/* ============ Mani's Cars Town — friendly, big-and-simple admin UI ============ */
[hidden] { display: none !important; }
:root {
  color-scheme: light;
  --bg: #eef0f2;
  --surface: #ffffff;
  --surface-2: #e4e7ea;
  --hover: #dde1e5;
  --border: rgba(20,20,25,.10);
  --border-strong: rgba(20,20,25,.18);
  --text: #16171a;
  --text-soft: #52555c;
  --text-mute: #83868d;
  --primary: #8a6d1f;
  --primary-hover: #6e5518;
  --primary-soft: #fbf1d6;
  --chart-fill: #dcdfe3;
  --accent: #f8cf40;
  --danger: #d6362b;
  --danger-soft: #fdecec;
  --success: #16874f;
  --success-soft: #e6f8ee;
  --warn: #b8720a;
  --warn-soft: #fdf3e2;
  --sky: #0284c7;
  --sky-soft: #e7f4fc;
  --sidebar-bg: #0b0b0d;
  --sidebar-text: #9a9aa2;
  --sidebar-active: #3d3419;
  --ambient-glow:
    radial-gradient(1000px 620px at 10% -10%, rgba(255,255,255,.5), transparent 55%),
    radial-gradient(900px 650px at 100% 110%, rgba(178,181,190,.2), transparent 60%);
  --radius: 20px;
  --radius-sm: 13px;
  --shadow-sm: 0 1px 2px rgba(15,15,17,.08), 0 2px 8px rgba(15,15,17,.08);
  --shadow-md: 0 8px 20px -4px rgba(15,15,17,.16), 0 20px 40px -10px rgba(15,15,17,.18);
  --sidebar-w: 272px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Chart categorical palette — fixed hue order, validated for colorblind-safe
     adjacent separation (see the dataviz skill). Never reassign a slot based
     on data values; only ever append new categories in this order. */
  --viz-1: #2a78d6; /* blue */
  --viz-2: #eb6834; /* orange */
  --viz-3: #1baf7a; /* aqua */
  --viz-4: #eda100; /* yellow */
  --viz-5: #e87ba4; /* magenta */
  --viz-6: #4a3aa7; /* violet */
  --viz-neutral: #9aa3b8; /* for "Cancelled"/inactive segments — deliberately outside the categorical set */
  /* Status palette — fixed, never themed — reserved for state (good/warning/serious/critical), never reused as a plain series color. */
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical: #d03b3b;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #08080a;
  --surface: #111114;
  --surface-2: #17171b;
  --hover: #1c1c21;
  --border: rgba(255,255,255,.10);
  --border-strong: rgba(255,255,255,.18);
  --text: #f5f5f7;
  --text-soft: #b8b8c0;
  --text-mute: #7a7a82;
  --primary: #f8cf40;
  --primary-hover: #ffe27a;
  --primary-soft: #2a2410;
  --chart-fill: #1c1c21;
  --accent: #f8cf40;
  --danger: #f97066;
  --danger-soft: #2a1a1c;
  --success: #3ddc97;
  --success-soft: #10241d;
  --warn: #fdb022;
  --warn-soft: #2a2113;
  --sky: #38bdf8;
  --sky-soft: #10202c;
  --sidebar-bg: #050506;
  --ambient-glow:
    radial-gradient(1100px 680px at 10% -10%, rgba(255,255,255,.05), transparent 60%),
    radial-gradient(900px 650px at 100% 110%, rgba(255,255,255,.035), transparent 60%);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 16px 48px rgba(0,0,0,.6);

  --viz-1: #3987e5;
  --viz-2: #d95926;
  --viz-3: #199e70;
  --viz-4: #c98500;
  --viz-5: #d55181;
  --viz-6: #9085e9;
  --viz-neutral: #5b6786;
  /* status-* intentionally not redefined here — fixed across themes per the dataviz skill. */
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font); font-size: 15.5px; color: var(--text); -webkit-font-smoothing: antialiased; line-height: 1.55;
  background: var(--ambient-glow), var(--bg);
  background-attachment: fixed;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; color: var(--sidebar-text); background: var(--sidebar-bg);
  display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 40;
  border-right: 1px solid rgba(255,255,255,.08);
}
.brand { display: flex; align-items: center; gap: 13px; padding: 22px 20px 24px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark { width: 46px; height: 46px; border-radius: 13px; background: var(--sidebar-active); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 16px; }
.brand-logo { width: 46px; height: 46px; object-fit: contain; background: #fff; border-radius: 11px; padding: 4px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong { font-size: 16px; color: #fff; }
.brand-text span { font-size: 12px; color: #7b8192; }
.brand-has-logo { flex-direction: column; align-items: stretch; gap: 6px; }
.brand-has-logo .brand-logo { width: 100%; height: auto; max-height: 120px; background: none; padding: 0; border-radius: 0; }
.brand-has-logo .brand-tagline { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: #7b8192; text-align: center; }
.nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 14px; padding: 14px 14px; border-radius: 14px; font-size: 15.5px; font-weight: 600; color: #9aa0b0; margin-bottom: 4px; transition: .12s; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: linear-gradient(150deg, rgba(248,207,64,.16), rgba(248,207,64,.04)); border: 1px solid rgba(248,207,64,.4); color: #f8cf40; box-shadow: 0 6px 16px -4px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.08); }
.nav-item .ico { width: 22px; height: 22px; flex-shrink: 0; }
.nav-group { margin-bottom: 4px; }
.nav-group > summary { list-style: none; cursor: pointer; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after { content: '›'; margin-left: auto; font-size: 18px; line-height: 1; opacity: .7; transition: transform .15s; }
.nav-group[open] > summary::after { transform: rotate(90deg); }
.nav-sub { display: flex; flex-direction: column; margin: 3px 0 8px; }
.nav-subitem { padding: 11px 12px 11px 50px; border-radius: 12px; font-size: 14px; font-weight: 500; color: #9aa0b0; margin-bottom: 2px; transition: .12s; }
.nav-subitem:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-subitem.active { background: var(--sidebar-active); color: #fff; }
.sidebar-foot { padding: 16px; border-top: 1px solid rgba(255,255,255,.07); }
.user-chip { display: flex; align-items: center; gap: 11px; margin-bottom: 10px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: #262c3a; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.user-name { font-size: 14.5px; font-weight: 600; color: #f5f6f8; }
.logout { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: #9aa0b0; padding: 8px 10px; border-radius: 10px; }
.logout:hover { color: #fff; background: rgba(255,255,255,.08); }
.sidebar-credit { margin-top: 10px; padding: 0 10px; font-size: 11px; color: #6b7180; line-height: 1.4; }
.sidebar-credit a { color: #6b7180; text-decoration: underline; text-underline-offset: 2px; }
.sidebar-credit a:hover { color: var(--primary); }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.sidebar-backdrop { display: none; position: fixed; inset: 0; z-index: 45; background: rgba(9,13,22,.55);
  opacity: 0; pointer-events: none; transition: opacity .2s; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; background: var(--surface); border-bottom: 1px solid var(--border); padding: 12px 28px; }
.hamburger { display: none; background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: var(--text-soft); width: 40px; height: 40px; border-radius: 8px; flex-shrink: 0; }
.hamburger:hover { background: var(--hover); color: var(--primary); }
.global-search { flex: 1; max-width: 440px; position: relative; }
.global-search input { width: 100%; padding: 10px 14px; border: 1px solid var(--border-strong); border-radius: 10px; font-size: 13px; background: var(--surface-2); color: var(--text); }
.global-search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); background: var(--surface); }
.global-search .kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 10.5px; font-weight: 600; color: var(--text-mute); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 5px; padding: 2px 6px; pointer-events: none; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.quick-actions { display: flex; gap: 8px; }
.content { padding: 26px 28px 60px; max-width: 1480px; width: 100%; }

/* ---- topbar icon buttons + dropdowns ---- */
.tb-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px; border: 1.5px solid var(--border-strong); background: var(--surface-2); color: var(--text-soft);
  cursor: pointer; font-size: 18px; transition: .12s; }
.tb-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--surface); }
.tb-btn.on { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.theme-toggle { display: inline-flex; border: 1.5px solid var(--border-strong); border-radius: 12px; overflow: hidden; }
.theme-toggle button { width: 40px; height: 44px; border: 0; background: var(--surface-2); color: var(--text-mute); cursor: pointer; font-size: 15px; }
.theme-toggle button.on { background: var(--primary-soft); color: var(--primary); }

.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: var(--surface-2);
  border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-md); z-index: 60; padding: 6px; }
.menu-panel a, .menu-panel button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px;
  border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--text); background: none; border: 0; cursor: pointer;
  text-align: left; font-family: inherit; }
.menu-panel a:hover, .menu-panel button:hover { background: var(--hover); color: var(--primary); }
.menu-panel .sep { height: 1px; background: var(--border); margin: 5px 4px; }
.user-menu > summary { display: flex; align-items: center; gap: 9px; padding: 5px 8px 5px 5px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface-2); }
.user-menu > summary:hover { border-color: var(--primary); }
.user-menu .av { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(150deg, #3a3a42, #0e0e11); border: 1px solid rgba(255,255,255,.14); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.user-menu .un { display: flex; flex-direction: column; line-height: 1.2; }
.user-menu .un b { font-size: 12.5px; }
.user-menu .un span { font-size: 11px; color: var(--text-mute); }

/* ---- top-bar notifications bell ---- */
.notif { position: relative; }
.notif > summary { list-style: none; cursor: pointer; position: relative; display: inline-flex;
  align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 9px;
  border: 1px solid var(--border-strong); background: var(--surface-2); font-size: 17px; user-select: none; }
.notif > summary::-webkit-details-marker { display: none; }
.notif > summary { border-color: var(--border-strong); background: var(--surface-2); color: var(--text-soft); }
.notif > summary:hover { border-color: var(--primary); background: var(--surface); color: var(--primary); }
.notif[open] > summary { border-color: var(--primary); background: var(--surface); }
.notif-count { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 20px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; border: 2px solid var(--surface); }
.notif-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 360px; max-width: 84vw;
  max-height: 460px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 12px; box-shadow: var(--shadow-md); z-index: 50; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px;
  border-bottom: 1px solid var(--border); font-weight: 600; font-size: 13px; color: var(--text); }
.notif-head span { background: var(--surface-2); color: var(--text-soft); border-radius: 20px; padding: 2px 9px; font-size: 12px; }
.notif-empty { padding: 26px 16px; text-align: center; color: var(--text-mute); font-size: 13px; }
.notif-item { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; font-size: 12.5px;
  line-height: 1.45; color: var(--text); border-bottom: 1px solid var(--border); text-decoration: none; }
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--hover); }
.notif-badge { flex: 0 0 20px; height: 20px; border-radius: 6px; display: flex; align-items: center;
  justify-content: center; font-size: 11px; font-weight: 700; background: #eef0f3; color: #667085; }
.notif-item.lvl-danger .notif-badge { background: var(--danger-soft); color: var(--danger); }
.notif-item.lvl-warn .notif-badge { background: var(--warn-soft); color: var(--warn); }
.notif-item.lvl-info .notif-badge { background: var(--primary-soft); color: var(--primary); }
@media (max-width: 860px) { .notif-panel { width: 320px; } }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
.page-head .sub { color: var(--text-mute); font-size: 14px; margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 12px; font-size: 14.5px; font-weight: 700; border: 1px solid transparent; cursor: pointer; transition: .12s; white-space: nowrap; background: none; font-family: inherit; }
.btn-sm { padding: 9px 13px; font-size: 13px; border-radius: 10px; }
.btn-lg { padding: 15px 26px; font-size: 16px; font-weight: 700; }
.btn-primary { background: linear-gradient(150deg, #ffe27a, #f0c22e); border: 1px solid rgba(0,0,0,.08); color: #211a04; box-shadow: 0 4px 14px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.5); }
.btn-primary:hover { background: linear-gradient(150deg, #ffe994, #f8cf40); }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text-soft); }
.btn-ghost:hover { background: var(--hover); border-color: var(--border-strong); color: var(--text); }
.btn-danger { background: var(--surface); border-color: var(--border-strong); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: #fda29b; }
.btn-block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-link { color: var(--primary); font-weight: 600; padding: 0; }
.btn-link:hover { text-decoration: underline; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 22px 24px; }
.card + .card { margin-top: 18px; }
.card-head { padding: 18px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h2 { font-size: 16px; font-weight: 750; }

/* ---------- stat grid ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; align-items: stretch; }
.stat { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); overflow: hidden; }
.stat .label { display: block; font-size: 12px; color: var(--text-mute); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; line-height: 1.35; min-height: 2.4em; padding-right: 72px; }
.stat .value { font-size: 22px; font-weight: 700; margin-top: 8px; letter-spacing: -.01em; }
.stat .meta { font-size: 12px; color: var(--text-soft); margin-top: 4px; }
a.stat { display: block; transition: .12s; }
a.stat:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-1px); }
a.stat .value { color: inherit; }
.stat .go { position: absolute; top: 16px; right: 18px; float: none; font-size: 11px; color: var(--text-mute); font-weight: 600; white-space: nowrap; }
a.stat:hover .go { color: var(--primary); }
.stat.accent-green .value { color: var(--success); }
.stat.accent-red .value { color: var(--danger); }
.stat.accent-amber .value { color: var(--warn); }

/* ---------- tables ---------- */
/* Edge-fade hint when a table is wider than its box — two shadow layers pinned to
   the container edges (background-attachment:scroll) fade in only on the side that
   still has more to scroll, using two matching surface-color layers that travel
   with the content (background-attachment:local) to mask the shadow once scrolled
   past it. Pure CSS, no JS, works with the existing overflow-x:auto unchanged. */
.table-wrap {
  overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm);
  background-image:
    linear-gradient(to right, var(--surface) 30%, rgba(0,0,0,0)),
    linear-gradient(to left, var(--surface) 30%, rgba(0,0,0,0)),
    linear-gradient(to right, rgba(16,24,40,.12), rgba(0,0,0,0) 12px),
    linear-gradient(to left, rgba(16,24,40,.12), rgba(0,0,0,0) 12px);
  background-repeat: no-repeat;
  background-size: 40px 100%, 40px 100%, 12px 100%, 12px 100%;
  background-position: 0 0, 100% 0, 0 0, 100% 0;
  background-attachment: local, local, scroll, scroll;
}
table.data { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 720px; }
table.data th { text-align: left; padding: 13px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-mute); font-weight: 700; white-space: nowrap; }
table.data td { padding: 15px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
table.data td.wrap { white-space: normal; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--hover); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .strong { font-weight: 650; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* Financial columns (revenue/expenses/profit) hidden by default on the Vehicles list
   to keep the table narrow enough to fit the screen without side-scrolling; a checkbox
   above the table reveals them again for anyone doing P&L analysis. */
table.data .col-fin { display: none; }
table.data.show-fin .col-fin { display: table-cell; }
/* Vehicles list specifically: tighter padding + a capped, wrapping name column so the
   table fits typical laptop screens without a horizontal scrollbar. */
#vehiclesTable th, #vehiclesTable td { padding-left: 10px; padding-right: 10px; }
#vehiclesTable td.wrap { max-width: 190px; }
#vehiclesTable .vt-btn { padding: 6px 11px; }
#vehiclesTable .btn-sm { padding: 7px 10px; font-size: 12.5px; }
.fin-toggle { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-mute); margin-bottom: 10px; cursor: pointer; user-select: none; }
.fin-toggle input { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
.fin-toggle:hover { color: var(--text); }

/* "Show on Website?" Yes/No segmented control — reads as a question with two clear
   answers instead of a single ambiguous hide/show button. */
.visibility-toggle { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px; gap: 2px; }
.vt-btn { border: none; background: transparent; padding: 6px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 700; line-height: 1; cursor: pointer; color: var(--text-mute); transition: background .15s, color .15s, opacity .15s; }
.vt-btn:hover:not(.active):not(:disabled) { background: var(--hover); color: var(--text); }
.vt-btn.active[data-value="1"] { background: linear-gradient(150deg, #34d399, #059669); color: #fff; box-shadow: var(--shadow-sm); }
.vt-btn.active[data-value="0"] { background: linear-gradient(150deg, #f87171, #dc2626); color: #fff; box-shadow: var(--shadow-sm); }
.vt-btn:disabled { cursor: wait; opacity: .7; }

/* Small floating confirmation after an AJAX action, so the page never needs to
   reload (and jump the scroll position back to the top) just to confirm a save. */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(12px); z-index: 500; padding: 11px 20px; border-radius: 999px; font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-lg, 0 8px 24px rgba(0,0,0,.25)); opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-success { background: var(--success-soft); color: var(--success); border: 1px solid #a6f4c5; }
.toast-error { background: var(--danger-soft); color: var(--danger); border: 1px solid #fda29b; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; font-size: 18px; line-height: 1; box-shadow: var(--shadow-sm); transition: .12s; }
.icon-btn:hover { background: linear-gradient(150deg, #3a3a42, #0e0e11); border-color: rgba(255,255,255,.14); color: #fff; transform: translateY(-1px); }
.icon-btn.danger { color: var(--danger); }
.icon-btn.danger:hover { color: #fff; background: var(--danger); border-color: var(--danger); }

/* hover tooltip bubble (see app.js) */
.tip-bubble { position: fixed; z-index: 200; transform: translate(-50%, -100%);
  background: var(--text); color: var(--surface); font-size: 11.5px; font-weight: 600;
  line-height: 1; padding: 6px 8px; border-radius: 6px; white-space: nowrap;
  pointer-events: none; opacity: 0; transition: opacity .1s; box-shadow: var(--shadow-md); }
.tip-bubble.show { opacity: 1; }
.empty { text-align: center; padding: 54px 20px; color: var(--text-mute); }
.empty h3 { font-size: 15px; color: var(--text-soft); margin-bottom: 6px; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--text-soft); white-space: nowrap; }
.badge-draft { background: var(--surface-2); color: var(--text-mute); }
.badge-sent { background: var(--primary-soft); color: var(--primary); }
.badge-accepted, .badge-paid, .badge-issued { background: var(--success-soft); color: var(--success); }
.badge-partially-paid { background: var(--warn-soft); color: var(--warn); }
.badge-rejected, .badge-cancelled, .badge-expired, .badge-carried-forward { background: var(--surface-2); color: var(--text-mute); }
.badge-overdue { background: var(--danger-soft); color: var(--danger); }
.badge-due-today { background: var(--warn-soft); color: var(--warn); }
.badge-upcoming { background: var(--surface-2); color: var(--text-mute); }
.badge-active { background: var(--success-soft); color: var(--success); }
.badge-completed { background: var(--primary-soft); color: var(--primary); }
.badge-on-hold { background: var(--warn-soft); color: var(--warn); }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13.5px; font-weight: 700; color: var(--text-soft); }
.field label .req { color: var(--danger); }
.field input, .field select, .field textarea {
  padding: 12px 14px; border: 1.5px solid var(--border-strong); border-radius: 11px; font-size: 15px;
  font-family: inherit; background: var(--surface); color: var(--text); width: 100%;
}
.field textarea { resize: vertical; min-height: 74px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field .hint { font-size: 11.5px; color: var(--text-mute); }
/* Show/hide toggle, added automatically to every password field by app.js */
.password-wrap { position: relative; width: 100%; }
.password-wrap input { width: 100%; padding-right: 38px !important; }
.password-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; display: grid; place-items: center;
  background: none; border: 0; border-radius: 6px; cursor: pointer; font-size: 14px; line-height: 1; padding: 0;
}
.password-toggle:hover { background: var(--hover); }
/* Standalone guidance text (form section intros, "what is this for" notes) — not nested in .field. */
p.hint { font-size: 12.5px; color: var(--text-soft); background: var(--primary-soft); border-radius: var(--radius-sm); padding: 8px 12px; line-height: 1.5; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.field .err { font-size: 11.5px; color: var(--danger); font-weight: 500; }
.form-section { margin-bottom: 24px; }
.form-section > h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-mute); margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.form-foot { display: flex; gap: 10px; justify-content: flex-end; padding-top: 8px; }
.inline-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-soft); }
.inline-check input { width: auto; }

/* ---------- line items ---------- */
.items-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.items-table th { text-align: left; padding: 8px 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-mute); border-bottom: 1px solid var(--border); }
.items-table td { padding: 6px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.items-table input, .items-table select, .items-table textarea { padding: 7px 9px; border: 1px solid var(--border-strong); border-radius: 6px; font-size: 13px; width: 100%; font-family: inherit; }
.items-table textarea { min-height: 34px; resize: vertical; }
.items-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.items-table .line-amt { padding-top: 14px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.col-remove { width: 34px; }
.totals-box { margin-left: auto; margin-top: 16px; width: 340px; max-width: 100%; }
.totals-box .row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; }
.totals-box .row.grand { border-top: 2px solid var(--text); margin-top: 6px; padding-top: 10px; font-size: 16px; font-weight: 700; }
.totals-box .row .val { font-variant-numeric: tabular-nums; }
.words-line { font-size: 12.5px; color: var(--text-soft); font-style: italic; margin-top: 8px; text-align: right; }

/* ---------- filters ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters .field { min-width: 150px; gap: 4px; }
.filters .field label { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-mute); }
.filters .field input, .filters .field select { padding: 7px 10px; font-size: 12.5px; }

/* ---------- alerts ---------- */
.alert { padding: 11px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; font-weight: 500; border: 1px solid; }
.alert-success { background: var(--success-soft); border-color: #a6f4c5; color: var(--success); }
.alert-error { background: var(--danger-soft); border-color: #fda29b; color: var(--danger); }
.alert-info { background: var(--primary-soft); border-color: #c7d2fe; color: var(--primary); }
.alert-warn { background: var(--warn-soft); border-color: #fedf89; color: var(--warn); }

/* ---------- misc ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 20px; }
.grid-2:last-child, .grid-3:last-child { margin-bottom: 0; }
/* grid/flex children must be allowed to shrink below their content, or a wide
   child (e.g. a min-width table) blows the track out and clips the row */
.grid-2 > *, .grid-3 > *, .stat-grid > * { min-width: 0; }
/* dashboard mini-tables have few columns — let them fit the card, no 720px floor */
.grid-2 table.data, .grid-3 table.data { min-width: 0; font-size: 12.5px; }
.grid-2 table.data th, .grid-2 table.data td,
.grid-3 table.data th, .grid-3 table.data td { padding-left: 8px; padding-right: 8px; }
.muted { color: var(--text-mute); }

.booking-type-select { display: flex; gap: 10px; flex-wrap: wrap; }
.booking-type-select input[type=radio] { position: absolute; opacity: 0; width: 0; height: 0; }
.booking-type-select label { flex: 1; min-width: 200px; cursor: pointer; border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; background: var(--surface-2); transition: border-color .15s, background .15s; }
.booking-type-select label b { display: block; font-size: 14px; margin-bottom: 3px; }
.booking-type-select label span { font-size: 12px; color: var(--text-soft); }
.booking-type-select input[type=radio]:checked + label { border-color: var(--primary); background: var(--primary-soft); }
.booking-type-select input[type=radio]:focus-visible + label { outline: 2px solid var(--primary); outline-offset: 2px; }
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; font-size: 13px; }
.dl dt { color: var(--text-mute); font-weight: 500; }
.dl dd { color: var(--text); }
.tag-link { color: var(--primary); font-weight: 600; transition: color .12s; }
.tag-link:hover { color: var(--primary-hover); text-decoration: underline; text-underline-offset: 2px; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.pill-tabs { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 3px; margin-bottom: 18px; flex-wrap: wrap; }
.pill-tabs a { padding: 7px 13px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--text-soft); }
.pill-tabs a.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.pagination { display: flex; gap: 6px; margin-top: 16px; justify-content: flex-end; }
.pagination a, .pagination span { padding: 6px 11px; border: 1px solid var(--border); border-radius: 7px; font-size: 12.5px; background: var(--surface); }
.pagination .current { background: linear-gradient(150deg, #3a3a42, #0e0e11); color: #fff; border-color: rgba(255,255,255,.14); }
.doc-type-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.doc-type-card { display: block; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); transition: .12s; }
.doc-type-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.doc-type-card .t { font-weight: 650; font-size: 14px; margin-bottom: 4px; }
.doc-type-card .d { font-size: 12px; color: var(--text-mute); }

/* icons (simple css shapes via unicode) */
.ico { width: 16px; height: 16px; display: inline-block; opacity: .9; background: currentColor; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: center; mask-position: center; -webkit-mask-size: contain; mask-size: contain; }
.ico-grid { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='3' y='3' width='7' height='7'/%3E%3Crect x='14' y='3' width='7' height='7'/%3E%3Crect x='14' y='14' width='7' height='7'/%3E%3Crect x='3' y='14' width='7' height='7'/%3E%3C/svg%3E"); }
.ico-file { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3C/svg%3E"); }
.ico-wallet { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M21 12V7H5a2 2 0 0 1 0-4h14v4'/%3E%3Cpath d='M3 5v14a2 2 0 0 0 2 2h16v-5'/%3E%3Cpath d='M18 12a2 2 0 0 0 0 4h4v-4z'/%3E%3C/svg%3E"); }
.ico-receipt { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z'/%3E%3Cpath d='M8 7h8M8 11h8M8 15h5'/%3E%3C/svg%3E"); }
.ico-ledger { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M3 3h18v18H3z'/%3E%3Cpath d='M3 9h18M9 21V9'/%3E%3C/svg%3E"); }
.ico-users { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M22 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E"); }
.ico-folder { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z'/%3E%3C/svg%3E"); }
.ico-download { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='7 10 12 15 17 10'/%3E%3Cline x1='12' y1='15' x2='12' y2='3'/%3E%3C/svg%3E"); }
.ico-cog { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.6 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.6a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z'/%3E%3C/svg%3E"); }
.ico-tag { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M20.59 13.41 13.42 20.6a2 2 0 0 1-2.83 0l-7.18-7.19A2 2 0 0 1 2.81 12V4a2 2 0 0 1 2-2h8a2 2 0 0 1 1.41.59l6.37 6.36a2 2 0 0 1 0 2.83z'/%3E%3Cline x1='7' y1='7' x2='7.01' y2='7'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M20.59 13.41 13.42 20.6a2 2 0 0 1-2.83 0l-7.18-7.19A2 2 0 0 1 2.81 12V4a2 2 0 0 1 2-2h8a2 2 0 0 1 1.41.59l6.37 6.36a2 2 0 0 1 0 2.83z'/%3E%3Cline x1='7' y1='7' x2='7.01' y2='7'/%3E%3C/svg%3E"); }
.ico-archive { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='2' y='3' width='20' height='5'/%3E%3Cpath d='M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8'/%3E%3Cline x1='10' y1='12' x2='14' y2='12'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='2' y='3' width='20' height='5'/%3E%3Cpath d='M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8'/%3E%3Cline x1='10' y1='12' x2='14' y2='12'/%3E%3C/svg%3E"); }

/* ---------- password field with show/hide ---------- */
.pw-wrap { position: relative; display: flex; align-items: center; }
.pw-wrap input { flex: 1; padding-right: 62px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--primary); font-size: 12px; font-weight: 600; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.pw-toggle:hover { background: var(--hover); color: var(--primary); }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 700px at 25% -10%, #3a3a44, #08080a 60%), radial-gradient(900px 600px at 100% 110%, #2c2c34, transparent 60%), #08080a; padding: 24px; }
.login-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 24px; box-shadow: 0 24px 70px rgba(0,0,0,.55);
  width: 100%; max-width: 420px; padding: 42px 38px;
}
.login-card .brand-mark { width: 56px; height: 56px; border-radius: 15px; font-size: 20px; margin-bottom: 20px; }
.login-card h1 { font-size: 23px; font-weight: 800; margin-bottom: 6px; }
.login-card p.sub { color: var(--text-mute); font-size: 14.5px; margin-bottom: 26px; }

/* ---------- dashboard analytics ---------- */
.chart-bars { display: flex; align-items: flex-end; gap: 14px; height: 172px; padding-top: 8px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart-stack { display: flex; align-items: flex-end; gap: 4px; height: 140px; }
.chart-stack .bar { width: 16px; border-radius: 3px 3px 0 0; min-height: 2px; transition: height .3s; }
.bar-billed, .dot-billed { background: #c7d2fe; }
.bar-recv, .dot-recv { background: var(--primary); }
.chart-x { font-size: 11px; color: var(--text-mute); font-weight: 600; }
.chart-legend { display: flex; gap: 16px; margin-top: 12px; font-size: 12px; color: var(--text-soft); }
.chart-legend .dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 5px; }

.meter-row { margin-bottom: 12px; }
.meter-top { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 5px; }
.meter-top b { font-variant-numeric: tabular-nums; }
.meter { height: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--primary); border-radius: 5px; min-width: 2px; }

.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-table td { padding: 7px 4px; border-bottom: 1px solid var(--border); }
.mini-table tr:last-child td { border-bottom: 0; }
.mini-table .num { text-align: right; font-variant-numeric: tabular-nums; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); padding: 5px 9px; border-radius: 8px; }

.proj-list { display: flex; flex-direction: column; }
.proj-item { display: block; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.proj-item:last-child { border-bottom: 0; }
.proj-item:hover { background: var(--hover); }
.proj-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.proj-name { font-size: 13px; font-weight: 650; display: flex; align-items: center; gap: 6px; }
.proj-pending { font-size: 12.5px; font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
.proj-sub { font-size: 11.5px; color: var(--text-mute); margin: 3px 0 7px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.proj-item .meter { height: 6px; }

.activity { display: flex; flex-direction: column; }
.act-row { display: flex; align-items: center; gap: 12px; padding: 11px 20px; border-bottom: 1px solid var(--border); }
.act-row:last-child { border-bottom: 0; }
.act-row:hover { background: var(--hover); }
.act-ico { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: var(--text-mute); }
.act-document { background: var(--primary); }
.act-payment { background: var(--success); }
.act-refund { background: var(--danger); }
.act-receipt { background: var(--warn); }
.act-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.act-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-sub { font-size: 11.5px; color: var(--text-mute); }
.act-amt { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- payment screenshot OCR ---------- */
.ocr-drop { border: 1.5px dashed var(--border-strong); border-radius: 12px; padding: 16px; margin-bottom: 18px; background: var(--surface-2); transition: .15s; }
.ocr-drop.drag { border-color: var(--primary); background: var(--primary-soft); }
.ocr-inner { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 7px; padding: 10px; }
.ocr-inner .ocr-ic { font-size: 26px; }
.ocr-inner b { font-size: 13.5px; }
.ocr-inner span { font-size: 11.5px; color: var(--text-mute); max-width: 340px; }
.ocr-preview { display: flex; gap: 14px; align-items: flex-start; }
.ocr-preview img { width: 150px; max-height: 210px; object-fit: contain; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.ocr-preview-side { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
.ocr-status { font-size: 12px; color: var(--text-soft); line-height: 1.5; }
.ocr-status .busy { color: var(--primary); font-weight: 600; }
.ocr-status .done { color: var(--success); font-weight: 600; }
.ocr-status .warn { color: var(--warn); font-weight: 600; }
.ocr-bar { height: 5px; border-radius: 4px; background: var(--border); overflow: hidden; }
.ocr-bar span { display: block; height: 100%; background: var(--primary); width: 0; transition: width .3s; }
.ocr-hit { animation: ocrHit 1s ease; }
@keyframes ocrHit { 0% { background: var(--success-soft); } 100% { background: transparent; } }

/* ---------- balance preview ---------- */
.balance-panel { position: sticky; top: 84px; }
.bal-row { display: flex; justify-content: space-between; padding: 7px 0; font-size: 13px; border-bottom: 1px dashed var(--border); }
.bal-row.total { border-bottom: 0; border-top: 2px solid var(--text); margin-top: 4px; padding-top: 10px; font-size: 14px; }
.bal-row.total.ok strong { color: var(--danger); }
.bal-row.total.over strong { color: var(--danger); }
.bal-row strong { font-variant-numeric: tabular-nums; }
.bal-warn { margin-top: 10px; font-size: 12px; color: var(--danger); background: var(--danger-soft); padding: 8px 10px; border-radius: 6px; }

/* ============ dashboard v2 (mockup theme) ============ */
.dash-hd { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.dash-hd h1 { font-size: 23px; font-weight: 700; letter-spacing: -.02em; }
.dash-hd .sub { color: var(--text-mute); font-size: 13px; margin-top: 4px; }
.dash-hd-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dash-date { font-size: 12.5px; color: var(--text-mute); }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; }
.seg a { padding: 6px 12px; border-radius: 7px; font-size: 12px; font-weight: 600; color: var(--text-mute); }
.seg a.on { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }

/* Fluid by design — no fixed column count, so it can never squeeze a card
   narrower than it needs and force text to overflow/overlap. Each tile takes
   at least 200px and the row wraps on its own as the viewport shrinks. */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi {
  background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; min-width: 0; transition: .12s;
}
a.kpi:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { font-size: 13.5px; color: var(--text-soft); font-weight: 700; }
.kpi-chip { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 20px; display: inline-flex; align-items: center; gap: 3px; }
.kpi-chip.up { background: var(--success-soft); color: var(--success); }
.kpi-chip.down { background: var(--danger-soft); color: var(--danger); }
.kpi-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; flex-shrink: 0; }
.kpi-ico.b { background: var(--primary-soft); color: var(--primary); }
.kpi-ico.a { background: var(--warn-soft); color: var(--warn); }
.kpi-ico.r { background: var(--danger-soft); color: var(--danger); }
.kpi-ico.g { background: var(--success-soft); color: var(--success); }
.kpi-ico.s { background: var(--sky-soft); color: var(--sky); }
.kpi-val { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin: 12px 0 2px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12.5px; color: var(--text-mute); }

/* ---------- home-screen tiles (dashboard main menu) ---------- */
/* Fixed column counts (not auto-fit) so a half-empty last row always lines up
   under full columns instead of leaving one ragged, oddly-narrow row. */
.home-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 24px; }
@media (min-width: 561px) { .home-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 861px) { .home-grid { grid-template-columns: repeat(5, 1fr); } }
.home-tile {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border); border-radius: 20px; padding: 20px 16px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; transition: .12s; min-width: 0;
}
.home-tile:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-3px); }
.home-tile .home-ico { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 26px; background: var(--primary-soft); color: var(--primary); }
.home-tile .home-ico.danger { background: var(--danger-soft); color: var(--danger); }
.home-tile .home-label { font-size: 14.5px; font-weight: 750; color: var(--text); }
.home-tile .home-count { font-size: 11.5px; font-weight: 700; color: var(--text-mute); }
.home-tile .home-badge { position: absolute; top: 10px; right: 10px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 20px; background: var(--danger); color: #fff; font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.chart-box canvas { position: absolute; inset: 0; max-width: 100%; }

.dash-grid { display: grid; grid-template-columns: 2fr 1.15fr 1fr; gap: 18px; margin-bottom: 18px; align-items: start; }
.dash-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; align-items: start; }
.dash-grid > *, .dash-grid-2 > * { min-width: 0; }
.dash-grid table.data, .dash-grid-2 table.data { min-width: 0; font-size: 12.5px; }
.dash-grid table.data th, .dash-grid table.data td,
.dash-grid-2 table.data th, .dash-grid-2 table.data td { padding-left: 12px; padding-right: 12px; }
.dash-grid .table-wrap, .dash-grid-2 .table-wrap { border: 0; box-shadow: none; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.panel-hd { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.panel-hd h2 { font-size: 14px; font-weight: 700; }
.panel-hd .lnk { font-size: 12px; font-weight: 600; color: var(--primary); transition: color .12s; }
.panel-hd .lnk:hover { color: var(--primary-hover); text-decoration: underline; text-underline-offset: 2px; }
.panel-bd { padding: 16px 18px; }
.panel-bd.flush { padding: 4px 0; }
.panel > .table-wrap { border: 0; box-shadow: none; border-radius: 0 0 var(--radius) var(--radius); }
.panel > .table-wrap table.data { border-radius: 0; }
.chart-box { position: relative; height: 260px; width: 100%; min-width: 0; overflow: hidden; padding: 8px 4px 0; }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut-box { position: relative; width: 150px; height: 150px; flex-shrink: 0; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-center b { font-size: 20px; font-weight: 750; }
.donut-center span { font-size: 10.5px; color: var(--text-mute); }
.donut-legend { flex: 1; min-width: 130px; display: flex; flex-direction: column; gap: 7px; }
.dl-row { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 4px 6px; margin: 0 -6px; border-radius: 7px; transition: background .12s; }
a.dl-row:hover { background: var(--hover); }
a.dl-row:hover .nm { color: var(--primary); }
.dl-row i { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.dl-row .nm { color: var(--text-soft); }
.dl-row .ct { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.dl-row .pc { color: var(--text-mute); width: 38px; text-align: right; font-variant-numeric: tabular-nums; }

.rem-list, .mini-list { display: flex; flex-direction: column; }
.rem-row { display: flex; align-items: center; gap: 11px; padding: 11px 18px; border-bottom: 1px solid var(--border); }
.rem-row:last-child { border-bottom: 0; }
.rem-row { transition: background .12s; }
.rem-row:hover { background: var(--hover); }
a.rem-row:hover .rem-main b { color: var(--primary); }
.rem-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-size: 13px; flex-shrink: 0; background: var(--primary-soft); color: var(--primary); }
.rem-ic.g { background: var(--success-soft); color: var(--success); }
.rem-ic.r { background: var(--danger-soft); color: var(--danger); }
.rem-ic.a { background: var(--warn-soft); color: var(--warn); }
.rem-main { flex: 1; min-width: 0; }
.rem-main b { font-size: 12.5px; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rem-main span { font-size: 11px; color: var(--text-mute); }
.rem-when { font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 20px; white-space: nowrap; background: var(--surface-2); color: var(--text-soft); }
.rem-when.soon { background: var(--danger-soft); color: var(--danger); }
.rem-when.mid { background: var(--warn-soft); color: var(--warn); }
.rem-when.ok { background: var(--success-soft); color: var(--success); }

.qstat-row { display: flex; align-items: center; gap: 11px; padding: 11px 18px; border-bottom: 1px solid var(--border); font-size: 13px; }
.qstat-row:last-child { border-bottom: 0; }
.qstat-row { transition: background .12s; }
.qstat-row:hover { background: var(--hover); }
a.qstat-row:hover .nm { color: var(--primary); }
a.qstat-row:hover .ch { color: var(--primary); }
.qstat-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-size: 14px; background: var(--primary-soft); color: var(--primary); flex-shrink: 0; }
.qstat-row .nm { color: var(--text-soft); }
.qstat-row .v { margin-left: auto; font-weight: 750; font-variant-numeric: tabular-nums; }
.qstat-row .ch { color: var(--text-mute); }

.dash-cta { background: linear-gradient(145deg, #38383f, #0a0a0d); border: 1px solid rgba(255,255,255,.12); box-shadow: inset 0 1px 0 rgba(255,255,255,.12); color: #fff; border-radius: var(--radius); padding: 20px; }
.dash-cta h3 { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.dash-cta p { font-size: 12px; opacity: .9; line-height: 1.5; }

/* ---------- responsive ---------- */
@media (max-width: 1240px) {
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .dash-grid > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 1100px) {
  .stat-grid, .doc-type-cards { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 980px) {
  .dash-grid, .dash-grid-2 { grid-template-columns: 1fr; }
  .dash-grid > :first-child { grid-column: auto; }
}

/* ---- tablet / phone: sidebar becomes a slide-in drawer ---- */
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; z-index: 50; will-change: transform; }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 44px rgba(0,0,0,.4); }
  .sidebar-backdrop { display: block; }
  .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }
  .main { margin-left: 0; }
  .hamburger { display: inline-flex; align-items: center; justify-content: center; }
  .quick-actions { display: none; }
  .form-grid, .grid-2, .grid-3, .dash-grid, .dash-grid-2 { grid-template-columns: 1fr; }
  .content { padding: 18px 16px 48px; }
  .topbar { padding: 10px 14px; gap: 8px 10px; flex-wrap: wrap; }
  .global-search { max-width: none; order: 3; flex-basis: 100%; min-width: 0; }
  .global-search .kbd { display: none; }
  .user-menu .un { display: none; }
  .topbar-right { gap: 8px; flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
  .topbar-right .menu-panel { position: fixed; left: 12px; right: 12px; top: 60px; width: auto; min-width: 0; }
  .dash-hd, .page-head { gap: 10px; }
  .dash-hd-right, .page-actions { width: 100%; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  table.data th, table.data td { padding: 10px 12px; }
  .dl { grid-template-columns: 1fr !important; gap: 3px 0; }
  .dl dt { margin-top: 10px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-mute); }
  .dl dt:first-child { margin-top: 0; }
  .totals-box { margin-left: 0; width: 100%; }
  .form-foot { flex-direction: column-reverse; }
  .form-foot .btn { width: 100%; justify-content: center; }
}

/* ---- phone ---- */
@media (max-width: 640px) {
  /* 16px keeps iOS Safari from zooming in on field focus */
  .field input, .field select, .field textarea,
  .filters .field input, .filters .field select,
  .items-table input, .items-table select, .items-table textarea,
  .global-search input { font-size: 16px; }
  .filters { gap: 8px; }
  .filters .field { min-width: 0; flex: 1 1 45%; }
  .items-table { min-width: 560px; }
}
@media (max-width: 560px) {
  .stat-grid, .doc-type-cards { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: 1fr; }
  .page-head h1, .dash-hd h1 { font-size: 19px; }
  .content { padding: 14px 12px 44px; }
  .card-pad { padding: 16px 14px; }
  .panel-hd, .panel-bd { padding-left: 14px; padding-right: 14px; }
  .chart-box { height: 220px; }
  .dash-hd-right .btn, .page-actions .btn { flex: 1 1 auto; justify-content: center; }
  .btn { padding: 10px 14px; }
  .kbd { display: none; }
  #createMenu .lbl { display: none; }
}

/* ============ Fleet Rental additions ============ */
.ico-car { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M5 17h14M5 17a2 2 0 1 1-4 0 2 2 0 0 1 4 0Zm14 0a2 2 0 1 0 4 0 2 2 0 0 0-4 0ZM3 17V11l2-5h14l2 5v6'/%3E%3Cpath d='M5 11h14'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M5 17h14M5 17a2 2 0 1 1-4 0 2 2 0 0 1 4 0Zm14 0a2 2 0 1 0 4 0 2 2 0 0 0-4 0ZM3 17V11l2-5h14l2 5v6'/%3E%3Cpath d='M5 11h14'/%3E%3C/svg%3E"); }
.ico-id { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='2' y='5' width='20' height='14' rx='2'/%3E%3Ccircle cx='8' cy='12' r='2'/%3E%3Cpath d='M14 10h6M14 14h4'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='2' y='5' width='20' height='14' rx='2'/%3E%3Ccircle cx='8' cy='12' r='2'/%3E%3Cpath d='M14 10h6M14 14h4'/%3E%3C/svg%3E"); }
.ico-wrench { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M14.7 6.3a4 4 0 1 0-5.66 5.66l-6 6a1.5 1.5 0 0 0 2.12 2.12l6-6a4 4 0 0 0 5.66-5.66l-2.83 2.83-2.12-2.12z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M14.7 6.3a4 4 0 1 0-5.66 5.66l-6 6a1.5 1.5 0 0 0 2.12 2.12l6-6a4 4 0 0 0 5.66-5.66l-2.83 2.83-2.12-2.12z'/%3E%3C/svg%3E"); }
.ico-bell { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M18 8a6 6 0 0 0-12 0c0 7-3 9-3 9h18s-3-2-3-9'/%3E%3Cpath d='M13.73 21a2 2 0 0 1-3.46 0'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M18 8a6 6 0 0 0-12 0c0 7-3 9-3 9h18s-3-2-3-9'/%3E%3Cpath d='M13.73 21a2 2 0 0 1-3.46 0'/%3E%3C/svg%3E"); }

.badge-available { background: var(--success-soft); color: var(--success); }
.badge-on-rent { background: var(--primary-soft); color: var(--primary); }
.badge-maintenance { background: var(--warn-soft); color: var(--warn); }
.badge-inactive { background: var(--surface-2); color: var(--text-mute); }
.badge-reserved { background: var(--sky-soft); color: var(--sky); }
.badge-confirmed { background: var(--primary-soft); color: var(--primary); }
.badge-out { background: var(--warn-soft); color: var(--warn); }
.badge-returned { background: var(--sky-soft); color: var(--sky); }
.badge-closed { background: var(--success-soft); color: var(--success); }
.badge-cancelled { background: var(--surface-2); color: var(--text-mute); }
.badge-held { background: var(--warn-soft); color: var(--warn); }
.badge-refunded { background: var(--success-soft); color: var(--success); }
.badge-adjusted { background: var(--primary-soft); color: var(--primary); }
.badge-forfeited { background: var(--danger-soft); color: var(--danger); }
.badge-pending { background: var(--warn-soft); color: var(--warn); }
.badge-verified { background: var(--success-soft); color: var(--success); }
.badge-rejected { background: var(--danger-soft); color: var(--danger); }
.badge-scheduled { background: var(--sky-soft); color: var(--sky); }
.badge-in-progress { background: var(--warn-soft); color: var(--warn); }
.badge-done { background: var(--success-soft); color: var(--success); }
.badge-converted { background: var(--success-soft); color: var(--success); }
.badge-sell { background: var(--danger-soft); color: var(--danger); }

/* ---- charts (inline SVG, no JS library) ---- */
.chart-svg { width: 100%; height: auto; overflow: visible; }
.chart-label { font-size: 9px; fill: var(--text-mute); font-family: var(--font); }
.chart-axis { stroke: var(--border); stroke-width: 1; }
.chart-donut-total { font-size: 22px; font-weight: 800; fill: var(--text); font-family: var(--font); }
.chart-row { display: flex; align-items: center; justify-content: center; gap: 24px; flex-wrap: wrap; }
.chart-row .donut-wrap { flex-shrink: 0; width: 160px; }
.chart-legend { display: flex; flex-direction: column; gap: 8px; min-width: 160px; }
.chart-legend-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.chart-legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.chart-legend-label { color: var(--text-soft); flex: 1; }
.chart-legend-val { font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---- insight panels ---- */
.insight-list { list-style: none; margin: 0; padding: 0; }
.insight-item { display: flex; gap: 10px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.insight-item:last-child { border-bottom: 0; }
.insight-ico { font-size: 16px; flex-shrink: 0; line-height: 1.4; }
.insight-body a { font-weight: 650; }
.insight-body p { margin: 2px 0 0; color: var(--text-soft); }
.insight-banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 13.5px; border: 1px solid; }
.insight-banner.level-danger { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.insight-banner.level-warn { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.insight-banner.level-info { background: var(--sky-soft); border-color: var(--sky); color: var(--sky); }
.insight-banner .insight-ico { font-size: 18px; }
.insight-banner p { margin: 0; color: inherit; }

.kpi-link { display: block; }
.kpi-link:hover .kpi { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-1px); }

.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-mute { color: var(--text-mute); }
.text-warn { color: var(--warn); }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mb-8 { margin-bottom: 8px; }

.thumb-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.thumb-grid img, .thumb-grid video { width: 110px; height: 82px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); background: #000; }
.thumb-grid a { display: block; }

.action-list { list-style: none; margin: 0; padding: 0; }
.action-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.action-list li:last-child { border-bottom: 0; }
.action-list .wa-btn { background: #25D366; color: #fff; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
/* Paired Today cards (Pick-ups / Returns) must read as one balanced row even
   when one side is empty — stretch both to the grid row height and center
   the "nothing to do" placeholder in the leftover space, instead of leaving
   it stuck at the top with a dead gap below. */
.grid-2 .card { display: flex; flex-direction: column; }
.grid-2 .card .action-list { flex: 1; display: flex; flex-direction: column; }
.grid-2 .card .action-empty { flex: 1; display: flex; align-items: center; justify-content: center; border-bottom: 0; color: var(--text-mute); text-align: center; }

.pl-good { color: var(--success); font-weight: 700; }
.pl-bad { color: var(--danger); font-weight: 700; }

/* Briefly highlights a section jumped to via an in-page anchor link (e.g. the
   page-head "Ban Customer" button), so it's obvious where the click landed. */
@keyframes targetFlash { 0%, 40% { box-shadow: 0 0 0 3px var(--danger); } 100% { box-shadow: var(--shadow-sm); } }
:target.card { animation: targetFlash 2s ease-out; }
