:root {
  --bg: #f1f5f9; --card: #fff; --ink: #0f172a; --muted: #64748b; --line: #e2e8f0;
  --brand: #0f172a; --accent: #2563eb; --ok: #15803d; --ok-bg: #dcfce7; --bad: #b91c1c; --bad-bg: #fee2e2;
  --warn: #a16207; --warn-bg: #fef9c3; --info-bg: #e0e7ff;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select, textarea { font: inherit; }
[hidden] { display: none !important; }

.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--brand); color: #fff; }
.brand { font-weight: 700; letter-spacing: .2px; display: flex; align-items: center; gap: 8px; }
.logo { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: #22c55e; color: #052e16; font-weight: 800; }
.who { font-size: 13px; display: flex; gap: 10px; align-items: center; }
.who button { background: transparent; color: #cbd5e1; border: 1px solid #334155; border-radius: 8px; padding: 4px 10px; cursor: pointer; }

.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 8px 12px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 50px; z-index: 4; }
.tabs button { border: 0; background: transparent; padding: 8px 14px; border-radius: 8px; color: var(--muted); cursor: pointer; white-space: nowrap; font-weight: 600; }
.tabs button.on { background: var(--info-bg); color: var(--accent); }

main { max-width: 1100px; margin: 0 auto; padding: 16px; }
.pad { padding: 24px; } .center { text-align: center; } .muted { color: var(--muted); } .small { font-size: 13px; }
h2 { font-size: 18px; margin: 22px 0 10px; } h2:first-child { margin-top: 4px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 14px; }
.narrow { max-width: 440px; margin: 20px auto; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.stat .label { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 26px; font-weight: 750; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.stat.big { border: 2px solid var(--accent); }
.stat.bad { background: var(--bad-bg); border-color: #fecaca; } .stat.bad .value { color: var(--bad); }
.stat.good .value { color: var(--ok); }

label { display: block; font-weight: 600; font-size: 13.5px; margin: 12px 0 5px; }
input, select, textarea { width: 100%; padding: 11px 12px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid #93c5fd; border-color: var(--accent); }
input.money { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; } .row > * { flex: 1; min-width: 140px; }
.btn { display: inline-block; border: 0; border-radius: 10px; padding: 11px 18px; background: var(--accent); color: #fff; font-weight: 700; cursor: pointer; }
.btn.block { width: 100%; margin-top: 16px; padding: 14px; font-size: 16px; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid #cbd5e1; }
.btn.danger { background: #fff; color: var(--bad); border: 1px solid #fecaca; }
.btn.sm { padding: 6px 10px; font-size: 13px; font-weight: 600; }
.btn:disabled { opacity: .55; cursor: default; }
.seg { display: flex; border: 1px solid #cbd5e1; border-radius: 10px; overflow: hidden; }
.seg button { flex: 1; border: 0; background: #fff; padding: 10px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--accent); color: #fff; }
.err { color: var(--bad); font-size: 14px; margin-top: 10px; min-height: 1em; }

.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); background: #f8fafc; font-weight: 700; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.click { cursor: pointer; } tr.click:hover td { background: #f8fafc; }
tr.voided td { color: #94a3b8; text-decoration: line-through; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 700; }
.pill.ok { background: var(--ok-bg); color: var(--ok); } .pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); } .pill.info { background: var(--info-bg); color: var(--accent); }
.pill.grey { background: #f1f5f9; color: var(--muted); }
.neg { color: var(--bad); font-weight: 700; } .pos { color: var(--warn); font-weight: 700; } .zero { color: var(--ok); font-weight: 700; }

.banner { border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-weight: 600; }
.banner.bad { background: var(--bad-bg); color: var(--bad); } .banner.ok { background: var(--ok-bg); color: var(--ok); }
.banner.info { background: var(--info-bg); color: #1e3a8a; font-weight: 500; }

.shot-pick { border: 2px dashed #cbd5e1; border-radius: 12px; padding: 18px; text-align: center; cursor: pointer; color: var(--muted); background: #f8fafc; }
.shot-pick img { max-width: 100%; max-height: 260px; border-radius: 8px; display: block; margin: 0 auto; }
.shot-full { max-width: 100%; border-radius: 10px; border: 1px solid var(--line); }

.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: #fff; width: 100%; max-width: 820px; max-height: 88vh; overflow: auto; border-radius: 16px 16px 0 0; padding: 16px; }
@media (min-width: 700px) { .modal { align-items: center; } .sheet { border-radius: 16px; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.sheet-head h3 { margin: 0; font-size: 17px; }
.x { border: 0; background: #f1f5f9; width: 34px; height: 34px; border-radius: 50%; font-size: 20px; cursor: pointer; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14px; margin: 8px 0 14px; }
.kv div:nth-child(odd) { color: var(--muted); } .kv div:nth-child(even) { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px; z-index: 30; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.staff-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr auto; gap: 8px; align-items: end; padding: 10px 0; border-bottom: 1px solid var(--line); }
.staff-row:last-child { border-bottom: 0; }
@media (max-width: 640px) { .staff-row { grid-template-columns: 1fr 1fr; } }
