:root {
  --bg: #0a0b0c;
  --panel: #121416;
  --panel-2: #181b1e;
  --line: #24282b;
  --text: #f2f4f5;
  --muted: #8b9498;
  --faint: #5d666a;
  --teal: #2cdce4;
  --teal-soft: rgba(44, 220, 228, 0.12);
  --red: #f0716d;
  --green: #5fd38d;
  --amber: #f2b84b;

  /* split bar colors */
  --c-product: #3a4146;
  --c-fees: #5d666a;
  --c-software: #8b9498;
  --c-venue: #f2f4f5;
  --c-leslie: #a6eef2;
  --c-malek: #2cdce4;
  --c-josiah: #128a91;

  --radius: 4px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f6f7;
  --panel: #ffffff;
  --panel-2: #f8fafa;
  --line: #dfe4e6;
  --text: #0a0b0c;
  --muted: #5d666a;
  --faint: #8b9498;
  --teal: #0b9aa2;
  --teal-soft: rgba(11, 154, 162, 0.1);
  --red: #c8423d;
  --green: #22874f;
  --amber: #b07612;
  --c-product: #d5dbdd;
  --c-fees: #aab3b6;
  --c-software: #7c868a;
  --c-venue: #0a0b0c;
  --c-leslie: #9fe3e7;
  --c-malek: #2cdce4;
  --c-josiah: #0b8f96;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: "Inter", system-ui, -apple-system, sans-serif; font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

h1 { font-size: 24px; font-weight: 600; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 12px; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin: 32px 0 12px; }
h3 { font-size: 15px; font-weight: 600; margin: 0 0 10px; }
p { margin: 0 0 12px; max-width: 70ch; }
.muted { color: var(--muted); }
.num, td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 30;
  background: var(--bg); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  transform: translateX(-100%); visibility: hidden; transition: transform .22s ease, visibility .22s;
}
.sidebar.open { transform: none; visibility: visible; }
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 25; display: none; }
.scrim.show { display: block; }
.sidebar-head { display: flex; justify-content: space-between; align-items: center; height: 64px; padding: 0 16px 0 24px; border-bottom: 1px solid var(--line); }
.brand { text-decoration: none; font-weight: 500; letter-spacing: 0.24em; text-transform: uppercase; font-size: 14px; }
.nav { padding: 12px 0; overflow-y: auto; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 14px; padding: 12px 24px;
  text-decoration: none; color: var(--muted); font-size: 15px; border-left: 3px solid transparent;
}
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--teal); background: var(--teal-soft); border-left-color: var(--teal); }
.nav-group { padding: 22px 24px 8px; font-size: 11px; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; color: var(--teal); }
.sidebar-foot { border-top: 1px solid var(--line); padding: 12px 0 20px; }
.foot-link { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 24px; background: none; border: 0; color: var(--muted); font: inherit; font-size: 14px; text-decoration: none; cursor: pointer; text-align: left; }
.foot-link:hover { color: var(--text); }
.foot-link.accent { color: var(--red); letter-spacing: 0.14em; text-transform: uppercase; font-size: 12px; }
.who { padding: 8px 24px 0; font-size: 12px; color: var(--faint); overflow-wrap: anywhere; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10; height: 64px;
  display: flex; align-items: center; gap: 16px; padding: 0 20px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.icon-btn { background: none; border: 0; color: var(--text); padding: 8px; cursor: pointer; display: inline-flex; border-radius: var(--radius); }
.icon-btn svg { width: 24px; height: 24px; }
.page-title { font-size: 19px; font-weight: 600; }
.page-figure { font-size: 14px; color: var(--teal); letter-spacing: 0.08em; font-variant-numeric: tabular-nums; }

@media (min-width: 1100px) {
  .sidebar { transform: none; visibility: visible; }
  .scrim, #openMenu, .close-menu { display: none !important; }
  .shell { margin-left: 280px; }
}

main { max-width: 1480px; margin: 0; padding: 28px 32px 80px; }
main:focus { outline: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }

/* ---------- Quarter picker (styled like a select) ---------- */
.qpick { display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: var(--radius); margin-bottom: 20px; }
.qpick button { background: none; border: 0; color: var(--muted); padding: 12px 16px; cursor: pointer; font: inherit; font-size: 18px; line-height: 1; }
.qpick button:hover { color: var(--text); }
.qpick span { font-size: 13px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }

/* ---------- Stat tiles ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 22px 24px; min-width: 0; min-height: 134px; }
.tile .label { font-size: 12px; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.tile .value { font-size: 30px; font-weight: 600; margin: 8px 0 4px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.tile .sub { font-size: 14px; color: var(--muted); }
.tile.teal .value { color: var(--teal); }
.tile.green .value { color: var(--green); }
.tile.red .value { color: var(--red); }
.tile.amber .value { color: var(--amber); }

/* ---------- Dashboard ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.small { font-size: 12.5px; }
.period { display: block; margin-bottom: 20px; }
.period select { padding: 13px 16px; background: var(--bg); font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); cursor: pointer; }
.delta { font-size: 13px; font-weight: 500; letter-spacing: 0.04em; margin-left: 6px; white-space: nowrap; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }
.todo ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.todo a, table.machines td a { color: var(--teal); text-decoration: none; }
table.machines td { vertical-align: middle; }
table.machines .split-col { width: 38%; min-width: 260px; }
table.machines .bar { height: 14px; }
.legend.key { margin-top: 8px; gap: 4px 14px; font-size: 12px; letter-spacing: 0; text-transform: none; font-weight: 400; }
table.machines th { vertical-align: bottom; }
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
.two-col .panel { margin-bottom: 0; }
.chart { display: flex; align-items: flex-end; gap: 4px; height: 180px; }
.chart .col { flex: 1; height: 100%; display: flex; align-items: flex-end; min-width: 3px; }
.chart .fill { width: 100%; background: var(--teal); border-radius: 2px 2px 0 0; opacity: .9; }
.chart .col:hover .fill { opacity: 1; }
.chart-axis { display: flex; justify-content: space-between; margin-top: 10px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 8px; }
.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.rank-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.rank-row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-bar { height: 4px; background: var(--panel-2); margin-top: 6px; border-radius: 2px; }
.rank-bar div { height: 100%; background: var(--teal); border-radius: 2px; }
@media (max-width: 1000px) { .two-col { grid-template-columns: 1fr; } table.machines .split-col { display: none; } }

/* ---------- Payouts ---------- */
button.btn.small-btn, a.btn.small-btn { padding: 8px 14px; font-size: 12px; }
table.pay td { vertical-align: middle; }
table.pay td a { color: var(--teal); }
.pay-actions { text-align: right; white-space: nowrap; }
.pay-actions select { width: auto; padding: 7px 10px; font-size: 13px; margin-right: 8px; }
.calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 12px; }
.calc-grid .panel { margin: 0; }
.calc-line { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 14px; border-bottom: 1px solid var(--line); }
.calc-line.total { font-weight: 600; border-bottom: 1px solid var(--muted); }
.calc-line.owed .num { color: var(--teal); font-weight: 600; }
.calc-line.sub { padding-left: 14px; }
.calc .actions { margin-top: 16px; }
table.adj { margin-bottom: 16px; }
table.adj td { padding: 10px 12px 10px 0; }
.adj-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.adj-form label { flex: 0 0 170px; }
.adj-form label.grow { flex: 1 1 240px; }

/* ---------- Deposits ---------- */
.flag.amber { background: rgba(242, 184, 75, .14); color: var(--amber); }
table.weeks td { vertical-align: middle; white-space: nowrap; }
.adj-form .grow-text { flex: 1 1 260px; align-self: center; }
details.how { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
details.how summary { cursor: pointer; color: var(--teal); padding: 6px 0; }
details.how p { margin: 8px 0 0; }

/* ---------- Expenses ---------- */
.owes { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.owes li { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.owes li:last-child { border-bottom: 0; padding-bottom: 0; }
.owes li > span:first-child { flex: 1 1 220px; }
.owes .amount { font-size: 18px; font-weight: 600; color: var(--amber); }
.list-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.inline-filter { display: block; margin-bottom: 12px; }
.inline-filter select { width: auto; min-width: 200px; }
select:disabled { opacity: .5; }

/* ---------- Panels & split bars ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 16px; }
.venues { display: grid; gap: 16px; }
.venue-row h3 { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.venue-row h3 a { text-decoration: none; }
.venue-row h3 a:hover { color: var(--teal); }
.venue-row h3 .num { font-weight: 400; color: var(--muted); font-size: 14px; }
.bar { display: flex; height: 28px; border-radius: 2px; overflow: hidden; background: var(--panel-2); }
.bar > div { min-width: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.legend b { color: var(--text); font-weight: 500; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); background: var(--panel-2); }
th .muted { text-transform: none; letter-spacing: 0; font-size: 12px; }
tr:last-child td { border-bottom: 0; }
tr.total td { font-weight: 600; border-top: 1px solid var(--muted); }
td.owed { color: var(--teal); font-weight: 600; }

/* ---------- Forms ---------- */
form.card, .card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 16px; }
label { display: grid; gap: 6px; font-size: 11px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
label small { letter-spacing: 0; text-transform: none; font-size: 12px; color: var(--faint); }
input, select, textarea { font: inherit; font-size: 15px; letter-spacing: 0; text-transform: none; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--text); width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); outline: none; }
.actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
button.btn, a.btn {
  font: inherit; font-size: 13px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 11px 22px; border-radius: var(--radius); border: 1px solid var(--teal);
  background: var(--teal); color: #061214; cursor: pointer; text-decoration: none; display: inline-block;
}
button.btn:hover, a.btn:hover { filter: brightness(1.08); }
button.btn.ghost, a.btn.ghost { background: transparent; color: var(--teal); }
button.link { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; color: var(--teal); cursor: pointer; }
button.link.danger { color: var(--red); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
td a { color: var(--teal); text-decoration: none; }

.flag { display: inline-block; font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); font-variant-numeric: tabular-nums; }
.flag.warn { background: rgba(240, 113, 109, .14); color: var(--red); }
.flag.ok { background: rgba(95, 211, 141, .12); color: var(--green); }
.notice { border: 1px solid var(--line); border-left: 3px solid var(--teal); background: var(--panel); padding: 14px 18px; margin-bottom: 16px; border-radius: var(--radius); }
.notice.warn { border-left-color: var(--red); }
.notice a { color: var(--teal); }
.empty { padding: 32px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty a { color: var(--teal); }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--panel-2); color: var(--text); border: 1px solid var(--line); padding: 12px 20px; border-radius: var(--radius); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 40; }
#toast.show { opacity: 1; }

/* ---------- Statement (printed for venues, always light) ---------- */
.statement { max-width: 720px; background: #fff; color: #0a0b0c; padding: 40px; border-radius: var(--radius); }
.statement .muted { color: #5d666a; }
.statement .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 2px solid #0a0b0c; padding-bottom: 16px; margin-bottom: 24px; }
.statement .brand-line { font-weight: 500; letter-spacing: 0.24em; text-transform: uppercase; font-size: 16px; }
.statement table { font-size: 14px; }
.statement th, .statement td { border-color: #dfe4e6; }
.statement tr.total td { border-top-color: #0a0b0c; }
.statement .due { margin: 24px 0; padding: 18px 20px; border: 1px solid #0a0b0c; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.statement .due .amount { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }
.statement .lines { border: 1px solid #dfe4e6; border-radius: var(--radius); }

@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) {
  main { padding: 16px 14px 64px; }
  .stat-grid { gap: 12px; }
  .tile { padding: 16px; }
  .tile .value { font-size: 23px; }
  .statement { padding: 22px; }
}
@media print {
  .sidebar, .scrim, .topbar, .no-print, #toast { display: none !important; }
  html, body { background: #fff; }
  .shell { margin: 0 !important; }
  main { padding: 0; max-width: none; }
  .statement { padding: 0; }
}
@media (prefers-reduced-motion: reduce) { .sidebar, #toast { transition: none; } }
.two-col > section { min-width: 0; }
.rank li, .rank-row { min-width: 0; }
.shell { min-width: 0; overflow-x: clip; }
input:not([type="file"]):not([type="checkbox"]), select { height: 42px; }
.pay-actions select { height: 34px; }
.period select { height: auto; }
