/* ==========================================================================
   Deleta After School Skate — Permission Slips

   All brand tokens live in :root below. Change a value there and every page
   follows. If you adjust a colour, keep the paired -deep / -tint versions in
   step: the bright one is for fills, the deep one is the version that stays
   readable as text on the tint.
   ========================================================================== */

:root {
  /* --- Retro roller-rink palette: purple, light blue, light red, pink ---
     Shades are tuned so every text/background pair clears WCAG AA (4.5:1).
     The bright versions (--blue, --coral, --accent) are for fills and the
     stripe; the -deep versions are the readable text equivalents. */

  --brand:        #5b2a86;   /* purple — headers, links, primary chrome */
  --brand-dark:   #3b1a5c;
  --brand-light:  #f2eafb;
  --brand-tint:   #e5d8f5;

  --accent:       #d6336c;   /* pink — buttons and calls to action */
  --accent-dark:  #b82a5c;
  --accent-tint:  #ffe8f0;

  --blue:         #6fc9e4;   /* light blue — info fills, stripe */
  --blue-deep:    #14657f;
  --blue-tint:    #e2f5fb;

  --coral:        #f0564b;   /* light red — pickup flags, stripe */
  --coral-deep:   #a82c24;
  --coral-tint:   #ffebe8;

  --ink:          #221a2e;
  --muted:        #5e5873;
  --placeholder:  #6b6482;
  --line:         #e7dff0;
  --bg:           #fbf7fb;
  --card:         #ffffff;

  --ok:           #0f7a56;
  --ok-bg:        #e3f6ee;
  --warn:         #8a5200;
  --warn-bg:      #fff1d6;
  --err:          #b3261e;
  --err-bg:       #fdeae8;

  --radius:       14px;
  --shadow:       0 1px 2px rgba(34,26,46,.06), 0 8px 24px rgba(34,26,46,.09);
  --font:         system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

::placeholder { color: var(--placeholder); opacity: 1; }

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Layout ---------- */

.wrap { max-width: 720px; margin: 0 auto; padding: 0 20px 72px; }
.wrap-wide { max-width: 1140px; }

.masthead {
  background: var(--brand);
  background-image: linear-gradient(135deg, #6d33a0 0%, var(--brand-dark) 100%);
  color: #fff;
  padding: 22px 20px;
  position: relative;
}

/* Retro four-colour stripe under the header — purple, blue, red, pink. */
.masthead::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; height: 5px;
  background: linear-gradient(90deg,
    var(--brand)  0%,   var(--brand) 25%,
    var(--blue)  25%,   var(--blue)  50%,
    var(--coral) 50%,   var(--coral) 75%,
    var(--accent) 75%,  var(--accent) 100%);
}
.masthead-inner {
  max-width: 720px; margin: 0 auto;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.masthead-inner.wide { max-width: 1140px; }
.logo {
  font-weight: 800; font-size: 21px; letter-spacing: -.02em;
  color: #fff; text-decoration: none; display: flex; align-items: center; gap: 10px;
}
.logo-mark {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 18px; flex: none;
}
.masthead .sub { margin-left: auto; font-size: 14px; opacity: .85; }
.masthead a.sub:hover { opacity: 1; }
.masthead .sub a { color: #fff; }

.hero { padding: 40px 0 8px; }
.hero h1 { font-size: 33px; line-height: 1.15; letter-spacing: -.025em; margin: 0 0 12px; }
.hero p { font-size: 19px; color: var(--muted); margin: 0; }

/* ---------- Cards ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
  margin: 22px 0;
}
.card h2 { font-size: 21px; margin: 0 0 4px; letter-spacing: -.015em; }
.card h2 + .hint { margin-top: 0; }
.card-tight { padding: 18px 20px; }

.hint { color: var(--muted); font-size: 15px; margin: 6px 0 18px; }

/* ---------- Forms ---------- */

.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }

label.lab {
  display: block; font-weight: 650; font-size: 15px;
  margin-bottom: 6px; letter-spacing: -.005em;
}
label.lab .req { color: var(--err); font-weight: 400; }
label.lab .opt { color: var(--muted); font-weight: 400; }

input[type=text], input[type=email], input[type=tel], input[type=password],
input[type=date], input[type=time], select, textarea {
  width: 100%;
  padding: 12px 13px;
  font: inherit;
  font-size: 16px; /* 16px prevents iOS zoom-on-focus */
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}
input[aria-invalid=true], select[aria-invalid=true] { border-color: var(--err); }
select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'><path d='M1 1l6 6 6-6' stroke='%235e5873' stroke-width='2' fill='none' stroke-linecap='round'/></svg>"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }

.row { display: flex; gap: 14px; }
.row > * { flex: 1; min-width: 0; }
@media (max-width: 560px) { .row { flex-direction: column; gap: 18px; } }

.err-msg { color: var(--err); font-size: 14px; margin-top: 6px; display: none; }
.err-msg.show { display: block; }

/* Radio cards — used for the bus / pick-up choice */
.choice { display: block; margin-bottom: 10px; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-body {
  border: 1.5px solid var(--line); border-radius: 11px;
  padding: 13px 15px; display: flex; gap: 12px; align-items: flex-start;
  transition: border-color .12s, background .12s;
}
.choice input:focus-visible + .choice-body { box-shadow: 0 0 0 3px var(--brand-light); }
.choice input:checked + .choice-body { border-color: var(--brand); background: var(--brand-light); }
.choice-dot {
  width: 20px; height: 20px; border-radius: 50%; flex: none; margin-top: 2px;
  border: 2px solid #b3a9c9; background: #fff; position: relative;
}
.choice input:checked + .choice-body .choice-dot { border-color: var(--brand); }
.choice input:checked + .choice-body .choice-dot::after {
  content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--brand);
}
.choice-text strong { display: block; font-size: 16px; }
.choice-text span { font-size: 14px; color: var(--muted); }

/* Checkbox */
.check { display: flex; gap: 11px; align-items: flex-start; cursor: pointer; font-size: 15px; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--brand); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 17px; font-weight: 700;
  padding: 13px 22px; border-radius: 11px; border: 1.5px solid transparent;
  background: var(--accent); color: #fff;
  cursor: pointer; text-decoration: none;
  transition: background .12s, transform .06s;
}
.btn:hover { background: var(--accent-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-lg { font-size: 18px; padding: 16px 24px; }
.btn-secondary { background: #fff; color: var(--brand); border-color: var(--line); }
.btn-secondary:hover { background: var(--brand-light); border-color: var(--brand); }
.btn-sm { font-size: 14px; padding: 8px 14px; border-radius: 9px; }
.btn-danger { background: #fff; color: var(--err); border-color: var(--line); }
.btn-danger:hover { background: var(--err-bg); border-color: var(--err); }

/* ---------- Signature pad ---------- */

.sigwrap { position: relative; }
.sigpad {
  width: 100%; height: 190px; display: block;
  background: #fff; border: 1.5px dashed #b3a9c9; border-radius: 11px;
  touch-action: none; cursor: crosshair;
}
.sigpad.signed { border-style: solid; border-color: var(--brand); }
.sigline {
  position: absolute; left: 22px; right: 22px; bottom: 42px;
  border-top: 1.5px solid var(--line); pointer-events: none;
}
.sigplaceholder {
  position: absolute; left: 0; right: 0; bottom: 14px; text-align: center;
  color: var(--muted); font-size: 14px; pointer-events: none;
}
.sigbar { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }

/* ---------- Legal text block ---------- */

.legal {
  max-height: 260px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 11px;
  padding: 18px 20px; background: #fdfbfe;
  font-size: 14.5px; line-height: 1.6;
}
.legal.open { max-height: none; overflow: visible; }
.legal h3 { font-size: 15px; margin: 18px 0 6px; letter-spacing: .01em; }
.legal h3:first-child { margin-top: 0; }
.legal p, .legal li { margin: 0 0 9px; }
.legal ul { margin: 0 0 9px; padding-left: 20px; }
.legal strong { font-weight: 700; }

/* ---------- Detail panel (event summary) ---------- */

.eventbox {
  background: var(--blue-tint); border: 1px solid #bfe6f3;
  border-radius: var(--radius); padding: 20px 22px; margin: 22px 0;
}
.eventbox h2 { margin: 0 0 14px; font-size: 20px; color: var(--blue-deep); }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; font-size: 15.5px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 650; }

/* ---------- Alerts ---------- */

.alert { border-radius: 11px; padding: 14px 16px; font-size: 15px; margin: 18px 0; border: 1px solid; }
.alert-ok   { background: var(--ok-bg);    border-color: #b7e4d0; color: var(--ok); }
.alert-warn { background: var(--warn-bg);  border-color: #f0c069; color: var(--warn); }
.alert-err  { background: var(--err-bg);   border-color: #f0b3ae; color: var(--err); }
.alert-pick { background: var(--coral-tint); border-color: #f5b9b3; color: var(--coral-deep); }
.alert strong { display: block; margin-bottom: 2px; }

/* ---------- Success screen ---------- */

.done { text-align: center; padding: 26px 0 10px; }
.done-mark {
  width: 68px; height: 68px; border-radius: 50%; margin: 0 auto 18px;
  background: var(--ok-bg); color: var(--ok);
  display: grid; place-items: center; font-size: 34px;
}
.done h1 { font-size: 28px; margin: 0 0 10px; letter-spacing: -.02em; }
.done p { color: var(--muted); margin: 0 auto; max-width: 460px; }

/* ---------- Tables (staff) ---------- */

.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
table.data th {
  text-align: left; font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 700;
  padding: 12px 14px; border-bottom: 1.5px solid var(--line); background: #fdfbfe;
  white-space: nowrap; position: sticky; top: 0;
}
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #fdfbfe; }
table.data .num { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.pill {
  display: inline-block; font-size: 12.5px; font-weight: 700; padding: 3px 9px;
  border-radius: 999px; white-space: nowrap;
}
.pill-bus  { background: var(--blue-tint);  color: var(--blue-deep); }
.pill-pick { background: var(--coral-tint); color: var(--coral-deep); }
.pill-req  { background: var(--coral-deep); color: #fff; }

.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px; }
.toolbar .field { margin: 0; }
.toolbar .grow { flex: 1; min-width: 190px; }

.stats { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 20px; min-width: 128px; flex: 1;
}
.stat .n { font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.stat .l { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 650; }
.stat.accent .n { color: var(--brand); }

.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 10px; }

.tabs { display: flex; gap: 4px; border-bottom: 1.5px solid var(--line); margin-bottom: 24px; flex-wrap: wrap; }
.tab {
  font: inherit; font-size: 15.5px; font-weight: 650; color: var(--muted);
  background: none; border: none; border-bottom: 3px solid transparent;
  padding: 11px 15px; cursor: pointer; margin-bottom: -1.5px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

.sig-thumb { height: 34px; max-width: 130px; object-fit: contain; object-position: left; }

/* ---------- Misc ---------- */

.footer { text-align: center; color: var(--muted); font-size: 14px; padding: 30px 20px 50px; }
.footer a { color: var(--brand); }
a { color: var(--brand); }
.center { text-align: center; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
.small { font-size: 14px; }
.muted { color: var(--muted); }
.spinner {
  display: inline-block; width: 17px; height: 17px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* ---------- Print: door roster ---------- */

@media print {
  body { background: #fff; font-size: 12pt; }
  .masthead, .toolbar, .tabs, .btn, .footer, .no-print, .stats { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .card, .tablewrap { border: none; box-shadow: none; padding: 0; margin: 0; }
  table.data { font-size: 11pt; }
  table.data th { background: #fff !important; border-bottom: 2px solid #000; }
  table.data td { border-bottom: 1px solid #ccc; }
  .print-head { display: block !important; margin-bottom: 14pt; }
  .print-head h1 { font-size: 18pt; margin: 0 0 4pt; }
  .print-head p { margin: 0; font-size: 11pt; }
  .checkbox-cell { width: 30pt; }
  .checkbox-cell::before {
    content: ""; display: inline-block; width: 14pt; height: 14pt; border: 1.5pt solid #333;
  }
  tr { page-break-inside: avoid; }
}
.print-head { display: none; }
