/* =====================================================================
   Velocity Motors – admin panel styles
   Breakpoints: phone < 640px · tablet 640–1023px · desktop ≥ 1024px
   ===================================================================== */
:root {
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --soft: #F8F9FB;
  --hover: #F2F4F7;
  --line: #E4E7EC;
  --line-strong: #D0D5DD;
  --ink: #101828;
  --text: #344054;
  --sub: #667085;
  --muted: #98A2B3;
  --primary: #1D4ED8;
  --primary-hover: #1E40AF;
  --primary-soft: #EFF4FF;
  --green: #067647;   --green-soft: #ECFDF3;
  --red: #B42318;     --red-soft: #FEF3F2;
  --amber: #B54708;   --amber-soft: #FFFAEB;
  --blue: #1D4ED8;    --blue-soft: #EFF4FF;
  --accent: var(--primary); --accent-soft: var(--primary-soft);
  --r: 8px; --r-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
code { font-size: 12.5px; background: var(--soft); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 16px 12px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; color: var(--ink); }
.brand-mark { width: 28px; height: 28px; border-radius: 6px; background: var(--primary); color: #fff; display: grid; place-items: center; }
.brand-mark svg { width: 16px; height: 16px; stroke-width: 2; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 16px; font-weight: 700; letter-spacing: -.2px; }
.brand-text small { font-size: 11.5px; color: var(--sub); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: var(--r-sm); font-weight: 500; color: var(--text); }
.nav a svg { color: var(--sub); }
.nav a:hover { background: var(--hover); }
.nav a.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav a.on svg { color: var(--primary); }
.side-cta { margin-top: auto; display: flex; align-items: center; justify-content: center; gap: 6px; height: 36px; border-radius: var(--r-sm); background: var(--primary); color: #fff; font-weight: 600; }
.side-cta:hover { background: var(--primary-hover); }
.topbar, .tabs { display: none; }
.main { min-width: 0; outline: none; }

/* signed-in user */
.me { margin-top: 12px; padding: 12px 6px 0; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.av { width: 32px; height: 32px; border-radius: 50%; background: var(--hover); color: var(--text); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 600; font-size: 12.5px; flex-shrink: 0; }
.me .who { flex: 1; min-width: 0; line-height: 1.3; }
.me .who b { display: block; font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role { font-size: 12px; color: var(--sub); }
.me button, .me-top button { background: transparent; border: 0; color: var(--sub); cursor: pointer; width: 32px; height: 32px; border-radius: var(--r-sm); display: grid; place-items: center; }
.me button:hover, .me-top button:hover { background: var(--hover); color: var(--ink); }
.me-top { margin-left: auto; display: flex; align-items: center; gap: 4px; }

@media (max-width: 1023px) and (min-width: 640px) {
  .shell { grid-template-columns: 72px 1fr; }
  .side { padding: 14px 8px; }
  .side .brand { justify-content: center; padding: 0 0 16px; }
  .side .brand-text, .side-cta span:last-child, .me .who { display: none; }
  .nav a { flex-direction: column; height: 54px; gap: 3px; justify-content: center; padding: 0; font-size: 10.5px; }
  .nav a .lbl-long { display: none; }
  .side-cta { width: 40px; align-self: center; }
  .me { flex-direction: column; padding: 12px 0 0; gap: 6px; }
}
@media (min-width: 1024px) { .nav a .lbl-short { display: none; } }
@media (max-width: 639px) {
  .shell { display: block; padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  .side { display: none; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 20; height: 52px; padding: 0 14px; align-items: center; background: var(--surface); border-bottom: 1px solid var(--line); }
  .topbar .brand { padding: 0; }
  .tabs { display: flex; position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 56px; font-size: 10.5px; font-weight: 500; color: var(--sub); }
  .tabs a.on { color: var(--primary); font-weight: 600; }
  .nav a .lbl-long { display: none; }
}

/* ---------------------------------------------------------------- page */
.page { max-width: 1280px; margin: 0 auto; padding: 24px 28px 40px; }
.page.has-footer { padding-bottom: 100px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .t { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.page-head h1 { margin: 0; font-size: 20px; font-weight: 600; color: var(--ink); letter-spacing: -.2px; }
.page-head p { margin: 2px 0 0; color: var(--sub); font-size: 13.5px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { width: 32px; height: 32px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; color: var(--text); flex-shrink: 0; }
.back:hover { background: var(--hover); }
.back svg { width: 16px; height: 16px; }
.sticky-footer { position: fixed; z-index: 15; bottom: 0; right: 0; left: 232px; background: var(--surface); border-top: 1px solid var(--line); }
.sticky-footer .in { max-width: 1280px; margin: 0 auto; padding: 10px 28px; display: flex; align-items: center; gap: 8px; }
@media (max-width: 1023px) and (min-width: 640px) { .sticky-footer { left: 72px; } .page { padding: 20px 20px 40px; } }
@media (max-width: 639px) {
  .page { padding: 16px 14px 28px; }
  .page.has-footer { padding-bottom: 140px; }
  .page-head { margin-bottom: 14px; }
  .page-head h1 { font-size: 18px; }
  .sticky-footer { left: 0; bottom: calc(56px + env(safe-area-inset-bottom)); }
  .sticky-footer .in { padding: 8px 14px; }
}

/* ---------------------------------------------------------------- cards & layout */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card.hl { border-color: var(--line-strong); background: var(--soft); }
.card.warm { background: var(--soft); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin: -2px 0 14px; }
.card-head h3 { margin: 0; font-size: 14.5px; font-weight: 600; color: var(--ink); }
.card-head .hint { color: var(--sub); font-size: 12.5px; }
.grid { display: grid; gap: 0 14px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.grid .full { grid-column: 1 / -1; }
.cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
.cols.even { grid-template-columns: 1fr 1fr; }
@media (max-width: 1023px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols, .cols.even { grid-template-columns: 1fr; }
}
@media (max-width: 639px) {
  .grid, .grid.c2 { grid-template-columns: 1fr; }
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card { padding: 14px; }
}

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--primary); background: var(--primary); color: #fff; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow); }
.btn:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn svg { width: 16px; height: 16px; }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; }
.btn.accent { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.sec { background: var(--surface); border-color: var(--line-strong); color: var(--text); }
.btn.sec:hover { background: var(--hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text); box-shadow: none; }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { background: var(--surface); border-color: #FDA29B; color: var(--red); }
.btn.danger:hover { background: var(--red-soft); }
.btn.danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger-solid:hover { background: #912018; border-color: #912018; }
.btn.success { background: var(--green); border-color: var(--green); color: #fff; }
.btn.success:hover { background: #05603A; border-color: #05603A; }
.btn:disabled { opacity: .5; cursor: default; }
.spacer { flex: 1; }
@media (max-width: 639px) { .btn .hide-sm { display: none; } }

/* ---------------------------------------------------------------- forms */
.field { margin-bottom: 14px; min-width: 0; }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.field label .req { color: var(--red); }
.input, select.input, textarea.input {
  width: 100%; height: 38px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 0 11px; background: #fff; font-size: 14px; color: var(--ink); outline: none; box-shadow: var(--shadow);
}
.input::placeholder { color: var(--muted); }
textarea.input { height: auto; min-height: 76px; padding: 9px 11px; resize: vertical; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px; }
.input:focus { border-color: #84ADFF; box-shadow: 0 0 0 3px rgba(29, 78, 216, .12); }
.input.money { text-align: right; font-variant-numeric: tabular-nums; }
.input.invalid { border-color: #FDA29B; background-color: #FFFBFA; }
.input.invalid:focus { box-shadow: 0 0 0 3px rgba(180, 35, 24, .1); }
.input[readonly] { background: var(--soft); color: var(--text); font-weight: 600; box-shadow: none; }
.err-box { background: var(--red-soft); border: 1px solid #FECDCA; color: var(--red); border-radius: var(--r-sm); padding: 10px 12px; margin-bottom: 14px; font-size: 13.5px; }
.err-box ul { margin: 4px 0 0; padding-left: 18px; }
.inline-total { display: flex; align-items: center; height: 38px; color: var(--sub); }
.inline-total b { color: var(--ink); margin-left: 6px; font-weight: 600; }
.link { color: var(--primary); font-weight: 500; cursor: pointer; background: none; border: 0; padding: 0; }
.link:hover { text-decoration: underline; }
.link:disabled { color: var(--muted); cursor: default; text-decoration: none; }

.chips { display: inline-flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.chip { height: 34px; padding: 0 14px; border: 0; border-right: 1px solid var(--line-strong); background: var(--surface); font-weight: 500; font-size: 13px; color: var(--text); cursor: pointer; }
.chip:last-child { border-right: 0; }
.chip:hover { background: var(--hover); }
.chip.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.search { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--muted); flex: 1; min-width: 200px; box-shadow: var(--shadow); }
.search:focus-within { border-color: #84ADFF; box-shadow: 0 0 0 3px rgba(29, 78, 216, .12); }
.search svg { width: 16px; height: 16px; }
.search input { border: 0; outline: none; flex: 1; height: 34px; background: transparent; color: var(--ink); min-width: 0; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.section-title { font-size: 14.5px; font-weight: 600; color: var(--ink); }

/* ---------------------------------------------------------------- tables */
.tbl { width: 100%; border: 1px solid var(--line); border-radius: var(--r); border-collapse: separate; border-spacing: 0; overflow: hidden; background: var(--surface); }
.tbl th { background: var(--soft); text-align: left; font-size: 12px; font-weight: 500; color: var(--sub); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 13.5px; color: var(--text); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--soft); }
.tbl .r { text-align: right; }
.tbl tfoot td { background: var(--soft); font-weight: 600; color: var(--ink); border-top: 1px solid var(--line); border-bottom: 0; }
.tbl .strong { font-weight: 600; color: var(--ink); letter-spacing: .2px; }
.tbl .sm { color: var(--sub); font-size: 12.5px; }
.tbl.edit td { padding: 6px 4px; }
.tbl.edit td:first-child { padding-left: 12px; color: var(--muted); width: 32px; }
.tbl.edit .input { height: 34px; font-size: 13.5px; box-shadow: none; }
.icon-btn { width: 32px; height: 32px; border-radius: var(--r-sm); border: 0; background: transparent; color: var(--sub); display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--red-soft); color: var(--red); }
.icon-btn svg { width: 16px; height: 16px; }
.empty-rows { padding: 16px; border: 1px dashed var(--line-strong); border-radius: var(--r); text-align: center; color: var(--sub); font-size: 13px; background: var(--soft); }
.rows-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.rows-foot .tot { color: var(--sub); font-size: 13.5px; }
.rows-foot .tot b { color: var(--ink); font-weight: 600; }
.muted { color: var(--sub); font-size: 13px; }

@media (max-width: 1099px) {
  .tbl.edit, .tbl.edit tbody, .tbl.edit tr, .tbl.edit td { display: block; width: 100%; border: 0; }
  .tbl.edit { background: transparent; border: 0; }
  .tbl.edit thead { display: none; }
  .tbl.edit tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; background: var(--soft); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 12px 10px; margin-bottom: 10px; }
  .tbl.edit td { padding: 4px 0 !important; width: 100% !important; }
  .tbl.edit td[data-label]::before { content: attr(data-label); display: block; font-size: 12.5px; font-weight: 500; color: var(--text); margin-bottom: 4px; }
  .tbl.edit td.rowno { grid-column: 1; font-weight: 600; color: var(--ink) !important; align-self: center; }
  .tbl.edit td.del { grid-column: 2; grid-row: 1; justify-self: end; width: auto !important; }
}
@media (max-width: 639px) {
  .tbl.edit tbody tr { grid-template-columns: 1fr auto; }
  .tbl.edit td[data-label] { grid-column: 1 / -1; }
  .tbl.view, .tbl.view tbody, .tbl.view tfoot, .tbl.view tr, .tbl.view td { display: block; width: 100%; }
  .tbl.view { border: 0; background: transparent; }
  .tbl.view thead { display: none; }
  .tbl.view tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; margin-bottom: 8px; }
  .tbl.view td { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border: 0; text-align: right; }
  .tbl.view td::before { content: attr(data-label); color: var(--sub); font-size: 12.5px; text-align: left; flex-shrink: 0; }
  .tbl.view td:first-child { display: block; text-align: left; margin-bottom: 4px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
  .tbl.view td:first-child::before { display: none; }
  .tbl.view tfoot tr { background: var(--soft); }
  .tbl.view tfoot td { background: transparent; }
}

/* ---------------------------------------------------------------- display */
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; min-width: 0; box-shadow: var(--shadow); }
.stat .l { font-size: 12.5px; color: var(--sub); font-weight: 500; }
.stat .l svg { display: none; }
.stat .v { font-size: 22px; font-weight: 600; color: var(--ink); margin-top: 4px; letter-spacing: -.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 12.5px; color: var(--sub); margin-top: 2px; }
.stats { margin-bottom: 16px; }
.stat .v.blue { color: var(--ink) !important; }
.green { color: var(--green) !important; } .red { color: var(--red) !important; } .blue { color: var(--blue) !important; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.amber { background: var(--amber-soft); color: var(--amber); border-color: #FEDF89; }
.badge.green { background: var(--green-soft); color: var(--green); border-color: #ABEFC6; }
.badge.blue { background: var(--blue-soft); color: var(--blue); border-color: #C7D7FE; }
.badge.gray { background: var(--soft); color: var(--sub); border-color: var(--line); }
.kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; }
.kv.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kv .k { font-size: 12.5px; color: var(--sub); }
.kv .v { margin-top: 2px; font-weight: 500; color: var(--ink); word-break: break-word; }
@media (max-width: 1023px) { .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 639px) { .kv, .kv.c2 { grid-template-columns: 1fr 1fr; } }
.lines .ln { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.lines .ln:last-child { border-bottom: 0; }
.lines .ln span:first-child { color: var(--sub); }
.lines .ln span:last-child { font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.lines .ln.strong { border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line); margin-top: 2px; }
.lines .ln.strong span { color: var(--ink) !important; font-weight: 600; font-size: 14.5px; }
.lines .ln.strong span.green { color: var(--green) !important; } .lines .ln.strong span.red { color: var(--red) !important; }
.empty { text-align: center; padding: 32px 16px; color: var(--sub); }
.empty h3 { color: var(--ink); margin: 10px 0 4px; font-size: 15px; font-weight: 600; }
.empty .big { width: 44px; height: 44px; border-radius: 10px; background: var(--soft); border: 1px solid var(--line); color: var(--sub); display: inline-grid; place-items: center; }
.empty .big svg { width: 22px; height: 22px; }
.empty .actions { justify-content: center; margin-top: 16px; }
.by { color: var(--sub); font-size: 12.5px; margin-top: 6px; }

/* dashboard lists */
.act { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.act:last-child { border-bottom: 0; }
.act:hover .tx b { color: var(--primary); }
.act .ic { display: none; }
.act .tag { width: 84px; flex-shrink: 0; }
.act .tx { flex: 1; min-width: 0; }
.act .tx b, .act .tx small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act .tx b { font-weight: 500; color: var(--ink); }
.act .tx small { color: var(--sub); font-size: 12.5px; margin-top: 1px; }
.act .amt { font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.bal { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.bal:last-child { border-bottom: 0; }
.bal b { font-weight: 500; color: var(--ink); }
.bal small { display: block; color: var(--sub); font-size: 12px; }
@media (max-width: 639px) { .act .tag { display: none; } }

/* car tiles */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1023px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 639px) { .tiles { grid-template-columns: 1fr; } }
.tile { display: block; text-align: left; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; cursor: pointer; box-shadow: var(--shadow); color: var(--text); }
.tile:hover { border-color: var(--line-strong); background: var(--soft); }
.tile.sel { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29, 78, 216, .12); }
.tile .top { display: flex; align-items: flex-start; gap: 10px; }
.tile .ic { display: none; }
.tile .plate { font-size: 14.5px; font-weight: 600; color: var(--ink); letter-spacing: .4px; }
.tile .name { font-size: 13px; color: var(--sub); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.tile .meta small { display: block; font-size: 12px; color: var(--sub); }
.tile .meta b { font-size: 13.5px; font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }

/* stepper */
.stepper { display: flex; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.step { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 0; cursor: default; color: var(--sub); font-weight: 500; font-size: 13px; white-space: nowrap; }
.step.done { cursor: pointer; color: var(--text); }
.step .dot { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line-strong); display: grid; place-items: center; font-size: 12px; font-weight: 600; background: var(--surface); color: var(--sub); }
.step.done .dot { background: var(--primary-soft); border-color: var(--primary-soft); color: var(--primary); }
.step.on .dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.step.on { color: var(--ink); font-weight: 600; }
.step .dot svg { width: 13px; height: 13px; stroke-width: 3; }
.step-bar { flex: 1; height: 1px; background: var(--line-strong); margin: 0 12px; min-width: 12px; }
.step-bar.done { background: var(--primary); }
@media (max-width: 1199px) { .step:not(.on) .txt { display: none; } }
.stepper-m { display: none; margin-bottom: 14px; }
.stepper-m .row { display: flex; justify-content: space-between; margin-bottom: 6px; font-weight: 600; color: var(--ink); }
.stepper-m .bar { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.stepper-m .bar i { display: block; height: 100%; background: var(--primary); }
@media (max-width: 639px) { .stepper { display: none; } .stepper-m { display: block; } }

/* ---------------------------------------------------------------- dialogs */
dialog.sheet { border: 1px solid var(--line); padding: 0; border-radius: 10px; width: min(620px, calc(100vw - 32px)); max-height: 88vh; background: var(--surface); color: var(--text); box-shadow: 0 20px 40px -8px rgba(16, 24, 40, .2); animation: mbox-in .18s ease-out; }
dialog.sheet::backdrop { background: rgba(16, 24, 40, .45); animation: mbox-fade .18s ease-out; }
dialog.sheet form { display: flex; flex-direction: column; max-height: 88vh; margin: 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.sheet-head h3 { margin: 0; font-size: 16px; font-weight: 600; color: var(--ink); }
.sheet-head .icon-btn:hover { background: var(--hover); color: var(--ink); }
.sheet-body { padding: 18px; overflow: auto; }
.sheet-foot { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--soft); border-radius: 0 0 10px 10px; }
@media (max-width: 639px) {
  dialog.sheet { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 12px 12px 0 0; max-height: 92vh; }
}

/* message boxes (confirm / input / alert) */
dialog.mbox { border: 0; padding: 0; border-radius: 12px; width: min(400px, calc(100vw - 32px)); background: var(--surface); color: var(--text);
  box-shadow: 0 20px 40px -8px rgba(16, 24, 40, .25); animation: mbox-in .18s ease-out; }
dialog.mbox::backdrop { background: rgba(16, 24, 40, .5); animation: mbox-fade .18s ease-out; }
dialog.mbox.closing { animation: mbox-out .15s ease-in forwards; }
dialog.mbox.closing::backdrop { animation: mbox-fade-out .15s ease-in forwards; }
dialog.mbox form { padding: 22px 22px 18px; margin: 0; }
.mbox-ic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; margin: 0 0 14px; }
.mbox-ic svg { width: 20px; height: 20px; }
dialog.mbox h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; color: var(--ink); }
dialog.mbox p { margin: 0; color: var(--sub); line-height: 1.5; }
.mbox-err { color: var(--red); font-size: 12.5px; margin-top: 4px; }
.mbox-btns { display: flex; gap: 8px; margin-top: 22px; }
.mbox-btns .btn { flex: 1; }
@keyframes mbox-in { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes mbox-out { to { opacity: 0; transform: translateY(4px) scale(.98); } }
@keyframes mbox-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes mbox-fade-out { to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { dialog.mbox, dialog.mbox::backdrop, dialog.sheet, dialog.sheet::backdrop { animation: none !important; } }

/* toasts */
.toasts { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: var(--r-sm); font-size: 13.5px; font-weight: 500; box-shadow: 0 12px 24px -6px rgba(16, 24, 40, .25); max-width: 380px; animation: tin .2s ease-out; }
.toast.err { background: var(--red); }
@keyframes tin { from { transform: translateY(6px); opacity: 0; } }
@media (max-width: 639px) { .toasts { left: 12px; right: 12px; bottom: 76px; align-items: stretch; } .toast { max-width: none; } }
.loading { padding: 60px; text-align: center; color: var(--sub); }

/* ---------------------------------------------------------------- sign-in */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 28px; box-shadow: 0 12px 24px -8px rgba(16, 24, 40, .1); }
.login-card .brand { padding: 0 0 24px; }
.login-card h1 { margin: 0 0 6px; font-size: 20px; font-weight: 600; color: var(--ink); }
.login-card p.lead { margin: 0 0 20px; color: var(--sub); }
.login-card .btn { width: 100%; height: 40px; }
.code-input { font-size: 22px !important; letter-spacing: 10px; text-align: center; height: 48px !important; font-weight: 600; font-variant-numeric: tabular-nums; }
.login-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; font-size: 13.5px; flex-wrap: wrap; }
.login-note { margin: 16px 0 0; color: var(--sub); font-size: 12.5px; text-align: center; }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch input { width: 16px; height: 16px; accent-color: var(--primary); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 639px) { .grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }

/* ---------------------------------------------------------------- date range picker */
.drp { position: relative; }
.drp-btn { display: inline-flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--text); cursor: pointer; box-shadow: var(--shadow); max-width: 100%; }
.drp-btn:hover { background: var(--hover); }
.drp-btn svg { width: 16px; height: 16px; color: var(--sub); }
.drp-label { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; overflow: hidden; }
.drp-label b { font-weight: 600; color: var(--ink); font-size: 13.5px; }
.drp-label span { color: var(--sub); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.drp-panel { position: absolute; z-index: 30; top: calc(100% + 6px); right: 0; width: 520px; max-width: calc(100vw - 28px); display: grid; grid-template-columns: 190px 1fr;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 16px 32px -8px rgba(16, 24, 40, .18); overflow: hidden; }
.drp-presets { display: flex; flex-direction: column; padding: 6px; border-right: 1px solid var(--line); }
.drp-presets button { text-align: left; border: 0; background: transparent; padding: 7px 10px; border-radius: var(--r-sm); font-size: 13.5px; color: var(--text); cursor: pointer; }
.drp-presets button:hover { background: var(--hover); }
.drp-presets button.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.drp-custom { padding: 14px 16px; }
.drp-title { font-weight: 600; color: var(--ink); margin-bottom: 12px; }
.drp-err { color: var(--red); font-size: 12.5px; min-height: 18px; margin-top: -6px; }
.drp-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
@media (max-width: 639px) {
  .page-head .actions { width: 100%; }
  .drp { flex: 1 1 100%; }
  .drp-btn { width: 100%; }
  .drp-panel { position: fixed; left: 14px; right: 14px; top: 110px; width: auto; grid-template-columns: 1fr; max-height: calc(100vh - 200px); overflow: auto; }
  .drp-presets { display: grid; grid-template-columns: 1fr 1fr; border-right: 0; border-bottom: 1px solid var(--line); max-height: none; }
}

/* ---------------------------------------------------------------- print (reports) */
.print-only { display: none; }
@media print {
  @page { margin: 12mm; }
  body { background: #fff; font-size: 12px; }
  .shell { display: block; }
  .side, .topbar, .tabs, .page-head, .no-print, .toasts, .sticky-footer { display: none !important; }
  .page { padding: 0; max-width: none; }
  .print-only { display: block; }
  .print-head { display: flex; justify-content: space-between; border-bottom: 2px solid #101828; padding-bottom: 8px; margin-bottom: 14px; }
  .print-head b { font-size: 15px; }
  .card, .stat { box-shadow: none; break-inside: avoid; }
  .tbl { font-size: 11.5px; }
  .tbl tr { break-inside: avoid; }
  a { color: inherit; }
}

/* ---------------------------------------------------------------- skeleton loaders */
.sk { display: block; max-width: 100%; border-radius: 4px; background: linear-gradient(90deg, #EEF0F3 25%, #F6F7F9 37%, #EEF0F3 63%); background-size: 400% 100%; animation: sk-shimmer 1.3s ease infinite; }
.sk.mt8 { margin-top: 8px; }
.sk.r6 { border-radius: var(--r-sm); }
.sk-table { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.sk-tr { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 16px; padding: 13px 12px; border-bottom: 1px solid var(--line); }
.sk-tr:last-child { border-bottom: 0; }
.sk-th { background: var(--soft); padding: 11px 12px; }
.sk-line { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.sk-line:last-child { border-bottom: 0; }
@keyframes sk-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }
@media (max-width: 639px) { .sk-tr { grid-auto-columns: 1fr; } .sk-tr > :nth-child(n+4) { display: none; } }
/* first load, before we know if someone is signed in */
.boot { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.boot-side { background: var(--surface); border-right: 1px solid var(--line); padding: 18px 16px; display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 1023px) { .boot { grid-template-columns: 1fr; } .boot-side { display: none; } }

/* ---------------------------------------------------------------- agreements */
dialog.sheet.wide { width: min(780px, calc(100vw - 32px)); }
.checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.check { display: flex; align-items: flex-start; gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer; background: var(--surface); font-size: 13.5px; color: var(--text); line-height: 1.35; }
.check:hover { background: var(--soft); }
.check:has(input:checked) { border-color: #84ADFF; background: var(--primary-soft); color: var(--ink); }
.check input { width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--primary); flex-shrink: 0; }
.chip:disabled { color: var(--muted); cursor: not-allowed; background: var(--soft); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.row-actions .del:hover { background: var(--red-soft); color: var(--red); }
@media (max-width: 639px) {
  .checks { grid-template-columns: 1fr; }
  #kind.chips { display: flex; flex-direction: column; width: 100%; }
  #kind .chip { border-right: 0; border-bottom: 1px solid var(--line-strong); text-align: left; height: auto; padding: 9px 12px; }
  #kind .chip:last-child { border-bottom: 0; }
  .tbl.view td .row-actions { justify-content: flex-start; }
}
.field .check { display: flex; margin: 0; font-weight: 400; font-size: 13.5px; color: var(--text); }
.field .check:has(input:checked) { color: var(--ink); }
