/* Omalume Fleet Finance — one stylesheet. Modern, dense, light. Cyan accent. */
:root {
  --bg: #f4f6f8; --surface: #ffffff; --surface-alt: #f9fafb; --border: #e2e6ea; --border-strong: #cbd2d9;
  --ink: #111827; --ink-2: #4b5563; --ink-3: #6b7280;
  --brand: #0f2a44; --brand-2: #163a5c; --accent: #0891b2; --accent-2: #0e7490; --accent-soft: #e0f2fe; --accent-ring: rgba(8,145,178,.25);
  --positive: #15803d; --positive-soft: #dcfce7; --attention: #b45309; --attention-soft: #fef3c7; --negative: #b91c1c; --negative-soft: #fee2e2;
  --heat-1: #fee2e2; --heat-2: #fca5a5; --heat-3: #f87171;
  --s1: #0891b2; --s2: #eb6834; --s3: #7c3aed; --s4: #eda100; --s5: #db2777; --s6: #2a78d6;
  --radius: 8px; --topbar-h: 52px; --sidebar-w: 224px;
  --font: -apple-system, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f1419; --surface: #171d24; --surface-alt: #1c232b; --border: #2a333d; --border-strong: #3a4653;
  --ink: #e6edf3; --ink-2: #aeb8c2; --ink-3: #8b96a1; --brand: #0b1f33; --brand-2: #143551; --accent: #22b8d4; --accent-2: #67d5e8; --accent-soft: #0e3a4a;
  --positive: #4ade80; --positive-soft: #10321e; --attention: #fbbf24; --attention-soft: #3a2a08; --negative: #f87171; --negative-soft: #3b1212;
  --heat-1: #3b1212; --heat-2: #6b1d1d; --heat-3: #9b2c2c;
  --s1: #1aa3bf; --s2: #d95926; --s3: #9085e9; --s4: #c98500; --s5: #d55181; --s6: #3987e5;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 13px/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; color: var(--ink); }
h1 { font-size: 20px; } h2 { font-size: 15px; } h3 { font-size: 13px; }
.num, td.num, th.num, .tabular { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.ctr { text-align: center; }
.muted { color: var(--ink-3); } .small { font-size: 12px; } .tiny { font-size: 11px; }
.pos { color: var(--positive); } .neg { color: var(--negative); } .att { color: var(--attention); }
.mono { font-family: var(--mono); font-size: 12px; }
code { font-family: var(--mono); font-size: 12px; background: var(--surface-alt); padding: 1px 4px; border-radius: 3px; }

/* layout */
.topbar { position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h); background: var(--brand); color: #fff; display: flex; align-items: center; gap: 12px; padding: 0 16px; z-index: 50; }
.topbar .logo { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; color: #fff; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.topbar .logo .mark { width: 26px; height: 26px; border-radius: 6px; background: var(--accent); display: inline-grid; place-items: center; font-size: 13px; font-weight: 800; color: #fff; }
.topbar .search { flex: 1; max-width: 460px; margin-left: 16px; }
.topbar .search input { width: 100%; height: 32px; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.1); color: #fff; border-radius: 6px; padding: 0 10px 0 32px; font: inherit; outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23ffffff' stroke-opacity='.7' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 9px center; }
.topbar .search input::placeholder { color: rgba(255,255,255,.6); }
.topbar .search input:focus { background-color: rgba(255,255,255,.16); border-color: var(--accent); }
.topbar .spacer { flex: 1; }
.topbar .period { display: flex; align-items: center; gap: 6px; font-size: 12px; color: rgba(255,255,255,.85); }
.topbar .period select { height: 30px; border-radius: 6px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.1); color: #fff; font: inherit; padding: 0 6px; }
.topbar .period select option { color: var(--ink); }
.topbar .user { display: flex; align-items: center; gap: 10px; font-size: 12px; color: rgba(255,255,255,.85); }
.topbar .user .avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.topbar .user a { color: #fff; opacity: .85; }
.topbar .burger { display: none; background: none; border: 0; color: #fff; font-size: 22px; cursor: pointer; padding: 4px 6px; }
.sidebar { position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; padding: 10px 0 20px; z-index: 40; }
.sidebar .sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); padding: 12px 16px 4px; font-weight: 600; }
.sidebar a { display: flex; align-items: center; gap: 9px; padding: 6px 16px 6px 14px; color: var(--ink-2); border-left: 2px solid transparent; font-size: 13px; }
.sidebar a:hover { background: var(--surface-alt); text-decoration: none; color: var(--ink); }
.sidebar a.active { color: var(--accent-2); background: var(--accent-soft); border-left-color: var(--accent); font-weight: 600; }
.sidebar a svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; opacity: .85; }
.main { margin-left: var(--sidebar-w); padding: calc(var(--topbar-h) + 18px) 22px 40px; min-height: 100vh; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head .crumbs { font-size: 12px; color: var(--ink-3); margin-bottom: 4px; }
.page-head .crumbs a { color: var(--ink-3); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sub { color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }

/* cards & grids */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; }
.card > .card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--border); }
.card > .card-h h2 { font-size: 13.5px; }
.card > .card-h .meta { font-size: 12px; color: var(--ink-3); }
.card > .card-b { padding: 12px 14px; }
.card > .card-b.flush { padding: 0; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: repeat(3, 1fr); } .grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-21 { grid-template-columns: 1.6fr 1fr; } .grid-12 { grid-template-columns: 1fr 1.6fr; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.kpi .lbl { font-size: 11.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.kpi .val { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .val small { font-size: 13px; font-weight: 500; color: var(--ink-3); margin-left: 4px; }
.kpi .foot { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.kpi.accent { border-top: 3px solid var(--accent); }
.kpi.neg { border-top: 3px solid var(--negative); } .kpi.pos { border-top: 3px solid var(--positive); } .kpi.att { border-top: 3px solid var(--attention); }

/* tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th { position: sticky; top: var(--topbar-h); background: var(--surface-alt); color: var(--ink-2); text-align: left; font-weight: 600; font-size: 11.5px; letter-spacing: .02em; padding: 7px 10px; border-bottom: 1px solid var(--border-strong); white-space: nowrap; z-index: 1; }
.tbl th.num { text-align: right; }
.tbl td { padding: 6px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr:nth-child(even) td { background: var(--surface-alt); }
.tbl tbody tr:hover td { background: var(--accent-soft); }
.tbl tr.sel td { background: var(--accent-soft); }
.tbl tfoot td { font-weight: 700; border-top: 2px solid var(--border-strong); background: var(--surface); }
.tbl td.date { text-align: center; white-space: nowrap; }
.tbl .sortable { cursor: pointer; user-select: none; }
.tbl .sortable:after { content: " ↕"; color: var(--ink-3); font-size: 10px; }
.tbl-wrap { overflow-x: auto; }
.tbl-wrap .tbl th { position: static; }
.tbl.compact td { padding: 4px 8px; } .tbl.compact th { padding: 5px 8px; }
.tbl td.heat-1 { background: var(--heat-1) !important; } .tbl td.heat-2 { background: var(--heat-2) !important; } .tbl td.heat-3 { background: var(--heat-3) !important; color: #fff; }
.empty { padding: 26px 14px; text-align: center; color: var(--ink-3); font-size: 13px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-alt); border-radius: var(--radius) var(--radius) 0 0; }
.filters label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--ink-3); }
.filters input, .filters select { height: 30px; }

/* badges & pills */
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: var(--surface-alt); color: var(--ink-2); border: 1px solid var(--border); white-space: nowrap; }
.badge.pos { background: var(--positive-soft); color: var(--positive); border-color: transparent; }
.badge.att { background: var(--attention-soft); color: var(--attention); border-color: transparent; }
.badge.neg { background: var(--negative-soft); color: var(--negative); border-color: transparent; }
.badge.acc { background: var(--accent-soft); color: var(--accent-2); border-color: transparent; }
.badge.brand { background: var(--brand); color: #fff; border-color: transparent; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-alt); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.danger { color: var(--negative); border-color: var(--negative); }
.btn.sm { height: 26px; padding: 0 9px; font-size: 12px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
.form.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form.cols-1 { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.wide { grid-column: 1 / -1; }
.field label { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.field .help { font-size: 11.5px; color: var(--ink-3); }
.field .err { font-size: 12px; color: var(--negative); }
input[type=text], input[type=number], input[type=date], input[type=email], input[type=password], input[type=file], select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 6px; padding: 0 9px; height: 32px; width: 100%; }
textarea { height: auto; min-height: 70px; padding: 6px 9px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
.field.check { flex-direction: row; align-items: center; gap: 8px; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 8px; padding-top: 6px; border-top: 1px solid var(--border); margin-top: 4px; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px 12px; margin: 0 0 10px; grid-column: 1 / -1; }
fieldset legend { font-size: 12px; font-weight: 700; color: var(--brand); padding: 0 6px; }
fieldset .form { margin-top: 4px; }

/* definition lists */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 12.5px; }
.dl dt { color: var(--ink-3); } .dl dd { margin: 0; font-weight: 500; }
.dl.cols { grid-template-columns: max-content 1fr max-content 1fr; }

/* alerts / messages */
.msgs { margin-bottom: 14px; }
.alert { padding: 9px 12px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); font-size: 12.5px; margin-bottom: 8px; display: flex; gap: 8px; align-items: flex-start; }
.alert.info { background: var(--accent-soft); border-color: transparent; color: var(--accent-2); }
.alert.success { background: var(--positive-soft); border-color: transparent; color: var(--positive); }
.alert.warning { background: var(--attention-soft); border-color: transparent; color: var(--attention); }
.alert.error { background: var(--negative-soft); border-color: transparent; color: var(--negative); }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 8px 12px; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; }
.tabs a.active { color: var(--accent-2); border-bottom-color: var(--accent); }
.tabs a:hover { text-decoration: none; color: var(--ink); }

/* stage strip */
.stages { display: flex; gap: 3px; }
.stages span { flex: 1; height: 6px; border-radius: 3px; background: var(--border); }
.stages span.done { background: var(--accent); }
.stages span.cur { background: var(--brand); }

/* charts */
.chart-box { position: relative; height: 220px; }
.chart-box.tall { height: 300px; }
.chart-box canvas { max-width: 100%; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11.5px; color: var(--ink-2); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, var(--brand) 0%, #0b3d5c 60%, var(--accent) 140%); padding: 20px; }
.login { width: 360px; background: var(--surface); border-radius: 12px; padding: 26px 28px 24px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login h1 { font-size: 18px; margin-bottom: 2px; }
.login .form { grid-template-columns: 1fr; margin-top: 14px; }

/* print */
@media print { .topbar, .sidebar, .actions, .filters, .btn { display: none !important; } .main { margin: 0; padding: 0; } .card { break-inside: avoid; } }

/* responsive */
@media (max-width: 900px) {
  .kpis, .grid-4, .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-21, .grid-12 { grid-template-columns: 1fr; }
  .form, .form.cols-3 { grid-template-columns: 1fr; }
  .topbar .search { display: none; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .15s; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vw rgba(0,0,0,.35); }
  .topbar .burger { display: block; }
  .main { margin-left: 0; padding: calc(var(--topbar-h) + 12px) 12px 30px; }
  .kpis, .grid-4, .grid-3 { grid-template-columns: 1fr; }
  .topbar .period { display: none; }
  .topbar .user > span:not(.avatar) { display: none; }
  .topbar .logo { font-size: 14px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .dl.cols { grid-template-columns: max-content 1fr; }
  .mobile-card .tbl { font-size: 13px; }
}
/* phone-friendly capture */
.capture { max-width: 520px; }
.capture .field label { font-size: 13px; }
.capture input, .capture select { height: 42px; font-size: 16px; }
.capture .btn { height: 44px; font-size: 15px; width: 100%; justify-content: center; }
.machine-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px; background: var(--surface); }
.machine-card .t { font-weight: 700; font-size: 15px; }

/* privacy mode: rand amounts masked on screen (toggle in the top bar; PDFs and exports are untouched) */
.privacy-toggle { background: transparent; border: 1px solid rgba(255,255,255,.3); color: #fff; border-radius: 6px; height: 28px; width: 32px; display: inline-grid; place-items: center; cursor: pointer; padding: 0; }
.privacy-toggle:hover { background: rgba(255,255,255,.12); }
.privacy-toggle svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.privacy-toggle .eye-off, html.privacy .privacy-toggle .eye-on { display: none; }
html.privacy .privacy-toggle .eye-off { display: inline; }
html.privacy .privacy-toggle { background: var(--accent); border-color: var(--accent); }
html.privacy .amt .v { display: none; }
html.privacy .amt::before { content: "••••"; letter-spacing: .05em; color: var(--ink-3); }
html.privacy input.money:not(:focus) { color: transparent; background-image: radial-gradient(circle, var(--ink-3) 2px, transparent 2.5px); background-size: 9px 100%; background-repeat: space no-repeat; background-position: 10px center; background-clip: content-box; }

/* sidebar: one section open at a time */
.sidebar details.nav-group > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; user-select: none; }
.sidebar details.nav-group > summary::-webkit-details-marker { display: none; }
.sidebar details.nav-group > summary::after { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .12s; margin-right: 2px; }
.sidebar details.nav-group[open] > summary::after { transform: rotate(45deg); }
.sidebar details.nav-group > summary:hover { color: var(--ink); background: var(--surface-alt); }
.sidebar details.nav-group > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.sidebar details.nav-group:has(a.active) > summary { color: var(--accent-2); }
.sidebar .nav-sep { border-top: 1px solid var(--border); margin: 10px 16px 6px; }

/* PDF viewer: documents open over the page instead of replacing it */
body.pdf-open { overflow: hidden; }
.pdf-viewer { position: fixed; inset: 0; z-index: 1000; background: rgba(15, 20, 25, .55); display: flex; align-items: center; justify-content: center; padding: 24px; }
.pdf-viewer .pdf-box { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 20px 50px rgba(0,0,0,.3); width: min(1100px, 100%); height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.pdf-viewer .pdf-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.pdf-viewer .pdf-title { flex: 1; font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-viewer .pdf-frame { flex: 1; width: 100%; border: 0; background: #525659; }
@media print { .pdf-viewer { display: none !important; } }
/* attachments panel */
.attach-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.attach-form input[type=text] { flex: 1; min-width: 160px; }
