@import url('https://fonts.googleapis.com/css2?family=Playfair+Display+SC:wght@400;700&family=Karla:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
  --canvas: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f5f1e8;
  --ink: #2a2420;
  --ink-muted: #8a8171;
  --ink-faint: #b8ae9c;
  --border: #e8e1d4;

  --lunch: #e17055;
  --lunch-bg: #fdf1ec;
  --dinner: #6c5ce7;
  --dinner-bg: #efedfc;
  --flag: #d99a1b;
  --flag-bg: #fbf3de;
  --pending: #3b6ea5;
  --pending-bg: #e9f1f8;
  --success: #1a7a3a;
  --success-bg: #e7f5ea;
  --danger: #b3453a;
  --danger-bg: #fbeceb;
  --whatsapp: #25d366;
  --analytics: #3b71ca;
  --analytics-bg: #eaf0fb;

  --shadow-sm: 0 1px 2px rgba(42, 36, 32, 0.05);
  --shadow-md: 0 6px 20px -8px rgba(42, 36, 32, 0.16);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --font-display: 'Playfair Display SC', Georgia, 'Times New Roman', serif;
  --font-body: 'Karla', -apple-system, 'SF Pro Text', Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--canvas);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
body.app-shell { padding-bottom: 84px; }

a { color: inherit; }
section { padding: 12px 18px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

:focus-visible {
  outline: 2px solid var(--dinner);
  outline-offset: 2px;
}

/* Typography */

.page-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
  padding: 22px 18px 6px;
  margin: 0;
}

.scroll-container { min-height: 100dvh; }

.empty {
  color: var(--ink-muted);
  font-size: 13.5px;
  font-style: italic;
  padding: 4px 18px 16px;
}

.flagged { color: var(--flag); font-weight: 600; font-size: 13px; }

/* Calendar month panel */

.cal-head {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 20px 18px 16px;
  color: var(--ink);
}
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 14px;
}
.cal-nav a {
  color: var(--ink-muted);
  text-decoration: none;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 19px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  transition: background 150ms ease, color 150ms ease;
}
.cal-nav a:hover { background: var(--surface-2); color: var(--ink); }

.dow-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
  margin-bottom: 8px;
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 4px; }
.cal-cell {
  text-align: center;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  padding: 7px 0;
  border-radius: var(--radius-sm);
  color: var(--ink);
  text-decoration: none;
  display: block;
  transition: background 150ms ease;
}
.cal-cell:hover { background: var(--surface-2); }
.cal-cell.dim { color: var(--ink-faint); }
.cal-cell.selected { background: var(--dinner); color: #fff; font-weight: 700; }
.cal-cell .dot {
  display: block;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--lunch);
  margin: 3px auto 0;
}
.cal-cell.selected .dot { background: #fff; }

/* Day view */

.day-head {
  position: sticky;
  top: 0;
  background: rgba(251, 250, 247, 0.92);
  backdrop-filter: blur(6px);
  padding: 16px 18px 8px;
  z-index: 2;
  border-bottom: 1px solid var(--border);
}
.day-head .dow { font-size: 11.5px; font-weight: 600; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.day-head .date { font-family: var(--font-display); font-size: 20px; font-weight: 700; }

.day-panel-head { display: flex; align-items: baseline; justify-content: space-between; padding: 18px 18px 6px; }
.day-panel-head .dt { font-family: var(--font-display); font-size: 19px; font-weight: 700; }
.day-panel-head .lab { font-size: 11.5px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }

.meal-label {
  display: flex; align-items: center; gap: 6px;
  width: 100%;
  padding: 14px 18px 6px;
  font-size: 11.5px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  font-family: inherit;
  background: none;
  border: none;
  color: var(--ink-muted);
  text-align: left;
}
button.meal-label { cursor: pointer; }
.meal-label.lunch { color: var(--lunch); }
.meal-label.dinner { color: var(--dinner); }
.meal-chevron { transition: transform 200ms ease; flex-shrink: 0; }
.meal-section.collapsed .meal-chevron { transform: rotate(-90deg); }
.meal-section.collapsed .meal-section-body { display: none; }

.row-wrap {
  position: relative;
  margin: 6px 14px;
  border-radius: var(--radius-md);
  overflow: hidden;
}
.row-wrap .row { margin: 0; touch-action: pan-y; }
.row-wrap.swipeable .row { transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 150ms ease, background 150ms ease; }
.row-wrap.dragging .row { transition: none; }

.row-actions { position: absolute; top: 0; right: 0; bottom: 0; display: flex; width: 104px; }
.row-action {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  text-decoration: none;
  transition: filter 150ms ease;
}
.row-action:active { filter: brightness(0.92); }
.row-action.call { background: var(--dinner); }
.row-action.whatsapp { background: var(--whatsapp); }

.row {
  display: flex; align-items: center; gap: 12px;
  min-height: 44px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  text-decoration: none;
  color: inherit;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}
.row:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.row:active { transform: translateY(0) scale(0.99); }
.row.lunch { border-left-color: var(--lunch); }
.row.dinner { border-left-color: var(--dinner); }
.row.flagged { background: var(--flag-bg); border-left-color: var(--flag); border-color: transparent; }
.row.card-pending { background: var(--pending-bg); border-color: transparent; }
.row.card-pending::after {
  content: "Unconfirmed";
  margin-left: auto;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--pending);
}
.row.is-cancelled { opacity: 0.55; }
.row.is-cancelled .who { text-decoration: line-through; }
.row .time { font-weight: 700; font-size: 13.5px; width: 44px; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.row.search-result .time { width: auto; font-size: 12px; }
.row .who { flex: 1; font-size: 13.5px; font-weight: 600; }
.row .party {
  font-size: 12.5px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--surface-2);
  color: var(--ink);
  padding: 3px 9px;
  border-radius: 20px;
}
.row .reasons { font-size: 12px; color: var(--ink-muted); }

.totals {
  display: flex; justify-content: space-between;
  margin: 6px 18px; padding: 9px 14px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: 11.5px; color: var(--ink-muted);
}
.totals b { color: var(--ink); font-variant-numeric: tabular-nums; }

.load-more {
  display: block; margin: 18px auto 26px;
  padding: 11px 26px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: background 150ms ease;
}
.load-more:hover { background: var(--surface-2); }
.load-more:disabled { opacity: 0.6; cursor: default; }

.fab {
  position: fixed; bottom: 96px; right: 20px;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--dinner);
  color: #fff;
  font-size: 26px; font-weight: 400;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none;
  box-shadow: var(--shadow-md);
  z-index: 3;
  transition: transform 150ms ease;
}
.fab:hover { transform: scale(1.05); }
.fab:active { transform: scale(0.96); }

/* Bottom nav */

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 8px 6px calc(10px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -6px 20px -10px rgba(42, 36, 32, 0.12);
  z-index: 4;
}
.nav-item {
  flex: 1; min-height: 44px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  text-align: center; font-size: 10.5px; font-weight: 600;
  color: var(--ink-faint);
  text-decoration: none;
  transition: color 150ms ease;
}
.nav-item .ic { display: flex; }
.nav-item .ic svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.75; }
.nav-item.active { color: var(--dinner); }
.nav-item:hover { color: var(--ink); }
.nav-item.active:hover { color: var(--dinner); }

/* Dashboard */

.dash-header { padding: 20px 16px 6px; }
.dash-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dash-nav .page-title { padding: 0; text-align: center; flex: 1; }
.dash-nav-arrow {
  flex-shrink: 0;
  min-width: 36px; min-height: 36px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 20px; font-weight: 600;
  border-radius: var(--radius-sm);
  transition: background 150ms ease, color 150ms ease;
}
.dash-nav-arrow:hover { background: var(--surface-2); color: var(--ink); }

.period-toggle { display: flex; gap: 2px; margin: 10px auto 0; width: fit-content; padding: 3px; background: var(--surface-2); border-radius: 20px; }
.period-toggle a {
  min-height: 30px;
  display: flex; align-items: center;
  padding: 0 14px;
  border-radius: 16px;
  font-size: 12px; font-weight: 700;
  text-decoration: none;
  color: var(--ink-muted);
  transition: background 150ms ease, color 150ms ease;
}
.period-toggle a.active { background: var(--surface); color: var(--dinner); box-shadow: var(--shadow-sm); }
.period-toggle a:hover { color: var(--ink); }
.period-toggle a.active:hover { color: var(--dinner); }

.stat-row { display: flex; gap: 10px; padding: 10px 16px; }
.stat { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px; }
.stat-n { font-family: var(--font-display); font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-n.lunch-color { color: var(--lunch); }
.stat-n.dinner-color { color: var(--dinner); }
.stat-l { font-size: 10.5px; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }

.dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 8px 16px;
}
a.dash-card {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 150ms ease, transform 150ms ease;
}
a.dash-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }

.dash-card-title { font-size: 11.5px; font-weight: 700; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.dash-card-value { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--flag); }
.dash-card-value .stat-l { display: inline; text-transform: none; font-family: var(--font-body); margin-left: 4px; }

.bars { display: flex; align-items: flex-end; gap: 8px; height: 100px; padding: 10px 4px 0; position: relative; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; cursor: pointer; border-radius: var(--radius-sm); }
.bar-col:focus-visible { outline: 2px solid var(--dinner); outline-offset: 2px; }
.bar-stack { width: 100%; display: flex; flex-direction: column-reverse; border-radius: 5px 5px 0 0; overflow: hidden; background: var(--surface-2); transition: transform 150ms ease, filter 150ms ease; }
.bar-seg.lunch { background: var(--lunch); }
.bar-seg.dinner { background: var(--dinner); }
.bar-lab { text-align: center; font-size: 9.5px; color: var(--ink-muted); margin-top: 6px; font-variant-numeric: tabular-nums; transition: color 150ms ease; }
.bar-col:hover .bar-stack, .bar-col.chart-point-active .bar-stack { filter: brightness(1.08); transform: scaleX(1.08); }
.bar-col.chart-point-active .bar-lab { color: var(--ink); font-weight: 700; }

.bars.dense { gap: 2px; }
.bars.dense .bar-stack { border-radius: 2px 2px 0 0; }
.bars.dense .bar-lab { font-size: 8px; margin-top: 4px; }

.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.card-head .dash-card-title { margin-bottom: 0; }
.mini-toggle { display: flex; gap: 2px; padding: 2px; background: var(--surface-2); border-radius: 14px; }
.mini-toggle a {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 10.5px; font-weight: 700;
  text-decoration: none;
  color: var(--ink-muted);
  transition: background 150ms ease, color 150ms ease;
}
.mini-toggle a.active { background: var(--surface); color: var(--whatsapp); box-shadow: var(--shadow-sm); }
.mini-toggle a:hover { color: var(--ink); }
.mini-toggle a.active:hover { color: var(--whatsapp); }

.dash-card-total { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--whatsapp); margin-bottom: 8px; font-variant-numeric: tabular-nums; }

.curve-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.curve-head-mid { text-align: center; }
.curve-head-mid .dash-card-total { margin-bottom: 0; }
.curve-period-label { font-size: 10.5px; color: var(--ink-muted); margin-top: 2px; }
.dash-nav-arrow.small { min-width: 28px; min-height: 28px; font-size: 16px; }

.curve-chart { width: 100%; height: 100px; position: relative; }
.curve-svg-wrap { width: 100%; height: 100%; overflow: hidden; }
.curve-svg { width: 100%; height: 100%; display: block; overflow: hidden; }
.curve-area { fill: var(--whatsapp); fill-opacity: 0.12; stroke: none; }
.curve-line { fill: none; stroke: var(--whatsapp); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.curve-dot { fill: var(--whatsapp); transform-box: fill-box; transform-origin: center; transition: transform 150ms ease; }
.curve-dot.chart-point-active { transform: scale(1.7); }

.curve-hit { fill: transparent; cursor: pointer; outline: none; }

.curve-labels { display: flex; justify-content: space-between; padding: 6px 6px 0; }
.curve-labels span { flex: 1; text-align: center; font-size: 9.5px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }

.trend-legend { display: flex; gap: 16px; margin-bottom: 8px; }
.trend-legend-item { font-size: 11.5px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.trend-legend-item::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.trend-legend-item.confirmed::before { background: var(--success); }
.trend-legend-item.cancelled::before { background: var(--danger); }
.trend-area.confirmed { fill: var(--success); fill-opacity: 0.1; stroke: none; }
.trend-line.confirmed { fill: none; stroke: var(--success); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.trend-line.cancelled { fill: none; stroke: var(--danger); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 5 4; }

/* Chart tooltips (tap/click a bar or curve point to reveal its value) */

.chart-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--canvas);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transition: opacity 120ms ease, transform 120ms ease;
}
.chart-tooltip::after {
  content: "";
  position: absolute;
  top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--ink);
}
.chart-tooltip.visible { opacity: 1; }
.chart-tooltip-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-tooltip-label { color: var(--ink-faint); margin-top: 1px; font-size: 10.5px; }

@media (prefers-reduced-motion: reduce) {
  .chart-tooltip, .curve-dot, .bar-stack { transition: none; }
}

/* Forms */

form label { display: block; margin-bottom: 14px; font-size: 13px; font-weight: 600; color: var(--ink-muted); }
form input, form select, form textarea {
  width: 100%;
  padding: 11px 12px;
  margin-top: 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14.5px;
  transition: border-color 150ms ease;
}
form input:focus, form select:focus, form textarea:focus {
  border-color: var(--dinner);
  outline: none;
}
form textarea { min-height: 80px; resize: vertical; }
form button {
  min-height: 44px;
  padding: 12px 22px;
  background: var(--dinner);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 15px; font-weight: 700;
  cursor: pointer;
  transition: background 150ms ease, transform 150ms ease;
}
form button:hover { background: #5c4dd6; }
form button:active { transform: scale(0.98); }

.auth-shell { min-height: 100dvh; display: flex; align-items: center; justify-content: center; background: var(--canvas); padding: 24px; }
.auth-card { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 36px 28px; box-shadow: var(--shadow-md); }
.auth-brand { font-family: var(--font-display); font-size: 26px; font-weight: 700; text-align: center; color: var(--ink); letter-spacing: -0.01em; }
.auth-tagline { text-align: center; font-size: 11px; font-weight: 600; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.08em; margin: 6px 0 26px; }

.login-form { padding: 0; }
.login-form button { width: 100%; margin-top: 4px; }

.settings-hint { margin: 0 0 14px; font-size: 12.5px; color: var(--ink-muted); line-height: 1.5; }
.settings-form button { width: 100%; }

.back-link {
  display: inline-block;
  padding: 18px 18px 0;
  color: var(--dinner);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}
.back-link:hover { text-decoration: underline; }

/* Status badges */

.status {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--surface-2);
  color: var(--ink-muted);
}
.status-confirmed { background: var(--success-bg); color: var(--success); }
.status-pending_confirmation { background: var(--pending-bg); color: var(--pending); }
.status-needs_review { background: var(--flag-bg); color: var(--flag); }
.status-cancelled { background: var(--surface-2); color: var(--ink-faint); text-decoration: line-through; }

.source-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--surface-2);
  color: var(--ink-faint);
}

/* Small content utilities */

.link-block { display: block; text-decoration: none; color: inherit; }
.msg-success { margin: 0; color: var(--success); font-weight: 700; }
.msg-error { margin: 0; color: var(--danger); font-weight: 600; }
.quote-block { margin: 0; font-style: italic; font-size: 13.5px; color: var(--ink-muted); line-height: 1.6; }
.kv-list { list-style: none; padding: 0; margin: 14px 0 0; font-size: 14.5px; line-height: 2; }
.kv-list a { color: var(--dinner); text-decoration: none; }
.kv-list a:hover { text-decoration: underline; }

.history-summary { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--ink); }
.history-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.history-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.history-list a { color: var(--dinner); text-decoration: none; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.history-list a:hover { text-decoration: underline; }
.history-more { margin: 8px 0 0; font-size: 11.5px; color: var(--ink-muted); }
.action-link {
  display: block;
  text-align: center;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
}
.action-link.edit { color: var(--dinner); }
.action-link.danger { color: var(--danger); }
.action-link.approve { color: var(--success); }

/* Search + status tabs (bookings list) */

.search-bar {
  display: flex; align-items: center; gap: 8px;
  margin: 16px 16px 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  color: var(--ink-muted);
}
.search-bar svg { flex-shrink: 0; }
.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
}
.search-bar input::placeholder { color: var(--ink-faint); }
.search-clear {
  flex-shrink: 0;
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 14px;
  line-height: 1;
}

.status-tabs { display: flex; gap: 2px; margin: 0 16px 10px; padding: 3px; background: var(--surface-2); border-radius: 20px; }
.status-tabs a {
  flex: 1;
  text-align: center;
  min-height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 16px;
  font-size: 12.5px; font-weight: 700;
  text-decoration: none;
  color: var(--ink-muted);
  transition: background 150ms ease, color 150ms ease;
}
.status-tabs a.active { background: var(--surface); color: var(--dinner); box-shadow: var(--shadow-sm); }
.status-tabs a:hover { color: var(--ink); }
.status-tabs a.active:hover { color: var(--dinner); }

.search-count { margin: 4px 18px 0; font-size: 11.5px; color: var(--ink-muted); }

/* Google Analytics cards */

.ga-total { color: var(--analytics); }
.ga-conversion { font-size: 12px; font-weight: 700; color: var(--whatsapp); margin-top: 2px; }
.ga-area { fill: var(--analytics); fill-opacity: 0.1; stroke: none; }
.ga-line { fill: none; stroke: var(--analytics); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.ga-bar-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.ga-bar-row:not(:last-child) { border-bottom: 1px solid var(--border); }
.ga-bar-label { flex-shrink: 0; width: 100px; font-size: 12.5px; font-weight: 600; color: var(--ink); text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.ga-bar-track { flex: 1; height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.ga-bar-fill { height: 100%; border-radius: 4px; }
.ga-bar-fill.sources { background: var(--analytics); }
.ga-bar-fill.devices { background: var(--analytics); }
.ga-bar-pct { flex-shrink: 0; width: 34px; text-align: right; font-size: 11.5px; font-weight: 700; color: var(--ink-muted); font-variant-numeric: tabular-nums; }

.ga-page-list { list-style: none; padding: 0; margin: 0; counter-reset: ga-page; }
.ga-page-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; counter-increment: ga-page; }
.ga-page-list li:not(:last-child) { border-bottom: 1px solid var(--border); }
.ga-page-list li::before { content: counter(ga-page); flex-shrink: 0; width: 18px; font-size: 11px; font-weight: 700; color: var(--ink-faint); }
.ga-page-path { flex: 1; font-size: 12.5px; font-weight: 600; color: var(--ink); text-overflow: ellipsis; overflow: hidden; white-space: nowrap; font-family: var(--font-body); }
.ga-page-views { flex-shrink: 0; font-size: 12px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }

/* WhatsApp conversion by channel (donut) */

/* Wrap/viewBox are larger than the ring itself (ring occupies the inner
   200x200 centered via the <g translate(50,50)> in the markup) so the
   callout leader line has room to extend past the ring's outer edge. */
.donut-wrap { position: relative; width: 240px; height: 240px; margin: 4px auto 8px; }
.donut-svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.donut-slice {
  fill: none;
  stroke: var(--donut-color, var(--analytics));
  stroke-width: 28;
  stroke-linecap: round;
  cursor: pointer;
  transition: stroke-width 150ms ease, opacity 150ms ease;
  -webkit-tap-highlight-color: transparent;
}
.donut-slice:hover,
.donut-slice.active { stroke-width: 32; }
.donut-slice:focus,
.donut-slice:focus-visible { outline: none; }

.donut-center {
  position: absolute;
  inset: 60px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  padding: 4px;
}
.donut-center-value { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--analytics); font-variant-numeric: tabular-nums; }
.donut-center-label { font-size: 11px; font-weight: 700; color: var(--ink); text-transform: uppercase; letter-spacing: 0.03em; margin-top: 2px; }
.donut-center-sub { font-size: 10.5px; color: var(--ink-muted); margin-top: 2px; }

/* Callout: an animated leader line drawn from the active slice's outer edge
   out past the ring, ending in a floating percentage label. This overlay
   svg is deliberately NOT rotated like .donut-svg is — JS computes its
   coordinates already in final screen-space, so the label renders upright
   with no counter-rotation needed. Hidden (collapsed at center, transparent)
   until a slice is active; x1/y1/x2/y2/opacity are CSS-transitioned so
   setting new coordinates animates the line sliding/growing into place. */
.donut-callout-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.donut-callout-line {
  stroke: var(--ink-muted);
  stroke-width: 1.5;
  opacity: 0;
  transition: x1 200ms ease, y1 200ms ease, x2 200ms ease, y2 200ms ease, opacity 200ms ease;
}
.donut-callout-label {
  fill: var(--ink);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  transition: x 200ms ease, y 200ms ease, opacity 200ms ease;
}
.donut-callout-svg.visible .donut-callout-line { opacity: 1; }
.donut-callout-svg.visible .donut-callout-label { opacity: 1; }

.donut-legend { list-style: none; padding: 0; margin: 0; }
.donut-legend-item { display: flex; align-items: center; gap: 8px; padding: 7px 4px; border-radius: 8px; cursor: pointer; transition: background 150ms ease; -webkit-tap-highlight-color: transparent; }
.donut-legend-item:not(:last-child) { border-bottom: 1px solid var(--border); }
.donut-legend-item:hover,
.donut-legend-item.active { background: var(--surface-2); }
.donut-legend-item:focus,
.donut-legend-item:focus-visible { outline: none; }
.donut-legend-dot { flex-shrink: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--donut-color, var(--analytics)); }
.donut-legend-name { flex: 1; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.donut-legend-badge { margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: var(--success-bg); color: var(--success); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; vertical-align: middle; }
.donut-legend-rate { flex-shrink: 0; font-size: 12px; font-weight: 700; color: var(--ink-muted); font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  .donut-slice, .donut-legend-item, .donut-callout-line, .donut-callout-label { transition: none; }
}
