/* =====================================================================
   ZED Car Electronics — Design System
   Brand: Racing Red · Carbon Black · White  +  Electric Cyan accent
   ===================================================================== */

:root {
  --brand: #E10600;
  --brand-2: #FF3B30;
  --brand-dark: #A80000;
  --brand-soft: rgba(225, 6, 0, .08);
  --brand-glow: rgba(225, 6, 0, .32);
  --accent: #0891B2;
  --accent-2: #06B6D4;
  --accent-soft: rgba(8, 145, 178, .10);
  --accent-glow: rgba(6, 182, 212, .35);
  --success: #16A34A;  --success-soft: rgba(22, 163, 74, .10);
  --warning: #D97706;  --warning-soft: rgba(217, 119, 6, .12);
  --danger:  #DC2626;  --danger-soft:  rgba(220, 38, 38, .10);
  --info:    #2563EB;  --info-soft:    rgba(37, 99, 235, .10);
  --violet:  #7C3AED;  --violet-soft:  rgba(124, 58, 237, .10);

  --bg: #F2F3F6;
  --surface: #FFFFFF;
  --surface-2: #F8F9FB;
  --surface-3: #EEF0F4;
  --border: #E5E7EC;
  --border-strong: #D4D7DE;
  --text: #0D0E12;
  --text-2: #3D424E;
  --muted: #6B7180;
  --faint: #9BA1AD;

  --shadow-xs: 0 1px 2px rgba(16, 18, 27, .05);
  --shadow-sm: 0 1px 3px rgba(16, 18, 27, .06), 0 1px 2px rgba(16, 18, 27, .04);
  --shadow-md: 0 8px 22px -8px rgba(16, 18, 27, .14), 0 2px 6px rgba(16, 18, 27, .05);
  --shadow-lg: 0 28px 56px -18px rgba(16, 18, 27, .28);
  --ring: 0 0 0 4px rgba(225, 6, 0, .14);

  --radius: 16px;
  --radius-sm: 11px;
  --radius-xs: 8px;
  --sidebar-w: 268px;
  --sidebar-w-c: 80px;
  --topbar-h: 70px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-display: 'Rajdhani', 'Inter', system-ui, sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);

  --sb-bg: #0A0A0C;
  --sb-bg-2: #111114;
  --sb-text: #9C9CA6;
  --sb-line: rgba(255, 255, 255, .06);
  color-scheme: light;
}

[data-theme="dark"] {
  --brand: #FF2A1F;
  --brand-2: #FF5B4F;
  --brand-dark: #C70A00;
  --brand-soft: rgba(255, 42, 31, .12);
  --brand-glow: rgba(255, 42, 31, .38);
  --accent: #22D3EE;
  --accent-2: #67E8F9;
  --accent-soft: rgba(34, 211, 238, .12);
  --accent-glow: rgba(34, 211, 238, .35);
  --success: #22C55E;  --success-soft: rgba(34, 197, 94, .13);
  --warning: #F59E0B;  --warning-soft: rgba(245, 158, 11, .14);
  --danger:  #F87171;  --danger-soft:  rgba(248, 113, 113, .13);
  --info:    #60A5FA;  --info-soft:    rgba(96, 165, 250, .13);
  --violet:  #A78BFA;  --violet-soft:  rgba(167, 139, 250, .14);

  --bg: #070709;
  --surface: #101014;
  --surface-2: #15151A;
  --surface-3: #1C1C23;
  --border: #22222A;
  --border-strong: #2F2F39;
  --text: #F3F3F5;
  --text-2: #C6C6CE;
  --muted: #8C8C98;
  --faint: #5C5C68;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .45);
  --shadow-md: 0 10px 26px -10px rgba(0, 0, 0, .7);
  --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, .8);
  --ring: 0 0 0 4px rgba(255, 42, 31, .2);
  --sb-bg: #050506;
  --sb-bg-2: #0C0C0F;
  color-scheme: dark;
}

/* ------------------------------------------------------------------ */
/* Base                                                                */
/* ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color .35s var(--ease), color .35s var(--ease);
}
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 100% -10%, var(--brand-soft), transparent 60%),
    radial-gradient(700px 420px at 30% 110%, var(--accent-soft), transparent 60%);
  opacity: .9;
}
a { color: inherit; text-decoration: none; }
a.link, .link { color: var(--accent); font-weight: 600; }
a.link:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.015em; }
p { margin: 0; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
::selection { background: var(--brand); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.ic { flex-shrink: 0; display: inline-block; vertical-align: middle; }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------------------------ */
/* App shell                                                           */
/* ------------------------------------------------------------------ */
.app { min-height: 100vh; }
.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .35s var(--ease);
}
.sb-collapsed .main { margin-left: var(--sidebar-w-c); }
.content { flex: 1; padding: 26px 30px 40px; max-width: 1680px; width: 100%; margin: 0 auto; }
.app-footer {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 16px 30px; font-size: 12px; color: var(--muted);
  border-top: 1px solid var(--border);
}

/* Sidebar */
.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background:
    linear-gradient(180deg, rgba(225, 6, 0, .10), transparent 220px),
    linear-gradient(180deg, var(--sb-bg), var(--sb-bg-2));
  color: var(--sb-text);
  display: flex; flex-direction: column;
  z-index: 60;
  border-right: 1px solid var(--sb-line);
  transition: width .35s var(--ease), transform .35s var(--ease);
}
.sidebar::after {
  content: ""; position: absolute; top: 0; right: -1px; width: 1px; height: 180px;
  background: linear-gradient(180deg, var(--brand), transparent);
  opacity: .7;
}
.sb-brand {
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px 0 20px;
  border-bottom: 1px solid var(--sb-line);
}
.brand-link { display: flex; align-items: center; gap: 11px; color: #fff; min-width: 0; }
.brand-link .logo-mark { color: #fff; filter: drop-shadow(0 4px 14px rgba(225, 6, 0, .5)); transition: transform .5s var(--ease-spring); }
.brand-link:hover .logo-mark { transform: rotate(-8deg) scale(1.08); }
.brand-img { width: 38px; height: 38px; object-fit: contain; border-radius: 8px; }
.brand-text { display: flex; flex-direction: column; line-height: 1; white-space: nowrap; }
.brand-text b { font-family: var(--font-display); font-size: 26px; letter-spacing: .06em; font-weight: 700; }
.brand-text small { font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase; color: #8d8d97; margin-top: 3px; }
.sb-collapse {
  width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 9px; border: 1px solid var(--sb-line); background: rgba(255, 255, 255, .03);
  color: #8d8d97; cursor: pointer; transition: all .25s var(--ease);
}
.sb-collapse:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.sb-collapsed .sb-collapse { transform: rotate(180deg); }
.sb-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 10px 12px 18px; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .08); }
.sb-section {
  font-size: 10.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: #5d5d68; padding: 18px 12px 7px; white-space: nowrap;
}
.sb-link {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; margin: 2px 0;
  border-radius: 11px;
  color: var(--sb-text);
  font-weight: 500; font-size: 13.6px;
  white-space: nowrap;
  transition: background .25s var(--ease), color .25s var(--ease), transform .25s var(--ease);
}
.sb-link .sb-ic { display: grid; place-items: center; width: 22px; transition: transform .35s var(--ease-spring), color .25s; }
.sb-link:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.sb-link:hover .sb-ic { transform: scale(1.12); color: var(--brand-2); }
.sb-link.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(225, 6, 0, .28), rgba(225, 6, 0, .06) 70%, transparent);
  box-shadow: inset 0 0 0 1px rgba(255, 59, 48, .18);
}
.sb-link.active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--brand-2);
  box-shadow: 0 0 16px 2px rgba(255, 59, 48, .7);
}
.sb-link.active .sb-ic { color: #ff5148; }
.sb-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.sb-tag {
  font-size: 9.5px; font-weight: 800; letter-spacing: .1em; padding: 2px 6px; border-radius: 6px;
  background: rgba(34, 211, 238, .14); color: #67e8f9; border: 1px solid rgba(34, 211, 238, .25);
}
.sb-count {
  min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
  background: rgba(255, 255, 255, .08); color: #e5e5ea;
}
.sb-count.warn { background: rgba(245, 158, 11, .18); color: #fbbf24; }
.sb-footer { padding: 14px; border-top: 1px solid var(--sb-line); }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: rgba(255, 255, 255, .03); overflow: hidden; }
.sb-user-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; white-space: nowrap; }
.sb-user-meta b { color: #fff; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.sb-user-meta small { color: #7a7a85; font-size: 11.5px; }

/* Collapsed sidebar (desktop) */
@media (min-width: 1025px) {
  .sb-collapsed .sidebar { width: var(--sidebar-w-c); }
  .sb-collapsed .brand-text, .sb-collapsed .sb-label, .sb-collapsed .sb-tag,
  .sb-collapsed .sb-user-meta, .sb-collapsed .sb-section span { display: none; }
  .sb-collapsed .sb-section { padding: 10px 0 4px; height: 14px; }
  .sb-collapsed .sb-section::after { content: ""; display: block; margin: 0 auto; width: 22px; border-top: 1px solid var(--sb-line); }
  .sb-collapsed .sb-brand { padding: 0; flex-direction: column; justify-content: center; gap: 4px; height: auto; min-height: var(--topbar-h); padding: 10px 0; }
  .sb-collapsed .sb-link { justify-content: center; padding: 11px 0; }
  .sb-collapsed .sb-count { position: absolute; top: 2px; right: 6px; min-width: 18px; height: 16px; font-size: 10px; padding: 0 4px; }
  .sb-collapsed .sb-user { justify-content: center; padding: 6px 0; background: none; }
  .sb-collapsed .sb-link:hover::after {
    content: attr(data-tip);
    position: absolute; left: calc(100% + 14px); top: 50%; transform: translateY(-50%);
    background: #18181d; color: #fff; padding: 7px 11px; border-radius: 8px; font-size: 12.5px;
    box-shadow: var(--shadow-md); border: 1px solid rgba(255, 255, 255, .08);
    animation: tip-in .2s var(--ease);
    z-index: 5;
  }
}
@keyframes tip-in { from { opacity: 0; transform: translate(-6px, -50%); } }
.sb-overlay { display: none; }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 30px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--border);
}
.search-trigger {
  flex: 1; max-width: 560px;
  display: flex; align-items: center; gap: 11px;
  height: 44px; padding: 0 8px 0 15px;
  border-radius: 13px; border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted); cursor: pointer; text-align: left;
  box-shadow: var(--shadow-xs);
  transition: border-color .25s, box-shadow .25s, transform .25s var(--ease);
}
.search-trigger span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-trigger:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
kbd {
  font-family: var(--font); font-size: 11px; font-weight: 600; color: var(--muted);
  padding: 3px 7px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2);
  box-shadow: inset 0 -1px 0 var(--border);
}
.tb-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn {
  position: relative;
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); cursor: pointer;
  transition: all .25s var(--ease);
}
.icon-btn:hover { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 35%, var(--border)); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.icon-btn .ping {
  position: absolute; top: -5px; right: -5px;
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px;
  background: var(--brand); color: #fff; font-size: 10.5px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid var(--bg);
  animation: ping-pop 2.4s var(--ease) infinite;
}
@keyframes ping-pop { 0%, 100% { box-shadow: 0 0 0 0 var(--brand-glow); } 50% { box-shadow: 0 0 0 6px transparent; } }
.theme-toggle .ti-sun, .theme-toggle .ti-moon { display: grid; animation: spin-in .5s var(--ease-spring); }
.theme-toggle .ti-moon, [data-theme="dark"] .theme-toggle .ti-sun { display: none; }
[data-theme="dark"] .theme-toggle .ti-moon { display: grid; }
@keyframes spin-in { from { transform: rotate(-90deg) scale(.5); opacity: 0; } }
.user-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 10px 4px 4px; height: 44px;
  border-radius: 13px; border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; transition: all .25s var(--ease);
}
.user-btn:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.user-btn-meta { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.user-btn-meta b { font-size: 13px; }
.user-btn-meta small { font-size: 11px; color: var(--muted); }
.only-mobile { display: none !important; }

/* Avatar */
.avatar {
  --h: 0;
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; flex-shrink: 0;
  font-weight: 700; font-size: 13px; letter-spacing: .02em; color: #fff;
  background: linear-gradient(135deg, hsl(var(--h) 70% 52%), hsl(calc(var(--h) + 40) 75% 38%));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15);
}
.avatar.sm { width: 32px; height: 32px; font-size: 12px; border-radius: 9px; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; border-radius: 18px; }
.avatar.xl { width: 84px; height: 84px; font-size: 28px; border-radius: 22px; }

/* ------------------------------------------------------------------ */
/* Page header                                                         */
/* ------------------------------------------------------------------ */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head h1 { font-size: 27px; font-weight: 800; letter-spacing: -.025em; }
.page-head p { color: var(--muted); margin-top: 5px; font-size: 14px; }
.ph-actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--faint); font-size: 12.5px; margin-bottom: 8px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); display: inline-flex; align-items: center; transition: color .2s; }
.crumbs a:hover { color: var(--brand); }
.crumbs span { color: var(--text-2); font-weight: 600; }

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px;
  border-radius: 12px; border: 1px solid transparent;
  font-weight: 600; font-size: 13.5px; white-space: nowrap;
  cursor: pointer; user-select: none;
  transition: transform .2s var(--ease), box-shadow .25s var(--ease), background .25s, border-color .25s, color .25s, filter .25s;
}
.btn:active { transform: translateY(1px) scale(.98); }
.btn[disabled], .btn.disabled { opacity: .55; pointer-events: none; }
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--brand-2), var(--brand) 55%, var(--brand-dark));
  box-shadow: 0 6px 18px -6px var(--brand-glow), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 26px -8px var(--brand-glow), inset 0 1px 0 rgba(255, 255, 255, .25); filter: saturate(1.1); }
.btn-accent {
  color: #04222b;
  background: linear-gradient(135deg, #67E8F9, #22D3EE 50%, #06B6D4);
  box-shadow: 0 6px 18px -6px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, .4);
}
.btn-accent:hover { transform: translateY(-2px); box-shadow: 0 12px 26px -8px var(--accent-glow); }
.btn-dark { color: #fff; background: linear-gradient(180deg, #24242a, #0d0d10); box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, .08); }
[data-theme="dark"] .btn-dark { background: linear-gradient(180deg, #2b2b33, #1b1b21); border-color: var(--border-strong); }
.btn-dark:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text-2); box-shadow: var(--shadow-xs); }
.btn-ghost:hover { border-color: var(--border-strong); color: var(--text); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-soft { background: var(--brand-soft); color: var(--brand); }
.btn-soft:hover { background: color-mix(in srgb, var(--brand) 16%, transparent); }
.btn-soft-accent { background: var(--accent-soft); color: var(--accent); }
.btn-soft-accent:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.btn-success { color: #fff; background: linear-gradient(135deg, #22c55e, #16a34a); box-shadow: 0 6px 18px -8px rgba(22, 163, 74, .6); }
.btn-success:hover { transform: translateY(-2px); }
.btn-danger { color: #fff; background: linear-gradient(135deg, #f87171, #dc2626); box-shadow: 0 6px 18px -8px rgba(220, 38, 38, .6); }
.btn-danger:hover { transform: translateY(-2px); }
.btn-link { background: none; border: 0; color: var(--accent); padding: 0 6px; height: auto; cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; font-size: inherit; }
.btn-link:hover { text-decoration: underline; }
[data-cust-card] b, [data-cust-card] small { display: block; }
.ln-type-sel { height: 26px !important; width: auto !important; font-size: 11.5px !important; padding: 0 24px 0 8px !important; border-radius: 7px !important; background-position: right 6px center !important; font-weight: 600; color: var(--text-2); }
.btn-sm { height: 36px; padding: 0 13px; font-size: 13px; border-radius: 10px; }
.btn-xs { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; gap: 6px; }
.btn-lg { height: 50px; padding: 0 24px; font-size: 15px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-xs { width: 30px; }
.ripple {
  position: absolute; border-radius: 50%; transform: scale(0);
  background: rgba(255, 255, 255, .45); pointer-events: none;
  animation: ripple .6s linear;
}
@keyframes ripple { to { transform: scale(4); opacity: 0; } }
.btn-group { display: inline-flex; border: 1px solid var(--border); border-radius: 12px; padding: 3px; background: var(--surface); gap: 2px; }
.btn-group .btn { height: 32px; border-radius: 9px; padding: 0 11px; background: transparent; color: var(--muted); box-shadow: none; }
.btn-group .btn.active { background: var(--surface-3); color: var(--text); }
.t-actions { display: flex; gap: 6px; justify-content: flex-end; }
.act {
  width: 32px; height: 32px; display: inline-grid; place-items: center;
  border-radius: 9px; color: var(--muted); border: 1px solid transparent; background: transparent; cursor: pointer;
  transition: all .2s var(--ease);
}
.act:hover { color: var(--text); background: var(--surface-3); border-color: var(--border); transform: translateY(-1px); }
.act.danger:hover { color: var(--danger); background: var(--danger-soft); }
.act.brand:hover { color: var(--brand); background: var(--brand-soft); }
.act.accent:hover { color: var(--accent); background: var(--accent-soft); }

/* ------------------------------------------------------------------ */
/* Dropdown                                                            */
/* ------------------------------------------------------------------ */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 10px); left: 0; z-index: 80;
  min-width: 230px; padding: 7px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.98); transform-origin: top right;
  transition: opacity .2s var(--ease), transform .25s var(--ease), visibility .2s;
}
.dropdown-menu.right { left: auto; right: 0; }
.dropdown.open .dropdown-menu { opacity: 1; visibility: visible; transform: none; }
.dropdown-menu a, .dropdown-menu button.dd-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 11px; border-radius: 9px; border: 0; background: none; cursor: pointer;
  color: var(--text-2); font-size: 13.5px; font-weight: 500; text-align: left;
  transition: background .15s, color .15s, padding .2s var(--ease);
}
.dropdown-menu a:hover, .dropdown-menu button.dd-item:hover { background: var(--surface-3); color: var(--text); padding-left: 14px; }
.dropdown-menu a .ic { color: var(--muted); }
.dropdown-menu a:hover .ic { color: var(--brand); }
.dropdown-menu a.danger, .dropdown-menu a.danger .ic { color: var(--danger); }
.dd-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.dd-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 11px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; font-size: 13px; }
.dd-head.col { flex-direction: column; align-items: flex-start; gap: 2px; }
.notif-menu { width: 370px; padding: 7px; }
.notif-list { max-height: 400px; overflow-y: auto; }
.notif-item { display: flex !important; gap: 12px !important; align-items: flex-start !important; padding: 10px !important; }
.notif-item b { display: block; font-size: 13px; color: var(--text); font-weight: 600; line-height: 1.3; }
.notif-item small { color: var(--muted); font-size: 12px; }
.notif-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.notif-empty { text-align: center; padding: 26px 10px; color: var(--muted); }
.notif-empty .ic { color: var(--success); margin-bottom: 8px; }

/* tone helpers */
.tone-brand { background: var(--brand-soft); color: var(--brand); }
.tone-accent { background: var(--accent-soft); color: var(--accent); }
.tone-success { background: var(--success-soft); color: var(--success); }
.tone-warning { background: var(--warning-soft); color: var(--warning); }
.tone-danger { background: var(--danger-soft); color: var(--danger); }
.tone-info { background: var(--info-soft); color: var(--info); }
.tone-violet { background: var(--violet-soft); color: var(--violet); }
.tone-neutral { background: var(--surface-3); color: var(--text-2); }

/* ------------------------------------------------------------------ */
/* Cards & grid                                                        */
/* ------------------------------------------------------------------ */
.grid { display: grid; gap: 20px; }
.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-side { grid-template-columns: minmax(0, 1fr) 360px; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-all { grid-column: 1 / -1; }
.stack { display: flex; flex-direction: column; gap: 20px; }

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .3s var(--ease), transform .3s var(--ease), border-color .3s;
  min-width: 0;
}
.card.hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 20px 0;
}
.card-head.bordered { padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.card-title { display: flex; align-items: center; gap: 10px; font-size: 15.5px; font-weight: 700; }
.card-title .ic-chip { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; }
.card-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; font-weight: 500; }
.card-body { padding: 18px 20px 20px; }
.card-body.tight { padding: 8px 10px 10px; }
.card-body.flush { padding: 0; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* KPI cards */
.kpi {
  position: relative; overflow: hidden;
  padding: 18px 20px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s;
  isolation: isolate;
}
.kpi::before {
  content: ""; position: absolute; inset: auto -40% -60% auto; width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, var(--kpi-glow, var(--brand-soft)), transparent 65%);
  z-index: -1; transition: transform .6s var(--ease);
}
.kpi::after {
  content: ""; position: absolute; left: 0; top: 0; height: 3px; width: 100%;
  background: linear-gradient(90deg, var(--kpi-c, var(--brand)), transparent);
  transform: scaleX(0); transform-origin: left; transition: transform .6s var(--ease);
}
.kpi:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--kpi-c, var(--brand)) 30%, var(--border)); }
.kpi:hover::before { transform: scale(1.25); }
.kpi:hover::after { transform: scaleX(1); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 600; letter-spacing: .01em; }
.kpi-ic {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  color: var(--kpi-c, var(--brand)); background: color-mix(in srgb, var(--kpi-c, var(--brand)) 12%, transparent);
  transition: transform .45s var(--ease-spring);
}
.kpi:hover .kpi-ic { transform: rotate(-8deg) scale(1.1); }
.kpi-value { font-family: var(--font-display); font-size: 34px; font-weight: 700; line-height: 1; letter-spacing: .01em; }
.kpi-value small { font-size: 18px; color: var(--muted); font-weight: 600; margin-right: 3px; }
.kpi-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; padding: 2px 7px; border-radius: 7px; font-size: 11.5px; }
.delta.up { color: var(--success); background: var(--success-soft); }
.delta.down { color: var(--danger); background: var(--danger-soft); }
.delta.flat { color: var(--muted); background: var(--surface-3); }
.kpi-spark { position: absolute; right: 16px; top: 68px; width: 92px; height: 32px; opacity: .9; pointer-events: none; }
.kpi-foot > span { white-space: nowrap; }
.kpi.c-brand { --kpi-c: var(--brand); --kpi-glow: var(--brand-soft); }
.kpi.c-accent { --kpi-c: var(--accent); --kpi-glow: var(--accent-soft); }
.kpi.c-success { --kpi-c: var(--success); --kpi-glow: var(--success-soft); }
.kpi.c-warning { --kpi-c: var(--warning); --kpi-glow: var(--warning-soft); }
.kpi.c-violet { --kpi-c: var(--violet); --kpi-glow: var(--violet-soft); }
.kpi.c-info { --kpi-c: var(--info); --kpi-glow: var(--info-soft); }

/* Hero / welcome banner */
.hero {
  position: relative; overflow: hidden;
  border-radius: 20px;
  padding: 26px 28px;
  color: #fff;
  background:
    radial-gradient(600px 260px at 85% 20%, rgba(34, 211, 238, .22), transparent 60%),
    radial-gradient(500px 300px at 10% 120%, rgba(225, 6, 0, .55), transparent 60%),
    linear-gradient(135deg, #0b0b0e 0%, #17171c 60%, #1f0d0d 100%);
  border: 1px solid rgba(255, 255, 255, .06);
  box-shadow: var(--shadow-lg);
  isolation: isolate;
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .35;
  background-image: linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(90deg, transparent, #000 40%, #000);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 40%, #000);
}
.hero h2 { font-size: 25px; font-weight: 800; letter-spacing: -.02em; }
.hero p { color: #b9b9c3; margin-top: 6px; max-width: 620px; }
.hero-row { display: flex; justify-content: space-between; align-items: center; gap: 22px; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 26px; flex-wrap: wrap; }
.hero-stat b { display: block; font-family: var(--font-display); font-size: 30px; line-height: 1; }
.hero-stat > span { font-size: 11.5px; color: #9a9aa6; text-transform: uppercase; letter-spacing: .12em; }
.hero-row { position: relative; z-index: 1; }

/* ------------------------------------------------------------------ */
/* Badges, chips                                                       */
/* ------------------------------------------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 8px; border-radius: 999px;
  font-size: 11.8px; font-weight: 650; white-space: nowrap; line-height: 1.5;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; font-style: normal; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-violet { background: var(--violet-soft); color: var(--violet); }
.badge-brand { background: var(--brand-soft); color: var(--brand); }
.badge-neutral { background: var(--surface-3); color: var(--text-2); }
.badge-danger .dot { animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .3; } }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); font-size: 12.5px; font-weight: 600; color: var(--text-2);
  cursor: pointer; transition: all .2s var(--ease); white-space: nowrap;
}
.chip:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.chip.active { background: var(--text); color: var(--surface); border-color: var(--text); }
.chip .swatch { width: 8px; height: 8px; border-radius: 50%; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); }
.mono-tag { font-family: var(--mono); font-size: 11.5px; padding: 2px 7px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); }

/* ------------------------------------------------------------------ */
/* Forms                                                               */
/* ------------------------------------------------------------------ */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px 18px; }
.col-12 { grid-column: span 12; } .col-9 { grid-column: span 9; } .col-8 { grid-column: span 8; }
.col-6 { grid-column: span 6; } .col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; } .col-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label, .label { font-size: 12.8px; font-weight: 650; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.field > label .req { color: var(--brand); }
.field > label .opt { color: var(--faint); font-weight: 500; font-size: 11.5px; }
.help { font-size: 12px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%;
  height: 44px; padding: 0 14px;
  border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
  font: inherit; font-size: 14px;
  transition: border-color .2s, box-shadow .2s, background .2s;
  outline: none;
}
.textarea { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238C8C98' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); background: var(--surface); box-shadow: var(--ring); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input.sm, .select.sm { height: 36px; font-size: 13px; border-radius: 9px; padding: 0 11px; }
.select.sm { padding-right: 32px; background-position: right 9px center; }
.select option.opt-add { font-weight: 700; color: #E10600; }
.pay-opt.pay-add { border: 0; background: none; padding: 0; font: inherit; }
.pay-opt.pay-add span { border-style: dashed; color: var(--brand); height: 100%; justify-content: center; }
.pay-opt.pay-add:hover span { background: var(--brand-soft); border-color: var(--brand); }
.input.invalid, .select.invalid { border-color: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .ig-icon { position: absolute; left: 13px; color: var(--faint); pointer-events: none; display: grid; }
.input-group .input { padding-left: 40px; }
.input-group .ig-suffix { position: absolute; right: 12px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.input-group .ig-prefix-text { position: absolute; left: 13px; color: var(--muted); font-weight: 700; font-size: 13px; }
.input-group.money .input { padding-left: 32px; }
.input-group .ig-btn { position: absolute; right: 6px; }
.form-section { padding: 22px 0 6px; }
.form-section:first-child { padding-top: 0; }
.form-section-title { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 14.5px; margin-bottom: 14px; }
.form-section-title .n {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); font-size: 12px; font-weight: 800;
}
.form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding-top: 18px; }
.sticky-actions {
  position: sticky; bottom: 0; z-index: 20;
  margin: 20px -30px -40px; padding: 14px 30px;
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap;
}

/* switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-weight: 600; font-size: 13px; color: var(--text-2); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  position: relative; width: 42px; height: 24px; border-radius: 999px;
  background: var(--border-strong); transition: background .25s;
  flex-shrink: 0;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); transition: transform .3s var(--ease-spring);
}
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }

/* segmented radio */
.seg { display: inline-flex; padding: 4px; border-radius: 12px; background: var(--surface-3); gap: 3px; flex-wrap: wrap; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--muted); transition: all .2s var(--ease); }
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg.full { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); width: 100%; }
.seg.full span { justify-content: center; }

/* checkbox */
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13.5px; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }

/* Dropzone */
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  width: 100%; min-height: 168px;
  border: 2px dashed var(--border-strong); border-radius: 16px;
  padding: 22px 18px; text-align: center; cursor: pointer;
  background:
    radial-gradient(260px 120px at 50% 0%, var(--brand-soft), transparent 70%),
    var(--surface-2);
  transition: border-color .25s, background-color .25s, transform .25s var(--ease), box-shadow .25s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background-color: var(--brand-soft); box-shadow: 0 10px 30px -14px var(--brand-glow); }
.dropzone.drag { transform: scale(1.01); }
.dropzone input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 2; }
.dropzone .dz-ic {
  width: 56px; height: 56px; margin-bottom: 8px; border-radius: 16px; display: grid; place-items: center;
  background: var(--surface); color: var(--brand); box-shadow: var(--shadow-md);
  transition: transform .4s var(--ease-spring);
}
.dropzone:hover .dz-ic { transform: translateY(-4px) scale(1.06); }
.dropzone b { display: block; font-size: 14.5px; font-weight: 700; color: var(--text); }
.dropzone b u { color: var(--brand); text-decoration: none; border-bottom: 2px solid currentColor; }
.dropzone small { display: block; color: var(--muted); font-size: 12px; line-height: 1.5; }
.dropzone.compact { min-height: 118px; padding: 16px; }
.dropzone.compact .dz-ic { width: 44px; height: 44px; border-radius: 13px; margin-bottom: 4px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; margin-top: 14px; }
.thumbs:empty { display: none; }
.thumb {
  position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden;
  border: 2px solid var(--border); background: var(--surface-2);
  animation: pop-in .35s var(--ease-spring);
  transition: border-color .25s, box-shadow .25s, transform .25s var(--ease);
}
.thumb:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.thumb.is-main { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: filter .3s, opacity .3s; }
.thumb input { display: none; }
.thumb-tag {
  position: absolute; left: 7px; top: 7px; z-index: 1;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; letter-spacing: .02em;
  background: rgba(10, 10, 12, .72); color: #fff; backdrop-filter: blur(6px);
}
.thumb-tag.tag-main { background: var(--brand); }
.thumb:not(.is-main) .thumb-tag.tag-main { display: none; }
.thumb.is-main .thumb-tag.tag-new { display: none; }
.thumb-tools {
  position: absolute; left: 6px; right: 6px; bottom: 6px; z-index: 1;
  display: flex; justify-content: space-between; gap: 6px;
  opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .25s var(--ease);
}
.thumb:hover .thumb-tools, .thumb:focus-within .thumb-tools { opacity: 1; transform: none; }
@media (hover: none) { .thumb-tools { opacity: 1; transform: none; } }
.thumb-btn {
  height: 28px; padding: 0 9px; border: 0; border-radius: 8px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(10, 10, 12, .74); color: #fff; font: inherit; font-size: 11.5px; font-weight: 600;
  backdrop-filter: blur(6px); transition: background .2s;
}
.thumb-btn:hover { background: var(--brand); }
.thumb-btn.danger:hover { background: var(--danger); }
.thumb.is-main .thumb-btn[data-make-main] { visibility: hidden; }
.thumb-removed {
  position: absolute; inset: 0; z-index: 2; display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 8px;
  text-align: center; font-size: 11.5px; font-weight: 700; color: #fff;
  background: rgba(127, 29, 29, .55); backdrop-filter: blur(2px);
}
.thumb.removing { border-color: var(--danger); }
.thumb.removing img { filter: grayscale(1); opacity: .5; }
.thumb.removing .thumb-removed { display: flex; }
.thumb.removing .thumb-tools, .thumb.removing .thumb-tag { display: none; }
@keyframes pop-in { from { transform: scale(.85); opacity: 0; } }

/* ------------------------------------------------------------------ */
/* Toolbar / filters                                                   */
/* ------------------------------------------------------------------ */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.toolbar .grow { flex: 1; min-width: 200px; }
.toolbar .input, .toolbar .select { height: 40px; }
.toolbar .search { min-width: 240px; flex: 1; max-width: 420px; }

/* ------------------------------------------------------------------ */
/* Tables                                                              */
/* ------------------------------------------------------------------ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th {
  position: sticky; top: 0; z-index: 1;
  text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); background: var(--surface-2);
  padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table th a { display: inline-flex; align-items: center; gap: 4px; }
.table th a:hover { color: var(--text); }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .18s; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-3) 60%, transparent); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .center { text-align: center; }
.table.compact td { padding: 9px 14px; }
.table.compact th { padding: 9px 14px; }
.table tr.row-link { cursor: pointer; }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border); }
.cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-main b { display: block; font-weight: 650; color: var(--text); line-height: 1.3; }
.cell-main small { display: block; color: var(--muted); font-size: 12px; }
.pthumb {
  width: 44px; height: 44px; border-radius: 11px; overflow: hidden; flex-shrink: 0;
  background: var(--surface-3); display: grid; place-items: center; color: var(--faint);
  border: 1px solid var(--border);
}
.pthumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); }
tr:hover .pthumb img { transform: scale(1.1); }
.pthumb.lg { width: 56px; height: 56px; border-radius: 13px; }
.qty-pill { font-family: var(--font-display); font-size: 17px; font-weight: 700; }
.stockbar { width: 90px; height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; margin-top: 5px; }
.stockbar span { display: block; height: 100%; border-radius: 6px; background: var(--success); transform-origin: left; animation: grow-x 1s var(--ease) both; }
.stockbar span.low { background: var(--warning); }
.stockbar span.out { background: var(--danger); }
@keyframes grow-x { from { transform: scaleX(0); } }
.text-in { color: var(--success); font-weight: 700; }
.text-out { color: var(--danger); font-weight: 700; }

/* Pager */
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pager-info { color: var(--muted); font-size: 12.5px; }
.pager-links { display: flex; gap: 5px; align-items: center; }
.pg-btn {
  min-width: 34px; height: 34px; padding: 0 9px; border-radius: 9px; display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--surface); font-weight: 600; font-size: 13px; color: var(--text-2);
  transition: all .2s var(--ease);
}
a.pg-btn:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-1px); }
.pg-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 6px 14px -6px var(--brand-glow); }
.pg-btn.disabled { opacity: .4; }
.pg-gap { color: var(--faint); padding: 0 3px; }

/* ------------------------------------------------------------------ */
/* Product grid view                                                   */
/* ------------------------------------------------------------------ */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; padding: 18px; }
.pcard {
  position: relative; overflow: hidden;
  border: 1px solid var(--border); border-radius: 16px; background: var(--surface);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .3s;
  display: flex; flex-direction: column;
}
.pcard:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.pcard-img { position: relative; aspect-ratio: 4 / 3; background: linear-gradient(135deg, var(--surface-2), var(--surface-3)); display: grid; place-items: center; color: var(--faint); overflow: hidden; }
.pcard-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.pcard:hover .pcard-img img { transform: scale(1.08); }
.pcard-img .badge { position: absolute; top: 10px; left: 10px; backdrop-filter: blur(8px); }
.pcard-body { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.pcard-body b { font-size: 14px; line-height: 1.3; }
.pcard-meta { font-size: 12px; color: var(--muted); }
.pcard-foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 8px; }
.pcard-price { font-family: var(--font-display); font-size: 21px; font-weight: 700; }
.pcard-actions {
  position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 6px;
  opacity: 0; transform: translateX(10px); transition: all .3s var(--ease);
}
.pcard:hover .pcard-actions { opacity: 1; transform: none; }
.pcard-actions .act { background: var(--surface); box-shadow: var(--shadow-md); }

/* ------------------------------------------------------------------ */
/* Tabs                                                                */
/* ------------------------------------------------------------------ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 18px; overflow-x: auto; }
.tab {
  position: relative; padding: 14px 14px; font-weight: 600; font-size: 13.5px; color: var(--muted);
  cursor: pointer; border: 0; background: none; white-space: nowrap; display: inline-flex; gap: 8px; align-items: center;
  transition: color .2s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); }
.tab::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0;
  background: var(--brand); transform: scaleX(0); transition: transform .3s var(--ease);
}
.tab.active::after { transform: scaleX(1); }
.tab .count { font-size: 11px; padding: 1px 7px; border-radius: 8px; background: var(--surface-3); color: var(--text-2); }
.tab-panel { display: none; animation: fade-up .4s var(--ease); }
.tab-panel.active { display: block; }

/* ------------------------------------------------------------------ */
/* Modal                                                               */
/* ------------------------------------------------------------------ */
.modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; visibility: hidden; pointer-events: none; }
.modal.open { visibility: visible; pointer-events: auto; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(5, 5, 8, .55); backdrop-filter: blur(6px); opacity: 0; transition: opacity .3s var(--ease); }
.modal.open .modal-backdrop { opacity: 1; }
.modal-panel {
  position: relative; width: 100%; max-width: 640px; max-height: calc(100vh - 40px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(18px) scale(.97);
  transition: opacity .3s var(--ease), transform .4s var(--ease-spring);
}
.modal.open .modal-panel { opacity: 1; transform: none; }
.modal-panel.sm { max-width: 420px; padding: 26px; text-align: center; }
.modal-panel.lg { max-width: 860px; }
.modal-panel.xl { max-width: 1100px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 17px; font-weight: 750; display: flex; gap: 10px; align-items: center; }
.modal-head p { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.modal-actions.center { justify-content: center; border: 0; padding: 18px 0 0; }
.modal-panel.sm h3 { font-size: 18px; margin: 12px 0 6px; }
.confirm-ic { width: 58px; height: 58px; margin: 0 auto; border-radius: 18px; display: grid; place-items: center; background: var(--danger-soft); color: var(--danger); animation: pop-in .4s var(--ease-spring); }
body.modal-lock { overflow: hidden; }

/* ------------------------------------------------------------------ */
/* Toasts                                                              */
/* ------------------------------------------------------------------ */
.toasts { position: fixed; right: 22px; bottom: 22px; z-index: 300; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  pointer-events: auto; position: relative; overflow: hidden;
  display: flex; gap: 12px; align-items: flex-start;
  min-width: 300px; max-width: 420px; padding: 14px 16px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg);
  animation: toast-in .5s var(--ease-spring);
}
.toast.out { animation: toast-out .35s var(--ease) forwards; }
.toast .t-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.toast b { display: block; font-size: 13.5px; }
.toast p { font-size: 13px; color: var(--muted); }
.toast .t-bar { position: absolute; left: 0; bottom: 0; height: 3px; background: currentColor; animation: t-bar linear forwards; opacity: .7; }
.toast .t-x { margin-left: auto; background: none; border: 0; color: var(--faint); cursor: pointer; padding: 0; }
@keyframes toast-in { from { transform: translateX(110%); opacity: 0; } }
@keyframes toast-out { to { transform: translateX(110%); opacity: 0; } }
@keyframes t-bar { from { width: 100%; } to { width: 0; } }

/* ------------------------------------------------------------------ */
/* Command palette                                                     */
/* ------------------------------------------------------------------ */
.cmdk { position: fixed; inset: 0; z-index: 250; display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px; visibility: hidden; }
.cmdk.open { visibility: visible; }
.cmdk-backdrop { position: absolute; inset: 0; background: rgba(5, 5, 8, .5); backdrop-filter: blur(5px); opacity: 0; transition: opacity .25s; }
.cmdk.open .cmdk-backdrop { opacity: 1; }
.cmdk-panel {
  position: relative; width: 100%; max-width: 680px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(225, 6, 0, .06);
  overflow: hidden;
  opacity: 0; transform: translateY(-14px) scale(.98); transition: all .3s var(--ease-spring);
}
.cmdk.open .cmdk-panel { opacity: 1; transform: none; }
.cmdk-input { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); color: var(--muted); }
.cmdk-input input { flex: 1; border: 0; outline: 0; background: none; font: inherit; font-size: 16.5px; color: var(--text); }
.cmdk-input kbd { cursor: pointer; }
.cmdk-body { max-height: 56vh; overflow-y: auto; padding: 8px; }
.cmdk-group { padding: 10px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.cmdk-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; cursor: pointer;
  transition: background .15s;
}
.cmdk-item.sel { background: var(--surface-3); }
.cmdk-item.sel .cmdk-go { opacity: 1; transform: none; }
.cmdk-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; overflow: hidden; }
.cmdk-ic img { width: 100%; height: 100%; object-fit: cover; }
.cmdk-text { flex: 1; min-width: 0; }
.cmdk-text b { display: block; font-size: 13.8px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-text small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-text mark { background: color-mix(in srgb, var(--brand) 18%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.cmdk-meta { font-size: 12px; color: var(--muted); text-align: right; white-space: nowrap; }
.cmdk-go { opacity: 0; transform: translateX(-4px); transition: all .2s; color: var(--brand); }
.cmdk-foot { display: flex; gap: 16px; align-items: center; padding: 11px 18px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); background: var(--surface-2); }
.cmdk-foot .grow { flex: 1; }
.cmdk-foot kbd { margin-right: 3px; }
.cmdk-empty { text-align: center; padding: 34px 12px; color: var(--muted); }
.cmdk-empty .ic { margin-bottom: 8px; opacity: .6; }

/* ------------------------------------------------------------------ */
/* Autocomplete                                                        */
/* ------------------------------------------------------------------ */
.ac { position: relative; }
.ac-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 90;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg);
  max-height: 340px; overflow-y: auto; padding: 6px; display: none; min-width: 300px;
  animation: fade-up .2s var(--ease);
}
.ac-menu.open { display: block; }
.ac-item { display: flex; gap: 11px; align-items: center; padding: 9px 10px; border-radius: 10px; cursor: pointer; }
.ac-item.sel, .ac-item:hover { background: var(--surface-3); }
.ac-item .pthumb { width: 38px; height: 38px; border-radius: 9px; }
.ac-item .ac-t { flex: 1; min-width: 0; }
.ac-item b { display: block; font-size: 13.4px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-item small { color: var(--muted); font-size: 11.8px; }
.ac-item .ac-r { text-align: right; font-size: 12.5px; white-space: nowrap; }
.ac-item .ac-r b { font-family: var(--font-display); font-size: 15px; }
.ac-empty { padding: 16px; text-align: center; color: var(--muted); font-size: 13px; }

/* ------------------------------------------------------------------ */
/* Document builder (quotes / invoices / jobs / POs)                   */
/* ------------------------------------------------------------------ */
.lines { width: 100%; border-collapse: separate; border-spacing: 0; }
.lines th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 10px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.lines td { padding: 8px; border-bottom: 1px dashed var(--border); vertical-align: top; }
.lines tr.line { animation: fade-up .3s var(--ease); }
.lines .input { height: 40px; font-size: 13.5px; background: var(--surface); padding: 0 10px; }
.lines .num .input { text-align: right; }
.lines .ln-desc { min-width: 220px; }
.lines .ln-qty { width: 82px; min-width: 70px; }
.lines .ln-price { width: 128px; min-width: 104px; }
.lines .ln-disc { width: 76px; min-width: 66px; }
.lines .ln-total { width: 120px; text-align: right; font-family: var(--font-display); font-size: 17px; font-weight: 700; padding-top: 16px; white-space: nowrap; }
.lines .ln-x { width: 44px; padding-top: 12px; }
.ln-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; font-size: 11.5px; color: var(--muted); align-items: center; }
.ln-info { display: contents; }
.ln-meta .warn { color: var(--danger); font-weight: 700; display: inline-flex; gap: 4px; align-items: center; }
.ln-meta .ok { color: var(--success); font-weight: 600; }
.ln-handle { color: var(--faint); cursor: grab; }
.lines-add { display: flex; gap: 10px; flex-wrap: wrap; padding: 14px 0 4px; }
.totals { width: 100%; max-width: 380px; margin-left: auto; }
.totals .t-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; font-size: 14px; color: var(--text-2); }
.totals .t-row b { font-variant-numeric: tabular-nums; color: var(--text); }
.totals .t-grand { margin-top: 8px; padding: 16px 18px; border-radius: 14px; background: linear-gradient(135deg, #0d0d10, #1b1b21); color: #fff; }
[data-theme="dark"] .totals .t-grand { background: linear-gradient(135deg, #1c1c22, #26262e); border: 1px solid var(--border-strong); }
.totals .t-grand span { color: #a8a8b3; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; font-size: 12px; }
.totals .t-grand b { color: #fff; font-family: var(--font-display); font-size: 30px; }
.totals .t-inline { display: flex; gap: 6px; align-items: center; }
.totals .t-inline .input, .totals .t-inline .select { height: 34px; width: 92px; font-size: 13px; }
.margin-pill { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }

/* ------------------------------------------------------------------ */
/* Lists, timeline, insights                                           */
/* ------------------------------------------------------------------ */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 6px; border-bottom: 1px solid var(--border); transition: background .2s, padding .25s var(--ease); border-radius: 10px; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: var(--surface-2); padding-left: 12px; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-main b { display: block; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .li-main small { color: var(--muted); font-size: 12px; }
.list-item .li-end { text-align: right; white-space: nowrap; }
.li-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; }

.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(180deg, var(--border-strong), transparent); }
.tl-item { position: relative; padding: 0 0 18px; animation: fade-up .4s var(--ease) both; }
.tl-item::before {
  content: ""; position: absolute; left: -22px; top: 4px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--tl, var(--accent));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--tl, var(--accent)) 15%, transparent);
}
.tl-item b { font-size: 13.5px; }
.tl-item small { display: block; color: var(--muted); font-size: 12px; }
.tl-item .tl-body { margin-top: 4px; font-size: 13px; color: var(--text-2); }

.insight {
  display: flex; gap: 12px; padding: 13px 14px; border-radius: 13px;
  border: 1px solid var(--border); background: var(--surface-2);
  transition: transform .25s var(--ease), border-color .25s, box-shadow .25s;
  animation: fade-up .5s var(--ease) both;
}
.insight + .insight { margin-top: 10px; }
.insight:hover { transform: translateX(4px); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.insight .li-ic { width: 34px; height: 34px; }
.insight b { font-size: 13.3px; display: block; line-height: 1.35; }
.insight p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.insight a.link { font-size: 12.5px; }
.ai-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px; color: var(--accent);
  background: linear-gradient(90deg, var(--accent-soft), var(--brand-soft));
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.ai-chip .ic { animation: twinkle 2.4s ease-in-out infinite; }
@keyframes twinkle { 50% { transform: rotate(20deg) scale(1.2); opacity: .7; } }

.progress { height: 8px; border-radius: 8px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transform-origin: left; animation: grow-x 1.2s var(--ease) both; }
.progress.accent > span { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.progress.success > span { background: linear-gradient(90deg, #16a34a, #4ade80); }

.dl { display: grid; grid-template-columns: 140px 1fr; gap: 10px 14px; font-size: 13.5px; }
.dl dt { color: var(--muted); font-weight: 500; }
.dl dd { margin: 0; font-weight: 600; word-break: break-word; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.mini-stat { padding: 14px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--border); }
.mini-stat span { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.mini-stat b { display: block; font-family: var(--font-display); font-size: 23px; margin-top: 4px; line-height: 1.1; }

/* Empty state */
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state .ic { color: var(--faint); margin-bottom: 12px; }
.empty-state h3 { color: var(--text); font-size: 16px; margin-bottom: 4px; }
.empty-state p { max-width: 420px; margin: 0 auto 16px; font-size: 13.5px; }
.empty-state.big { padding: 80px 20px; }
.empty-state.big h2 { color: var(--text); margin-bottom: 6px; }

/* Charts */
.chart-box { position: relative; height: 300px; }
.chart-box.sm { height: 220px; }
.chart-box.lg { height: 340px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.donut-wrap { position: relative; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; text-align: center; }
.donut-center b { font-family: var(--font-display); font-size: 26px; display: block; line-height: 1; }
.donut-center span { font-size: 11.5px; color: var(--muted); }

/* Skeleton */
.skeleton { position: relative; overflow: hidden; background: var(--surface-3); border-radius: 8px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent); animation: shimmer 1.4s infinite; }
[data-theme="dark"] .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .06), transparent); }
@keyframes shimmer { to { transform: translateX(100%); } }

/* Alerts */
.alert { display: flex; gap: 12px; padding: 13px 16px; border-radius: 13px; font-size: 13.5px; align-items: flex-start; border: 1px solid transparent; }
.alert .ic { margin-top: 1px; }
.alert-danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 25%, transparent); }
.alert-info { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.alert-success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.alert b { color: inherit; }
.alert p { color: var(--text-2); }

/* ------------------------------------------------------------------ */
/* Kanban                                                              */
/* ------------------------------------------------------------------ */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 16px; overflow-x: auto; padding-bottom: 10px; }
.kcol { background: var(--surface-2); border: 1px solid var(--border); border-radius: 16px; display: flex; flex-direction: column; min-height: 420px; transition: border-color .2s, background .2s; }
.kcol.over { border-color: var(--accent); background: var(--accent-soft); }
.kcol-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px; font-weight: 700; font-size: 13.5px; }
.kcol-head .kdot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 8px; }
.kcol-body { flex: 1; padding: 0 10px 10px; display: flex; flex-direction: column; gap: 10px; }
.kcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: 13px; padding: 13px;
  box-shadow: var(--shadow-xs); cursor: grab; transition: transform .25s var(--ease), box-shadow .25s, opacity .2s;
  animation: fade-up .4s var(--ease) both;
}
.kcard:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.kcard.dragging { opacity: .45; transform: rotate(2deg); }
.kcard b { display: block; font-size: 13.5px; line-height: 1.35; }
.kcard .k-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 12px; color: var(--muted); }
.kcard .k-veh { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--text-2); margin-top: 6px; }

/* ------------------------------------------------------------------ */
/* POS                                                                 */
/* ------------------------------------------------------------------ */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 20px; align-items: start; }
.pos-search { display: flex; gap: 10px; align-items: center; }
#pos-cats { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; mask-image: linear-gradient(90deg, #000 92%, transparent); -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent); }
#pos-cats::-webkit-scrollbar { display: none; }
.pos-search .input-group { flex: 1; }
.pos-search .input { height: 50px; font-size: 15px; border-radius: 14px; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-top: 16px; }
.pos-tile {
  position: relative; text-align: left; cursor: pointer; overflow: hidden;
  border: 1px solid var(--border); border-radius: 15px; background: var(--surface); padding: 0;
  transition: transform .25s var(--ease), box-shadow .25s, border-color .25s;
  animation: fade-up .35s var(--ease) both;
}
.pos-tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--brand); }
.pos-tile:active { transform: scale(.97); }
.pos-tile .pt-img { aspect-ratio: 16 / 11; background: var(--surface-3); display: grid; place-items: center; color: var(--faint); overflow: hidden; }
.pos-tile .pt-img img { width: 100%; height: 100%; object-fit: cover; }
.pos-tile .pt-body { padding: 10px 12px 12px; }
.pos-tile b { display: block; font-size: 13px; line-height: 1.3; height: 34px; overflow: hidden; }
.pos-tile .pt-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.pos-tile .pt-price { font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.pos-tile .pt-stock { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; }
.pos-tile.oos { opacity: .55; }
.pos-tile .pt-add { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; transform: scale(0); transition: transform .3s var(--ease-spring); }
.pos-tile:hover .pt-add { transform: scale(1); }
.cart { position: sticky; top: calc(var(--topbar-h) + 18px); display: flex; flex-direction: column; max-height: calc(100vh - var(--topbar-h) - 40px); }
.cart-lines { flex: 1; overflow-y: auto; padding: 4px 16px; min-height: 120px; }
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 12px 0; border-bottom: 1px dashed var(--border); animation: slide-in .3s var(--ease); }
.cart-line b { font-size: 13.3px; line-height: 1.3; }
.cart-line .cl-price { font-size: 12px; color: var(--muted); }
.cart-line .cl-total { font-family: var(--font-display); font-size: 17px; font-weight: 700; text-align: right; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.stepper button { width: 30px; height: 30px; border: 0; background: var(--surface-2); cursor: pointer; display: grid; place-items: center; color: var(--text-2); }
.stepper button:hover { background: var(--surface-3); color: var(--brand); }
.stepper input { width: 44px; height: 30px; border: 0; text-align: center; background: var(--surface); color: var(--text); font-weight: 700; outline: 0; }
.cart-sum { padding: 14px 16px; border-top: 1px solid var(--border); }
.pay-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pay-opt { position: relative; cursor: pointer; }
.pay-opt input { position: absolute; opacity: 0; }
.pay-opt span { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border-radius: 12px; border: 1px solid var(--border); font-size: 11.5px; font-weight: 600; color: var(--muted); transition: all .2s var(--ease); text-align: center; }
.pay-opt input:checked + span { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px var(--brand-soft); }
.quick-cash { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.quick-cash button { flex: 1; min-width: 60px; }
.change-box { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-radius: 12px; background: var(--success-soft); color: var(--success); font-weight: 700; margin-top: 10px; }
.change-box b { font-family: var(--font-display); font-size: 22px; }
.change-box.short { background: var(--danger-soft); color: var(--danger); }
@keyframes slide-in { from { transform: translateX(16px); opacity: 0; } }
.success-burst { width: 84px; height: 84px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; background: var(--success-soft); color: var(--success); animation: pop-in .5s var(--ease-spring); box-shadow: 0 0 0 10px color-mix(in srgb, var(--success) 8%, transparent); }

/* ------------------------------------------------------------------ */
/* Profile / detail heads                                              */
/* ------------------------------------------------------------------ */
.profile-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.profile-head h2 { font-size: 22px; font-weight: 800; }
.profile-head .meta { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-top: 6px; }
.profile-head .meta span { display: inline-flex; gap: 6px; align-items: center; }
.gallery-main { aspect-ratio: 1; border-radius: 16px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; color: var(--faint); }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; animation: fade-in .4s var(--ease); }
.gallery-strip { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.gallery-strip button { width: 62px; height: 62px; border-radius: 11px; overflow: hidden; border: 2px solid transparent; padding: 0; cursor: pointer; background: var(--surface-2); transition: border-color .2s, transform .2s; }
.gallery-strip button.active, .gallery-strip button:hover { border-color: var(--brand); transform: translateY(-2px); }
.gallery-strip img { width: 100%; height: 100%; object-fit: cover; }
.vehicle-card { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); transition: all .25s var(--ease); }
.vehicle-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.plate { display: inline-block; font-family: var(--mono); font-weight: 800; font-size: 12.5px; letter-spacing: .08em; padding: 3px 9px; border-radius: 6px; background: #FFD400; color: #111; border: 1.5px solid #111; }
.plate.white { background: #fff; }

/* Role cards */
.role-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.role-card { padding: 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); }
.role-card h4 { display: flex; gap: 8px; align-items: center; font-size: 14px; margin-bottom: 8px; }
.role-card ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; line-height: 1.7; }

/* Loading states & theme transition */
.theming, .theming *, .theming *::before, .theming *::after {
  transition: background-color .45s var(--ease), border-color .45s var(--ease), color .35s var(--ease), box-shadow .45s var(--ease) !important;
}
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading .ic { opacity: 0; }
.btn.is-loading::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px;
  border: 2.5px solid rgba(255, 255, 255, .9); border-right-color: transparent; border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn-ghost.is-loading::after, .btn-soft.is-loading::after { border-color: var(--brand); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.dropzone.busy { pointer-events: none; opacity: .7; }
.dropzone.busy .dz-ic .ic { animation: spin 1s linear infinite; }

/* ------------------------------------------------------------------ */
/* Animations & utilities                                              */
/* ------------------------------------------------------------------ */
@keyframes fade-up { from { opacity: 0; transform: translateY(12px); } }
@keyframes fade-in { from { opacity: 0; } }
.reveal { animation: fade-up .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
a.kpi { display: block; color: inherit; }
/* CSV file picker */
.file-pick {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  padding: 28px 18px; border: 2px dashed var(--border-strong); border-radius: 16px; cursor: pointer;
  background: radial-gradient(260px 120px at 50% 0%, var(--accent-soft), transparent 70%), var(--surface-2);
  transition: border-color .25s, background-color .25s;
}
.file-pick:hover, .file-pick.picked { border-color: var(--accent); background-color: var(--accent-soft); }
.file-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-pick .dz-ic { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: var(--surface); color: var(--accent); box-shadow: var(--shadow-md); margin-bottom: 6px; }
.file-pick b { font-size: 14.5px; }
.file-pick small { color: var(--muted); font-size: 12px; }
/* Get-started checklist */
.setup-card { overflow: hidden; }
.setup-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, var(--brand), var(--accent)); }
.setup-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.setup-step {
  display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--surface-2); color: inherit;
  transition: transform .25s var(--ease), border-color .25s, box-shadow .25s;
}
.setup-step:hover { transform: translateY(-2px); border-color: var(--brand); box-shadow: var(--shadow-md); }
.setup-step b { display: block; font-size: 13.5px; line-height: 1.3; }
.setup-step small { display: block; color: var(--muted); font-size: 12px; line-height: 1.4; margin-top: 2px; }
.setup-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; background: var(--brand-soft); color: var(--brand); }
.setup-cta { font-size: 12px; font-weight: 700; color: var(--brand); white-space: nowrap; display: inline-flex; gap: 4px; align-items: center; }
.setup-step.done { opacity: .7; }
.setup-step.done .setup-ic { background: var(--success); color: #fff; }
.setup-step.done b { text-decoration: line-through; text-decoration-color: var(--muted); }
@media (max-width: 1180px) { .setup-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .setup-grid { grid-template-columns: minmax(0, 1fr); } }
a.mini-stat { display: block; transition: transform .25s var(--ease), box-shadow .25s; }
a.mini-stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
@media (max-width: 900px) { .only-desktop { display: none !important; } }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.xs { font-size: 11.5px; }
.strong { font-weight: 700; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.display { font-family: var(--font-display); font-weight: 700; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-brand { color: var(--brand); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.grow { flex: 1; min-width: 0; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-20 { margin-bottom: 20px; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.clamp-1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pre { white-space: pre-line; }

/* ------------------------------------------------------------------ */
/* Auth pages (login / installer)                                      */
/* ------------------------------------------------------------------ */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--bg); }
.auth-visual {
  position: relative; overflow: hidden; isolation: isolate;
  background:
    radial-gradient(800px 500px at 20% 110%, rgba(225, 6, 0, .55), transparent 60%),
    radial-gradient(600px 400px at 90% 0%, rgba(34, 211, 238, .25), transparent 60%),
    linear-gradient(160deg, #050506, #111116 55%, #1c0707);
  color: #fff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between;
}
.auth-visual::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .5;
  background-image: linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(circle at 60% 40%, #000, transparent 75%);
  -webkit-mask-image: radial-gradient(circle at 60% 40%, #000, transparent 75%);
}
.auth-brand { display: flex; align-items: center; gap: 14px; }
.auth-brand .logo-mark { color: #fff; filter: drop-shadow(0 6px 22px rgba(225, 6, 0, .6)); }
.auth-brand b { font-family: var(--font-display); font-size: 30px; letter-spacing: .06em; display: block; line-height: 1; }
.auth-brand small { font-size: 11px; letter-spacing: .26em; text-transform: uppercase; color: #9b9ba6; }
.auth-copy h1 { font-size: 44px; font-weight: 800; letter-spacing: -.03em; line-height: 1.08; max-width: 560px; }
.auth-copy h1 em { font-style: normal; background: linear-gradient(90deg, #ff3b30, #ff8a65); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-copy h1 span { background: linear-gradient(90deg, #22d3ee, #67e8f9); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-copy p { color: #a5a5b0; margin-top: 16px; max-width: 500px; font-size: 15px; }
.auth-features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 30px; max-width: 560px; }
.auth-feature { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .07); font-size: 13px; color: #d4d4da; backdrop-filter: blur(6px); animation: fade-up .7s var(--ease) both; }
.auth-feature .ic { color: #ff5148; }
.auth-feature:nth-child(even) .ic { color: #22d3ee; }
.auth-foot { color: #6f6f7a; font-size: 12px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.auth-lights { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.auth-lights i { position: absolute; height: 2px; border-radius: 2px; left: 100%; animation: streak-l 3.8s linear infinite; }
.auth-lights i:nth-child(1) { top: 22%; width: 260px; background: linear-gradient(90deg, transparent, #ff3b30); animation-delay: .2s; }
.auth-lights i:nth-child(2) { top: 48%; width: 180px; background: linear-gradient(90deg, transparent, #22d3ee); animation-delay: 1.4s; animation-duration: 3.2s; }
.auth-lights i:nth-child(3) { top: 68%; width: 320px; background: linear-gradient(90deg, transparent, #ff3b30); animation-delay: 2.3s; animation-duration: 4.4s; }
.auth-lights i:nth-child(4) { top: 84%; width: 140px; background: linear-gradient(90deg, transparent, #fff); animation-delay: .9s; opacity: .5; }
@keyframes streak-l { from { transform: translateX(0); } to { transform: translateX(-200vw); } }
.auth-panel { display: grid; place-items: center; padding: 40px 24px; position: relative; }
.auth-card { width: 100%; max-width: 420px; animation: fade-up .7s var(--ease) both; }
.auth-card h2 { font-size: 28px; font-weight: 800; letter-spacing: -.025em; }
.auth-card .sub { color: var(--muted); margin: 6px 0 26px; }
.auth-card .field { margin-bottom: 16px; }
.auth-card .input { height: 50px; border-radius: 13px; font-size: 15px; }
.auth-card .btn-lg { width: 100%; margin-top: 6px; }
.pw-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 9px; display: grid; place-items: center; }
.pw-toggle:hover { color: var(--text); background: var(--surface-3); }
.caps-warn { display: none; font-size: 12px; color: var(--warning); margin-top: 6px; font-weight: 600; }
.caps-warn.on { display: flex; gap: 6px; align-items: center; }
.auth-theme { position: absolute; top: 22px; right: 22px; }
.secure-note { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 22px; font-size: 12px; color: var(--muted); }
.secure-note .ic { color: var(--success); }

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */
@media (max-width: 1400px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pos { grid-template-columns: minmax(0, 1fr) 380px; }
}
@media (max-width: 1180px) {
  .g-main, .g-side { grid-template-columns: minmax(0, 1fr); }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pos { grid-template-columns: minmax(0, 1fr); }
  .cart { position: static; max-height: none; }
  .role-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
  .main, .sb-collapsed .main { margin-left: 0; }
  .sidebar { transform: translateX(-100%); width: 280px; box-shadow: var(--shadow-lg); }
  .sb-open .sidebar { transform: none; }
  .sb-open .sb-overlay { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .5); backdrop-filter: blur(3px); animation: fade-in .3s; }
  .sb-collapse { display: none; }
  .only-mobile { display: grid !important; }
  .topbar { padding: 0 16px; gap: 10px; }
  .content { padding: 20px 16px 32px; }
  .sticky-actions { margin: 20px -16px -32px; padding: 12px 16px; }
  .auth { grid-template-columns: 1fr; }
  .auth-visual { padding: 32px 28px; min-height: auto; }
  .auth-copy h1 { font-size: 32px; }
  .auth-features { display: none; }
  .app-footer { padding: 14px 16px; }
}
@media (max-width: 760px) {
  .g-2, .g-3, .g-4 { grid-template-columns: minmax(0, 1fr); }
  .span-2, .span-3 { grid-column: auto; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid > [class*="col-"] { grid-column: 1 / -1; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .search-trigger { flex: 0 0 42px; height: 42px; width: 42px; padding: 0; justify-content: center; }
  .user-btn-meta, .tb-new span { display: none; }
  .page-head h1 { font-size: 22px; }
  .kpi-value { font-size: 28px; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dd { margin-bottom: 8px; }
  .notif-menu { width: calc(100vw - 32px); right: -60px; }
  .toasts { left: 16px; right: 16px; bottom: 16px; }
  .toast { min-width: 0; max-width: none; }
  .hero { padding: 22px 20px; }
  .toolbar .search { max-width: none; min-width: 100%; }
  .lines thead { display: none; }
  .lines, .lines tbody, .lines tr, .lines td { display: block; width: 100% !important; }
  .lines tr.line { position: relative; border: 1px solid var(--border); border-radius: 14px; padding: 8px; margin-bottom: 12px; background: var(--surface-2); }
  .lines td { border: 0; padding: 5px; }
  .lines td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
  .lines .ln-x { position: absolute; top: 4px; right: 4px; width: auto !important; }
  .lines .ln-total { text-align: left; }
  .pay-grid { grid-template-columns: repeat(2, 1fr); }
  .modal { padding: 10px; align-items: end; }
  .modal-panel { max-height: 92vh; border-radius: 20px 20px 14px 14px; }
  .pgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 12px; }
  .pos-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .grid.g-4 > .span-2 { grid-column: 1 / -1; }
  .kpi { padding: 14px 14px 12px; }
  .kpi-top { margin-bottom: 10px; }
  .kpi-label { font-size: 11.5px; }
  .kpi-ic { width: 32px; height: 32px; border-radius: 10px; }
  .kpi-ic .ic { width: 16px; height: 16px; }
  .kpi-value { font-size: 24px; }
  .kpi-value small { font-size: 14px; }
  .kpi-spark { display: none; }
  .kpi-foot { flex-wrap: wrap; gap: 4px 8px; margin-top: 8px; }
  .kpi-foot > span { white-space: normal; }
  .hero-stats { gap: 18px; }
  .hero-stat b { font-size: 24px; }
}
