:root { --ink:#1b1f24; --mute:#5b6470; --line:#d9dee4; --bg:#f4f6f8; --head:#0f3d6e; --brand:#b3261e; --ok:#0b6b2f; --okb:#e3f4e8; --warn:#8a5a00; --warnb:#fff1cc; --bad:#a3170f; --badb:#fde4e1; }
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", system-ui, Arial, sans-serif; color: var(--ink); background: var(--bg); font-size: 14px; }
a { color: var(--head); }
#app { display: flex; min-height: 100vh; }
.side { width: 230px; background: var(--head); color: #fff; padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; flex: none; }
.side .brand { font-weight: 800; font-size: 16px; }
.side .who { font-size: 12px; opacity: .8; margin: 2px 0 10px; word-break: break-all; }
.navh { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; opacity: .65; margin: 12px 6px 3px; }
.navl { display: block; color: #fff; text-decoration: none; padding: 5px 8px; border-radius: 5px; font-size: 13.5px; }
.navl:hover { background: rgba(255,255,255,.12); }
.navl.on { background: #fff; color: var(--head); font-weight: 600; }
.side .btn { margin-top: 16px; width: 100%; }
.menubtn { display: none; }
.main { flex: 1; padding: 18px 24px 60px; min-width: 0; }
.phead h1 { margin: 0 0 2px; font-size: 22px; color: var(--head); }
.phead p { margin: 0 0 14px; }
h2 { font-size: 16px; color: var(--head); margin: 22px 0 8px; }
.muted { color: var(--mute); }
.b { font-weight: 600; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.note { background: var(--warnb); border-left: 4px solid #d79b00; padding: 8px 10px; }
.ok { color: var(--ok); }
.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 6px 12px; border-radius: 6px; cursor: pointer; font: inherit; }
.btn:hover { border-color: var(--head); }
.btn.primary { background: var(--head); color: #fff; border-color: var(--head); }
.btn.danger { background: #fff; color: var(--bad); border-color: var(--bad); }
.btn.small { padding: 3px 8px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; padding: 5px 7px; border: 1px solid var(--line); border-radius: 5px; background: #fff; max-width: 100%; }
input:disabled, select:disabled, textarea:disabled { background: #f1f3f5; color: var(--ink); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0 10px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-bottom: 10px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px; text-decoration: none; color: var(--ink); border-top: 4px solid var(--line); }
.card.ok { border-top-color: var(--ok); } .card.warn { border-top-color: #d79b00; } .card.bad { border-top-color: var(--bad); }
.card .cv { font-size: 26px; font-weight: 700; }
.card .cl { color: var(--mute); font-size: 12.5px; }
.tw { overflow-x: auto; }
table.grid { border-collapse: collapse; width: 100%; background: #fff; font-size: 13px; }
table.grid th, table.grid td { border: 1px solid var(--line); padding: 5px 7px; text-align: left; vertical-align: top; }
table.grid th { background: #eef2f6; position: sticky; top: 0; white-space: nowrap; }
table.grid.click tr:not(:first-child) { cursor: pointer; }
table.grid.click tr:not(:first-child):hover { background: #f3f8fd; }
table.grid tr.muted td { color: var(--mute); }
table.grid tr.tot td { background: #eef2f6; }
table.kv { border-collapse: collapse; background: #fff; margin-bottom: 10px; min-width: 60%; }
table.kv th, table.kv td { border: 1px solid var(--line); padding: 5px 9px; text-align: left; font-size: 13px; }
table.kv th { background: #eef2f6; width: 220px; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #eef2f6; white-space: nowrap; }
.pill.ok { background: var(--okb); color: var(--ok); } .pill.warn { background: var(--warnb); color: var(--warn); } .pill.bad { background: var(--badb); color: var(--bad); }
.subh { display: flex; align-items: center; gap: 12px; }
.subh h2 { margin-right: auto; }
.ov { position: fixed; inset: 0; background: rgba(15,30,45,.45); display: flex; align-items: flex-start; justify-content: center; padding: 30px 12px; overflow-y: auto; z-index: 50; }
.modal { background: #fff; border-radius: 10px; padding: 16px 18px; width: min(860px, 100%); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal h3 { margin: 0 0 10px; color: var(--head); }
.mbar { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.form label { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--mute); }
.form label > *:not(span) { color: var(--ink); font-size: 14px; }
.form .wide { grid-column: 1 / -1; }
.fup { display: grid; grid-template-columns: 150px 1fr 120px auto; gap: 6px; margin-bottom: 5px; }
.filef { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.apbox { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.aph { font-weight: 600; width: 100%; }
.diff { width: 100%; font-size: 13px; }
.diff .old { color: var(--bad); text-decoration: line-through; } .diff .new { color: var(--ok); font-weight: 600; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--head); color: #fff; padding: 9px 16px; border-radius: 6px; z-index: 99; max-width: 90vw; }
.toast.bad { background: var(--bad); }
body.login #app { align-items: center; justify-content: center; background: linear-gradient(135deg, #0f3d6e, #1c5c9c); }
.loginbox { background: #fff; padding: 26px; border-radius: 10px; width: min(360px, 92vw); display: flex; flex-direction: column; gap: 10px; }
.loginbox .brand { font-size: 20px; font-weight: 800; color: var(--head); }
@media (max-width: 820px) {
  .side { position: fixed; left: -260px; z-index: 40; transition: left .2s; }
  .side.open { left: 0; }
  .menubtn { display: block; position: fixed; top: 8px; right: 8px; z-index: 41; }
  .main { padding: 46px 10px 40px; }
  .form { grid-template-columns: 1fr; }
  .fup { grid-template-columns: 1fr 1fr; }
}
@media print { .side, .menubtn, .filters, .btn { display: none !important; } .main { padding: 0; } body { background: #fff; } }
/* spreadsheets */
.sbook { display: flex; flex-direction: column; height: calc(100vh - 150px); min-height: 380px; }
.sbar { margin: 0 0 6px; }
.sgrid { flex: 1; overflow: auto; background: #fff; border: 1px solid var(--line); outline: none; position: relative; }
.sgrid:focus { border-color: var(--head); }
table.sheet { border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.sheet thead { position: sticky; top: 0; z-index: 3; }
table.sheet th, table.sheet td { border-right: 1px solid #e3e7ec; border-bottom: 1px solid #e3e7ec; padding: 3px 6px; height: 24px; white-space: nowrap; max-width: 260px; min-width: 70px; overflow: hidden; text-overflow: ellipsis; cursor: cell; background: #fff; user-select: none; }
table.sheet thead th.cl { background: #eef2f6; text-align: center; color: var(--mute); font-weight: 600; }
table.sheet th.rn { position: sticky; left: 0; z-index: 2; background: #eef2f6; color: var(--mute); min-width: 44px; text-align: right; font-weight: 400; cursor: pointer; }
table.sheet thead th.rn { z-index: 4; }
table.sheet tr.frz td { background: #f7f9fb; font-weight: 600; }
table.sheet td.n { text-align: right; font-variant-numeric: tabular-nums; }
table.sheet td.exp { background: var(--badb); color: var(--bad); }
table.sheet td.soon { background: var(--warnb); color: var(--warn); }
table.sheet td.sel { background: #e3eefb; }
table.sheet td.act { outline: 2px solid #1a73e8; outline-offset: -2px; }
table.sheet td .sedit { width: 100%; min-width: 160px; border: 0; padding: 0; font: inherit; outline: none; background: #fff; }
.stabs { display: flex; gap: 2px; flex-wrap: wrap; padding: 4px 0; align-items: center; }
.stab { padding: 5px 12px; background: #e8ecf0; border-radius: 0 0 6px 6px; text-decoration: none; color: var(--ink); font-size: 13px; }
.stab.on { background: #fff; color: var(--head); font-weight: 700; box-shadow: 0 2px 0 var(--head) inset; }
td.old { color: var(--bad); }
.ssink { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
/* vehicle master */
.vmbar .stb.on { background: var(--head); color: #fff; border-color: var(--head); }
.chk { font-size: 13px; color: var(--mute); }
.legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; font-size: 12px; }
.lg { padding: 1px 8px; border-radius: 4px; border: 1px solid var(--line); }
.vmwrap { overflow: auto; max-height: calc(100vh - 230px); border: 1px solid var(--line); background: #fff; }
table.vm { border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
table.vm th, table.vm td { border-right: 1px solid #e3e7ec; border-bottom: 1px solid #e3e7ec; padding: 3px 6px; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; background: #fff; }
table.vm th { position: sticky; top: 0; z-index: 2; background: #eef2f6; text-align: left; }
table.vm th.money { background: #f6ecd9; }
table.vm th.filtered { background: #dbe8f8; }
table.vm .sticky { position: sticky; left: 0; z-index: 1; background: #f7f9fb; }
table.vm th.sticky { z-index: 3; }
table.vm td { cursor: pointer; }
.fbtn { border: 0; background: transparent; color: var(--mute); cursor: pointer; padding: 0 2px; margin-left: 4px; font-size: 11px; }
td.bad, .lg.bad { background: #fde4e1 !important; color: #a3170f; }
td.warn, .lg.warn { background: #fff1cc !important; color: #8a5a00; }
td.soon, .lg.soon { background: #fff9e6 !important; }
td.good, .lg.good { background: #e8f6ec !important; }
td.miss, .lg.miss { background: repeating-linear-gradient(45deg, #f3f4f6, #f3f4f6 4px, #e5e7eb 4px, #e5e7eb 8px) !important; }
td.pend, .lg.pend { background: #fff7a8 !important; font-style: italic; }
td.dup, .lg.dup { background: #efe1fb !important; color: #5b2a86; }
td.grey, .lg.grey { color: #9aa3ad !important; }
.vmedit { width: 100%; min-width: 130px; font: inherit; padding: 1px 3px; }
.fmenu { position: fixed; z-index: 60; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 30px rgba(0,0,0,.2); padding: 8px; width: 280px; display: flex; flex-direction: column; gap: 6px; }
.fm-list { max-height: 220px; overflow: auto; display: flex; flex-direction: column; font-size: 13px; }
.fm-quick { display: flex; flex-wrap: wrap; gap: 4px; }
.fm-btns { display: flex; gap: 6px; justify-content: flex-end; }
.vmcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 10px; }
.vmcard { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.vmcard.money { border-color: #e2c48d; background: #fffaf0; }
.vmcard h3 { margin: 0 0 6px; color: var(--head); font-size: 14px; }
table.vmkv { width: 100%; }
table.vmkv th { position: static; width: 45%; font-weight: 500; color: var(--mute); background: transparent; }

/* menu tabs picker + folding menu */
.navh.fold { cursor: pointer; user-select: none; }
.navh.fold::before { content: "▸ "; }
.navh.fold.open::before { content: "▾ "; }
.tabgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px 18px; max-height: 60vh; overflow: auto; margin-top: 8px; }
.tabgrp { border: 1px solid #e3e6ea; border-radius: 8px; padding: 8px 10px; }
.tabhead { display: block; font-weight: 700; margin-bottom: 4px; cursor: pointer; }
.tabsub { display: block; margin-left: 18px; font-size: 13.5px; line-height: 1.7; cursor: pointer; }

/* menu: drag to resize, auto-hide (a thin strip stays; point at it to open) */
.sidegrip { position: absolute; top: 0; right: 0; width: 6px; height: 100%; cursor: col-resize; }
.sidegrip:hover { background: rgba(255,255,255,.25); }
.btn.ghostw { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.35); }
body.autohide .side { position: fixed; top: 0; left: calc(8px - var(--sw, 230px)); z-index: 40; transition: left .15s ease .15s; }
body.autohide .side:hover { left: 0; box-shadow: 4px 0 24px rgba(0,0,0,.28); transition-delay: 0s; }
body.autohide .main { padding-left: 32px; }
/* column widths: drag the right edge of a heading */
th.rzhot { cursor: col-resize; box-shadow: inset -3px 0 0 #1a73e8; }
@media (max-width: 820px) { .sidegrip { display: none; } body.autohide .side { left: -260px; } body.autohide .side.open { left: 0; } }

/* approvals */
.apbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; position: sticky; top: 0; background: var(--bg, #f4f6f8); padding: 8px 0; z-index: 5; }
.apcard { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; }
.aphd { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.aptitle { font-weight: 700; font-size: 15px; }
.apline { display: flex; gap: 10px; align-items: flex-start; padding: 5px 0; border-top: 1px dashed #e6e9ee; flex-wrap: wrap; }
.apf { min-width: 150px; color: var(--mute); }
.apline .old { color: var(--bad); text-decoration: line-through; }
.apline .new, .vdiff .new { color: #0a7a3d; font-weight: 600; }
.vdiff .same { color: var(--ink); }
.vdiff .old { color: var(--bad); }
.arrow { color: var(--mute); }
.apact { display: flex; gap: 8px; margin-top: 6px; }
p.big { font-size: 16px; }
.navc { background: #e8a317; color: #000; border-radius: 9px; padding: 0 6px; font-size: 11px; margin-left: 6px; font-weight: 700; }
