/* Loyal Sports — Admin console (light, high-clarity theme) */
:root {
  --bg: #F4F6FA;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --border: #E5E8EF;
  --border-strong: #D3D8E2;
  --text: #0F172A;
  --text-2: #334155;
  --muted: #64748B;
  --faint: #94A3B8;

  --ink: #0B1220;
  --ink-2: #131C2E;
  --ink-3: #1E293B;

  --primary: #0E7490;
  --primary-hover: #155E75;
  --primary-soft: #E6F6FA;
  --gold: #F59E0B;
  --gold-soft: #FEF5E2;

  --amber: #B45309;   --amber-bg: #FEF3C7;
  --blue: #1D4ED8;    --blue-bg: #DBEAFE;
  --violet: #6D28D9;  --violet-bg: #EDE9FE;
  --green: #047857;   --green-bg: #D1FAE5;
  --red: #B91C1C;     --red-bg: #FEE2E2;
  --slate-bg: #EEF1F6;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .04);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, .14);
  --sidebar-w: 248px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
.i { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 15px; height: 15px; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 13px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hide { display: none !important; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  background: var(--ink); color: #CBD5E1;
  display: flex; flex-direction: column; z-index: 40;
  transition: transform .25s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 18px; }
.sidebar-brand img { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; }
.brand-name { font-weight: 800; letter-spacing: .08em; font-size: 14px; color: #fff; }
.brand-name b { color: var(--gold); font-weight: 800; }
.brand-sub { font-size: 11px; color: #64748B; letter-spacing: .04em; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 12px 16px; }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: #475569; padding: 16px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; margin: 1px 0;
  border-radius: 8px; color: #94A3B8; font-weight: 500; position: relative;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--ink-2); color: #E2E8F0; }
.nav-item.active { background: var(--ink-3); color: #fff; }
.nav-item.active::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
.nav-item.active .i { color: var(--gold); }
.nav-count { margin-left: auto; background: var(--gold); color: var(--ink); font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; min-width: 20px; text-align: center; }
.nav-count.soft { background: #1E293B; color: #CBD5E1; }
.sidebar-foot { border-top: 1px solid #1A2335; 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-shrink: 0; }
.sidebar-foot .avatar { background: #1E293B; color: var(--gold); }
.sidebar-foot .who { flex: 1; min-width: 0; }
.sidebar-foot .who strong { display: block; color: #fff; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot .who span { font-size: 11px; color: #64748B; }
.icon-link { color: #64748B; padding: 6px; border-radius: 6px; display: grid; place-items: center; }
.icon-link:hover { color: #fff; background: var(--ink-3); }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: 64px;
  display: flex; align-items: center; gap: 16px; padding: 0 28px;
  background: rgba(255, 255, 255, .88); backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 18px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-search { margin-left: auto; position: relative; width: 300px; max-width: 34vw; }
.topbar-search .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.topbar-search input { width: 100%; height: 38px; padding: 0 12px 0 36px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-2); outline: none; }
.topbar-search input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px var(--primary-soft); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.dot-badge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #E11D48; color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }
.menu-toggle { display: none; }
.content { padding: 28px; flex: 1; width: 100%; max-width: 1440px; }
.footer { padding: 18px 28px; color: var(--faint); font-size: 12px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--border); }
.footer a { color: var(--muted); font-weight: 600; }

/* ---------- Dropdown (notifications) ---------- */
.dropdown { position: relative; }
.dropdown-panel {
  position: absolute; right: 0; top: calc(100% + 8px); width: 360px; max-width: calc(100vw - 24px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); display: none; overflow: hidden; z-index: 60;
}
.dropdown-panel.open { display: block; animation: pop .14s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.dropdown-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 600; }
.dropdown-list { max-height: 380px; overflow-y: auto; }
.dropdown-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text); }
.dropdown-item:hover { background: var(--surface-2); color: var(--text); }
.dropdown-item .meta { flex: 1; min-width: 0; }
.dropdown-item .meta strong { display: block; font-size: 13px; }
.dropdown-item .meta span { font-size: 12px; color: var(--muted); }
.dropdown-sep { padding: 8px 16px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface-2); }
.dropdown-foot { display: block; text-align: center; padding: 11px; font-weight: 600; font-size: 13px; }
.dropdown-empty { padding: 28px 16px; text-align: center; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px; border-radius: 9px; border: 1px solid transparent;
  font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: var(--ink-3); color: #fff; }
.btn-outline { background: var(--surface); border-color: var(--border-strong); color: var(--text-2); }
.btn-outline:hover { background: var(--surface-2); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--slate-bg); color: var(--text); }
.btn-danger { background: var(--surface); color: var(--red); border-color: #F5C2C2; }
.btn-danger:hover { background: var(--red-bg); color: var(--red); }
.btn-success { background: #059669; color: #fff; }
.btn-success:hover { background: #047857; color: #fff; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn-xs { height: 28px; padding: 0 9px; font-size: 12px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2, .card-head h3 { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.card-head .sub { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.grid-chart { grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); }
.stack > * + * { margin-top: 20px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h2 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.page-head p { color: var(--muted); margin-top: 2px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 500; margin-bottom: 14px; }
.back-link:hover { color: var(--text); }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { padding: 18px 20px; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.kpi-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; }
.kpi-icon.teal { background: var(--primary-soft); color: var(--primary); }
.kpi-icon.gold { background: var(--gold-soft); color: #B45309; }
.kpi-icon.violet { background: var(--violet-bg); color: var(--violet); }
.kpi-icon.green { background: var(--green-bg); color: var(--green); }
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi-foot { margin-top: 6px; font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.delta { font-weight: 600; padding: 1px 6px; border-radius: 6px; font-size: 12px; }
.delta.up { color: var(--green); background: var(--green-bg); }
.delta.down { color: var(--red); background: var(--red-bg); }

/* ---------- Alerts / banners ---------- */
.flash-stack { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.flash { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 10px; border: 1px solid; font-weight: 500; }
.flash .i { margin-top: 1px; }
.flash-close { margin-left: auto; background: none; border: 0; cursor: pointer; color: inherit; opacity: .6; font-size: 18px; line-height: 1; }
.flash-success { background: #ECFDF5; border-color: #A7F3D0; color: #065F46; }
.flash-error { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }
.flash-warning { background: #FFFBEB; border-color: #FDE68A; color: #92400E; }
.flash-info { background: #EFF6FF; border-color: #BFDBFE; color: #1E40AF; }
.banner { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: var(--radius); background: linear-gradient(90deg, #FFF8E8, #FFFDF7); border: 1px solid #FBE3B0; margin-bottom: 20px; flex-wrap: wrap; }
.banner-icon { width: 38px; height: 38px; border-radius: 10px; background: var(--gold); color: var(--ink); display: grid; place-items: center; flex-shrink: 0; }
.banner-text { flex: 1; min-width: 220px; }
.banner-text strong { display: block; }
.banner-text span { color: var(--muted); font-size: 13px; }

/* ---------- Status pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 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.no-dot::before { display: none; }
.pill-pending { background: var(--amber-bg); color: var(--amber); }
.pill-confirmed { background: var(--blue-bg); color: var(--blue); }
.pill-shipped { background: var(--violet-bg); color: var(--violet); }
.pill-delivered { background: var(--green-bg); color: var(--green); }
.pill-cancelled { background: var(--red-bg); color: var(--red); }
.pill-paid { background: var(--green-bg); color: var(--green); }
.pill-unpaid { background: var(--slate-bg); color: #475569; }
.pill-refunded { background: var(--red-bg); color: var(--red); }
.pill-neutral { background: var(--slate-bg); color: #475569; }
.pill-gold { background: var(--gold-soft); color: #92400E; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); background: var(--surface-2); padding: 10px 16px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #FAFBFD; }
.table tr.is-new { animation: flashrow 2.5s ease; }
@keyframes flashrow { 0% { background: #FFF6D9; } 100% { background: transparent; } }
.table .check { width: 36px; padding-right: 0; }
.cell-title { font-weight: 600; color: var(--text); }
.cell-title:hover { color: var(--primary); }
.cell-sub { font-size: 12px; color: var(--muted); }
.order-no { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-weight: 600; font-size: 13px; color: var(--text); }
a.order-no:hover { color: var(--primary); }
.thumb { width: 44px; height: 44px; border-radius: 9px; object-fit: cover; background: var(--slate-bg); border: 1px solid var(--border); display: grid; place-items: center; color: var(--faint); flex-shrink: 0; }
.thumb-lg { width: 64px; height: 64px; }
.row-flex { display: flex; align-items: center; gap: 12px; min-width: 0; }
.empty { padding: 56px 20px; text-align: center; color: var(--muted); }
.empty .i { width: 40px; height: 40px; color: var(--faint); margin: 0 auto 10px; stroke-width: 1.4; }
.empty strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* ---------- Tabs / toolbar ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 12px; overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 13px 10px 12px; color: var(--muted); font-weight: 600; font-size: 13.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--primary); }
.tab .count { font-size: 11.5px; background: var(--slate-bg); color: var(--muted); padding: 0 7px; border-radius: 999px; font-weight: 600; }
.tab.active .count { background: var(--primary-soft); color: var(--primary); }
.toolbar { display: flex; gap: 10px; padding: 14px 16px; flex-wrap: wrap; align-items: center; border-bottom: 1px solid var(--border); }
.toolbar .grow { flex: 1; min-width: 200px; }
.bulkbar { display: none; align-items: center; gap: 10px; padding: 10px 16px; background: var(--primary-soft); border-bottom: 1px solid #BFE6EF; flex-wrap: wrap; }
.bulkbar.show { display: flex; }
.bulkbar strong { color: var(--primary); }
.segmented { display: inline-flex; background: var(--slate-bg); border-radius: 9px; padding: 3px; gap: 2px; }
.segmented a { padding: 6px 12px; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: 13px; }
.segmented a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--border-strong);
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s; font-size: 14px;
}
.textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 84px; line-height: 1.5; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%2364748B' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; cursor: pointer; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input-sm, .select-sm { height: 32px; font-size: 13px; }
.input-group { position: relative; }
.input-group .prefix { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; pointer-events: none; }
.input-group .input { padding-left: 28px; }
.input-icon { position: relative; }
.input-icon .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.input-icon .input { padding-left: 34px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .span-2 { grid-column: span 2; }
.check-row { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; }
.check-row:hover { background: var(--surface-2); }
.check-row input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--primary); }
.check-row strong { display: block; font-size: 13.5px; }
.check-row span { font-size: 12px; color: var(--muted); }
input[type=checkbox] { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }
.switch { position: relative; width: 36px; height: 20px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; border-radius: 999px; background: #CBD5E1; transition: .2s; cursor: pointer; }
.switch .track::after { content: ''; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(16px); }
.dropzone { border: 1.5px dashed var(--border-strong); border-radius: 12px; padding: 18px; display: flex; align-items: center; gap: 16px; background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-soft); }
.dropzone img { width: 84px; height: 84px; border-radius: 10px; object-fit: cover; border: 1px solid var(--border); }
.dropzone .ph { width: 84px; height: 84px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; color: var(--faint); }

/* ---------- Chart ---------- */
.chart { display: flex; align-items: flex-end; gap: 6px; height: 220px; padding: 10px 4px 0; position: relative; }
.chart-gridlines { position: absolute; inset: 10px 0 24px; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.chart-gridlines span { border-top: 1px dashed var(--border); }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; position: relative; z-index: 1; }
.bar { width: 100%; max-width: 30px; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, #22B8D6, var(--primary)); min-height: 3px; transition: opacity .15s; position: relative; }
.bar.zero { background: var(--border); }
.bar-col:hover .bar { opacity: .85; }
.bar-col .tip { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 11.5px; padding: 6px 9px; border-radius: 7px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 5; }
.bar-col:hover .tip { opacity: 1; }
.bar-label { font-size: 11px; color: var(--faint); margin-top: 8px; height: 16px; }
.breakdown-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; }
.breakdown-row + .breakdown-row { border-top: 1px solid var(--border); }
.breakdown-row .lbl { flex: 1; font-weight: 500; }
.meter { height: 6px; background: var(--slate-bg); border-radius: 999px; overflow: hidden; width: 90px; }
.meter span { display: block; height: 100%; border-radius: 999px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.rank { width: 24px; height: 24px; border-radius: 7px; background: var(--slate-bg); color: var(--muted); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.stock-badge { font-weight: 700; font-size: 12px; padding: 2px 8px; border-radius: 6px; }
.stock-ok { background: var(--green-bg); color: var(--green); }
.stock-low { background: var(--amber-bg); color: var(--amber); }
.stock-out { background: var(--red-bg); color: var(--red); }

/* ---------- Order detail ---------- */
.stepper { display: flex; padding: 22px 20px; gap: 0; }
.step { flex: 1; text-align: center; position: relative; }
.step::before { content: ''; position: absolute; top: 15px; left: -50%; right: 50%; height: 3px; background: var(--border); z-index: 0; }
.step:first-child::before { display: none; }
.step.done::before { background: var(--primary); }
.step-dot { width: 32px; height: 32px; border-radius: 50%; margin: 0 auto 8px; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--border-strong); color: var(--faint); position: relative; z-index: 1; font-weight: 700; font-size: 13px; }
.step.done .step-dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.step.current .step-dot { box-shadow: 0 0 0 5px var(--primary-soft); }
.step-label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.step.done .step-label { color: var(--text); }
.cancelled-strip { margin: 16px 20px; padding: 12px 14px; border-radius: 10px; background: var(--red-bg); color: var(--red); font-weight: 600; display: flex; gap: 8px; align-items: center; }
.totals { margin-left: auto; max-width: 340px; padding: 16px 20px; }
.totals-row { display: flex; justify-content: space-between; padding: 5px 0; color: var(--text-2); }
.totals-row.grand { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 12px; font-size: 16px; font-weight: 700; color: var(--text); }
.totals-row .etb { display: block; text-align: right; font-size: 12px; color: var(--muted); font-weight: 500; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 10px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { font-weight: 500; word-break: break-word; }
.address-box { padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); line-height: 1.6; }
.timeline { list-style: none; position: relative; }
.timeline li { position: relative; padding: 0 0 18px 28px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ''; position: absolute; left: 7px; top: 18px; bottom: -2px; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.tl-dot { position: absolute; left: 0; top: 3px; width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); background: var(--faint); }
.tl-dot.pending { background: var(--gold); }
.tl-dot.confirmed { background: var(--blue); }
.tl-dot.shipped { background: var(--violet); }
.tl-dot.delivered { background: var(--green); }
.tl-dot.cancelled { background: var(--red); }
.tl-title { font-weight: 600; font-size: 13.5px; }
.tl-note { font-size: 13px; color: var(--text-2); margin-top: 3px; white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--border); padding: 7px 10px; border-radius: 8px; }
.tl-meta { font-size: 12px; color: var(--faint); margin-top: 2px; }
.quick-advance { padding: 16px 20px; border-bottom: 1px solid var(--border); background: linear-gradient(180deg, var(--primary-soft), transparent); }

/* ---------- Products grid ---------- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; padding: 16px; }
.p-card { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); display: flex; flex-direction: column; transition: box-shadow .15s, border-color .15s; }
.p-card:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }
.p-media { position: relative; aspect-ratio: 4 / 3; background: var(--slate-bg); }
.p-media img { width: 100%; height: 100%; object-fit: cover; }
.p-media .ph { width: 100%; height: 100%; display: grid; place-items: center; color: var(--faint); }
.p-flags { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.p-flags .pill { box-shadow: var(--shadow-sm); }
.p-body { padding: 14px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.p-cat { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--primary); }
.p-name { font-weight: 650; line-height: 1.35; color: var(--text); }
.p-price { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.p-price strong { font-size: 16px; }
.p-price s { color: var(--faint); font-size: 13px; }
.p-meta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); margin-top: auto; padding-top: 8px; }
.p-actions { display: flex; gap: 6px; padding: 10px 14px; border-top: 1px solid var(--border); background: var(--surface-2); align-items: center; }
.p-actions form { display: contents; }
.stock-form { display: flex; gap: 4px; margin-left: auto; }
.stock-form .input { width: 64px; height: 28px; font-size: 12.5px; padding: 0 8px; }

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pagination .pages { display: flex; gap: 4px; }

/* ---------- Messages ---------- */
.msg { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; gap: 14px; }
.msg:last-child { border-bottom: 0; }
.msg.unread { background: linear-gradient(90deg, #F2FBFD, transparent 40%); }
.msg-body { flex: 1; min-width: 0; }
.msg-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.msg-subject { font-weight: 650; margin-top: 2px; }
.msg-text { color: var(--text-2); margin-top: 6px; white-space: pre-wrap; word-break: break-word; }
.msg-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast { width: 340px; max-width: calc(100vw - 40px); background: var(--ink); color: #fff; border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow-lg); display: flex; gap: 12px; animation: slidein .25s ease; }
.toast .ico { width: 34px; height: 34px; border-radius: 9px; background: var(--gold); color: var(--ink); display: grid; place-items: center; flex-shrink: 0; }
.toast strong { display: block; }
.toast span { font-size: 12.5px; color: #CBD5E1; }
.toast a { color: var(--gold); font-weight: 600; font-size: 12.5px; }
@keyframes slidein { from { transform: translateY(12px); opacity: 0; } }

/* ---------- Login ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-art { background: radial-gradient(circle at 25% 20%, rgba(6, 182, 212, .25), transparent 45%), radial-gradient(circle at 80% 85%, rgba(245, 158, 11, .2), transparent 45%), var(--ink); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-art h2 { font-size: 34px; line-height: 1.15; letter-spacing: -.02em; max-width: 420px; }
.auth-art h2 b { color: var(--gold); }
.auth-art p { color: #94A3B8; margin-top: 12px; max-width: 400px; }
.auth-feats { display: grid; gap: 12px; margin-top: 28px; }
.auth-feats div { display: flex; gap: 10px; align-items: center; color: #CBD5E1; }
.auth-feats .i { color: var(--gold); }
.auth-form { display: grid; place-items: center; padding: 32px; background: var(--surface); }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 24px; letter-spacing: -.02em; }

/* ---------- Content editor ---------- */
.feature-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--surface-2); }
.side-tabs { display: flex; flex-direction: column; gap: 2px; padding: 8px; }
.side-tab { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--text-2); font-weight: 500; }
.side-tab:hover { background: var(--surface-2); color: var(--text); }
.side-tab.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.key-tag { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; color: var(--faint); }

/* ---------- Responsive ---------- */
.backdrop { display: none; }
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main, .grid-chart { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .backdrop.open { display: block; position: fixed; inset: 0; background: rgba(11, 18, 32, .45); z-index: 35; }
  .main { margin-left: 0; }
  .menu-toggle { display: grid; }
  .topbar { padding: 0 16px; }
  .topbar-search { display: none; }
  .topbar-actions { margin-left: auto; }
  .content { padding: 20px 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { display: none; }
}
@media (max-width: 600px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: 12px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 20px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .topbar .hide-sm { display: none; }
  .table td, .table th { padding: 10px 12px; }
  .stepper { padding: 18px 8px; }
  .step-label { font-size: 11px; }
}

/* ---------- Print (invoice) ---------- */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
}
