/* =========================================================================
   Arbitragex  ·  Design System
   Vanilla CSS · no build step · light default + dark mode toggle
   ========================================================================= */

/* ---------- Design tokens ------------------------------------------------ */
:root {
  /* brand / accent */
  --brand: #6366f1;
  --brand-600: #5457e5;
  --brand-700: #4f46e5;
  --brand-soft: #eef2ff;
  --brand-softer: #f5f6ff;

  /* semantic */
  --pos: #16a34a;
  --pos-soft: #dcfce7;
  --neg: #dc2626;
  --neg-soft: #fee2e2;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --info: #0284c7;
  --info-soft: #e0f2fe;

  /* surfaces (light) */
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #fafbfe;
  --sidebar: #14162b;
  --sidebar-2: #1c1f3a;
  --sidebar-hover: #262a4d;
  --sidebar-active: #6366f1;

  /* text */
  --text: #1a1c2e;
  --text-soft: #565973;
  --text-mut: #8a8ea8;
  --text-invert: #eef0ff;
  --text-invert-soft: #9ea4c9;

  /* lines */
  --border: #e6e8f0;
  --border-strong: #d3d6e4;

  /* radius */
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 999px;

  /* spacing scale */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px;
  --s6: 24px; --s7: 32px; --s8: 40px; --s9: 56px;

  /* shadows */
  --sh-sm: 0 1px 2px rgba(20,22,43,.06);
  --sh: 0 2px 8px rgba(20,22,43,.06), 0 1px 2px rgba(20,22,43,.04);
  --sh-md: 0 8px 24px rgba(20,22,43,.08), 0 2px 6px rgba(20,22,43,.05);
  --sh-lg: 0 20px 48px rgba(20,22,43,.14);
  --sh-brand: 0 8px 24px rgba(99,102,241,.32);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --sidebar-w: 254px;
  --topbar-h: 64px;
}

[data-theme="dark"] {
  --bg: #0e0f1c;
  --surface: #171827;
  --surface-2: #1c1e30;
  --sidebar: #0b0c17;
  --sidebar-2: #141527;
  --sidebar-hover: #20223a;

  --text: #e9ebf7;
  --text-soft: #a9adc9;
  --text-mut: #767a9a;
  --text-invert: #eef0ff;

  --border: #262838;
  --border-strong: #33364a;

  --brand-soft: #1e2036;
  --brand-softer: #191b2d;

  --pos-soft: #10331f;
  --neg-soft: #3a1a1c;
  --warn-soft: #382a10;
  --info-soft: #10283a;

  --sh: 0 2px 8px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
  --sh-md: 0 8px 24px rgba(0,0,0,.5);
  --sh-lg: 0 20px 48px rgba(0,0,0,.6);
}

/* ---------- Reset -------------------------------------------------------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-mut); background-clip: content-box; }

/* =========================================================================
   BRAND
   ========================================================================= */
.brand { display: flex; align-items: center; gap: 11px; }
.brand-badge {
  width: 38px; height: 38px; flex: 0 0 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, #7c7ff5 0%, #6366f1 55%, #4f46e5 100%);
  color: #fff; font-weight: 800; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: -.5px;
  box-shadow: var(--sh-brand);
}
.brand-badge.sm { width: 30px; height: 30px; flex-basis: 30px; font-size: 14px; border-radius: 9px; }
.brand-word { display: flex; flex-direction: column; line-height: 1.05; }
.brand-word b { font-weight: 800; font-size: 16px; letter-spacing: -.3px; }
.brand-word span { font-size: 10.5px; color: var(--text-invert-soft); letter-spacing: 1.5px; text-transform: uppercase; }

/* =========================================================================
   APP SHELL
   ========================================================================= */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

/* ---------- Sidebar ------------------------------------------------------ */
.sidebar {
  background: var(--sidebar);
  color: var(--text-invert);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  border-right: 1px solid rgba(255,255,255,.04);
  z-index: 30;
}
.sidebar-head { padding: 20px 18px 18px; }
.sidebar-nav { flex: 1; padding: 8px 12px; overflow-y: auto; }
.nav-label {
  font-size: 10.5px; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--text-invert-soft); padding: 16px 12px 7px; opacity: .7;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r-sm);
  color: var(--text-invert-soft); font-weight: 500; font-size: 14px;
  cursor: pointer; margin-bottom: 2px;
  transition: background .14s, color .14s;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(99,102,241,.28), rgba(99,102,241,.10));
  color: #fff;
  box-shadow: inset 3px 0 0 var(--brand);
}
.nav-item svg { width: 18px; height: 18px; flex: 0 0 18px; stroke-width: 1.9; }
.nav-item .nav-badge {
  margin-left: auto; background: var(--brand); color: #fff;
  font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: var(--r-pill);
  min-width: 20px; text-align: center;
}

.sidebar-foot { padding: 14px 12px; border-top: 1px solid rgba(255,255,255,.06); }
.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--r); background: rgba(255,255,255,.04);
}
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 34px;
  background: linear-gradient(135deg, #7c7ff5, #4f46e5); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}
.user-meta { line-height: 1.2; min-width: 0; }
.user-meta b { font-size: 13.5px; display: block; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta span { font-size: 11px; color: var(--text-invert-soft); }
.icon-btn-ghost {
  margin-left: auto; background: none; border: none; color: var(--text-invert-soft);
  width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  transition: background .14s, color .14s;
}
.icon-btn-ghost:hover { background: rgba(255,255,255,.08); color: #fff; }
.icon-btn-ghost svg { width: 17px; height: 17px; }

/* ---------- Main / topbar ------------------------------------------------ */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--topbar-h); position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 26px;
}
.topbar h1 { font-size: 19px; font-weight: 700; margin: 0; letter-spacing: -.3px; }
.topbar .sub { color: var(--text-mut); font-size: 13px; margin-left: 2px; }
.topbar-spacer { flex: 1; }
.topbar-tools { display: flex; align-items: center; gap: 10px; }

.content { padding: 26px; max-width: 1440px; width: 100%; }
.section { display: none; animation: fade .28s ease; }
.section.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: none; } }

.section-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.section-head h2 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.2px; }
.section-head p { margin: 3px 0 0; color: var(--text-mut); font-size: 13px; }
.section-head .spacer { flex: 1; }

/* =========================================================================
   CONTROLS
   ========================================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--r-sm); font-weight: 600; font-size: 13.5px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  transition: all .14s; white-space: nowrap;
}
.btn:hover { border-color: var(--brand); color: var(--brand); box-shadow: var(--sh-sm); }
.btn svg { width: 16px; height: 16px; }
.btn.primary {
  background: linear-gradient(135deg, #6b6ef4, var(--brand-700));
  border-color: transparent; color: #fff; box-shadow: var(--sh-brand);
}
.btn.primary:hover { color: #fff; filter: brightness(1.06); box-shadow: 0 10px 28px rgba(99,102,241,.4); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-soft); }
.btn.ghost:hover { background: var(--brand-soft); color: var(--brand); box-shadow: none; }
.btn.sm { padding: 6px 11px; font-size: 12.5px; }
.btn.danger:hover { border-color: var(--neg); color: var(--neg); }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 3px; }
.seg button {
  border: none; background: none; color: var(--text-soft); font-weight: 600; font-size: 13px;
  padding: 6px 13px; border-radius: 6px; transition: all .14s;
}
.seg button.active { background: var(--surface); color: var(--brand); box-shadow: var(--sh-sm); }
.seg button:hover:not(.active) { color: var(--text); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--text-soft); }
.field .hint { font-size: 11.5px; color: var(--text-mut); font-weight: 400; }
.input, select.input, textarea.input {
  width: 100%; padding: 9px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  transition: border-color .14s, box-shadow .14s;
}
.input:focus, textarea.input:focus, select.input:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(99,102,241,.16);
}
textarea.input { resize: vertical; min-height: 74px; }
select.input { appearance: none; -webkit-appearance: none;
  background-image: 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='%238a8ea8' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; padding-right: 32px; cursor: pointer; }

.select-mini {
  padding: 7px 30px 7px 12px; border-radius: var(--r-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: 13px;
  appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: 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='%238a8ea8' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.select-mini:focus { outline: none; border-color: var(--brand); }

.checkline { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 500; cursor: pointer; user-select: none; }
.checkline input { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }

.mp-toggle {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 13px;
  border: 1.5px solid var(--border-strong); border-radius: var(--r-sm); cursor: pointer;
  font-weight: 600; font-size: 13px; transition: all .14s; user-select: none; background: var(--surface);
}
.mp-toggle input { display: none; }
.mp-toggle .flag { font-size: 15px; }
.mp-toggle.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }

/* =========================================================================
   CARDS
   ========================================================================= */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--sh); padding: 20px;
}
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.card-head .spacer { flex: 1; }
.card-sub { color: var(--text-mut); font-size: 12.5px; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid.charts { grid-template-columns: 1.7fr 1fr; }

/* ---------- KPI cards ---------------------------------------------------- */
.kpi-row {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 18px;
}
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 15px 16px; box-shadow: var(--sh); position: relative; overflow: hidden;
  transition: transform .16s, box-shadow .16s;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }
.kpi.hero { background: linear-gradient(150deg, #6b6ef4 0%, #4f46e5 100%); border-color: transparent; color: #fff; box-shadow: var(--sh-brand); }
.kpi.hero .kpi-label, .kpi.hero .kpi-icon { color: rgba(255,255,255,.85); }
.kpi-top { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.kpi-icon {
  width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand); flex: 0 0 30px;
}
.kpi.hero .kpi-icon { background: rgba(255,255,255,.18); }
.kpi-icon svg { width: 16px; height: 16px; }
.kpi-label { font-size: 12px; font-weight: 600; color: var(--text-soft); letter-spacing: .1px; }
.kpi-value { font-size: 25px; font-weight: 800; letter-spacing: -.6px; line-height: 1.1; }
.kpi.hero .kpi-value { font-size: 27px; }
.kpi-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 700;
  padding: 2px 8px; border-radius: var(--r-pill);
}
.chip svg { width: 12px; height: 12px; }
.chip.up { background: var(--pos-soft); color: var(--pos); }
.chip.down { background: var(--neg-soft); color: var(--neg); }
.chip.flat { background: var(--border); color: var(--text-soft); }
.kpi.hero .chip.up { background: rgba(255,255,255,.22); color: #fff; }
.kpi.hero .chip.down { background: rgba(0,0,0,.18); color: #ffd9d9; }
.kpi-foot small { color: var(--text-mut); font-size: 11.5px; }
.kpi.hero .kpi-foot small { color: rgba(255,255,255,.75); }

/* =========================================================================
   TABLES
   ========================================================================= */
.table-wrap { overflow-x: auto; border-radius: var(--r); }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.tbl thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2); text-align: left; font-weight: 700; font-size: 11.5px;
  letter-spacing: .5px; text-transform: uppercase; color: var(--text-mut);
  padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.tbl tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tbody tr:nth-child(even) { background: var(--surface-2); }
table.tbl tbody tr:hover { background: var(--brand-softer); }
table.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .prod { display: flex; align-items: center; gap: 11px; min-width: 210px; }
.tbl .prod img, .prod-thumb {
  width: 40px; height: 40px; border-radius: var(--r-sm); object-fit: cover;
  background: var(--surface-2); border: 1px solid var(--border); flex: 0 0 40px;
}
.prod-thumb.ph { display: flex; align-items: center; justify-content: center; color: var(--text-mut); }
.prod-thumb.ph svg { width: 18px; height: 18px; }
.tbl .prod-title { font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tbl .prod-meta { font-size: 11.5px; color: var(--text-mut); font-family: var(--mono); }

.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--text-mut); }

/* editable cell */
.cell-edit {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 7px;
  border: 1px dashed transparent; cursor: text; transition: border-color .14s, background .14s;
}
.cell-edit:hover { border-color: var(--border-strong); background: var(--surface-2); }
.cell-edit svg { width: 12px; height: 12px; color: var(--text-mut); opacity: 0; transition: opacity .14s; }
.cell-edit:hover svg { opacity: 1; }
.cogs-input {
  width: 92px; padding: 6px 9px; border-radius: 7px; border: 1px solid var(--brand);
  box-shadow: 0 0 0 3px rgba(99,102,241,.16); text-align: right; font-variant-numeric: tabular-nums;
  background: var(--surface); color: var(--text);
}

/* =========================================================================
   PILLS / BADGES
   ========================================================================= */
.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 700; white-space: nowrap; letter-spacing: .2px;
}
.pill::before { content:""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.gray { background: var(--border); color: var(--text-soft); }
.pill.green { background: var(--pos-soft); color: var(--pos); }
.pill.red { background: var(--neg-soft); color: var(--neg); }
.pill.amber { background: var(--warn-soft); color: var(--warn); }
.pill.blue { background: var(--info-soft); color: var(--info); }
.pill.violet { background: var(--brand-soft); color: var(--brand); }
.pill.plain::before { display: none; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 700; border: 1px solid transparent;
}
.badge.ok { background: var(--pos-soft); color: var(--pos); }
.badge.off { background: var(--warn-soft); color: var(--warn); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.flag-chip { font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; }

/* =========================================================================
   CHARTS (inline SVG)
   ========================================================================= */
.chart-box { width: 100%; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-legend { display: flex; gap: 18px; margin-top: 12px; flex-wrap: wrap; }
.leg { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-soft); font-weight: 500; }
.leg .swatch { width: 11px; height: 11px; border-radius: 3px; }
.chart-tip {
  position: fixed; pointer-events: none; z-index: 100; background: var(--sidebar); color: #fff;
  padding: 9px 12px; border-radius: 10px; font-size: 12px; box-shadow: var(--sh-lg);
  opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s; min-width: 130px;
}
.chart-tip.show { opacity: 1; transform: none; }
.chart-tip b { display: block; font-size: 11px; color: var(--text-invert-soft); font-weight: 600; margin-bottom: 5px; }
.chart-tip .row { display: flex; justify-content: space-between; gap: 16px; line-height: 1.7; }
.chart-tip .row span { color: var(--text-invert-soft); }
.chart-tip .row b { display: inline; color: #fff; font-weight: 700; margin: 0; }

.bar-list { display: flex; flex-direction: column; gap: 15px; }
.bar-item .bar-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; font-size: 13px; }
.bar-item .bar-top b { font-weight: 700; }
.bar-track { height: 9px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: var(--r-pill); transition: width .5s cubic-bezier(.2,.7,.2,1); }

/* =========================================================================
   FORMS / layout helpers
   ========================================================================= */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.divider { height: 1px; background: var(--border); margin: 20px 0; border: none; }

/* items editor (prep announce) */
.items-editor { display: flex; flex-direction: column; gap: 10px; }
.item-row {
  display: grid; grid-template-columns: 1fr 1fr 1.5fr 70px 1fr 34px; gap: 8px; align-items: center;
}
.item-row .input { padding: 7px 10px; }
.item-remove {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-mut); display: flex; align-items: center; justify-content: center; transition: all .14s;
}
.item-remove:hover { border-color: var(--neg); color: var(--neg); }
.item-remove svg { width: 15px; height: 15px; }

/* producttype picklist */
.pt-search { position: relative; }
.pt-list {
  margin-top: 8px; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden;
  max-height: 220px; overflow-y: auto; background: var(--surface); box-shadow: var(--sh);
}
.pt-opt { padding: 9px 13px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background .12s; }
.pt-opt:last-child { border-bottom: none; }
.pt-opt:hover { background: var(--brand-soft); }
.pt-opt b { font-weight: 600; }
.pt-opt .pt-name { font-family: var(--mono); font-size: 11.5px; color: var(--text-mut); }
.pt-selected { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--r-sm); background: var(--brand-soft); color: var(--brand); font-weight: 600; font-size: 13px; }
.pt-selected .x { cursor: pointer; opacity: .7; }
.pt-selected .x:hover { opacity: 1; }

/* listing result cards */
.result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 14px; }
.result-card { border: 1px solid var(--border); border-radius: var(--r); padding: 15px; background: var(--surface-2); }
.result-card.ok { border-left: 3px solid var(--pos); }
.result-card.bad { border-left: 3px solid var(--neg); }
.result-card .rc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.result-card .rc-mp { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 7px; }
.result-card .issue { font-size: 12.5px; color: var(--neg); padding: 6px 0; border-top: 1px dashed var(--border); }
.result-card .rc-sub { font-size: 11.5px; color: var(--text-mut); font-family: var(--mono); word-break: break-all; }

/* =========================================================================
   EU-LISTING · ASIN arbitrage flow
   ========================================================================= */
.pricing-bar { padding: 14px 18px; }
.pricing-bar .pricing-label { font-size: 13px; font-weight: 700; color: var(--text-soft); }

.lc-card { padding: 18px; }
.lc-card.bad { border-left: 3px solid var(--neg); }

.lc-head { display: flex; align-items: flex-start; gap: 14px; }
.lc-thumb {
  width: 84px; height: 84px; flex: 0 0 84px; border-radius: var(--r);
  object-fit: cover; background: var(--surface-2); border: 1px solid var(--border);
}
.lc-thumb.ph { display: flex; align-items: center; justify-content: center; color: var(--text-mut); }
.lc-thumb.ph svg { width: 30px; height: 30px; }
.lc-info { min-width: 0; flex: 1; padding-top: 2px; }
.lc-title {
  font-weight: 700; font-size: 15px; line-height: 1.3; letter-spacing: -.2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.lc-meta { margin-top: 5px; font-size: 12px; color: var(--text-mut); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.lc-meta .mono { font-size: 11.5px; }

.lc-error {
  display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 13px 15px;
  border-radius: var(--r); background: var(--neg-soft); color: var(--neg);
}
.lc-error svg { width: 22px; height: 22px; flex: 0 0 22px; }
.lc-error b { display: block; font-size: 13.5px; }
.lc-error span { font-size: 12.5px; opacity: .85; }

.lc-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; margin-top: 16px; align-items: start; }

.mp-table { border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.mp-row {
  display: grid; grid-template-columns: 1.1fr .9fr 1fr; gap: 10px; align-items: center;
  padding: 9px 13px; border-bottom: 1px solid var(--border);
}
.mp-row:last-child { border-bottom: none; }
.mp-row.mp-head {
  background: var(--surface-2); font-size: 10.5px; font-weight: 700; letter-spacing: .5px;
  text-transform: uppercase; color: var(--text-mut);
}
.mp-name { font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.mp-bb { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text-soft); font-size: 13px; }
.mp-price { padding: 7px 10px; text-align: right; font-variant-numeric: tabular-nums; }

.lc-side { display: flex; flex-direction: column; gap: 12px; }
.lc-side .lc-submit { margin-top: 4px; }

.lc-results:empty { display: none; }
.lc-results { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border); }
.lc-res-head { font-size: 12px; font-weight: 700; color: var(--text-soft); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 10px; }
.lc-res-list { display: flex; flex-direction: column; gap: 8px; }
.lc-res-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lc-res-row .mp-name { min-width: 130px; }
.lc-res-row .issue { width: 100%; font-size: 12.5px; color: var(--neg); }
.lc-freischalt {
  width: 100%; display: flex; align-items: flex-start; gap: 11px; margin-top: 4px;
  padding: 12px 14px; border-radius: var(--r); background: var(--warn-soft); color: var(--warn);
}
.lc-freischalt svg { width: 20px; height: 20px; flex: 0 0 20px; margin-top: 1px; }
.lc-freischalt b { display: block; font-size: 13.5px; }
.lc-freischalt span { font-size: 12.5px; opacity: .9; }

/* =========================================================================
   SETTINGS · grouped sections
   ========================================================================= */
.settings-group { margin-bottom: 22px; }
.settings-group:last-of-type { margin-bottom: 0; }
.settings-group-head {
  font-size: 11.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase;
  color: var(--text-mut); padding-bottom: 10px; margin-bottom: 14px; border-bottom: 1px solid var(--border);
}

/* =========================================================================
   SKELETON / EMPTY / TOAST
   ========================================================================= */
.skel { background: linear-gradient(100deg, var(--surface-2) 30%, var(--border) 50%, var(--surface-2) 70%);
  background-size: 220% 100%; animation: shimmer 1.3s infinite linear; border-radius: 7px; }
@keyframes shimmer { from { background-position: 220% 0; } to { background-position: -220% 0; } }
.skel-line { height: 12px; margin: 7px 0; }
.skel-kpi { height: 108px; border-radius: var(--r-lg); }
.skel-block { height: 260px; border-radius: var(--r-lg); }

.empty { text-align: center; padding: 46px 20px; color: var(--text-mut); }
.empty .ic {
  width: 56px; height: 56px; border-radius: 16px; background: var(--brand-soft); color: var(--brand);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 14px;
}
.empty .ic svg { width: 26px; height: 26px; }
.empty h4 { margin: 0 0 5px; color: var(--text); font-size: 15px; }
.empty p { margin: 0; font-size: 13px; }

.toast-wrap { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: flex-start; gap: 11px; padding: 13px 16px; border-radius: var(--r);
  background: var(--surface); box-shadow: var(--sh-lg); border: 1px solid var(--border);
  min-width: 280px; max-width: 380px; animation: toastIn .3s cubic-bezier(.2,.8,.2,1);
  border-left: 4px solid var(--brand);
}
.toast.ok { border-left-color: var(--pos); }
.toast.err { border-left-color: var(--neg); }
.toast.info { border-left-color: var(--info); }
.toast .t-ic { flex: 0 0 20px; margin-top: 1px; }
.toast .t-ic svg { width: 20px; height: 20px; }
.toast.ok .t-ic { color: var(--pos); }
.toast.err .t-ic { color: var(--neg); }
.toast.info .t-ic { color: var(--info); }
.toast .t-body b { display: block; font-size: 13.5px; margin-bottom: 1px; }
.toast .t-body span { font-size: 12.5px; color: var(--text-soft); }
.toast .t-close { margin-left: auto; background: none; border: none; color: var(--text-mut); font-size: 16px; line-height: 1; padding: 2px; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
.toast.out { animation: toastOut .25s forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

.spinner {
  width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite; display: inline-block;
}
.btn:not(.primary) .spinner { border-color: var(--border-strong); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================================
   LOGIN
   ========================================================================= */
.login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 100% -10%, #eef0ff 0%, transparent 55%),
              radial-gradient(900px 500px at -10% 110%, #f3e8ff 0%, transparent 50%),
              var(--bg);
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); box-shadow: var(--sh-lg); padding: 34px 32px; position: relative; overflow: hidden;
}
.login-card::before { content:""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, #7c7ff5, #6366f1, #a855f7); }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-brand .brand-badge { width: 54px; height: 54px; flex-basis: 54px; font-size: 24px; border-radius: 15px; }
.login-brand h1 { margin: 4px 0 0; font-size: 22px; font-weight: 800; letter-spacing: -.4px; }
.login-brand p { margin: 0; color: var(--text-mut); font-size: 13px; }
.login-form { display: flex; flex-direction: column; gap: 15px; }
.login-form .btn.primary { padding: 12px; font-size: 14.5px; margin-top: 4px; }
.login-err {
  display: none; align-items: center; gap: 8px; padding: 10px 13px; border-radius: var(--r-sm);
  background: var(--neg-soft); color: var(--neg); font-size: 13px; font-weight: 500;
}
.login-err.show { display: flex; }
.login-err svg { width: 16px; height: 16px; flex: 0 0 16px; }
.login-switch { text-align: center; margin-top: 16px; font-size: 13px; color: var(--text-soft); }
.login-switch a { font-weight: 700; margin-left: 4px; }
.login-switch a:hover { text-decoration: underline; }
.login-foot { text-align: center; margin-top: 20px; color: var(--text-mut); font-size: 12px; }

/* =========================================================================
   ONBOARDING BANNER
   ========================================================================= */
.onboard-banner {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 20px 24px; margin-bottom: 20px; border-radius: var(--r-lg);
  background: linear-gradient(135deg, #6b6ef4 0%, #4f46e5 100%);
  color: #fff; box-shadow: var(--sh-brand); position: relative; overflow: hidden;
}
.onboard-banner .ob-ic {
  width: 46px; height: 46px; border-radius: 13px; flex: 0 0 46px;
  background: rgba(255,255,255,.18); display: flex; align-items: center; justify-content: center;
}
.onboard-banner .ob-ic svg { width: 24px; height: 24px; }
.onboard-banner .ob-body { flex: 1; min-width: 220px; }
.onboard-banner .ob-body b { font-size: 15.5px; font-weight: 800; display: block; letter-spacing: -.2px; }
.onboard-banner .ob-body span { font-size: 13px; color: rgba(255,255,255,.85); }
.onboard-banner .btn {
  background: #fff; color: var(--brand-700); border-color: transparent; box-shadow: var(--sh-sm);
}
.onboard-banner .btn:hover { color: var(--brand-700); filter: brightness(.97); box-shadow: var(--sh); }

/* =========================================================================
   AMAZON ACCOUNTS PANEL
   ========================================================================= */
.acct-list { display: flex; flex-direction: column; gap: 12px; }
.acct-card {
  display: flex; align-items: flex-start; gap: 14px; padding: 15px 16px;
  border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2);
}
.acct-card .acct-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.acct-head { display: flex; align-items: center; gap: 9px; }
.acct-head b { font-size: 14.5px; font-weight: 700; }
.acct-spid { color: var(--text-soft); word-break: break-all; }
.acct-mps { display: flex; flex-wrap: wrap; gap: 6px; }
.acct-card .btn.danger { flex: 0 0 auto; }

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 1240px) {
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
  .grid.charts { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1024px) {
  :root { --sidebar-w: 72px; }
  .brand-word, .nav-item span.lbl, .nav-label, .user-meta, .nav-badge { display: none; }
  .sidebar-head, .nav-item { justify-content: center; }
  .nav-item { padding: 11px; }
  .user-card { justify-content: center; padding: 8px; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .form-grid, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .lc-grid { grid-template-columns: 1fr; }
  .item-row { grid-template-columns: 1fr 1fr; }
  .content { padding: 18px; }
  .topbar { padding: 0 16px; }
}
@media (max-width: 560px) {
  .kpi-row { grid-template-columns: 1fr; }
  .topbar h1 { font-size: 16px; }
  .topbar .sub { display: none; }
}
