/* =====================================================================
   HelloDrop Repricer · Design system v2 ("Calm Pro")
   Loaded LAST on every page. Source of truth for tokens + components.
   Built with ui-ux-pro-max: Data-Dense Dashboard style, Plus Jakarta Sans,
   SVG icons (Lucide) instead of emoji, flat surfaces, 4.5:1 contrast,
   visible focus, prefers-reduced-motion. Spec: docs/design-system/
   ===================================================================== */
@font-face { font-family: 'Plus Jakarta Sans'; src: url('/assets/fonts/jakarta.woff2') format('woff2'); font-weight: 200 800; font-style: normal; font-display: swap; }

:root {
  /* brand */
  --p: #4f46e5; --p-h: #4338ca; --p-d: #3730a3; --p-soft: #eef2ff; --p-ring: rgba(79,70,229,.28);
  --p2: #6366f1;
  --grad: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  /* neutrals (slate) */
  --ink: #0f172a; --ink-2: #334155; --muted: #64748b; --faint: #94a3b8;
  --line: #e2e8f0; --edge: #cbd5e1; --bg: #f6f7fb; --card: #fff; --sunk: #f8fafc;
  /* semantic */
  --up: #047857; --up-soft: #ecfdf5; --up-b: #a7f3d0;
  --down: #c2410c; --down-soft: #fff7ed; --down-b: #fed7aa;
  --bad: #be123c; --bad-soft: #fff1f2; --bad-b: #fecdd3;
  --warn: #b45309; --warn-soft: #fffbeb; --warn-b: #fde68a;
  --info: #0369a1; --info-soft: #f0f9ff; --info-b: #bae6fd;
  /* shape + depth */
  --r-sm: 8px; --r: 10px; --r-lg: 14px;
  --shadow: 0 1px 2px rgba(15,23,42,.05);
  --shadow-h: 0 4px 16px rgba(15,23,42,.08);
  --shadow-pop: 0 12px 40px rgba(15,23,42,.16);
  --ease: cubic-bezier(.2,.7,.2,1);
  --font: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
}

/* ---------- base ---------- */
[hidden] { display: none !important; }
html, body { font: 450 13px/1.5 var(--font); word-spacing: .05em; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { background-image: none !important; }
button, input, select, textarea { font-family: var(--font); }
b, strong { font-weight: 700; }
h1, h2, h3, h4 { letter-spacing: -.015em; }
h3 { font-size: 14px; font-weight: 700; color: var(--ink); }
.muted { color: var(--muted); }
::selection { background: #c7d2fe; }
a { text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--p); outline-offset: 2px; border-radius: 6px; }
.num, td.num, .tbl .num, b { font-variant-numeric: tabular-nums; }

/* icons */
.ic { width: 16px; height: 16px; flex: 0 0 auto; display: block; }
i.icw { display: inline-flex; align-items: center; justify-content: center; font-style: normal; line-height: 0; }
/* emoji that were swapped to icons: sit on the text baseline, sized to the text */
i.emi { vertical-align: -0.16em; margin: 0 .28em 0 0; }
i.emi .ic { width: 1.12em; height: 1.12em; stroke-width: 2.1; }
h2 i.emi .ic, h3 i.emi .ic { color: var(--muted); }
.tone-g { color: #059669 !important; } .tone-o { color: #ea580c !important; } .tone-r { color: #e11d48 !important; }
.tone-a { color: #d97706 !important; } .tone-v { color: #7c3aed !important; } .tone-f { color: #c026d3 !important; }
.tone-b { color: #0284c7 !important; } .tone-s { color: #64748b !important; }
.btn i.emi .ic, .usermenu i.emi .ic, .big-review i.emi .ic, .btn.primary .ic { color: inherit !important; }
/* icon containers that used to hold a big emoji */
.s-ic i.emi, .td-ic i.emi, .opp-i i.emi, .a-ic i.emi, .big-ic i.emi, .f span i.emi { margin: 0; vertical-align: 0; }
.s-ic .ic, .td-ic .ic, .opp-i .ic, .a-ic .ic { width: 17px; height: 17px; }
.big-ic .ic { width: 26px; height: 26px; }

/* ---------- buttons ---------- */
.btn { border-radius: var(--r-sm); border: 1px solid var(--edge); background: #fff; color: var(--ink-2); font-weight: 650; gap: 7px; box-shadow: 0 1px 1px rgba(15,23,42,.03); transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s; }
.btn:hover { background: var(--sunk); border-color: #94a3b8; color: var(--ink); transform: none; }
.btn:active { transform: scale(.98); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--p-ring); }
.btn.primary, .syncbar .sync-btn { background: var(--p) !important; border: 1px solid var(--p) !important; color: #fff !important; box-shadow: 0 1px 2px rgba(67,56,202,.25) !important; }
.btn.primary:hover, .syncbar .sync-btn:hover { background: var(--p-h) !important; border-color: var(--p-h) !important; transform: none; }
.btn.big { padding: 10px 18px; font-size: 14px; border-radius: var(--r); }
.btn.danger { color: var(--bad); border-color: var(--bad-b); background: #fff; }
.btn.danger:hover { background: var(--bad-soft); border-color: #fda4af; }
.btn.xs { padding: 4px 10px; font-size: 12px; border-radius: 7px; }
.btn[disabled], .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .ic { width: 15px; height: 15px; }

/* ---------- form controls ---------- */
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input:not([type]), select, textarea {
  border: 1px solid var(--edge); border-radius: var(--r-sm); background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
input[type=text]:hover, input[type=email]:hover, input[type=password]:hover, input[type=number]:hover, select:hover, textarea:hover { border-color: #94a3b8; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--p) !important; box-shadow: 0 0 0 3px var(--p-ring); }
input::placeholder, textarea::placeholder { color: var(--faint); font-weight: 450; }
input[type=checkbox], input[type=radio] { accent-color: var(--p); }
.field { font-weight: 650; color: var(--ink-2); font-size: 12.5px; }
.field input { border-radius: var(--r-sm); padding: 10px 12px; font-size: 14px; font-weight: 500; }

/* ---------- surfaces ---------- */
.card, .kpi, .stat, .dtile, .f { background: var(--card); border: 1px solid var(--line) !important; border-top-width: 1px !important; border-radius: var(--r-lg); box-shadow: var(--shadow); }
.card.c-violet, .card.c-amber, .card.c-blue, .card.c-green { border-top-color: var(--line) !important; }
.card h3 { font-size: 14px; }
.ins-grid > .card, .dcard { border-top: 1px solid var(--line) !important; }
.empty { color: var(--muted); }

/* KPI tiles: quiet, number-first */
.kpi { padding: 14px 16px; }
.kpi span, .dt-l { font-size: 11px; font-weight: 700; letter-spacing: .05em; color: var(--muted); }
.kpi b { font-size: 22px; font-weight: 750; letter-spacing: -.02em; }
.dtile { padding: 12px 14px; }
.dtile::after { width: 3px; border-radius: 0 3px 3px 0; top: 12px; bottom: 12px; }
.dtile b { font-weight: 750; letter-spacing: -.02em; }
.dtile:hover:not([disabled]) { transform: translateY(-1px); box-shadow: var(--shadow-h); border-color: var(--edge) !important; }

/* review stat filters: tinted icon chips instead of gradient bubbles */
.stat { cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.stat:hover { transform: translateY(-1px); box-shadow: var(--shadow-h); }
.stat.on { border-color: currentColor !important; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 14%, transparent); }
.stat b { font-weight: 750; color: var(--ink); }
.stat span { color: var(--muted); font-weight: 600; }
.stat .s-ic { border-radius: 9px; color: inherit; background: color-mix(in srgb, currentColor 12%, #fff) !important; }
.stat.s-all { color: var(--p); } .stat.s-up { color: var(--up); } .stat.s-down { color: var(--down); } .stat.s-dead { color: var(--bad); } .stat.s-cost { color: var(--warn); }

/* the big "N changes need your review" banner: confident, not loud */
.big-review { background: var(--ink) !important; color: #fff; box-shadow: var(--shadow-h) !important; border-radius: var(--r-lg) !important; border: 0; }
.big-review .btn { background: #fff !important; color: var(--ink) !important; border: 0 !important; font-weight: 700; }
.big-review .btn:hover { background: #e2e8f0 !important; }

/* notices */
.notice { border-radius: var(--r); font-weight: 550; }
.mode-note { border-radius: var(--r) !important; background: var(--info-soft) !important; border: 1px solid var(--info-b) !important; color: #0c4a6e; }
.connect-card { border-radius: var(--r-lg) !important; }
.fees { border-radius: var(--r-lg) !important; background: #fff; }

/* pills + badges */
.pill { font-weight: 650; }
.badge { font-weight: 700; background: var(--bad); }
.soon { background: #fef3c7 !important; color: #92400e !important; border-radius: 999px; font-size: 9.5px !important; font-weight: 800; letter-spacing: .04em; padding: 1px 7px !important; }
.beta.insider { background: var(--p-soft) !important; color: var(--p-h) !important; border: 1px solid #c7d2fe !important; font-weight: 750; }

/* ---------- tables ---------- */
.tbl { border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.tbl th { background: var(--sunk); color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: .06em; border-bottom: 1px solid var(--line); }
.tbl td { border-bottom: 1px solid #eef2f6; }
.tbl tbody tr:hover td { background: #f8faff; }
.tbl td.name a, .tbl td.name b { font-weight: 650; }
.tbl th.sort.asc::after, .tbl th.sort.desc::after { color: var(--p); }

/* ---------- modal + menus + toast ---------- */
.modal { background: rgba(15,23,42,.42); backdrop-filter: blur(2px); }
.modal-card { border-radius: 16px !important; box-shadow: var(--shadow-pop) !important; border: 1px solid var(--line); }
.usermenu { border-radius: 12px !important; box-shadow: var(--shadow-pop) !important; border: 1px solid var(--line) !important; padding: 6px !important; min-width: 220px; }
.usermenu button { display: flex !important; align-items: center; gap: 10px; border-radius: 8px !important; font-weight: 600 !important; color: var(--ink-2) !important; padding: 8px 10px !important; }
.usermenu button:hover { background: var(--sunk) !important; color: var(--ink) !important; }
.usermenu button .ic { color: var(--muted); }
.usermenu .um-out { color: var(--bad) !important; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px !important; margin-top: 4px; }
.usermenu .um-out .ic { color: var(--bad); }
.toast { border-radius: 12px !important; box-shadow: var(--shadow-pop) !important; font-weight: 600; }

/* ---------- app shell: sidebar ---------- */
.side { background: #fff; border-right: 1px solid var(--line); }
.side .brand-txt span { font-weight: 800; letter-spacing: -.02em; }
.side .tagline { font-weight: 550; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.side .store-pick { border-radius: var(--r-sm); font-weight: 650; }
.side .nav-h { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; color: var(--faint); }
.side .tabs button { gap: 10px; color: var(--ink-2); font-weight: 600; border-radius: var(--r-sm); min-height: 36px; transition: background .12s, color .12s; }
.side .tabs .ti { display: inline-flex; color: var(--muted); transition: color .12s; }
.side .tabs .ti .ic { width: 18px; height: 18px; }
.side .tabs button:hover { background: var(--sunk); color: var(--ink); }
.side .tabs button:hover .ti { color: var(--ink-2); }
.side .tabs button.on { background: var(--p-soft); color: var(--p-d); font-weight: 700; }
.side .tabs button.on .ti { color: var(--p); }
.side .tabs button.on::before { background: var(--p); }
.side .badge.zero, .side .tabs button.on .badge.zero { background: #f1f5f9 !important; color: var(--muted) !important; }
.side-foot a, .side-foot button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: var(--r-sm); font-weight: 650; color: var(--ink-2); }
.side-foot .ic { width: 15px; height: 15px; color: var(--muted); }
body.side-mini .side .tabs .ti .ic { width: 19px; height: 19px; }

/* ---------- app shell: top bar ---------- */
.top { background: rgba(255,255,255,.92); backdrop-filter: saturate(1.4) blur(8px); position: sticky; top: 0; z-index: 20; }
.page-title { font-weight: 750; letter-spacing: -.02em; }
.top .icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; border-radius: var(--r-sm); color: var(--ink-2); border: 1px solid var(--line); background: #fff; transition: background .15s, border-color .15s; }
.top .icon-btn:hover { background: var(--sunk); border-color: var(--edge); }
.top .icon-btn .ic { width: 17px; height: 17px; }
.top .side-tg { display: none; }
@media (max-width: 900px) { .top .side-tg { display: inline-flex; } }
.top .mode { background: #f1f5f9; border-radius: 10px; padding: 3px; }
.top .mode button { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; color: var(--muted); }
.top .mode button .ic { width: 15px; height: 15px; }
.top .mode-thumb { border-radius: 8px; box-shadow: 0 1px 3px rgba(15,23,42,.14); }
.top .ap { border-radius: 999px; font-weight: 650; }
.syncbar { background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.syncbar .btn.ghost-w { background: #fff; border-color: var(--edge); color: var(--ink-2); }
.syncbar .sync-btn { display: inline-flex; align-items: center; gap: 7px; }
.spin-ic { display: inline-flex; }
.conn { font-weight: 600; }

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

/* misc */
.flip .ic { transform: scaleX(-1); }
.g-back { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- flatten leftover v1 gradients ---------- */
.soon-hero { background: var(--ink) !important; background-image: radial-gradient(600px 260px at 85% 0%, rgba(99,102,241,.45), transparent 70%) !important; border-radius: var(--r-lg) !important; box-shadow: none !important; }
.soon-hero h2, .soon-hero p { color: #fff; }
.soon-hero .soon-badge { background: rgba(255,255,255,.12) !important; color: #e0e7ff !important; border: 1px solid rgba(255,255,255,.25); font-size: 11px; letter-spacing: .08em; }
.soon-hero .ic { color: #a5b4fc !important; }
.mode.auto .mode-thumb { background: #fff !important; }
input.sw:checked { background: #059669 !important; }
.bar-fill { background: var(--p) !important; animation: none !important; }
.bar-fill.ok { background: #059669 !important; }
.automode, .mode-note.auto { background: var(--warn-soft) !important; border-color: var(--warn-b) !important; }
.mode-note.autopub { background: var(--up-soft) !important; border-color: var(--up-b) !important; }
.rules-head.store { background: var(--p-soft) !important; }
.toast { background: var(--ink) !important; color: #fff !important; }
.toast.ok { background: #065f46 !important; } .toast.err { background: #9f1239 !important; } .toast.warn { background: #92400e !important; }

/* files modal: inline bold inside step paths */
.sg small b, .sg small i { display: inline !important; font-size: inherit; }
.sg small b { color: var(--ink-2); font-weight: 700; }
