/* HSBC look: charcoal header, red only as a fill with white text on it */
:root {
  --red: #db0011;
  --dark: #333333;
  --ink: #1d1d1f;
  --mute: #5f5f66;
  --line: #d9d9de;
  --bg: #f3f3f5;
  --panel: #ffffff;
  --green: #1a7f4b;
  --amber: #f2b53a;
  --hex: #333333;
  --hotseat: #5d0c2a;
  --psh: #305a85;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px;
  -webkit-tap-highlight-color: transparent; padding-bottom: env(safe-area-inset-bottom);
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
a { color: inherit; }

/* header */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--dark); color: #fff; padding: calc(8px + env(safe-area-inset-top)) 16px 8px; }
.logo { height: 28px; }
.top h1 { font-size: 18px; margin: 0; flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.status { display: flex; flex-direction: column; align-items: flex-end; padding: 4px 10px; border-radius: 8px; line-height: 1.15; }
.status b { font-size: 14px; }
.status small { font-size: 11px; opacity: 0.85; }
.status.live b::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #3ccf7f; margin-right: 6px; vertical-align: 1px; }
.status.busy { background: rgba(255, 255, 255, 0.12); }
.status.warn { background: var(--amber); color: #1d1d1f; }
.who-btn { background: rgba(255, 255, 255, 0.12); border: 0; border-radius: 8px; padding: 8px 12px; color: #fff; font-size: 14px; font-weight: 600; }
@media (max-width: 560px) {
  .top h1 { display: none; }
  .status { margin-left: auto; }
}

main { max-width: 1100px; margin: 0 auto; padding: 12px 16px 80px; }

/* banners */
.banner { display: block; width: 100%; text-align: left; margin: 8px 0; padding: 12px 14px; border-radius: 10px; border: 0; font-weight: 600; text-decoration: none; }
.banner.bad { background: var(--red); color: #fff; }
#banners { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
#banners:empty { display: none; }
.link { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; font-weight: 700; }

/* toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.seg { display: inline-flex; background: #e4e4e8; border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 9px 14px; border-radius: 8px; font-weight: 600; font-size: 15px; color: var(--mute); }
.seg button[aria-selected="true"], .seg button[aria-pressed="true"] { background: var(--dark); color: #fff; }
.seg.small button { padding: 8px 11px; font-size: 14px; }
#search { flex: 1 1 200px; min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; font-size: 16px; }

/* cards */
.cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 480px), 1fr)); }
.card { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; background: var(--panel); border-radius: 14px; padding: 14px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06); cursor: pointer; }
.card.done { opacity: 0.55; }
.card.now { box-shadow: 0 0 0 2px var(--dark); }
.time { display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
.time b { font-size: 20px; }
.time span { font-size: 13px; color: var(--mute); }
.on { font-style: normal; font-size: 11px; font-weight: 700; background: var(--dark); color: #fff; border-radius: 4px; padding: 2px 5px; margin-top: 4px; text-align: center; }
.info { min-width: 0; }
.info h3 { margin: 2px 0; font-size: 17px; }
.where { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: #fff; border-radius: 4px; padding: 2px 6px; }
.sp-hex { background: var(--hex); }
.sp-hotseat { background: var(--hotseat); }
.sp-psh { background: var(--psh); }
.who { margin: 2px 0 6px; color: var(--mute); font-size: 13px; }
.ops { margin: 4px 0 8px; font-size: 13px; color: var(--mute); background: #f0f0f3; border-radius: 8px; padding: 8px 10px; }
.meter { height: 8px; background: #e7e7ea; border-radius: 4px; overflow: hidden; margin: 6px 0; }
.meter i { display: block; height: 100%; background: var(--green); }
.meter.nearly i { background: var(--amber); }
.meter.full i, .meter.over i { background: var(--red); }
.nums { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 13px; color: var(--mute); }
.nums b { color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; }
.nums.big { font-size: 15px; margin-bottom: 12px; }
.nums.big b { font-size: 20px; }
.chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: #e1f2e8; color: #0d5132; }
.chip.nearly { background: var(--amber); color: #1d1d1f; }
.chip.full, .chip.over { background: var(--red); color: #fff; }
.chip.off { background: #e4e4e8; color: var(--mute); }
.chip.in { background: var(--green); color: #fff; }
.add { white-space: nowrap; }
@media (max-width: 480px) {
  .card { grid-template-columns: 52px 1fr; }
  .card .add { grid-column: 1 / -1; width: 100%; }
}

/* buttons */
.btn { border: 1px solid transparent; border-radius: 10px; padding: 11px 16px; font-size: 15px; font-weight: 600; background: #e4e4e8; color: var(--ink); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn.primary { background: var(--red); color: #fff; }
.btn.bad { background: var(--dark); color: #fff; }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.wide { width: 100%; padding: 14px; font-size: 17px; }

/* session page */
.crumb { margin-bottom: 8px; }
.s-head { background: var(--panel); border-radius: 14px; padding: 16px; margin-bottom: 12px; }
.s-head h2 { margin: 6px 0 2px; font-size: 22px; }
h4 { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--mute); }
.guests { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.guest { display: flex; gap: 10px; align-items: center; background: var(--panel); border-radius: 12px; padding: 12px 14px; }
.guest.is-in { background: #e9f6ee; }
.guest.is-over { box-shadow: inset 4px 0 0 var(--red); }
.g-main { flex: 1; min-width: 0; }
.g-main > b { font-size: 17px; }
.party { font-weight: 700; margin-left: 6px; background: var(--dark); color: #fff; border-radius: 4px; padding: 1px 6px; font-size: 13px; }
.g-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; color: var(--mute); margin-top: 3px; }
.g-note { font-size: 13px; margin-top: 3px; }
.tag { background: #ececf0; color: var(--ink); border-radius: 4px; padding: 1px 6px; }
.flag { display: inline-block; margin-left: 8px; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 4px; background: #e4e4e8; vertical-align: 2px; }
.flag.over { background: var(--red); color: #fff; }
.flag.pending { background: var(--amber); color: #1d1d1f; }
.g-act { display: flex; gap: 6px; flex: none; }
.arrive { min-width: 104px; }
.arrive.on { background: var(--green); color: #fff; }
details { margin-top: 16px; }
summary { cursor: pointer; color: var(--mute); font-weight: 600; padding: 6px 0; }
.empty { color: var(--mute); padding: 16px 4px; }
@media (max-width: 480px) {
  .guest { flex-wrap: wrap; }
  .g-act { width: 100%; }
  .g-act .arrive { flex: 1; }
}

/* search */
.results { display: grid; gap: 8px; }
.result { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; text-align: left; background: var(--panel); border: 0; border-radius: 12px; padding: 12px 14px; }
.result b { flex: 1 1 100%; font-size: 16px; }
.result span { font-size: 13px; color: var(--mute); }
.result .chip { color: inherit; }

/* bottom sheet form */
.sheet-wrap { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet-wrap[hidden] { display: none; }
.sheet { background: var(--panel); width: min(640px, 100%); max-height: 92dvh; overflow: auto; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); display: grid; gap: 8px; }
@media (min-width: 700px) { .sheet-wrap { align-items: center; } .sheet { border-radius: 18px; } }
.sheet h2 { margin: 0 0 4px; font-size: 21px; }
.sheet label { display: grid; gap: 4px; font-size: 13px; font-weight: 700; color: var(--mute); margin-top: 4px; }
.sheet input, .sheet select { font-size: 17px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font-weight: 400; width: 100%; }
.stepper { display: flex; align-items: center; gap: 14px; }
.stepper .btn { width: 52px; height: 48px; font-size: 24px; padding: 0; }
.stepper output { font-size: 26px; font-weight: 700; min-width: 32px; text-align: center; font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pick { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 12px; font-size: 14px; font-weight: 600; }
.pick[aria-pressed="true"] { background: var(--dark); color: #fff; border-color: var(--dark); }
.warn-box { background: #fff4dc; border-left: 5px solid var(--amber); padding: 10px 12px; border-radius: 8px; margin: 4px 0; font-size: 14px; }
.hint { color: var(--mute); font-size: 13px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; margin-top: 6px; }
.more { display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 8px; }

/* admin */
.panel { background: var(--panel); border-radius: 14px; padding: 16px; margin-bottom: 12px; }
.panel h2 { margin: 0 0 6px; }
.panel h3 { margin: 18px 0 6px; font-size: 15px; }
.panel input { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 16px; }
.panel.danger { border: 2px solid var(--dark); }
.sform { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px 8px; align-items: end; padding: 10px 0; border-bottom: 1px solid var(--line); }
.sform label { display: grid; gap: 2px; font-size: 11px; font-weight: 700; color: var(--mute); text-transform: uppercase; }
.sform input, .sform select { width: 100%; padding: 8px; font-size: 15px; border: 1px solid var(--line); border-radius: 8px; background: #fff; text-transform: none; }
.sform label:first-child { grid-column: span 3; }
.sform .wide { grid-column: span 3; }
.sform .full { grid-column: 1 / -1; }
.sform .tick { display: flex; align-items: center; gap: 6px; text-transform: none; font-size: 14px; }
.sform .tick input { width: auto; }
.err { color: var(--ink); font-weight: 700; font-size: 13px; }
.err:not(:empty)::before { content: "⚠ "; }
@media (max-width: 640px) { .sform { grid-template-columns: repeat(2, minmax(0, 1fr)); } .sform label:first-child, .sform .wide { grid-column: 1 / -1; } }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--dark); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; z-index: 30; max-width: calc(100% - 32px); }
.toast[hidden] { display: none; }

/* admin tabs and totals */
.row.between { justify-content: space-between; margin-bottom: 12px; }
.full-row { flex-basis: 100%; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 8px 0 4px; }
.tiles.small { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.tile { background: #f0f0f3; border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; }
.tile b { font-size: 26px; font-variant-numeric: tabular-nums; }
.tile b small { font-size: 15px; color: var(--mute); font-weight: 600; }
.tile span { font-size: 13px; font-weight: 700; }
.tile > small { font-size: 12px; color: var(--mute); }
.scroll { overflow-x: auto; }
table.totals { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 620px; }
.totals th { text-align: left; background: var(--dark); color: #fff; padding: 8px; font-size: 12px; }
.totals td { padding: 8px; border-bottom: 1px solid var(--line); }
.totals tbody tr { cursor: pointer; }
.totals tbody tr:hover { background: #f6f6f8; }
.totals tr.is-over td:first-child { box-shadow: inset 4px 0 0 var(--red); }
.totals .n { text-align: right; font-variant-numeric: tabular-nums; }
.totals tfoot td { font-weight: 700; border-top: 2px solid var(--dark); }
.sform fieldset.types { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; }
.sform fieldset.types legend { font-size: 11px; font-weight: 700; color: var(--mute); text-transform: uppercase; padding: 0 4px; }
