/* ── CSS Variables ──────────────────────────────────────────── */
:root {
  --bg: #FAFAF7;
  --card: #FFFFFF;
  --line: #E8E7E1;
  --ink: #1A1A16;
  --ink-2: #4A4A42;
  --ink-3: #8A8A86;
  --accent: #FF5C26;
  --grade-a: #1F7A4C;
  --grade-b: #3D6CC8;
  --grade-c: #C28E1F;
  --grade-d: #C45A1F;
  --grade-f: #B22330;
  --radius: 12px;
  --radius-sm: 8px;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Geist Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0;
}

.logo-mark {
  width: 42px;
  height: 28px;
  background: var(--accent);
  color: #fff;
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.04em;
}

.topbar-title {
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: 18px;
  color: var(--ink);
  margin-left: 12px;
}

.topbar-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.sync-label {
  font-size: 12px;
  color: var(--ink-3);
}

.topbar-right {
  display: flex;
  align-items: center;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.02em;
}

/* ── Filter Bar ─────────────────────────────────────────────── */
.filter-bar {
  position: sticky;
  top: 56px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 10px 24px;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}

.filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-chip {
  height: 30px;
  padding: 0 12px;
  border-radius: 100px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-2);
  font-family: inherit;
  transition: background 120ms, color 120ms, border-color 120ms;
  white-space: nowrap;
}

.filter-chip:hover {
  background: #F0EFE9;
}

.filter-chip.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

/* Grade-specific active colors */
.grade-chip[data-grade="A"].active { background: var(--grade-a); border-color: var(--grade-a); }
.grade-chip[data-grade="B"].active { background: var(--grade-b); border-color: var(--grade-b); }
.grade-chip[data-grade="C"].active { background: var(--grade-c); border-color: var(--grade-c); }
.grade-chip[data-grade="D"].active { background: var(--grade-d); border-color: var(--grade-d); }
.grade-chip[data-grade="F"].active { background: var(--grade-f); border-color: var(--grade-f); }

#staleFilter.active {
  background: #FFF3E0;
  color: var(--grade-d);
  border-color: var(--grade-d);
}

.search-input {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  width: 220px;
  outline: none;
  background: var(--bg);
  transition: border-color 150ms;
}

.search-input::placeholder {
  color: var(--ink-3);
}

.search-input:focus {
  border-color: var(--ink-3);
  background: #fff;
}

/* ── Main Content ───────────────────────────────────────────── */
.main-content {
  padding-top: 24px;
  padding-bottom: 48px;
  max-width: 1400px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
  margin-top: 112px; /* topbar(56) + filter-bar(56) */
}

/* ── KPI Row ────────────────────────────────────────────────── */
.kpi-row {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 24px;
  min-width: 0;
}

.kpi-value {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 40px;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.kpi-value .kpi-unit {
  font-size: 20px;
  color: var(--ink-3);
  font-weight: 400;
  margin-left: 2px;
}

.kpi-value.good { color: var(--grade-a); }
.kpi-value.bad  { color: var(--grade-f); }

.kpi-label {
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 8px;
  font-weight: 500;
}

/* ── Analytics Grid ─────────────────────────────────────────── */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 8px;
}

.card-title {
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: 16px;
  color: var(--ink);
}

.card-subtitle {
  font-size: 12px;
  color: var(--ink-3);
}

/* ── Grade Distribution Bars ────────────────────────────────── */
.grade-dist-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.grade-dist-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.grade-dist-label {
  width: 20px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Fraunces', serif;
  flex-shrink: 0;
}

.grade-dist-label.grade-a { color: var(--grade-a); }
.grade-dist-label.grade-b { color: var(--grade-b); }
.grade-dist-label.grade-c { color: var(--grade-c); }
.grade-dist-label.grade-d { color: var(--grade-d); }
.grade-dist-label.grade-f { color: var(--grade-f); }

.grade-dist-track {
  flex: 1;
  height: 8px;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.grade-dist-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.grade-dist-fill.grade-a { background: var(--grade-a); }
.grade-dist-fill.grade-b { background: var(--grade-b); }
.grade-dist-fill.grade-c { background: var(--grade-c); }
.grade-dist-fill.grade-d { background: var(--grade-d); }
.grade-dist-fill.grade-f { background: var(--grade-f); }

.grade-dist-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-3);
  width: 28px;
  text-align: right;
  flex-shrink: 0;
}

/* ── Score Averages ─────────────────────────────────────────── */
.channel-avg-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.avg-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.avg-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.avg-row-label {
  font-size: 13px;
  color: var(--ink-2);
}

.avg-row-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

.avg-track {
  height: 6px;
  background: var(--line);
  border-radius: 3px;
  overflow: hidden;
}

.avg-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.avg-fill.blue { background: var(--grade-b); }

.phase2-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-3);
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

/* ── Feature Adoption List ──────────────────────────────────── */
.feature-adopt-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feature-adopt-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.feature-adopt-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.feature-adopt-name {
  flex: 1;
  font-size: 12px;
  color: var(--ink-2);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feature-adopt-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-3);
  white-space: nowrap;
}

.feature-adopt-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 100px;
  background: #F0EFE9;
  color: var(--ink-2);
  white-space: nowrap;
}

/* ── Trend Card ─────────────────────────────────────────────── */
.trend-card {
  margin-bottom: 16px;
}

.trend-svg {
  width: 100%;
  height: 120px;
  display: block;
  margin-top: 8px;
}

.trend-placeholder {
  text-align: center;
  font-size: 13px;
  color: var(--ink-3);
  padding: 32px 0;
}

/* ── Table Section ──────────────────────────────────────────── */
.table-section {
  margin-top: 24px;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title {
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: 20px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  background: #F0EFE9;
  color: var(--ink-3);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  min-width: 28px;
}

.export-btn {
  padding: 7px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
}

.export-btn:hover {
  background: #F0EFE9;
  border-color: #D0CFC9;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.ctable {
  width: 100%;
  border-collapse: collapse;
}

.ctable thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  font-weight: 600;
  padding: 10px 16px;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
  background: #FAFAF7;
}

.ctable thead th:first-child {
  border-radius: var(--radius) 0 0 0;
}

.ctable thead th:last-child {
  border-radius: 0 var(--radius) 0 0;
}

.ctable td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.ctable tbody tr:last-child td {
  border-bottom: none;
}

.ctable tbody tr {
  cursor: pointer;
  transition: background 80ms;
}

.ctable tbody tr:hover,
.ctable tbody tr.selected {
  background: #F5F4F0;
}

.th-score {
  text-align: right;
}

.td-score {
  text-align: right;
}

/* ── Merchant Cell ──────────────────────────────────────────── */
.merchant-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  line-height: 1.3;
}

.merchant-id {
  font-size: 11px;
  color: var(--ink-3);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 2px;
}

/* ── Feature Dots ───────────────────────────────────────────── */
.dot-grid {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot.active {
  /* color set inline per feature */
}

.dot.inactive {
  border: 1.5px solid #D0CFC9;
  background: transparent;
}

/* ── Score Chips ────────────────────────────────────────────── */
.score-chips {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.grade-chip-sm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  width: fit-content;
}

.grade-chip-sm.grade-a { background: #EBF5EF; color: var(--grade-a); }
.grade-chip-sm.grade-b { background: #EBF0FB; color: var(--grade-b); }
.grade-chip-sm.grade-c { background: #FAF3E0; color: var(--grade-c); }
.grade-chip-sm.grade-d { background: #FBF0EB; color: var(--grade-d); }
.grade-chip-sm.grade-f { background: #FAEAEA; color: var(--grade-f); }
.grade-chip-sm.grade-na { background: #F0EFE9; color: var(--ink-3); }

/* ── Overall Score Cell ─────────────────────────────────────── */
.overall-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.score-num {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 24px;
  color: var(--ink);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* ── Grade Badge ─────────────────────────────────────────────── */
.grade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 13px;
}

.grade-badge.grade-a { background: #EBF5EF; color: var(--grade-a); }
.grade-badge.grade-b { background: #EBF0FB; color: var(--grade-b); }
.grade-badge.grade-c { background: #FAF3E0; color: var(--grade-c); }
.grade-badge.grade-d { background: #FBF0EB; color: var(--grade-d); }
.grade-badge.grade-f { background: #FAEAEA; color: var(--grade-f); }

/* ── Last Audit Cell ────────────────────────────────────────── */
.audit-date {
  font-size: 13px;
  color: var(--ink-2);
  white-space: nowrap;
}

.audit-date.stale {
  color: var(--grade-d);
}

.stale-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--grade-d);
  margin-right: 4px;
  vertical-align: middle;
  margin-top: -2px;
}

/* ── Empty State ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  color: var(--ink-3);
  padding: 48px 24px;
  font-size: 14px;
  line-height: 1.6;
}

.empty-state strong {
  display: block;
  font-size: 16px;
  color: var(--ink-2);
  margin-bottom: 6px;
  font-weight: 600;
}

/* ── Spinner ────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--ink-3);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner-large {
  width: 32px;
  height: 32px;
  border-width: 3px;
  margin: 40px auto;
  display: block;
}

/* ── Skeleton loading ────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #F0EFE9 25%, #E8E7E1 50%, #F0EFE9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-kpi {
  height: 88px;
  border-radius: var(--radius);
}

/* ── Backdrop ───────────────────────────────────────────────── */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.backdrop.open {
  opacity: 1;
  pointer-events: all;
}

/* ── Drawer ─────────────────────────────────────────────────── */
.drawer {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 720px;
  max-width: 100vw;
  background: var(--card);
  z-index: 300;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  overflow-y: auto;
  box-shadow: -4px 0 40px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
  transition: background 120ms;
}

.drawer-close:hover {
  background: #F0EFE9;
}

/* ── Drawer Hero ────────────────────────────────────────────── */
.drawer-hero {
  padding: 32px 32px 20px;
  display: flex;
  align-items: flex-end;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  padding-right: 64px;
}

.hero-grade {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 80px;
  line-height: 1;
  flex-shrink: 0;
}

.hero-grade.grade-a { color: var(--grade-a); }
.hero-grade.grade-b { color: var(--grade-b); }
.hero-grade.grade-c { color: var(--grade-c); }
.hero-grade.grade-d { color: var(--grade-d); }
.hero-grade.grade-f { color: var(--grade-f); }
.hero-grade.grade-na { color: var(--ink-3); }

.hero-info {
  flex: 1;
  min-width: 0;
  padding-bottom: 8px;
}

.hero-score {
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: 32px;
  color: var(--ink-2);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.hero-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-meta {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 4px;
  line-height: 1.5;
}

/* ── Drawer Tabs ────────────────────────────────────────────── */
.drawer-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  padding: 0 32px;
  flex-shrink: 0;
  overflow-x: auto;
}

.drawer-tab {
  padding: 12px 16px;
  font-size: 13px;
  font-family: inherit;
  border-bottom: 2px solid transparent;
  color: var(--ink-3);
  cursor: pointer;
  background: transparent;
  border-top: none;
  border-left: none;
  border-right: none;
  transition: color 120ms, border-color 120ms;
  white-space: nowrap;
}

.drawer-tab:hover {
  color: var(--ink-2);
}

.drawer-tab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

/* ── Drawer Body ────────────────────────────────────────────── */
.drawer-body {
  padding: 24px 32px;
  flex: 1;
  min-height: 400px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ── Overview Tab ───────────────────────────────────────────── */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.overview-stat {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.overview-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  font-weight: 600;
  margin-bottom: 8px;
}

.overview-stat-value {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 28px;
  line-height: 1;
  color: var(--ink);
}

.overview-stat-sub {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 4px;
}

/* ── Features Tab ───────────────────────────────────────────── */
.feature-table {
  width: 100%;
  border-collapse: collapse;
}

.feature-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  font-weight: 600;
  padding: 6px 0 10px;
  border-bottom: 1px solid var(--line);
}

.feature-table td {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.feature-table tbody tr:last-child td {
  border-bottom: none;
}

.feature-row-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 10px;
  display: inline-block;
  flex-shrink: 0;
}

.feature-row-name {
  display: flex;
  align-items: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

.feature-row-desc {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 2px;
}

.feature-score {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--ink-3);
  text-align: right;
}

/* ── Status Pills ───────────────────────────────────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.status-pill.active     { background: #EBF5EF; color: var(--grade-a); }
.status-pill.setup-only { background: #FAF3E0; color: #92600A; }
.status-pill.partial    { background: #FAF3E0; color: var(--grade-c); }
.status-pill.off        { background: #F0F0EC; color: var(--ink-3); }

.feature-usage-note {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 3px;
}

/* ── Orders Summary ─────────────────────────────────────────── */
.orders-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.orders-summary-item {
  text-align: center;
}

.orders-summary-val {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
}

.orders-summary-label {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 3px;
}

/* ── Images Tab ─────────────────────────────────────────────── */
.images-tab-layout {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

.donut-wrap {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.donut-label {
  font-size: 12px;
  color: var(--ink-3);
  text-align: center;
}

.donut-svg {
  width: 110px;
  height: 110px;
}

.donut-center-text {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 22px;
  fill: var(--ink);
  dominant-baseline: middle;
  text-anchor: middle;
}

.donut-center-sub {
  font-size: 10px;
  fill: var(--ink-3);
  dominant-baseline: middle;
  text-anchor: middle;
}

.images-info {
  flex: 1;
}

.images-stat-row {
  font-size: 14px;
  color: var(--ink-2);
  margin-bottom: 16px;
  line-height: 1.5;
}

.images-stat-row strong {
  font-weight: 600;
  color: var(--ink);
}

.yesno-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}

.yesno-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-2);
  padding: 8px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.yesno-icon {
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.yesno-icon.yes { color: var(--grade-a); }
.yesno-icon.no  { color: var(--ink-3); }
.yesno-icon.na  { color: var(--ink-3); font-weight: 400; }

.yesno-text {
  line-height: 1.3;
}

/* ── Notes Tab ──────────────────────────────────────────────── */
.notes-textarea {
  width: 100%;
  min-height: 200px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  resize: vertical;
  outline: none;
  line-height: 1.6;
}

.notes-textarea:focus {
  border-color: var(--ink-3);
  background: #fff;
}

.notes-hint {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 8px;
}

/* ── Drawer Footer ──────────────────────────────────────────── */
.drawer-footer {
  padding: 16px 32px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.btn {
  padding: 8px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
}

.btn:hover {
  background: var(--line);
}

.btn.primary {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.btn.primary:hover {
  background: #2A2A22;
}

/* ── Trend SVG elements ─────────────────────────────────────── */
.trend-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trend-area {
  fill: url(#trendGradient);
}

.trend-dot {
  fill: var(--accent);
}

.trend-label {
  font-size: 10px;
  fill: var(--ink-3);
  font-family: 'JetBrains Mono', monospace;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .analytics-grid {
    grid-template-columns: 1fr 1fr;
  }

  #featureAdoptCard {
    grid-column: 1 / -1;
  }

  .kpi-row {
    flex-wrap: wrap;
  }

  .kpi-card {
    min-width: calc(50% - 8px);
  }
}

@media (max-width: 768px) {
  .main-content {
    padding-left: 16px;
    padding-right: 16px;
  }

  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .kpi-row {
    gap: 10px;
  }

  .kpi-card {
    flex: 1 1 calc(50% - 5px);
    padding: 16px;
  }

  .kpi-value {
    font-size: 28px;
  }

  .drawer {
    width: 100%;
  }

  .filter-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 16px;
  }

  .search-input {
    width: 100%;
  }

  .topbar {
    padding: 0 16px;
  }

  .topbar-center {
    display: none;
  }

  .overview-grid {
    grid-template-columns: 1fr;
  }

  .images-tab-layout {
    flex-direction: column;
  }
}
