/* ==========================================================================
   BulliedBear design system — port of What10 "Cloud Fixation".
   Token NAMES kept verbatim from What10 (they are the API every ported
   component references); only VALUES are rebranded. Two additions because
   amber cannot do what indigo did at WCAG AA:
     --deep      text-safe amber (links, active tab text, tinted-pill text)
     --grad-ink  text ON gradient/amber fills (white on #F0B429 is ~1.9:1)
   ========================================================================== */
:root {
  --indigo: #F0B429;              /* Bull Amber — gradient start */
  --purple: #D69E2E;              /* Bear Bronze — gradient end, hover borders */
  --blue:   #00D2FF;              /* Electric Blue — focus glow (unchanged) */
  --grad:   linear-gradient(135deg, #F0B429 0%, #D69E2E 100%);
  --deep:     #975A16;
  --grad-ink: #231A03;

  --ok: #0E9F6E;  --warn: #C27803;  --bad: #DC2626;
  --up: #16A34A;  --down: #DC2626;

  --bg: #F8FAFC;  --surface: #FFFFFF;  --card: #FFFFFF;
  --ink: #0B0F19;  --ink-soft: #334155;  --muted: #64748B;
  --border: #E2E8F0;  --line: #E6EAF1;  --soft: #F1F5F9;
  --shadow: 0 10px 30px -16px rgba(11, 15, 25, 0.22);
  --focus: 0 0 0 4px rgba(0, 210, 255, 0.18);

  --r-sm: 8px;  --r: 16px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --display: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
}
:root[data-theme="dark"] {
  --bg: #0B0F19;  --surface: #111827;  --card: #121829;
  --ink: #F1F5F9;  --ink-soft: #cbd5e1;  --muted: #94A3B8;
  --border: #1F2937;  --line: #232c41;  --soft: #1a2233;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.6);
  --deep: #F6C453;
}

/* ---- base ---- */
* { box-sizing: border-box; }
html { height: 100%; }
html, body { margin: 0; padding: 0; }
body { min-height: 100vh; display: flex; flex-direction: column;
  font-family: var(--body); color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background .25s var(--ease), color .25s var(--ease); }
:root[data-theme="dark"] body {
  background:
    radial-gradient(1100px 520px at 8% -10%, rgba(240,180,41,.16) 0%, transparent 60%),
    radial-gradient(900px 480px at 108% 4%, rgba(0,210,255,.10) 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
}
a { color: var(--deep); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--display); letter-spacing: -0.01em; }
[hidden] { display: none !important; }
.g { background: var(--grad, linear-gradient(135deg,#F0B429,#D69E2E));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12.5px; }

/* ---- banner ---- */
.bbbanner { position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface, #fff) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border, #E2E8F0); }
.bb-in { max-width: 1100px; margin: 0 auto; padding: 0 22px; height: 62px;
  display: flex; align-items: center; gap: 14px; position: relative; }
.bb-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; margin-right: auto; }
.bb-logo:hover { text-decoration: none; }
.bb-logo svg { height: 42px; width: 42px; border-radius: 9px; display: block; }
.bb-word { font-family: var(--display); font-weight: 700; font-size: 23px;
  letter-spacing: -.02em; color: var(--ink, #0B0F19); white-space: nowrap; }
.bb-sep { display: inline-block; width: 4px; height: 4px; border-radius: 50%;
  background: var(--muted, #94A3B8); opacity: .55; margin: 0 10px; vertical-align: middle; }
.bb-app { font-weight: 500; font-size: 19px; letter-spacing: -.01em; color: var(--muted, #64748B); }
.bb-theme { appearance: none; border: 1px solid var(--border); background: var(--surface);
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer; line-height: 1; flex: none;
  display: grid; place-items: center; padding: 0; color: var(--ink-soft); }
.bb-theme:hover { border-color: #D69E2E; }
.bb-theme svg { width: 17px; height: 17px; }
.bb-chip { display: inline-flex; align-items: center; gap: 9px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); padding: 5px 13px 5px 5px;
  border-radius: 999px; max-width: 200px; text-decoration: none; color: var(--ink);
  transition: border-color .2s; font-size: 13.5px; font-weight: 600; }
.bb-chip:hover { border-color: #D69E2E; text-decoration: none; }
.bb-chip .bb-mail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bb-av { width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, #F0B429, #D69E2E); color: var(--grad-ink);
  display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.bb-signin { background: var(--grad); color: var(--grad-ink); border-radius: 999px;
  padding: 9px 18px; font-weight: 700; font-size: 14px; border: 0; cursor: pointer;
  font-family: var(--body); text-decoration: none; display: inline-block; }
.bb-signin:hover { filter: brightness(1.05); text-decoration: none; }

/* ---- layout ---- */
main.wrap { flex: 1 0 auto; width: 100%; max-width: 1100px; margin: 0 auto;
  padding: 20px 22px 70px; }
.page-title { font-size: 30px; margin: 18px 0 4px; }
.sub { color: var(--muted); font-size: 15px; margin: 0 0 20px; }

/* ---- hero ---- */
.hero { text-align: center; padding: 34px 0 8px; }
.hero-mark { font-family: var(--display); font-weight: 700; font-size: 52px;
  letter-spacing: -.03em; margin: 6px 0 4px; }
.hero-sub { color: var(--muted); font-size: 16px; margin: 0 0 24px; }

/* ---- cards ---- */
.card { background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 22px; margin-bottom: 20px; box-shadow: var(--shadow); }
.card h3 { margin-top: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin: 10px 0 20px; }
.ana-kpi { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px;
  background: var(--surface); position: relative; overflow: hidden; }
.ana-kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px; background: var(--grad); }
.ana-kpi .k { color: var(--muted); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em; }
.ana-kpi .v { font-size: 26px; font-weight: 800; font-family: var(--display);
  color: var(--ink); line-height: 1.15; margin-top: 3px; font-variant-numeric: tabular-nums; }
.ana-bar { display: grid; grid-template-columns: 130px 1fr 52px; align-items: center;
  gap: 10px; margin-bottom: 7px; font-size: 13px; }
.ana-bar .b-track { height: 10px; border-radius: 999px; background: rgba(127,127,127,.12); overflow: hidden; }
.ana-bar .b-fill { height: 100%; border-radius: 999px; background: var(--grad); }
.ana-bar .b-num { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---- result rows (Bullied List / search) ---- */
.res { background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 15px 17px; margin-bottom: 10px; display: block; color: var(--ink);
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease), transform .16s var(--ease); }
.res:hover { border-color: #D69E2E; box-shadow: 0 3px 14px rgba(2,6,23,.08);
  text-decoration: none; transform: translateY(-1px); }
.res-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.res-name { font-weight: 650; font-size: 15.5px; }
.res-sym { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.res-meta { color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.res-num { margin-left: auto; text-align: right; font-variant-numeric: tabular-nums; }
.chg { font-weight: 700; font-size: 13px; white-space: nowrap; }
.chg.up { color: var(--up); } .chg.down { color: var(--down); }

/* ---- tables ---- */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 600; padding: 10px 12px;
  border-bottom: 2px solid var(--border); text-transform: uppercase; font-size: 11px;
  letter-spacing: .5px; white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: top;
  color: var(--ink); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td, tr.hoverable:hover td { background: rgba(214,158,46,.07); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- pills / actions / tabs ---- */
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; }
.pill.admin, .pill.brand { background: rgba(214,158,46,.16); color: var(--deep); }
.pill.ok  { background: rgba(14,159,110,.12); color: var(--ok); }
.pill.off { background: rgba(220,38,38,.12); color: var(--bad); }
.act { background: var(--surface); border: 1px solid var(--border); color: var(--ink-soft);
  border-radius: 8px; padding: 5px 10px; font-size: 12px; font-weight: 600;
  cursor: pointer; margin: 2px; font-family: var(--body); }
.act:hover { border-color: var(--purple); color: var(--ink); }
.act.danger:hover { border-color: var(--bad); color: var(--bad); background: rgba(220,38,38,.06); }
.stabs { display: flex; gap: 18px; border-bottom: 1px solid var(--border); margin: 6px 0 16px; }
.stab { font-size: 14px; font-weight: 600; color: var(--muted); padding: 8px 2px;
  border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  background: none; cursor: pointer; font-family: var(--body); }
.stab.on { color: var(--deep); border-bottom-color: var(--purple); }

/* ---- buttons / forms ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 11px 20px; border-radius: 10px; border: none; background: var(--grad);
  color: var(--grad-ink); font-weight: 700; font-size: 14.5px; cursor: pointer;
  font-family: var(--body); transition: opacity .15s; text-decoration: none; }
.btn:hover { opacity: .9; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: var(--surface); border: 1px solid var(--border); color: var(--ink);
  border-radius: 10px; padding: 10px 18px; font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: var(--body); }
.btn-ghost:hover { border-color: var(--purple); color: var(--deep); }
.bb-input { width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 13px; color: var(--ink); font-size: 13.5px;
  font-family: var(--body); min-height: 38px; }
.bb-input:focus { outline: none; border-color: var(--blue); box-shadow: var(--focus); }

/* ---- search pill (hero + banner) ---- */
.searchwrap { position: relative; flex: 1; max-width: 480px; }
.searchpill { display: flex; align-items: center; background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px; padding: 0 6px 0 16px;
  transition: border-color .16s, box-shadow .16s; }
.searchpill:focus-within { border-color: #D69E2E; box-shadow: 0 1px 10px rgba(214,158,46,.18); }
.searchpill input { flex: 1; border: 0; background: none; color: var(--ink);
  font-size: 14.5px; font-family: var(--body); padding: 9px 4px; min-width: 0; }
.searchpill input:focus { outline: none; }
.sugg { position: absolute; top: 46px; left: 0; right: 0; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px; overflow: hidden; z-index: 30;
  box-shadow: 0 14px 30px -12px rgba(15,23,42,.3); }
.sugg a { display: block; padding: 10px 16px; color: var(--ink); font-size: 14px; }
.sugg a:hover, .sugg a.sel { background: rgba(214,158,46,.08); text-decoration: none; }
.sugg small { color: var(--muted); margin-left: 8px; font-family: var(--mono); font-size: 11.5px; }

/* ---- banner (loading note) ---- */
.notice { background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 16px; color: var(--muted); margin: 14px auto; font-size: 13px;
  max-width: 1100px; }

/* ---- sparkline ---- */
.spark { width: 100%; height: 130px; margin: 8px 0 4px; }

/* ---- footer ---- */
.bbfoot { flex-shrink: 0; border-top: 1px solid var(--border); margin-top: 52px;
  padding: 36px 22px 44px; text-align: center; color: var(--muted); }
.bbfoot-note { font-size: 12.5px; max-width: 620px; margin: 0 auto 14px; }
.bbfoot-copy { font-size: 12.5px; margin: 12px 0 0; }

/* ---- toast ---- */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: #111827; color: #F1F5F9; border-radius: 999px; padding: 10px 20px;
  font-size: 13.5px; font-weight: 600; opacity: 0; pointer-events: none;
  transition: opacity .25s var(--ease), transform .25s var(--ease); z-index: 200; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- skeleton ---- */
@keyframes sh { to { background-position: -200% 0; } }
.skel { border-radius: 12px; background: linear-gradient(90deg, var(--soft) 25%,
  var(--border) 37%, var(--soft) 63%); background-size: 200% 100%;
  animation: sh 1.2s infinite; }
@keyframes pop { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.pop { animation: pop .25s var(--ease); }

/* ---- responsive ---- */
@media (max-width: 860px) {
  .bb-in { gap: 8px; }
  .bb-word { font-size: 21px; }
}
@media (max-width: 760px) {
  main.wrap { padding: 12px 0 60px; }
  .hero, .sub, .page-title, .stabs, .notice, h1, h2 { margin-left: 15px; margin-right: 15px; }
  .res { margin: 0; border-left: 0; border-right: 0; border-radius: 0;
    border-bottom: 1px solid var(--border); border-top: 0; }
  .res:hover { box-shadow: none; transform: none; }
  .card { border-radius: 0; border-left: 0; border-right: 0; }
  .cards { margin-left: 15px; margin-right: 15px; }
}
@media (max-width: 640px) {
  .bb-app, .bb-sep { display: none; }
  .hero-mark { font-size: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
