/* Market360 UI. Light/dark themes via CSS variables. */
:root {
  --c1: #2a78d6; --c2: #eb6834;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --border: #e3e6eb;
  --text: #16191f;
  --text-2: #5b6472;
  --text-3: #8b93a1;
  --accent: #3b5bdb;
  --accent-soft: #e8edfd;
  --pos: #1f9d55;
  --pos-soft: #e3f5ea;
  --neg: #d64545;
  --neg-soft: #fbe7e7;
  --mix: #d98e04;
  --mix-soft: #fdf2dc;
  --neu: #8b93a1;
  --neu-soft: #eef0f3;
  --rapsodo: #0f7b8a;
  --brand: #12B76A;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --c1: #3987e5; --c2: #d95926;
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1e222b;
  --border: #2a2f3a;
  --text: #eceef2;
  --text-2: #a6adbb;
  --text-3: #727a89;
  --accent: #7b93f5;
  --accent-soft: #232b48;
  --pos: #3fbf75;
  --pos-soft: #17301f;
  --neg: #ef6b6b;
  --neg-soft: #3a1c1f;
  --mix: #f0b232;
  --mix-soft: #392c12;
  --neu: #8b93a1;
  --neu-soft: #262a33;
  --rapsodo: #33b3c4;
  --brand: #32D583;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- layout */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 20px; padding: 20px 14px; background: var(--surface); border-right: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); position: relative; flex: none; }
.brand-mark::after { content: ""; position: absolute; inset: 8px; border: 2.5px solid #fff; border-radius: 50%; }
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: -.02em; }
.brand-name .n360, .n360 { color: var(--brand); }
.brand-sub { font-size: 12px; color: var(--text-3); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text-2); font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav .sep { height: 1px; background: var(--border); margin: 8px 6px; }
.nav .badge { margin-left: auto; font-size: 11px; background: var(--surface-2); color: var(--text-2); padding: 0 7px; border-radius: 99px; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.data-pill { font-size: 12px; color: var(--text-2); background: var(--surface-2); border-radius: 8px; padding: 8px 10px; line-height: 1.45; }
.data-pill b { color: var(--text); }
.ghost-btn { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: transparent; border-radius: 8px; padding: 7px 10px; cursor: pointer; color: var(--text-2); }
.ghost-btn:hover { background: var(--surface-2); color: var(--text); }

.main { min-width: 0; padding: 0 32px 48px; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 22px 0 16px; background: var(--bg); flex-wrap: wrap; }
.topbar h1 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.crumbs { font-size: 12px; color: var(--text-3); min-height: 18px; }
.crumbs a { color: var(--text-3); }
.filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.view { display: flex; flex-direction: column; gap: 20px; }

/* ---------- controls */
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 5px 11px; border-radius: 6px; cursor: pointer; color: var(--text-2); font-weight: 500; }
.seg button.on { background: var(--accent-soft); color: var(--accent); }
.select-btn, .btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--surface); border-radius: 9px; padding: 7px 12px; cursor: pointer; font-weight: 500; white-space: nowrap; }
.select-btn:hover, .btn:hover { border-color: var(--text-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--neg); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.dropdown { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); width: 260px; max-height: 420px; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.12); padding: 6px; z-index: 20; }
.menu label { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.menu label:hover { background: var(--surface-2); }
.menu .menu-actions { display: flex; justify-content: space-between; padding: 6px 8px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu .menu-actions button { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font-size: 13px; }
input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; color: var(--text-2); user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 34px; height: 20px; border-radius: 99px; background: var(--border); position: relative; transition: background .15s; }
.switch .thumb { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--mix); }
.switch input:checked + .track .thumb { transform: translateX(14px); }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--border); background: var(--surface); border-radius: 9px; padding: 8px 11px; outline: none; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { min-height: 120px; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-2); }

/* ---------- cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.card h2 { margin: 0 0 2px; font-size: 15px; letter-spacing: -.01em; }
.card .sub { margin: 0 0 14px; font-size: 13px; color: var(--text-3); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.grid { display: grid; gap: 20px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-wide { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
@media (max-width: 1200px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3, .g-wide { grid-template-columns: 1fr; } }
@media (max-width: 860px) { .shell { grid-template-columns: 1fr; } .sidebar { position: static; height: auto; } .g2 { grid-template-columns: 1fr; } .main { padding: 0 16px 40px; } }

.kpi .label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.kpi .value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; }
.kpi .hint { font-size: 12px; color: var(--text-3); }
.chart-box { position: relative; height: 300px; }
.chart-box.tall { height: 380px; }
.chart-box.short { height: 220px; }

/* ---------- tables */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-weight: 600; color: var(--text-3); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--surface-2); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.bar-cell { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.bar-cell .bar { height: 8px; border-radius: 99px; background: var(--accent); opacity: .85; }
.diverge { position: relative; width: 90px; flex: none; height: 8px; background: var(--surface-2); border-radius: 99px; }
.diverge::before { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--text-3); opacity: .5; }
.diverge i { position: absolute; top: 0; bottom: 0; border-radius: 99px; }

/* ---------- heatmap */
.heat-wrap { overflow-x: auto; }
.heat { border-collapse: separate; border-spacing: 3px; font-size: 12px; }
.heat th { font-weight: 500; color: var(--text-2); padding: 4px 6px; white-space: nowrap; }
.heat thead th { height: 175px; vertical-align: bottom; }
.heat thead th div { writing-mode: vertical-rl; transform: rotate(180deg); text-align: left; max-height: 172px; }
.heat td { width: 44px; height: 32px; text-align: center; border-radius: 6px; font-variant-numeric: tabular-nums; font-weight: 600; cursor: default; }
.heat td.void { background: var(--surface-2); opacity: .5; }
.legend { display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--text-2); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.grad { width: 140px; height: 8px; border-radius: 99px; background: linear-gradient(90deg, var(--neg), var(--neu-soft), var(--pos)); display: inline-block; vertical-align: middle; margin: 0 6px; }

/* ---------- pills */
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 99px; white-space: nowrap; }
.pill.positive { background: var(--pos-soft); color: var(--pos); }
.pill.negative { background: var(--neg-soft); color: var(--neg); }
.pill.mixed { background: var(--mix-soft); color: var(--mix); }
.pill.neutral { background: var(--neu-soft); color: var(--text-2); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill.rapsodo { background: color-mix(in srgb, var(--rapsodo) 15%, transparent); color: var(--rapsodo); }
.chip { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.score { font-weight: 700; font-variant-numeric: tabular-nums; }
.score.pos { color: var(--pos); } .score.neg { color: var(--neg); } .score.zero { color: var(--text-2); }
.src { font-size: 12px; font-weight: 700; color: var(--text-2); }

/* ---------- competitor cards */
.comp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.comp-card { cursor: pointer; transition: border-color .12s, transform .12s; display: flex; flex-direction: column; gap: 12px; }
.comp-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.comp-card .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.comp-card .top > div:first-child { min-width: 0; }
.comp-card .top > div:last-child { flex: none; white-space: nowrap; }
.comp-card .name { font-weight: 700; font-size: 15px; }
.comp-card .meta { font-size: 12.5px; color: var(--text-3); }
.comp-card .big { font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.split { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--surface-2); }
.split i { display: block; height: 100%; }
.hl { font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.hl div { display: flex; gap: 6px; align-items: baseline; }
.hl .k { font-weight: 700; width: 14px; flex: none; text-align: center; }
.hl .k.p { color: var(--pos); } .hl .k.n { color: var(--neg); }
.muted { color: var(--text-3); }

/* ---------- phrase lists */
.phr { display: flex; flex-direction: column; gap: 8px; }
.phr-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; font-size: 13.5px; }
.phr-row .b { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.phr-row .b i { display: block; height: 100%; border-radius: 99px; }

/* ---------- feed */
.feed { display: flex; flex-direction: column; gap: 12px; }
.post { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.post .row1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-3); }
.post .text { white-space: pre-wrap; word-break: break-word; font-size: 14px; }
.post .text.clamp { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.post .summary { font-size: 13px; color: var(--text-2); border-left: 3px solid var(--accent-soft); padding-left: 10px; }
.post .row3 { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); align-items: center; }
.post .plus { color: var(--pos); } .post .minus { color: var(--neg); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .input { width: auto; min-width: 150px; }
.toolbar .grow { flex: 1; min-width: 220px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--text-2); font-size: 13px; }

/* ---------- timeline */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: grid; grid-template-columns: 96px 18px 1fr; gap: 0 12px; }
.tl-date { font-size: 12.5px; color: var(--text-3); padding-top: 2px; text-align: right; font-variant-numeric: tabular-nums; }
.tl-rail { position: relative; }
.tl-rail::before { content: ""; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.tl-rail i { position: absolute; left: 3px; top: 5px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--surface); }
.tl-body { padding-bottom: 18px; display: flex; flex-direction: column; gap: 4px; }
.tl-title { font-weight: 600; }

/* ---------- notices */
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 14px; border: 1px solid; }
.banner.warn { background: var(--mix-soft); border-color: color-mix(in srgb, var(--mix) 35%, transparent); color: var(--text); }
.banner.info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.banner b { font-weight: 700; }
.empty { text-align: center; padding: 48px 16px; color: var(--text-2); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty .icon { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; color: var(--text-3); }
.empty h3 { margin: 0; color: var(--text); font-size: 16px; }
.empty p { margin: 0; max-width: 460px; }
.toast { position: fixed; right: 24px; bottom: 24px; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 500; box-shadow: 0 10px 30px rgba(0,0,0,.2); z-index: 50; }
.skeleton { height: 120px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- admin */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 8px; }
.log { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--surface-2); border-radius: 8px; padding: 12px; max-height: 260px; overflow: auto; white-space: pre-wrap; }
.progress { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.md { font-size: 14px; line-height: 1.6; }
.md h1 { font-size: 18px; } .md h2 { font-size: 15px; margin-top: 18px; }
.md table { border-collapse: collapse; font-size: 13px; }
.md td, .md th { border: 1px solid var(--border); padding: 4px 8px; }
.md blockquote { margin: 8px 0; padding: 6px 12px; background: var(--mix-soft); border-radius: 8px; }
.icon svg, [data-icon] svg { width: 16px; height: 16px; display: block; }
.empty .icon svg { width: 22px; height: 22px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.head-stat { display: flex; gap: 28px; flex-wrap: wrap; }
.head-stat div { display: flex; flex-direction: column; }
.head-stat .v { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.head-stat .l { font-size: 12.5px; color: var(--text-3); }
.nav a svg, .btn svg, .select-btn svg, .ghost-btn svg { width: 16px; height: 16px; flex: none; }

.tbl-wrap { overflow-x: auto; margin: 0 -4px; }
.g-wide { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
@media (max-width: 1200px) { .g-wide { grid-template-columns: 1fr; } }

/* ---------- v2 additions */
.banner.danger { background: var(--neg-soft); border-color: color-mix(in srgb, var(--neg) 35%, transparent); }
.user-box { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.user-box .meta { min-width: 0; font-size: 12px; line-height: 1.3; }
.user-box .meta b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-box a { margin-left: auto; white-space: nowrap; font-size: 12px; color: var(--text-3); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 4px; flex-wrap: wrap; }
.tabs a { padding: 8px 12px; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
.modal-back { position: fixed; inset: 0; background: rgba(16, 24, 40, .45); display: grid; place-items: center; z-index: 40; padding: 24px; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; width: min(820px, 100%); max-height: calc(100vh - 48px); overflow: auto; padding: 22px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal h2 { margin: 0 0 4px; font-size: 17px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; position: sticky; bottom: -22px; background: var(--surface); padding: 12px 0 2px; }
textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; min-height: 180px; }
.kv { display: grid; grid-template-columns: 200px 1fr; gap: 8px 16px; font-size: 13.5px; }
.kv dt { color: var(--text-3); } .kv dd { margin: 0; }
.ok { color: var(--pos); } .bad { color: var(--neg); } .warn-t { color: var(--mix); }
.delta { font-size: 12px; font-weight: 600; margin-left: 6px; }
.delta.up { color: var(--pos); } .delta.down { color: var(--neg); }
.quote { border-left: 3px solid var(--brand); padding: 4px 0 4px 12px; display: flex; flex-direction: column; gap: 6px; }
.quote .t { font-size: 14px; }
.quote .by { font-size: 12.5px; color: var(--text-3); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.voice-row .who { display: flex; flex-direction: column; }
.voice-row .who small { color: var(--text-3); }
.takeaways { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 100%); text-align: center; display: flex; flex-direction: column; gap: 16px; padding: 36px 32px; }
.login-card .logo { font-size: 30px; font-weight: 800; letter-spacing: -.03em; }
.ms-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid var(--border); background: var(--surface); padding: 11px 16px; border-radius: 10px; font-weight: 600; cursor: pointer; color: var(--text); }
.ms-btn:hover { border-color: var(--text-3); text-decoration: none; }
.sig-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.sig-tabs a { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; flex: 1 1 0; min-width: 104px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text-2); }
.sig-tabs a:hover { border-color: var(--text-3); text-decoration: none; }
.sig-tabs a span { font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.sig-tabs a b { font-size: 20px; color: var(--text); letter-spacing: -.02em; }
.sig-tabs a.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.sig-detail { white-space: pre-wrap; font-size: 13px; color: var(--text-2); max-height: 7.5em; overflow: hidden; }

/* Admin → API keys */
.keys-tbl { table-layout: fixed; width: 100%; }
.keys-tbl td { vertical-align: top; overflow-wrap: anywhere; }
.keys-tbl .test { margin-top: 4px; }
.keys-tbl .test .pill { white-space: normal; border-radius: 8px; line-height: 1.35; padding: 2px 8px; }
.keys-tbl .input { min-width: 0; }
.meter { height: 8px; border-radius: 99px; background: var(--border); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 99px; }

/* plain-language brief, opinion bars, praise/criticism chips, competitor cards */
.brief { border-left: 3px solid var(--accent); }
.brief ul { margin: 8px 0 6px; padding-left: 18px; display: grid; gap: 6px; font-size: 14.5px; line-height: 1.45; }
.brief p { margin: 4px 0 0; }
.sent-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.sent-legend span { display: inline-flex; align-items: center; gap: 5px; }
.sent-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.opinion { display: grid; gap: 4px; }
.opinion .split { height: 8px; }
.split { gap: 2px; }
.split i:first-child { border-radius: 4px 0 0 4px; } .split i:last-child { border-radius: 0 4px 4px 0; }
.pos-t { color: var(--pos); } .neg-t { color: var(--neg); }
.tchip { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; padding: 2px 9px; border-radius: 99px; margin: 2px 4px 2px 0; border: 1px solid var(--border); white-space: nowrap; }
.tchip b { font-weight: 600; color: var(--text-3); }
.tchip.p { background: var(--pos-soft); border-color: color-mix(in srgb, var(--pos) 30%, transparent); }
.tchip.n { background: var(--neg-soft); border-color: color-mix(in srgb, var(--neg) 30%, transparent); }
.tbl.pc td { vertical-align: top; }
details.more { margin-top: 12px; } details.more summary { cursor: pointer; font-size: 13px; color: var(--accent); }
.quotes { display: grid; gap: 8px; }
.quotes blockquote { margin: 0; font-size: 13px; line-height: 1.45; padding: 6px 10px; border-left: 3px solid var(--border); background: var(--surface-2); border-radius: 0 8px 8px 0; }
.quotes blockquote.p { border-left-color: var(--pos); } .quotes blockquote.n { border-left-color: var(--neg); }
.quotes blockquote span { display: block; margin-top: 3px; font-size: 11.5px; color: var(--text-3); }
.cev { display: grid; gap: 6px; font-size: 13px; border-top: 1px solid var(--border); padding-top: 10px; }
.mix-t { color: var(--mix); } .neu-t { color: var(--text-2); }

/* ---------- acting on the data: alerts, switching, battlecards, digest ---------- */
.alerts { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.alert { border-left: 3px solid var(--border); }
.alert.important { border-left-color: var(--neg); }
.alert .atitle { font-weight: 600; margin-top: 4px; }
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi .label { font-size: 12px; color: var(--text-2); }
.kpi .value { font-size: 28px; font-weight: 700; margin-top: 4px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); margin: 4px 0 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.tbl.flow td.bar { width: 40%; }
.tbl.flow .b { display: flex; align-items: center; gap: 6px; }
.tbl.flow .l .b { justify-content: flex-end; }
.tbl.flow .b i { display: block; height: 12px; min-width: 0; border-radius: 0 4px 4px 0; }
.tbl.flow .l .b i { border-radius: 4px 0 0 4px; }
.tbl.flow .b span { font-size: 12px; color: var(--text-2); min-width: 10px; }
.battle h3 { font-size: 14px; margin: 16px 0 6px; }
.battle ul { margin: 0; padding-left: 18px; }
.battle li { margin: 3px 0; }
.positioning { font-size: 16px; font-weight: 600; margin: 14px 0 4px; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 6px; }
.hl-row td { background: var(--accent-soft); }
.digest h1 { font-size: 20px; margin-top: 0; }
.digest h2 { font-size: 15px; margin: 18px 0 6px; }
.digest table { border-collapse: collapse; width: 100%; font-size: 13px; }
.digest th, .digest td { border-bottom: 1px solid var(--border); padding: 5px 8px; text-align: left; }
.digest blockquote { margin: 6px 0; padding: 6px 10px; border-left: 3px solid var(--border); color: var(--text-2); }
@media print {
  .sidebar, .topbar, #filters, #banners, .no-print, .nav { display: none !important; }
  .main, #view { margin: 0 !important; padding: 0 !important; }
  .card { box-shadow: none !important; border: none !important; }
}

.comp-tools { margin-bottom: 4px; }
.comp-tools label { display: inline-flex; align-items: center; gap: 6px; }
.comp-tools .input.sm { padding: 5px 8px; font-size: 13px; width: auto !important; min-width: 0; }

.daybars { display: flex; align-items: flex-end; gap: 3px; height: 120px; margin: 8px 0 4px; }
.daybars div { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.daybars i { display: block; width: 100%; min-height: 2px; background: var(--c1); border-radius: 3px 3px 0 0; }
.daybars span { font-size: 10px; color: var(--text-2); height: 14px; }
