/* Fair Tips. Warm paper, bottle green and brass: the colours of a well-run bar, not a dashboard. */
:root {
  --paper: #f6f1e6;
  --card: #fffdf7;
  --ink: #1d231f;
  --muted: #5d655e;
  --line: #e1d8c6;
  --line-strong: #c9bda5;
  --green: #1f4d3a;
  --green-hover: #173b2c;
  --on-green: #fbf8f0;
  --brass: #9a6a22;
  --brass-soft: #f2e4c8;
  --danger: #9e3626;
  --danger-soft: #f8e1da;
  --ok: #2c6a45;
  --ok-soft: #dcefe2;
  --focus: #c8902e;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121815; --card: #1a221e; --ink: #ece6d8; --muted: #a2a99e; --line: #2b3530; --line-strong: #3d4943;
    --green: #2f6b51; --green-hover: #3a7d60; --on-green: #f6f2e8; --brass: #d8a754; --brass-soft: #3a2f1c;
    --danger: #e08a76; --danger-soft: #3b211b; --ok: #8fcfa6; --ok-soft: #1d3326; --focus: #d8a754; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #121815; --card: #1a221e; --ink: #ece6d8; --muted: #a2a99e; --line: #2b3530; --line-strong: #3d4943;
  --green: #2f6b51; --green-hover: #3a7d60; --on-green: #f6f2e8; --brass: #d8a754; --brass-soft: #3a2f1c;
  --danger: #e08a76; --danger-soft: #3b211b; --ok: #8fcfa6; --ok-soft: #1d3326; --focus: #d8a754; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 var(--sans); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0; letter-spacing: -0.005em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0; }
a { color: var(--green); }
.num, td.num, .money { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Layout */
.top { position: sticky; top: 0; z-index: 5; background: var(--paper); border-bottom: 1px solid var(--line); }
.top-inner { max-width: 980px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand svg { flex: none; }
.brand b { font-family: var(--serif); font-size: 1.2rem; }
.venue-name { color: var(--muted); font-size: .9rem; border-left: 1px solid var(--line-strong); padding-left: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { margin-left: auto; display: flex; gap: 4px; }
.nav button { font: inherit; font-size: .95rem; border: 0; background: none; color: var(--muted); padding: 8px 12px; border-radius: 8px; cursor: pointer; }
.nav button[aria-current="page"] { color: var(--ink); background: var(--brass-soft); font-weight: 600; }
.nav button:hover { color: var(--ink); }
main { max-width: 980px; margin: 0 auto; padding: 24px 16px 96px; }
@media (max-width: 720px) {
  .nav { position: fixed; bottom: 0; left: 0; right: 0; margin: 0; background: var(--card); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; z-index: 6; }
  .nav button { flex: 1; padding: 10px 4px; font-size: .9rem; }
  .venue-name { display: none; }
  h1 { font-size: 1.45rem; }
}

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 20px; }
.page-head p { color: var(--muted); margin-top: 4px; }
.stack > * + * { margin-top: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card > h2 + *, .card > h3 + * { margin-top: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.card-head .hint { color: var(--muted); font-size: .9rem; }
.grid-2 { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .grid-2 { grid-template-columns: 1.1fr .9fr; align-items: start; } }

/* Controls */
label { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line-strong); border-radius: 8px; padding: 10px 12px; width: 100%; min-height: 44px; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 30%, transparent); }
input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--green); }
.field + .field { margin-top: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.row > .grow { flex: 1 1 140px; }
.btn { font: inherit; font-weight: 600; border-radius: 999px; padding: 10px 18px; min-height: 44px; cursor: pointer; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--green); border-color: var(--green); color: var(--on-green); }
.btn.primary:hover { background: var(--green-hover); }
.btn.quiet { border-color: transparent; background: none; color: var(--muted); padding-inline: 10px; }
.btn.quiet:hover { color: var(--ink); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }

.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { font: inherit; font-size: .9rem; border: 0; border-radius: 999px; padding: 7px 12px; background: none; color: var(--muted); cursor: pointer; min-height: 36px; }
.seg button[aria-pressed="true"] { background: var(--green); color: var(--on-green); }

/* Tables */
.table-wrap { overflow-x: auto; margin-inline: -4px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: none; }
tfoot td { border-bottom: 0; border-top: 2px solid var(--ink); font-weight: 700; }
td .sub { display: block; color: var(--muted); font-size: .82rem; }
td input { min-height: 40px; padding: 8px 10px; }
.hours-input { width: 6.5em; text-align: right; font-variant-numeric: tabular-nums; }

/* Status */
.pill { display: inline-block; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--brass-soft); color: var(--brass); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.note { border-left: 3px solid var(--brass); background: var(--brass-soft); padding: 12px 14px; border-radius: 0 8px 8px 0; font-size: .95rem; }
.note.bad { border-color: var(--danger); background: var(--danger-soft); }
.note ul { margin: 6px 0 0; padding-left: 18px; }
.empty { color: var(--muted); padding: 12px 0; }
.big-total { font-family: var(--serif); font-size: 2.2rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.totals { display: flex; flex-wrap: wrap; gap: 8px 20px; color: var(--muted); font-size: .9rem; margin-top: 6px; }
.totals b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* Share bars */
.bar { height: 6px; background: var(--line); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brass); border-radius: 3px; }

/* Period switcher */
.switcher { display: flex; align-items: center; gap: 6px; }
.switcher .label { font-family: var(--serif); font-size: 1.05rem; min-width: 12ch; text-align: center; }

/* Welcome */
.welcome { max-width: 560px; margin: 8vh auto 0; text-align: center; }
.welcome h1 { font-size: 2rem; margin-top: 18px; }
.welcome p { color: var(--muted); margin-top: 10px; }
.welcome .btns { justify-content: center; margin-top: 24px; }
.welcome form { text-align: left; margin-top: 28px; }

.policy { font-family: var(--serif); font-size: 1rem; line-height: 1.6; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 18px; max-height: 60vh; overflow: auto; }
.policy h2 { font-size: 1.25rem; }
.policy h3 { font-size: 1rem; margin-top: 16px; }
.policy p, .policy ul { margin: 6px 0 0; }
.policy ul { padding-left: 20px; }
.sheet h3 { margin-top: 12pt; }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 999px; font-size: .92rem; z-index: 20; }

/* Print: only the print sheet */
#print { display: none; }
@media print {
  body { background: #fff; color: #000; }
  .top, main, .nav, .toast { display: none !important; }
  #print { display: block; }
  .sheet { page-break-after: always; break-after: page; font: 11pt/1.5 var(--serif); padding: 8mm 4mm; }
  .sheet:last-child { page-break-after: auto; break-after: auto; }
  .sheet h1 { font-size: 18pt; }
  .sheet .meta { color: #444; margin: 4pt 0 14pt; }
  .sheet table { margin-top: 10pt; }
  .sheet th, .sheet td { border-bottom: 1px solid #bbb; padding: 5pt 4pt; }
  .sheet .figure { font-size: 22pt; margin: 8pt 0; }
  .sheet .small { font-size: 9pt; color: #444; margin-top: 16pt; }
  .sheet pre { white-space: pre-wrap; font: inherit; }
}
