/* IVDNews client app. Light and dark themes; one file, no framework. */
/* Lato (SIL Open Font License), self-hosted: the IVDNews brand font (deliver/brand). Weights 400, 700, 900. */
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/lato-400.woff2') format('woff2'); }
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/lato-700.woff2') format('woff2'); }
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 900; font-display: swap; src: url('../fonts/lato-900.woff2') format('woff2'); }

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --line: #e3e8ee;
  --line-strong: #cdd5de;
  --ink: #16202c;
  --ink-2: #44515f;
  --muted: #5e6680;
  --brand: #1c64a8;
  --brand-ink: #134a80;
  --brand-tint: #e7f0fa;
  --sky: #3bb3fb;             /* brand sky (logo underline) */
  --accent: #3bb3fb;
  --gradient: linear-gradient(90deg, #134a80 0%, #1c64a8 38%, #2e9be6 100%);   /* brand signature gradient, button form */
  --edge: linear-gradient(90deg, #134a80 0%, #1c64a8 38%, #3bb3fb 100%);       /* brand signature gradient, edge bars */
  --navy: linear-gradient(160deg, #07111f 0%, #0b1f36 40%, #0f2d4d 75%, #14385e 100%);
  --dots: radial-gradient(circle, rgba(150, 200, 245, .22) 1.2px, transparent 1.7px);
  --up: #1c7a43;
  --down: #c0352b;
  --side-ink: #cfdbe7;
  --side-head: #8fb3d4;
  --side-hover: rgba(143, 179, 212, .10);
  --side-on: rgba(59, 179, 251, .16);
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
  --radius: 10px;
  --font: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {   /* the brand sheet's navy ramp (Navy 0-3) */
  --bg: #07111f;
  --surface: #0b1f36;
  --surface-2: #0f2d4d;
  --line: #1c3756;
  --line-strong: #2a4a6e;
  --ink: #e9f0f7;
  --ink-2: #b9c8d8;
  --muted: #92a9c0;
  --brand: #3bb3fb;
  --brand-ink: #8fd0fd;
  --brand-tint: #12385c;
  --up: #4cc27f;
  --down: #f07167;
  --shadow: none;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font); }
img { max-width: 100%; height: auto; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-ink); text-decoration: underline; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.ic { width: 18px; height: 18px; flex-shrink: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.note { color: var(--muted); font-size: 12.5px; margin: 8px 0 0; }
.lede { color: var(--ink-2); margin: -6px 0 16px; }

/* ---------------- shell ---------------- */
.app { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--navy); color: var(--side-ink); position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; padding: 18px 14px; z-index: 30; }
.sidebar { isolation: isolate; }
.sidebar::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background-image: var(--dots); background-size: 11px 11px;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .35) 45%, rgba(0, 0, 0, .12) 100%); mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .35) 45%, rgba(0, 0, 0, .12) 100%); }
.sidebar::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 3px; background: linear-gradient(180deg, #3bb3fb 0%, #1c64a8 55%, #134a80 100%); opacity: .9; }
.side-logo { display: block; padding: 4px 10px 18px; }
.side-logo img { width: 190px; height: auto; display: block; }
.side-nav { flex: 1; }
.side-group { border: 1px solid rgba(143, 179, 212, .14); background: rgba(7, 17, 31, .28); border-radius: 10px; padding: 6px; margin-bottom: 14px; }
.side-head { font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--side-head); padding: 8px 10px 6px; }
.side-link { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 8px; color: var(--side-ink); font-size: 15px; flex: 1; min-width: 0; }
.side-link span { overflow: hidden; text-overflow: ellipsis; }
.side-link:hover { background: var(--side-hover); color: #fff; text-decoration: none; }
.side-link.on { background: var(--side-on); color: #fff; box-shadow: inset 3px 0 0 var(--sky); }
.side-row { display: flex; align-items: center; }
.side-toggle { background: none; border: 0; color: var(--side-head); padding: 8px; border-radius: 6px; cursor: pointer; display: flex; }
.side-toggle:hover { color: #fff; background: var(--side-hover); }
.side-toggle .ic { transition: transform .15s; width: 16px; height: 16px; }
.side-topic.open .side-toggle .ic { transform: rotate(90deg); }
.side-subs { display: none; padding: 2px 0 6px 39px; }
.side-topic.open .side-subs { display: block; }
.side-sub { display: block; padding: 5px 8px; border-radius: 6px; color: var(--side-head); font-size: 14px; }
.side-sub:hover { color: #fff; background: var(--side-hover); text-decoration: none; }
.side-sub.on { color: #fff; background: var(--side-on); }
.side-foot { border-top: 1px solid rgba(143, 179, 212, .16); padding-top: 10px; }
.scrim { display: none; }

.page { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 14px; height: 68px; padding: 0 28px; background: var(--surface); position: sticky; top: 0; z-index: 20; }
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--edge); }
.menu-btn { display: none; }
.top-logo { display: none; line-height: 0; }
.top-logo img { height: 34px; width: auto; }
:root[data-theme="dark"] .top-logo .on-light, .top-logo .on-dark { display: none; }
:root[data-theme="dark"] .top-logo .on-dark { display: block; }
.top-search { position: relative; flex: 1; max-width: 560px; margin-left: auto; }
.top-search input[type="search"] { width: 100%; height: 40px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 12px 0 38px; background: var(--surface); color: var(--ink); font: 15px var(--font); }
.top-search input[type="search"]:focus { border-color: var(--brand); outline: 3px solid var(--brand-tint); outline-offset: 0; }
.top-search-ic { position: absolute; left: 11px; top: 11px; color: var(--muted); display: flex; }
.search-drop { display: none; position: absolute; top: 46px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(16, 24, 40, .14); padding: 12px 14px; z-index: 40; }
.top-search:focus-within .search-drop { display: block; }
.drop-head { font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 4px 0 8px; }
.drop-list { list-style: none; margin: 0; padding: 0; }
.drop-list a { display: block; padding: 6px 8px; border-radius: 6px; color: var(--ink); }
.drop-list a:hover { background: var(--surface-2); text-decoration: none; }
.drop-list strong { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drop-list span { display: block; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 8px; border: 0; background: none; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn .ic { width: 20px; height: 20px; }
.when-dark { display: none; } :root[data-theme="dark"] .when-dark { display: inline-flex; } :root[data-theme="dark"] .when-light { display: none; }
.avatar { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--line); padding: 0; overflow: hidden; cursor: pointer; background: var(--surface); }
.avatar img { width: 100%; height: 100%; display: block; }
.menu-wrap { position: relative; }
.pop { position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(16, 24, 40, .16); padding: 6px; z-index: 50; }
.pop a, .pop button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 6px; color: var(--ink); background: none; border: 0; cursor: pointer; text-align: left; font-size: 14px; }
.pop a:hover, .pop button:hover { background: var(--surface-2); text-decoration: none; }
.pop.apps { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; width: 340px; padding: 8px; }
.pop.apps a { flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px; border: 1px solid var(--line); }
.pop.apps a .ic { color: var(--brand); margin-bottom: 4px; width: 22px; height: 22px; }
.pop.apps strong { font-size: 14px; }
.pop.apps span { font-size: 12.5px; color: var(--muted); }
.pop.user { width: 260px; }
.user-id { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.user-id strong { display: block; }
.user-id span { font-size: 13px; color: var(--muted); word-break: break-all; }
.pop.user .btn.block { justify-content: center; margin-top: 6px; color: #fff; }

.main { padding: 26px 28px 40px; flex: 1; width: 100%; max-width: 1480px; }
.sitefoot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 18px; padding: 16px 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; background: var(--surface); }

/* ---------------- common ---------------- */
.page-title { font-size: 26px; font-weight: 900; letter-spacing: -.01em; margin: 0 0 16px; }
.page-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head-row .page-title { margin: 0; }
.section-title { font-size: 16px; font-weight: 600; color: var(--ink-2); margin: 24px 0 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.empty h1 { font-size: 20px; margin: 0 0 6px; }
.card.empty p { margin: 0; color: var(--ink-2); }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-head h2 { font-size: 16.5px; font-weight: 700; margin: 0; }
.panel-sub { color: var(--muted); font-size: 13px; font-style: italic; }
.panel-head [data-expand], .panel-link { margin-left: auto; }
.panel-link { font-size: 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 18px; border-radius: 8px; border: 0; background: var(--gradient); color: #fff; font: 700 14px var(--font); letter-spacing: .01em; cursor: pointer; white-space: nowrap; text-shadow: 0 1px 1px rgba(7, 17, 31, .2); box-shadow: 0 1px 0 rgba(255, 255, 255, .16) inset, 0 3px 10px rgba(28, 100, 168, .22); transition: filter .15s, box-shadow .15s; }
.btn:hover { filter: brightness(1.07); color: #fff; text-decoration: none; box-shadow: 0 1px 0 rgba(255, 255, 255, .16) inset, 0 6px 16px rgba(28, 100, 168, .3); }
.btn:active { filter: brightness(.95); }
.btn[disabled] { opacity: .55; cursor: default; }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); text-shadow: none; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); filter: none; box-shadow: none; }
.btn .ic { width: 17px; height: 17px; }
.linkish { background: none; border: 0; padding: 2px 4px; color: var(--brand); font: 500 14px var(--font); cursor: pointer; }
.linkish:hover { text-decoration: underline; }
.linkish.danger { color: var(--down); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px 6px 10px; border-radius: 999px; background: var(--gradient); color: #fff; font-weight: 600; font-size: 14px; }
.pill:hover { filter: brightness(1.07); color: #fff; text-decoration: none; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--ink-2); font-weight: 500; border: 0; padding: 0; margin: 0; min-width: 0; }
.field.grow { flex: 1 1 280px; }
.field.compact { flex-direction: row; align-items: center; gap: 8px; }
.field input, .field select, .field textarea, .picker-find, .copy-row input, .table-tools input { min-height: 38px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 10px; font: 15px var(--font); color: var(--ink); background: var(--surface); width: 100%; }
.field textarea { resize: vertical; }
.field input:disabled { background: var(--surface-2); color: var(--muted); }
.field input:focus, .field select:focus, .field textarea:focus, .picker-find:focus, .table-tools input:focus { border-color: var(--brand); outline: 3px solid var(--brand-tint); outline-offset: 0; }
.field legend { font-size: 13px; font-weight: 500; color: var(--ink-2); margin-bottom: 4px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--ink); font-weight: 400; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); margin: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.form-msg { font-size: 14px; }
.form-msg.ok { color: var(--up); }
.form-msg.err { color: var(--down); }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
.hint.ok { color: var(--up); } .hint.err { color: var(--down); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); font-size: 13.5px; font-weight: 500; cursor: pointer; }
.chip:hover { border-color: var(--brand); color: var(--brand-ink); text-decoration: none; }
.chip.chip-co { border-color: #9fd4dc; }
.chip.chip-term { border-color: #c8bfe6; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip .count { font-size: 12px; opacity: .75; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; color: var(--brand-ink); background: var(--brand-tint); border-radius: 999px; padding: 2px 9px; margin: 0 4px 4px 0; }
.badges { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.badge { font-size: 13px; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-5-7 { display: grid; grid-template-columns: 5fr 7fr; gap: 16px; }
.grid-7-5 { display: grid; grid-template-columns: 7fr 5fr; gap: 16px; }
.grid-2 > .card, .grid-5-7 > .card, .grid-7-5 > .card { margin-bottom: 16px; }

/* tabs (Recent Articles / Show All / My Preferences; analytics tabs) */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; color: var(--ink-2); font-weight: 500; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a { position: relative; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: transparent; }
.tabs a[aria-current="page"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; border-radius: 2px; background: var(--edge); }

/* ---------------- dashboard ---------------- */
.headlines { margin-bottom: 14px; }
.ticker { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
.ticker-track { display: flex; width: max-content; animation: ivd-ticker var(--ticker-dur, 90s) linear infinite; }
.ticker:hover .ticker-track, .ticker:focus-within .ticker-track { animation-play-state: paused; }
@keyframes ivd-ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.tick { display: flex; align-items: center; gap: 10px; padding: 12px 22px; max-width: 420px; color: var(--ink); border-right: 1px solid var(--line); }
.tick:hover { background: var(--surface-2); text-decoration: none; }
.tick img { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; }
.tick span { min-width: 0; }
.tick strong { display: block; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 340px; }
.tick em { display: block; font-style: normal; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .ticker-track { animation: none; } .ticker { overflow-x: auto; } }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; margin-left: auto; }
.seg button { border: 0; border-left: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); padding: 6px 11px; font-size: 13.5px; cursor: pointer; }
.seg button:first-child { border-left: 0; }
.seg button:hover { background: var(--surface-2); }
.seg button[aria-checked="true"] { background: var(--brand); color: #fff; font-weight: 700; }
.alist { list-style: none; margin: 0; padding: 0; }
.alist.scroll { max-height: 520px; overflow-y: auto; margin: 0 -20px; padding: 0 20px; }
.arow { border-top: 1px solid var(--line); }
.arow:first-child { border-top: 0; }
.arow a { display: block; padding: 13px 0; color: var(--ink); }
.arow a:hover { text-decoration: none; }
.arow a:hover strong { color: var(--brand); }
.arow time { display: block; font-size: 13px; color: var(--ink-2); }
.arow strong { display: block; font-size: 15.5px; line-height: 1.35; margin: 2px 0; }
.src { color: var(--brand); font-size: 13px; font-weight: 700; }
:root[data-theme="dark"] .chip.on, :root[data-theme="dark"] .pager a[aria-current="page"], :root[data-theme="dark"] .seg button[aria-checked="true"] { color: #07111f; }
.arow .src { display: block; }
.arow .sum { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); font-size: 14px; margin-top: 2px; }
.empty-msg { color: var(--muted); margin: 8px 0 0; }
.results { padding: 4px 20px; }

.topic-summary { text-align: center; }
.gauge-title { font-size: 18px; font-weight: 500; font-style: italic; color: var(--ink-2); margin: 0 0 4px; }
.gauge { position: relative; height: 170px; max-width: 240px; margin: 0 auto; }
.gauge-label { position: absolute; left: 0; right: 0; top: 54%; transform: translateY(-50%); text-align: center; pointer-events: none; }
.gauge-label span { display: block; font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.gauge-label small { font-size: 12.5px; color: var(--muted); font-weight: 600; font-style: italic; }
.mini-title { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 8px 0 4px; text-align: left; }
.chart-sm { position: relative; height: 130px; }
.sparks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.spark { padding: 14px 16px 6px; }
.spark-label { font-size: 13.5px; color: var(--ink-2); font-weight: 500; }
.spark-value { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.spark-chart { position: relative; height: 70px; margin: 0 -6px; }

.topic-block { margin-bottom: 8px; }
.divider { font-size: 17px; font-weight: 600; margin: 8px 0 12px; padding-bottom: 8px; border-bottom: 1px dashed var(--line-strong); }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; margin-bottom: 18px; }
.acard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.acard-head { position: relative; display: flex; align-items: flex-end; min-height: 118px; padding: 16px 18px 19px; background: var(--dots), var(--navy); background-size: 11px 11px, auto; color: #fff; }
.acard-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--edge); }
.acard-head:hover { text-decoration: none; filter: brightness(1.08); }
.acard-head h3 { font-size: 16px; line-height: 1.35; margin: 0; color: #fff; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.acard-body { padding: 12px 18px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.acard-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.acard-meta .src { text-transform: uppercase; letter-spacing: .03em; font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acard time { font-size: 12.5px; color: var(--muted); }
.acard-sum { color: var(--ink-2); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden; }
.acard-sum:hover { text-decoration: none; color: var(--ink); }
.card-menu .pop { min-width: 150px; }

/* ---------------- article detail ---------------- */
.detail-top { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.crumb a { color: var(--muted); font-size: 14px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.detail-main h1 { font-size: 24px; line-height: 1.3; margin: 0 0 12px; }
.source-box { background: var(--brand-tint); color: var(--brand-ink); border: 1px solid #cfe0f2; border-left: 4px solid var(--brand); border-radius: 8px; padding: 9px 12px; font-weight: 500; margin-bottom: 14px; }
:root[data-theme="dark"] .source-box { border-color: var(--line-strong); border-left-color: var(--sky); }
.lead { font-size: 16.5px; line-height: 1.65; color: var(--ink-2); overflow-wrap: anywhere; }
.lead p { margin: 0 0 1em; }
.lead img { border-radius: 6px; }
.lead table { display: block; max-width: 100%; overflow-x: auto; }
.detail-side dl { margin: 0; }
.detail-side dt { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 14px; }
.detail-side dt:first-child { margin-top: 0; }
.detail-side dd { margin: 4px 0 0; }
.detail-side .tools { display: flex; flex-direction: column; gap: 8px; }
.detail-side .tools .btn { justify-content: flex-start; }

/* ---------------- search / library / prefs / profile / share ---------------- */
.search-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.count { color: var(--muted); font-size: 13.5px; margin: 0 0 10px; }
.pager { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 16px 0; }
.pager a { min-width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink-2); }
.pager a:hover { text-decoration: none; border-color: var(--brand); }
.pager a[aria-current="page"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.lib-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.lib-nav { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 84px; }
.pill-btn { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--ink-2); cursor: pointer; text-align: left; font-size: 14px; }
.pill-btn:hover { background: var(--surface-2); }
.pill-btn.on { background: var(--brand-tint); color: var(--brand-ink); font-weight: 600; }
.pill-btn .count { margin-left: auto; font-size: 12px; color: var(--muted); }
.pill-btn .ic { width: 16px; height: 16px; }
.lib-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.lib-item { margin: 0; }
.lib-top { display: flex; align-items: center; justify-content: space-between; }
.lib-item h3 { font-size: 16px; line-height: 1.35; margin: 6px 0 4px; }
.lib-item h3 a { color: var(--ink); }
.lib-item .meta { font-size: 13px; color: var(--muted); }
.lib-item .sum { color: var(--ink-2); font-size: 14px; margin: 6px 0 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.picker-find { margin: 6px 0 8px; }
.picker-list { max-height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; display: grid; gap: 4px; }
.picker-list .check { padding: 3px 0; font-size: 14.5px; }
.picked { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.profile-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
.profile-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 84px; padding: 10px; }
.profile-nav a { padding: 8px 10px; border-radius: 6px; color: var(--ink-2); }
.profile-nav a:hover { background: var(--surface-2); text-decoration: none; }
.profile-main section { scroll-margin-top: 84px; }
.profile-main fieldset { display: flex; gap: 18px; flex-wrap: wrap; }
.profile-main fieldset legend { width: 100%; }
.copy-row { display: flex; gap: 8px; }
.actions { white-space: nowrap; }
.share-what { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; margin: 0 0 16px; }
dialog.modal { border: 1px solid var(--line); border-radius: 12px; padding: 22px; width: min(480px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: 0 20px 50px rgba(16, 24, 40, .25); }
dialog.modal h2 { font-size: 18px; margin: 0; }
dialog::backdrop { background: rgba(15, 21, 28, .45); }

/* ---------------- analytics ---------------- */
.inline-form { display: flex; gap: 10px; align-items: center; }
.panel { min-width: 0; }
.chart { position: relative; height: 320px; }
.gauges { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.gauge-card .gauge { height: 180px; }
.report-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.report-link { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); }
.report-link:hover { border-color: var(--brand); text-decoration: none; }
.kicker { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--brand-ink); }
.older { margin-top: 12px; }
.older summary { cursor: pointer; color: var(--brand); font-size: 14px; }
.older-list { columns: 2; margin: 8px 0 0; padding-left: 18px; font-size: 14px; }
.report-frame { display: block; width: 100%; height: 80vh; border: 0; background: #fff; }
.table-tools { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.table-tools input { max-width: 260px; }
.table-scroll { overflow-x: auto; }
.table-scroll.tall { max-height: 460px; overflow-y: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.data th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
table.data tr.totals th { color: var(--ink); font-size: 13px; top: 0; }
table.data thead tr:nth-child(2) th { top: 37px; }
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
table.data tbody tr:hover td { background: var(--surface-2); }
table.data .num { text-align: right; }
table.data .up { color: var(--up); font-weight: 600; }
table.data .down { color: var(--down); font-weight: 600; }
table.sortable th[data-sort] { cursor: pointer; user-select: none; }
table.sortable th[data-sort]::after { content: " ↕"; opacity: .35; }
table.sortable th[aria-sort="ascending"]::after { content: " ↑"; opacity: 1; }
table.sortable th[aria-sort="descending"]::after { content: " ↓"; opacity: 1; }
dialog.expand { border: 0; border-radius: 12px; padding: 0; width: min(1200px, calc(100vw - 32px)); max-height: calc(100vh - 48px); background: var(--surface); color: var(--ink); }
.expand-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.expand-head h2 { font-size: 17px; margin: 0; }
.expand-body { padding: 18px; overflow: auto; max-height: calc(100vh - 130px); }
.expand-body .chart { height: min(62vh, 600px); }
.expand-body .table-scroll.tall { max-height: none; }
.toast { position: fixed; right: 20px; bottom: 20px; background: var(--ink); color: var(--surface); padding: 11px 16px; border-radius: 8px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); z-index: 90; font-size: 14px; max-width: calc(100vw - 40px); }
.toast.err { background: var(--down); color: #fff; }

/* shared-article (public) page */
.shared { background: var(--bg); }
.shared-top { position: relative; background: var(--dots), var(--navy); background-size: 11px 11px, auto; padding: 16px 24px 19px; }
.shared-top::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--edge); }
.shared-top img { height: 46px; width: auto; display: block; filter: drop-shadow(0 4px 12px rgba(0, 0, 0, .45)); }
.shared-top .btn.ghost { background: rgba(255, 255, 255, .08); color: #fff; border-color: rgba(143, 179, 212, .4); }
.shared-top .btn.ghost:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.shared-main { max-width: 860px; margin: 24px auto; padding: 0 16px; }
.shared-main .meta { color: var(--muted); font-size: 14px; }
.shared-cta { color: var(--ink-2); font-size: 14px; }

.shared-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.legal-body { padding: 28px 32px; }
.legal-body h1 { font-size: 28px; margin: 0 0 4px; }
.legal-body h2 { font-size: 18px; margin: 26px 0 8px; }
.legal-body h3 { font-size: 15.5px; margin: 16px 0 6px; }
.legal-body p, .legal-body li { color: var(--ink-2); line-height: 1.65; }
.legal-body ul { padding-left: 20px; }
.legal-body li { margin-bottom: 6px; }
.legal-body .updated { color: var(--muted); font-size: 14px; margin-top: 0; }

/* ---------------- responsive ---------------- */
@media (max-width: 1200px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr) 290px; }
  .sparks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-5-7, .grid-7-5 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; width: 270px; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  body.side-open .sidebar { transform: none; }
  body.side-open .scrim { display: block; position: fixed; inset: 0; background: rgba(15, 21, 28, .45); z-index: 25; }
  .menu-btn { display: inline-flex; }
  .top-logo { display: block; }
  .topbar { padding: 0 16px; gap: 8px; }
  .main { padding: 20px 16px 32px; }
  .sitefoot { padding: 14px 16px; }
  .dash-grid, .detail-grid, .lib-grid, .profile-grid, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .lib-nav, .profile-nav { position: static; }
  .gauges { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .topbar { height: 60px; }
  .top-search input[type="search"] { font-size: 16px; }
  .sparks, .gauges { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .seg { margin-left: 0; }
  .pop.apps { width: min(320px, calc(100vw - 32px)); }
  .chart { height: 260px; }
  .older-list { columns: 1; }
  .card { padding: 16px; }
  .alist.scroll { margin: 0 -16px; padding: 0 16px; }
}
