/* TenX · Daily Cash Collection */
:root {
  --bg: #f4f2ec; --surface: #fff; --ink: #17202b; --muted: #5f6b7a; --line: #dfdbd0; --soft: #f8f6f1;
  --brand: #14345f; --brand-ink: #fff; --accent: #c8102e;
  --ok: #17754a; --ok-bg: #e3f3ea; --warn: #8a5a00; --warn-bg: #fdf0cf; --bad: #a8201a; --bad-bg: #fbe4e1; --idle: #5f6b7a; --idle-bg: #ebe8e0;
  --r: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0; letter-spacing: -.01em; text-wrap: balance; }
h2 { font-size: 1rem; margin: 0 0 .7rem; }
small { color: var(--muted); font-weight: 400; }
code { font: 600 .95em ui-monospace, Consolas, monospace; background: var(--soft); padding: .1em .4em; border-radius: 4px; border: 1px solid var(--line); }
main { max-width: 1320px; margin: 0 auto; padding: 18px 16px 60px; }

/* top bar */
.top { background: var(--brand); color: #fff; display: flex; align-items: center; gap: 18px; padding: 0 16px; min-height: 54px; position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; line-height: 1.15; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand small { display: block; color: #b9c7da; font-size: .72rem; font-weight: 500; }
.mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 800; font-size: 1.05rem; }
.mark.big { width: 48px; height: 48px; font-size: 1.5rem; border-radius: 12px; margin-bottom: 12px; }
.top nav { display: flex; align-items: center; gap: 2px; flex: 1; flex-wrap: wrap; }
.top nav > a { color: #d5deea; padding: 16px 11px; font-weight: 600; font-size: .92rem; border-bottom: 3px solid transparent; }
.top nav > a:hover { color: #fff; text-decoration: none; }
.top nav > a.on { color: #fff; border-bottom-color: var(--accent); }
.who { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: .85rem; }
.who span { line-height: 1.15; text-align: right; }
.who small { display: block; color: #b9c7da; }
.who a { color: #d5deea; }
.badge { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: .75rem; font-weight: 700; text-align: center; }
.burger { display: none; margin-left: auto; cursor: pointer; padding: 10px 4px; }
.burger i { display: block; width: 22px; height: 2px; background: #fff; margin: 5px 0; }

/* page furniture */
.titlebar { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.titlebar p { margin: 2px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card.attention { border-color: #e3b341; box-shadow: inset 4px 0 0 #e3b341; }
.cols { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; }
.cols > .card { min-width: 0; }
.hint { color: var(--muted); margin: 0 0 .8rem; font-size: .9rem; max-width: 80ch; }
.empty { color: var(--muted); padding: 14px 16px; margin: 0; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; background: var(--ok-bg); color: var(--ok); border: 1px solid #b9dfc9; font-weight: 600; }
.flash.err { background: var(--bad-bg); color: var(--bad); border-color: #efc0bb; }
.flash.warn { background: var(--warn-bg); color: var(--warn); border-color: #ecd699; }
.pw { font-size: 1.1em; user-select: all; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid #c9c4b6; background: #fff; color: var(--ink); font-family: inherit; font-weight: 600; font-size: .9rem; line-height: 1.2; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--soft); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #0e2747; }
.btn.danger { color: var(--bad); border-color: #e0b1ac; }
.btn.small { padding: 4px 9px; font-size: .8rem; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid #2f6fd0; outline-offset: 1px; }
form.inline { display: inline; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 13px 15px; display: flex; flex-direction: column; gap: 2px; }
.tile strong { font-size: 1.45rem; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.tile.key { background: var(--brand); border-color: var(--brand); color: #fff; }
.tile.key .lbl, .tile.key small { color: #c3d0e2; }
.tile.warn { box-shadow: inset 0 3px 0 #e3b341; }
.tile.bad { box-shadow: inset 0 3px 0 var(--bad); }
.tile.bad strong { color: var(--bad); }
.lbl { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }

/* tables */
.scroll { overflow-x: auto; }
.scroll.tall { max-height: 56vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
table.grid { width: 100%; border-collapse: collapse; font-size: .88rem; }
.grid th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--soft); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.grid td { padding: 7px 10px; border-bottom: 1px solid #eeeae0; vertical-align: middle; }
.grid tbody tr:hover td { background: #fbfaf6; }
.grid .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid .nw { white-space: nowrap; }
.grid .sep { border-left: 2px solid var(--line); }
.grid .strong { font-weight: 700; }
.grid tfoot td, .grid tr.subtotal td { font-weight: 700; background: var(--soft); border-top: 1px solid var(--line); }
.grid tfoot td { background: #ece8dd; }
.zero { color: #b3ac9c; }
.hold { color: var(--warn); font-weight: 700; }
.gone { color: var(--ok); font-size: .8rem; }
.sheet th { white-space: normal; min-width: 74px; vertical-align: bottom; }
.sheet td:first-child, .sheet th:first-child { position: sticky; left: 0; background: #fff; z-index: 2; }
.sheet th:first-child { background: var(--soft); }
.sheet tr.subtotal td:first-child { background: var(--soft); }
.sheet tfoot td:first-child { background: #ece8dd; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: .74rem; font-weight: 700; background: var(--idle-bg); color: var(--idle); white-space: nowrap; }
.chip.pending { background: var(--warn-bg); color: var(--warn); }
.chip.confirmed { background: var(--ok-bg); color: var(--ok); }
.chip.rejected { background: var(--bad-bg); color: var(--bad); }
.age { font-size: .75rem; color: var(--muted); font-weight: 700; }
.age.late { color: var(--bad); }
.pager { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }

/* forms */
label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; font-weight: 600; color: #3b4654; }
input, select, textarea { font: inherit; font-size: 16px; color: var(--ink); padding: 8px 10px; border: 1px solid #c9c4b6; border-radius: 8px; background: #fff; width: 100%; min-width: 0; }
input[type=checkbox] { width: 18px; height: 18px; padding: 0; accent-color: var(--brand); flex: none; }
input[type=file] { padding: 6px; font-size: .85rem; }
input:disabled, select:disabled { background: var(--soft); color: #4a5563; }
input.amt { text-align: right; font-variant-numeric: tabular-nums; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters label { min-width: 140px; }
.filters .grow, .tagbar .grow { flex: 1; min-width: 180px; }
.filters .check { min-width: 0; padding-bottom: 9px; }
.filters.range .tabs { margin: 0; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 14px; }
.fields.one { grid-template-columns: 1fr; }
.fields .span2 { grid-column: span 2; }
.fields .span3 { grid-column: 1 / -1; }
.fields.modes { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.cashfield input { border-color: var(--brand); border-width: 2px; background: #f3f7fd; font-weight: 700; }
.sumline { display: flex; gap: 26px; flex-wrap: wrap; padding: 10px 14px; background: var(--soft); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 14px; }
.sumline strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; margin-left: 6px; }
.sumline .off strong { color: var(--bad); }
.formfoot { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.formfoot.sticky { position: sticky; bottom: 0; background: #fff; padding: 12px 0 2px; border-top: 1px solid var(--line); margin-top: 12px; justify-content: space-between; }
.sendtotal strong { font-size: 1.3rem; font-variant-numeric: tabular-nums; margin-left: 6px; }
.addrow { border-top: 1px dashed var(--line); margin-top: 14px; padding-top: 14px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { padding: 7px 13px; border-radius: 20px; border: 1px solid #c9c4b6; background: #fff; color: var(--ink); font-weight: 600; font-size: .88rem; }
.tabs a:hover { text-decoration: none; background: var(--soft); }
.tabs a.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.tagbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 10px; }
.tagbar label { min-width: 130px; }
.lots input.lotamt { width: 110px; padding: 5px 8px; }
.lots tr.on td { background: #eef4fd !important; }
.lots tr[hidden] { display: none; }
.lots .sub { display: none; }

/* voucher + trail */
.vhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.vhead h2 { margin: 0; }
.vhead .hint { margin: 2px 0 0; }
.big { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.right { text-align: right; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 20px; margin: 0 0 18px; }
.facts dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.signs { display: none; }
.where { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }
.where span { background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.where small { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.trail { list-style: none; margin: 0; padding: 0 0 0 8px; border-left: 2px solid var(--line); }
.trail li { position: relative; padding: 5px 0 5px 16px; display: flex; gap: 12px; flex-wrap: wrap; }
.trail li::before { content: ""; position: absolute; left: -7px; top: 11px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); border: 2px solid #fff; }
.trail li.pending::before { background: #e3b341; }
.trail li.rejected::before, .trail li.cancelled::before { background: #b3ac9c; }
.trail li.rejected, .trail li.cancelled { color: var(--muted); }
.trail .when { color: var(--muted); min-width: 92px; font-variant-numeric: tabular-nums; }

/* chart */
.bars { width: 100%; height: auto; display: block; }
.bars .b1, .legend .b1 { fill: var(--brand); background: var(--brand); }
.bars .b2, .legend .b2 { fill: #8fb0dc; background: #8fb0dc; }
.bars .axis { stroke: var(--line); }
.bars .hit { fill: transparent; }
.bars g:hover .hit { fill: #f1eee6; }
.bars text { font-size: 11px; fill: var(--muted); text-anchor: middle; }
.legend { margin: 8px 0 0; color: var(--muted); font-size: .82rem; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 4px 0 10px; }
.legend i:first-child { margin-left: 0; }

/* sign-in */
body.bare { display: grid; min-height: 100vh; place-items: center; }
body.bare main { width: 100%; }
.auth { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 28px; max-width: 400px; margin: 0 auto; }
.auth.wide { max-width: 640px; }
.auth h1 { margin-bottom: 6px; }
.auth p { color: var(--muted); margin: 0 0 16px; }
.auth form { display: grid; gap: 14px; }
.creds { margin-bottom: 18px; }

@media (max-width: 900px) {
  .cols { grid-template-columns: 1fr; }
  .burger { display: block; }
  .top { flex-wrap: wrap; }
  .top nav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding-bottom: 10px; }
  #navtoggle:checked ~ nav { display: flex; }
  .top nav > a { padding: 11px 6px; border-bottom: 1px solid #284a78; }
  .top nav > a.on { border-bottom-color: #284a78; box-shadow: inset 3px 0 0 var(--accent); padding-left: 12px; }
  .who { margin: 10px 0 0; justify-content: space-between; }
  .who span { text-align: left; }
  .fields .span2 { grid-column: 1 / -1; }
  .tile strong { font-size: 1.25rem; }
  main { padding: 14px 12px 60px; }
  .filters label { flex: 1 1 130px; }
  .lots .opt { display: none; }
  .lots .sub { display: block; font-size: .75rem; }
  .lots td { overflow-wrap: anywhere; }
  .lots input.lotamt { width: 84px; }
  .lots td, .lots th { padding: 7px 6px; }
}
@media print {
  .top, .noprint, .actions, .flash, .filters { display: none !important; }
  body { background: #fff; font-size: 12px; }
  main { padding: 0; max-width: none; }
  .card { border: none; padding: 0; }
  .scroll { overflow: visible; }
  .grid th { position: static; }
  .sheet td:first-child, .sheet th:first-child { position: static; }
  .signs { display: flex; justify-content: space-between; margin-top: 70px; }
  .signs span { border-top: 1px solid #000; padding-top: 4px; width: 28%; text-align: center; }
}
