/* IT Team Post Tracker
   Layout: sticky top bar with section tabs; each section is a stack of panels on a quiet page plane.
   Platform colors are the validated categorical slots 1–3 (Facebook, Instagram, TikTok) and follow the platform everywhere. */
:root {
  color-scheme: light;
  --bg: #f4f6f7;
  --surface: #ffffff;
  --surface-2: #f1f4f5;
  --surface-3: #e8edee;
  --ink: #0f1517;
  --ink-2: #48555a;
  --ink-3: #7c898e;
  --line: #e2e7e9;
  --line-2: #d2d9dc;
  --accent: #0b7a62;
  --accent-hover: #09684f;
  --accent-ink: #ffffff;
  --accent-soft: #e2f3ee;
  --good: #11713a; --good-bg: #e2f4e8;
  --mid: #885800;  --mid-bg: #fcf0d6;
  --low: #b0342b;  --low-bg: #fce6e3;
  --s1: #2a78d6;   /* Facebook */
  --s2: #eb6834;   /* Instagram */
  --s3: #1baf7a;   /* TikTok */
  --grid: #e9edee;
  --axis: #c9d1d4;
  --scrim: rgba(12, 18, 20, .38);
  --tab-on: #ffffff;
  --shadow-sm: 0 1px 2px rgba(15, 21, 23, .05);
  --shadow-md: 0 1px 2px rgba(15, 21, 23, .04), 0 8px 24px rgba(15, 21, 23, .07);
  --shadow-lg: 0 12px 48px rgba(15, 21, 23, .18);
  --r-sm: 8px; --r: 12px; --r-lg: 16px;
  --f-sans: "Geist", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "Geist Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  color-scheme: dark;
  --bg: #0b0f10; --surface: #141a1c; --surface-2: #1a2124; --surface-3: #222a2d;
  --ink: #edf2f3; --ink-2: #a8b4b8; --ink-3: #7a878c; --line: #232b2e; --line-2: #2f383c;
  --accent: #34c29b; --accent-hover: #4fd2ad; --accent-ink: #04150f; --accent-soft: #11332a;
  --good: #63d494; --good-bg: #123222; --mid: #efc062; --mid-bg: #372b10; --low: #f2897f; --low-bg: #3a1c19;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70;
  --grid: #1f272a; --axis: #333d41; --scrim: rgba(0, 0, 0, .55); --tab-on: #2a3337;
  --shadow-sm: none; --shadow-md: 0 0 0 1px rgba(255,255,255,.02); --shadow-lg: 0 16px 56px rgba(0,0,0,.6);
} }
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0f10; --surface: #141a1c; --surface-2: #1a2124; --surface-3: #222a2d;
  --ink: #edf2f3; --ink-2: #a8b4b8; --ink-3: #7a878c; --line: #232b2e; --line-2: #2f383c;
  --accent: #34c29b; --accent-hover: #4fd2ad; --accent-ink: #04150f; --accent-soft: #11332a;
  --good: #63d494; --good-bg: #123222; --mid: #efc062; --mid-bg: #372b10; --low: #f2897f; --low-bg: #3a1c19;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70;
  --grid: #1f272a; --axis: #333d41; --scrim: rgba(0, 0, 0, .55); --tab-on: #2a3337;
  --shadow-sm: none; --shadow-md: 0 0 0 1px rgba(255,255,255,.02); --shadow-lg: 0 16px 56px rgba(0,0,0,.6);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14.5px/1.5 var(--f-sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.015em; text-wrap: balance; }
h1 { font-size: 1.6rem; line-height: 1.2; }
h2 { font-size: 1rem; }
p { margin: 0; }
a { color: var(--accent); }
svg { display: block; }
button, input, select { font: inherit; color: inherit; }
.muted { color: var(--ink-2); }
.sm { font-size: .82rem; }
.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* icons drawn with strokes */
.icon-btn svg, .btn svg, .search svg, .fab svg, .brand-mark svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#menu-btn svg { fill: currentColor; stroke: none; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-weight: 600; font-size: .9rem; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--low); border-color: color-mix(in srgb, var(--low) 45%, transparent); background: transparent; }
.btn.danger:hover { background: var(--low-bg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.block { width: 100%; height: 42px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.link { font-weight: 600; font-size: .85rem; text-decoration: none; }
.link:hover { text-decoration: underline; }

.field { display: grid; gap: 6px; font-size: .82rem; font-weight: 500; color: var(--ink-2); min-width: 0; }
.field .hint { font-weight: 400; color: var(--ink-3); }
input[type="text"], input[type="url"], input[type="number"], input[type="password"], input[type="date"], input[type="search"], select {
  width: 100%; min-width: 0; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-size: .92rem; transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: var(--ink-3); }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 17px) 16px, calc(100% - 12px) 16px; background-size: 5px 5px; background-repeat: no-repeat; }
.msg { font-size: .85rem; min-height: 1.3em; }
.msg.err { color: var(--low); }
.msg.ok { color: var(--good); }

/* ---------- login ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.login-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 32px 28px; box-shadow: var(--shadow-md); display: grid; gap: 10px; }
.login-card h1 { font-size: 1.45rem; margin-top: 8px; }
.login-card form { display: grid; gap: 12px; margin-top: 14px; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); }
.brand-mark svg { width: 24px; height: 24px; stroke-width: 2.6; }
.brand-mark.sm { width: 30px; height: 30px; border-radius: 9px; }
.brand-mark.sm svg { width: 18px; height: 18px; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.topbar-in { max-width: 1240px; margin: 0 auto; padding-inline: 20px; height: 60px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 600; flex-shrink: 0; }
.brand-text { display: grid; line-height: 1.1; font-size: .95rem; }
.brand-text small { font-size: .72rem; color: var(--ink-3); font-weight: 500; }
.tabs { display: flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 11px; }
.tabs a { padding: 6px 14px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: .9rem; white-space: nowrap; transition: color .15s, background .15s; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { background: var(--tab-on); color: var(--ink); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.sync { display: inline-flex; align-items: center; gap: 7px; font-size: .8rem; color: var(--ink-3); padding: 0 8px; white-space: nowrap; }
.sync i { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--good-bg); }
.sync.off i { background: var(--low); box-shadow: 0 0 0 3px var(--low-bg); }
#theme-btn .i-sun { display: none; }
:root[data-theme="dark"] #theme-btn .i-sun { display: block; }
:root[data-theme="dark"] #theme-btn .i-moon { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) #theme-btn .i-sun { display: block; } :root:not([data-theme="light"]) #theme-btn .i-moon { display: none; } }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 190px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 6px; display: grid; z-index: 30; }
.menu a, .menu button { text-align: left; padding: 8px 10px; border-radius: 8px; border: 0; background: none; color: var(--ink); text-decoration: none; font-size: .9rem; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--surface-2); }
.notice { max-width: 1240px; margin: 12px auto 0; padding: 10px 14px; border-radius: var(--r); background: var(--mid-bg); color: var(--mid); font-size: .9rem; width: calc(100% - 40px); }

/* ---------- page ---------- */
.page { max-width: 1240px; margin: 0 auto; padding-inline: 20px; padding-block: 28px 96px; }
.view { display: grid; gap: 20px; animation: rise .25s ease both; }
@keyframes rise { from { transform: translateY(4px); } to { transform: none; } }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; }
.page-head p { margin-top: 4px; max-width: 70ch; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow-sm); min-width: 0; display: grid; gap: 14px; align-content: start; }
.panel.flush { padding: 0; gap: 0; overflow: hidden; }
.panel-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; }
.panel-head.pad { padding: 18px 20px 14px; }
.panel-head p { margin-top: 2px; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: 1.3fr repeat(3, 1fr); gap: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; display: grid; gap: 6px; align-content: start; min-width: 0; box-shadow: var(--shadow-sm); }
.kpi .label { font-size: .82rem; color: var(--ink-2); font-weight: 500; }
.kpi .value { font-size: 1.85rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.kpi.hero .value { font-size: 3rem; }
.kpi .foot { font-size: .8rem; color: var(--ink-3); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; overflow-wrap: anywhere; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-size: .78rem; padding: 1px 7px; border-radius: 999px; }
.delta.up { color: var(--good); background: var(--good-bg); }
.delta.down { color: var(--low); background: var(--low-bg); }
.delta.flat { color: var(--ink-2); background: var(--surface-2); }

.grid-main { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(280px, 1fr); gap: 20px; align-items: start; }

/* legend & chart */
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .8rem; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot.s1, .seg.s1 { background: var(--s1); fill: var(--s1); }
.dot.s2, .seg.s2 { background: var(--s2); fill: var(--s2); }
.dot.s3, .seg.s3 { background: var(--s3); fill: var(--s3); }
.chart { position: relative; min-height: 240px; }
.chart svg { width: 100%; height: 240px; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .tick { fill: var(--ink-3); font: 11px var(--f-mono); font-variant-numeric: tabular-nums; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover, .chart .hit.on { fill: var(--surface-2); }
.chart .empty-day { fill: var(--surface-3); }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--ink-3); font-size: .9rem; padding: 20px; }
.tooltip { position: fixed; z-index: 60; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 10px 12px; font-size: .82rem; min-width: 170px; display: grid; gap: 4px; }
.tooltip b { font-weight: 600; margin-bottom: 2px; }
.tooltip .row { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.tooltip .row .v { margin-left: auto; color: var(--ink); font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.tooltip .row.total { border-top: 1px solid var(--line); padding-top: 4px; margin-top: 2px; color: var(--ink); font-weight: 600; }

/* leaderboard */
.leader { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.leader li { display: grid; grid-template-columns: 22px 32px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.leader li:hover { background: var(--surface-2); }
.leader .rank { font-family: var(--f-mono); font-size: .8rem; color: var(--ink-3); text-align: center; }
.leader .who { min-width: 0; display: grid; gap: 4px; }
.leader .who b { font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter { height: 5px; border-radius: 3px; background: var(--accent-soft); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.leader .score { font-weight: 600; font-size: .95rem; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: .78rem; color: var(--ink); background: var(--surface-3); flex-shrink: 0; }
.avatar.lg { width: 44px; height: 44px; font-size: .95rem; }

/* platform cards */
.platforms { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.plat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; display: grid; gap: 10px; box-shadow: var(--shadow-sm); min-width: 0; }
.plat-card .top { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9rem; }
.plat-card .big { font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em; }
.plat-card .stats { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .8rem; color: var(--ink-3); }
.plat-card .stats b { color: var(--ink-2); font-weight: 600; }

/* ---------- posts ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.search { position: relative; display: flex; align-items: center; flex: 1 1 260px; min-width: 0; max-width: 380px; }
.search svg { position: absolute; left: 11px; width: 16px; height: 16px; color: var(--ink-3); pointer-events: none; }
.search input { padding-left: 34px; padding-right: 36px; }
.search kbd { position: absolute; right: 9px; font: 11px var(--f-mono); color: var(--ink-3); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 6px; background: var(--surface-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font-weight: 500; font-size: .86rem; cursor: pointer; }
.chip:hover { color: var(--ink); background: var(--surface-2); }
.chip.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.selects { display: flex; gap: 8px; margin-left: auto; }
.selects select { width: auto; height: 34px; font-size: .86rem; }

.post-head, .post { display: grid; grid-template-columns: minmax(0, 2.6fr) repeat(4, minmax(56px, .55fr)) 88px minmax(70px, .6fr) 92px 28px; align-items: center; gap: 12px; padding: 0 20px; }
.post-head { height: 40px; border-bottom: 1px solid var(--line); background: var(--surface-2); font-size: .72rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.post-head .r, .post .r { text-align: right; }
.post { min-height: 68px; padding-block: 12px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .12s; }
.post:last-child { border-bottom: 0; }
.post:hover { background: var(--surface-2); }
.post .main { display: grid; gap: 4px; min-width: 0; }
.post .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: .78rem; color: var(--ink-3); }
.post .stat { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-size: .9rem; }
.post .stat small { display: none; }
.post .total { display: grid; justify-items: end; gap: 2px; }
.post .total b { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-weight: 600; }
.gain { font-size: .74rem; font-weight: 600; color: var(--good); }
.gain.neg { color: var(--low); }
.post .chev { color: var(--ink-3); justify-self: end; }
.post .chev svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.plat { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: 500; }
.tag { display: inline-flex; align-items: center; font-size: .66rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; padding: 1px 6px; border-radius: 5px; background: var(--surface-3); color: var(--ink-2); }
.spark { width: 88px; height: 28px; overflow: visible; }
.spark .line { fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.spark .area { fill: var(--ink-3); opacity: .1; }
.spark .end { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.spark-none { font-size: .75rem; color: var(--ink-3); }
.pill { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 76px; padding: 4px 10px; border-radius: 999px; font-weight: 600; font-size: .82rem; font-family: var(--f-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pill.good { color: var(--good); background: var(--good-bg); }
.pill.mid { color: var(--mid); background: var(--mid-bg); }
.pill.low { color: var(--low); background: var(--low-bg); }
.pill.wait { color: var(--ink-2); background: var(--surface-2); font-family: var(--f-sans); font-weight: 500; }
.empty { padding: 44px 20px; text-align: center; color: var(--ink-2); display: grid; gap: 6px; justify-items: center; }
.empty b { color: var(--ink); font-weight: 600; }
.empty .btn { margin-top: 8px; }

/* tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 640px; font-size: .9rem; }
.table th, .table td { text-align: left; padding: 11px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .72rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.table .r { text-align: right; }
.table td.num, .table td .num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.table .t { font-weight: 600; display: block; max-width: 36ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .s { font-size: .78rem; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 2px; align-items: center; }
.table a { color: inherit; text-decoration: none; }
.table a:hover .t { text-decoration: underline; }

/* ---------- daily ---------- */
.grid-daily { display: grid; grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); gap: 20px; align-items: start; }
.day-list { display: grid; max-height: 640px; overflow-y: auto; }
.day { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 14px 18px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; cursor: pointer; color: var(--ink); }
.day:last-child { border-bottom: 0; }
.day:hover { background: var(--surface-2); }
.day[aria-selected="true"] { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.day .d { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.day .n { font-family: var(--f-mono); font-weight: 600; font-variant-numeric: tabular-nums; }
.day .sub { font-size: .78rem; color: var(--ink-3); }
.day .meter { grid-column: 1 / -1; margin-top: 4px; }
.day-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border-block: 1px solid var(--line); }
.day-kpis div { background: var(--surface); padding: 14px 20px; display: grid; gap: 2px; }
.day-kpis span { font-size: .78rem; color: var(--ink-3); }
.day-kpis b { font-size: 1.25rem; font-weight: 600; }

/* ---------- team ---------- */
.members { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.member { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; display: grid; gap: 14px; box-shadow: var(--shadow-sm); min-width: 0; align-content: start; }
.member .top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.member .top div { min-width: 0; display: grid; }
.member .top b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member .top span { font-size: .8rem; color: var(--ink-3); }
.member .top .btn { margin-left: auto; }
.member .figs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.member .figs div { display: grid; background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.member .figs b { font-weight: 600; font-size: 1.05rem; }
.member .figs span { font-size: .74rem; color: var(--ink-3); }
.auds { display: grid; gap: 6px; }
.aud { display: flex; align-items: center; gap: 8px; font-size: .86rem; color: var(--ink-2); }
.aud .v { margin-left: auto; font-family: var(--f-mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.aud a { color: inherit; }
.aud.missing .v { color: var(--ink-3); font-family: var(--f-sans); }
.how { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.how div { display: grid; gap: 4px; align-content: start; padding-left: 12px; border-left: 2px solid var(--accent-soft); }
.how b { font-weight: 600; font-size: .92rem; }
.how p { font-size: .86rem; color: var(--ink-2); }

/* ---------- drawer ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; }
@keyframes fade { from { opacity: 0; } }
.drawer { position: fixed; z-index: 50; top: 0; right: 0; bottom: 0; width: min(480px, 100%); background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .25s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes slide { from { transform: translateX(32px); } }
.drawer-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 22px 16px; border-bottom: 1px solid var(--line); padding-top: calc(20px + env(safe-area-inset-top, 0px)); }
.drawer-head div { min-width: 0; flex: 1; display: grid; gap: 4px; }
.drawer-head h2 { font-size: 1.15rem; overflow-wrap: anywhere; }
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; }
.drawer-body > * { flex-shrink: 0; }
.drawer-foot { display: flex; align-items: center; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
.drawer-foot .right { margin-left: auto; display: flex; gap: 8px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.detected { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--ink-2); min-height: 1.2em; }
.section-label { font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-top: 4px; }
.history { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.history .table { min-width: 0; font-size: .84rem; }
.history .table th, .history .table td { padding: 8px 12px; }
.detail-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.detail-stats div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; display: grid; }
.detail-stats span { font-size: .74rem; color: var(--ink-3); }
.detail-stats b { font-weight: 600; font-size: 1.1rem; }

/* ---------- toasts & fab ---------- */
.toasts { position: fixed; z-index: 70; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; width: min(420px, calc(100% - 32px)); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: .9rem; font-weight: 500; animation: toast .25s ease both; }
.toast.err { background: var(--low); color: #fff; }
.toast i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.toast.err i { background: #fff; }
@keyframes toast { from { transform: translateY(10px); } }
.fab { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .post-head { display: none; }
  .post { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main score" "stats total"; row-gap: 10px; }
  .post .main { grid-area: main; }
  .post .pillcell { grid-area: score; justify-self: end; }
  .post .statrow { grid-area: stats; }
  .post .total { grid-area: total; }
  .post .sparkcell, .post .chev { display: none; }
}
@media (min-width: 1081px) { .post .statrow { display: contents; } }
@media (max-width: 1080px) {
  .post .statrow { display: flex; flex-wrap: wrap; gap: 4px 16px; }
  .post .stat { font-size: .82rem; text-align: left; }
  .post .stat small { display: inline; color: var(--ink-3); font-family: var(--f-sans); margin-left: 4px; }
}
@media (max-width: 860px) {
  .topbar-in { height: auto; flex-wrap: wrap; row-gap: 0; padding-block: 10px 0; }
  .tabs { order: 3; width: 100%; background: none; padding: 0; margin-top: 8px; overflow-x: auto; border-radius: 0; gap: 0; }
  .tabs a { border-radius: 0; padding: 10px 14px; border-bottom: 2px solid transparent; }
  .tabs a[aria-current="page"] { background: none; box-shadow: none; border-bottom-color: var(--accent); }
  .add-btn { display: none; }
  .toasts { bottom: calc(90px + env(safe-area-inset-bottom, 0px)); }
  .fab { display: grid; place-items: center; position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); width: 56px; height: 56px; border-radius: 18px; border: 0; background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-lg); z-index: 25; cursor: pointer; }
  .fab svg { width: 24px; height: 24px; }
  .grid-daily { grid-template-columns: minmax(0, 1fr); }
  .day-list { max-height: 300px; }
  .platforms { grid-template-columns: minmax(0, 1fr); }
  .selects { margin-left: 0; width: 100%; }
  .selects select { flex: 1; }
  .search { max-width: none; flex-basis: 100%; }
  .search kbd { display: none; }
}
@media (max-width: 560px) {
  .page { padding-inline: 16px; padding-block: 20px 96px; }
  .topbar-in { padding-inline: 16px; }
  .sync span { display: none; }
  .brand-text small { display: none; }
  .kpi.hero, .kpi:last-child { grid-column: 1 / -1; }
  .kpi .value { font-size: 1.5rem; }
  .kpi.hero .value { font-size: 2.4rem; }
  .post { padding-inline: 16px; }
  .day-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4, .detail-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .drawer { top: auto; width: 100%; max-height: 92vh; max-height: 92dvh; border-left: 0; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; animation-name: sheet; }
  .drawer-head { padding-top: 20px; }
  @keyframes sheet { from { transform: translateY(40px); } }
  .panel-head.pad { padding-inline: 16px; }
  .table th, .table td { padding-inline: 16px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* drawer form wiring */
.drawer-form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.drawer-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 2px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.day .n.gain { font-size: inherit; }
@media (max-width: 560px) { .grid-3 { grid-template-columns: minmax(0, 1fr); } }
/* tighter data tables so the daily table fits beside the day list */
#day-table th, #day-table td { padding-inline: 12px; }
#day-table th:first-child, #day-table td:first-child { padding-left: 20px; }
#day-table .t { max-width: 26ch; }
#day-table th { white-space: nowrap; }
@media (max-width: 560px) { #day-table th:first-child, #day-table td:first-child { padding-left: 16px; } }
