:root {
  --brand: #04774A;
  --brand-dark: #05613C;
  --brand-light: #E8F3EE;
  --brand-primary: #04774A;
  --brand-primary-dark: #05613C;
  --brand-primary-light: #E8F3EE;
  --navbar-bg: #296042;
  --pos: #1E8E5A;
  --warn: #D68910;
  --neg: #C0392B;
  --info: #2C6E9B;
  --bg: #F4F6F5;
  --surface: #FFFFFF;
  --ink: #1A2420;
  --muted: #6B7A74;
  --hairline: #E4E9E7;
  --bs-primary: #04774A;
  --bs-primary-rgb: 4, 119, 74;
  --bs-link-color: #04774A;
  --bs-link-hover-color: #05613C;
  --font-display: "Onest", -apple-system, "Segoe UI", sans-serif;
  --font-body: "Golos Text", -apple-system, "Segoe UI", sans-serif;
  --font-primary: var(--font-display);
  --font-secondary: var(--font-body);
  --shadow-card: 0 1px 2px rgba(16, 40, 30, 0.04), 0 4px 16px rgba(16, 40, 30, 0.06);
  --radius-card: 16px;
  --radius-accent: 20px;
  --comp-critical-start: #c0392b;
  --comp-critical-end: #e74c3c;
  --comp-notice-start: #d68910;
  --comp-notice-end: #f5b041;
  --comp-lead-start: #04774A;
  --comp-lead-end: #27ae60;
  --comp-muted-start: #6c7a89;
  --comp-muted-end: #95a5a6;
  --comp-neg-start: #e74c3c;
  --comp-neg-end: #f1948a;
  --comp-neg-muted-start: #bdc3c7;
  --comp-neg-muted-end: #d5dbdb;
  --comp-pos-start: #04774A;
  --comp-pos-end: #58d68d;
  --comp-pos-muted-start: #a9dfbf;
  --comp-pos-muted-end: #d5f5e3;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background-color: var(--bg);
  font-variant-numeric: tabular-nums;
}

h1, h2, h3, h4, h5, h6,
.metric-value,
.pharmacy-highlight-label,
.oko-section-title {
  font-family: var(--font-display);
  font-weight: 600;
}

.card,
.table,
.alert,
.list-group-item {
  font-family: var(--font-body);
}

.navbar,
.navbar-brand,
.navbar-nav,
.nav-link,
.form-select,
.filter-bar,
.btn {
  font-family: var(--font-secondary);
}

.navbar-app {
  --bs-navbar-bg: var(--navbar-bg);
  --bs-navbar-color: rgba(255, 255, 255, 0.92);
  --bs-navbar-hover-color: #ffffff;
  --bs-navbar-active-color: #ffffff;
  --bs-navbar-brand-color: #ffffff;
  --bs-navbar-brand-hover-color: #ffffff;
  --bs-navbar-toggler-border-color: rgba(255, 255, 255, 0.45);
  background-color: var(--navbar-bg) !important;
  font-family: var(--font-secondary);
}

.navbar-app .navbar-brand {
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  margin-right: 1rem;
}

.navbar-app .navbar-brand,
.navbar-app .navbar-nav,
.navbar-app .nav-link,
.navbar-app .navbar-text,
.navbar-app .btn {
  font-family: Roboto, Ubuntu, Arial, Helvetica, sans-serif;
  font-weight: 500;
}

.navbar-app .navbar-text {
  font-weight: 400;
  font-size: 0.9rem;
}

.navbar-app .nav-link {
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.navbar-brand {
  font-weight: 500;
  letter-spacing: 0.01em;
}

.navbar-brand img {
  display: block;
  height: 40px;
  width: auto;
  max-width: min(180px, 50vw);
}

.btn-primary {
  --bs-btn-bg: var(--brand-primary);
  --bs-btn-border-color: var(--brand-primary);
  --bs-btn-hover-bg: var(--brand-primary-dark);
  --bs-btn-hover-border-color: var(--brand-primary-dark);
  --bs-btn-active-bg: var(--brand-primary-dark);
  --bs-btn-active-border-color: var(--brand-primary-dark);
  --bs-btn-disabled-bg: var(--brand-primary);
  --bs-btn-disabled-border-color: var(--brand-primary);
}

.btn-outline-primary {
  --bs-btn-color: var(--brand-primary);
  --bs-btn-border-color: var(--brand-primary);
  --bs-btn-hover-bg: var(--brand-primary);
  --bs-btn-hover-border-color: var(--brand-primary);
  --bs-btn-active-bg: var(--brand-primary-dark);
  --bs-btn-active-border-color: var(--brand-primary-dark);
}

.badge.bg-primary,
.bg-primary {
  background-color: var(--brand-primary) !important;
}

.text-primary {
  color: var(--brand-primary) !important;
}

.card {
  border: none;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  background: var(--surface);
}

.oko-card {
  border: none;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  background: var(--surface);
}

.metric-card {
  min-height: 110px;
  border: none;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  border-left: 4px solid var(--brand);
  background: var(--surface);
}

.metric-card--warn { border-left-color: var(--warn); }
.metric-card--neg { border-left-color: var(--neg); }
.metric-card--info { border-left-color: var(--info); }

/* KPI grid (replaces carousel) */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
  gap: 0.65rem;
  align-items: stretch;
}

.kpi-grid__link {
  display: block;
  color: inherit;
  height: 100%;
}

.kpi-grid__link .metric-card,
.kpi-grid > .metric-card {
  height: 100%;
}

.kpi-grid .metric-card--tile .card-body {
  min-height: 6.5rem;
}

/* ASS heatmap cells */
.heatmap-ass-cell {
  border-radius: 4px;
  font-size: 0.75rem;
  line-height: 1.35;
  min-height: 1.6rem;
}

.heatmap-cell--good {
  background: #eef2f0 !important;
  color: #6c757d !important;
}

.heatmap-cell--bad {
  background: #dc3545 !important;
  color: #fff !important;
  font-weight: 600;
}

.heatmap-cell--warn {
  background: #ffc107 !important;
  color: #212529 !important;
}

.heatmap-cell--neutral {
  background: #e9ecef !important;
  color: #495057 !important;
}

.heatmap-cell--sparse {
  background: transparent !important;
  color: #ced4da !important;
  font-size: 0.7rem;
}

.heatmap-legend-swatch {
  display: inline-block;
  width: 1rem;
  height: 0.75rem;
  border-radius: 2px;
  vertical-align: -2px;
  margin-right: 0.15rem;
}

.reviews-drill {
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.reviews-drill:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.reviews-drill--active {
  outline: 2px solid var(--brand-primary, #04774a);
  outline-offset: 2px;
}

.topic-negative-tile.reviews-drill:hover {
  transform: translateY(-2px);
}

@media (max-width: 767.98px) {
  #reviewsDrawer.offcanvas-bottom {
    max-height: 75vh;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
  }
}

/* KPI carousel above the chart: 5 tiles visible, one-tile smooth steps */
.kpi-carousel {
  --kpi-gap: 0.65rem;
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
}

.kpi-carousel__nav {
  flex: 0 0 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d5e0da;
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 1.75rem;
  line-height: 1;
  padding: 0;
  box-shadow: var(--shadow-card);
  cursor: pointer;
}

.kpi-carousel__nav:hover:not(:disabled) {
  border-color: var(--brand);
  color: var(--brand);
}

.kpi-carousel__nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.kpi-carousel__viewport {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.kpi-carousel__track {
  display: flex;
  align-items: stretch;
  gap: var(--kpi-gap);
  will-change: transform;
  transition: transform 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.kpi-carousel__slide {
  flex: 0 0 auto;
  min-width: 0;
}

.kpi-carousel__slide > .metric-card,
.kpi-carousel__slide > .kpi-carousel__link {
  height: 100%;
}

.kpi-carousel__link {
  display: block;
  min-width: 0;
  color: inherit;
  height: 100%;
}

.kpi-carousel__link:disabled,
.kpi-carousel__link[disabled] {
  opacity: 0.85;
  cursor: default;
}

.kpi-carousel__link .metric-card {
  height: 100%;
}

.kpi-carousel .metric-card--tile {
  min-height: 8.25rem;
  height: 100%;
}

.kpi-carousel .metric-card--tile .card-body {
  padding: 0.7rem 0.8rem;
  min-height: 8.25rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

@media (prefers-reduced-motion: reduce) {
  .kpi-carousel__track {
    transition: none;
  }
}

.kpi-carousel .metric-label {
  font-size: 0.72rem;
  margin-bottom: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-carousel .metric-value {
  font-size: clamp(1.25rem, 2.2vw, 1.7rem);
  line-height: 1.1;
  margin-bottom: 0.15rem;
}

.kpi-carousel .metric-sub {
  font-size: 0.68rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-carousel .delta-pill {
  font-size: 0.68rem;
  padding: 0.1rem 0.35rem;
  margin-top: 0.15rem;
}

.health-risks-panel {
  scroll-margin-top: 1rem;
}

.health-risk-card {
  border: none;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  border-left: 4px solid var(--neg);
  background: var(--surface);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.health-risk-card:hover {
  box-shadow: 0 6px 20px rgba(180, 35, 24, 0.12);
  transform: translateY(-1px);
}

.health-risk-card--overdue {
  border-left-color: #b42318;
  background: #fff5f5;
}

.health-risks-open .metric-card {
  cursor: pointer;
}

.health-risks-open .metric-card:hover {
  box-shadow: 0 6px 20px rgba(180, 35, 24, 0.1);
}

.metric-value {
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  font-weight: 700;
  color: var(--brand-dark);
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
}

.metric-label {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: var(--font-display);
}

.delta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.delta-pill--pos { background: #E8F6EF; color: var(--pos); }
.delta-pill--neg { background: #FCEEEC; color: var(--neg); }
.delta-pill--muted { background: var(--hairline); color: var(--muted); }

.alert-banner {
  border: none;
  border-radius: 12px;
  border-left: 4px solid;
  box-shadow: var(--shadow-card);
}

.alert-banner--danger {
  border-left-color: var(--neg);
  background: #FCEEEC;
}

.alert-banner--warning {
  border-left-color: var(--warn);
  background: #FEF5E7;
}

.alert-banner--info {
  border-left-color: var(--info);
  background: #EBF3F8;
}

.filter-chips {
  position: relative;
}

.filter-chips > summary {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  list-style: none;
}

.filter-chips > summary::-webkit-details-marker {
  display: none;
}

.filter-chips > summary::after {
  content: "▾";
  font-size: 0.75rem;
  transition: transform 0.15s ease;
}

.filter-chips[open] > summary::after {
  transform: rotate(180deg);
}

.filter-chips > .filter-bar {
  position: absolute;
  z-index: 1050;
  top: calc(100% + 0.4rem);
  right: 0;
  display: grid !important;
  grid-template-columns: repeat(4, minmax(8.5rem, 1fr));
  width: min(42rem, calc(100vw - 2rem));
  margin-top: 0 !important;
  padding: 0.8rem !important;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(16, 40, 30, 0.16);
}

.filter-chips > .filter-bar .form-select {
  width: 100%;
  min-width: 0 !important;
}

@media (max-width: 767.98px) {
  .filter-chips > .filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .pharmacy-highlight-tile,
  .metric-card,
  .rating-bar,
  .neg-bar {
    transition: none !important;
    animation: none !important;
  }
}

.table-worst {
  background: var(--brand-primary-light);
}

.overdue {
  color: #c0392b;
  font-weight: 600;
}

.badge-platform-yandex {
  background-color: #fc3f1d !important;
}

.badge-platform-apteka {
  background-color: #2563eb !important;
  color: #fff !important;
}

.badge-platform-callcenter {
  background-color: #0E5C43 !important;
  color: #fff !important;
}

.login-card {
  border-top: 4px solid var(--brand-primary);
}

.login-main {
  min-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 2rem;
  padding-bottom: 2rem;
}

.login-wrap {
  width: 100%;
}

.login-logo {
  max-width: 100%;
  max-height: 140px;
  width: auto;
  height: auto;
}

@media (max-width: 576px) {
  .metric-value {
    font-size: 1.35rem;
  }

  .navbar-brand img {
    height: 30px;
  }
}

.star-rating {
  color: #f5a623;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.sparkline {
  display: block;
}

.dashboard-chart {
  position: relative;
  height: 220px;
  width: 100%;
}

.dashboard-chart canvas {
  display: block;
}

.pharmacy-highlight-tile {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 96px;
  height: 100%;
  padding: 12px 14px;
  border-radius: 20px;
  color: #fff;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.pharmacy-highlight-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.14);
  color: #fff;
}

.pharmacy-highlight-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.85;
  margin-bottom: 2px;
}

.pharmacy-highlight-name {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pharmacy-highlight-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
}

.pharmacy-highlight-hint {
  font-size: 0.72rem;
  opacity: 0.88;
  margin-top: 4px;
}

.pharmacy-highlight--best-rating {
  background: linear-gradient(145deg, #035a39 0%, #0a9d62 55%, #2ecc71 100%);
}

.pharmacy-highlight--worst-rating {
  background: linear-gradient(145deg, #922b21 0%, #c0392b 55%, #e74c3c 100%);
}

.pharmacy-highlight--best-response {
  background: linear-gradient(145deg, #1a5276 0%, #1a6b8a 50%, #48c9b0 100%);
}

.pharmacy-highlight--worst-response {
  background: linear-gradient(145deg, #9a7d0a 0%, #d68910 50%, #f39c12 100%);
}

.neg-bar-wrap {
  position: relative;
  min-width: 64px;
  height: 1.25rem;
  background: #eef2f0;
  border-radius: 3px;
  overflow: hidden;
}

.neg-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: rgba(192, 57, 43, 0.35);
  max-width: 100%;
}

.neg-bar-wrap span {
  position: relative;
  z-index: 1;
  padding: 0 4px;
  font-size: 0.75rem;
}

.rating-bar-wrap {
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.rating-bar {
  width: 100%;
  min-height: 2px;
  border-radius: 2px 2px 0 0;
}

.rating-bar-1, .rating-bar-2 { background: #c0392b; }
.rating-bar-3 { background: #f5a623; }
.rating-bar-4, .rating-bar-5 { background: #04774A; }

.rating-bar-outline {
  position: absolute;
  bottom: 0;
  left: 10%;
  right: 10%;
  border: 1px solid #aaa;
  background: transparent;
  opacity: 0.5;
}

/* --- Темы негатива: градиентные плитки --- */
.topic-negative-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.65rem;
}

.topic-negative-tile {
  --heat: 0.5;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 5.5rem;
  padding: 0.75rem 0.85rem;
  border-radius: 14px;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(
    145deg,
    color-mix(in srgb, #9aa3ad calc((1 - var(--heat)) * 100%), #8b2418 calc(var(--heat) * 100%)),
    color-mix(in srgb, #c5cbd3 calc((1 - var(--heat)) * 100%), #e74c3c calc(var(--heat) * 100%))
  );
  box-shadow: 0 3px 12px color-mix(in srgb, #c0392b calc(var(--heat) * 35%), transparent);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.topic-negative-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px color-mix(in srgb, #c0392b calc(var(--heat) * 45%), rgba(0, 0, 0, 0.08));
  color: #fff;
}

.topic-negative-tile--muted {
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.topic-negative-tile--muted:hover {
  color: var(--ink);
}

.topic-negative-count {
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.topic-negative-label {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.25;
  margin-top: 0.2rem;
}

.topic-negative-delta {
  font-size: 0.68rem;
  margin-top: 0.35rem;
  opacity: 0.92;
}

.topic-negative-tile--muted .topic-negative-delta.is-up { color: #922b21; font-weight: 600; }
.topic-negative-tile--muted .topic-negative-delta.is-down { color: #04774A; font-weight: 600; }

/* --- Распределение оценок --- */
.rating-dist-chart {
  display: flex;
  flex-direction: column;
  padding-top: 0.25rem;
  min-height: 16rem;
}

.rating-dist-bars {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0.75rem;
  flex: 1 1 auto;
  min-height: 14rem;
  padding: 0 0.25rem 0.35rem;
  border-bottom: 1px solid var(--hairline);
}

.rating-dist-col {
  flex: 1 1 0;
  max-width: 4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  min-height: 100%;
}

.rating-dist-value {
  font-size: 0.8125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  min-height: 1.1rem;
  flex: 0 0 auto;
}

.rating-dist-track {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-height: 10rem;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.03) 0%, transparent 100%);
  border-radius: 10px 10px 4px 4px;
}

.rating-dist-bar {
  position: relative;
  z-index: 2;
  width: 72%;
  min-height: 0;
  border-radius: 8px 8px 4px 4px;
  transition: height 300ms ease;
}

.rating-dist-bar--1,
.rating-dist-bar--2 {
  background: linear-gradient(180deg, #e74c3c 0%, #c0392b 100%);
  box-shadow: 0 2px 8px rgba(192, 57, 43, 0.25);
}

.rating-dist-bar--3 {
  background: linear-gradient(180deg, #f5b041 0%, #d68910 100%);
  box-shadow: 0 2px 8px rgba(214, 137, 16, 0.2);
}

.rating-dist-bar--4,
.rating-dist-bar--5 {
  background: linear-gradient(180deg, #27ae60 0%, #04774A 100%);
  box-shadow: 0 2px 8px rgba(4, 119, 74, 0.22);
}

.rating-dist-ghost {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 88%;
  border: 2px dashed rgba(0, 0, 0, 0.12);
  border-radius: 8px 8px 4px 4px;
  background: transparent;
  z-index: 1;
  pointer-events: none;
}

.rating-dist-star {
  flex: 0 0 auto;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink);
}

.rating-dist-legend {
  font-size: 0.75rem;
}

.pharmacy-sort-link {
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.pharmacy-sort-link:hover {
  color: var(--brand);
}

.pharmacy-sort-link.is-active {
  color: var(--brand);
  font-weight: 600;
}

.pharmacy-list-table thead th {
  vertical-align: bottom;
  font-size: 0.8125rem;
}

.pharmacy-oko-summary .card {
  border: 0;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.pharmacy-oko-hero {
  border: 0;
  border-radius: var(--radius-card);
  background: linear-gradient(135deg, #fff 0%, var(--brand-light) 135%);
  box-shadow: var(--shadow-card);
}

.oko-advice-item {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.48rem 0.62rem;
  border-radius: 10px;
  font-size: 0.82rem;
}

.oko-advice-item + .oko-advice-item {
  margin-top: 0.4rem;
}

.oko-advice-item--positive {
  background: rgba(25, 135, 84, 0.08);
  color: #276441;
}

.oko-advice-item--negative {
  background: rgba(181, 71, 71, 0.08);
  color: #8c3d39;
}

.oko-advice-item:hover {
  filter: brightness(0.97);
}

.oko-history-card {
  padding: 0.6rem 0.7rem;
  border: 1px solid #e4ebe7;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.pharmacy-rating-chart {
  position: relative;
  min-height: 300px;
  height: 36vh;
  max-height: 390px;
}

.pharmacy-attention-grid .metric-card {
  border: 0;
  box-shadow: var(--shadow-card);
}

.pharmacy-card-photo {
  width: 102px;
}

.pharmacy-card-photo img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 10px;
}

.review-photos-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.review-photo-item {
  width: 140px;
}

.review-photo-link img {
  width: 132px;
  height: 132px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.08));
}

.review-photo-vision .badge {
  margin-right: 4px;
}

.pharmacy-oko-table {
  min-width: 1120px;
}

.pharmacy-oko-table th:first-child {
  min-width: 250px;
}

.pharmacy-oko-table th:last-child {
  min-width: 300px;
}

.pharmacy-oko-table tbody tr {
  transition: background-color 140ms ease;
}

.pharmacy-oko-table tbody tr:hover td {
  background-color: rgba(4, 119, 74, 0.035);
}

.pharmacy-oko-below-target td:first-child {
  border-left: 3px solid #f0ad4e;
}

.pharmacy-oko-score-cell {
  font-variant-numeric: tabular-nums;
}

.pharmacy-oko-score-cell .fw-bold {
  font-size: 1.25rem;
}

.pharmacy-source-ratings {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  margin-top: 0.25rem;
}

.pharmacy-source-ratings span {
  padding: 0.12rem 0.35rem;
  border-radius: 999px;
  background: #f3f6f4;
  color: #66706b;
  font-size: 0.68rem;
  white-space: nowrap;
}

.pharmacy-oko-reasons {
  min-width: 300px;
}

.oko-reason-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
}

.oko-reason-group + .oko-reason-group {
  margin-top: 0.35rem;
}

.oko-reason-label {
  min-width: 3.4rem;
  font-size: 0.72rem;
  font-weight: 700;
}

.oko-reason-group--positive .oko-reason-label {
  color: #198754;
}

.oko-reason-group--negative .oko-reason-label {
  color: #b54747;
}

.oko-reason-chip {
  padding: 0.18rem 0.42rem;
  border-radius: 999px;
  background: #eef8f2;
  color: #276441;
  font-size: 0.72rem;
}

.oko-reason-group--negative .oko-reason-chip {
  background: #fff1f0;
  color: #a33b36;
}

.oko-history {
  margin-top: 0.5rem;
  font-size: 0.78rem;
}

.oko-history summary {
  color: var(--brand);
  cursor: pointer;
  font-weight: 600;
}

.oko-history-list {
  margin-top: 0.5rem;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  background: #f8faf9;
}

.oko-history-item + .oko-history-item {
  margin-top: 0.45rem;
  padding-top: 0.45rem;
  border-top: 1px solid #e5ebe7;
}

.display-name-cell {
  cursor: pointer;
  border-bottom: 1px dashed #ccc;
}

/* --- Конкурентная среда --- */
.comp-attention-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

@media (max-width: 767px) {
  .comp-attention-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.comp-segment-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  min-height: 108px;
  padding: 0.85rem 1rem;
  border: none;
  border-radius: 16px;
  color: #fff;
  text-align: left;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  transition: transform 150ms ease, box-shadow 150ms ease;
  cursor: pointer;
}

.comp-segment-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
}

.comp-segment-tile.is-active {
  outline: 2px solid #fff;
  outline-offset: -2px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.2);
}

.comp-segment-tile.is-active::after {
  content: "▼";
  position: absolute;
  bottom: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  color: #555;
}

.comp-segment-tile--muted {
  opacity: 0.85;
}

.comp-segment-count {
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.15rem;
}

.comp-segment-label {
  font-size: 0.95rem;
  font-weight: 600;
}

.comp-segment-hint {
  font-size: 0.68rem;
  opacity: 0.88;
  margin-top: 0.2rem;
  line-height: 1.2;
}

.comp-segment-tile--critical {
  background: linear-gradient(135deg, var(--comp-critical-start), var(--comp-critical-end));
}

.comp-segment-tile--noticeable {
  background: linear-gradient(135deg, var(--comp-notice-start), var(--comp-notice-end));
}

.comp-segment-tile--leading {
  background: linear-gradient(135deg, var(--comp-lead-start), var(--comp-lead-end));
}

.comp-segment-tile--low_data {
  background: linear-gradient(135deg, var(--comp-muted-start), var(--comp-muted-end));
}

.comp-attention-list-wrap {
  margin-top: 1.25rem;
}

.comp-attention-card {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid #e8ecea;
}

.comp-attention-card:last-child {
  border-bottom: none;
}

.comp-attention-stripe {
  flex-shrink: 0;
  width: 4px;
  border-radius: 2px;
  align-self: stretch;
}

.comp-attention-stripe--critical { background: var(--comp-critical-end); }
.comp-attention-stripe--noticeable { background: var(--comp-notice-end); }
.comp-attention-stripe--leading { background: var(--comp-lead-end); }
.comp-attention-stripe--low_data { background: var(--comp-muted-end); }

.comp-gap-pill {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}

.comp-gap-pill--critical { background: var(--comp-critical-end); }
.comp-gap-pill--noticeable { background: var(--comp-notice-end); }
.comp-gap-pill--leading { background: var(--comp-lead-end); }

.comp-attention-card--muted {
  opacity: 0.65;
}

.comp-mode-toggle {
  display: inline-flex;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #dfe8e3;
  margin-bottom: 1rem;
}

.comp-mode-btn {
  border: none;
  background: #fff;
  padding: 0.45rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}

.comp-mode-btn.is-active[data-mode="neg"] {
  background: linear-gradient(135deg, var(--comp-neg-start), var(--comp-neg-end));
  color: #fff;
}

.comp-mode-btn.is-active[data-mode="pos"] {
  background: linear-gradient(135deg, var(--comp-pos-start), var(--comp-pos-end));
  color: #fff;
}

.comp-butterfly-insight {
  font-size: 0.9rem;
  color: #4a5568;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: #fff;
  border-radius: 8px;
  border-left: 3px solid var(--brand-primary);
}

.comp-butterfly-row {
  display: grid;
  grid-template-columns: 1fr 160px 1fr;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.comp-butterfly-side {
  display: flex;
  align-items: center;
  min-height: 2rem;
}

.comp-butterfly-side--own {
  justify-content: flex-end;
}

.comp-butterfly-side--comp {
  justify-content: flex-start;
}

.comp-butterfly-bar {
  position: relative;
  height: 1.75rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  transition: width 400ms ease;
  min-width: 2px;
  cursor: pointer;
  border: none;
  padding: 0 0.4rem;
}

.comp-butterfly-bar--own-neg {
  background: linear-gradient(90deg, var(--comp-neg-start), var(--comp-neg-end));
  margin-left: auto;
}

.comp-butterfly-bar--comp-neg {
  background: linear-gradient(90deg, var(--comp-neg-muted-start), var(--comp-neg-muted-end));
  color: #555;
}

.comp-butterfly-bar--own-pos {
  background: linear-gradient(90deg, var(--comp-pos-start), var(--comp-pos-end));
  margin-left: auto;
}

.comp-butterfly-bar--comp-pos {
  background: linear-gradient(90deg, var(--comp-pos-muted-start), var(--comp-pos-muted-end));
  color: #555;
}

.comp-butterfly-bar-placeholder {
  width: 28%;
  height: 1.75rem;
  border-radius: 4px;
  background: repeating-linear-gradient(
    45deg,
    #ecf0f1,
    #ecf0f1 6px,
    #dfe6e9 6px,
    #dfe6e9 12px
  );
}

.comp-butterfly-topic {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.2;
  padding: 0 0.25rem;
}

.comp-collect-progress {
  font-size: 0.8rem;
  padding: 0.65rem 0.75rem;
  background: #f4f6f5;
  border-radius: 10px;
  margin-bottom: 0.75rem;
}

.comp-collect-progress-bar {
  height: 6px;
  background: #dfe8e3;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.35rem;
}

.comp-collect-progress-fill {
  height: 100%;
  background: var(--brand-primary);
  border-radius: 3px;
  transition: width 400ms ease;
}

.comp-topic-reviews {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #dfe8e3;
}

@media (max-width: 639px) {
  .comp-butterfly-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .comp-butterfly-topic {
    text-align: left;
    font-weight: 600;
    padding-top: 0.35rem;
  }

  .comp-butterfly-side--own,
  .comp-butterfly-side--comp {
    justify-content: stretch;
  }

  .comp-butterfly-bar {
    width: 100% !important;
    margin-left: 0 !important;
  }

  .comp-butterfly-side--own::before {
    content: "Мы";
    font-size: 0.7rem;
    color: #888;
    display: block;
    margin-bottom: 0.15rem;
  }

  .comp-butterfly-side--comp::before {
    content: "Конкуренты";
    font-size: 0.7rem;
    color: #888;
    display: block;
    margin-bottom: 0.15rem;
  }
}

.heatmap-aspect-table .heatmap-col-header {
  min-width: 4.5rem;
  max-width: 6.5rem;
  vertical-align: bottom;
  white-space: normal;
  line-height: 1.15;
  padding: 0.35rem 0.2rem;
  font-size: 0.72rem;
}

@media (max-width: 768px) {
  .heatmap-aspect-table th:first-child,
  .heatmap-aspect-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--surface);
  }
}

.hours-matrix td.table-warning,
.hours-matrix tr.table-warning td {
  background: #FEF5E7 !important;
}

.score-heatmap th,
.score-heatmap td {
  font-variant-numeric: tabular-nums;
  font-size: 0.875rem;
}

.score-heatmap .score-comp-col {
  min-width: 4.5rem;
  max-width: 6.5rem;
  vertical-align: bottom;
}

.score-heatmap .score-actions-col {
  min-width: 12rem;
}

.score-heatmap .score-actions-cell {
  font-size: 0.8125rem;
  line-height: 1.35;
}

.score-action-line + .score-action-line {
  margin-top: 0.25rem;
  padding-top: 0.25rem;
  border-top: 1px solid var(--oko-border, #e9ecef);
}

.inbox-list .list-group-item {
  border-color: var(--hairline);
}

.inbox-item__text {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.inbox-item__tag {
  min-width: 9.5rem;
  max-width: 100%;
}

@media (min-width: 1200px) {
  .inbox-item__aside {
    width: 17.5rem;
    max-width: 17.5rem;
  }

  .inbox-item__aside .d-flex.flex-wrap.gap-1 {
    justify-content: flex-end;
  }
}

.cc-appeal-card {
  transition: transform .12s ease, box-shadow .12s ease;
}
.cc-appeal-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .08);
}

button.topic-negative-tile,
a.topic-negative-tile {
  border: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
  color: inherit;
}

.rating-dist-col.is-clickable {
  cursor: pointer;
}

.rating-dist-col.is-clickable:hover .rating-dist-bar {
  opacity: 0.85;
}

.org-search-wrap {
  position: relative;
}

.org-search-dropdown {
  display: none;
  position: absolute;
  z-index: 1050;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 0.375rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  margin-top: 2px;
}

.org-search-dropdown.is-open {
  display: block;
}

.org-search-dropdown__item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 0.5rem 0.75rem;
}

.org-search-dropdown__item:hover {
  background: rgba(4, 119, 74, 0.08);
}

.org-search-dropdown__empty {
  padding: 0.5rem 0.75rem;
  color: #6c757d;
  font-size: 0.875rem;
}

/* Dashboard top — OKO hero + soft KPI tiles (стиль Сантем) */
.dashboard-top .col-lg-8 > .row > [class*="col-"] {
  min-width: 0;
}

.oko-score-block {
  background: linear-gradient(135deg, #fff 0%, var(--brand-light) 120%);
  border: none;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  width: 100%;
}

.metric-card-soft {
  background: linear-gradient(135deg, #fff 0%, var(--brand-light) 120%);
  border-left: none;
}

.dashboard-top .metric-card {
  border-left: none;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  background: linear-gradient(135deg, #fff 0%, var(--brand-light) 120%);
  min-height: 0;
}

.metric-card-clickable {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}

.metric-card-clickable:hover:not(:disabled) {
  box-shadow: var(--shadow-card), 0 6px 28px rgba(4, 119, 74, 0.1);
}

.metric-card-clickable:disabled {
  opacity: 0.65;
  cursor: default;
}

.oko-score-block .card-body,
.dashboard-top .metric-card .card-body {
  min-width: 0;
  padding: 1rem 1.1rem;
}

.oko-score-value {
  font-family: var(--font-display);
  font-size: clamp(3.75rem, 7vw, 5rem);
  font-weight: 700;
  line-height: 1;
  color: var(--brand-dark);
}

.oko-score-good { color: var(--pos); }
.oko-score-mid { color: var(--warn); }
.oko-score-bad { color: var(--neg); }

.oko-delta-up { color: var(--pos); font-weight: 600; }
.oko-delta-down { color: var(--neg); font-weight: 600; }

.oko-aspect-title--pos { color: var(--pos); }
.oko-aspect-title--neg { color: var(--neg); }

.oko-aspect-title {
  margin-bottom: 0.35rem;
}

.oko-aspect-group + .oko-aspect-group {
  border-top: 1px solid rgba(4, 119, 74, 0.12);
  padding-top: 0.75rem;
}

.oko-aspect-list {
  line-height: 1.35;
}

.oko-aspect-list a:hover {
  text-decoration: underline !important;
}

/* Единый рабочий раздел отзывов */
.review-workspace-tabs .btn {
  border-radius: 999px;
}

.review-workspace-filters {
  border: none;
  box-shadow: var(--shadow-card);
}

.review-rating-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-height: 31px;
  align-items: center;
}

.review-rating-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.35rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8125rem;
  line-height: 1.2;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  user-select: none;
  margin: 0;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.review-rating-chip:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.review-rating-chip.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.review-workspace-table {
  border: none;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.review-workspace-table table {
  min-width: 960px;
}

.review-workspace-table thead th {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--bg);
}

.review-workspace-main {
  min-width: 22rem;
  max-width: 34rem;
}

.review-workspace-open {
  width: 100%;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.review-workspace-open:hover .review-workspace-text {
  color: var(--brand);
  text-decoration: underline;
}

.nav-tabs-sm .nav-link {
  font-size: 0.85rem;
  padding: 0.35rem 0.75rem;
  color: var(--muted);
  border: none;
  border-bottom: 2px solid transparent;
}

.nav-tabs-sm .nav-link.active {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--brand);
  background: transparent;
}

.review-item.review-negative {
  border-left: 3px solid #e07a5f;
}

.dashboard-chart-row {
  align-items: flex-start;
}

.dashboard-chart-row > [class*="col-"] {
  min-height: 0;
}

.dashboard-chart-side {
  display: flex;
  min-height: 0;
}

.dashboard-recent-card {
  min-height: 0;
  overflow: hidden;
}

.dashboard-recent-list {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  overscroll-behavior: contain;
}

.dashboard-recent-card .list-group-item {
  padding: 0.85rem 1.1rem;
}

.dashboard-recent-item {
  cursor: pointer;
  transition: background 0.15s ease;
}

.dashboard-recent-item:hover,
.dashboard-recent-item:focus-visible {
  background: var(--brand-light);
  outline: none;
}

.dashboard-recent-list .review-preview {
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.45;
  color: var(--ink);
  white-space: normal;
}

.review-workspace-text {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.review-row-overdue > * {
  background: #fff7f6 !important;
}

.review-workspace-panel {
  width: min(34rem, 100vw) !important;
}

.review-workspace-panel-text {
  white-space: pre-wrap;
  line-height: 1.55;
}
