/* toitoi — plain CSS, no build step. Colours are Milûk's house palette. */

:root {
  --blue: #303d8e;
  --blue-dark: #252f70;
  --orange: #f49d3d;
  --yellow: #fffbdb;
  --teal: #38a3a5;
  --mint: #c0ede6;

  --bg: #fffdf0;
  --card: #ffffff;
  --text: #1f2440;
  --muted: #5d6280;
  --line: #e3e0c8;
  --danger: #b3261e;
  --ok-bg: #e2f6f2;
  --ok-line: var(--teal);
  --bad-bg: #fdeceb;

  --radius: 10px;
  --tap: 48px; /* minimum size of anything you tap */
}

* { box-sizing: border-box; }

html {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--blue); }
[hidden] { display: none !important; }

/* ------------------------------------------------------------ header */

.top {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.5rem max(1rem, env(safe-area-inset-right)) 0.5rem max(1rem, env(safe-area-inset-left));
  padding-top: max(0.5rem, env(safe-area-inset-top));
  background: var(--blue);
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
  font-weight: 700;
  font-size: 1.25rem;
  text-decoration: none;
  letter-spacing: 0.02em;
}
.brand img { border-radius: 50%; background: var(--yellow); }

.top nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  margin-left: auto;
}
.top nav a, .top nav button.link {
  color: #fff;
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font: inherit;
  min-height: 0;
}
.top nav a:hover, .top nav button.link:hover { background: var(--blue-dark); }
.top nav form { margin: 0; }
.top .who { margin-left: auto; opacity: 0.9; }

/* -------------------------------------------------------------- main */

main {
  max-width: 62rem;
  margin: 0 auto;
  padding: 1rem max(1rem, env(safe-area-inset-right)) 3rem max(1rem, env(safe-area-inset-left));
}
.narrow { max-width: 32rem; margin: 0 auto; }

h1 { font-size: 1.6rem; margin: 0.75rem 0; color: var(--blue); }
h2 { font-size: 1.15rem; margin: 0 0 0.5rem; color: var(--blue); }

.bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.crumb { margin: 0.25rem 0 0; }
.crumb a { text-decoration: none; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 1rem 0;
}

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.nowrap { white-space: nowrap; }
.warn { color: #9a5b00; font-weight: 600; }

.tag {
  display: inline-block;
  padding: 0 0.5rem;
  border-radius: 999px;
  background: var(--mint);
  color: #17494a;
  font-size: 0.8rem;
  white-space: nowrap;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border-left: 5px solid;
  margin: 1rem 0;
}
.flash.ok { background: var(--ok-bg); border-color: var(--ok-line); }
.flash.fout { background: var(--bad-bg); border-color: var(--danger); }

/* ------------------------------------------------------------- forms */

.stack { display: flex; flex-direction: column; gap: 0.4rem; }
.stack > label { font-weight: 600; margin-top: 0.5rem; }
.stack > label .muted { font-weight: 400; }
.stack > button { align-self: flex-start; margin-top: 0.75rem; }

input:not([type="checkbox"]), textarea {
  font: inherit;
  color: inherit;
  width: 100%;
  min-height: var(--tap);
  padding: 0.5rem 0.75rem;
  border: 1px solid #b9b697;
  border-radius: var(--radius);
  background: #fff;
}
textarea { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.9rem; }
input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

fieldset { border: 1px solid var(--line); border-radius: var(--radius); margin: 0.75rem 0 0; padding: 0.5rem 0.75rem; }
legend { font-weight: 600; padding: 0 0.25rem; }

label.check {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-weight: 400;
  padding: 0.4rem 0;
}
label.check input { width: 1.2rem; height: 1.2rem; flex: none; accent-color: var(--blue); transform: translateY(0.15rem); }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0.5rem 1.25rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--blue);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
button:hover, .button:hover { background: var(--blue-dark); }
button.danger { background: var(--danger); }
button.small { min-height: 2.25rem; padding: 0.25rem 0.75rem; font-size: 0.9rem; }
button.link { background: none; font-weight: 400; cursor: pointer; }

details { margin-top: 0.75rem; }
summary { cursor: pointer; color: var(--blue); padding: 0.5rem 0; }

/* ------------------------------------------------------------ tables */

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
th, td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.85rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr.inactive td { color: var(--muted); }
td form { margin: 0; }

/* -------------------------------------------------------- enrollment */

.steps { padding-left: 1.25rem; }
.steps li { margin: 0.4rem 0; }

input.code {
  font-size: 2rem;
  letter-spacing: 0.15em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.enroll { text-align: center; max-width: 32rem; margin: 0 auto; }
.bigcode {
  font-size: clamp(2.5rem, 10vw, 4.5rem);
  font-weight: 700;
  letter-spacing: 0.1em;
  font-variant-numeric: tabular-nums;
  color: var(--blue);
  margin: 0.5rem 0;
}
.qr svg { width: min(18rem, 80vw); height: auto; border-radius: var(--radius); }

/* ------------------------------------------------------------ roster */

h2.day {
  margin: 1.5rem 0 0;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
h2.day::first-letter { text-transform: uppercase; }

.activity { margin-top: 0.6rem; }
.activity header { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.activity .times { font-variant-numeric: tabular-nums; font-weight: 600; }
.activity .title { margin: 0.4rem 0 0; font-weight: 600; }
.activity p.small { margin: 0.1rem 0 0; }

.tag.kind { background: var(--blue); color: #fff; }
.tag.open { background: var(--orange); color: #3a2400; }
.tag.who { background: var(--ok-bg); color: #17494a; border: 1px solid var(--teal); }

ul.shifts, ul.plain { list-style: none; margin: 0.75rem 0 0; padding: 0; }
ul.plain li { padding: 0.3rem 0; }
ul.shifts li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  margin-top: 0.4rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
ul.shifts li.mine { border-color: var(--teal); background: var(--ok-bg); }
ul.shifts .what { flex: 1; min-width: 0; }
ul.shifts form { margin: 0; flex: none; }

button.quiet { background: #fff; color: var(--blue); border: 1px solid var(--blue); }
button.quiet:hover { background: var(--mint); }

.bad { color: var(--danger); font-weight: 600; }
.url { word-break: break-all; }
td.actions { white-space: nowrap; }
td.actions form { display: inline-block; }
td.actions details { white-space: normal; max-width: 18rem; }

form.row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
form.row input { flex: 1 1 12rem; }
code { background: var(--yellow); padding: 0 0.25rem; border-radius: 4px; }

/* ---------------------------------------------------------- building */

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 0.6rem; margin-top: 0.6rem; }
.device { margin: 0; display: flex; flex-direction: column; gap: 0.5rem; border-left: 6px solid var(--line); }
.device.on { border-left-color: var(--orange); }
.device.busy { border-left-color: var(--teal); }
.device.alert { border-left-color: var(--danger); background: var(--bad-bg); }
.device.gone { opacity: 0.65; }
.device .head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.device .state { color: var(--muted); white-space: nowrap; }
.device.on .state { color: #9a5b00; font-weight: 600; }
.device.alert .state { color: var(--danger); font-weight: 700; }
.device form { margin: 0; display: flex; gap: 0.5rem; }
.device form button { flex: 1; }
.device form input[type="password"] { flex: 0 1 7rem; }
.device input[type="range"] { width: 100%; min-height: var(--tap); padding: 0; border: 0; background: none; accent-color: var(--orange); }

/* ----------------------------------------------------- notifications */

table.choices th:not(:first-child), table.choices td:not(:first-child) { text-align: center; width: 4.5rem; padding-left: 0.25rem; padding-right: 0.25rem; }
table.choices td { vertical-align: middle; }
table.choices input { width: 1.5rem; height: 1.5rem; accent-color: var(--blue); }
table.choices + button, .scroll + button { margin-top: 0.75rem; }

/* ---- Programme, orders and tickets ---- */
ul.programme { list-style: none; margin: 0 0 1rem; padding: 0; }
ul.programme li { display: flex; gap: 0.75rem; align-items: center; padding: 0.6rem 0; border-bottom: 1px solid var(--line, #ddd); }
ul.programme .times { font-variant-numeric: tabular-nums; min-width: 3.2rem; font-weight: 600; }
ul.programme .what { flex: 1; }
.prose { white-space: pre-line; }
input.quantity { max-width: 6rem; font-size: 1.2rem; text-align: center; }
table.lines { width: 100%; }
td.amount, th.amount { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 700; border-top: 2px solid currentColor; }
.tag.bad { background: #b3261e; color: #fff; }
.tickets { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); margin: 1rem 0; }
.ticket { display: flex; gap: 1rem; align-items: center; background: #fff; color: #111; border: 2px dashed #888; border-radius: 0.6rem; padding: 0.75rem; break-inside: avoid; }
.ticket .qr svg { width: 9rem; height: 9rem; display: block; }
.ticket.used, .ticket.void { opacity: 0.55; }
.ticketcode { font-family: ui-monospace, monospace; font-size: 1.05rem; letter-spacing: 0.04em; margin-top: 0.3rem; white-space: nowrap; }
@media (max-width: 30rem) { .ticket .qr svg { width: 7rem; height: 7rem; } .ticket { gap: 0.6rem; } }

/* ---- The till ---- */
.tillshows { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); }
a.tillshow { display: flex; flex-direction: column; gap: 0.25rem; padding: 1rem; border-radius: 0.6rem; border: 2px solid var(--line, #ccc); text-decoration: none; color: inherit; background: var(--card, #fff); }
a.tillshow.today { border-color: #303d8e; }
a.tillshow.off { opacity: 0.55; }
a.tillshow strong { font-size: 1.2rem; }
form.sale { max-width: 34rem; }
.tillrow { display: grid; grid-template-columns: 1fr 3.6rem 5rem 3.6rem; gap: 0.5rem; align-items: center; padding: 0.5rem 0; border-bottom: 1px solid var(--line, #ddd); }
.tillrow label { font-size: 1.15rem; font-weight: 600; }
.tillrow label .muted { display: block; font-weight: 400; }
.tillrow input.quantity { width: 100%; max-width: none; font-size: 1.5rem; padding: 0.4rem 0.2rem; }
button.step { font-size: 1.8rem; line-height: 1; padding: 0.5rem 0; min-height: 3.4rem; }
.tilltotal { font-size: 1.6rem; display: flex; justify-content: space-between; margin: 1rem 0; }
.paybuttons { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.paybuttons button { font-size: 1.4rem; min-height: 4.2rem; }
.scanresult { padding: 1.2rem; border-radius: 0.6rem; margin: 0 0 1rem; color: #fff; font-size: 1.1rem; }
.scanresult strong { display: block; font-size: 2rem; }
.scanresult.ok { background: #1b7f3b; }
.scanresult.used, .scanresult.void, .scanresult.unknown { background: #b3261e; }
.scanresult.other { background: #a05a00; }
.scanresult form { margin-top: 0.75rem; }
.scanresult button { background: #fff; color: #111; }

@media print {
  header.top, .noprint, .crumb, .flash { display: none !important; }
  body { background: #fff; }
  .tickets { grid-template-columns: 1fr 1fr; }
}

/* ---- The bar ---- */
select { font: inherit; padding: 0.55rem 0.6rem; border: 1px solid var(--line); border-radius: 0.5rem; background: var(--card); color: var(--text); max-width: 100%; }
form.sale.wide { max-width: 72rem; }
.drinks { display: grid; grid-template-columns: repeat(auto-fill, minmax(21rem, 1fr)); column-gap: 2rem; }
form.period { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0 0 1rem; }
form.period input[type="date"] { width: auto; }

/* ---- Voucher and reservations at the till ---- */
.bon { display: grid; grid-template-columns: 1fr 8rem; gap: 0.5rem; align-items: center; margin: 0 0 1rem; }
.bon input { text-align: right; }
td.actions form.row { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
td.actions form.row input { width: 8.5rem; }

/* Posters: on a show's page, small with a title in the admin, tiny in the programme. */
img.poster { display: block; max-width: 100%; width: 16rem; height: auto; border-radius: var(--radius); margin: 0 0 1rem; }
img.poster.small { width: 6rem; float: right; margin: 0 0 0.5rem 0.75rem; }
img.poster.thumb { width: 2.6rem; margin: 0; border-radius: 3px; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.15rem 0.75rem; margin: 0 0 1rem; font-size: 0.95rem; }
dl.facts dt { color: var(--muted, #666); }
dl.facts dd { margin: 0; }
