/* ==========================================================
   SuperPOS Theme v2.0 — "Soft ERP" style
   White cards + gradient accents, outlined sidebar, pastel toolbar
   Light / Dark mode: <html data-theme="light|dark">
   ========================================================== */

:root {
  --font: "Inter", "Hind Siliguri", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Inter", system-ui, sans-serif;

  --bg: #f3f4f9;
  --surface: #ffffff;
  --surface-2: #f7f7fb;
  --ink: #1f2335;
  --ink-2: #3c4257;
  --muted: #8a90a6;
  --line: #e7e8f0;
  --line-2: #f0f1f6;

  --primary: #7357f6;           /* violet */
  --primary-600: #6045e8;
  --primary-50: #efebff;
  --primary-ink: #ffffff;
  --grad-primary: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
  --grad-line: linear-gradient(90deg, #f472b6 0%, #a855f7 45%, #6366f1 100%);
  --grad-title: linear-gradient(90deg, #ec4899, #a855f7);

  --accent: #f26b1d;            /* POS orange */
  --grad-accent: linear-gradient(135deg, #ff8a3d 0%, #f2541b 100%);
  --accent-50: #fff0e6;
  --success: #12a150;
  --success-50: #e5f7ed;
  --danger: #ef4444;
  --danger-50: #fdecec;
  --warning: #d98a04;
  --warning-50: #fff5df;
  --info: #3b82f6;
  --info-50: #e8f0fe;
  --pink-50: #fdebf4;
  --mint-50: #e3f7ee;

  /* gradient icon tiles */
  --g-violet: linear-gradient(135deg, #8b5cf6, #6366f1);
  --g-green:  linear-gradient(135deg, #34d399, #10b981);
  --g-pink:   linear-gradient(135deg, #f9a8d4, #ec4899);
  --g-orange: linear-gradient(135deg, #fdba74, #f97316);
  --g-cyan:   linear-gradient(135deg, #67e8f9, #06b6d4);
  --g-red:    linear-gradient(135deg, #fca5a5, #ef4444);
  --g-amber:  linear-gradient(135deg, #fcd34d, #f59e0b);
  --g-blue:   linear-gradient(135deg, #93c5fd, #3b82f6);
  --g-teal:   linear-gradient(135deg, #5eead4, #14b8a6);

  --sidebar-bg: #ffffff;
  --sidebar-ink: #2f3447;
  --sidebar-muted: #9aa0b4;
  --sidebar-item-border: #ebecf3;
  --sidebar-active-bg: #eeeaff;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(31, 35, 53, .04), 0 2px 8px rgba(31, 35, 53, .04);
  --shadow: 0 6px 24px rgba(31, 35, 53, .07);
  --shadow-lg: 0 24px 60px rgba(31, 35, 53, .18);

  --sidebar-w: 268px;
  --topbar-h: 76px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0f1120;
  --surface: #181b2e;
  --surface-2: #1f2338;
  --ink: #eceefa;
  --ink-2: #c7cbe0;
  --muted: #8c92ad;
  --line: #2a2f48;
  --line-2: #22263c;
  --primary: #9b85ff;
  --primary-600: #ad9bff;
  --primary-50: #2a2550;
  --accent-50: #3a2414;
  --success-50: #12301f;
  --danger-50: #3a1a1e;
  --warning-50: #382a0e;
  --info-50: #172647;
  --pink-50: #3a1830;
  --mint-50: #133127;
  --sidebar-bg: #151829;
  --sidebar-ink: #d4d8ea;
  --sidebar-item-border: #262a42;
  --sidebar-active-bg: #2a2550;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow: 0 6px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 24px 60px rgba(0,0,0,.55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0; }
.num, .mono { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-right { text-align: right; }
svg.lucide { width: 18px; height: 18px; stroke-width: 1.8; flex-shrink: 0; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--sidebar-bg); color: var(--sidebar-ink);
  position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 40;
  border-right: 1px solid var(--line); transition: transform .2s ease;
}
.brand { height: var(--topbar-h); display: flex; align-items: center; gap: 10px; padding: 0 22px; border-bottom: 1px solid var(--line); font-weight: 800; font-size: 22px; color: var(--ink); letter-spacing: -.02em; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--grad-primary); display: grid; place-items: center; color: #fff; box-shadow: 0 6px 16px rgba(115,87,246,.35); }
.brand-mark svg.lucide { width: 22px; height: 22px; }
.brand b { background: linear-gradient(90deg, #4338ca, #7357f6); -webkit-background-clip: text; background-clip: text; color: transparent; }
[data-theme="dark"] .brand b { background: linear-gradient(90deg, #a5b4fc, #c4b5fd); -webkit-background-clip: text; background-clip: text; }
.brand small { display: block; font-size: 10.5px; font-weight: 600; color: var(--muted); letter-spacing: .02em; margin-top: -2px; }
.nav { flex: 1; overflow-y: auto; padding: 14px 14px 24px; scrollbar-width: thin; scrollbar-color: #c9c3f5 transparent; }
.nav-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--sidebar-muted); padding: 14px 6px 6px; }
.nav-item, .nav-sub a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; margin-bottom: 6px;
  border: 1px solid var(--sidebar-item-border); border-radius: 8px; background: var(--sidebar-bg);
  color: var(--sidebar-ink); font-weight: 500; font-size: 13.5px; cursor: pointer; width: 100%;
  font-family: var(--font); text-align: left; box-shadow: 0 1px 2px rgba(31,35,53,.03);
  transition: background .15s, border-color .15s, color .15s;
}
.nav-item:hover, .nav-sub a:hover { border-color: #cfc6ff; color: var(--primary); }
.nav-item.active { background: var(--sidebar-active-bg); border-color: #c9bdff; color: var(--primary); font-weight: 600; box-shadow: inset 3px 0 0 var(--primary), 0 2px 8px rgba(115,87,246,.15); }
.nav-item .chev { margin-left: auto; width: 15px; height: 15px; transition: transform .2s; color: var(--muted); }
.nav-group.open > .nav-item .chev { transform: rotate(-90deg); }
.nav-item .count { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--danger-50); color: var(--danger); padding: 1px 7px; border-radius: 99px; }
.nav-sub { display: none; padding-left: 14px; margin: -2px 0 6px; border-left: 2px dashed var(--line); margin-left: 18px; }
.nav-group.open .nav-sub { display: block; }
.nav-sub a { padding: 7px 10px; font-size: 13px; margin-bottom: 4px; box-shadow: none; }
.nav-sub a.active { color: var(--primary); border-color: #c9bdff; background: var(--sidebar-active-bg); font-weight: 600; }
.nav-sub a::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .45; }
.sidebar-foot { padding: 14px; border-top: 1px solid var(--line); }
.sell-cta { display: flex; align-items: center; justify-content: center; gap: 8px; background: var(--grad-accent); color: #fff; font-weight: 700; padding: 11px; border-radius: 10px; box-shadow: 0 8px 20px rgba(242,84,27,.3); }
.sell-cta .kbd { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.35); color: #fff; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar { height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; padding: 0 22px; position: sticky; top: 0; z-index: 30; }
.topbar .search { flex: 1; max-width: 380px; position: relative; }
.topbar .search input { padding-left: 38px; background: var(--surface-2); border-color: transparent; }
.topbar .search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.topbar .spacer { flex: 1; }
.icon-btn { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; border: 0; background: var(--surface-2); color: var(--ink-2); cursor: pointer; position: relative; transition: transform .1s, filter .15s; }
.icon-btn:hover { filter: brightness(.97); transform: translateY(-1px); }
.icon-btn.wide { width: 64px; }
.icon-btn .dot { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; background: var(--danger); border-radius: 50%; border: 2px solid var(--surface); }
.t-blue { background: #dfe9fb; color: #3b5bdb; }
.t-violet { background: #efe8ff; color: #7c3aed; }
.t-peach { background: #ffeedd; color: #ea580c; }
.t-mint { background: #dcf5e8; color: #059669; }
.t-pink { background: #fde4ec; color: #db2777; }
[data-theme="dark"] .t-blue { background: #1c2a4d; color: #93b4ff; }
[data-theme="dark"] .t-violet { background: #2a2350; color: #c4b5fd; }
[data-theme="dark"] .t-peach { background: #3a2716; color: #fdba74; }
[data-theme="dark"] .t-mint { background: #13342a; color: #6ee7b7; }
[data-theme="dark"] .t-pink { background: #3a1a2b; color: #f9a8d4; }
.pos-pill { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 20px; border-radius: 11px; background: var(--grad-accent); color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .03em; box-shadow: 0 8px 18px rgba(242,84,27,.35); }
.date-pill { height: 42px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--line); display: inline-flex; align-items: center; font-size: 12.5px; font-weight: 600; color: var(--ink-2); background: var(--surface); }
.menu-toggle { display: grid; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.user-btn { border: 2px solid var(--line); padding: 0; background: var(--surface); cursor: pointer; }
.register-pill { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; background: var(--success-50); color: var(--success); padding: 6px 11px; border-radius: 99px; }
.register-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
body.sb-collapsed .sidebar { transform: translateX(-100%); }
body.sb-collapsed .main { margin-left: 0; }

/* dropdown */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; display: none; z-index: 60; }
.dropdown.open .dropdown-menu { display: block; animation: fade .12s; }
.dropdown-menu a, .dropdown-menu button { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 8px; color: var(--ink-2); font: 500 13.5px var(--font); width: 100%; border: 0; background: none; cursor: pointer; text-align: left; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); color: var(--primary); }
.dropdown-head { padding: 10px 11px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.dropdown-head b { display: block; }
.dropdown-head span { font-size: 12px; color: var(--muted); }

.content { padding: 22px; max-width: 1560px; width: 100%; }
.page-head { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; background: var(--surface); border-radius: var(--radius-lg); padding: 24px 26px; box-shadow: var(--shadow-sm); overflow: hidden; }
.page-head::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--grad-line); }
.page-head h1 { font-size: 24px; font-weight: 800; background: var(--grad-title); -webkit-background-clip: text; background-clip: text; color: transparent; display: inline-block; }
.page-head p { color: var(--muted); margin-top: 6px; font-size: 13.5px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.breadcrumb { font-size: 12px; color: var(--muted); margin-bottom: 4px; }

/* ---------- Grid ---------- */
.grid { display: grid; gap: 18px; }
.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, 2fr) minmax(0, 1fr); }
.g-dash { grid-template-columns: minmax(0, 3fr) minmax(320px, 1.15fr); align-items: start; }
.span-2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.mt-16 { margin-top: 18px; }

/* ---------- Card ---------- */
.card { background: var(--surface); border: 0; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); position: relative; }
.card.accent-top { overflow: hidden; }
.card.accent-top::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--grad-line); z-index: 1; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line-2); }
.card-head h3 { font-size: 15.5px; font-weight: 700; }
.card-head p { font-size: 12.5px; color: var(--muted); }
.card-title { display: flex; align-items: center; gap: 12px; }
.card-title h3 { font-size: 18px; color: var(--primary); }
.card-body { padding: 20px; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--line-2); display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 13px; }

/* ---------- KPI tiles ---------- */
.kpi { padding: 18px; display: flex; flex-direction: column; gap: 8px; transition: transform .15s, box-shadow .15s; overflow: hidden; }
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.kpi:hover::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--grad-line); }
.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 6px; }
.kpi-label { font-size: 10.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .07em; }
.kpi-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.kpi-icon.g { color: #fff; box-shadow: 0 6px 14px rgba(31,35,53,.12); }
.kpi-icon.g svg.lucide { width: 19px; height: 19px; }
.kpi-value { font-size: 23px; font-weight: 500; letter-spacing: -.01em; color: var(--ink); }
.kpi-value.sm { font-size: 14px; font-weight: 600; }
.tag-pill { font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); background: var(--surface-2); padding: 3px 9px; border-radius: 6px; }
.trend { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.trend svg.lucide { width: 14px; height: 14px; }
.trend.up { color: var(--success); }
.trend.down { color: var(--danger); }
.tint-primary { background: var(--primary-50); color: var(--primary); }
.tint-accent { background: var(--accent-50); color: var(--accent); }
.tint-info { background: var(--info-50); color: var(--info); }
.tint-danger { background: var(--danger-50); color: var(--danger); }
.tint-success { background: var(--success-50); color: var(--success); }
.g-violet { background: var(--g-violet); } .g-green { background: var(--g-green); } .g-pink { background: var(--g-pink); }
.g-orange { background: var(--g-orange); } .g-cyan { background: var(--g-cyan); } .g-red { background: var(--g-red); }
.g-amber { background: var(--g-amber); } .g-blue { background: var(--g-blue); } .g-teal { background: var(--g-teal); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 13.5px var(--font); cursor: pointer; white-space: nowrap; transition: filter .15s, background .15s, transform .05s; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--grad-primary); border: 0; color: #fff; box-shadow: 0 8px 18px rgba(115,87,246,.3); }
.btn-primary:hover { background: var(--grad-primary); filter: brightness(1.06); }
.btn-accent { background: var(--grad-accent); border: 0; color: #fff; box-shadow: 0 8px 18px rgba(242,84,27,.28); }
.btn-accent:hover { background: var(--grad-accent); filter: brightness(1.05); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger); filter: brightness(1.05); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-soft { background: var(--primary-50); color: var(--primary); border-color: transparent; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 50px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 32px; padding: 0; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, .select, textarea.input { width: 100%; height: 42px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: 400 14px var(--font); outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; padding: 10px 13px; min-height: 84px; resize: vertical; }
.input:focus, .select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-50); }
.input-group { display: flex; }
.input-group .input { border-radius: 10px 0 0 10px; }
.input-group .btn { border-radius: 0 10px 10px 0; border-left: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #d9dbe6; border-radius: 99px; cursor: pointer; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--grad-primary); }
.switch input:checked + span::before { transform: translateX(18px); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line-2); }
.setting-row:last-child { border-bottom: 0; }
.setting-row b { display: block; font-size: 14px; }
.setting-row span { font-size: 12.5px; color: var(--muted); }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.toolbar .input, .toolbar .select { height: 38px; width: auto; min-width: 150px; }
.toolbar .grow { flex: 1; min-width: 200px; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); background: var(--surface-2); padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table.compact td { padding: 10px 16px; font-size: 13px; }
.amt { color: var(--success); font-weight: 500; }
.cell-item { display: flex; align-items: center; gap: 11px; }
.cell-item b { display: block; font-weight: 600; }
.cell-item span { font-size: 12px; color: var(--muted); }
.thumb { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; font-size: 18px; background: var(--surface-2); flex-shrink: 0; }
.pagination { display: flex; gap: 4px; }
.pagination button { min-width: 32px; height: 32px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 8px; cursor: pointer; font: 600 12.5px var(--font); }
.pagination button.active { background: var(--grad-primary); color: #fff; border: 0; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.badge-success { background: var(--success-50); color: var(--success); }
.badge-danger { background: var(--danger-50); color: var(--danger); }
.badge-warning { background: var(--warning-50); color: var(--warning); }
.badge-info { background: var(--info-50); color: var(--info); }
.badge-primary { background: var(--primary-50); color: var(--primary); }
.badge-muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 20px; overflow-x: auto; }
.tab { padding: 15px 12px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; background: none; border-top: 0; border-left: 0; border-right: 0; font-family: var(--font); font-size: 13.5px; white-space: nowrap; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 7px 13px; border-radius: 8px; font: 600 12.5px var(--font); color: var(--muted); cursor: pointer; }
.seg button.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line-2); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list b { display: block; font-weight: 600; }
.list small { color: var(--muted); }
.progress { height: 7px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--grad-primary); border-radius: 99px; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(20, 18, 40, .5); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal.open { display: flex; animation: fade .15s ease; }
.modal-box { background: var(--surface); border-radius: 18px; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; box-shadow: var(--shadow-lg); position: relative; }
.modal-box::before { content: ""; position: sticky; display: block; top: 0; height: 3px; background: var(--grad-line); z-index: 2; }
.modal-box.lg { max-width: 840px; }
.modal-box.sm { max-width: 360px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 22px; border-bottom: 1px solid var(--line-2); }
.modal-head h3 { font-size: 17px; font-weight: 700; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line-2); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* calculator */
.calc-screen { background: var(--surface-2); border-radius: 12px; padding: 14px 16px; text-align: right; font-size: 28px; font-weight: 600; min-height: 64px; word-break: break-all; }
.calc-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.calc-keys button { height: 50px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); font: 600 17px var(--font); color: var(--ink); cursor: pointer; }
.calc-keys button.op { background: var(--primary-50); color: var(--primary); border-color: transparent; }
.calc-keys button.eq { background: var(--grad-primary); color: #fff; border: 0; }

/* FAB */
.fab { position: fixed; right: 24px; bottom: 24px; width: 56px; height: 56px; border-radius: 16px; background: var(--grad-primary); color: #fff; border: 0; display: grid; place-items: center; cursor: pointer; box-shadow: 0 12px 28px rgba(115,87,246,.45); z-index: 50; }
.fab svg.lucide { width: 24px; height: 24px; }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick-grid a { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 8px; border-radius: 12px; border: 1px solid var(--line); color: var(--ink-2); font-weight: 600; font-size: 12.5px; text-align: center; }
.quick-grid a:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; bottom: 92px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: #1f2335; color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 600; font-size: 13.5px; display: flex; gap: 8px; align-items: center; animation: fade .2s; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty svg { width: 40px; height: 40px; margin-bottom: 8px; opacity: .5; }
.divider { height: 1px; background: var(--line-2); margin: 14px 0; }
.kbd { font-size: 11px; padding: 2px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: var(--surface-2); color: var(--muted); font-weight: 600; }
.chart-box { position: relative; height: 290px; }
.chart-box.sm { height: 220px; }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.module-card { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.module-card .row b { font-size: 15px; }
.module-card p { color: var(--muted); font-size: 13px; flex: 1; }
.code-chip { display: inline-block; font-family: ui-monospace, Consolas, monospace; font-size: 12px; background: var(--primary-50); color: var(--primary); padding: 2px 7px; border-radius: 6px; margin: 2px; }

/* ==========================================================
   POS SELL SCREEN
   ========================================================== */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 430px; grid-template-rows: 100%; height: 100vh; overflow: hidden; }
.pos-left { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pos-left .product-grid, .pos-right .cart-items { min-height: 0; }
.pos-top { height: 70px; display: flex; align-items: center; gap: 10px; padding: 0 18px; background: var(--surface); border-bottom: 1px solid var(--line); }
.pos-search { flex: 1; position: relative; }
.pos-search input { height: 46px; padding-left: 44px; font-size: 15px; background: var(--surface-2); border-color: transparent; }
.pos-search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--primary); }
.pos-search .kbd { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); }
.cat-bar { display: flex; gap: 8px; padding: 14px 18px; overflow-x: auto; scrollbar-width: none; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font: 600 13px var(--font); color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.chip.active { background: var(--grad-primary); color: #fff; border-color: transparent; box-shadow: 0 6px 14px rgba(115,87,246,.3); }
.chip small { font-weight: 500; opacity: .7; }
.product-grid { flex: 1; overflow-y: auto; padding: 4px 18px 18px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; align-content: start; }
.p-card { background: var(--surface); border: 1px solid transparent; border-radius: 14px; padding: 12px; cursor: pointer; text-align: left; font-family: var(--font); color: var(--ink); transition: border-color .15s, box-shadow .15s, transform .1s; display: flex; flex-direction: column; gap: 8px; position: relative; box-shadow: var(--shadow-sm); }
.p-card:hover { border-color: #cfc6ff; box-shadow: var(--shadow); transform: translateY(-2px); }
.p-card:active { transform: scale(.98); }
.p-img { aspect-ratio: 4/3; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font-size: 38px; }
.p-name { font-weight: 600; font-size: 13.5px; line-height: 1.3; min-height: 35px; }
.p-meta { display: flex; justify-content: space-between; align-items: center; }
.p-price { font-weight: 700; color: var(--primary); font-size: 14px; }
.p-stock { font-size: 11px; color: var(--muted); }
.p-stock.low { color: var(--danger); font-weight: 700; }
.p-card.out { opacity: .45; pointer-events: none; }
.pos-right { background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.cart-head { padding: 14px 18px; border-bottom: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 10px; }
.cust-box { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px dashed #cfc6ff; background: var(--primary-50); border-radius: 12px; cursor: pointer; }
.cust-box .grow { flex: 1; }
.cust-box b { font-size: 13.5px; display: block; }
.cust-box small { color: var(--muted); font-size: 12px; }
.cart-items { flex: 1; overflow-y: auto; }
.cart-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 11px 18px; border-bottom: 1px solid var(--line-2); }
.cart-line b { font-size: 13.5px; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-line small { color: var(--muted); font-size: 12px; }
.qty { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 9px; }
.qty button { width: 28px; height: 28px; border: 0; background: none; cursor: pointer; color: var(--primary); display: grid; place-items: center; }
.qty button svg { width: 14px; height: 14px; }
.qty span { min-width: 26px; text-align: center; font-weight: 700; font-size: 13px; }
.line-total { font-weight: 700; min-width: 72px; text-align: right; font-size: 13.5px; }
.cart-sum { padding: 14px 18px; border-top: 1px solid var(--line); background: var(--surface-2); }
.sum-row { display: flex; justify-content: space-between; padding: 3px 0; font-size: 13.5px; color: var(--ink-2); }
.sum-total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 10px; margin-top: 8px; border-top: 1px dashed var(--line); }
.sum-total b { font-size: 15px; }
.sum-total .num { font-size: 26px; font-weight: 800; background: var(--grad-title); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cart-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 12px 18px 0; }
.cart-actions .btn { flex-direction: column; height: 58px; gap: 3px; font-size: 11.5px; padding: 0 4px; }
.pay-btn { margin: 12px 18px 16px; height: 56px; font-size: 17px; border-radius: 14px; justify-content: space-between; padding: 0 20px; }
.pay-methods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pay-method { border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 6px; text-align: center; cursor: pointer; font: 600 12.5px var(--font); background: var(--surface); color: var(--ink); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pay-method.active { border-color: var(--primary); background: var(--primary-50); color: var(--primary); }
.amount-due { text-align: center; padding: 16px; background: var(--primary-50); border-radius: 14px; margin-bottom: 16px; }
.amount-due small { color: var(--muted); font-weight: 600; }
.amount-due .num { font-size: 36px; font-weight: 800; display: block; color: var(--primary); }
.quick-cash { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.change-box { display: flex; justify-content: space-between; padding: 12px 14px; border-radius: 12px; background: var(--success-50); color: var(--success); font-weight: 700; margin-top: 14px; }
.change-box .num { font-size: 18px; }

/* ---------- KDS ---------- */
.kds-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.ticket { background: var(--surface); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-sm); }
.ticket-head { padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; color: #fff; }
.ticket-head.new { background: var(--g-blue); }
.ticket-head.cooking { background: var(--g-amber); }
.ticket-head.late { background: var(--g-red); }
.ticket-head.ready { background: var(--g-green); }
.ticket ul { list-style: none; margin: 0; padding: 8px 14px; flex: 1; }
.ticket li { padding: 7px 0; border-bottom: 1px dashed var(--line); display: flex; gap: 10px; }
.ticket li:last-child { border-bottom: 0; }
.ticket li em { display: block; font-size: 12px; color: var(--danger); font-style: normal; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--bg); }
.auth-side { background: linear-gradient(150deg, #4c1d95 0%, #6d28d9 45%, #db2777 100%); color: #fff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side::before, .auth-side::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.08); }
.auth-side::before { width: 420px; height: 420px; right: -120px; top: -120px; }
.auth-side::after { width: 520px; height: 520px; left: -200px; bottom: -260px; }
.auth-side > * { position: relative; z-index: 1; }
.feature-row { display: flex; gap: 14px; align-items: flex-start; margin-top: 18px; }
.feature-row .ic { width: 44px; height: 44px; border-radius: 12px; background: rgba(255,255,255,.16); display: grid; place-items: center; flex-shrink: 0; }
.feature-row b { display: block; font-size: 15px; }
.feature-row span { color: rgba(255,255,255,.75); font-size: 13px; }
.auth-form { display: flex; flex-direction: column; padding: 24px 32px; }
.auth-top { display: flex; justify-content: flex-end; gap: 10px; }
.auth-center { flex: 1; display: grid; place-items: center; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 20px; padding: 34px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.auth-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--grad-line); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.pin-pad button { height: 54px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font: 700 20px var(--font); color: var(--ink); cursor: pointer; }
.pin-pad button:hover { background: var(--primary-50); color: var(--primary); }

/* ---------- Receipt (80mm) ---------- */
.receipt { width: 302px; margin: 20px auto; background: #fff; color: #000; font: 12px/1.45 ui-monospace, Consolas, "Courier New", monospace; padding: 14px 12px; }
.receipt h2 { font-size: 16px; text-align: center; font-family: inherit; }
.receipt .c { text-align: center; }
.receipt table { width: 100%; border-collapse: collapse; font-size: 12px; }
.receipt td { padding: 2px 0; vertical-align: top; }
.receipt .r { text-align: right; }
.receipt hr { border: 0; border-top: 1px dashed #000; margin: 7px 0; }
.receipt .big { font-size: 15px; font-weight: 700; }
@media print { body { background: #fff; } .no-print { display: none !important; } .receipt { margin: 0; width: 100%; padding: 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .g-dash { grid-template-columns: minmax(0, 1fr); }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: minmax(0, 1fr); }
  .pos { grid-template-columns: minmax(0, 1fr) 370px; }
  .topbar .search, .date-pill { display: none; }
}
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
  .main { margin-left: 0; }
  .g-3 { grid-template-columns: minmax(0, 1fr); }
  .pos { grid-template-columns: 1fr; grid-template-rows: auto; height: auto; overflow: visible; }
  .pos-right { border-left: 0; border-top: 1px solid var(--line); }
  .pos-left .product-grid { max-height: 62vh; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .register-pill, .tb-optional { display: none !important; }
}
@media (max-width: 640px) {
  .content { padding: 14px; }
  .topbar { padding: 0 12px; gap: 6px; }
  .icon-btn { width: 38px; height: 38px; }
  .pos-pill { padding: 0 14px; height: 38px; }
  .g-2, .g-4, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .page-head { padding: 18px; }
  .pay-methods, .quick-cash { grid-template-columns: repeat(2, 1fr); }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .pos-top .seg { display: none; }
  .pos-top { padding: 0 12px; gap: 8px; }
  .auth-form { padding: 16px; }
  .auth-card { padding: 24px; }
}

/* v2 fixes */
.page-actions .select { width: auto; }
@media (max-width: 640px) {
  #kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  #kpis .kpi { padding: 14px; }
  #kpis .kpi-value { font-size: 16px; font-weight: 600; }
  #kpis .tag-pill { display: none; }
}
