/* ==========================================================================
   APPRO — "Quiet Dusk" theme
   Shared design tokens + components for 'app' (dashboard), 'marketing'
   (landing/pricing/support/etc.), and 'auth' (login/register/etc.) layouts.
   Loaded globally from partials/header.php alongside legacy css/style.css.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, "Noto Serif", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Menlo, monospace;

  --fs-2xs: 0.6875rem;
  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-base: 0.9375rem;
  --fs-md: 1.0625rem;
  --fs-lg: 1.375rem;
  --fs-xl: 2rem;
  --fs-2xl: 2.9rem;
  --fs-hero: 3.4rem;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 18px;

  --sidebar-w: 224px;

  --bg: #1C1519;
  --surface: #241A1F;
  --surface-raised: #2B1F25;
  --sidebar-bg: #181114;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --ink: #F5ECE8;
  --ink-secondary: rgba(245, 236, 232, 0.68);
  --ink-muted: rgba(245, 236, 232, 0.46);

  --accent: #E0729D;
  --accent-deep: #C24A79;
  --accent-tint: rgba(224, 114, 157, 0.14);
  --accent-tint-strong: rgba(224, 114, 157, 0.22);
  --accent-on: #241019;

  --speaker-1: #D6588F;
  --speaker-2: #22A88C;

  --good: #6FBE95;
  --good-tint: rgba(111, 190, 149, 0.16);
  --warn: #E0A857;
  --warn-tint: rgba(224, 168, 87, 0.17);
  --critical: #E07A6E;
  --critical-tint: rgba(224, 122, 110, 0.15);

  --shadow-card: 0 1px 2px rgba(0,0,0,0.2), 0 12px 32px -16px rgba(0,0,0,0.55);
  color-scheme: dark;
}

@media (prefers-reduced-motion: reduce) {
  .theme-scope *, .theme-scope *::before, .theme-scope *::after {
    transition: none !important; animation: none !important; scroll-behavior: auto !important;
  }
}

.theme-scope { font-family: var(--font-body); font-size: var(--fs-base); line-height: 1.5; background: var(--bg); color: var(--ink); min-height: 100vh; }
.theme-scope h1, .theme-scope h2, .theme-scope h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; font-weight: 600; }
.theme-scope .num { font-variant-numeric: tabular-nums; }
.theme-scope a { color: inherit; }
.theme-scope :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.theme-scope img, .theme-scope svg { display: block; max-width: 100%; }
.theme-scope button { font: inherit; }

/* ============ Buttons ============ */
.theme-scope .btn {
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: 999px; border: 1px solid transparent;
  padding: 11px 22px; font-size: var(--fs-sm); font-weight: 600; cursor: pointer;
  text-decoration: none; white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.theme-scope .btn:active { transform: translateY(1px); }
.theme-scope .btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: var(--accent-on);
  box-shadow: 0 8px 24px -10px rgba(224,114,157,0.55);
}
.theme-scope .btn-primary:hover { box-shadow: 0 10px 28px -8px rgba(224,114,157,0.6); }
.theme-scope .btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--ink); padding: 10px 20px; }
.theme-scope .btn-ghost:hover { background: var(--accent-tint); }
.theme-scope .btn-sm { padding: 8px 16px; font-size: var(--fs-xs); }

/* App-shell buttons use radius-sm pills, not fully round */
.app-shell .btn { border-radius: var(--radius-sm); padding: 9px 16px; }
.app-shell .btn-primary { box-shadow: 0 6px 18px -8px rgba(224,114,157,0.55); }
.app-shell .btn-primary:hover { box-shadow: 0 8px 22px -6px rgba(224,114,157,0.6); }
.app-shell .btn-ghost { background: var(--surface); }

/* ============ Cards & shared bits ============ */
.theme-scope .card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
  padding: 18px 20px;
}
.theme-scope .card-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.theme-scope .card-title { font-size: var(--fs-md); font-weight: 600; font-family: var(--font-display); }
.theme-scope .card-sub { font-size: var(--fs-xs); color: var(--ink-muted); margin-top: 2px; }

.theme-scope .chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-2xs); font-weight: 700; padding: 4px 9px; border-radius: 999px;
  border: 1px solid var(--border-strong); color: var(--ink-secondary); white-space: nowrap;
}
.theme-scope .chip.emotions { background: var(--accent-tint); border-color: transparent; color: var(--accent); }

.theme-scope .status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-2xs); font-weight: 700; }
.theme-scope .status-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.theme-scope .status-dot.pulse { animation: appro-pulse 1.6s ease-in-out infinite; }
@keyframes appro-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.theme-scope .status-pill.complete { color: var(--good); } .theme-scope .status-pill.complete .status-dot { background: var(--good); }
.theme-scope .status-pill.progress { color: var(--ink-secondary); } .theme-scope .status-pill.progress .status-dot { background: var(--accent); }
.theme-scope .status-pill.error { color: var(--critical); } .theme-scope .status-pill.error .status-dot { background: var(--critical); }

.theme-scope .legend { display: flex; gap: 14px; flex-wrap: wrap; }
.theme-scope .legend-item { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--ink-secondary); font-weight: 600; }
.theme-scope .swatch { width: 9px; height: 9px; border-radius: 50%; flex: none; }

.theme-scope [data-tip] { position: relative; }
.theme-scope [data-tip]:hover::after, .theme-scope [data-tip]:focus-visible::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: var(--surface-raised); color: var(--ink); border: 1px solid var(--border-strong);
  font-size: var(--fs-2xs); font-weight: 600; white-space: nowrap;
  padding: 5px 9px; border-radius: 6px; pointer-events: none; z-index: 5;
  box-shadow: 0 6px 16px -6px rgba(0,0,0,0.4);
}

/* ============ Trend chart ============ */
.theme-scope .trend-wrap { position: relative; }
.theme-scope .trend-svg { width: 100%; height: 160px; overflow: visible; }
.theme-scope .trend-grid line { stroke: var(--border); stroke-width: 1; }
.theme-scope .trend-area { fill: url(#trendFill); opacity: 0.9; }
.theme-scope .trend-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.theme-scope .trend-dot { fill: var(--surface); stroke: var(--accent); stroke-width: 2.5; }
.theme-scope .trend-dot.end { fill: var(--accent); }
.theme-scope .trend-x-labels { display: flex; justify-content: space-between; margin-top: 6px; padding: 0 2px; }
.theme-scope .trend-x-labels span { font-size: var(--fs-2xs); color: var(--ink-muted); }

/* ============ Gauge / donut ============ */
.theme-scope .gauge-row { display: flex; align-items: center; gap: 16px; }
.theme-scope .gauge-num { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; }
.theme-scope .gauge-band { font-size: var(--fs-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 3px 8px; border-radius: 999px; margin-top: 4px; display: inline-block; }
.theme-scope .gauge-band.good { background: var(--good-tint); color: var(--good); }
.theme-scope .gauge-band.warn { background: var(--warn-tint); color: var(--warn); }
.theme-scope .gauge-band.critical { background: var(--critical-tint); color: var(--critical); }
.theme-scope .mini-donut-row { display: flex; align-items: center; gap: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.theme-scope .mini-donut-legend { display: flex; flex-direction: column; gap: 5px; }

/* ============ Horsemen bars ============ */
.theme-scope .horsemen { display: flex; flex-direction: column; gap: 13px; }
.theme-scope .horseman-item { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.theme-scope .horseman-row { display: grid; grid-template-columns: 108px 1fr 64px; align-items: center; gap: 10px; }
.theme-scope .horseman-label { font-size: var(--fs-xs); font-weight: 600; color: var(--ink-secondary); }
.theme-scope .horseman-track { height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; }
.theme-scope .horseman-fill { height: 100%; border-radius: 999px; }
.theme-scope .horseman-sev { font-size: var(--fs-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; text-align: right; }
.theme-scope .horseman-sev.low { color: var(--good); } .theme-scope .horseman-sev.moderate { color: var(--warn); } .theme-scope .horseman-sev.high { color: var(--critical); }
.theme-scope .horseman-sev.unclear { color: var(--ink-muted); }   /* rr_severity_meta() couldn't read a severity value - never falls back to "low" */

/* ============ Emotional arc ============ */
.theme-scope .arc-svg { width: 100%; height: 150px; overflow: visible; }
.theme-scope .arc-line { fill: none; stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
.theme-scope .arc-annot { font-size: var(--fs-2xs); fill: var(--ink-muted); font-family: var(--font-body); font-weight: 600; }
.theme-scope .arc-annot-dot { fill: var(--good); }

/* ============ Table bits (sessions table, shared) ============ */
.theme-scope .health-chip { font-family: var(--font-mono); font-weight: 700; font-size: var(--fs-sm); }
.theme-scope .health-chip.good { color: var(--good); }
.theme-scope .health-chip.warn { color: var(--warn); }
.theme-scope .health-chip.critical { color: var(--critical); }
.theme-scope .row-action { font-size: var(--fs-xs); font-weight: 700; color: var(--accent); text-decoration: none; background: none; border: none; cursor: pointer; padding: 0; font-family: inherit; }
.theme-scope .row-action:hover { text-decoration: underline; }
.theme-scope .muted-em { color: var(--ink-muted); font-size: var(--fs-xs); }
.theme-scope .select-col { width: 34px; padding-right: 0 !important; }
.theme-scope .row-select, .theme-scope .select-all { width: 16px; height: 16px; border-radius: 4px; accent-color: var(--accent); cursor: pointer; }

.theme-scope .status-progress-track { height: 4px; border-radius: 999px; background: var(--border); overflow: hidden; margin-top: 6px; width: 140px; max-width: 100%; }
.theme-scope .status-progress-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width 0.4s ease; }
.theme-scope .status-elapsed { font-size: var(--fs-2xs); color: var(--ink-muted); margin-top: 3px; font-family: var(--font-mono); }

/* ============ Toast ============ */
.theme-scope .toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(12px);
  background: var(--surface-raised); border: 1px solid var(--border-strong); color: var(--ink);
  padding: 12px 20px; border-radius: 999px; font-size: var(--fs-sm); font-weight: 600;
  box-shadow: 0 20px 50px -20px rgba(0,0,0,0.6); z-index: 50;
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease, transform 0.25s ease;
}
.theme-scope .toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ Form fields (auth + upload forms) ============ */
.theme-scope .field-label { font-size: var(--fs-sm); font-weight: 600; color: var(--ink); margin-bottom: 6px; display: block; }
.theme-scope .field-input, .theme-scope .field-select, .theme-scope .field-textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 10px 13px; font-size: var(--fs-sm); color: var(--ink); font-family: inherit;
}
.theme-scope .field-input:focus, .theme-scope .field-select:focus, .theme-scope .field-textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint);
}
.theme-scope .field-textarea { resize: vertical; }

/* ==========================================================================
   MARKETING PAGE UTILITIES (shared across landing/pricing/security/etc.)
   ========================================================================== */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 32px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700;
  color: var(--accent); background: var(--accent-tint); border-radius: 999px; padding: 6px 14px;
  margin-bottom: 22px;
}
@media (max-width: 900px) { .wrap { padding: 0 20px; } }

/* ==========================================================================
   MARKETING NAV
   ========================================================================== */
.mnav {
  position: sticky; top: 0; z-index: 40;
  background: rgba(28,21,25,0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.mnav .wrap { display: flex; align-items: center; justify-content: space-between; padding: 14px 32px; max-width: 1180px; margin: 0 auto; }
.mnav .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  object-fit: cover;
}
.mnav .brand-name { font-family: var(--font-display); font-size: var(--fs-md); font-weight: 600; letter-spacing: 0.01em; color: var(--ink); }
.nav-center { display: flex; align-items: center; gap: 4px; }
.nav-item-drop { position: relative; }
.nav-trigger {
  display: flex; align-items: center; gap: 6px; background: none; border: none; cursor: pointer;
  color: var(--ink-secondary); font-size: var(--fs-sm); padding: 9px 12px; border-radius: var(--radius-sm);
}
.nav-trigger:hover, .nav-trigger[aria-expanded="true"] { color: var(--ink); background: var(--accent-tint); }
.nav-trigger svg { transition: transform 0.18s ease; opacity: 0.7; }
.nav-trigger[aria-expanded="true"] svg { transform: rotate(180deg); }
.nav-plain { color: var(--ink-secondary); font-size: var(--fs-sm); text-decoration: none; padding: 9px 12px; border-radius: var(--radius-sm); }
.nav-plain:hover { color: var(--ink); background: var(--accent-tint); }
.nav-cta-group { display: flex; align-items: center; gap: 14px; }

.mega {
  position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%) translateY(-6px);
  width: min(760px, calc(100vw - 40px));
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  box-shadow: 0 1px 2px rgba(0,0,0,0.25), 0 40px 90px -30px rgba(0,0,0,0.65);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  overflow: hidden;
}
.nav-item-drop.open .mega { opacity: 1; visibility: visible; pointer-events: auto; transform: translateX(-50%) translateY(0); }
.mega-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 28px; padding: 26px 30px 22px; max-width: none; }
.mega-col-label { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-muted); font-weight: 700; margin-bottom: 10px; }
.mega-item { display: block; padding: 9px 10px; border-radius: var(--radius-sm); text-decoration: none; margin: 0 -10px; }
.mega-item:hover { background: var(--accent-tint); }
.mega-item-title { display: block; font-size: var(--fs-sm); font-weight: 700; color: var(--ink); }
.mega-item-caption { display: block; font-size: var(--fs-xs); color: var(--ink-muted); margin-top: 2px; }
.mega-strip { border-top: 1px solid var(--border); background: rgba(224,114,157,0.06); }
.mega-strip-inner { display: flex; align-items: center; gap: 14px; padding: 16px 30px; max-width: none; }
.mega-strip-icon {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: var(--accent-tint-strong); display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.mega-strip-title { font-size: var(--fs-xs); font-weight: 700; }
.mega-strip-caption { font-size: var(--fs-2xs); color: var(--ink-muted); margin-top: 1px; }

.drop-simple {
  position: absolute; top: calc(100% + 10px); left: 0;
  width: 240px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  box-shadow: 0 1px 2px rgba(0,0,0,0.25), 0 30px 70px -28px rgba(0,0,0,0.6);
  opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  padding: 8px;
}
.nav-item-drop.open .drop-simple { opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0); }
.drop-simple a { display: block; padding: 9px 11px; border-radius: var(--radius-sm); font-size: var(--fs-sm); text-decoration: none; color: var(--ink-secondary); }
.drop-simple a:hover { background: var(--accent-tint); color: var(--ink); }

@media (max-width: 900px) {
  .nav-center { display: none; }
  .mega { position: fixed; left: 16px; right: 16px; top: 62px; width: auto; transform: translateY(-6px); }
  .nav-item-drop.open .mega { transform: translateY(0); }
}

/* ==========================================================================
   MARKETING FOOTER
   ========================================================================== */
/* Legacy css/style.css has an unscoped `footer { background: #fff; color: #718096; }`
   rule from before this marketing footer existed; .mfoot's class selector
   outranks it on specificity, but only once background/color are set here too. */
.mfoot { background: transparent; color: var(--ink-secondary); border-top: 1px solid var(--border); padding: 50px 0 30px; }
.mfoot .wrap { max-width: 1180px; margin: 0 auto; padding: 0 32px; }
.foot-top { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 30px; padding-bottom: 34px; }
.foot-brand-blurb { color: var(--ink-muted); font-size: var(--fs-xs); margin-top: 12px; max-width: 260px; line-height: 1.6; }
.foot-col-label { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-muted); font-weight: 700; margin-bottom: 12px; }
.foot-col a { display: block; font-size: var(--fs-sm); color: var(--ink-secondary); text-decoration: none; padding: 5px 0; }
.foot-col a:hover { color: var(--ink); }
.foot-bottom { border-top: 1px solid var(--border); padding-top: 20px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.foot-copy { font-size: var(--fs-2xs); color: var(--ink-muted); }

@media (max-width: 900px) {
  .foot-top { grid-template-columns: 1fr; gap: 22px; }
}

/* ==========================================================================
   REPORT TABS (shared by view_report.php and sample_report.php)
   ========================================================================== */
.rr-body { font-size: var(--fs-sm); color: var(--ink-secondary); line-height: 1.6; margin-top: 10px; }
.rr-subnote { font-size: var(--fs-xs); color: var(--ink-muted); margin: 8px 0 0; line-height: 1.5; }
/* Small "not medical advice" line under the Overview score; mirrors the PDF footer. */
.rr-disclaimer { font-size: var(--fs-2xs); color: var(--ink-muted); margin: 12px 0 0; line-height: 1.5; padding-top: 10px; border-top: 1px solid var(--border); }
.rr-list { margin: 0; padding-left: 18px; font-size: var(--fs-sm); color: var(--ink-secondary); line-height: 1.7; }
.rr-list.good li::marker { color: var(--good); }
.rr-list.critical li::marker { color: var(--critical); }
.rr-kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.rr-kv-label { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-muted); font-weight: 700; }
.rr-kv-value { font-size: var(--fs-sm); color: var(--ink-secondary); margin-top: 4px; line-height: 1.5; }
.rr-transcript { display: flex; flex-direction: column; gap: 14px; }
.rr-t-line { display: grid; grid-template-columns: auto auto 1fr; align-items: baseline; gap: 10px; }
.rr-t-line p { font-size: var(--fs-sm); color: var(--ink-secondary); line-height: 1.55; margin: 0; }
.rr-paywall { display: flex; align-items: center; gap: 14px; background: var(--accent-tint); border: 1px solid var(--border-strong); border-radius: var(--radius-md); padding: 16px 18px; margin-top: 16px; }
.rr-paywall-icon { font-size: 1.4rem; }
.rr-paywall-title { font-size: var(--fs-sm); font-weight: 700; }
.rr-paywall-body { font-size: var(--fs-xs); color: var(--ink-muted); margin-top: 2px; }
.rr-paywall .btn { margin-left: auto; }
@media (max-width: 700px) { .rr-paywall { flex-wrap: wrap; } .rr-paywall .btn { margin-left: 0; } }

.rtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.rtab-btn { background: none; border: none; padding: 11px 16px; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.rtab-btn:hover { color: var(--ink); }
.rtab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.rtab-panel { display: none; }
.rtab-panel.active { display: block; }

/* grid-2 is used throughout every report tab to pair two cards side by side.
   It was referenced by report_render.php from the start of the redesign but
   never actually defined here, so every "side by side" pairing across all
   four tabs was silently falling back to stacked full-width divs. */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }

/* Per-speaker card components (attachment styles, transcript speaker tags).
   Like grid-2, these were only ever defined in landing.php's local <style>
   block for the marketing-page demo mockup and never made it into the
   shared theme, so the real report page rendered them as plain unstyled text. */
.attach-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 10px; }
.attach-card:last-child { margin-bottom: 0; }
.attach-name { font-size: var(--fs-xs); font-weight: 700; }
.attach-name.s1 { color: var(--speaker-1); } .attach-name.s2 { color: var(--speaker-2); }
.attach-style { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--ink-muted); margin: 2px 0 5px; }
.attach-desc { font-size: 0.75rem; color: var(--ink-secondary); line-height: 1.5; }

.growth-card { background: var(--bg); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); padding: 13px 16px; }
.growth-title { font-size: var(--fs-sm); font-weight: 700; margin-bottom: 4px; }
.growth-body { font-size: var(--fs-xs); color: var(--ink-secondary); line-height: 1.55; }

.t-speaker { font-size: var(--fs-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.t-speaker.s1 { color: var(--speaker-1); } .t-speaker.s2 { color: var(--speaker-2); }
.t-tone { font-size: var(--fs-2xs); color: var(--ink-muted); font-style: italic; }

/* Inline highlight for a speaker's name inside AI-generated narrative prose
   (Deeper patterns, emotional dynamics, etc.) so it's easier to scan which
   remarks are about which person even when the field isn't structurally
   split per speaker. */
.sp-hl { font-weight: 700; }
.sp-hl.s1 { color: var(--speaker-1); } .sp-hl.s2 { color: var(--speaker-2); }

/* Four-horsemen: one pattern can now carry a severity bar per speaker
   (new-format reports) instead of a single shared bar (legacy reports). */
.horseman-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.horseman-group:last-child { margin-bottom: 0; }
.horseman-group-label { font-size: var(--fs-xs); font-weight: 700; color: var(--ink); }
.horseman-speaker { font-size: var(--fs-xs); font-weight: 600; }
.horseman-speaker.s1 { color: var(--speaker-1); } .horseman-speaker.s2 { color: var(--speaker-2); }

/* Talk-time stat tiles (word count / turns / duration / wpm per speaker) */
.talkstat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
@media (max-width: 700px) { .talkstat-grid { grid-template-columns: 1fr; } }
.talkstat-name { font-size: var(--fs-xs); font-weight: 700; margin-bottom: 8px; }
.talkstat-name.s1 { color: var(--speaker-1); } .talkstat-name.s2 { color: var(--speaker-2); }
.talkstat-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.talkstat-tile { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; text-align: center; }
.talkstat-value { display: block; font-family: var(--font-mono); font-weight: 700; font-size: var(--fs-sm); color: var(--ink); }
.talkstat-label { display: block; font-size: var(--fs-2xs); color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.03em; margin-top: 2px; }

.whoswho-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; list-style: none; }
.whoswho-summary::-webkit-details-marker { display: none; }
.whoswho-summary-name.s1 { color: var(--speaker-1); font-weight: 700; } .whoswho-summary-name.s2 { color: var(--speaker-2); font-weight: 700; }
.whoswho-toggle-icon { flex-shrink: 0; color: var(--ink-muted); transition: transform 0.15s ease; }
.whoswho-details[open] .whoswho-toggle-icon { transform: rotate(180deg); }
.whoswho-body { margin-top: 16px; }
.whoswho-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.whoswho-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; }
.whoswho-snippet { font-size: var(--fs-xs); color: var(--ink-secondary); line-height: 1.5; margin: 6px 0 12px; font-style: italic; min-height: calc(1.5em * 2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.whoswho-form { display: flex; flex-direction: column; gap: 10px; }
.whoswho-btn-row { display: flex; align-items: center; gap: 8px; }
.btn-me {
  width: 40px; height: 40px; padding: 0; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: transparent; color: var(--ink-secondary);
  font-size: var(--fs-xs); font-weight: 700; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn-me:hover { background: var(--accent-tint); color: var(--ink); border-color: var(--accent); }
@media (max-width: 700px) { .whoswho-grid { grid-template-columns: 1fr; } }

/* ==========================================================================
   AUTH LAYOUT (simple centered card)
   ========================================================================== */
.auth-shell { min-height: calc(100vh - 64px); display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-topbar { display: flex; justify-content: center; padding: 20px 0; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 32px 30px; }
.auth-card h1 { font-size: var(--fs-lg); margin-bottom: 6px; }
.auth-card .auth-sub { color: var(--ink-secondary); font-size: var(--fs-sm); margin-bottom: 24px; }
.auth-field { margin-bottom: 16px; }
.auth-foot-link { text-align: center; font-size: var(--fs-sm); color: var(--ink-secondary); margin-top: 18px; }
.auth-foot-link a { color: var(--accent); font-weight: 600; text-decoration: none; }
.auth-foot-link a:hover { text-decoration: underline; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--ink-muted); font-size: var(--fs-xs); }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-error { background: var(--critical-tint); color: var(--critical); border-radius: var(--radius-sm); padding: 10px 14px; font-size: var(--fs-sm); margin-bottom: 16px; }
.auth-success { background: var(--good-tint); color: var(--good); border-radius: var(--radius-sm); padding: 10px 14px; font-size: var(--fs-sm); margin-bottom: 16px; }

/* ==========================================================================
   APP SHELL (sidebar + page chrome shared by dashboard / sessions / settings)
   ========================================================================== */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--sidebar-bg); border-right: 1px solid var(--border);
  padding: 22px 14px; display: flex; flex-direction: column; gap: 28px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; text-decoration: none; }
.sidebar .brand-name { font-family: var(--font-display); font-size: var(--fs-md); font-weight: 600; color: var(--ink); }
.sidebar .brand-sub { font-size: var(--fs-2xs); color: var(--ink-muted); letter-spacing: 0.03em; text-transform: uppercase; }
nav.primary-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: var(--radius-sm);
  font-size: var(--fs-sm); font-weight: 500; color: var(--ink-secondary); text-decoration: none;
  cursor: pointer; border: none; background: none; text-align: left; width: 100%; position: relative;
}
.nav-item .ic { width: 17px; height: 17px; flex: none; opacity: 0.85; }
.nav-item:hover { background: var(--accent-tint); color: var(--ink); }
.nav-item.active { background: var(--accent-tint-strong); color: var(--accent); font-weight: 600; }
.nav-item .soon { margin-left: auto; font-size: var(--fs-2xs); padding: 2px 6px; border-radius: 999px; background: var(--border); color: var(--ink-muted); font-weight: 600; letter-spacing: 0.02em; }
.nav-group-label { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-muted); padding: 0 10px; margin-top: 6px; }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm); text-decoration: none; width: 100%; }
.user-chip:hover { background: var(--accent-tint); }
.avatar { width: 30px; height: 30px; border-radius: 50%; flex: none; background: var(--surface-raised); border: 1px solid var(--border-strong); display: flex; align-items: center; justify-content: center; font-size: var(--fs-xs); font-weight: 600; color: var(--ink-secondary); }
.user-meta { line-height: 1.25; }
.user-name { font-size: var(--fs-sm); font-weight: 600; color: var(--ink); }
.user-email { font-size: var(--fs-2xs); color: var(--ink-muted); }

.main { flex: 1; min-width: 0; padding: 26px 34px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: var(--fs-xl); }
.page-sub { color: var(--ink-secondary); font-size: var(--fs-sm); margin-top: 4px; }
.head-actions { display: flex; align-items: center; gap: 10px; }
.credit-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border-strong); font-size: var(--fs-xs); font-weight: 600; color: var(--ink-secondary); }
.credit-pill b { color: var(--ink); font-family: var(--font-mono); }
.empty-state { color: var(--ink-muted); font-size: var(--fs-sm); padding: 20px 0; text-align: center; }
.flash-banner { border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 18px; font-size: var(--fs-sm); }
.flash-banner.good { background: var(--good-tint); color: var(--good); }
.flash-banner.critical { background: var(--critical-tint); color: var(--critical); }

@media (max-width: 980px) {
  .sidebar { display: none; }
  .main { padding: 20px 16px 50px; }
}

/* ═══ Tone visuals (Gemini emotion metrics) ═══════════════════════════════
   Chart-mark colors only — punchier variants of the status tokens, chosen
   for colorblind separation against this surface (worst adjacent pair
   ΔE 12.8 deutan / 17.0 normal, all ≥3:1 on --bg). Text, badges and
   severity bars keep the ordinary theme tokens; these four are never used
   for type. Color never carries meaning alone here: every mark is paired
   with a legend, a label or a tooltip naming the emotion. */
:root {
  --tone-positive: #77C89D;
  --tone-calm:     #968985;
  --tone-distress: #F2C94C;
  --tone-hostile:  #E0524D;
  /* Labels sitting ON a tone fill need dark ink — the light --ink token
     measures 1.4:1 on the yellow. This clears 4.7:1 on all four fills. */
  --tone-label-ink: #241019;
}
.tone-positive { background: var(--tone-positive); }
.tone-calm     { background: var(--tone-calm); }
.tone-distress { background: var(--tone-distress); }
.tone-hostile  { background: var(--tone-hostile); }

.tone-legend { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-bottom: 16px; }
.tone-legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-muted); }
.tone-legend-sw { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }

/* Conversation weather: one track per speaker, a block per turn/sub-tone. */
.tone-tl { display: flex; flex-direction: column; gap: 7px; }
.tone-tl-grid { display: grid; grid-template-columns: 92px 1fr; gap: 10px; align-items: center; }
@media (max-width: 700px) { .tone-tl-grid { grid-template-columns: 60px 1fr; gap: 7px; } }
.tone-tl-name { font-size: var(--fs-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tone-tl-name.s1 { color: var(--speaker-1); } .tone-tl-name.s2 { color: var(--speaker-2); }
.tone-tl-track { position: relative; height: 22px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.tone-tl-block { position: absolute; top: 0; bottom: 0; border-radius: 2px; min-width: 3px; }
.tone-tl-markers { position: relative; height: 19px; }
.tone-tl-marker { position: absolute; bottom: 0; font-size: var(--fs-2xs); font-weight: 700; white-space: nowrap; }
.tone-tl-marker.peak { color: var(--critical); } .tone-tl-marker.warm { color: var(--good); }
.tone-tl-axis { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--ink-muted); }
.tone-note { font-size: var(--fs-xs); color: var(--ink-muted); line-height: 1.55; margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--border); }

/* Tension curve — single series, no y-axis numbers, same x-scale as tracks. */
.tension-row { margin-top: 4px; align-items: end; }
.tension-label { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-muted); font-weight: 700; }
.tension-svg { display: block; width: 100%; height: 70px; }

/* Tone balance: stacked share of speaking time, 2px surface gaps. */
.tone-bal-row { margin-bottom: 13px; } .tone-bal-row:last-child { margin-bottom: 0; }
.tone-bal-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.tone-bal-name { font-size: var(--fs-xs); font-weight: 700; }
.tone-bal-name.s1 { color: var(--speaker-1); } .tone-bal-name.s2 { color: var(--speaker-2); }
.tone-bal-sub { font-size: var(--fs-2xs); color: var(--ink-muted); }
.tone-bal-bar { display: flex; gap: 2px; height: 22px; border-radius: var(--radius-sm); overflow: hidden; background: var(--bg); border: 1px solid var(--border); }
.tone-bal-seg { display: flex; align-items: center; justify-content: center; font-size: var(--fs-2xs); font-weight: 700; color: var(--tone-label-ink); min-width: 0; overflow: hidden; }

/* Pace / reciprocity bars (same anatomy as the four-horsemen tracks). */
.pace-speaker { font-size: var(--fs-xs); font-weight: 700; margin: 12px 0 7px; }
.pace-speaker:first-child { margin-top: 0; }
.pace-speaker.s1 { color: var(--speaker-1); } .pace-speaker.s2 { color: var(--speaker-2); }
.pace-row { display: grid; grid-template-columns: 104px 1fr 58px; align-items: center; gap: 10px; margin-bottom: 6px; }
@media (max-width: 700px) { .pace-row { grid-template-columns: 84px 1fr 50px; gap: 7px; } }
.pace-label { font-size: var(--fs-xs); color: var(--ink-secondary); }
.pace-track { height: 9px; background: var(--border); border-radius: 5px; overflow: hidden; }
.pace-fill { height: 100%; border-radius: 5px; }
.pace-value { font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--ink); text-align: right; }
.pace-caption { font-size: var(--fs-sm); color: var(--ink-secondary); line-height: 1.55; margin: 10px 0 0; }

/* Key moments + "said vs. sounded" cards. */
.moment-card { background: var(--bg); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 10px; }
.moment-card:last-child { margin-bottom: 0; }
.moment-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 7px; }
.moment-time { font-family: var(--font-mono); font-size: var(--fs-2xs); font-weight: 700; color: var(--ink); background: var(--surface-raised); border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px; text-decoration: none; }
a.moment-time:hover { border-color: var(--border-strong); }
.moment-type { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; color: var(--ink-muted); }
.moment-quote { font-size: var(--fs-sm); color: var(--ink); font-style: italic; margin: 0 0 6px; line-height: 1.5; }
.moment-why { font-size: var(--fs-xs); color: var(--ink-secondary); line-height: 1.55; margin: 0; }
.moment-jump { font-size: var(--fs-2xs); color: var(--ink-muted); text-decoration: none; margin-left: auto; }
.moment-jump:hover { color: var(--ink-secondary); }
.mismatch-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0; }
@media (max-width: 700px) { .mismatch-grid { grid-template-columns: 1fr; } }
.mismatch-cell { background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 11px; }
.mismatch-cell-label { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-muted); font-weight: 700; margin-bottom: 3px; }
.mismatch-cell-body { font-size: var(--fs-xs); color: var(--ink-secondary); line-height: 1.5; }

/* "How conflict moves" */
.flow-chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 0; }
.flow-chip { display: inline-flex; align-items: center; gap: 7px; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 6px 13px; font-size: var(--fs-xs); }
.flow-chip-label { color: var(--ink-muted); }
.flow-chip-value { font-weight: 700; color: var(--ink); }
.flow-block { margin-top: 15px; }
.flow-block-title { font-size: var(--fs-xs); font-weight: 700; color: var(--ink); margin-bottom: 5px; }
.flow-block-body { font-size: var(--fs-sm); color: var(--ink-secondary); line-height: 1.6; margin: 0; }

/* Overview tab: compact tone summary linking through to the Emotional tab. */
.tone-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.tone-strip-mini { display: flex; align-items: center; gap: 8px; }
.tone-strip-name { font-size: var(--fs-2xs); font-weight: 700; min-width: 52px; }
.tone-strip-name.s1 { color: var(--speaker-1); } .tone-strip-name.s2 { color: var(--speaker-2); }
.tone-strip-bar { display: flex; gap: 2px; width: 104px; height: 9px; border-radius: 5px; overflow: hidden; background: var(--bg); }
.tone-strip-fact { font-size: var(--fs-2xs); color: var(--ink-muted); }
.tone-strip-fact b { color: var(--ink); font-family: var(--font-mono); font-weight: 700; }

/* Transcript with a timestamp gutter + bucket-tinted tone chips. Only applied
   when tone metrics exist, so ElevenLabs transcripts render exactly as before. */
.rr-transcript.timed .rr-t-line { grid-template-columns: auto auto auto 1fr; }
@media (max-width: 560px) { .rr-transcript.timed .rr-t-line { grid-template-columns: auto auto 1fr; } }
.t-time { font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--ink-muted); text-decoration: none; }
.rr-t-line:target { background: var(--accent-tint); border-radius: var(--radius-sm); box-shadow: 0 0 0 8px var(--accent-tint); }
.t-tone.bucket { font-style: normal; font-weight: 600; color: var(--ink-secondary); border: 1px solid var(--border-strong); border-radius: 999px; padding: 1px 8px; }
.t-tone.b-positive { background: rgba(119, 200, 157, 0.18); border-color: rgba(119, 200, 157, 0.5); }
.t-tone.b-calm     { background: rgba(150, 137, 133, 0.18); border-color: rgba(150, 137, 133, 0.5); }
.t-tone.b-distress { background: rgba(242, 201, 76, 0.18); border-color: rgba(242, 201, 76, 0.5); }
.t-tone.b-hostile  { background: rgba(224, 82, 77, 0.18); border-color: rgba(224, 82, 77, 0.5); }
