/* Benny. Phone first: one column and a tab bar along the bottom; from 760px the tabs move to
   a sidebar and the Personal page splits in two. Same markup at every size.
   System fonts on purpose - no web-font host sees our staff's IP addresses (CSP is 'self'). */
:root {
  --bg: #EEF2EF; --surface: #FFFFFF; --sunk: #F5F8F6; --line: #D7E0DB;
  --fg: #18282A; --muted: #5B6E6C;
  --brand: #1F5F57; --brand-ink: #FFFFFF; --brand-soft: #DCEDE8;
  --sun: #F2B33D; --sun-soft: #FCEFD3;
  --ok: #2E7D4F; --ok-soft: #DDF1E4; --warn: #9A6200; --warn-soft: #FBEBCB; --bad: #B23A30; --bad-soft: #F8DEDA;
  --f-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", monospace;
  --r: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1716; --surface: #172221; --sunk: #121C1B; --line: #2A3A38;
    --fg: #E4EEEB; --muted: #93A8A4;
    --brand: #5FB8A8; --brand-ink: #0C1A18; --brand-soft: #1E3632;
    --sun-soft: #3A2F17;
    --ok: #6FCB92; --ok-soft: #173226; --warn: #E9B45A; --warn-soft: #352915; --bad: #F08A7E; --bad-soft: #3A1E1B;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 15px/1.45 var(--f-body); }
button, input, select { font: inherit; color: inherit; }
a { color: var(--brand); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---- shell ---- */
.app { display: flex; min-height: 100dvh; }
.side { display: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 10px; background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 21px; letter-spacing: -.02em; }
.mark { width: 30px; height: 30px; border-radius: 9px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-size: 17px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--sun-soft); color: var(--warn);
  display: grid; place-items: center; font-weight: 700; font-size: 13px; text-decoration: none;
}
.demo { margin: 0 16px 8px; padding: 6px 10px; border-radius: 8px; background: var(--sun-soft); color: var(--warn); font-size: 13px; font-weight: 600; }
.screen { flex: 1; padding: 4px 16px calc(96px + env(safe-area-inset-bottom, 0px)); max-width: 1100px; width: 100%; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 3;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px 4px calc(8px + env(safe-area-inset-bottom, 0px));
}
.tabbar a, .tabbar button {
  display: grid; justify-items: center; gap: 2px; padding: 6px 0;
  border: 0; background: none; cursor: pointer; text-decoration: none;
  font-size: 11px; font-weight: 600; color: var(--muted);
}
.tabbar form { display: contents; }
.tabbar [aria-current="page"] { color: var(--brand); }
.tabbar svg { width: 22px; height: 22px; }

@media (min-width: 760px) {
  .tabbar { display: none; }
  .side {
    display: flex; flex-direction: column; gap: 2px; width: 228px; flex: none;
    position: sticky; top: 0; height: 100dvh;
    background: var(--surface); border-right: 1px solid var(--line); padding: 20px 12px;
  }
  .side .brand { padding: 0 8px 18px; }
  .side a, .side button {
    display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
    border: 0; background: none; text-align: left; cursor: pointer; text-decoration: none;
    color: var(--fg); font-weight: 500;
  }
  .side a:hover, .side button:hover { background: var(--sunk); }
  .side [aria-current="page"] { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
  .side svg { width: 18px; height: 18px; }
  .side-out { margin-top: auto; }
  .top .brand { visibility: hidden; }
  .top { padding: 20px 32px 8px; }
  .demo { margin: 0 32px 8px; }
  .screen { padding: 6px 32px 48px; }
  .split { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: start; }
}

/* ---- content ---- */
.stack, .split { display: grid; gap: 14px; }
.title { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin: 4px 0 0; text-wrap: balance; }
.sub { color: var(--muted); margin: 2px 0 0; }
.hint { color: var(--muted); font-size: 13px; margin: 0; }
.hint.center { text-align: center; }
.label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: grid; gap: 12px; min-width: 0; }
.card h2 { margin: 0; font-size: 16px; font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.tile { text-decoration: none; color: var(--fg); gap: 4px; }
.tile:hover { border-color: var(--brand); }
.tile-title { font-weight: 600; }
.tile.attention { background: var(--sun-soft); border-color: transparent; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }

.note { background: var(--sun-soft); border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.note.bad { background: var(--bad-soft); color: var(--bad); }
.flash { background: var(--ok-soft); color: var(--ok); border-radius: 8px; padding: 10px 12px; font-weight: 600; margin-bottom: 12px; }
.flash.bad { background: var(--bad-soft); color: var(--bad); }
.note.ok-note { background: var(--ok-soft); }
.pill { background: var(--sunk); color: var(--muted); }
.muted-inline { color: var(--muted); font-weight: 400; }
.nowrap { white-space: nowrap; }

/* lists: one row per item, label left, state right */
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.card > h2 + .row, .card > h2 + .hint + .row { border-top: 0; }
.row > div { min-width: 0; }
.row .t { font-weight: 600; overflow-wrap: anywhere; }
.row .s { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.row-end { display: grid; justify-items: end; gap: 4px; flex: none; }
.row-end form { margin: 0; }
.amt { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.link { border: 0; background: none; color: var(--brand); font-weight: 600; cursor: pointer; padding: 0; font-size: 13px; }
.estimate { display: flex; justify-content: space-between; align-items: baseline; background: var(--brand-soft); border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.estimate b { font-size: 18px; font-variant-numeric: tabular-nums; }
progress.meter { width: 100%; height: 8px; border: 0; border-radius: 4px; overflow: hidden; appearance: none; background: var(--sunk); }
progress.meter::-webkit-progress-bar { background: var(--sunk); }
progress.meter::-webkit-progress-value { background: var(--brand); border-radius: 4px; }
progress.meter::-moz-progress-bar { background: var(--brand); border-radius: 4px; }
.num { font-variant-numeric: tabular-nums; }

.row.first { border-top: 0; padding-top: 0; }
.big { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.bad-text { color: var(--bad); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
input[type="file"] { padding: 9px; font-size: 14px; }

/* receipts on the approvals screen */
.receipts { display: flex; flex-wrap: wrap; gap: 8px; }
.receipt-thumb { display: block; width: 120px; height: 120px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--sunk); }
.receipt-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* approvals: now vs requested */
.table-wrap { overflow-x: auto; }
.compare { width: 100%; border-collapse: collapse; font-size: 14px; }
.compare th, .compare td { text-align: left; padding: 7px 8px; border-top: 1px solid var(--line); }
.compare thead th { border-top: 0; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.compare tbody th { font-weight: 500; color: var(--muted); }
.compare tr.changed td:last-child { background: var(--sun-soft); font-weight: 600; }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.reject summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; padding: 4px 0; }
.reject[open] summary { margin-bottom: 10px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.masked { font-family: var(--f-mono); letter-spacing: .03em; white-space: nowrap; }

/* ---- forms ---- */
.form { display: grid; gap: 12px; }
.field { display: grid; gap: 5px; min-width: 0; }
.field label { font-size: 13px; font-weight: 600; }
.pair, .trio { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 480px) {
  .pair { grid-template-columns: 1fr 1fr; }
  .trio { grid-template-columns: 2fr 1fr 1fr; }
}
input, select {
  width: 100%; min-width: 0; background: var(--sunk); border: 1px solid var(--line); border-radius: 8px;
  padding: 11px 12px; font-size: 16px; /* 16px stops iOS zooming into the field */
}
input.upper { text-transform: uppercase; }
input:focus, select:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.input-validation-error { border-color: var(--bad); }
.err { color: var(--bad); font-size: 13px; }
.err:empty { display: none; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; flex: none; }

.btn {
  display: inline-block; border: 0; border-radius: 9px; padding: 12px 18px; cursor: pointer; text-decoration: none;
  background: var(--brand); color: var(--brand-ink); font-weight: 600; font-size: 15px; text-align: center;
}
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: var(--sunk); color: var(--fg); border: 1px solid var(--line); }
.btn.small { padding: 8px 12px; font-size: 13px; }
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- login ---- */
.login-page { display: grid; place-items: center; min-height: 100dvh; padding: 24px 16px; }
.login { width: 100%; max-width: 380px; display: grid; gap: 14px; }
.big-brand { font-size: 30px; }
.big-brand .mark { width: 40px; height: 40px; font-size: 22px; border-radius: 11px; }
.login .btn { width: 100%; }
.center-link { display: block; text-align: center; margin-top: 4px; width: 100%; }
input.pin { font-family: var(--f-mono); font-size: 24px; letter-spacing: .5em; text-align: center; }

@media (prefers-reduced-motion: no-preference) {
  .flash { animation: arrive .25s ease-out; }
  @keyframes arrive { from { opacity: 0; transform: translateY(-4px); } }
}

/* Fields Benny filled in from a receipt photo - marked until the person changes them. */
.filled { background: var(--sun-soft); }
.note.reading::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .note.reading::before { animation: none; } }

/* ---- snap a receipt (Home + Receipts) ---- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.snap-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 64px; font-size: 18px; cursor: pointer; }
.snap-btn svg { width: 26px; height: 26px; }
.snap-btn[hidden] { display: none; }
.snap form { margin: 0; }
.snap label.snap-btn:has(+ input:focus-visible) { outline: 3px solid var(--sun); outline-offset: 2px; }
.toggle { display: grid; grid-template-columns: 1fr 1fr; background: var(--sunk); border: 1px solid var(--line); border-radius: 999px; padding: 4px; margin-bottom: 12px; }
.toggle label { position: relative; text-align: center; padding: 9px 6px; border-radius: 999px; cursor: pointer; font-weight: 600; color: var(--muted); }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle label:has(input:checked) { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.toggle label:has(input:focus-visible) { outline: 2px solid var(--brand); }
.snap-results { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.snap-results:not(:empty) { margin-top: 12px; }
.snap-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; background: var(--sunk); }
.snap-item .what { font-weight: 600; }
.snap-item .more { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.snap-item .acts { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.light { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-weight: 800; font-size: 16px; color: #fff; flex: none; }
.light.g { background: var(--ok); }
.light.y { background: var(--sun); color: #3A2A00; }
.light.r { background: var(--bad); }
.light.n { background: var(--line); color: var(--fg); }
.lit { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.answer { padding: 12px 0; border-top: 1px solid var(--line); display: grid; gap: 10px; }

/* ---- Time: hours grid ---- */
.period-nav { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.period-nav a { text-decoration: none; font-size: 20px; line-height: 1; padding: 0 6px; }
.hours { display: grid; gap: 0; }
.hour-row { display: grid; grid-template-columns: 1fr 72px; gap: 4px 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.hour-row.weekend .hour-day b { color: var(--muted); }
.hour-row.today .hour-day b { color: var(--brand); }
.hour-day { font-size: 14px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.hour-day .s { width: 100%; font-size: 12px; color: var(--muted); }
.hour-num { text-align: right; font-variant-numeric: tabular-nums; }
.hour-num.ro { padding-right: 12px; }
.hour-note { grid-column: 1 / -1; }
details.hour-note summary { font-size: 12px; color: var(--muted); cursor: pointer; list-style: none; }
details.hour-note summary::-webkit-details-marker { display: none; }
details.hour-note[open] summary { margin-bottom: 4px; }
.hour-note.s { font-size: 12px; color: var(--muted); }
.hours .estimate { margin-top: 8px; }
.hours button { margin-top: 10px; }


/* ---- Pay ---- */
h3.minor { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 14px 0 6px; }

/* ---- More ---- */
.more-list { display: grid; padding: 4px 0; }
.more-list a { display: flex; align-items: center; gap: 12px; padding: 14px 16px; text-decoration: none; color: var(--fg); border-top: 1px solid var(--line); font-weight: 600; }
.more-list a:first-child { border-top: 0; }
.more-list svg { width: 22px; height: 22px; color: var(--brand); }
fieldset.field { border: 0; padding: 0; margin: 0; display: flex; gap: 18px; flex-wrap: wrap; }
fieldset.field legend { font-weight: 600; font-size: 14px; margin-bottom: 6px; }

/* ---- Mileage: usual trips ---- */
.usual { display: grid; gap: 6px; margin-bottom: 12px; }
.usual .label { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--sunk); color: var(--fg); border-radius: 999px; padding: 8px 12px;
        font: inherit; font-size: 14px; cursor: pointer; text-align: left; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip b { color: var(--brand); margin-right: 4px; }
.chip:active { filter: brightness(.95); }

/* ---- Arrange menu ---- */
.arrange { list-style: none; margin: 0; padding: 0; display: grid; }
.arrange li { position: relative; display: grid; grid-template-columns: 28px 1fr auto auto; align-items: center; gap: 10px;
              padding: 12px 4px; border-top: 1px solid var(--line); background: var(--surface); touch-action: none; user-select: none; }
.arrange li:first-child { border-top: 0; }
.arrange li.fixed { color: var(--muted); }
.arrange li.dragging { box-shadow: 0 4px 16px rgba(0, 0, 0, .18); border-radius: 8px; z-index: 2; cursor: grabbing; }
.arrange .grip { color: var(--muted); cursor: grab; display: grid; place-items: center; }
.arrange .grip svg, .arrange .name svg { width: 20px; height: 20px; vertical-align: -4px; }
.arrange .name { font-weight: 600; }
.arrange .where { font-size: 12px; color: var(--brand); }
.arrange .divider { position: absolute; top: -9px; left: 40px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
                    background: var(--surface); padding: 0 6px; color: var(--muted); }
.arrange .arrows { display: flex; gap: 4px; margin: 0; }
.arrow { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--sunk); color: var(--fg); font-size: 16px; cursor: pointer; }
.arrow:disabled { opacity: .35; cursor: default; }
.side-arrange { opacity: .75; font-size: 14px; }

/* which build is live (sign-in and More) */
.version { text-align: center; font-size: 12px; color: var(--muted); margin: 16px 0 0; font-variant-numeric: tabular-nums; }
.snap-alt { display: block; text-align: center; margin-top: 10px; font-size: 14px; color: var(--brand); text-decoration: underline; cursor: pointer; }
.answer.focus { background: var(--sun-soft); margin: 0 -12px; padding: 12px; border-radius: 8px; }
