/* ============================================================
   EMM — Control-room precision design system
   ============================================================ */

/* ---- tokens : LIGHT ---------------------------------------- */
:root {
  --font: "IBM Plex Sans", "IBM Plex Sans Devanagari", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;

  --paper:      oklch(0.965 0.004 255);
  --surface:    #ffffff;
  --surface-2:  oklch(0.985 0.003 255);
  --surface-3:  oklch(0.955 0.004 255);
  --ink:        oklch(0.26 0.018 260);
  --ink-2:      oklch(0.40 0.018 260);
  --muted:      oklch(0.56 0.015 260);
  --faint:      oklch(0.70 0.012 260);
  --line:       oklch(0.91 0.005 260);
  --line-2:     oklch(0.86 0.006 260);
  --cell-empty: oklch(0.955 0.004 260);

  --accent:     oklch(0.40 0.095 264);
  --accent-rgb: 27 58 107;
  --accent-soft: rgba(var(--accent-rgb) / 0.08);
  --accent-ink: #ffffff;

  --pos: oklch(0.60 0.115 152);
  --neu: oklch(0.66 0.018 255);
  --neg: oklch(0.56 0.155 27);

  --rail-bg:   oklch(0.22 0.022 262);
  --rail-ink:  oklch(0.78 0.02 262);
  --rail-active: oklch(0.30 0.05 264);

  --radius: 4px;
  --radius-lg: 6px;
  --gap: 16px;
  --pad: 16px;
  --rail-w: 188px;
  --slide-w: 540px;
  --shadow: 0 1px 2px rgba(15,20,30,0.05), 0 1px 1px rgba(15,20,30,0.04);
  --shadow-lg: 0 12px 40px rgba(12,16,24,0.18), 0 2px 8px rgba(12,16,24,0.10);
  --t-fast: 0.12s ease;
}

[data-theme="dark"] {
  --paper:      oklch(0.16 0.012 260);
  --surface:    oklch(0.205 0.014 260);
  --surface-2:  oklch(0.235 0.015 260);
  --surface-3:  oklch(0.26 0.016 260);
  --ink:        oklch(0.93 0.008 260);
  --ink-2:      oklch(0.80 0.012 260);
  --muted:      oklch(0.62 0.015 260);
  --faint:      oklch(0.48 0.012 260);
  --line:       oklch(0.30 0.014 260);
  --line-2:     oklch(0.36 0.016 260);
  --cell-empty: oklch(0.24 0.014 260);
  --accent:     oklch(0.62 0.11 262);
  --accent-rgb: 96 134 196;
  --accent-ink: oklch(0.16 0.012 260);
  --rail-bg:   oklch(0.13 0.012 262);
  --rail-ink:  oklch(0.66 0.02 262);
  --rail-active: oklch(0.26 0.04 264);
  --pos: oklch(0.68 0.13 152);
  --neg: oklch(0.64 0.16 27);
  --shadow: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-lg: 0 14px 48px rgba(0,0,0,0.6);
}

[data-density="compact"] { --gap: 11px; --pad: 12px; --rail-w: 170px; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html[lang="hi"] { --line-bump: 1.5; }
body {
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
html[lang="hi"] body { line-height: 1.62; }
.mono { font-family: var(--mono); font-feature-settings: "tnum" 1; }
.clickable { cursor: pointer; }
button { font-family: inherit; color: inherit; }

/* backdrop grid (control-room) */
[data-grid="on"] body {
  background-image:
    linear-gradient(rgba(var(--accent-rgb)/0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--accent-rgb)/0.025) 1px, transparent 1px);
  background-size: 28px 28px;
}

/* ============================================================
   APP SHELL
   ============================================================ */
#root, .emm-app { height: 100vh; }
.emm-app { display: flex; overflow: hidden; }

/* ---- LEFT RAIL ---- */
.emm-rail {
  width: var(--rail-w); flex: 0 0 var(--rail-w);
  background: var(--rail-bg); color: var(--rail-ink);
  display: flex; flex-direction: column;
  padding: 14px 10px; gap: 4px;
  border-right: 1px solid rgba(255,255,255,0.06);
}
.emm-rail-brand { padding: 6px 8px 14px; }
.emm-rail-mark {
  font-family: var(--mono); font-weight: 600; letter-spacing: 0.16em;
  font-size: 15px; color: #fff;
  border: 1px solid rgba(255,255,255,0.22); border-radius: var(--radius);
  padding: 7px 10px; display: inline-block;
}
.emm-rail-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.emm-rail-foot { border-top: 1px solid rgba(255,255,255,0.08); padding-top: 6px; }
.emm-rail-item {
  display: flex; align-items: center; gap: 10px;
  background: none; border: 0; width: 100%; text-align: left;
  padding: 9px 10px; border-radius: var(--radius); cursor: pointer;
  color: var(--rail-ink); font-size: 13.5px; transition: var(--t-fast);
}
.emm-rail-item:hover { background: rgba(255,255,255,0.05); color: #fff; }
.emm-rail-item.active { background: var(--rail-active); color: #fff; }
.emm-rail-ico { width: 16px; height: 16px; display: grid; place-items: center; flex: 0 0 16px; }
.emm-rail-ico svg { width: 15px; height: 15px; fill: currentColor; }
.emm-rail-lab { white-space: nowrap; }

/* ---- MAIN ---- */
.emm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100vh; }

/* top bar */
.emm-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 18px; height: 56px; flex: 0 0 56px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.emm-topbar-titles { line-height: 1.15; }
.emm-topbar-app { font-weight: 600; font-size: 14.5px; letter-spacing: -0.01em; }
.emm-topbar-org { font-size: 10.5px; color: var(--muted); letter-spacing: 0.02em; }
.emm-topbar-r { display: flex; align-items: center; gap: 10px; }
.emm-topbar-div { width: 1px; height: 24px; background: var(--line-2); }
.emm-tool-btn {
  background: var(--surface-2); border: 1px solid var(--line-2); color: var(--ink-2);
  font-size: 12px; padding: 6px 11px; border-radius: var(--radius); cursor: pointer;
  letter-spacing: 0.01em; transition: var(--t-fast); white-space: nowrap;
}
.emm-tool-btn:hover { border-color: var(--accent); color: var(--accent); }
.emm-tool-btn.ghost { background: transparent; }
.emm-tool-btn.accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.emm-tool-btn.accent:hover { filter: brightness(1.08); color: var(--accent-ink); }
.emm-tool-btn.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.emm-lang { display: flex; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; }
.emm-lang-btn {
  background: var(--surface-2); border: 0; padding: 6px 10px; font-size: 12px; cursor: pointer;
  color: var(--muted); letter-spacing: 0.04em; transition: var(--t-fast);
}
.emm-lang-btn.dev { font-family: var(--font); }
.emm-lang-btn.active { background: var(--accent); color: var(--accent-ink); }

/* time control */
.emm-time { display: flex; gap: 0; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; }
.emm-time-btn {
  background: var(--surface-2); border: 0; border-right: 1px solid var(--line);
  padding: 6px 11px; font-size: 12px; cursor: pointer; color: var(--ink-2);
  display: flex; align-items: center; gap: 6px; transition: var(--t-fast); white-space: nowrap;
}
.emm-time-btn:last-child { border-right: 0; }
.emm-time-btn:hover { background: var(--surface-3); }
.emm-time-btn.active { background: var(--accent); color: var(--accent-ink); }
.emm-time-btn.ghost { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.emm-live-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--neg);
  box-shadow: 0 0 0 0 rgba(220,60,50,0.5); animation: emm-pulse 1.8s infinite;
}
.emm-time-btn.active .emm-live-dot { background: #fff; box-shadow: none; }
@keyframes emm-pulse { 0%{box-shadow:0 0 0 0 rgba(220,60,50,0.5);} 70%{box-shadow:0 0 0 5px rgba(220,60,50,0);} 100%{box-shadow:0 0 0 0 rgba(220,60,50,0);} }

/* sub bar */
.emm-subbar {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 9px 18px; background: var(--surface);
  border-bottom: 1px solid var(--line); min-height: 50px;
}
.emm-crumbs { display: flex; flex-wrap: nowrap; align-items: center; font-size: 12.5px; min-width: 0; }
.emm-crumb-wrap { display: inline-flex; align-items: center; }
.emm-crumb-sep { color: var(--faint); margin: 0 7px; }
.emm-crumb { color: var(--muted); white-space: nowrap; }
.emm-crumb.link, .emm-crumb-wrap button.emm-crumb {
  background: none; border: 0; cursor: pointer; color: var(--ink-2); padding: 2px 0;
}
.emm-crumb.link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.emm-crumb.current { color: var(--ink); font-weight: 600; }

/* lens switch */
.emm-lens { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.emm-lens-cap { font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.emm-lens-seg { display: flex; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; }
.emm-lens-btn {
  display: flex; flex-direction: column; align-items: center; gap: 1px; position: relative;
  background: var(--surface-2); border: 0; border-right: 1px solid var(--line);
  padding: 4px 11px; cursor: pointer; transition: var(--t-fast); min-width: 56px;
}
.emm-lens-btn:last-child { border-right: 0; }
.emm-lens-btn .code { font-size: 9px; color: var(--faint); letter-spacing: 0.05em; }
.emm-lens-btn .name { font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }
.emm-lens-btn:hover { background: var(--surface-3); }
.emm-lens-btn.active { background: var(--accent); }
.emm-lens-btn.active .code, .emm-lens-btn.active .name { color: var(--accent-ink); }
.emm-lens-btn .rep-dot { position: absolute; top: 4px; right: 5px; width: 4px; height: 4px; border-radius: 50%; background: var(--neu); }
.emm-lens-desc { font-size: 10px; color: var(--muted); max-width: 340px; text-align: right; }
.emm-lens-desc em { color: var(--faint); font-style: normal; }

/* filter chips */
.emm-chipbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 18px; background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.emm-chipbar-cap { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.emm-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--accent); color: var(--ink);
  border-radius: 100px; padding: 3px 5px 3px 10px; cursor: pointer; font-size: 12px; transition: var(--t-fast);
}
.emm-chip:hover { background: var(--accent-soft); }
.emm-chip-key { font-size: 9.5px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.05em; }
.emm-chip-x { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 13px; line-height: 1; }
.emm-chip-clear { background: none; border: 0; color: var(--muted); font-size: 11px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* content */
.emm-content { flex: 1; overflow-y: auto; padding: 20px; zoom: var(--font-scale, 1); }
.emm-screen { max-width: 1480px; margin: 0 auto; }

/* screen head */
.emm-screenhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.emm-screenhead-title { font-size: 22px; font-weight: 600; letter-spacing: -0.015em; margin: 0; display: flex; align-items: center; gap: 12px; }
.emm-screenhead-sub { font-size: 11.5px; color: var(--muted); margin: 4px 0 0; letter-spacing: 0.01em; }
.emm-live-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 10px; letter-spacing: 0.06em; color: var(--neg); border: 1px solid var(--neg); border-radius: 100px; padding: 2px 9px; text-transform: uppercase; white-space: nowrap; }
.emm-rolenote { font-size: 11.5px; color: var(--muted); }
.emm-rolenote b { color: var(--ink); }
.emm-rep-banner { font-size: 10.5px; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 6px 11px; }

/* ============================================================
   PANEL
   ============================================================ */
.emm-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.emm-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 13px var(--pad) 0; }
.emm-panel-head > div:first-child { min-width: 0; flex: 1; }
.emm-panel-title { font-size: 13px; font-weight: 600; margin: 0; letter-spacing: -0.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emm-panel-sub { font-size: 10.5px; color: var(--muted); margin: 2px 0 0; }
.emm-panel-right { flex: 0 0 auto; }
.emm-panel-body { padding: 12px var(--pad) var(--pad); }
.emm-panel-body.flush { padding: 10px 0 0; }
.emm-panel-hint { font-size: 10px; color: var(--faint); }
.emm-count-badge { font-size: 11px; background: var(--surface-3); border: 1px solid var(--line-2); border-radius: 100px; padding: 1px 8px; color: var(--ink-2); }
.emm-count-badge.neg { color: var(--neg); border-color: var(--neg); }

/* ============================================================
   KPI
   ============================================================ */
.emm-kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--gap); margin-bottom: var(--gap); }
.emm-kpi-grid.four { grid-template-columns: repeat(4, 1fr); }
.emm-kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px var(--pad); box-shadow: var(--shadow); transition: var(--t-fast); min-width: 0; }
.emm-kpi.clickable:hover { border-color: var(--accent); transform: translateY(-1px); }
.emm-kpi-label { font-size: 10.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emm-kpi-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.emm-kpi-value { font-size: 25px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; white-space: nowrap; }
.emm-kpi-value.trunc { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.emm-kpi.big .emm-kpi-value { font-size: 30px; }
.emm-kpi-unit { font-size: 14px; color: var(--muted); margin-left: 3px; }
.emm-kpi-foot { font-size: 11px; color: var(--muted); margin-top: 7px; }
.emm-kpi-delta { display: flex; align-items: center; gap: 5px; font-size: 11px; margin-top: 9px; }
.emm-kpi-delta.good { color: var(--pos); } .emm-kpi-delta.bad { color: var(--neg); }
.emm-kpi-delta .arrow { font-size: 9px; }
.emm-kpi-delta-cap { color: var(--faint); margin-left: 2px; }

/* ============================================================
   COCKPIT LAYOUT
   ============================================================ */
.emm-cockpit-cols { display: grid; grid-template-columns: 5fr 7fr; gap: var(--gap); align-items: stretch; }
.emm-cockpit-left, .emm-cockpit-right { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }

.emm-alert-list { display: flex; flex-direction: column; gap: 8px; }
.emm-alert { display: flex; align-items: stretch; gap: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 0; cursor: pointer; text-align: left; overflow: hidden; transition: var(--t-fast); }
.emm-alert:hover { border-color: var(--neg); background: var(--surface-3); }
.emm-alert-bar { width: 3px; background: var(--neg); flex: 0 0 3px; }
.emm-alert-body { padding: 10px 12px; flex: 1; min-width: 0; }
.emm-alert-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.emm-alert-reach { font-size: 11px; color: var(--neg); white-space: nowrap; }
.emm-alert-head { font-size: 13px; font-weight: 500; line-height: 1.35; margin-bottom: 5px; }
.emm-alert-meta { font-size: 10.5px; color: var(--muted); }
.emm-alert-go { display: grid; place-items: center; padding: 0 12px; color: var(--faint); font-size: 18px; }

.emm-bigsent { display: flex; flex-direction: column; gap: 10px; }
.emm-bigsent-row { display: grid; grid-template-columns: 46px 1fr auto auto; align-items: center; gap: 10px; }
.emm-bigsent-num { font-size: 15px; font-weight: 600; }
.emm-bigsent-num.pos { color: var(--pos); } .emm-bigsent-num.neu { color: var(--neu); } .emm-bigsent-num.neg { color: var(--neg); }
.emm-bigsent-track { height: 9px; background: var(--surface-3); border-radius: 100px; overflow: hidden; }
.emm-bigsent-fill { height: 100%; border-radius: 100px; }
.emm-bigsent-fill.pos { background: var(--pos); } .emm-bigsent-fill.neu { background: var(--neu); } .emm-bigsent-fill.neg { background: var(--neg); }
.emm-bigsent-lab { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; width: 64px; }
.emm-bigsent-cnt { font-size: 11px; color: var(--ink-2); text-align: right; }

/* ============================================================
   SENTIMENT primitives
   ============================================================ */
.emm-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.emm-sentchip { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; padding: 2px 9px 2px 8px; border-radius: 100px; border: 1px solid var(--line-2); text-transform: capitalize; }
.emm-sentchip.pos { color: var(--pos); border-color: color-mix(in oklch, var(--pos), transparent 55%); }
.emm-sentchip.neu { color: var(--neu); border-color: var(--line-2); }
.emm-sentchip.neg { color: var(--neg); border-color: color-mix(in oklch, var(--neg), transparent 55%); }

/* ============================================================
   BARS / LEADERBOARD
   ============================================================ */
.emm-bar-row { padding: 4px 8px; margin: 0 -8px; border-radius: var(--radius); transition: var(--t-fast); }
.emm-bar-row.clickable { cursor: pointer; }
.emm-bar-row.clickable:hover { background: var(--surface-2); }
.emm-bar-row.active { background: var(--accent-soft); }
.emm-bar-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 5px; }
.emm-bar-label { flex: 1; font-size: 12.5px; display: flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emm-bar-val { font-size: 12px; color: var(--ink-2); flex: 0 0 auto; white-space: nowrap; }
.emm-bar-track { background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.emm-bar-sub { font-size: 9.5px; color: var(--faint); margin-top: 4px; }
.emm-board-label { display: flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* logo monogram */
.emm-logo { display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius); font-weight: 600; letter-spacing: 0.02em; flex: 0 0 auto; }

/* ============================================================
   HEATMAP / DAYPART
   ============================================================ */
.emm-heat-table { border-collapse: separate; border-spacing: 2px; width: 100%; }
.emm-heat-label { font-size: 11px; color: var(--ink-2); white-space: nowrap; padding-right: 8px; text-align: right; max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
.emm-heat-cell { height: 18px; border-radius: 2px; transition: var(--t-fast); }
.emm-heat-cell.clickable { cursor: pointer; }
.emm-heat-cell.clickable:hover { outline: 2px solid var(--accent); outline-offset: -1px; }
.emm-heat-cell.big { height: 30px; min-width: 30px; text-align: center; }
.emm-heat-axis td { font-size: 9px; color: var(--faint); text-align: center; padding-top: 3px; }
.emm-heat-axis .dow { font-size: 10px; }
.emm-heat-label.dp { font-size: 10.5px; }
.dp-val { font-size: 10px; }
tr.active .emm-heat-label { color: var(--accent); font-weight: 600; }
.emm-heatleg { display: flex; align-items: center; gap: 6px; font-size: 9px; color: var(--faint); }
.emm-heatleg-ramp { width: 56px; height: 8px; border-radius: 2px; background: linear-gradient(90deg, rgba(var(--accent-rgb)/0.1), rgba(var(--accent-rgb)/1)); }

/* ============================================================
   STORY LIST
   ============================================================ */
.emm-storylist { display: flex; flex-direction: column; }
.emm-story-row { display: grid; grid-template-columns: 1fr 90px 64px 76px 40px 76px; align-items: center; gap: 12px; padding: 11px var(--pad); border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; cursor: pointer; transition: var(--t-fast); width: 100%; }
.emm-story-row.head { cursor: default; padding-top: 6px; padding-bottom: 8px; }
.emm-story-row.head span { font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.emm-story-row:not(.head):hover { background: var(--surface-2); }
.emm-story-row:last-child { border-bottom: 0; }
.emm-story-row .c-head { font-size: 13px; display: flex; align-items: center; gap: 8px; min-width: 0; line-height: 1.3; }
.emm-story-row .c-head { overflow: hidden; }
.emm-story-id { font-size: 10px; color: var(--faint); flex: 0 0 auto; }
.emm-hot { font-size: 8.5px; background: var(--neg); color: #fff; padding: 1px 5px; border-radius: 3px; letter-spacing: 0.06em; flex: 0 0 auto; }
.emm-story-row .c-ch { display: flex; align-items: center; gap: 5px; }
.emm-more { font-size: 10px; color: var(--muted); }
.emm-story-row .c-time, .emm-story-row .c-dur, .emm-story-row .c-reach { font-size: 11.5px; color: var(--ink-2); }
.emm-story-row .c-reach { text-align: right; }
.emm-story-row .c-sent { display: flex; justify-content: center; }

/* trend legend */
.emm-trend-legend { display: flex; gap: 16px; font-size: 10.5px; color: var(--muted); margin-top: 8px; }
.emm-trend-legend span { display: inline-flex; align-items: center; gap: 5px; }

/* ============================================================
   CHANNEL SCREEN
   ============================================================ */
.emm-chhead { display: flex; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; margin-bottom: var(--gap); box-shadow: var(--shadow); }
.emm-chhead-main { flex: 1; min-width: 0; }
.emm-chhead-name { font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -0.015em; }
.emm-chhead-meta { display: flex; gap: 14px; font-size: 11px; color: var(--muted); margin-top: 5px; flex-wrap: wrap; }
.emm-tier { color: var(--accent); border: 1px solid color-mix(in oklch, var(--accent), transparent 60%); border-radius: 3px; padding: 0 6px; }
.emm-chhead-sent { width: 220px; flex: 0 0 220px; }
.emm-chhead-sent-cap { font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); margin-bottom: 4px; }
.emm-chhead-ratio { font-size: 16px; margin-bottom: 7px; }

.emm-channel-grid, .emm-topic-grid, .emm-reach-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--gap); align-items: stretch; }
.emm-channel-grid > .emm-panel, .emm-topic-grid > .emm-panel, .emm-reach-grid > .emm-panel { align-self: start; min-width: 0; }
.emm-channel-grid .span-trend { grid-column: span 7; }
.emm-channel-grid .span-topics { grid-column: span 5; }
.emm-channel-grid .span-daypart { grid-column: span 7; }
.emm-channel-grid .span-dur { grid-column: span 5; }
.emm-channel-grid .span-stories { grid-column: span 12; }

.emm-statstrip { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.emm-statstrip-item { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.emm-statstrip-label { font-size: 9.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.emm-statstrip-value { font-size: 18px; font-weight: 600; margin-top: 4px; }

/* ============================================================
   TOPIC SCREEN
   ============================================================ */
.emm-tphead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; margin-bottom: var(--gap); box-shadow: var(--shadow); }
.emm-tphead-cap { font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.emm-tphead-name { font-size: 24px; font-weight: 600; margin: 4px 0 0; letter-spacing: -0.015em; }
.emm-tphead-stats { display: flex; gap: 26px; }
.emm-tphead-stat { text-align: right; }
.emm-tphead-stat .lab { font-size: 9.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.emm-tphead-stat .val { font-size: 20px; font-weight: 600; margin-top: 4px; white-space: nowrap; }
.emm-topic-grid .span-trend { grid-column: span 8; }
.emm-topic-grid .span-cross { grid-column: span 4; }
.emm-topic-grid .span-journos { grid-column: span 12; }
.emm-topic-grid .span-stories { grid-column: span 12; }
.emm-jlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }

/* journalist card */
.emm-jcard { display: flex; align-items: center; gap: 11px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; text-align: left; width: 100%; transition: var(--t-fast); }
.emm-jcard.clickable { cursor: pointer; }
.emm-jcard.clickable:hover { border-color: var(--accent); }
.emm-javatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 13px; font-weight: 600; flex: 0 0 38px; }
.emm-javatar.lg { width: 46px; height: 46px; font-size: 15px; flex: 0 0 46px; }
.emm-jbody { flex: 1; min-width: 0; }
.emm-jname { font-size: 13px; font-weight: 600; }
.emm-jmeta { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.emm-jstats { display: flex; gap: 10px; font-size: 10px; color: var(--faint); margin-top: 3px; }
.emm-jcount { text-align: center; flex: 0 0 auto; }
.emm-jcount b { font-size: 18px; display: block; } .emm-jcount span { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* ============================================================
   STORY DETAIL / SLIDE-OVER
   ============================================================ */
.emm-scrim { position: fixed; inset: 0; background: rgba(10,14,22,0.34); z-index: 40; animation: emm-fade 0.18s ease; }
[data-theme="dark"] .emm-scrim { background: rgba(0,0,0,0.55); }
@keyframes emm-fade { from { opacity: 0; } }
.emm-slideover { position: fixed; top: 0; right: 0; height: 100vh; width: var(--slide-w); max-width: 92vw; background: var(--surface); border-left: 1px solid var(--line-2); box-shadow: var(--shadow-lg); z-index: 41; display: flex; flex-direction: column; animation: emm-slidein 0.24s cubic-bezier(0.22,0.61,0.36,1); }
@keyframes emm-slidein { from { transform: translateX(100%); } }
.emm-fullstory { position: fixed; inset: 0; z-index: 45; background: var(--paper); overflow-y: auto; animation: emm-fade 0.2s ease; }

.emm-story-detail { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.emm-story-detail.full { max-width: 1180px; margin: 0 auto; height: auto; min-height: 100%; background: var(--surface); border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.emm-sd-head { padding: 18px 20px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.emm-sd-head-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.emm-sd-tags { display: flex; align-items: center; gap: 8px; }
.emm-tag.topic { background: var(--accent-soft); color: var(--accent); border: 0; border-radius: 3px; padding: 3px 9px; font-size: 11px; cursor: pointer; }
.emm-tag.topic:hover { background: var(--accent); color: var(--accent-ink); }
.emm-sd-head-actions { display: flex; align-items: center; gap: 8px; }
.emm-btn { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 6px 12px; font-size: 12px; cursor: pointer; transition: var(--t-fast); }
.emm-btn:hover { border-color: var(--accent); color: var(--accent); }
.emm-iconbtn { width: 30px; height: 30px; border-radius: var(--radius); border: 1px solid var(--line-2); background: var(--surface); font-size: 18px; line-height: 1; cursor: pointer; color: var(--muted); }
.emm-iconbtn:hover { color: var(--ink); border-color: var(--line-2); }
.emm-iconbtn.sm { width: 22px; height: 22px; font-size: 14px; }
.emm-sd-headline { font-size: 20px; font-weight: 600; line-height: 1.3; margin: 0 0 12px; letter-spacing: -0.01em; }
.emm-story-detail.full .emm-sd-headline { font-size: 26px; }
.emm-sd-subrow { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.emm-sd-reach { font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.emm-sd-day { font-size: 11px; color: var(--muted); white-space: nowrap; }
.emm-sd-entities { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.emm-sd-ent-cap { font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.emm-ent-chip { font-size: 11px; background: var(--surface-3); border: 1px solid var(--line); border-radius: 100px; padding: 2px 10px; color: var(--ink-2); white-space: nowrap; }

.emm-sd-body { flex: 1; overflow-y: auto; padding: 18px 20px; }
.emm-sd-body.full { display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; padding: 26px; }
.emm-sd-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.emm-sd-section { }
.emm-sd-sectitle { font-size: 12px; font-weight: 600; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; letter-spacing: 0.01em; }
.emm-lens-tag { font-size: 9px; background: var(--accent-soft); color: var(--accent); border-radius: 3px; padding: 1px 6px; }
.emm-air-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 10px; }
.emm-air-tab { background: var(--surface-2); border: 1px solid var(--line); border-radius: 3px; padding: 2px 8px; font-size: 10px; cursor: pointer; color: var(--muted); }
.emm-air-tab.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.emm-airings { display: flex; flex-direction: column; gap: 6px; }
.emm-airing { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; cursor: pointer; text-align: left; transition: var(--t-fast); }
.emm-airing.sel { border-color: var(--accent); background: var(--accent-soft); }
.emm-airing-main { flex: 1; min-width: 0; }
.emm-airing-ch { font-size: 12.5px; font-weight: 500; }
.emm-airing-meta { font-size: 10px; color: var(--muted); margin-top: 1px; }
.emm-airing-stats { display: flex; flex-direction: column; align-items: flex-end; font-size: 11px; color: var(--ink-2); }
.emm-airing-stats .reach { color: var(--accent); font-size: 10px; }

.emm-release { display: flex; align-items: center; gap: 11px; border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 13px; background: var(--surface-2); }
.emm-release.matched { border-color: color-mix(in oklch, var(--pos), transparent 55%); }
.emm-release-icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 26px; font-size: 13px; }
.emm-release.matched .emm-release-icon { background: color-mix(in oklch, var(--pos), transparent 80%); color: var(--pos); }
.emm-release.nomatch .emm-release-icon { background: var(--surface-3); color: var(--muted); }
.emm-release-id { font-size: 10px; color: var(--muted); }
.emm-release-title { font-size: 12.5px; }

.emm-crossmedia { display: flex; flex-direction: column; gap: 8px; }
.emm-cm-row { display: grid; grid-template-columns: 96px 1fr 56px; align-items: center; gap: 10px; }
.emm-cm-label { font-size: 11.5px; color: var(--ink-2); }
.emm-cm-track { height: 8px; background: var(--surface-3); border-radius: 100px; overflow: hidden; }
.emm-cm-fill { height: 100%; background: var(--accent); border-radius: 100px; }
.emm-cm-val { font-size: 11px; text-align: right; color: var(--ink-2); }
.emm-cm-total { font-size: 12px; text-align: right; margin-top: 6px; color: var(--accent); font-weight: 600; }

/* ============================================================
   CLIP PLAYER
   ============================================================ */
.emm-clip { border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface-2); }
.emm-clip-video { position: relative; aspect-ratio: 16/9; background: #0c0f16; display: grid; place-items: center; overflow: hidden; }
.emm-clip-ph { position: absolute; inset: 0; display: grid; place-items: center; }
.emm-clip-stripes { position: absolute; inset: 0; background: repeating-linear-gradient(135deg, rgba(255,255,255,0.03) 0 12px, rgba(255,255,255,0.06) 12px 24px); }
.emm-clip-phlabel { position: relative; font-size: 10px; color: rgba(255,255,255,0.5); letter-spacing: 0.05em; }
.emm-clip-chrome { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; }
.emm-clip-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 9.5px; color: #fff; background: rgba(0,0,0,0.5); border-radius: 3px; padding: 3px 7px; backdrop-filter: blur(4px); white-space: nowrap; }
.emm-clip-badge.lower { background: rgba(0,0,0,0.4); }
.emm-clip-play { position: relative; width: 52px; height: 52px; border-radius: 50%; border: 0; background: rgba(255,255,255,0.92); color: #11151e; font-size: 17px; cursor: pointer; display: grid; place-items: center; transition: var(--t-fast); padding-left: 3px; }
.emm-clip-play.playing { padding-left: 0; }
.emm-clip-play:hover { background: #fff; transform: scale(1.06); }
.emm-clip-scrub { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--surface); }
.emm-clip-mini { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface-2); font-size: 10px; cursor: pointer; flex: 0 0 26px; padding-left: 1px; }
.emm-clip-bar { flex: 1; height: 5px; background: var(--surface-3); border-radius: 100px; position: relative; cursor: pointer; }
.emm-clip-fill { position: absolute; left: 0; top: 0; height: 100%; background: var(--accent); border-radius: 100px; }
.emm-clip-knob { position: absolute; top: 50%; width: 11px; height: 11px; border-radius: 50%; background: var(--accent); transform: translate(-50%, -50%); }
.emm-clip-time { font-size: 11px; color: var(--muted); flex: 0 0 auto; }
.emm-clip-transcript { max-height: 230px; overflow-y: auto; padding: 6px 0; }
.emm-tline { display: flex; gap: 12px; padding: 7px 14px; margin: 0; transition: var(--t-fast); border-left: 2px solid transparent; }
.emm-tline-t { font-size: 10px; color: var(--faint); flex: 0 0 38px; padding-top: 2px; }
.emm-tline-txt { font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }
.emm-tline.active { background: var(--surface-3); border-left-color: var(--accent); }
.emm-tline.active .emm-tline-txt { color: var(--ink); }
.emm-tline.matched .emm-tline-txt { background: color-mix(in oklch, var(--pos), transparent 86%); box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--pos), transparent 70%); border-radius: 3px; padding: 2px 6px; }
.emm-matched-tag { display: inline-block; font-size: 8.5px; color: var(--pos); border: 1px solid color-mix(in oklch, var(--pos), transparent 55%); border-radius: 3px; padding: 0 5px; margin-left: 7px; vertical-align: middle; letter-spacing: 0.03em; }

/* ============================================================
   JOURNALISTS SCREEN
   ============================================================ */
.emm-jgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--gap); }
.emm-jprofile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow); }
.emm-jprofile-head { display: flex; gap: 12px; align-items: center; }
.emm-jhandle { font-size: 10px; color: var(--faint); margin-top: 2px; }
.emm-jprofile-stats { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); align-items: center; }
.emm-jstat .val { font-size: 18px; font-weight: 600; }
.emm-jstat .lab { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }

/* ============================================================
   REACH EXPLORER
   ============================================================ */
.emm-reach-grid .span-map { grid-column: span 5; }
.emm-reach-grid .span-rank { grid-column: span 7; }
.emm-reach-grid .span-daypart { grid-column: span 7; }
.emm-reach-grid .span-spend { grid-column: span 5; }
.emm-map-note { font-size: 9.5px; color: var(--faint); margin-top: 8px; text-align: center; }
.emm-spend { display: flex; flex-direction: column; gap: 12px; }
.emm-spend-row { display: grid; grid-template-columns: 120px 1fr 56px; align-items: center; gap: 10px; }
.emm-spend-fmt { font-size: 12px; }
.emm-spend-track { height: 9px; background: var(--surface-3); border-radius: 100px; overflow: hidden; }
.emm-spend-fill { height: 100%; background: var(--accent); border-radius: 100px; }
.emm-spend-val { font-size: 13px; font-weight: 600; text-align: right; } .emm-spend-val small { font-size: 9px; color: var(--muted); font-weight: 400; }

/* ============================================================
   COMPARE
   ============================================================ */
.emm-compare-grid { display: grid; gap: var(--gap); }
.emm-compare-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.emm-compare-head { display: flex; align-items: center; gap: 10px; }
.emm-compare-select { flex: 1; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 6px 8px; font-size: 13px; color: var(--ink); cursor: pointer; }
.emm-compare-kpis { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.emm-compare-kpi { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; }
.emm-compare-kpi .val { font-size: 17px; font-weight: 600; }
.emm-compare-kpi .lab { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }

/* ============================================================
   MOBILE
   ============================================================ */
.emm-mobilewrap { }
.emm-mobile-stage { display: flex; align-items: center; gap: 48px; justify-content: center; padding: 30px 0; flex-wrap: wrap; }
.emm-mobile-side { max-width: 320px; }
.emm-mobile-notes { font-family: var(--mono); font-size: 12px; color: var(--muted); line-height: 2; margin: 16px 0 0; padding-left: 18px; }
.emm-phone { width: 320px; height: 660px; background: #0c0f16; border-radius: 42px; padding: 11px; box-shadow: var(--shadow-lg), 0 0 0 2px var(--line-2); position: relative; flex: 0 0 auto; }
.emm-phone-notch { position: absolute; top: 11px; left: 50%; transform: translateX(-50%); width: 130px; height: 26px; background: #0c0f16; border-radius: 0 0 16px 16px; z-index: 3; }
.emm-phone-screen { width: 100%; height: 100%; background: var(--paper); border-radius: 32px; overflow-y: auto; position: relative; }
.emm-mob-statusbar { display: flex; justify-content: space-between; padding: 11px 22px 4px; font-size: 11px; color: var(--ink); }
.emm-mob-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 18px 12px; }
.emm-mob-org { font-size: 9.5px; color: var(--muted); letter-spacing: 0.04em; }
.emm-mob-title { font-size: 18px; font-weight: 600; }
.emm-mob-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 14px; }
.emm-mob-kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.emm-mob-kpi.big { grid-column: span 2; }
.emm-mob-kpi .val { font-size: 22px; font-weight: 600; }
.emm-mob-kpi.big .val { font-size: 30px; color: var(--accent); }
.emm-mob-kpi .lab { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 3px; }
.emm-mob-sent { padding: 12px 14px; }
.emm-mob-section { font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); padding: 6px 18px 6px; }
.emm-mob-alert { display: flex; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin: 0 14px 7px; overflow: hidden; }
.emm-mob-alert > div { padding: 9px 11px; }
.emm-mob-alert-head { font-size: 12px; font-weight: 500; line-height: 1.35; }
.emm-mob-alert-meta { font-size: 9.5px; color: var(--muted); margin-top: 3px; }
.emm-mob-board { padding: 0 14px; }
.emm-mob-brow { display: flex; align-items: center; gap: 9px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.emm-mob-brow:last-child { border-bottom: 0; }
.emm-mob-brow .rank { font-size: 11px; color: var(--faint); width: 14px; }
.emm-mob-brow .name { font-size: 12.5px; flex: 1; }
.emm-mob-brow .val { font-size: 12px; color: var(--ink-2); }
.emm-mob-nav { position: sticky; bottom: 0; display: flex; justify-content: space-around; background: var(--surface); border-top: 1px solid var(--line); padding: 9px 0 16px; margin-top: 10px; }
.emm-mob-navitem { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 9px; color: var(--muted); }
.emm-mob-navitem .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--faint); }
.emm-mob-navitem.active { color: var(--accent); } .emm-mob-navitem.active .dot { background: var(--accent); }

/* ============================================================
   EMPTY / COMING / SKELETON / TIP
   ============================================================ */
.emm-empty { text-align: center; padding: 48px 20px; }
.emm-empty-mark { font-size: 28px; color: var(--faint); }
.emm-empty-title { font-size: 14px; font-weight: 600; margin-top: 10px; }
.emm-empty-sub { font-size: 12px; color: var(--muted); margin-top: 5px; }
.emm-coming { position: relative; text-align: center; padding: 56px 20px; border: 1px dashed var(--line-2); border-radius: var(--radius-lg); }
.emm-coming-tag { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.emm-coming-title { font-size: 17px; font-weight: 600; margin-top: 8px; }
.emm-coming-sub { font-size: 12px; color: var(--muted); margin-top: 5px; }
.emm-skel { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: emm-shimmer 1.4s infinite; }
@keyframes emm-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.emm-tip { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 5px 9px; box-shadow: var(--shadow); pointer-events: none; }

/* ============================================================
   PRD v2 — sidebar groups + user profile
   ============================================================ */
.emm-rail-brandsub { font-size: 9px; color: var(--rail-ink); letter-spacing: 0.14em; margin-top: 6px; opacity: 0.7; }
.emm-rail-group { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
.emm-rail-grouplab { font-size: 8.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--rail-ink); opacity: 0.5; padding: 4px 10px 5px; }
.emm-rail-item.active { box-shadow: inset 3px 0 0 var(--gold, oklch(0.78 0.13 85)); }
.emm-rail-badge { margin-left: auto; background: var(--neg); color: #fff; font-size: 10px; min-width: 17px; height: 17px; border-radius: 100px; display: grid; place-items: center; padding: 0 5px; }
.emm-rail-item.slim { padding: 7px 10px; font-size: 12.5px; opacity: 0.85; }
.emm-rail-user { display: flex; align-items: center; gap: 9px; padding: 10px 8px 2px; margin-top: 6px; border-top: 1px solid rgba(255,255,255,0.08); }
.emm-rail-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--rail-active); color: #fff; display: grid; place-items: center; font-size: 11px; flex: 0 0 30px; letter-spacing: 0.04em; }
.emm-rail-userbody { min-width: 0; }
.emm-rail-username { font-size: 12px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emm-rail-userrole { font-size: 9.5px; color: var(--rail-ink); opacity: 0.8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
:root { --gold: oklch(0.78 0.13 85); }

/* ============================================================
   PRD v2 — 12-column grid
   ============================================================ */
.emm-grid12 { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--gap); align-items: stretch; }
.emm-grid12 > * { min-width: 0; }
/* equal-height cards: panels fill their stretched grid cell, bodies absorb slack */
.emm-grid12 > .emm-panel,
.emm-channel-grid > .emm-panel,
.emm-topic-grid > .emm-panel,
.emm-reach-grid > .emm-panel,
.emm-cockpit-cols > .emm-panel { display: flex; flex-direction: column; }
.emm-grid12 > .emm-panel > .emm-panel-body,
.emm-channel-grid > .emm-panel > .emm-panel-body,
.emm-topic-grid > .emm-panel > .emm-panel-body,
.emm-reach-grid > .emm-panel > .emm-panel-body,
.emm-cockpit-cols > .emm-panel > .emm-panel-body { flex: 1 1 auto; }
/* a column wrapper that holds stacked panels should stretch them too */
.emm-crisis-side > .emm-panel { flex: 1 1 auto; display: flex; flex-direction: column; }
.col4 { grid-column: span 4; } .col5 { grid-column: span 5; } .col6 { grid-column: span 6; }
.col7 { grid-column: span 7; } .col8 { grid-column: span 8; } .col12 { grid-column: span 12; }

/* ============================================================
   PRD v2 — Donut
   ============================================================ */
.emm-donut-wrap { display: flex; align-items: center; gap: 18px; }
.emm-donut-wrap.col { flex-direction: column; gap: 12px; }
.emm-donut-legend { display: flex; flex-direction: column; gap: 7px; flex: 1; min-width: 0; }
.emm-donut-leg-row { display: flex; align-items: center; gap: 8px; }
.emm-donut-leg-lab { font-size: 12px; color: var(--ink-2); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emm-donut-leg-val { font-size: 12px; color: var(--ink); font-weight: 600; }

/* ============================================================
   PRD v2 — NSS card
   ============================================================ */
.emm-nss .emm-kpi-label { display: flex; align-items: center; gap: 5px; }
.emm-nss-info { color: var(--faint); font-size: 10px; cursor: help; }
.emm-nss-val { font-size: 28px; }
.emm-nss-val.good { color: var(--pos); } .emm-nss-val.bad { color: var(--neg); } .emm-nss-val.mid { color: var(--ink); }
.emm-nss-scale { margin-top: 12px; }
.emm-nss-track { position: relative; height: 6px; border-radius: 100px; background: linear-gradient(90deg, var(--neg), var(--neu) 50%, var(--pos)); opacity: 0.85; }
.emm-nss-mid { position: absolute; left: 50%; top: -2px; width: 1px; height: 10px; background: var(--line-2); transform: translateX(-50%); }
.emm-nss-marker { position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 50%; background: var(--ink); border: 2px solid var(--surface); transform: translate(-50%, -50%); box-shadow: var(--shadow); }
.emm-nss-marker.good { background: var(--pos); } .emm-nss-marker.bad { background: var(--neg); }
.emm-nss-ends { display: flex; justify-content: space-between; font-size: 9px; color: var(--faint); margin-top: 5px; }

/* ============================================================
   PRD v2 — Active alerts card
   ============================================================ */
.emm-alerts-kpi .emm-kpi-row { align-items: baseline; }
.emm-alerts-go { font-size: 10px; color: var(--neg); white-space: nowrap; }
.emm-alerts-bars { display: flex; gap: 2px; margin-top: 10px; height: 16px; }
.emm-alerts-seg { display: grid; place-items: center; font-size: 9.5px; color: #fff; border-radius: 2px; font-family: var(--mono); }
.emm-alerts-seg.crit { background: var(--neg); } .emm-alerts-seg.warn { background: var(--gold); } .emm-alerts-seg.flag { background: var(--neu); }
.emm-alerts-leg { display: flex; gap: 12px; font-size: 9px; color: var(--muted); margin-top: 7px; }
.emm-alerts-leg span { display: inline-flex; align-items: center; gap: 4px; }
.emm-alerts-leg i { width: 7px; height: 7px; border-radius: 2px; }
.emm-alerts-leg i.crit { background: var(--neg); } .emm-alerts-leg i.warn { background: var(--gold); } .emm-alerts-leg i.flag { background: var(--neu); }

/* ============================================================
   PRD v2 — Status pill
   ============================================================ */
.emm-status-pill { font-size: 9.5px; padding: 2px 8px; border-radius: 100px; letter-spacing: 0.03em; white-space: nowrap; font-family: var(--mono); border: 1px solid transparent; }
.emm-status-pill.critical { background: color-mix(in oklch, var(--neg), transparent 86%); color: var(--neg); border-color: color-mix(in oklch, var(--neg), transparent 60%); }
.emm-status-pill.flagged { background: color-mix(in oklch, var(--gold), transparent 86%); color: oklch(0.5 0.12 75); border-color: color-mix(in oklch, var(--gold), transparent 55%); }
.emm-status-pill.review { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in oklch, var(--accent), transparent 70%); }
.emm-status-pill.resolved { background: color-mix(in oklch, var(--pos), transparent 86%); color: var(--pos); border-color: color-mix(in oklch, var(--pos), transparent 60%); }

/* ============================================================
   PRD v2 — Emotion mapping
   ============================================================ */
.emm-emotion-panel .emm-panel-body { display: flex; flex-direction: column; gap: 14px; }
.emm-emogrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.emm-emocard { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px; background: var(--surface-2); position: relative; overflow: hidden; }
.emm-emocard-top { display: flex; align-items: center; gap: 9px; }
.emm-emocard-glyph { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-size: 14px; }
.emm-emocard-label { font-size: 12.5px; font-weight: 600; }
.emm-emocard-val { font-size: 32px; font-weight: 600; margin: 12px 0 8px; letter-spacing: -0.02em; }
.emm-emocard-val .pct { font-size: 16px; color: var(--muted); margin-left: 2px; }
.emm-emocard-track { height: 5px; border-radius: 100px; background: var(--surface-3); overflow: hidden; }
.emm-emocard-fill { height: 100%; border-radius: 100px; }
.emm-emocard.anger   { --emo: oklch(0.58 0.16 28); }
.emm-emocard.anxiety { --emo: oklch(0.68 0.13 60); }
.emm-emocard.trust   { --emo: oklch(0.58 0.10 200); }
.emm-emocard.hope    { --emo: oklch(0.62 0.12 152); }
.emm-emocard-glyph { background: color-mix(in oklch, var(--emo), transparent 84%); color: var(--emo); }
.emm-emocard-val { color: var(--emo); }
.emm-emocard-fill { background: var(--emo); }
.emm-opsignal { display: flex; align-items: baseline; gap: 12px; background: var(--accent-soft); border: 1px solid color-mix(in oklch, var(--accent), transparent 78%); border-radius: var(--radius-lg); padding: 13px 16px; }
.emm-opsignal-cap { font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); white-space: nowrap; flex: 0 0 auto; }
.emm-opsignal-txt { font-size: 13px; color: var(--ink); line-height: 1.45; }

/* ============================================================
   PRD v2 — Share / linguistic bars
   ============================================================ */
.emm-sharebars { display: flex; flex-direction: column; gap: 11px; }
.emm-sharebar-row { display: grid; grid-template-columns: 120px 1fr 42px; align-items: center; gap: 11px; }
.emm-sharebar-lab { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emm-sharebar-track { height: 9px; background: var(--surface-3); border-radius: 100px; overflow: hidden; }
.emm-sharebar-fill { height: 100%; border-radius: 100px; }
.emm-sharebar-val { font-size: 12px; text-align: right; color: var(--ink); font-weight: 600; }

/* ============================================================
   PRD v2 — Topic sentiment stack
   ============================================================ */
.emm-topicstack { display: flex; flex-direction: column; gap: 10px; }
.emm-topicstack-row { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 14px; padding: 3px 6px; margin: 0 -6px; border-radius: var(--radius); }
.emm-topicstack-row.clickable { cursor: pointer; }
.emm-topicstack-row.clickable:hover { background: var(--surface-2); }
.emm-topicstack-lab { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emm-topicstack-bar { display: flex; height: 22px; border-radius: var(--radius); overflow: hidden; }
.emm-topicstack-bar .seg { display: grid; place-items: center; font-size: 10px; color: #fff; font-family: var(--mono); overflow: hidden; }
.emm-topicstack-bar .seg.pos { background: var(--pos); } .emm-topicstack-bar .seg.neu { background: var(--neu); } .emm-topicstack-bar .seg.neg { background: var(--neg); }

/* ============================================================
   PRD v2 — Hashtags
   ============================================================ */
.emm-hashtags { display: flex; flex-direction: column; }
.emm-hashtag-row { display: grid; grid-template-columns: 26px 1fr auto auto; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.emm-hashtag-row:last-child { border-bottom: 0; }
.emm-hashtag-rank { font-size: 11px; color: var(--faint); }
.emm-hashtag-rank.top { color: var(--gold); font-weight: 600; }
.emm-hashtag-tag { font-size: 12.5px; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emm-hashtag-vol { font-size: 11px; color: var(--ink-2); }
.emm-hashtag-trend { font-size: 10px; }
.emm-hashtag-trend.up { color: var(--pos); } .emm-hashtag-trend.down { color: var(--neg); }

/* ============================================================
   PRD v2 — Word cloud
   ============================================================ */
.emm-wordcloud { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 14px; padding: 10px 6px; line-height: 1.1; }
.emm-word { font-weight: 600; letter-spacing: -0.01em; cursor: default; }
.emm-word.pos { color: var(--pos); } .emm-word.neu { color: var(--muted); } .emm-word.neg { color: var(--neg); }

/* ============================================================
   PRD v2 — Live feed
   ============================================================ */
.emm-livefeed { display: flex; flex-direction: column; max-height: 360px; overflow-y: auto; }
.emm-feed-row { display: flex; align-items: center; gap: 11px; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; cursor: pointer; width: 100%; transition: var(--t-fast); }
.emm-feed-row:last-child { border-bottom: 0; }
.emm-feed-row:hover { background: var(--surface-2); }
.emm-feed-main { flex: 1; min-width: 0; }
.emm-feed-head { font-size: 12.5px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emm-feed-meta { font-size: 10px; color: var(--muted); margin-top: 2px; }
.emm-feed-right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex: 0 0 auto; }
.emm-feed-time { font-size: 10px; color: var(--faint); white-space: nowrap; }
.emm-feed-live { display: inline-flex; align-items: center; gap: 4px; color: var(--neg); }
.emm-dash { display: inline-block; width: 14px; height: 0; border-top: 2px dashed currentColor; }

/* ============================================================
   PRD v2 — Crisis Center (urgent register)
   ============================================================ */
.emm-screen.crisis { position: relative; }
.emm-screen.crisis::before { content: ""; position: absolute; inset: -20px -20px auto; height: 180px; background: radial-gradient(120% 100% at 50% 0, color-mix(in oklch, var(--neg), transparent 92%), transparent 70%); pointer-events: none; }
.emm-live-pill.crisis { color: var(--neg); border-color: var(--neg); font-weight: 600; }
.emm-crisis-kpis .emm-ops-kpi { border-top: 2px solid var(--line-2); }
.emm-ops-kpi { display: flex; flex-direction: column; }
.emm-ops-kpi .emm-kpi-value.ops-good { color: var(--pos); }
.emm-ops-kpi .emm-kpi-value.ops-bad { color: var(--neg); }
.emm-ops-sub { font-size: 10px; color: var(--muted); margin-top: 4px; }
.emm-ops-foot { font-size: 10px; color: var(--faint); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.emm-velocity-panel { border-color: color-mix(in oklch, var(--neg), transparent 70%); box-shadow: 0 0 0 1px color-mix(in oklch, var(--neg), transparent 80%), var(--shadow); }
.emm-velocity { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.emm-velocity-main { display: flex; align-items: center; gap: 18px; flex: 1; min-width: 280px; }
.emm-velocity-pulse { position: relative; width: 54px; height: 54px; flex: 0 0 54px; display: grid; place-items: center; }
.emm-velocity-core { width: 40px; height: 40px; border-radius: 50%; background: var(--neg); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 700; z-index: 1; }
.emm-velocity-ring { position: absolute; inset: 0; border-radius: 50%; background: var(--neg); opacity: 0.4; animation: emm-velpulse 1.8s infinite; }
@keyframes emm-velpulse { 0% { transform: scale(0.7); opacity: 0.5; } 70% { transform: scale(1.4); opacity: 0; } 100% { opacity: 0; } }
.emm-velocity-spike { font-size: 38px; font-weight: 700; color: var(--neg); line-height: 1; letter-spacing: -0.02em; }
.emm-velocity-cap { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 4px; }
.emm-velocity-gz { margin-top: 9px; font-size: 12px; }
.emm-velocity-gz-cap { color: var(--faint); text-transform: uppercase; letter-spacing: 0.05em; font-size: 9.5px; margin-right: 7px; }
.emm-velocity-gz-val { color: var(--ink); }
.emm-velocity-spark { flex: 0 0 auto; max-width: 280px; }
.emm-velocity-auto { font-size: 10px; color: var(--neg); margin-top: 6px; opacity: 0.8; }
.emm-crisis-side { display: flex; flex-direction: column; gap: var(--gap); }
.emm-misinfo-list { display: flex; flex-direction: column; }
.emm-misinfo { display: flex; align-items: stretch; gap: 0; border-bottom: 1px solid var(--line); cursor: default; }
.emm-misinfo:last-child { border-bottom: 0; }
.emm-misinfo-stripe { width: 3px; flex: 0 0 3px; }
.emm-misinfo-stripe.high { background: var(--neg); } .emm-misinfo-stripe.med { background: var(--gold); } .emm-misinfo-stripe.low { background: var(--neu); }
.emm-misinfo-body { flex: 1; min-width: 0; padding: 11px 13px; }
.emm-misinfo-head { font-size: 12.5px; line-height: 1.4; margin-bottom: 5px; }
.emm-misinfo-meta { font-size: 10px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.emm-misinfo-meta .dot { color: var(--faint); }
.emm-misinfo-vel { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; padding: 11px 13px; flex: 0 0 auto; }
.emm-misinfo-vel-val { font-size: 13px; font-weight: 600; color: var(--neg); }
.emm-playbook { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; counter-reset: pb; }
.emm-playbook-item { display: flex; gap: 11px; align-items: flex-start; }
.emm-playbook-num { width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 11px; flex: 0 0 22px; font-weight: 600; }
.emm-playbook-txt { font-size: 12.5px; line-height: 1.45; color: var(--ink-2); }
.emm-resolutions { display: flex; flex-direction: column; gap: 9px; }
.emm-resolution { display: flex; gap: 10px; align-items: flex-start; }
.emm-resolution-check { width: 18px; height: 18px; border-radius: 50%; background: color-mix(in oklch, var(--pos), transparent 80%); color: var(--pos); display: grid; place-items: center; font-size: 11px; flex: 0 0 18px; margin-top: 1px; }
.emm-resolution-head { font-size: 12px; line-height: 1.35; }
.emm-resolution-meta { font-size: 9.5px; color: var(--muted); margin-top: 2px; }

/* ============================================================
   PRD v2 — Viewership recommendation
   ============================================================ */
.emm-recommend { margin-top: 14px; padding: 12px 13px; background: var(--accent-soft); border-radius: var(--radius); border: 1px solid color-mix(in oklch, var(--accent), transparent 80%); }
.emm-recommend-cap { display: block; font-size: 9.5px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--accent); margin-bottom: 5px; }
.emm-recommend-txt { font-size: 12px; line-height: 1.45; color: var(--ink-2); }
.emm-spend-val small { font-size: 8.5px; }

/* ============================================================
   PRD v2 — Reports
   ============================================================ */
.emm-report-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); margin-bottom: var(--gap); }
.emm-report-card { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; text-align: left; cursor: pointer; box-shadow: var(--shadow); transition: var(--t-fast); }
.emm-report-card:hover { border-color: var(--accent); transform: translateY(-2px); background: var(--surface-2); }
.emm-report-icon { width: 40px; height: 40px; border-radius: var(--radius-lg); background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 19px; }
.emm-report-title { font-size: 14.5px; font-weight: 600; }
.emm-report-desc { font-size: 11.5px; color: var(--muted); line-height: 1.45; flex: 1; }
.emm-report-action { font-size: 11px; color: var(--accent); margin-top: 4px; }
.emm-rtable { display: flex; flex-direction: column; }
.emm-rtable-row { display: grid; grid-template-columns: 1.4fr 1fr 0.8fr 1.3fr 0.6fr 0.8fr; align-items: center; gap: 12px; padding: 11px var(--pad); border-bottom: 1px solid var(--line); }
.emm-rtable-row:last-child { border-bottom: 0; }
.emm-rtable-row.head span { font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.emm-rtable-type { font-size: 12.5px; font-weight: 500; }
.emm-rtable-dim { font-size: 11.5px; color: var(--muted); }
.emm-fmt-pill { font-size: 9.5px; border: 1px solid var(--line-2); border-radius: 3px; padding: 1px 6px; color: var(--ink-2); }
.emm-rtable-dl { font-size: 11px; color: var(--accent); cursor: pointer; text-align: right; }
.emm-rtable-dl:hover { text-decoration: underline; }

/* ============================================================
   PRD v2 — Settings
   ============================================================ */
.emm-settings-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); }
.emm-settings-card { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow); }
.emm-settings-icon { width: 40px; height: 40px; border-radius: var(--radius-lg); background: var(--surface-3); color: var(--muted); display: grid; place-items: center; font-size: 18px; flex: 0 0 40px; }
.emm-settings-body { flex: 1; min-width: 0; }
.emm-settings-title { font-size: 13.5px; font-weight: 600; }
.emm-settings-sub { font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.emm-settings-note { text-align: center; font-size: 11px; color: var(--faint); margin-top: 18px; border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 12px; }

/* ============================================================
   PRD v2 — Critical alerts table (Main Feed)
   ============================================================ */
.emm-critable { display: flex; flex-direction: column; }
.emm-critable-row { display: grid; grid-template-columns: 110px 1fr 80px 60px 90px; align-items: center; gap: 12px; padding: 10px var(--pad); border-bottom: 1px solid var(--line); }
.emm-critable-row:last-child { border-bottom: 0; }
.emm-critable-row.clickable { cursor: pointer; }
.emm-critable-row.clickable:hover { background: var(--surface-2); }
.emm-critable-row.head span { font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.emm-critable-row > span:first-child { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.emm-sev-dot { width: 8px; height: 8px; border-radius: 2px; flex: 0 0 8px; }
.emm-sev-dot.high { background: var(--neg); } .emm-sev-dot.med { background: var(--gold); } .emm-sev-dot.low { background: var(--neu); }
.emm-critable-head { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emm-critable-dim { color: var(--muted); }

/* ============================================================
   PRD v2 — upgraded alert card (high-reach negative + CTA)
   ============================================================ */
.emm-alert-velocity { font-size: 11px; color: var(--neg); white-space: nowrap; font-weight: 600; }
.emm-alert-velocity .win { color: var(--muted); font-weight: 400; }
.emm-alert-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--line); }
.emm-alert-reach { font-size: 12px; color: var(--neg); white-space: nowrap; font-weight: 600; }
.emm-alert-reach-cap { font-size: 8.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); font-weight: 400; margin-right: 4px; }
.emm-alert-cta { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--accent-ink); background: var(--accent); border-radius: 100px; padding: 4px 11px; white-space: nowrap; transition: var(--t-fast); }
.emm-alert:hover .emm-alert-cta { filter: brightness(1.08); }

/* ============================================================
   PRD v2 — trending hashtag cards (social platforms)
   ============================================================ */
.emm-htcards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.emm-htcard { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-2); padding: 12px 13px; display: flex; flex-direction: column; gap: 8px; transition: var(--t-fast); }
.emm-htcard:hover { border-color: var(--accent); transform: translateY(-1px); }
.emm-htcard-top { display: flex; align-items: center; justify-content: space-between; }
.emm-htcard-plat { font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 4px; letter-spacing: 0.03em; }
.emm-htcard-rank { font-size: 10px; color: var(--faint); }
.emm-htcard-rank.top { color: var(--gold); font-weight: 600; }
.emm-htcard-tag { font-size: 13px; font-weight: 600; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emm-htcard-spark { height: 26px; }
.emm-htcard-foot { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.emm-htcard-vol { font-size: 13px; font-weight: 600; }
.emm-htcard-trend { font-size: 10px; }
.emm-htcard-trend.up { color: var(--pos); } .emm-htcard-trend.down { color: var(--neg); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1180px) {
  .emm-cockpit-cols { grid-template-columns: 1fr; }
  .emm-kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .emm-channel-grid .span-trend, .emm-channel-grid .span-topics,
  .emm-channel-grid .span-daypart, .emm-channel-grid .span-dur,
  .emm-topic-grid .span-trend, .emm-topic-grid .span-cross,
  .emm-reach-grid .span-map, .emm-reach-grid .span-rank,
  .emm-reach-grid .span-daypart, .emm-reach-grid .span-spend { grid-column: span 12; }
  .emm-sd-body.full { grid-template-columns: 1fr; }
  .col4, .col5, .col6, .col7, .col8 { grid-column: span 12; }
  .emm-report-grid { grid-template-columns: repeat(2, 1fr); }
  .emm-htcards { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 860px) {
  .emm-rail { --rail-w: 56px; }
  .emm-rail-lab, .emm-rail-mark { display: none; }
  .emm-rail-brand { text-align: center; }
  .emm-rail-brand::after { content: "EMM"; font-family: var(--mono); font-size: 10px; color: #fff; letter-spacing: 0.1em; }
  .emm-kpi-grid, .emm-kpi-grid.four { grid-template-columns: repeat(2, 1fr); }
  .emm-topbar { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 8px; }
  .emm-subbar { flex-direction: column; align-items: flex-start; gap: 10px; }
  .emm-lens { align-items: flex-start; }
  .emm-emogrid { grid-template-columns: repeat(2, 1fr); }
  .emm-report-grid, .emm-settings-grid { grid-template-columns: 1fr; }
  .emm-rail-grouplab { display: none; }
  .emm-rail-username, .emm-rail-userrole, .emm-rail-brandsub { display: none; }
  .emm-rail-badge { position: absolute; top: 4px; right: 4px; margin: 0; }
  .emm-rail-item { position: relative; }
  .emm-htcards { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   v2.1 — Gap-closure widgets (CTO sentiment framework)
   Universal controls · Fake-news detector · Spokesperson
   tracker · Raw mention log · demographics-by-location
   ============================================================ */

/* ---- Universal controls bar (search + region + dept) ---- */
.emm-controlbar { padding: 9px var(--pad); border-bottom: 1px solid var(--line); background: var(--surface); }
.emm-ucontrols { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.emm-usearch { position: relative; flex: 1 1 320px; min-width: 220px; display: flex; align-items: center; }
.emm-usearch-ico { position: absolute; left: 11px; color: var(--muted); font-size: 14px; pointer-events: none; }
.emm-usearch-input {
  width: 100%; height: 32px; padding: 0 12px 0 32px; font: inherit; font-size: 13px;
  color: var(--ink); background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: var(--radius); transition: var(--t-fast);
}
.emm-usearch-input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.emm-usearch-input::placeholder { color: var(--faint); }
.emm-uselect-wrap { display: flex; align-items: center; gap: 6px; }
.emm-uselect-cap { font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.emm-uselect {
  height: 32px; padding: 0 26px 0 10px; font-size: 12px; color: var(--ink-2);
  background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2390909a' stroke-width='1.4'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: 1px solid var(--line-2); border-radius: var(--radius); appearance: none; cursor: pointer; transition: var(--t-fast);
}
.emm-uselect:hover { border-color: var(--accent); }
.emm-uselect:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---- Fake-news / deepfake detector ---- */
.emm-fnd { display: flex; flex-direction: column; gap: 14px; }
.emm-fnd-tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.emm-fnd-tile { border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 10px; background: var(--surface-2); }
.emm-fnd-tile-val { font-size: 21px; font-weight: 600; line-height: 1; letter-spacing: -0.01em; }
.emm-fnd-tile-lab { font-size: 9px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin-top: 5px; line-height: 1.25; }
.emm-fnd-tile.neg .emm-fnd-tile-val { color: var(--neg); }
.emm-fnd-tile.pos .emm-fnd-tile-val { color: var(--pos); }
.emm-fnd-tile.warn .emm-fnd-tile-val { color: oklch(0.55 0.13 70); }
.emm-fnd-tile.warn { border-color: color-mix(in oklch, var(--gold), transparent 60%); }

.emm-fnd-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.emm-fnrow { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); }
.emm-fnrow:last-child { border-bottom: 0; }
.emm-fnrow-body { flex: 1; min-width: 0; padding: 11px 13px; }
.emm-fnrow-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 6px; }
.emm-fn-kind { font-size: 9.5px; font-weight: 600; letter-spacing: 0.02em; padding: 2px 8px; border-radius: 100px; text-transform: uppercase;
  background: var(--surface-3); color: var(--ink-2); border: 1px solid var(--line-2); }
.emm-fn-kind.deepfake, .emm-fn-kind.doctored { background: color-mix(in oklch, var(--neg), transparent 88%); color: var(--neg); border-color: color-mix(in oklch, var(--neg), transparent 62%); }
.emm-fn-deepfake { font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 100px;
  background: color-mix(in oklch, var(--neg), transparent 90%); color: var(--neg); border: 1px solid color-mix(in oklch, var(--neg), transparent 55%); }
.emm-fn-verdict { font-size: 9.5px; letter-spacing: 0.03em; padding: 2px 8px; border-radius: 100px; font-family: var(--mono); border: 1px solid transparent; }
.emm-fn-verdict.false, .emm-fn-verdict.debunked { background: color-mix(in oklch, var(--neg), transparent 88%); color: var(--neg); }
.emm-fn-verdict.disputed { background: color-mix(in oklch, var(--gold), transparent 84%); color: oklch(0.5 0.12 75); }
.emm-fn-verdict.unverified { background: var(--surface-3); color: var(--muted); }
.emm-fnrow-head { font-size: 12.5px; line-height: 1.4; margin-bottom: 5px; }
.emm-fnrow-meta { font-size: 10px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.emm-fnrow-meta .dot { color: var(--faint); }
.emm-fn-gz { color: var(--ink-2); font-weight: 600; }
.emm-fnrow-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; padding: 11px 13px; flex: 0 0 auto; text-align: right; }
.emm-fnrow-vel { font-size: 13px; font-weight: 600; color: var(--neg); }
.emm-fn-clar { font-size: 9.5px; letter-spacing: 0.02em; }
.emm-fn-clar.live { color: var(--pos); }
.emm-fn-clar.drafting { color: oklch(0.55 0.13 70); }
.emm-fn-clar.none { color: var(--faint); }

/* ---- Spokesperson credibility & prominence ---- */
.emm-spox { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 22px; }
.emm-spox-row { display: flex; align-items: center; gap: 11px; }
.emm-spox-avatar { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 600; background: var(--accent-soft); color: var(--accent); }
.emm-spox-main { flex: 1; min-width: 0; }
.emm-spox-name { font-size: 13px; font-weight: 600; display: flex; align-items: baseline; gap: 7px; }
.emm-spox-role { font-size: 10px; font-weight: 400; color: var(--muted); white-space: nowrap; }
.emm-spox-tone { display: flex; height: 6px; border-radius: 100px; overflow: hidden; margin-top: 6px; background: var(--surface-3); }
.emm-spox-tone .seg { height: 100%; }
.emm-spox-tone .seg.pos { background: var(--pos); }
.emm-spox-tone .seg.neu { background: var(--neu); }
.emm-spox-tone .seg.neg { background: var(--neg); }
.emm-spox-stats { text-align: right; flex: 0 0 auto; }
.emm-spox-quotes { font-size: 12px; color: var(--ink); }
.emm-spox-quotes b { font-size: 15px; }
.emm-spox-share { font-size: 10px; color: var(--muted); margin-top: 2px; }
.emm-spox-trend { margin-left: 5px; }
.emm-spox-trend.up { color: var(--pos); }
.emm-spox-trend.down { color: var(--neg); }

/* ---- Raw mention log (analytics bottom tier) ---- */
.emm-rawlog-panel { margin-top: var(--gap); }
.emm-rawlog { display: flex; flex-direction: column; font-size: 12px; }
.emm-rawlog-row { display: grid; grid-template-columns: 92px 130px 110px 1fr 130px 28px 64px; align-items: center; gap: 12px; padding: 9px var(--pad); border-bottom: 1px solid var(--line); }
.emm-rawlog-row:last-child { border-bottom: 0; }
.emm-rawlog-row.head span { font-size: 9px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.emm-rawlog-row:not(.head):hover { background: var(--surface-2); }
.emm-rawlog-dim { color: var(--muted); font-size: 11px; }
.emm-rawlog-ch { display: flex; align-items: center; gap: 7px; min-width: 0; }
.emm-rawlog-ch span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
.emm-rawlog-excerpt { color: var(--ink-2); line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.emm-rawlog-match { font-size: 8.5px; color: var(--pos); margin-left: 6px; vertical-align: middle; }
.emm-rawlog-topic { font-size: 11px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- demographics by location (under age donut) ---- */
.emm-demoloc { margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); }
.emm-demoloc-cap { font-size: 9.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--faint); margin-bottom: 10px; }

@media (max-width: 1180px) {
  .emm-fnd-tiles { grid-template-columns: repeat(3, 1fr); }
  .emm-spox { grid-template-columns: 1fr; }
  .emm-rawlog-row { grid-template-columns: 78px 110px 1fr 26px 56px; }
  .emm-rawlog-row > span:nth-child(3), .emm-rawlog-row > span:nth-child(5) { display: none; }
}

/* ============================================================
   v2.2 — Original-framework gap closure (Levels 2/3/4)
   Reach & airtime by sentiment · channel social presence
   ============================================================ */

/* ---- Reach / airtime split by sentiment (L2.3 / L3.3) ---- */
.emm-sentsplit { display: flex; flex-direction: column; gap: 12px; }
.emm-sentsplit-bar { display: flex; height: 12px; border-radius: 100px; overflow: hidden; background: var(--surface-3); }
.emm-sentsplit-bar .seg { height: 100%; }
.emm-sentsplit-rows { display: flex; flex-direction: column; gap: 8px; }
.emm-sentsplit-row { display: grid; grid-template-columns: 12px 1fr auto 40px; align-items: center; gap: 10px; }
.emm-sentsplit-lab { font-size: 12.5px; color: var(--ink-2); }
.emm-sentsplit-val { font-size: 13px; font-weight: 600; color: var(--ink); text-align: right; }
.emm-sentsplit-pct { font-size: 11px; color: var(--muted); text-align: right; }
.emm-subhead { font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); margin: 16px 0 12px; padding-top: 14px; border-top: 1px solid var(--line); }

/* ---- Channel social presence (L4.1) ---- */
.emm-chsocial { display: flex; flex-direction: column; }
.emm-chsocial-row { display: grid; grid-template-columns: 1.3fr 1.5fr 0.7fr 0.7fr; align-items: center; gap: 10px; padding: 9px var(--pad); border-bottom: 1px solid var(--line); font-size: 12px; }
.emm-chsocial-row:last-child { border-bottom: 0; }
.emm-chsocial-row.head span { font-size: 9px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.emm-chsocial-row:not(.head):hover { background: var(--surface-2); }
.emm-chsocial-plat { display: flex; align-items: center; gap: 8px; font-size: 12px; min-width: 0; }
.emm-chsocial-handle { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emm-chsocial-aud { text-align: right; color: var(--ink-2); }
.emm-chsocial-views { text-align: right; color: var(--accent); font-weight: 600; }
.emm-chsocial-row.head span:nth-child(3), .emm-chsocial-row.head span:nth-child(4) { text-align: right; }

/* ---- helpers ---- */
.emm-l4-row { margin-top: var(--gap); }
.emm-spend-share { color: var(--faint); font-weight: 400; }
.emm-mentionlog-meta { padding: 10px var(--pad); font-size: 11px; color: var(--muted); border-bottom: 1px solid var(--line); }

/* ---- real-time feed sentiment emoji (CTO wireframe) ---- */
.emm-feed-emoji { font-size: 14px; line-height: 1; }

/* ---- Capability framework table (Settings) ---- */
.emm-caplevels-panel { margin-bottom: var(--gap); }
.emm-caplevels { display: flex; flex-direction: column; }
.emm-caplevel-row { display: grid; grid-template-columns: 1.1fr 2fr 1.8fr 1fr; align-items: center; gap: 12px; padding: 11px var(--pad); border-bottom: 1px solid var(--line); font-size: 12.5px; }
.emm-caplevel-row:last-child { border-bottom: 0; }
.emm-caplevel-row.head span { font-size: 9px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.emm-caplevel-lv { display: flex; align-items: center; gap: 9px; font-weight: 600; color: var(--ink); }
.emm-caplevel-code { font-size: 10px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 2px 7px; }
.emm-caplevel-scope { color: var(--ink-2); line-height: 1.4; }
.emm-caplevel-by { display: flex; flex-wrap: wrap; gap: 5px; }
.emm-caplevel-chip { font-size: 10.5px; background: var(--surface-3); border: 1px solid var(--line-2); border-radius: 100px; padding: 2px 9px; color: var(--ink-2); }
.emm-caplevel-status { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--pos); white-space: nowrap; }
.emm-caplevel-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pos); flex: 0 0 auto; }
@media (max-width: 1180px) {
  .emm-caplevel-row { grid-template-columns: 0.8fr 1.6fr 1.4fr; }
  .emm-caplevel-row > span:nth-child(4) { display: none; }
}

/* ---- L3.1 frequency + duration per news item ---- */
.emm-sd-freq { color: var(--accent); font-weight: 600; }
.emm-airfreq-note { font-size: 10.5px; color: var(--muted); margin: -4px 0 10px; }
.emm-airing-freq { color: var(--ink); font-weight: 600; }
.emm-story-freq { color: var(--muted); }

/* ============================================================
   v2.3 — Multi-dimensional layer
   Matrix Explorer · propagation network · spreaders · relationships
   ============================================================ */

/* ---- Matrix controls ---- */
.emm-matrix-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: var(--gap);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 12px 14px; }
.emm-mx-swap { padding: 6px 10px; font-size: 14px; line-height: 1; }
.emm-mx-divider { width: 1px; align-self: stretch; background: var(--line-2); margin: 2px 2px; }

/* ---- Matrix grid ---- */
.emm-matrix-wrap { overflow-x: auto; }
.emm-matrix { border-collapse: separate; border-spacing: 2px; width: 100%; }
.emm-matrix th, .emm-matrix td { font-size: 11.5px; }
.emm-matrix-corner { text-align: left; color: var(--faint); font-size: 9.5px; letter-spacing: 0.04em; padding: 6px 8px; white-space: nowrap; }
.emm-matrix-colh { padding: 6px 6px; vertical-align: bottom; color: var(--ink-2); font-weight: 600; font-size: 10.5px; text-align: center; max-width: 84px; line-height: 1.2; }
.emm-matrix-colh span { display: block; }
.emm-matrix-rowh { text-align: left; color: var(--ink); font-weight: 600; font-size: 11.5px; padding: 6px 10px 6px 4px; white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.emm-matrix-cell { text-align: center; padding: 8px 6px; border-radius: 3px; color: var(--ink-2); min-width: 44px; transition: var(--t-fast); }
.emm-matrix-cell.clickable { cursor: pointer; }
.emm-matrix-cell.clickable:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.emm-matrix-toth, .emm-matrix-tot { text-align: center; color: var(--faint); font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; padding: 6px 8px; }
.emm-matrix-tot { color: var(--ink-2); font-weight: 600; font-size: 11.5px; border-left: 2px solid var(--line); }
.emm-matrix-totrow td { border-top: 2px solid var(--line); color: var(--ink-2); font-weight: 600; text-align: center; padding: 7px 6px; }
.emm-matrix-grand { color: var(--accent); }

/* ---- Propagation panel ---- */
.emm-prop-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.emm-prop-case { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.emm-prop-stat { font-size: 11px; color: var(--neg); white-space: nowrap; }

/* ---- Spreader list ---- */
.emm-spreaders { display: flex; flex-direction: column; font-size: 12px; }
.emm-spreader-row { display: grid; grid-template-columns: 1.6fr 0.6fr 0.9fr 0.8fr 0.8fr 0.7fr; align-items: center; gap: 10px; padding: 8px var(--pad); border-bottom: 1px solid var(--line); }
.emm-spreader-row:last-child { border-bottom: 0; }
.emm-spreader-row.head span { font-size: 9px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.emm-spreader-row.gz { background: color-mix(in oklch, var(--neg), transparent 93%); }
.emm-spreader-acc { font-family: var(--mono); font-size: 11.5px; color: var(--ink); display: flex; align-items: center; gap: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.emm-gz-dot { color: var(--neg); font-size: 12px; }
.emm-spreader-dim { color: var(--muted); font-size: 11px; }
.emm-spreader-reach { color: var(--accent); font-weight: 600; }
.emm-spreader-row span:nth-child(4), .emm-spreader-row span:nth-child(5) { text-align: right; }

/* ---- Relationship strip ---- */
.emm-relstrip { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 10px 0; margin-bottom: 4px; }
.emm-relstrip-cap { font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); margin-right: 4px; }
.emm-relstrip-sep { color: var(--faint); font-size: 12px; }
.emm-relchip { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px; background: var(--surface-2);
  border: 1px solid var(--line-2); border-radius: var(--radius); padding: 4px 10px; cursor: pointer; transition: var(--t-fast); }
.emm-relchip:hover { border-color: var(--accent); background: var(--accent-soft); }
.emm-relchip-dim { font-size: 8.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--faint); }
.emm-relchip-val { font-size: 12px; color: var(--ink); font-weight: 600; }

/* ---- Fake-news row selectable ---- */
.emm-fnrow.selectable { cursor: pointer; }
.emm-fnrow.selectable:hover { background: var(--surface-2); }
.emm-fnrow.selected { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }

@media (max-width: 1180px) {
  .emm-spreader-row { grid-template-columns: 1.6fr 0.6fr 0.9fr 0.8fr; }
  .emm-spreader-row > span:nth-child(5), .emm-spreader-row > span:nth-child(6) { display: none; }
}

/* ============================================================
   Wire-up additions: buttons, toggles, toast, time popover,
   settings controls, report preview (+ print), drilldown bits
   ============================================================ */

/* button modifiers (ghost / accent) */
.emm-btn.ghost { background: transparent; }
.emm-btn.accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.emm-btn.accent:hover { color: var(--accent-ink); filter: brightness(1.08); }

/* Toggle switch */
.emm-toggle { width: 38px; height: 22px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface-3); position: relative; cursor: pointer; transition: var(--t-fast); padding: 0; flex: 0 0 auto; }
.emm-toggle .emm-toggle-knob { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); transition: var(--t-fast); }
.emm-toggle.on { background: var(--accent); border-color: var(--accent); }
.emm-toggle.on .emm-toggle-knob { left: 18px; background: var(--accent-ink); }

/* Number field */
.emm-numfield { display: inline-flex; align-items: center; gap: 4px; }
.emm-numinput { height: 30px; padding: 0 8px; font-size: 12px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface-2); color: var(--ink); }
.emm-numinput:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.emm-numunit { font-size: 11px; color: var(--muted); }

/* Toast */
.emm-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: var(--radius-lg); font-size: 12px; box-shadow: var(--shadow-lg); z-index: 60; animation: emm-fade 0.18s ease; }

/* Time custom-range popover */
.emm-time-pop { position: absolute; top: calc(100% + 6px); right: 0; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 12px; z-index: 50; width: 240px; }
.emm-time-pop-title { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); margin-bottom: 8px; }
.emm-time-pop-row { display: flex; gap: 10px; }
.emm-time-pop-row label { display: flex; flex-direction: column; gap: 3px; font-size: 10px; color: var(--muted); flex: 1; }
.emm-time-pop-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.emm-time-btn.ghost.active { color: var(--accent); border-color: var(--accent); }

/* Settings — functional controls */
.emm-setrow { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.emm-setrow:last-child { border-bottom: none; }
.emm-setrow-l { min-width: 0; }
.emm-setrow-label { font-size: 13px; font-weight: 500; }
.emm-setrow-sub { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.emm-setrow-ctl { flex: 0 0 auto; }
.emm-setrow-grouptitle { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); margin: 4px 0 2px; }
.emm-set-divider { height: 1px; background: var(--line); margin: 10px 0; }
.emm-th-inline { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }

.emm-segctl { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; }
.emm-seg { background: var(--surface); border: none; padding: 5px 12px; font-size: 11px; cursor: pointer; color: var(--muted); border-right: 1px solid var(--line); transition: var(--t-fast); }
.emm-seg:last-child { border-right: none; }
.emm-seg:hover { color: var(--ink); }
.emm-seg.active { background: var(--accent); color: var(--accent-ink); }

.emm-accent-swatches { display: inline-flex; gap: 8px; }
.emm-accent-sw { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.12); padding: 0; }
.emm-accent-sw.active { border-color: var(--ink); }
.emm-range { width: 150px; accent-color: var(--accent); cursor: pointer; vertical-align: middle; }

.emm-chtoggle-list { max-height: 340px; overflow-y: auto; }
.emm-chtoggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px var(--pad); border-bottom: 1px solid var(--line); }
.emm-chtoggle:last-child { border-bottom: none; }
.emm-chtoggle-name { font-size: 12.5px; font-weight: 500; }
.emm-chtoggle-meta { font-size: 10px; color: var(--muted); margin-left: 8px; }

.emm-savedviews { display: flex; flex-direction: column; }
.emm-savedview { display: flex; align-items: center; gap: 12px; padding: 10px var(--pad); border-bottom: 1px solid var(--line); }
.emm-savedview:last-child { border-bottom: none; }
.emm-savedview-label { font-weight: 500; font-size: 13px; flex: 1; min-width: 0; }
.emm-savedview-meta { font-size: 10.5px; color: var(--muted); }
.emm-savedview-x { background: none; border: none; color: var(--faint); font-size: 18px; cursor: pointer; line-height: 1; padding: 0 4px; }
.emm-savedview-x:hover { color: var(--neg); }

/* Spokesperson focus highlight (in-page drill) */
.emm-spox-row.is-focus { background: var(--accent-soft); border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--accent); }

/* Propagation node focus callout */
.emm-prop-focus { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 8px 12px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--radius); font-size: 11px; }
.emm-prop-focus-handle { font-weight: 600; }
.emm-prop-focus-tier { padding: 1px 7px; border-radius: 999px; font-size: 9.5px; background: var(--accent-soft); color: var(--accent); }
.emm-prop-focus-tier.t0 { background: rgba(var(--accent-rgb) / 0.12); }
.emm-prop-focus-meta { color: var(--muted); }
.emm-prop-focus-x { margin-left: auto; background: none; border: none; cursor: pointer; color: var(--faint); font-size: 15px; line-height: 1; }
.emm-prop-focus-x:hover { color: var(--neg); }

/* Recent-reports rows clickable */
.emm-rtable-row.clickable { cursor: pointer; }
.emm-rtable-row.clickable:hover { background: var(--surface-2); }
button.emm-rtable-dl { background: none; border: none; color: var(--accent); cursor: pointer; font-size: inherit; font-family: inherit; padding: 0; text-align: right; }
button.emm-rtable-dl:hover { text-decoration: underline; }

/* ---- Report preview (full screen + print) ---- */
.emm-report-overlay { position: fixed; inset: 0; z-index: 50; background: var(--paper); overflow-y: auto; animation: emm-fade 0.2s ease; }
.emm-report-doc { min-height: 100%; }
.emm-report-bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--line-2); box-shadow: var(--shadow); }
.emm-report-bar-l { display: flex; align-items: center; gap: 10px; }
.emm-report-bar-ico { font-size: 18px; }
.emm-report-bar-title { font-weight: 600; font-size: 14px; }
.emm-report-bar-r { display: flex; gap: 8px; }
.emm-report-page { max-width: 880px; margin: 0 auto; padding: 28px 32px 48px; }
.emm-report-masthead { display: flex; justify-content: space-between; gap: 24px; border-bottom: 2px solid var(--accent); padding-bottom: 16px; margin-bottom: 20px; }
.emm-report-org { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.emm-report-h1 { font-size: 26px; margin: 4px 0 6px; letter-spacing: -0.01em; }
.emm-report-descline { font-size: 12.5px; color: var(--muted); max-width: 52ch; }
.emm-report-meta { text-align: right; font-size: 10.5px; color: var(--muted); line-height: 1.7; flex: 0 0 auto; }
.emm-report-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.emm-report-kpi { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 12px 14px; background: var(--surface); }
.emm-report-kpi .lab { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--faint); margin-bottom: 6px; }
.emm-report-kpi .val { font-size: 22px; font-weight: 600; }
.emm-report-block { margin-bottom: 18px; }
.emm-report-big { font-size: 40px; font-weight: 700; color: var(--accent); line-height: 1.1; }
.emm-report-note { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.emm-report-table { display: flex; flex-direction: column; }
.emm-report-trow { display: grid; grid-template-columns: 2.6fr 1fr 1fr 0.7fr; gap: 10px; padding: 8px var(--pad); border-bottom: 1px solid var(--line); align-items: center; font-size: 12px; }
.emm-report-trow.head { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--faint); }
.emm-report-trow:last-child { border-bottom: none; }
.emm-report-reslist { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.emm-report-resitem { font-size: 12px; }
.emm-report-resitem .mono { color: var(--muted); font-size: 10.5px; }
.emm-report-foot { text-align: center; font-size: 10px; color: var(--faint); margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--line); }

@media (max-width: 720px) {
  .emm-report-kpis { grid-template-columns: repeat(2, 1fr); }
  .emm-report-masthead { flex-direction: column; }
  .emm-report-meta { text-align: left; }
}

/* ---- Print: isolate the report ---- */
@media print {
  @page { margin: 14mm; }
  body { background: #fff !important; }
  .emm-app > *:not(.emm-report-print) { display: none !important; }
  .emm-report-overlay { position: static !important; overflow: visible !important; background: #fff !important; }
  .emm-report-bar, .emm-noprint { display: none !important; }
  .emm-report-page { max-width: none; margin: 0; padding: 0; }
  .emm-report-block, .emm-report-kpi, .emm-report-trow { break-inside: avoid; }
  .emm-panel { box-shadow: none; border-color: #ccc; }
}

/* ============================================================
   Login gate (client-side demo gate)
   ============================================================ */
.emm-login {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px; padding: 24px;
  background:
    radial-gradient(1100px 620px at 50% -10%, oklch(0.32 0.06 264) 0%, transparent 60%),
    linear-gradient(160deg, oklch(0.22 0.022 262) 0%, oklch(0.16 0.018 262) 100%);
  font-family: var(--font);
}
.emm-login-card {
  width: 100%; max-width: 392px; background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 12px; box-shadow: 0 24px 70px rgba(6,10,18,0.5); padding: 30px 30px 22px;
  animation: emm-login-rise 0.32s cubic-bezier(0.22,0.61,0.36,1);
}
@keyframes emm-login-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.emm-login-brand { display: flex; align-items: center; gap: 13px; padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.emm-login-mark {
  flex: 0 0 auto; width: 46px; height: 46px; border-radius: 9px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 15px; letter-spacing: 0.04em;
}
.emm-login-org { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.emm-login-sub { font-size: 10px; color: var(--muted); margin-top: 2px; }
.emm-login-form { display: flex; flex-direction: column; gap: 14px; }
.emm-login-field { display: flex; flex-direction: column; gap: 5px; }
.emm-login-lab { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--faint); }
.emm-login-input {
  height: 40px; padding: 0 12px; font-size: 13px; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--radius); transition: var(--t-fast);
}
.emm-login-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.emm-login-err { font-size: 11px; color: var(--neg); margin-top: -4px; }
.emm-login-btn {
  height: 40px; margin-top: 2px; background: var(--accent); color: var(--accent-ink); border: none;
  border-radius: var(--radius); font-size: 13px; font-weight: 500; cursor: pointer; transition: var(--t-fast);
}
.emm-login-btn:hover { filter: brightness(1.08); }
.emm-login-note { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 10px; color: var(--faint); text-align: center; }
.emm-login-foot { font-size: 10px; color: oklch(0.62 0.02 262); letter-spacing: 0.04em; }

/* rail sign-out button */
.emm-rail-user { position: relative; }
.emm-rail-logout {
  flex: 0 0 auto; margin-left: auto; width: 26px; height: 26px; border-radius: var(--radius);
  background: transparent; border: 1px solid transparent; color: var(--rail-ink); font-size: 14px;
  cursor: pointer; line-height: 1; transition: var(--t-fast);
}
.emm-rail-logout:hover { color: #fff; border-color: var(--rail-active); background: var(--rail-active); }
