/* Reddstrat design system — vision-v2 redesign (signed-off prototype reddstrat-vision-v2.html).
   Violet accent, darkened violet-tinted greys (≥ ~rgb(78,75,97)), Figtree + JetBrains Mono,
   12px font floor, card-based surfaces. Old token aliases are kept so the per-tab inline CSS
   adopts the palette with no class renames. */
:root {
  /* ── Primary violet ── */
  --v:       #5509F8;
  --v-h:     #4406D6;            /* hover (darker) */
  --v04:     rgba(85,9,248,.04);
  --v08:     rgba(85,9,248,.08);
  --v14:     rgba(85,9,248,.14);
  --v22:     rgba(85,9,248,.22);
  --vtint:   #F0EBFF;           /* violet-50 active-state wash */

  /* ── Semantic accent palette (prototype values) ── */
  --amber:   #E8A317;  --amber-s: #FCF3E0;  --amber-m: rgba(232,163,23,.22);  --amber-d: #9A6B05;
  --mint:    #16A34A;  --mint-s:  #E9F7EE;  --mint-m:  rgba(22,163,74,.20);    --mint-d:  #0E7A37;
  --coral:   #E5484D;  --coral-s: #FDECEC;  --coral-m: rgba(229,72,77,.20);    --coral-d: #C62A2F;
  --sky:     #0369A1;  --sky-s:   #E0F2FE;  --sky-m:   rgba(3,105,161,.16);
  --lilac:   #7C3AED;  --lilac-s: #F0EBFF;  --lilac-m: rgba(124,58,237,.16);
  --magenta: #F50FAF;  --magenta-s:#FFEAF7;

  /* ── Neutrals & surfaces ── */
  --bg:      #F8F7FC;            /* page background */
  --surface: #FFFFFF;           /* cards / sidebar */
  --s2:      #F3F1F8;            /* secondary surface, hover tint, inner dividers */
  --inp:     #FAFAFE;           /* form input background */

  /* ── Text hierarchy (darkened, violet-tinted; lightest ≈ rgb(78,75,97)) ── */
  --t1:      #12101A;
  --t2:      #423F52;
  --t3:      #4E4B61;

  /* ── Borders ── */
  --br:      #E7E4EE;
  --br2:     #DDD8E8;

  /* ── Shadows ── */
  --shsm:    0 1px 2px rgba(18,16,26,.04), 0 1px 3px rgba(18,16,26,.06);
  --shmd:    0 4px 16px rgba(18,16,26,.08);
  --shlg:    0 16px 56px rgba(18,16,26,.14);
  --shv:     0 8px 28px rgba(85,9,248,.20);    /* violet glow */

  /* ── Layout constants ── */
  --sb-w:    236px;
  /* minimal dropdown chevron (stroke = --t3), reused by every <select> */
  --chev:    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234E4B61' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");

  /* ── Back-compat aliases: old token names → new palette ── */
  --text:    var(--t1);
  --text-2:  var(--t2);
  --text-3:  var(--t3);
  --border:  var(--br);
  --brand:   var(--v);
  --accent:  var(--v);
  --pos:     var(--mint);
  --neg:     var(--coral);
  --neu:     var(--t3);
  --green:   var(--mint);
  --red:     var(--coral);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 14px/1.5 "Figtree", -apple-system, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono, .tnum { font-family: "JetBrains Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }

/* global violet focus ring */
input:focus, select:focus, textarea:focus { border-color: var(--v); box-shadow: 0 0 0 3px var(--v08); outline: none; }

/* ── form controls & buttons ── */
select, input:not([type]), input[type=text], input[type=search], input[type=number],
input[type=url], input[type=email], input[type=password], textarea {
  font-family: inherit; font-size: 13px; color: var(--t1); background-color: var(--inp);
  border: 1px solid var(--br2); border-radius: 10px; padding: 8px 11px;
  transition: border-color .15s, box-shadow .15s;
}
input:hover:not(:focus), textarea:hover:not(:focus), select:hover:not(:focus) { border-color: var(--t3); }
select {
  -webkit-appearance: none; appearance: none; cursor: pointer; padding-right: 30px;
  background-image: var(--chev); background-repeat: no-repeat; background-position: right 10px center; background-size: 11px;
}
button { font-family: inherit; cursor: pointer; }
.btn, .btn-p, .btn-g, .btn-new {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-family: inherit; font-size: 13px;
  font-weight: 600; letter-spacing: .005em; border-radius: 10px; padding: 8px 15px; border: 0; cursor: pointer;
  transition: background .15s, box-shadow .15s, border-color .15s, color .15s, transform .12s cubic-bezier(.2,.7,.3,1);
}
.btn-p { background: var(--v); color: #fff; box-shadow: 0 1px 2px rgba(85,9,248,.18); }
.btn-p:hover { background: var(--v-h); box-shadow: 0 6px 18px rgba(85,9,248,.30); transform: translateY(-1px); }
.btn-p:active { transform: translateY(0); box-shadow: 0 1px 2px rgba(85,9,248,.18); }
.btn-g { background: var(--surface); border: 1px solid var(--br2); color: var(--t2); }
.btn-g:hover { border-color: var(--t3); color: var(--t1); background: var(--s2); }
.btn-new { background: var(--v08); border: 1px solid var(--v14); color: var(--v); }
.btn-new:hover { background: var(--v); color: #fff; box-shadow: 0 6px 18px rgba(85,9,248,.30); }
button[type=submit]:not(.signout) {
  background: var(--v); color: #fff; border: 0; padding: 9px 16px; border-radius: 10px;
  font-size: 13px; font-weight: 600; letter-spacing: .005em; box-shadow: 0 1px 2px rgba(85,9,248,.18);
  transition: background .15s, box-shadow .15s, transform .12s cubic-bezier(.2,.7,.3,1);
}
button[type=submit]:not(.signout):hover { background: var(--v-h); box-shadow: 0 6px 18px rgba(85,9,248,.30); transform: translateY(-1px); }
button[type=submit]:not(.signout):active { transform: translateY(0); box-shadow: 0 1px 2px rgba(85,9,248,.18); }

/* ════════ shell: sidebar + header ════════ */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sb-w); flex: 0 0 var(--sb-w); background: var(--surface); color: var(--t2);
  border-right: 1px solid var(--br); position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
}
.brandrow { padding: 18px 18px 14px; display: flex; align-items: center; gap: 9px; }
.brandrow .rchip { width: 26px; height: 26px; border-radius: 7px; background: var(--v); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; flex: none; }
.brandrow .wm { font-size: 17px; font-weight: 700; letter-spacing: -.02em; color: var(--t1); }

.nav { flex: 1; overflow-y: auto; padding: 4px 12px; display: flex; flex-direction: column; gap: 2px; }
.navgrouplabel { font-size: 12px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--t3); padding: 10px 10px 6px; }
/* nested tree: a trunk drops from each group label, branching to its items */
.navitems { display: flex; flex-direction: column; gap: 2px; position: relative; padding-left: 13px; }
.navgroup.nogroup .navitems { padding-left: 0; }
.navgroup:not(.nogroup) .navitems::before {
  content: ''; position: absolute; left: 4px; top: -4px; bottom: 18px; width: 2px;
  background: var(--br2); border-radius: 2px;
}
.navgroup:not(.nogroup) .navitems > a::after {
  content: ''; position: absolute; left: -9px; top: 50%; width: 9px; height: 2px;
  background: var(--br2); border-radius: 2px; transform: translateY(-50%);
}
.navgroup:not(.nogroup) .navitems > a:hover::after { background: var(--t3); }
.navgroup:not(.nogroup) .navitems > a.active::after { background: var(--v); }
.nav a {
  position: relative; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px;
  border-radius: 9px; color: var(--t2); font-size: 13.5px; font-weight: 500; text-decoration: none;
}
.nav a svg { width: 17px; height: 17px; flex: none; color: var(--t3); }
.nav a:hover { background: var(--s2); color: var(--t1); text-decoration: none; }
.nav a.active { background: var(--vtint); color: var(--v); font-weight: 600; }
.nav a.active svg { color: var(--v); }
/* Home (ungrouped) keeps the violet left-bar; grouped items use the tree branch instead */
.navgroup.nogroup a.active::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 3px; background: var(--v); }
.nav a .soon { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--t3); background: var(--s2);
  border-radius: 5px; padding: 1px 6px; }
.nav a .navbadge { margin-left: auto; font-family: "JetBrains Mono", monospace; font-size: 12px; font-weight: 600;
  color: var(--magenta); background: var(--magenta-s); border-radius: 6px; padding: 1px 6px; }

.livemon { margin: 0 12px 10px; padding: 11px 13px; border: 1px solid var(--br); border-radius: 12px;
  background: var(--bg); display: flex; align-items: center; gap: 9px; }
.livemon .pulse { width: 8px; height: 8px; border-radius: 8px; background: var(--mint);
  box-shadow: 0 0 0 3px var(--mint-s); flex: none; }
.livemon .t { font-size: 12px; font-weight: 600; color: var(--t2); }
.livemon .s { font-size: 12px; color: var(--t3); }

.userblock { border-top: 1px solid var(--br); padding: 11px 16px; display: flex; align-items: center; gap: 10px; }
.userblock .avatar { width: 28px; height: 28px; flex: none; border-radius: 999px; background: var(--t1); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.userblock .uname { font-size: 13px; font-weight: 600; color: var(--t1); line-height: 1.25; }
.userblock .urole { font-size: 12px; color: var(--t3); }
.userblock .gear { flex: none; color: var(--t3); text-decoration: none; position: relative; padding: 4px;
  border-radius: 6px; line-height: 0; display: inline-flex; }
.userblock .gear:hover { color: var(--v); background: var(--vtint); }
.userblock .gear svg { width: 16px; height: 16px; }
.userblock .gearbadge { position: absolute; top: -4px; right: -4px; min-width: 15px; height: 15px; box-sizing: border-box;
  font-family: "JetBrains Mono", monospace; font-size: 12px; font-weight: 700; line-height: 13px; text-align: center;
  background: var(--amber); color: #fff; border-radius: 8px; padding: 0 3px; }
.sb-foot { padding: 0 16px 12px; }
.sb-foot .signout-form { margin: 0; padding: 0; }
.sb-foot .signout { background: none; font-family: inherit; cursor: pointer; font-size: 12px; font-weight: 500;
  color: var(--t3); border: 1px solid var(--br2); border-radius: 8px; padding: 5px 10px; box-shadow: none; transform: none; }
.sb-foot .signout:hover { color: var(--coral); border-color: var(--coral); background: none; box-shadow: none; transform: none; }
.sb-foot .signout:active { background: none; box-shadow: none; transform: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.header {
  height: 56px; flex: 0 0 56px; background: var(--surface); border-bottom: 1px solid var(--br);
  display: flex; align-items: center; gap: 12px; padding: 0 20px; position: sticky; top: 0; z-index: 5;
}
.header .brandswitch {
  font-weight: 600; font-size: 13px; color: var(--t1);
  border: 1px solid var(--br2); border-radius: 10px; padding: 7px 30px 7px 12px;
  background-color: var(--surface); background-image: var(--chev); background-repeat: no-repeat;
  background-position: right 10px center; background-size: 11px;
  -webkit-appearance: none; appearance: none; cursor: pointer; transition: border-color .18s, box-shadow .18s;
}
.header .spacer { flex: 1; }
.header .hchip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px;
  border: 1px solid var(--br2); border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--t2); }
.bell { color: var(--t3); position: relative; padding: 4px; display: inline-flex; cursor: pointer; }
.bell svg { width: 18px; height: 18px; display: block; }
.bell:hover { color: var(--v); }
.bell .belldot { position: absolute; top: 2px; right: 2px; width: 7px; height: 7px; border-radius: 7px; background: var(--magenta); border: 2px solid var(--surface); }

/* sidebar active-brand switcher pill (mirrors the prototype) */
.sb-brand { margin: 0 12px 8px; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 8px;
  border: 1px solid var(--br2); border-radius: 10px; background: var(--bg); }
.sb-brand .sb-fav { width: 22px; height: 22px; border-radius: 6px; color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex: none; }
.sb-brand .sb-brand-sel { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 13px; font-weight: 600;
  color: var(--t1); padding: 0; cursor: pointer; -webkit-appearance: none; appearance: none; box-shadow: none; }
.sb-brand .sb-brand-sel:focus { box-shadow: none; outline: none; }
.sb-brand .sb-brand-n { font-family: "JetBrains Mono", monospace; font-size: 12px; font-weight: 600; color: var(--t3);
  background: var(--s2); border-radius: 5px; padding: 1px 6px; flex: none; }
.sb-brand .sb-chev { color: var(--t3); flex: none; }
/* the brand switcher uses the custom dropdown: fill the pill, no inner border/divider */
.sb-brand .rsel-btn { flex: 1; min-width: 0; border: 0; background: transparent; padding: 0; border-radius: 0; font-size: 13px; font-weight: 600; color: var(--t1); }
.sb-brand .rsel-btn:hover { border: 0; }
.sb-brand .rsel-btn.open { box-shadow: none; }
.sb-brand .rsel-chev { color: var(--t3); }

.content { padding: 28px clamp(20px, 2vw, 36px); flex: 1; min-width: 0; }

/* ════════ page title block ════════ */
.eyebrow { font-size: 12px; text-transform: uppercase; font-weight: 700; letter-spacing: .08em; color: var(--v);
  display: flex; align-items: center; gap: 8px; }
.eyebrow::before { content: ''; width: 22px; height: 2px; border-radius: 2px; background: var(--v); }
.pagetitle { font-size: 22px; font-weight: 600; letter-spacing: -.02em; margin: 8px 0 2px; color: var(--t1); display: flex; align-items: center; }
.pagesub { font-size: 13px; color: var(--t2); margin: 0 0 16px; }
/* help tooltip beside each page title — short hover/focus explainer */
.helptip { display: inline-flex; align-items: center; justify-content: center; width: 19px; height: 19px; border-radius: 50%;
  border: 1px solid var(--br2); background: var(--surface); color: var(--t3); font-size: 11px; font-weight: 700; line-height: 1;
  cursor: help; margin-left: 9px; position: relative; user-select: none; flex: none; transition: color .15s, border-color .15s, background .15s; }
.helptip:hover, .helptip:focus { color: #fff; background: var(--v); border-color: var(--v); outline: none; }
.helptip .tip { position: absolute; top: calc(100% + 9px); left: -6px; width: max-content; max-width: 280px;
  background: var(--t1); color: #fff; font-size: 12px; font-weight: 400; line-height: 1.45; letter-spacing: 0; text-transform: none;
  padding: 8px 11px; border-radius: 9px; box-shadow: var(--shmd); opacity: 0; visibility: hidden; transform: translateY(-3px);
  transition: opacity .15s, transform .15s; z-index: 60; text-align: left; pointer-events: none; white-space: normal; }
.helptip:hover .tip, .helptip:focus .tip { opacity: 1; visibility: visible; transform: translateY(0); }
.helptip .tip::before { content: ''; position: absolute; bottom: 100%; left: 9px; border: 5px solid transparent; border-bottom-color: var(--t1); }
/* tooltip variants: mini chip (inline beside small labels), wide bubble (legends),
   open-left (right-aligned spots), open-up (near the page bottom) */
.helptip.mini { width: 15px; height: 15px; font-size: 10px; margin-left: 5px; vertical-align: middle; }
.helptip.wide .tip { max-width: 340px; }
.helptip.tipl .tip { left: auto; right: -6px; }
.helptip.tipl .tip::before { left: auto; right: 9px; }
.helptip.tipu .tip { top: auto; bottom: calc(100% + 9px); transform: translateY(3px); }
.helptip.tipu .tip::before { bottom: auto; top: 100%; border-bottom-color: transparent; border-top-color: var(--t1); }
/* pinned to a card's top-right corner (card must be position:relative) */
.helptip.corner { position: absolute; top: 11px; right: 13px; margin: 0; z-index: 3; }

/* in-page sub-tab strip (Brand Mentions lanes; Act To-Do/Done/Declined) */
.subtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--br); margin: 10px 0 16px; flex-wrap: wrap; }
.subtabs a { padding: 9px 14px; font-size: 13.5px; font-weight: 500; color: var(--t2); border-bottom: 2px solid transparent; text-decoration: none; margin-bottom: -1px; }
.subtabs a.active { color: var(--v); border-bottom-color: var(--v); font-weight: 600; }
.subtabs a:hover { color: var(--t1); text-decoration: none; }

/* section header inside a card */
.secthead { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.secthead .h { font-size: 16px; font-weight: 600; color: var(--t1); }
.secthead .sub { font-size: 13px; color: var(--t2); margin-top: 2px; }

/* ════════ cards ════════ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px; box-shadow: var(--shsm); }
.card-title { font-size: 14px; font-weight: 600; margin: 0 0 12px; }
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* KPI card with optional sparkline (Signal Brief / Sentiment) */
.kpicard { background: var(--surface); border: 1px solid var(--br); border-radius: 14px; padding: 16px; box-shadow: var(--shsm); }
.kpicard .klabel { font-size: 12px; color: var(--t2); font-weight: 500; }
.kpicard .krow { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: 8px; }
.kpicard .kval { font-family: "JetBrains Mono", monospace; font-variant-numeric: tabular-nums; font-size: 24px;
  font-weight: 600; line-height: 1; letter-spacing: -.02em; color: var(--t1); }
.kpicard .ksub { font-size: 12px; color: var(--t3); margin-top: 7px; }
.kpi .label { font-size: 12px; color: var(--text-3); }
.kpi .val { font-family: "JetBrains Mono", monospace; font-variant-numeric: tabular-nums; font-size: 26px;
  font-weight: 600; letter-spacing: -.02em; margin-top: 4px; }
.spark { width: 78px; height: 30px; flex: none; }

/* delta + net chip */
.delta { font-family: "JetBrains Mono", monospace; font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 600; }
.delta.up { color: var(--mint-d); }
.delta.down { color: var(--coral-d); }
.delta.flat { color: var(--t3); }
.netchip { font-family: "JetBrains Mono", monospace; font-variant-numeric: tabular-nums; display: inline-flex;
  align-items: center; height: 20px; padding: 0 7px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.netchip.pos { background: var(--mint-s); color: var(--mint-d); }
.netchip.neg { background: var(--coral-s); color: var(--coral-d); }
.netchip.neu { background: var(--s2); color: var(--t2); }

/* ════════ compact pill filters [boss #5] ════════ */
.pillbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--surface);
  border: 1px solid var(--br); border-radius: 14px; padding: 9px; box-shadow: var(--shsm); }
.rs-pill { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px;
  border: 1px solid var(--br2); border-radius: 999px; background: var(--surface); cursor: pointer;
  font-size: 12.5px; font-weight: 600; color: var(--t1); transition: border-color .12s, background .12s; }
.rs-pill:hover { border-color: var(--t3); }
.rs-pill .lab { font-size: 12px; color: var(--t3); font-weight: 600; }
.rs-pill.active { border-color: var(--v); background: var(--vtint); color: var(--v); }
.rs-pill select { border: 0; background: transparent; padding: 0 17px 0 0; margin: 0; font: inherit; font-size: 12.5px;
  font-weight: 600; color: inherit; cursor: pointer; height: auto; box-shadow: none !important;
  background-image: var(--chev); background-repeat: no-repeat; background-position: right center; background-size: 11px; }
.rs-search { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px;
  border: 1px solid var(--br2); border-radius: 999px; background: var(--surface); flex: 1; min-width: 130px; }
.rs-search input { border: 0; outline: 0; background: transparent; flex: 1; font-size: 13px; color: var(--t1); padding: 0; }
.rs-search input:focus { box-shadow: none; }
.clearf { font-size: 12.5px; font-weight: 600; color: var(--v); cursor: pointer; padding: 0 4px; }
/* sort-direction toggle (asc/desc) beside the Sort pill's select */
.sortdir { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0;
  border: 1px solid var(--br2); border-radius: 6px; background: var(--surface); color: var(--t2); cursor: pointer;
  transition: border-color .12s, color .12s; }
.sortdir:hover { border-color: var(--v); color: var(--v); }
.sortdir svg { transition: transform .15s; }
.sortdir.up svg { transform: rotate(180deg); }

/* card/list view switcher [boss #3] */
.viewsw { display: inline-flex; height: 32px; border: 1px solid var(--br2); border-radius: 999px; overflow: hidden; }
.viewsw a, .viewsw button { display: inline-flex; align-items: center; gap: 5px; padding: 0 11px; border: 0;
  background: transparent; font-size: 12.5px; font-weight: 600; color: var(--t2); text-decoration: none; cursor: pointer; }
.viewsw a.on, .viewsw button.on { background: var(--vtint); color: var(--v); }
.viewsw svg { width: 15px; height: 15px; }
/* result-count row: thread count on the left, icon-only view switch + export on the
   right (moved out of the filter bar so the filters stay on one line) */
.resbar { display: flex; align-items: center; gap: 8px; margin: 14px 2px 0; }
.iconbtn { height: 32px; min-width: 32px; padding: 0 9px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--br2); border-radius: 999px; background: var(--surface); color: var(--t2); cursor: pointer;
  transition: border-color .15s, color .15s, background .15s; }
.iconbtn:hover { border-color: var(--t3); color: var(--t1); background: var(--s2); }

/* ════════ pills / chips / stats ════════ */
.brandpills { display: inline-flex; gap: 5px; flex-wrap: wrap; }
.brandpill { display: inline-flex; align-items: center; gap: 5px; height: 21px; padding: 0 8px 0 6px; border-radius: 6px;
  background: var(--s2); font-size: 12px; font-weight: 600; color: var(--t1); white-space: nowrap; }
.brandpill .bdot { width: 8px; height: 8px; border-radius: 3px; flex: none; }
.stat { display: inline-flex; align-items: center; gap: 4px; font-family: "JetBrains Mono", monospace;
  font-variant-numeric: tabular-nums; font-size: 12.5px; font-weight: 600; color: var(--t2); white-space: nowrap; }
.stat svg { width: 13px; height: 13px; flex: none; color: var(--t3); }
.cpill { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 6px; font-size: 12px;
  font-weight: 600; white-space: nowrap; text-transform: capitalize; }
.cpill.pos { background: var(--mint-s); color: var(--mint-d); }
.cpill.neg { background: var(--coral-s); color: var(--coral-d); }
.cpill.neu { background: var(--s2); color: var(--t2); }
/* intent variants — same palette as the Opportunities .ibadge.i-* badges */
.cpill.i-buy { background: var(--mint-s); color: var(--mint); }
.cpill.i-switch { background: var(--amber-s); color: #b45309; }
.cpill.i-seek { background: var(--sky-s); color: var(--sky); }
.cpill.i-cmp { background: var(--lilac-s); color: var(--lilac); }
.cpill.i-neg { background: var(--coral-s); color: var(--coral); }
.cpill.i-pos { background: var(--mint-s); color: var(--mint); }
.cpill.i-q { background: var(--s2); color: var(--t2); }
.cpill.i-news, .cpill.i-other { background: var(--s2); color: var(--t3); }
/* colour swatch shown before colour-coded dropdown options (Mood / Intent) */
.rsel-sw { width: 8px; height: 8px; border-radius: 3px; flex: none; margin-right: 1px; }
.youtag { font-size: 12px; font-weight: 700; color: var(--v); background: var(--vtint); border-radius: 5px; padding: 1px 5px; }

/* horizontal proportion bar (intent mix, monthly volume, etc.) */
.hbar { height: 8px; border-radius: 6px; background: var(--s2); overflow: hidden; }
.hbar > span { display: block; height: 100%; border-radius: 6px; background: var(--v); }
.sentsplit { display: flex; height: 8px; border-radius: 6px; overflow: hidden; background: var(--s2); }
.sentsplit .p { background: var(--mint); } .sentsplit .m { background: var(--br2); } .sentsplit .n { background: var(--coral); }

/* placeholder / empty state */
.placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 320px; color: var(--text-3); text-align: center; gap: 8px;
  border: 1px dashed var(--border); border-radius: 14px; background: var(--surface); }
.placeholder .ph-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--s2); display: flex;
  align-items: center; justify-content: center; font-size: 22px; color: var(--t3); margin-bottom: 8px; }
.placeholder .ph-title { font-size: 16px; font-weight: 600; color: var(--text-1, var(--t1)); }
.placeholder .ph-tag { font-size: 12px; text-transform: none; letter-spacing: 0; font-weight: 500;
  color: var(--t3); border: 1px dashed var(--br2); background: transparent; border-radius: 8px; padding: 4px 10px; }

/* tables */
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; color: var(--text-3); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--br2); }
table.data td { padding: 12px 10px; border-bottom: 1px solid var(--br); }
table.data tr:hover td { background: var(--bg); }

/* badges / pills */
.badge { display: inline-block; font-size: 12px; border-radius: 999px; padding: 1px 8px; border: 1px solid var(--border); color: var(--text-2); }
.badge.beta { color: var(--amber-d); border-color: var(--amber-m); background: var(--amber-s); }
.banner { border-radius: 10px; padding: 11px 14px; font-size: 13px; font-weight: 500; border: 1px solid transparent; }
.banner.amber { background: var(--amber-s); border-color: var(--amber-m); color: var(--amber-d); }
.banner.violet { background: var(--vtint); border-color: var(--v14); color: var(--v-h); }
.banner.mint { background: var(--mint-s); border-color: var(--mint-m); color: var(--mint-d); }
.err { background: var(--coral-s); border: 1px solid var(--coral-m); color: var(--coral-d); padding: 12px; border-radius: 10px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; vertical-align: middle; }
/* brand logo avatar (logo.dev/favicon img over a colour-initial fallback) */
.blogo { position: relative; display: inline-flex; align-items: center; justify-content: center;
  flex: none; border-radius: 6px; overflow: hidden; color: #fff; font-weight: 700; font-size: 10px;
  line-height: 1; text-transform: uppercase; vertical-align: middle; }
.blogo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; }

/* chip input (SoV / Settings forms) */
.chipbox { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border: 1px solid var(--br2);
  border-radius: 10px; padding: 6px; min-width: 240px; background: var(--inp); cursor: text; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--v08); border: 1px solid var(--v14);
  border-radius: 8px; padding: 2px 4px 2px 9px; font-size: 13px; color: var(--t1); }
.chip .x { cursor: pointer; color: var(--brand); font-weight: 700; line-height: 1; padding: 0 4px; border-radius: 50%; }
.chip .x:hover { background: var(--brand); color: #fff; }
.chipbox input { border: 0; outline: 0; flex: 1; min-width: 80px; font-size: 13px; padding: 3px; background: transparent; }

/* ════════ detail drawer ════════ */
.drawer-ov { position: fixed; inset: 0; background: rgba(18,16,26,.28); z-index: 40; opacity: 0;
  pointer-events: none; transition: opacity .15s; }
.drawer-ov.on { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 430px; max-width: 94%; background: var(--surface);
  border-left: 1px solid var(--br); z-index: 50; display: flex; flex-direction: column;
  box-shadow: -8px 0 30px rgba(18,16,26,.10); transform: translateX(100%);
  transition: transform .22s cubic-bezier(.2,.7,.3,1); }
.drawer.on { transform: none; }
.drawer .dhead { padding: 16px 20px; border-bottom: 1px solid var(--s2); display: flex; align-items: center; gap: 10px; }
.drawer .dhead .dsub { font-size: 13px; font-weight: 600; color: var(--t1); flex: 1; min-width: 0; }
.drawer .dbody { flex: 1; overflow-y: auto; padding: 20px; }
.drawer .dtitle { font-size: 16px; font-weight: 600; line-height: 1.4; color: var(--t1); }
.drawer .dsnip { font-size: 13.5px; color: var(--t2); line-height: 1.6; margin-top: 14px; }
.drawer .dtiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.drawer .dtile { border: 1px solid var(--br); border-radius: 10px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; }
.drawer .dtile svg { width: 17px; height: 17px; color: var(--t3); flex: none; }
.drawer .dtile .v { font-family: "JetBrains Mono", monospace; font-size: 17px; font-weight: 600; color: var(--t1); }
.drawer .dfoot { padding: 16px; border-top: 1px solid var(--s2); display: flex; gap: 10px; }
.dclose { cursor: pointer; color: var(--t2); display: inline-flex; padding: 5px; border-radius: 7px; }
.dclose:hover { background: var(--s2); }
.drawer .dcwrap { margin-top: 18px; }
.drawer .dc-h { font-size: 13px; font-weight: 600; color: var(--t1); margin-bottom: 6px; }
.drawer .dc { padding: 10px 0; border-top: 1px solid var(--s2); }
.drawer .dc-meta { font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--t3); margin-bottom: 3px; }
.drawer .dc-meta b { color: var(--t2); }
.drawer .dc-body { font-size: 13px; color: var(--t2); line-height: 1.5; }
.drawer .dc-load, .drawer .dc-empty { font-size: 13px; color: var(--t3); padding: 8px 0; }
.drawer .dtxt { font-size: 13.5px; color: var(--t2); line-height: 1.6; }
.drawer .dclamp { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.drawer .dclamp.open { -webkit-line-clamp: unset; display: block; }
.drawer .readmore { font-size: 12.5px; font-weight: 600; color: var(--v); cursor: pointer; display: inline-block; margin-top: 5px; }

/* shared on-submit progress overlay (attachOverlay in sections.js) */
.rs-ovl { position: fixed; inset: 0; background: rgba(248,247,252,.82); display: none;
  align-items: center; justify-content: center; z-index: 60; }
.rs-ovl.on { display: flex; }
.rs-ovl .ovl-card { background: var(--surface); border: 1px solid var(--br); border-radius: 16px;
  padding: 22px 26px; width: min(100%, 340px); box-shadow: var(--shlg); text-align: center; }
.rs-ovl .ovl-msg { font-size: 14px; color: var(--text); }
.rs-ovl .ovl-track { height: 8px; background: var(--s2); border-radius: 6px; overflow: hidden; margin: 14px 0 8px; }
.rs-ovl .ovl-fill { height: 100%; width: 0; background: var(--brand); transition: width .15s linear; }
.rs-ovl .ovl-sub { font-size: 12px; color: var(--text-3); }

@keyframes fadeup { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.fadeup { animation: fadeup .4s cubic-bezier(.2,.7,.3,1) both; }

/* ════════ custom dropdown (progressively enhances native <select>; ui.js) ════════ */
select.rsel-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; border: 0; opacity: 0; pointer-events: none; }
.rsel-btn { display: inline-flex; align-items: center; gap: 6px; font-family: inherit; font-size: 13px; font-weight: 600;
  color: var(--t1); background: var(--inp); border: 1px solid var(--br2); border-radius: 10px; padding: 8px 11px;
  cursor: pointer; transition: border-color .15s, box-shadow .15s, background .15s; line-height: 1.2; max-width: 100%; }
.rsel-btn:hover { border-color: var(--t3); }
.rsel-btn.open { border-color: var(--v); box-shadow: 0 0 0 3px var(--v08); }
.rsel-btn .rsel-val { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rsel-chev { color: var(--t3); flex: none; margin-left: auto; transition: transform .15s; }
.rsel-btn.open .rsel-chev { transform: rotate(180deg); }
/* borderless contexts: compact filter pills + the opportunities filter form.
   A vertical divider separates the field label from the selected value. */
.rs-pill .rsel-btn, form#oform label .rsel-btn { border: 0; border-left: 1px solid var(--br2); background: transparent; padding: 0 0 0 9px; margin-left: 3px; border-radius: 0; font-size: 12.5px; font-weight: 600; color: var(--t1); }
.rs-pill .rsel-btn:hover, form#oform label .rsel-btn:hover { border-left-color: var(--t3); }
.rs-pill .rsel-btn.open, form#oform label .rsel-btn.open { box-shadow: none; border-left-color: var(--v); }
.rs-pill .rsel-chev, form#oform label .rsel-chev { margin-left: 6px; }
/* the floating menu (body-appended, fixed-position) */
.rsel-menu { position: fixed; z-index: 300; background: var(--surface); border: 1px solid var(--br2); border-radius: 12px;
  box-shadow: var(--shlg); padding: 6px; max-height: 320px; overflow-y: auto; animation: rselin .12s ease both; }
@keyframes rselin { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.rsel-opt { padding: 8px 11px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--t1); cursor: pointer; white-space: nowrap; }
.rsel-opt:hover { background: var(--s2); }
.rsel-opt.sel { background: var(--vtint); color: var(--v); font-weight: 600; }
/* stacked-form selects should fill the field width like text inputs do */
.fld .rsel-btn { width: 100%; }
.brandbar .rsel-btn { min-width: 220px; }
.savebar .rsel-btn, .secthead .rsel-btn { background: var(--surface); }
/* multi-select variant (<select multiple>): a checkbox per option + a summary label.
   Empty selection = "All" (the data-all label). */
.rsel-opt { display: flex; align-items: center; gap: 9px; }
.rsel-btn.rsel-has { color: var(--v); }
.rs-pill .rsel-btn.rsel-has, form#oform label .rsel-btn.rsel-has { border-left-color: var(--v); }
/* multi-select pills keep a constant width: the label always stays the placeholder
   ("All") no matter how many options are picked — a reserved dot just lights up. */
.rsel-btn.rsel-multi .rsel-val::after { content: ''; display: inline-block; width: 6px; height: 6px;
  margin-left: 7px; border-radius: 50%; background: transparent; vertical-align: middle; }
.rsel-btn.rsel-multi.rsel-has .rsel-val::after { background: var(--v); }
.rsel-menu-multi .rsel-opt.sel { background: transparent; color: var(--t1); font-weight: 500; }
.rsel-menu-multi .rsel-opt:hover { background: var(--s2); }
.rsel-ck { width: 16px; height: 16px; flex: none; border: 1.6px solid var(--br2); border-radius: 5px;
  display: inline-flex; align-items: center; justify-content: center; color: #fff; transition: background .12s, border-color .12s; }
.rsel-ck svg { opacity: 0; }
.rsel-opt.sel .rsel-ck { background: var(--v); border-color: var(--v); }
.rsel-opt.sel .rsel-ck svg { opacity: 1; }

/* ════════ motion — smooth, consistent transitions everywhere ════════ */
:root { --ease: cubic-bezier(.2,.7,.3,1); --ease-out: cubic-bezier(.16,1,.3,1); }

/* gentle page entrance on every (server-rendered) navigation */
.content { animation: pagein .3s var(--ease) both; }
@keyframes pagein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* every button transitions smoothly unless a more specific rule overrides it */
button { transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease), transform .12s var(--ease); }

/* unified smooth state changes on interactive surfaces */
.nav a, .rs-pill, .viewsw a, .viewsw button, .brandpill, .cpill, .badge, .stat, .rsel-btn, .rsel-opt,
.opp, .sigbtn, .subtabs a, .tw-row, .mt-row, .lk, .pager a, .cfgview .rochip, .acts button, .chip, .seg {
  transition: background-color .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease), transform .15s var(--ease);
}

/* clickable cards: gentle lift on hover */
.mcard, a.kpi, .brandcard { transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease); }
.mcard:hover, a.kpi:hover { transform: translateY(-2px); box-shadow: var(--shmd); }
.kpicard { transition: box-shadow .2s var(--ease), transform .2s var(--ease); position: relative; }
/* on hover, lift the card above its neighbours so a help tooltip overflowing the
   card's edge paints on top of the next card instead of being covered by it */
.kpicard:hover { box-shadow: var(--shmd); z-index: 40; }
.opp:hover { box-shadow: var(--shmd); border-color: var(--br2); }

/* drawer + overlay easing */
.drawer { transition: transform .26s var(--ease-out); }
.drawer-ov { transition: opacity .2s var(--ease); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
