/* ============================================================
   ProfitsFirst · Fanpage Tracker
   Design system: ProfitsFirst Content Intelligence
   (tokens taken from profitsfirst-dashboard.netlify.app)
   ============================================================ */

:root {
  color-scheme: light;   /* light only, by request: no dark mode */
  --plane:        #f6f6f8;
  --surface-1:    #ffffff;
  --surface-2:    #fbfbfd;
  --surface-glass: rgba(255, 255, 255, .72);
  --ink-1:        #0b0b0f;
  --ink-2:        #4b4b58;
  --ink-3:        #7a7a8a;
  --line:         rgba(11, 11, 15, .09);
  --line-strong:  rgba(11, 11, 15, .16);
  --grid:         #e7e7ec;
  --axis:         #c9c9d2;

  --accent:       #6d3ff0;
  --accent-2:     #4f46e5;
  --accent-ink:   #ffffff;
  --accent-wash:  rgba(109, 63, 240, .09);
  --focus:        #6d3ff0;

  --good:         #0f8a3d;
  --good-wash:    rgba(15, 138, 61, .09);
  --bad:          #d03b3b;
  --bad-wash:     rgba(208, 59, 59, .09);
  --warn:         #f5a623;

  /* Platforms */
  --p-youtube:    #e34948;
  --p-facebook:   #2a78d6;
  --p-instagram:  #e87ba4;

  /* Brands */
  --b-think:      #6d3ff0;
  --b-unfiltered: #f5a623;
  --b-learn:      #1baf7a;
  --b-fans:       #0ea5b7;
  --b-talks:      #475569;
  --b-pshorts:     #db2777;
  --b-motiv:       #ca8a04;
  --b-unplug:      #2563eb;
  --b-versus:      #65a30d;
  --b-unclips:     #b45309;
  --b-unpod:       #9f1239;
  --b-uninsight:   #4f46e5;

  --logo-tile:    #102040;
  --scrim:        rgba(11, 11, 15, .32);

  --radius:       16px;
  --shadow-card:  0 1px 2px rgba(11, 11, 15, .04), 0 8px 24px rgba(11, 11, 15, .06);
  --shadow-pop:   0 8px 40px rgba(11, 11, 15, .14);

  --font: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --side-w: 248px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--plane); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--plane); color: var(--ink-1);
  font: 400 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
h1, h2, h3, h4, p { margin: 0; }
table { border-collapse: collapse; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.picon { display: block; flex: none; }
.bdot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.bdot.think { background: var(--b-think); }
.bdot.unfiltered { background: var(--b-unfiltered); }
.bdot.learn { background: var(--b-learn); }
.bdot.fans { background: var(--b-fans); }
.bdot.talks { background: var(--b-talks); }
.bdot.pshorts { background: var(--b-pshorts); }
.bdot.motiv { background: var(--b-motiv); }
.bdot.unplug { background: var(--b-unplug); }
.bdot.versus { background: var(--b-versus); }
.bdot.unclips { background: var(--b-unclips); }
.bdot.unpod { background: var(--b-unpod); }
.bdot.uninsight { background: var(--b-uninsight); }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }

.side {
  position: sticky; top: env(safe-area-inset-top, 0px); height: 100vh; z-index: 30;
  display: flex; flex-direction: column; padding: 14px 12px;
  background: var(--surface-glass); border-right: 1px solid var(--line);
  backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
}
.side-head { display: flex; align-items: center; gap: 10px; padding: 4px 6px 18px; }
.logo-tile {
  width: 32px; height: 32px; border-radius: 9px; background: var(--logo-tile); flex: none;
  display: grid; place-items: center; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}
.logo-tile img { width: 20px; height: auto; display: block; }
.brand-name { font-size: 14px; font-weight: 600; letter-spacing: -.3px; line-height: 1.2; }
.brand-sub { font-size: 11px; color: var(--ink-3); line-height: 1.3; }
.icon-btn.side-close { margin-left: auto; display: none; }

.side-nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border-radius: 10px;
  font-size: 13px; font-weight: 500; color: var(--ink-2); text-align: left;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.nav-item:hover { background: var(--surface-2); color: var(--ink-1); }
.nav-item[aria-current="true"] { background: var(--accent-wash); color: var(--ink-1); }
.nav-item svg.ui { color: var(--ink-3); flex: none; }
.nav-item[aria-current="true"] svg.ui { color: var(--accent); }
.nav-item .count { margin-left: auto; font-size: 11px; font-weight: 400; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.nav-label { margin: 18px 12px 6px; font-size: 10.5px; font-weight: 500; letter-spacing: .7px; text-transform: uppercase; color: var(--ink-3); }

.side-foot { display: flex; align-items: flex-start; gap: 8px; padding: 12px 10px 4px; font-size: 11px; color: var(--ink-3); line-height: 1.45; border-top: 1px solid var(--line); margin-top: 12px; }
.side-foot .pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); margin-top: 5px; flex: none; }

.main { min-width: 0; display: flex; flex-direction: column; }

/* ---------- Top bar ---------- */
.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 24px;
  background: var(--surface-glass); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
}
.icon-btn.menu-btn { display: none; }
.top-title { min-width: 0; }
.top-title h1 { font-size: 15px; font-weight: 600; letter-spacing: -.375px; line-height: 1.3; }
.top-title p { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 999px; display: grid; place-items: center; flex: none;
  border: 1px solid var(--line); background: var(--surface-1); color: var(--ink-2);
  transition: background .16s var(--ease), color .16s var(--ease), transform .16s var(--ease);
}
.icon-btn:hover { color: var(--ink-1); background: var(--surface-2); }
.accent-btn {
  width: 36px; height: 36px; border-radius: 999px; display: grid; place-items: center; flex: none;
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 4px 14px rgba(109, 63, 240, .32);
  transition: transform .16s var(--ease), box-shadow .16s var(--ease);
}
.accent-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(109, 63, 240, .4); }
.accent-btn:active { transform: none; }

.search { position: relative; display: block; }
.search input {
  width: 200px; height: 36px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-1);
  padding: 0 40px 0 34px; font-size: 13px; color: var(--ink-1);
  transition: width .3s var(--ease), border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus { outline: none; width: 240px; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.search > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font: 500 10.5px/1 var(--font); color: var(--ink-3); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; background: var(--surface-2);
}
.search input:focus + kbd, .search input:not(:placeholder-shown) + kbd { display: none; }

/* Segmented control (pill group) */
.seg {
  position: relative; display: inline-flex; align-items: center; gap: 2px; padding: 2px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); flex: none;
}
.seg .thumb {
  position: absolute; top: 2px; bottom: 2px; left: 0; width: 0; border-radius: 999px; background: var(--accent);
  box-shadow: 0 2px 8px rgba(109, 63, 240, .28);
  transition: transform .3s var(--ease), width .3s var(--ease);
}
.seg button {
  position: relative; z-index: 1; height: 30px; padding: 0 12px; border-radius: 999px;
  font-size: 12px; font-weight: 500; color: var(--ink-2); white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: color .16s var(--ease);
}
.seg button:hover { color: var(--ink-1); }
.seg button[aria-pressed="true"] { color: var(--accent-ink); }
.seg.icons button { width: 30px; padding: 0; }
.seg.sm button { height: 26px; padding: 0 11px; }

/* ---------- Content ---------- */
.content { padding: 24px; max-width: 1240px; width: 100%; display: flex; flex-direction: column; gap: 16px; }
.view { display: flex; flex-direction: column; gap: 16px; }

.card {
  position: relative; overflow: hidden; background: var(--surface-1);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-card);
}
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-title { font-size: 13px; font-weight: 600; letter-spacing: -.325px; }
.card-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.sec-title { font-size: 15px; font-weight: 600; letter-spacing: -.375px; margin-top: 8px; }

/* Active filters */
.filter-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); }
.fchip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px 0 10px; border-radius: 999px;
  background: var(--surface-1); border: 1px solid var(--line); color: var(--ink-1); font-size: 12px; font-weight: 500;
}
.fchip:hover { border-color: var(--line-strong); }
.fchip .x { color: var(--ink-3); font-size: 14px; line-height: 1; }
.linkish { color: var(--accent); font-weight: 500; font-size: 12px; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { padding: 20px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kpi-label { font-size: 12px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value { font-size: 30px; font-weight: 600; letter-spacing: -.75px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 11.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.chip {
  display: inline-flex; align-items: center; gap: 3px; height: 20px; padding: 0 7px; border-radius: 999px;
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.chip.up { background: var(--good-wash); color: var(--good); }
.chip.down { background: var(--bad-wash); color: var(--bad); }
.chip.flat { background: var(--surface-2); color: var(--ink-3); border: 1px solid var(--line); }
.up-t { color: var(--good); } .down-t { color: var(--bad); } .flat-t { color: var(--ink-3); }

/* Chart */
.chart-card { padding: 20px 20px 16px; }
.chart-tools { display: flex; align-items: center; gap: 8px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 16px 0 6px; font-size: 11.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.legend b { font-weight: 600; color: var(--ink-1); font-variant-numeric: tabular-nums; }
.plot { position: relative; height: 260px; }
.plot > svg { display: block; width: 100%; height: 100%; overflow: visible; }
.plot .gridline { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.plot .axis { fill: var(--ink-3); font-size: 10.5px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.plot .cross { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.plot .hdot { stroke: var(--surface-1); stroke-width: 2; }
.tip {
  position: absolute; top: 0; left: 0; z-index: 3; pointer-events: none; min-width: 180px;
  background: var(--surface-1); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-pop);
  padding: 10px 12px; font-size: 12px; opacity: 0; transition: opacity .16s var(--ease);
}
.tip.on { opacity: 1; }
.tip .t-date { color: var(--ink-3); font-size: 11px; margin-bottom: 6px; }
.tip .t-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.tip .t-row b { margin-left: auto; padding-left: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tip .t-total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; }
.caption { font-size: 11px; color: var(--ink-3); margin-top: 10px; display: flex; align-items: center; gap: 6px; }
.caption .pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); flex: none; }

/* Ranked list */
.rank { list-style: none; margin: 12px 0 0; padding: 0; }
.rank li + li { border-top: 1px solid var(--line); }
.rank button {
  width: 100%; display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 4px 12px; align-items: center;
  padding: 12px 4px; text-align: left; border-radius: 10px;
  transition: background .16s var(--ease);
}
.rank button:hover { background: var(--surface-2); }
.rank .n { font-size: 12px; font-weight: 600; color: var(--ink-3); text-align: center; font-variant-numeric: tabular-nums; }
.rank .t { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank .m { font-size: 11.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; margin-top: 2px; white-space: nowrap; overflow: hidden; }
.rank .r { text-align: right; }
.rank .g { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rank .s { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.rank .rbar { grid-column: 2 / 3; height: 3px; border-radius: 3px; background: var(--grid); overflow: hidden; }
.rank .rbar i { display: block; height: 100%; border-radius: inherit; transform-origin: left; }

/* Platform cards */
.plat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.plat { padding: 20px; text-align: left; display: flex; flex-direction: column; gap: 14px; width: 100%;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease); }
.plat:hover { transform: translateY(-2px); box-shadow: var(--shadow-pop); border-color: var(--line-strong); }
.plat.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash), var(--shadow-card); }
.plat-top { display: flex; align-items: center; gap: 12px; }
.icon-tile { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); flex: none; }
.plat-name { font-size: 14px; font-weight: 600; letter-spacing: -.2px; }
.plat-meta { font-size: 11.5px; color: var(--ink-3); }
.plat-top .go { margin-left: auto; color: var(--ink-3); align-self: flex-start; transition: transform .2s var(--ease), color .2s var(--ease); }
.plat:hover .go { color: var(--ink-1); transform: translate(1px, -1px); }
.plat-mid { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.plat-val { font-size: 28px; font-weight: 600; letter-spacing: -.7px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.plat-unit { font-size: 11.5px; color: var(--ink-3); }
.plat-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--ink-3); }
.plat-foot b { color: var(--ink-1); font-weight: 600; font-variant-numeric: tabular-nums; }
.spark { display: block; overflow: visible; flex: none; }

/* Brand cards */
.brand-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.brand-card { padding: 18px 16px 8px; }
.brand-head { display: flex; align-items: center; gap: 8px; padding: 0 4px; }
.brand-head .name { font-size: 13px; font-weight: 600; letter-spacing: -.2px; }
.brand-head .tot { margin-left: auto; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.share { margin: 10px 4px 6px; height: 4px; border-radius: 4px; background: var(--grid); overflow: hidden; }
.share i { display: block; height: 100%; border-radius: inherit; transform-origin: left; }
.share-l { padding: 0 4px; font-size: 11px; color: var(--ink-3); margin-bottom: 6px; }
.prow {
  width: 100%; display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 10px 4px; border-top: 1px solid var(--line); text-align: left; border-radius: 8px;
  transition: background .16s var(--ease), opacity .3s var(--ease);
}
.prow:hover { background: var(--surface-2); }
.prow .h { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow .v { text-align: right; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.prow .d { display: block; font-size: 10.5px; font-weight: 500; }
.prow.dim { opacity: .35; }

/* Table */
.table-card { overflow: hidden; }
.table-scroll { overflow-x: auto; }
.tbl { width: 100%; font-size: 13px; }
.tbl thead th {
  height: 40px; padding: 0 16px; text-align: left; font-size: 11px; font-weight: 500; color: var(--ink-3);
  background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl th.r, .tbl td.r { text-align: right; }
.tbl th button { display: inline-flex; align-items: center; gap: 4px; font-weight: 500; color: inherit; }
.tbl th button:hover, .tbl th[aria-sort] button { color: var(--ink-1); }
.tbl th .arr { font-size: 9px; opacity: 0; }
.tbl th[aria-sort] .arr { opacity: 1; }
.tbl th[aria-sort="ascending"] .arr { display: inline-block; transform: rotate(180deg); }
.tbl tbody tr { height: 56px; cursor: pointer; transition: background .16s var(--ease); }
.tbl tbody tr + tr td { border-top: 1px solid var(--line); }
.tbl tbody tr:hover, .tbl tbody tr:focus-visible { background: var(--surface-2); outline: none; }
.tbl tbody tr:focus-visible td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
.tbl td { padding: 0 16px; white-space: nowrap; color: var(--ink-2); }
.tbl td .num, .tbl td.num { color: var(--ink-1); font-weight: 600; font-variant-numeric: tabular-nums; }
.pg { display: flex; align-items: center; gap: 12px; }
.pg .n { font-weight: 500; color: var(--ink-1); line-height: 1.3; }
.pg .h { font-size: 11.5px; color: var(--ink-3); line-height: 1.3; }
.tag { display: inline-flex; align-items: center; gap: 7px; }
.ext { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: var(--ink-3); }
.ext:hover { background: var(--surface-2); color: var(--ink-1); }
.table-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--ink-3); }
.empty { padding: 28px 16px; text-align: center; color: var(--ink-3); font-size: 13px; }

.foot { font-size: 11px; color: var(--ink-3); padding: 8px 0 16px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: space-between; }

/* ---------- Drawer ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: var(--scrim); opacity: 0; transition: opacity .3s var(--ease); }
.scrim.on { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 41; width: min(440px, 100%);
  background: var(--surface-1); border-left: 1px solid var(--line); box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column; transform: translateX(100%); transition: transform .3s var(--ease);
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}
.drawer.on { transform: none; }
.dr-head { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; }
.dr-head .icon-tile { width: 44px; height: 44px; }
.dr-title { font-size: 16px; font-weight: 600; letter-spacing: -.3px; line-height: 1.3; }
.dr-handle { font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.dr-head .icon-btn { margin-left: auto; width: 32px; height: 32px; }
.dr-body { overflow-y: auto; flex: 1; padding: 4px 20px 24px; }
.dr-sec { padding: 18px 0; border-bottom: 1px solid var(--line); }
.dr-sec:last-child { border-bottom: 0; }
.dr-sec h4 { font-size: 11px; font-weight: 500; letter-spacing: .6px; text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px; }
.dr-big { font-size: 32px; font-weight: 600; letter-spacing: -.8px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.dr-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.dr-3 div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.dr-3 span { display: block; font-size: 11px; color: var(--ink-3); }
.dr-3 b { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dr-hist svg { width: 100%; height: 110px; display: block; overflow: visible; }
.dr-hist .lbl { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-3); margin-top: 6px; font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px 12px; font-size: 12.5px; margin: 0; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.ms { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 8px; }
.meter { height: 6px; border-radius: 6px; background: var(--grid); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.open-btn {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; height: 34px; padding: 0 14px; border-radius: 999px;
  background: var(--ink-1); color: var(--plane); font-size: 12.5px; font-weight: 500;
}
.open-btn:hover { opacity: .88; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 60;
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  background: var(--ink-1); color: var(--plane); font-size: 13px; font-weight: 500;
  padding: 9px 16px; border-radius: 999px; box-shadow: var(--shadow-pop);
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.anim .rise { animation: rise .55s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 45ms); }
.anim .grow { animation: grow .7s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 45ms + 150ms); }
.plot .series-g.wipe { animation: wipe .9s var(--ease) both; }
.spark.wipe { animation: wipe .8s var(--ease) both .15s; }
.drawer.on .dr-sec { animation: rise .35s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 40ms + 60ms); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 1ms !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  .brand-grid { grid-template-columns: 1fr; }
  .search input { width: 160px; }
  .search input:focus { width: 200px; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed; top: 0; left: 0; bottom: 0; height: auto; width: min(280px, 86vw);
    background: var(--surface-1); transform: translateX(-100%); transition: transform .3s var(--ease);
    box-shadow: var(--shadow-pop); padding-top: calc(14px + env(safe-area-inset-top, 0px));
  }
  .side.open { transform: none; }
  .icon-btn.side-close { display: grid; }
  .icon-btn.menu-btn { display: grid; }
  .plat-grid { grid-template-columns: 1fr; }
  .top { padding: 0 16px; }
  .content { padding: 16px; }
  .tbl .hide-md { display: none; }
}
@media (max-width: 640px) {
  .top { height: auto; min-height: 60px; flex-wrap: wrap; padding: 10px 16px; row-gap: 10px; }
  .top-tools { width: 100%; margin-left: 0; }
  .search { flex: 1; min-width: 0; }
  .search input, .search input:focus { width: 100%; }
  .search kbd { display: none; }
  .kpis { gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 24px; }
  .plot { height: 210px; }
  .tbl thead { display: none; }
  .tbl, .tbl tbody { display: block; }
  .tbl tbody tr { display: grid; grid-template-columns: 1fr auto; align-items: center; height: auto; padding: 12px 14px; gap: 2px 10px; }
  .tbl tbody tr + tr td { border-top: 0; }
  .tbl tbody tr + tr { border-top: 1px solid var(--line); }
  .tbl td { padding: 0; }
  .tbl td.hide-sm { display: none; }
  .tbl td.c-page { grid-row: 1 / span 2; }
}
