/* ===== Tokens ===== */
:root {
  --bg: #f4f5fa;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --surface-3: #eef0f6;
  --border: #e6e8f0;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --primary: #4f46e5;
  --primary-2: #6366f1;
  --primary-soft: #eef2ff;
  --primary-text: #ffffff;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --success-text: #15803d;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --warning-text: #b45309;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --danger-text: #b91c1c;
  --info: #0284c7;
  --info-soft: #e0f2fe;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 6px 24px -8px rgba(15, 23, 42, .08);
  --shadow-lg: 0 20px 50px -12px rgba(15, 23, 42, .25);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar: 252px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1020; --surface: #121a2e; --surface-2: #161f36; --surface-3: #1c2742; --border: #243150;
    --text: #e8ecf5; --text-2: #c3cbdc; --muted: #8b97b0;
    --primary: #818cf8; --primary-2: #a5b4fc; --primary-soft: rgba(129, 140, 248, .14); --primary-text: #0b1020;
    --success: #22c55e; --success-soft: rgba(34, 197, 94, .14); --success-text: #4ade80;
    --warning: #f59e0b; --warning-soft: rgba(245, 158, 11, .14); --warning-text: #fbbf24;
    --danger: #f87171; --danger-soft: rgba(248, 113, 113, .14); --danger-text: #fca5a5;
    --info: #38bdf8; --info-soft: rgba(56, 189, 248, .14);
    --shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 8px 24px -10px rgba(0, 0, 0, .5);
    --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1020; --surface: #121a2e; --surface-2: #161f36; --surface-3: #1c2742; --border: #243150;
  --text: #e8ecf5; --text-2: #c3cbdc; --muted: #8b97b0;
  --primary: #818cf8; --primary-2: #a5b4fc; --primary-soft: rgba(129, 140, 248, .14); --primary-text: #0b1020;
  --success: #22c55e; --success-soft: rgba(34, 197, 94, .14); --success-text: #4ade80;
  --warning: #f59e0b; --warning-soft: rgba(245, 158, 11, .14); --warning-text: #fbbf24;
  --danger: #f87171; --danger-soft: rgba(248, 113, 113, .14); --danger-text: #fca5a5;
  --info: #38bdf8; --info-soft: rgba(56, 189, 248, .14);
  --shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 8px 24px -10px rgba(0, 0, 0, .5);
  --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* ===== Base ===== */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
p { margin: 0; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-3, .g-main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .g-2, .g-4 { grid-template-columns: minmax(0, 1fr); } }
.grid > * { min-width: 0; }

/* ===== Layout ===== */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); flex: none; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 30;
}
.brandmark { display: flex; align-items: center; gap: 12px; padding: 20px 20px 16px; }
.logo {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 16px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6 55%, #ec4899); box-shadow: 0 6px 16px -6px rgba(99, 102, 241, .7);
}
.brandmark .name { font-weight: 700; font-size: 15px; line-height: 1.2; }
.brandmark .sub { font-size: 11.5px; color: var(--muted); }
.nav { padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav .section { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 14px 10px 6px; font-weight: 600; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: var(--text-2); font-weight: 500;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-3); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav a .badge { margin-left: auto; }
.sidebar-foot { border-top: 1px solid var(--border); padding: 14px 16px; display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: var(--primary-soft); color: var(--primary); flex: none;
}
.sidebar-foot .who { min-width: 0; flex: 1; }
.sidebar-foot .who b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot .who span { font-size: 11.5px; color: var(--muted); text-transform: capitalize; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--border); }
.topbar .title { min-width: 0; }
.topbar .title p { color: var(--muted); font-size: 13px; }
.btn.menu-btn { display: none; }
.content { padding: 8px 28px 40px; max-width: 1440px; width: 100%; }
.scrim { display: none; }

@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .4); z-index: 25; }
  .btn.menu-btn { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .content { padding: 8px 16px 32px; }
  .topbar .hide-sm { display: none; }
}

/* ===== Cards ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-h p { color: var(--muted); font-size: 12.5px; }
.card-b { padding: 20px; }
.card-b.tight { padding: 8px 0; }
.card.pad { padding: 20px; }

.kpi { padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; }
.kpi .top { display: flex; align-items: center; justify-content: space-between; }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi .ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; }
.kpi .value { font-size: 26px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .foot { font-size: 12.5px; color: var(--muted); }
.ico.indigo { background: var(--primary-soft); color: var(--primary); }
.ico.green { background: var(--success-soft); color: var(--success); }
.ico.amber { background: var(--warning-soft); color: var(--warning); }
.ico.red { background: var(--danger-soft); color: var(--danger); }
.ico.blue { background: var(--info-soft); color: var(--info); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 15px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: 13.5px;
  cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; text-decoration: none !important;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg.i { width: 16px; height: 16px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); box-shadow: 0 4px 14px -6px var(--primary); }
.btn.primary:hover { background: var(--primary-2); border-color: var(--primary-2); }
.btn.success { background: var(--success); border-color: var(--success); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; }
.btn.xs { height: 28px; padding: 0 9px; font-size: 12px; border-radius: 8px; }
.btn.icon { width: 38px; padding: 0; }
.btn.sm.icon { width: 32px; }
.btn.xs.icon { width: 28px; }
.btn.block { width: 100%; }
.btn.lg { height: 46px; font-size: 15px; border-radius: 12px; }

/* ===== Forms ===== */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  color: var(--text); font: inherit; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.input.sm { height: 34px; font-size: 13px; padding: 0 10px; }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .prefix { position: absolute; left: 12px; color: var(--muted); font-size: 13px; pointer-events: none; }
.input-group .input { padding-left: 34px; }
.input-group.search .input { padding-left: 36px; }
.input-group.search svg { position: absolute; left: 11px; color: var(--muted); width: 17px; height: 17px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 13.5px; }
.check input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--primary); flex: none; }

.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice label {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1.5px solid var(--border); border-radius: 12px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.choice label:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.choice input { display: none; }
.choice .dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border); flex: none; margin-top: 1px; position: relative; }
.choice label.on { border-color: var(--primary); background: var(--primary-soft); }
.choice label.on .dot { border-color: var(--primary); }
.choice label.on .dot::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--primary); }
.choice b { display: block; font-size: 13.5px; }
.choice span { font-size: 12px; color: var(--muted); }
@media (max-width: 520px) { .choice { grid-template-columns: 1fr; } }

.dropzone {
  border: 1.5px dashed var(--border); border-radius: 12px; padding: 16px; text-align: center; cursor: pointer; color: var(--muted);
  transition: border-color .15s, background .15s; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 13px;
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.dropzone.has { border-style: solid; border-color: var(--success); background: var(--success-soft); color: var(--success-text); }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.t th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600;
  padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.t td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.t tr:last-child td { border-bottom: none; }
.t tbody tr { transition: background .1s; }
.t tbody tr:hover { background: var(--surface-2); }
.t tr.clickable { cursor: pointer; }
.t tr.voided td { opacity: .5; text-decoration: line-through; }
.t tr.voided td.keep { text-decoration: none; }
.t .actions { display: flex; gap: 6px; justify-content: flex-end; }
.t tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border); }
.prod b { display: block; font-weight: 600; }
.prod span { font-size: 12px; color: var(--muted); }

.items-table td { padding: 6px 6px; }
.items-table th { padding: 8px 6px; }
.items-table .input { height: 36px; }

/* ===== Pills & badges ===== */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.paid { background: var(--success-soft); color: var(--success-text); }
.pill.open { background: var(--warning-soft); color: var(--warning-text); }
.pill.none { background: var(--surface-3); color: var(--muted); }
.pill.red { background: var(--danger-soft); color: var(--danger-text); }
.pill.blue { background: var(--info-soft); color: var(--info); }
.pill.indigo { background: var(--primary-soft); color: var(--primary); }
.pill.plain::before { display: none; }
.badge { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--surface-3); color: var(--text-2); }
.badge.warn { background: var(--warning-soft); color: var(--warning-text); }
.badge.red { background: var(--danger-soft); color: var(--danger-text); }
.qty { display: inline-grid; place-items: center; min-width: 34px; height: 26px; padding: 0 8px; border-radius: 8px; font-weight: 700; background: var(--surface-3); font-variant-numeric: tabular-nums; }
.qty.low { background: var(--warning-soft); color: var(--warning-text); }
.qty.zero { background: var(--danger-soft); color: var(--danger-text); }

/* progress */
.progress { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), #8b5cf6); transition: width .4s; }
.progress.done > span { background: var(--success); }

/* ===== Tabs ===== */
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-3); border-radius: 12px; flex-wrap: wrap; }
.tabs button { border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; font-size: 13px; padding: 7px 14px; border-radius: 9px; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; }
.tabs button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ===== Toolbar ===== */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.toolbar .input-group.search { flex: 1; min-width: 200px; max-width: 360px; }
.toolbar select.input, .toolbar input[type="month"] { width: auto; min-width: 150px; }

/* ===== Brand cards ===== */
.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.brand-card { padding: 18px; display: flex; flex-direction: column; gap: 14px; cursor: pointer; transition: box-shadow .15s, transform .15s, border-color .15s; }
.brand-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
.brand-card .head { display: flex; gap: 12px; align-items: center; }
.brand-av { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 16px; color: #fff; flex: none; }
.brand-card .head h3 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-card .head p { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-card .bal { display: flex; justify-content: space-between; align-items: flex-end; }
.brand-card .bal .v { font-size: 22px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.brand-card .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.brand-card .stats div { font-size: 11.5px; color: var(--muted); }
.brand-card .stats b { display: block; font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums; }

/* hero for brand detail */
.hero { padding: 22px; display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.hero .brand-av { width: 56px; height: 56px; font-size: 22px; border-radius: 16px; }
.hero .meta { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-top: 6px; }
.hero .meta span { display: inline-flex; gap: 6px; align-items: center; }
.hero .meta svg.i { width: 15px; height: 15px; }
.account { padding: 22px; display: grid; grid-template-columns: repeat(3, 1fr) 1.3fr; gap: 20px; align-items: center; }
.account .lbl { font-size: 12px; color: var(--muted); font-weight: 500; }
.account .v { font-size: 22px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
@media (max-width: 900px) { .account { grid-template-columns: 1fr 1fr; } }

/* ===== Lists ===== */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: none; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .grow b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .grow span { font-size: 12px; color: var(--muted); }
a.list-item { color: inherit; }
a.list-item:hover { background: var(--surface-2); text-decoration: none; }
.act-dot { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.act-dot svg.i { width: 16px; height: 16px; }

/* statement */
.amount-pos { color: var(--danger-text); }
.amount-neg { color: var(--success-text); }

/* ===== Empty ===== */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .ico { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); margin-bottom: 4px; }
.empty .ico svg.i { width: 26px; height: 26px; }
.empty h3 { color: var(--text); font-size: 15px; }
.empty p { max-width: 380px; }

/* ===== Modal ===== */
.modal-back {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45); backdrop-filter: blur(3px); z-index: 100; display: flex;
  align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; animation: fade .15s;
}
.modal { width: 100%; max-width: 540px; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); animation: pop .18s ease-out; }
.modal.wide { max-width: 760px; }
.modal-h { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-h h2 { font-size: 17px; }
.modal-h p { font-size: 12.5px; color: var(--muted); }
.modal-b { padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.modal-f { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 18px 18px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

.callout { display: flex; gap: 12px; padding: 12px 14px; border-radius: 12px; font-size: 13px; align-items: flex-start; }
.callout svg.i { margin-top: 1px; }
.callout.info { background: var(--info-soft); color: var(--info); }
.callout.warn { background: var(--warning-soft); color: var(--warning-text); }
.callout.ok { background: var(--success-soft); color: var(--success-text); }
.callout.err { background: var(--danger-soft); color: var(--danger-text); }
.callout.neutral { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }

.summary-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.summary-box .line { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.summary-box .line.total { padding-top: 8px; border-top: 1px dashed var(--border); font-weight: 700; font-size: 15px; }

/* product picker */
.picker { position: relative; }
.picker-list {
  position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 280px; overflow-y: auto; padding: 6px;
}
.picker-list button { display: flex; width: 100%; gap: 10px; align-items: center; text-align: left; padding: 9px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; color: var(--text); font: inherit; }
.picker-list button:hover, .picker-list button.hl { background: var(--surface-3); }
.picker-list .grow { flex: 1; min-width: 0; }
.picker-list .grow span { display: block; font-size: 12px; color: var(--muted); }
.selected-product { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; height: 40px; }
.stepper button { width: 38px; height: 100%; border: 0; background: var(--surface-2); color: var(--text); font-size: 18px; cursor: pointer; }
.stepper button:hover { background: var(--surface-3); }
.stepper input { width: 56px; height: 100%; border: 0; text-align: center; font: inherit; font-weight: 700; background: var(--surface); color: var(--text); outline: none; }

/* ===== Toast ===== */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; gap: 10px; align-items: flex-start; min-width: 260px; max-width: 400px; padding: 12px 14px; border-radius: 12px;
  background: #0f172a; color: #f8fafc; box-shadow: var(--shadow-lg); font-size: 13.5px; animation: pop .2s ease-out;
}
.toast svg.i { margin-top: 1px; }
.toast.success svg.i { color: #4ade80; }
.toast.error svg.i { color: #f87171; }
.toast.info svg.i { color: #93c5fd; }
@media (max-width: 640px) { .toasts { left: 16px; right: 16px; } .toast { max-width: none; } }

/* ===== Auth ===== */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 10% -10%, rgba(99, 102, 241, .25), transparent 60%),
              radial-gradient(900px 500px at 110% 110%, rgba(236, 72, 153, .18), transparent 60%), var(--bg);
}
.auth-card { width: 100%; max-width: 420px; padding: 32px; border-radius: 22px; }
.auth-card .logo { width: 48px; height: 48px; font-size: 20px; border-radius: 14px; margin-bottom: 18px; }
.auth-card h1 { font-size: 24px; margin-bottom: 4px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 22px; }

.loading { display: grid; place-items: center; padding: 60px; color: var(--muted); }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--primary); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.chart-box { position: relative; height: 280px; }

.section-title { display: flex; align-items: center; gap: 10px; margin: 6px 0 2px; }

/* ===== Print (reports) ===== */
@media print {
  .sidebar, .topbar, .no-print, .toasts { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* small avatars */
.brand-av.sm { width: 28px; height: 28px; font-size: 11px; border-radius: 8px; }
.picker-list .brand-av, .selected-product .brand-av, .list-item .brand-av { width: 34px; height: 34px; font-size: 13px; border-radius: 10px; }
.topbar .title p svg.i { width: 14px; height: 14px; vertical-align: -2px; }
.topbar .title h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.t td .row b { white-space: nowrap; }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .form-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .form-grid.cols-4 { grid-template-columns: 1fr; } }
.scroll-list { max-height: 460px; overflow-y: auto; }
