/* styles.css — Headlights Repair staff app.
 * Utility & component classes available to page modules:
 *  Layout:   .page .page-header .page-actions .grid .grid-2 .grid-3 .grid-4 .row .col .stack .spread .end .wrap .grow .gap-xs/.gap-sm/.gap-md/.gap-lg
 *            .mt-xs/.mt-sm/.mt-md/.mt-lg .mb-xs/.mb-sm/.mb-md/.mb-lg .hide-m (hidden under 700px) .only-m (shown only under 700px)
 *  Cards:    .card .card-title .card-sub .card-inset .kpi (.kpi-icon .kpi-value .kpi-label; modifiers .accent .ok .warn .danger .info)
 *  Buttons:  .btn (default/secondary) .btn-primary .btn-secondary .btn-ghost .btn-danger .btn-success .btn-sm .btn-lg .btn-icon .btn-block
 *  Forms:    .field (label>span+input) .field.full .form-grid .input .hint .error-text .checkbox .segmented(.segmented-sm) .input-group(.ig-icon) .toolbar .search-box
 *  Tables:   .table-wrap .table tr.clickable .num .mono .truncate
 *  Pills:    .pill .pill-<job status> .bpill-<booking status> .ipill-<invoice status> .badge .badge-amber/.badge-green/.badge-red/.badge-gray/.badge-blue/.badge-violet .dot
 *  Text:     .muted .small .strong .text-ok .text-warn .text-danger .text-accent
 *  Misc:     .tabs .tabbar .tab .tab-badge .tabpanel .alert(.alert-info .alert-warn .alert-danger .alert-success) .kv .list .list-item .chip .chip-group
 *            .stepper .step(.done .active) .timeline .tl-item .tl-icon .tl-body .slot-grid .slot(.selected .disabled) .thumb-grid .thumb .dropdown-menu .dropdown-item .dropdown-empty
 *            .divider .empty .spinner .sticky-actions .chart .avatar .phone-links .status-strip .status-count
 */
:root {
  --bg: #f1f5f9; --surface: #ffffff; --surface-2: #f8fafc; --border: #e2e8f0; --border-strong: #cbd5e1;
  --text: #0f172a; --text-2: #334155; --muted: #64748b;
  --accent: #f59e0b; --accent-600: #d97706; --accent-soft: #fef3c7; --accent-text: #78350f;
  --sidebar: #0f172a; --sidebar-2: #1e293b; --sidebar-text: #cbd5e1; --sidebar-active: #f59e0b;
  --danger: #ef4444; --danger-soft: #fee2e2; --success: #10b981; --success-soft: #d1fae5; --info: #0ea5e9; --info-soft: #e0f2fe;
  --warn: #f97316; --warn-soft: #ffedd5; --violet: #8b5cf6; --violet-soft: #ede9fe; --sky: #0ea5e9; --sky-soft: #e0f2fe;
  --radius: 12px; --radius-sm: 8px; --shadow: 0 1px 2px rgba(15,23,42,.05), 0 1px 3px rgba(15,23,42,.08); --shadow-lg: 0 10px 30px rgba(15,23,42,.18);
  --sidebar-w: 240px; --topbar-h: 56px; --bottomnav-h: 62px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.45; -webkit-text-size-adjust: 100%; }
body.modal-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
a.link { color: var(--accent-600); text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 24px; } h2 { font-size: 18px; } h3 { font-size: 16px; } h4 { font-size: 14px; }
p { margin: 0 0 8px; }
[hidden] { display: none !important; }
.icon { width: 20px; height: 20px; flex: none; vertical-align: -4px; }
.btn-sm .icon, .small .icon, .tab .icon { width: 16px; height: 16px; }

/* ---------- layout */
#app { display: flex; min-height: 100vh; }
#sidebar { width: var(--sidebar-w); background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 40; transition: transform .2s ease; }
#main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
#topbar { height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
#topbar h2 { flex: 1; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-menu { display: none; }
.topbar-right { display: flex; gap: 8px; }
#page { padding: 20px; max-width: 1400px; width: 100%; }
#bottomnav { display: none; }
#drawer-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 39; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; font-weight: 800; font-size: 17px; color: #fff; }
.brand-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: #0f172a; display: inline-flex; align-items: center; justify-content: center; }
.brand-icon .icon { width: 22px; height: 22px; }
.brand-text { flex: 1; line-height: 1.2; }
.drawer-close { display: none; color: var(--sidebar-text); }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; flex: 1; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--sidebar-text); font-weight: 500; }
.nav-item:hover { background: var(--sidebar-2); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #0f172a; font-weight: 700; }
.nav-links { padding: 0 10px 8px; border-top: 1px solid var(--sidebar-2); margin-top: 6px; padding-top: 8px; }
.nav-links .nav-item { padding: 7px 12px; font-size: 13px; color: #94a3b8; }
.sidebar-footer { padding: 12px 14px 14px; border-top: 1px solid var(--sidebar-2); display: flex; flex-direction: column; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip-text { min-width: 0; color: #fff; }
.user-chip-text .muted { color: #94a3b8; }
.sidebar-footer .btn-ghost { color: var(--sidebar-text); }
.sidebar-footer .btn-ghost:hover { background: var(--sidebar-2); color: #fff; }
.sidebar-footer .segmented { background: var(--sidebar-2); border-color: var(--sidebar-2); }
.sidebar-footer .segmented button { color: var(--sidebar-text); }
.sidebar-footer .segmented button.active { background: var(--accent); color: #0f172a; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 13px; flex: none; }

.page-header { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-header-text { flex: 1; min-width: 200px; }
.page-subtitle { color: var(--muted); margin-top: 2px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- utilities */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap, .wrap { flex-wrap: wrap; }
.col, .stack { display: flex; flex-direction: column; gap: 12px; }
.spread { justify-content: space-between; }
.end { justify-content: flex-end; }
.center { justify-content: center; text-align: center; }
.grow { flex: 1; min-width: 0; }
.gap-xs { gap: 4px; } .gap-sm { gap: 8px; } .gap-md { gap: 12px; } .gap-lg { gap: 20px; }
.mt-xs { margin-top: 4px; } .mt-sm { margin-top: 8px; } .mt-md { margin-top: 16px; } .mt-lg { margin-top: 24px; }
.mb-xs { margin-bottom: 4px; } .mb-sm { margin-bottom: 8px; } .mb-md { margin-bottom: 16px; } .mb-lg { margin-bottom: 24px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .strong { font-weight: 600; } .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .95em; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-ok { color: #059669; } .text-warn { color: var(--warn); } .text-danger { color: var(--danger); } .text-accent { color: var(--accent-600); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.divider { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
.only-m { display: none; }

/* ---------- cards / kpi */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card-title { font-weight: 700; font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-sub { color: var(--muted); font-size: 13px; margin-top: -8px; margin-bottom: 12px; }
.card-inset { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; gap: 12px; align-items: center; box-shadow: var(--shadow); min-height: 84px; }
.kpi-icon { width: 42px; height: 42px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.kpi-icon .icon { width: 22px; height: 22px; }
.kpi-value { font-size: 24px; font-weight: 800; line-height: 1.1; }
.kpi-label { color: var(--muted); font-size: 13px; }
.kpi.ok .kpi-icon { background: var(--success-soft); color: #065f46; }
.kpi.warn .kpi-icon { background: var(--warn-soft); color: #9a3412; }
.kpi.danger .kpi-icon { background: var(--danger-soft); color: #991b1b; }
.kpi.info .kpi-icon { background: var(--info-soft); color: #075985; }
a.kpi:hover, .kpi.clickable:hover { border-color: var(--border-strong); cursor: pointer; }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, transform .05s; }
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #0f172a; }
.btn-primary:hover { background: var(--accent-600); border-color: var(--accent-600); }
.btn-secondary { background: var(--surface); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: rgba(15,23,42,.06); border-color: transparent; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; border-color: #dc2626; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.btn-lg { min-height: 48px; padding: 10px 20px; font-size: 16px; }
.btn-icon { padding: 8px; width: 40px; }
.btn-icon.btn-sm { width: 32px; padding: 4px; }
.btn-block { width: 100%; }
.btn .icon + span:empty { display: none; }

/* ---------- forms */
.input, input.input, select.input, textarea.input { width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; outline: none; transition: border-color .12s, box-shadow .12s; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { min-height: 80px; resize: vertical; }
select.input { appearance: none; -webkit-appearance: none; 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='%2364748b' 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 10px center; padding-right: 34px; }
input[type=date].input, input[type=time].input, input[type=datetime-local].input { min-width: 0; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.hint { font-size: 12px; color: var(--muted); }
.error-text { color: var(--danger); font-size: 13px; margin-top: 6px; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--accent); }
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.segmented button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font: inherit; font-weight: 600; color: var(--text-2); cursor: pointer; min-height: 34px; }
.segmented button.active { background: var(--surface); box-shadow: var(--shadow); color: var(--text); }
.segmented-sm button { padding: 3px 9px; min-height: 28px; font-size: 12px; }
.segmented.seg-ok button.active { background: var(--success-soft); color: #065f46; }
.segmented.seg-issue button.active { background: var(--danger-soft); color: #991b1b; }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .ig-icon { position: absolute; left: 10px; color: var(--muted); display: inline-flex; pointer-events: none; }
.input-group .input { padding-left: 38px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .input { width: auto; min-width: 140px; }
.toolbar .search-box { flex: 1; min-width: 200px; }
.toolbar .search-box .input { width: 100%; }
.plate-input { text-transform: uppercase; font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .04em; }

/* ---------- tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #fffbeb; }
.table th.num, .table td.num { text-align: right; }
.table tr.row-warn td { background: #fff7ed; }
.table tr.row-danger td { background: #fef2f2; }
.table tr.row-muted td { color: var(--muted); }
.card .table-wrap { border: 0; box-shadow: none; border-radius: 0; }

/* ---------- pills & badges */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; background: #e2e8f0; color: #334155; line-height: 1.4; }
.pill-checked_in { background: #e2e8f0; color: #334155; }
.pill-inspecting { background: var(--sky-soft); color: #075985; }
.pill-awaiting_approval { background: var(--violet-soft); color: #5b21b6; }
.pill-in_progress { background: var(--accent-soft); color: var(--accent-text); }
.pill-awaiting_parts { background: var(--warn-soft); color: #9a3412; }
.pill-ready { background: var(--success-soft); color: #065f46; }
.pill-collected { background: #f1f5f9; color: #64748b; }
.pill-cancelled { background: var(--danger-soft); color: #991b1b; }
.bpill-booked { background: var(--sky-soft); color: #075985; }
.bpill-confirmed { background: var(--success-soft); color: #065f46; }
.bpill-arrived { background: var(--accent-soft); color: var(--accent-text); }
.bpill-no_show { background: var(--danger-soft); color: #991b1b; }
.bpill-cancelled { background: #f1f5f9; color: #64748b; text-decoration: line-through; }
.bpill-converted { background: var(--violet-soft); color: #5b21b6; }
.ipill-issued { background: var(--warn-soft); color: #9a3412; }
.ipill-part_paid { background: var(--accent-soft); color: var(--accent-text); }
.ipill-paid { background: var(--success-soft); color: #065f46; }
.ipill-void { background: #f1f5f9; color: #64748b; text-decoration: line-through; }
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: #f1f5f9; color: #475569; white-space: nowrap; }
.badge-amber { background: var(--accent-soft); color: var(--accent-text); }
.badge-green { background: var(--success-soft); color: #065f46; }
.badge-red { background: var(--danger-soft); color: #991b1b; }
.badge-gray { background: #f1f5f9; color: #64748b; }
.badge-blue { background: var(--info-soft); color: #075985; }
.badge-violet { background: var(--violet-soft); color: #5b21b6; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.status-strip { display: flex; gap: 8px; flex-wrap: wrap; }
.status-count { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); font-weight: 600; font-size: 13px; }
.status-count b { font-size: 16px; }

/* ---------- tabs */
.tabbar { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabbar::-webkit-scrollbar { display: none; }
.tab { border: 0; background: transparent; padding: 10px 14px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; min-height: 42px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-badge { background: #e2e8f0; color: #334155; border-radius: 999px; padding: 0 7px; font-size: 12px; min-width: 20px; text-align: center; line-height: 20px; }
.tab.active .tab-badge { background: var(--accent); color: #0f172a; }

/* ---------- alerts, kv, lists, chips */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; border: 1px solid; font-size: 14px; }
.alert .icon { flex: none; margin-top: 1px; }
.alert-info { background: var(--info-soft); border-color: #bae6fd; color: #075985; }
.alert-warn { background: var(--warn-soft); border-color: #fed7aa; color: #9a3412; }
.alert-danger { background: var(--danger-soft); border-color: #fecaca; color: #991b1b; }
.alert-success { background: var(--success-soft); border-color: #a7f3d0; color: #065f46; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; min-width: 0; word-break: break-word; }
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item.clickable { cursor: pointer; margin: 0 -8px; padding: 11px 8px; border-radius: 8px; }
.list-item.clickable:hover { background: var(--surface-2); }
.chip-group { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; min-height: 34px; }
.chip:hover { border-color: var(--accent); }
.chip.selected { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.chip .icon { width: 16px; height: 16px; }
.phone-links { display: inline-flex; gap: 2px; vertical-align: middle; }

/* ---------- stepper & timeline */
.stepper { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.step { flex: 1; min-width: 92px; text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); position: relative; padding-top: 22px; }
.step::before { content: ""; position: absolute; top: 6px; left: 50%; transform: translateX(-50%); width: 12px; height: 12px; border-radius: 50%; background: #cbd5e1; border: 2px solid var(--surface); box-shadow: 0 0 0 2px #cbd5e1; z-index: 1; }
.step::after { content: ""; position: absolute; top: 11px; left: calc(50% + 8px); right: calc(-50% + 8px); height: 2px; background: #e2e8f0; }
.step:last-child::after { display: none; }
.step.done { color: #065f46; } .step.done::before { background: var(--success); box-shadow: 0 0 0 2px var(--success); } .step.done::after { background: var(--success); }
.step.active { color: var(--accent-text); } .step.active::before { background: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.step.cancelled { color: #991b1b; } .step.cancelled::before { background: var(--danger); box-shadow: 0 0 0 2px var(--danger); }
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.tl-item:last-child { border-bottom: 0; }
.tl-icon { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; color: var(--muted); flex: none; }
.tl-icon .icon { width: 16px; height: 16px; }
.tl-body { flex: 1; min-width: 0; font-size: 14px; } .tl-body .muted { font-size: 12px; }

/* ---------- slots, thumbs, dropdown */
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.slot { min-height: 40px; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; }
.slot:hover { border-color: var(--accent); }
.slot.selected { background: var(--accent); border-color: var(--accent); color: #0f172a; }
.slot.disabled { opacity: .35; cursor: not-allowed; text-decoration: line-through; }
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.thumb { position: relative; aspect-ratio: 4/3; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.thumb .thumb-del { position: absolute; top: 6px; right: 6px; background: rgba(15,23,42,.7); color: #fff; border: 0; }
.thumb .thumb-cap { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(15,23,42,.6); color: #fff; font-size: 11px; padding: 3px 6px; }
.dropdown-menu { position: absolute; z-index: 20; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); max-height: 320px; overflow-y: auto; min-width: 280px; width: 100%; margin-top: 4px; }
.dropdown-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 10px 12px; font: inherit; cursor: pointer; border-bottom: 1px solid var(--border); }
.dropdown-item:last-child { border-bottom: 0; }
.dropdown-item:hover, .dropdown-item:focus { background: #fffbeb; outline: none; }
.dropdown-empty { padding: 12px; color: var(--muted); font-size: 13px; }
.cpicker, .psearch { position: relative; }
.psearch .input { font-size: 16px; }
.sp-cat-title { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin: 10px 0 6px; }
.sp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.sp-card { display: block; border: 1px solid var(--border-strong); border-radius: 10px; padding: 10px 12px; cursor: pointer; background: var(--surface); position: relative; padding-left: 36px; }
.sp-card input { position: absolute; left: 11px; top: 13px; width: 16px; height: 16px; accent-color: var(--accent); }
.sp-card.selected { border-color: var(--accent); background: #fffbeb; }
.sp-name { font-weight: 600; font-size: 14px; } .sp-meta { font-size: 12px; color: var(--muted); }
.sp-summary { display: flex; gap: 18px; margin-top: 12px; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; font-size: 14px; flex-wrap: wrap; }

/* ---------- misc */
.empty { text-align: center; color: var(--muted); padding: 36px 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty .icon { width: 28px; height: 28px; opacity: .6; }
.spinner-wrap { display: flex; justify-content: center; padding: 40px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sticky-actions { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); padding: 12px 0; margin-top: 16px; display: flex; gap: 8px; justify-content: flex-end; z-index: 5; }
.chart-wrap { overflow-x: auto; }
.chart { width: 100%; max-height: 260px; display: block; }
.chart-bar { fill: var(--accent); } .chart-bar2 { fill: #94a3b8; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-label { font-size: 11px; fill: var(--muted); } .chart-val { font-size: 11px; fill: var(--text-2); font-weight: 600; }
.chart-legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-top: 6px; }
.chart-legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -2px; }
.sw1 { background: var(--accent); } .sw2 { background: #94a3b8; }

/* ---------- modal & toast */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100; animation: fade .12s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 640px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: pop .14s ease; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-sm { max-width: 440px; } .modal-lg { max-width: 920px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 10px; gap: 12px; }
.modal-body { padding: 6px 20px 16px; overflow-y: auto; }
.modal-footer { padding: 12px 20px 16px; border-top: 1px solid var(--border); }
#toast-root { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; width: min(92vw, 420px); pointer-events: none; }
.toast { background: #0f172a; color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: center; opacity: 0; transform: translateY(8px); transition: .25s; font-weight: 500; pointer-events: auto; }
.toast.show { opacity: 1; transform: none; }
.toast-success .icon { color: #34d399; } .toast-error { background: #7f1d1d; } .toast-error .icon { color: #fca5a5; } .toast-info .icon { color: #7dd3fc; }

/* ---------- login */
#login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(1200px 600px at 20% -10%, #fef3c7, transparent), var(--sidebar); }
.login-card { background: var(--surface); border-radius: 18px; padding: 32px 28px; width: 100%; max-width: 380px; box-shadow: var(--shadow-lg); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.login-brand .brand-icon { width: 44px; height: 44px; }
.login-brand .brand-icon .icon { width: 26px; height: 26px; }
.login-brand-text { font-weight: 800; font-size: 18px; line-height: 1.2; }
.login-brand-text .muted { font-weight: 500; font-size: 13px; }
.login-lang { display: flex; justify-content: center; margin-top: 18px; }

/* ---------- responsive */
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  #sidebar { transform: translateX(-100%); width: min(300px, 86vw); box-shadow: var(--shadow-lg); }
  #sidebar.open { transform: none; }
  .drawer-close { display: inline-flex; }
  #main { margin-left: 0; }
  .topbar-menu { display: inline-flex; }
  #topbar { padding: 0 14px; }
  #page { padding: 14px; padding-bottom: calc(var(--bottomnav-h) + 16px); }
  #bottomnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: var(--bottomnav-h); background: var(--surface); border-top: 1px solid var(--border); z-index: 35; padding-bottom: env(safe-area-inset-bottom); }
  .bnav-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); border: 0; background: transparent; font-family: inherit; cursor: pointer; }
  .bnav-item.active { color: var(--accent-600); }
  .bnav-item .icon { width: 22px; height: 22px; }
  .topbar-new span { display: none; }
  .topbar-new { width: 36px; padding: 6px; }
}
@media (max-width: 700px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .hide-m { display: none !important; }
  .only-m { display: initial; }
  h1 { font-size: 20px; }
  .kpi-value { font-size: 20px; }
  .card { padding: 14px; }
  .table th, .table td { padding: 9px 10px; }
  .sp-summary { gap: 10px; }
  .modal { max-height: calc(100vh - 16px); border-radius: 12px; }
  .modal-overlay { padding: 8px; align-items: flex-end; }
}
@media print { #sidebar, #topbar, #bottomnav, .page-actions, .sticky-actions, .print-hidden { display: none !important; } #main { margin: 0; } #page { padding: 0; } .card { box-shadow: none; border-color: #ccc; } }
