/* color-it.ua analytics — one page in the aggregator idiom: thin stats strip, dense sortable
   tables, change in green/red, 7-day sparklines. Body type is the site's own Roboto. */
@font-face { font-family: "Roboto"; src: url(/static/fonts/roboto-v20-latin_cyrillic-regular.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Roboto"; src: url(/static/fonts/Roboto-Medium.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Roboto"; src: url(/static/fonts/roboto-v20-latin_cyrillic-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "HNC"; src: url(/static/fonts/HelveticaNeue-CondensedBlack.woff) format("woff"); font-weight: 900; font-display: swap; }

:root {
  --bg: #ffffff;
  --row-hover: #f8fafd;
  --head: #58667e;           /* table header / muted ink */
  --ink: #0d1421;
  --ink-2: #58667e;
  --line: #eff2f5;
  --line-2: #e3e7ec;
  --up: #16c784;
  --up-ink: #0b8a59;         /* text-contrast green */
  --down: #ea3943;
  --down-ink: #c8202b;
  --amber-bg: #fff6e0;
  --amber-ink: #8a5a00;
  --amber: #f0a400;
  --accent: #ff0000;         /* color-it red, brand mark only */
  --pill-bg: #eff2f5;
  --pill-on: #ffffff;
  --tag-ink: #58667e;
  --skel: #eff2f5;
  color-scheme: light only;
}
/* Light by default (founder: clean white). Dark only when explicitly set via data-theme. */
:root[data-theme="dark"] {
  --bg: #0d1421; --row-hover: #171f30; --head: #a1a7bb; --ink: #f2f4f7; --ink-2: #a1a7bb;
  --line: #222b3d; --line-2: #2b3549; --up-ink: #3fdc9e; --down-ink: #ff6b73;
  --amber-bg: #2d2412; --amber-ink: #f5c45c; --pill-bg: #222b3d; --pill-on: #323e56; --tag-ink: #a1a7bb;
  --skel: #222b3d; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 14px/1.45 "Roboto", system-ui, sans-serif; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid #3861fb; outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; }

/* top bar */
.bar { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); }
.bar-in { max-width: 1280px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { font: 900 20px/1 "HNC", "Arial Narrow", sans-serif; letter-spacing: .01em; color: var(--ink); text-decoration: none; margin-right: auto; }
.brand span { font: 400 13px "Roboto", sans-serif; color: var(--ink-2); margin-left: 6px; letter-spacing: 0; }
.toggles { display: flex; gap: 10px; }
.pills { display: inline-flex; background: var(--pill-bg); border-radius: 8px; padding: 3px; }
.pills button { border: 0; background: transparent; padding: 5px 11px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.pills button[aria-pressed="true"] { background: var(--pill-on); color: var(--ink); box-shadow: 0 1px 2px rgba(13,20,33,.12); }
.pills button:not([aria-pressed="true"]):hover { color: var(--ink); }
.who { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--ink-2); }
.who a { color: var(--ink); font-weight: 500; text-decoration: none; }
.who a:hover { text-decoration: underline; }
.link { background: none; border: 0; padding: 0; color: var(--ink-2); cursor: pointer; }
.link:hover { color: var(--ink); text-decoration: underline; }
@media (max-width: 760px) {
  .bar-in { padding: 8px 16px; gap: 8px 10px; }
  .toggles { order: 3; width: 100%; justify-content: space-between; }
}

.wrap { max-width: 1280px; margin: 0 auto; padding: 0 24px 96px; }
@media (max-width: 760px) { .wrap { padding: 0 16px 96px; } }

/* stats strip */
.strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.stat { padding: 14px 16px 12px 0; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto auto; column-gap: 8px; }
.stat + .stat { padding-left: 16px; border-left: 1px solid var(--line); }
.stat .s-l { grid-column: 1 / -1; font-size: 12px; color: var(--ink-2); }
.stat .s-v { font-size: 22px; font-weight: 700; line-height: 1.25; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stat .s-d { font-size: 13px; }
.stat .s-sp { grid-row: 2 / 4; grid-column: 2; align-self: center; width: 84px; height: 34px; }
@media (max-width: 1000px) {
  .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat, .stat + .stat { padding: 12px 10px 10px 0; border-left: 0; border-top: 1px solid var(--line); }
  .stat:nth-child(even) { padding-left: 12px; border-left: 1px solid var(--line); }
  .stat:nth-child(-n+2) { border-top: 0; }
}
.notice { margin: 10px 0 0; padding: 7px 10px; border-radius: 6px; background: var(--amber-bg); color: var(--amber-ink); font-size: 13px; }

/* analyst note */
.note { margin: 14px 0 6px; border: 1px solid var(--line-2); border-radius: 10px; padding: 12px 16px; }
.note .n-top { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.note .n-mood { font-size: 16px; font-weight: 700; margin: 0; }
.note .n-mood.alert { color: var(--down-ink); }
.note .n-when { font-size: 12px; color: var(--ink-2); }
.note ul { margin: 8px 0 0; padding-left: 18px; }
.note li { margin: 2px 0; }
.note.clamped ul { max-height: 4.4em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); }
.note .more { margin-top: 4px; }

/* sections */
.sec { margin-top: 34px; }
.sec-h { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.sec-h h2 { font-size: 18px; font-weight: 700; margin: 0; }
.sec-h p { margin: 0; font-size: 13px; color: var(--ink-2); }
.foot { font-size: 12px; color: var(--ink-2); margin: 6px 0 0; }

/* tables */
.tw { overflow-x: auto; -webkit-overflow-scrolling: touch; border-top: 1px solid var(--line); }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.t th { position: sticky; top: 0; background: var(--bg); text-align: right; font-size: 12px; font-weight: 700; color: var(--head); padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none; }
.t th.sortable { cursor: pointer; }
.t th.sortable:hover { color: var(--ink); }
.t th .arr { display: inline-block; width: 10px; margin-left: 2px; font-size: 10px; }
.t th.l, .t td.l { text-align: left; }
.t td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; vertical-align: middle; background: var(--bg); }
.t tbody tr:hover td { background: var(--row-hover); }
.t .rk { width: 28px; color: var(--ink-2); font-size: 12px; text-align: left; padding-right: 0; }
.t .nm { text-align: left; white-space: normal; min-width: 220px; }
.t .nm b { font-weight: 500; }
.t .nm .sub { display: block; font-size: 12px; color: var(--ink-2); line-height: 1.35; margin-top: 1px; }
.t .nm .tag { display: inline-block; margin-left: 6px; font-size: 11px; color: var(--tag-ink); background: var(--pill-bg); padding: 1px 6px; border-radius: 4px; vertical-align: 1px; }
.t .v { font-weight: 500; }
.t .sp { width: 120px; padding-top: 6px; padding-bottom: 6px; }
.t .sp svg { width: 110px; height: 34px; display: block; margin-left: auto; }
.t .tog { background: none; border: 0; cursor: pointer; padding: 0 6px 0 0; color: var(--ink-2); font-size: 11px; }
.t tr.child td { background: var(--row-hover); }
.t tr.child .nm { padding-left: 28px; }
/* sticky name column on narrow screens */
@media (max-width: 760px) {
  .t .nm { position: sticky; left: 0; z-index: 1; min-width: 170px; max-width: 200px; box-shadow: 1px 0 0 var(--line); }
  .t th.nm { z-index: 2; }
  .t .rk { display: none; }
  .t .nm .sub { display: none; }
  .t td, .t th { padding-left: 8px; padding-right: 8px; }
}
.ch { font-weight: 500; }
.ch.up { color: var(--up-ink); } .ch.down { color: var(--down-ink); } .ch.flat { color: var(--ink-2); }
.more-row { margin-top: 8px; }
.btn-ghost { border: 1px solid var(--line-2); background: var(--bg); border-radius: 8px; padding: 6px 12px; font-size: 13px; font-weight: 500; cursor: pointer; }
.btn-ghost:hover { background: var(--row-hover); }
.sk { display: inline-block; height: 12px; border-radius: 4px; background: var(--skel); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }
.problem { color: var(--down-ink); padding: 12px 0; }

/* sparkline */
.spk path { fill: none; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.spk.up path { stroke: var(--up); } .spk.down path { stroke: var(--down); } .spk.flat path { stroke: var(--ink-2); }
.spk circle.gap { fill: var(--amber); stroke: var(--bg); stroke-width: 1.5; }
.spk rect.hit { fill: transparent; }

/* chat FAB + panel */
.fab { position: fixed; right: 20px; bottom: 20px; z-index: 30; display: flex; align-items: center; gap: 8px; background: var(--ink); color: var(--bg); border: 0; border-radius: 999px; padding: 12px 18px 12px 14px; font-weight: 500; cursor: pointer; box-shadow: 0 4px 14px rgba(13,20,33,.22); }
.fab svg { width: 20px; height: 20px; fill: currentColor; }
.fab:hover { background: #222c3d; }
.chat { position: fixed; right: 20px; bottom: 20px; z-index: 40; width: 380px; height: 560px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: var(--bg); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: 0 10px 34px rgba(13,20,33,.2); overflow: hidden; }
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.chat-head div { display: grid; }
.chat-head .muted { font-size: 12px; }
.x { background: none; border: 0; font-size: 24px; line-height: 1; cursor: pointer; color: var(--ink-2); padding: 2px 6px; }
.x:hover { color: var(--ink); }
.chat-body { flex: 1; overflow-y: auto; padding: 12px 14px; display: grid; gap: 10px; align-content: start; }
.q { justify-self: end; max-width: 85%; background: var(--ink); color: var(--bg); border-radius: 12px 12px 3px 12px; padding: 8px 11px; white-space: pre-wrap; }
.a { max-width: 100%; background: var(--row-hover); border: 1px solid var(--line); border-radius: 12px 12px 12px 3px; padding: 10px 12px; }
.a p { margin: 0 0 6px; } .a p:last-child { margin: 0; }
.a ul { margin: 2px 0 6px; padding-left: 18px; }
.a .src { margin-top: 6px; font-size: 11px; color: var(--ink-2); }
.a table { border-collapse: collapse; margin: 4px 0 8px; font-size: 12px; }
.a td, .a th { border-bottom: 1px solid var(--line); padding: 3px 6px; text-align: left; }
.a .n { text-align: right; }
.thinking { color: var(--ink-2); font-style: italic; }
.empty { color: var(--ink-2); font-size: 13px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 8px 14px 0; scrollbar-width: none; }
.chips button { flex: none; border: 1px solid var(--line-2); background: var(--bg); border-radius: 999px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.chips button:hover { background: var(--row-hover); }
.chat-form { display: flex; gap: 8px; padding: 10px 14px 14px; }
.chat-form textarea { flex: 1; resize: none; border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; background: var(--bg); }
.btn { background: var(--ink); color: var(--bg); border: 0; border-radius: 8px; padding: 0 14px; min-height: 38px; font-weight: 500; cursor: pointer; }
.btn:disabled { opacity: .5; cursor: progress; }
@media (max-width: 760px) {
  .chat { inset: 0; width: auto; height: auto; max-height: none; border-radius: 0; border: 0; }
  .fab { right: 16px; bottom: 16px; }
}

/* admin */
.gap-row .nm b { font-weight: 500; }
.gap-row details { font-size: 12px; color: var(--ink-2); margin-top: 3px; }
.notes-list .ni { padding: 12px 0; border-bottom: 1px solid var(--line); }
.notes-list .ni b { font-size: 15px; }
.notes-list ul { margin: 4px 0 0; padding-left: 18px; }

/* login */
.login { max-width: 360px; margin: 64px auto; }
.login h1 { font-size: 22px; margin: 0 0 4px; }
.login form { display: grid; gap: 12px; margin-top: 18px; }
.login label { display: grid; gap: 4px; font-size: 13px; color: var(--ink-2); }
.login input { border: 1px solid var(--line-2); border-radius: 8px; padding: 9px 11px; background: var(--bg); font-size: 16px; }
.err { color: var(--down-ink); min-height: 1.3em; margin: 0; font-size: 13px; }

.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: var(--bg); font-size: 12px; line-height: 1.35; padding: 6px 9px; border-radius: 6px; max-width: 260px; }
