:root {
  --bg: #f4f5f7; --card: #fff; --text: #111827; --muted: #646a73; --line: #e5e7eb;
  --teal: #0f766e; --red: #b91c1c; --red-bg: #fef2f2; --orange: #b45309; --orange-bg: #fffbeb;
  --yellow: #854d0e; --yellow-bg: #fefce8; --green: #15803d; --green-bg: #f0fdf4;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --card: #181b21; --text: #e5e7eb; --muted: #9aa1ab; --line: #2a2f37;
    --teal: #2dd4bf; --red: #f87171; --red-bg: #2a1414; --orange: #fbbf24; --orange-bg: #2a2110;
    --yellow: #fde047; --yellow-bg: #26240f; --green: #4ade80; --green-bg: #10241a;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.bad { color: var(--red); }
.good { color: var(--green); }
h1 { margin: 0 0 4px; font-size: 22px; }
h2 { font-size: 17px; margin: 18px 0 8px; }
button { font: inherit; padding: 8px 14px; border-radius: 8px; border: 0; background: var(--teal); color: #fff; cursor: pointer; }
button.link { background: none; color: var(--teal); padding: 4px 6px; }
button.small { padding: 4px 10px; font-size: 13px; }
button.grey { background: #6b7280; }
input, select { font: inherit; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); max-width: 100%; }
label { display: block; margin: 10px 0; }
label input { display: block; width: 100%; margin-top: 4px; }
.card { background: var(--card); border-radius: 12px; padding: 14px 16px; margin: 10px 0; border: 1px solid var(--line); }
.narrow { max-width: 380px; margin: 12vh auto; }
header { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
header b { font-size: 18px; color: var(--teal); margin-right: auto; }
nav { display: flex; gap: 4px; padding: 8px 12px; overflow-x: auto; background: var(--card); border-bottom: 1px solid var(--line); }
nav button { background: none; color: var(--muted); white-space: nowrap; }
nav button.on { background: var(--teal); color: #fff; }
main { max-width: 980px; margin: 0 auto; padding: 8px 16px 40px; }
.tills { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.till { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.prob { border-left: 5px solid var(--line); }
.prob.red { border-left-color: var(--red); background: var(--red-bg); }
.prob.orange { border-left-color: var(--orange); background: var(--orange-bg); }
.prob.yellow { border-left-color: var(--yellow); background: var(--yellow-bg); }
.prob.done { opacity: .55; background: var(--card); }
.prob .title { font-weight: 600; }
.row { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 220px; }
.side { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 14px; }
.side b { color: var(--muted); font-weight: 500; }
.raw { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; white-space: pre-wrap; }
table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; }
.key { font-family: ui-monospace, monospace; font-size: 16px; padding: 10px; background: var(--bg); border-radius: 8px; overflow-wrap: anywhere; user-select: all; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; background: var(--bg); color: var(--muted); }
.pill.red { background: var(--red-bg); color: var(--red); }
.pill.green { background: var(--green-bg); color: var(--green); }
.summary { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.summary .card { margin: 0; flex: 1; min-width: 140px; }
.summary .big { font-size: 26px; font-weight: 700; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 10px; }
.chip { background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 99px; padding: 5px 14px; }
.chip.on { background: var(--teal); color: #fff; border-color: var(--teal); }
.phead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.phead h3 { margin: 0; font-size: 18px; }
.right { text-align: right; }
.amount { font-size: 18px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.why { margin: 6px 0; font-size: 14px; }
.app { display: inline-block; color: #fff; background: #6b7280; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 6px; vertical-align: 1px; }
details { margin: 6px 0; }
summary { cursor: pointer; color: var(--teal); font-size: 14px; }
details .row { margin-top: 8px; }
.tillbox { padding-bottom: 4px; }
.pay { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); align-items: start; }
.tillbox .phead { margin-bottom: 6px; }
.pay .time { font-variant-numeric: tabular-nums; color: var(--muted); padding-top: 1px; }
.pay .raw { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
.pay.out .amount { text-decoration: line-through; }
.pay.fake { background: var(--red-bg); }
@media (max-width: 520px) { .pay { grid-template-columns: 44px 1fr; } .pay .amount { grid-column: 2; } }
.app1 { background: #0e7490; } .app2 { background: #7c3aed; } .app3 { background: #c2410c; } .app4 { background: #1d4ed8; }
.app5 { background: #be185d; } .app6 { background: #0369a1; } .app7 { background: #4d7c0f; }
.appname { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; vertical-align: middle; }
.logo { width: 28px; height: 28px; border-radius: 7px; object-fit: cover; border: 1px solid var(--line); background: #fff; }
.apptotals { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin: 4px 0 10px; }
.apptotal { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.apptotal .amount { font-size: 16px; margin-top: 4px; }
.apptotal .logo { width: 36px; height: 36px; border-radius: 9px; }
.pay .logo { width: 32px; height: 32px; }
.prob.green { border-left-color: var(--green); background: var(--green-bg); }
ol { margin: 8px 0; padding-left: 22px; } ol li { margin: 3px 0; }
.nowrap { white-space: nowrap; }
.ask { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; white-space: normal; }
.ask input { min-width: 160px; padding: 5px 8px; }
