/* Protocol Desk
   Layout: one narrow working column (max 760px) for phones first; detail opens as a bottom sheet on phones and a
   right-hand panel on desktop. Event colours (--accent, --accent-2) are set at runtime from the event settings. */

@font-face { font-family: "Poppins"; src: url("/fonts/Poppins-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/fonts/Poppins-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/fonts/Poppins-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }

:root {
  --font: "Poppins", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;

  --accent: #B4380F;           /* event main colour: buttons, links */
  --accent-2: #E9A62B;         /* event highlight: header details */
  --on-accent: #FFFFFF;
  --accent-ink: var(--accent); /* accent used as text */
  --accent-soft: color-mix(in oklab, var(--accent) 10%, var(--surface));

  --bg: #F3F1F2;
  --surface: #FFFFFF;
  --surface-2: #F8F6F7;
  --ink: #1F1922;
  --muted: #625A64;
  --border: #E2DCE1;
  --border-strong: #CFC7CD;
  --night: #221318;            /* event band behind the guest form header */
  --night-ink: #FBF3EA;

  --needs: #B42318;    --needs-bg: #FDECEA;
  --assigned: #1E4FC2; --assigned-bg: #E8EEFD;
  --onway: #8A5300;    --onway-bg: #FFF2D6;
  --picked: #0E6B63;   --picked-bg: #E1F4F1;
  --done: #3F6B35;     --done-bg: #ECF4E8;
  --own: #5A535D;      --own-bg: #EEECEF;
  --alert: #8A5300;    --alert-bg: #FFF6E2;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow-float: 0 12px 40px rgb(20 10 20 / .18), 0 2px 8px rgb(20 10 20 / .08);
  --focus: 0 0 0 3px color-mix(in oklab, var(--accent) 45%, transparent);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent-ink: color-mix(in oklab, var(--accent) 55%, white);
    --accent-soft: color-mix(in oklab, var(--accent) 22%, var(--surface));
    --bg: #141015; --surface: #1D181F; --surface-2: #231D25; --ink: #F1ECEF; --muted: #ABA2AD;
    --border: #342C36; --border-strong: #463C48; --night: #1A0E12;
    --needs: #FF9C8F;    --needs-bg: #3B1B1A;
    --assigned: #9DB8FF; --assigned-bg: #1C2540;
    --onway: #F2C266;    --onway-bg: #3A2C10;
    --picked: #7FD8CB;   --picked-bg: #12302D;
    --done: #A9D49C;     --done-bg: #1E2E1A;
    --own: #BEB6C0;      --own-bg: #2A252C;
    --alert: #F2C266;    --alert-bg: #33280F;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --accent-ink: color-mix(in oklab, var(--accent) 55%, white);
  --accent-soft: color-mix(in oklab, var(--accent) 22%, var(--surface));
  --bg: #141015; --surface: #1D181F; --surface-2: #231D25; --ink: #F1ECEF; --muted: #ABA2AD;
  --border: #342C36; --border-strong: #463C48; --night: #1A0E12;
  --needs: #FF9C8F;    --needs-bg: #3B1B1A;
  --assigned: #9DB8FF; --assigned-bg: #1C2540;
  --onway: #F2C266;    --onway-bg: #3A2C10;
  --picked: #7FD8CB;   --picked-bg: #12302D;
  --done: #A9D49C;     --done-bg: #1E2E1A;
  --own: #BEB6C0;      --own-bg: #2A252C;
  --alert: #F2C266;    --alert-bg: #33280F;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--accent-ink); }
h1, h2, h3 { text-wrap: balance; margin: 0; line-height: 1.25; }
h1 { font-size: 24px; font-weight: 600; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.label { font-size: 12px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
:focus-visible { outline: none; box-shadow: var(--focus); }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--radius-sm);
  font: 500 15px/1 var(--font); cursor: pointer; text-decoration: none; white-space: nowrap;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
  transition: background .15s ease-out, border-color .15s ease-out;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: color-mix(in oklab, var(--accent) 88%, black); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent-ink); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.danger { color: var(--needs); border-color: color-mix(in oklab, var(--needs) 45%, var(--border)); }
.btn.danger.solid { background: var(--needs); color: #fff; border-color: var(--needs); }
.btn.block { width: 100%; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn[disabled] { opacity: .55; cursor: default; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent; color: var(--ink); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); }

/* ---------- form fields ---------- */
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field > .field-label { font-size: 14px; font-weight: 500; }
.field .hint { font-size: 13px; color: var(--muted); }
.field .error { font-size: 13px; color: var(--needs); }
input[type="text"], input[type="tel"], input[type="email"], input[type="date"], input[type="time"],
input[type="number"], input[type="search"], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
  font: 400 16px/1.4 var(--font);
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--needs); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row2 > * { min-width: 0; }
@media (max-width: 380px) { .row2 { grid-template-columns: 1fr; } }

/* segmented choice (radio group) */
.seg { position: relative; display: flex; flex-wrap: wrap; gap: 8px; }
.seg input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.seg label {
  display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface);
  font-size: 14px; font-weight: 500; cursor: pointer; user-select: none;
}
.seg input:checked + label { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.seg input:focus-visible + label { box-shadow: var(--focus); }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.stepper button { width: 46px; height: 46px; border: 0; background: var(--surface-2); color: var(--ink); font: 500 20px/1 var(--font); cursor: pointer; }
.stepper output { min-width: 48px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- guest form ---------- */
.form-section { display: grid; gap: 16px; padding-block: 24px; border-top: 1px solid var(--border); }
.form-section:first-child { border-top: 0; padding-top: 8px; }
.form-section > h2 { font-size: 17px; }

/* ---------- toast ---------- */
.toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: grid; justify-items: center; pointer-events: none; z-index: 100; padding-inline: 16px; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px;
  max-width: 520px; padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--ink); color: var(--bg); font-size: 14px; box-shadow: var(--shadow-float);
}
.toast button { background: none; border: 0; color: inherit; font: 600 14px var(--font); text-decoration: underline; cursor: pointer; }

/* ---------- skeleton ---------- */
.skel { background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; border-radius: var(--radius-xs); animation: skel 1.4s ease-in-out infinite; }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } * { transition: none !important; } }

/* ---------- status pill ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 500; white-space: nowrap;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.needs { color: var(--needs); background: var(--needs-bg); }
.pill.assigned { color: var(--assigned); background: var(--assigned-bg); }
.pill.onway { color: var(--onway); background: var(--onway-bg); }
.pill.picked { color: var(--picked); background: var(--picked-bg); }
.pill.done { color: var(--done); background: var(--done-bg); }
.pill.own, .pill.cancelled, .pill.nodate { color: var(--own); background: var(--own-bg); }
.pill.cancelled::before { border-radius: 1px; height: 2px; }

.tag { display: inline-block; padding: 1px 8px; border-radius: var(--radius-xs); background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.tag.accent { color: var(--accent-ink); border-color: color-mix(in oklab, var(--accent) 30%, var(--border)); background: var(--accent-soft); }

.alert {
  display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: var(--radius-xs);
  background: var(--alert-bg); color: var(--alert); font-size: 13px; font-weight: 500;
}
.alert .icon { width: 16px; height: 16px; margin-top: 2px; }

/* ---------- sheet (dialog) ---------- */
dialog.sheet {
  border: 0; padding: 0; margin: 0; color: var(--ink); background: var(--surface);
  width: 100%; max-width: 100%; max-height: 100%; height: 100%;
}
dialog.sheet::backdrop { background: rgb(15 8 15 / .45); }
@media (max-width: 759px) {
  dialog.sheet { top: auto; bottom: 0; height: auto; max-height: calc(100% - 24px - env(safe-area-inset-top, 0px)); border-radius: 16px 16px 0 0; }
}
@media (min-width: 760px) {
  dialog.sheet { left: auto; right: 0; width: 500px; border-left: 1px solid var(--border); box-shadow: var(--shadow-float); }
}
.sheet-inner { display: flex; flex-direction: column; height: 100%; max-height: inherit; }
.sheet-head {
  display: flex; align-items: flex-start; gap: 12px; padding: 16px 16px 12px 20px;
  border-bottom: 1px solid var(--border); background: var(--surface);
}
.sheet-head > div { flex: 1; min-width: 0; }
.sheet-body { overflow-y: auto; padding: 4px 20px 24px; flex: 1; overscroll-behavior: contain; }
.sheet-foot { padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--border); display: flex; gap: 10px; flex-wrap: wrap; background: var(--surface); }
.sheet-foot .btn { flex: 1; }
body:has(.sticky-send) .toast-wrap, body:has(.fab) .toast-wrap { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }

/* Sheets: the dialog is a column so the middle part scrolls and the buttons stay visible (fixes Add guest not scrolling). */
dialog.sheet[open] { display: flex; flex-direction: column; overflow: hidden; }
.sheet-inner { flex: 1 1 auto; min-height: 0; height: auto; max-height: none; display: flex; flex-direction: column; }
.sheet-head, .sheet-foot { flex: none; }
.sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* Desk logo colours (light and dark) */
:root { --logo-tile: #2C2C2A; --logo-line: #B4B2A9; --logo-person: #FFFFFF; --logo-core: #EF9F27; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --logo-tile: #F1EFE8; --logo-line: #888780; --logo-person: #2C2C2A; --logo-core: #BA7517; } }
:root[data-theme="dark"] { --logo-tile: #F1EFE8; --logo-line: #888780; --logo-person: #2C2C2A; --logo-core: #BA7517; }
.logo { flex: none; }
.logo-tile { fill: var(--logo-tile); }
.logo-line { stroke: var(--logo-line); }
.logo-person { fill: var(--logo-person); }
.logo-core { fill: var(--logo-core); }
