/* RSRS — Roadsafe Roadshow Scheduler
 *
 * Colours are taken from the organisations' own identities so a crew member
 * recognises their service before reading a word:
 *   PSNI   #003D3C deep teal, #3EB599 mint, #006885 blue, #48277C purple
 *   NIFRS  #C8102E red
 *   NIAS   #01573D green
 *
 * Phone first throughout. Everything is a single column until 720px, tap
 * targets are 44px minimum, and nothing depends on hover. */

:root {
  --psni:        #003D3C;
  --psni-dark:   #002625;
  --mint:        #3EB599;
  --mint-dim:    #2d8a74;
  --blue:        #006885;
  --purple:      #48277C;
  --fire:        #C8102E;
  --amb:         #01573D;

  --bg:          #eef1f2;
  --surface:     #ffffff;
  --surface-2:   #f3f4f5;
  --line:        #d3d9dc;
  --line-soft:   #e7eaec;
  --ink:         #10221f;
  --ink-soft:    #4a5f5d;
  --ink-faint:   #7b8c8a;

  --ok:          #1f8a5c;
  --warn:        #b26a00;
  --bad:         #c8102e;

  --radius:      14px;
  --radius-sm:   9px;
  --shadow:      0 1px 2px rgba(0,38,37,.06), 0 4px 16px rgba(0,38,37,.07);
  --shadow-lg:   0 2px 6px rgba(0,38,37,.08), 0 18px 44px rgba(0,38,37,.14);
  --font:        'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI',
                 system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  /* iOS: keep content clear of the home indicator and notch */
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── header ───────────────────────────────────────────────────────────────── */

.top {
  background: linear-gradient(160deg, var(--psni) 0%, var(--psni-dark) 100%);
  color: #fff;
  padding: calc(14px + env(safe-area-inset-top)) 16px 14px;
  position: relative;
}
.top::after {                     /* mint keyline, the PSNI accent */
  content: ''; position: absolute; left: 0; right: 0; bottom: 0;
  height: 3px; background: var(--mint);
}
.top-in {
  max-width: 980px; margin: 0 auto;
  display: flex; align-items: center; gap: 13px;
}
.top-logo { height: 36px; width: auto; flex: 0 0 auto; }
.top-logo img { height: 36px; width: auto; display: block; }
.top-txt { min-width: 0; }
/* Wraps rather than truncating. "Roadsaf…" in the masthead of a branded tool
 * looks broken, and on a 375px phone with an action button there is not
 * enough room for one line. */
.top-txt h1 {
  margin: 0; font-size: 16px; font-weight: 800; letter-spacing: -.2px;
  line-height: 1.15; overflow-wrap: break-word;
}
.top-txt p {
  margin: 2px 0 0; font-size: 10px; font-weight: 700; color: var(--mint);
  text-transform: uppercase; letter-spacing: .08em; line-height: 1.3;
}
.top-act { margin-left: auto; display: flex; gap: 8px; flex: 0 0 auto; }

/* ── nav ──────────────────────────────────────────────────────────────────── */

.nav {
  background: var(--psni-dark); position: sticky; top: 0; z-index: 30;
  box-shadow: 0 1px 0 rgba(255,255,255,.07);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  /* Fades the right edge so it is obvious there is more nav off-screen —
   * on a phone the last item is otherwise cut with no hint it exists. */
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 26px), transparent);
          mask-image: linear-gradient(to right, #000 calc(100% - 26px), transparent);
}
.nav::-webkit-scrollbar { display: none; }
.nav-in {
  max-width: 980px; margin: 0 auto; display: flex; gap: 2px; padding: 0 10px;
}
.nav a {
  color: rgba(255,255,255,.72); font-size: 13px; font-weight: 700;
  padding: 13px 12px; white-space: nowrap; border-bottom: 3px solid transparent;
  text-decoration: none;
}
.nav a:hover { color: #fff; text-decoration: none; }
.nav a.on { color: #fff; border-bottom-color: var(--mint); }

/* ── layout ───────────────────────────────────────────────────────────────── */

.wrap { max-width: 980px; margin: 0 auto; padding: 16px 14px 56px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.muted { color: var(--ink-faint); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.stack { display: grid; gap: 12px; }

h2 { font-size: 20px; font-weight: 800; letter-spacing: -.3px; margin: 0 0 2px; }
h3 { font-size: 15px; font-weight: 800; margin: 0 0 8px; }

.section-label {
  font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-faint); margin: 22px 0 9px;
}
.section-label:first-child { margin-top: 0; }

/* ── cards ────────────────────────────────────────────────────────────────── */

.card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.card-pad { padding: 15px; }
.card-head {
  padding: 12px 15px; border-bottom: 1px solid var(--line-soft);
  font-size: 12px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
  color: var(--psni); display: flex; align-items: center; gap: 8px;
}

/* ── the date card: the thing you look at on a phone ──────────────────────── */

.ev {
  display: flex; gap: 0; background: var(--surface);
  border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; color: inherit; text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease;
}
.ev:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.ev:active { transform: none; }

.ev-date {
  flex: 0 0 68px; background: var(--psni); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 13px 4px; text-align: center; position: relative;
}
.ev-date .dow {
  font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--mint);
}
.ev-date .dd { font-size: 26px; font-weight: 800; line-height: 1.05; margin: 1px 0; }
.ev-date .mon {
  font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  opacity: .82;
}
.ev-body { padding: 12px 14px; min-width: 0; flex: 1 1 auto; }
.ev-venue {
  font-size: 15.5px; font-weight: 800; letter-spacing: -.2px; margin: 0 0 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ev-where {
  font-size: 12.5px; color: var(--ink-soft); margin: 0 0 9px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ev-meta {
  display: flex; gap: 6px 12px; flex-wrap: wrap; font-size: 12px;
  color: var(--ink-soft); font-weight: 600; margin-bottom: 9px;
}
.ev-meta b { color: var(--ink); font-weight: 700; }

.ev.is-cancelled { opacity: .62; }
.ev.is-cancelled .ev-venue { text-decoration: line-through; }
.ev.is-cancelled .ev-date { background: var(--ink-faint); }
.ev.is-draft .ev-date { background: var(--blue); }

/* ── role chips ───────────────────────────────────────────────────────────── */

.chips { display: flex; gap: 5px; flex-wrap: wrap; }
.chip {
  --c: var(--ink-faint);
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 800; letter-spacing: .02em;
  padding: 3px 8px; border-radius: 999px; white-space: nowrap;
  background: var(--c); color: #fff; border: 1.5px solid var(--c);
}
/* Short of cover reads as an outline, not a colour change: the service
 * colour stays recognisable while the hollow shape says "not covered yet". */
.chip.short { background: transparent; color: var(--c); border-style: dashed; }
.chip .n { font-variant-numeric: tabular-nums; opacity: .9; font-weight: 700; }
.chip.short .n { opacity: 1; }

.chip-police    { --c: var(--psni); }
.chip-fire      { --c: var(--fire); }
.chip-ambulance { --c: var(--amb); }
.chip-presenter { --c: var(--blue); }
.chip-cast      { --c: var(--purple); }
.chip-av        { --c: #55666B; }
.chip-support   { --c: var(--mint-dim); }

.tag {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px;
  font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 6px;
  background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--line);
}
.tag-ok     { background: #e7f5ee; color: #11674a; border-color: #bfe3d2; }
.tag-warn   { background: #fdf2e0; color: #8a5200; border-color: #f2ddb5; }
.tag-bad    { background: #fdeaec; color: #9c0c23; border-color: #f6c6cd; }
.tag-draft  { background: #e6f0f4; color: #00536a; border-color: #c2dde6; }

/* ── buttons ──────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; padding: 0 17px; border-radius: var(--radius-sm);
  border: none; cursor: pointer; font-family: inherit; font-size: 14px;
  font-weight: 700; text-decoration: none; background: var(--psni); color: #fff;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { text-decoration: none; filter: brightness(1.12); }
.btn:active { filter: brightness(.95); }
.btn-mint  { background: var(--mint); color: #01302a; }
.btn-ghost { background: var(--surface); color: var(--psni); border: 1.5px solid var(--line); }
.btn-ghost:hover { border-color: var(--psni); filter: none; }
.btn-ok    { background: var(--ok); }
.btn-bad   { background: var(--bad); }
.btn-sm    { min-height: 34px; padding: 0 11px; font-size: 12.5px; border-radius: 7px; }
.btn-lg    { min-height: 52px; font-size: 15.5px; padding: 0 22px; }
.btn-wide  { width: 100%; }
.btn-top   { background: rgba(255,255,255,.14); color: #fff; min-height: 36px;
             padding: 0 12px; font-size: 12.5px; }
.btn-top:hover { background: rgba(255,255,255,.24); filter: none; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ── forms ────────────────────────────────────────────────────────────────── */

.field { display: grid; gap: 5px; }
.field > label {
  font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-faint);
}
input[type=text], input[type=date], input[type=time], input[type=number],
input[type=password], input[type=email], input[type=tel], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 16px;   /* 16px stops iOS zooming on focus */
}
textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--mint); box-shadow: 0 0 0 3px rgba(62,181,153,.2);
}
.grid2 { display: grid; gap: 12px; grid-template-columns: 1fr; }
.grid3 { display: grid; gap: 12px; grid-template-columns: 1fr; }
.check { display: flex; gap: 9px; align-items: flex-start; }
.check input { width: 20px; height: 20px; min-height: 0; margin: 2px 0 0; flex: 0 0 auto; }
.check label { font-size: 14px; font-weight: 600; }

.msg { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13.5px;
       font-weight: 600; margin-bottom: 14px; }
.msg-ok  { background: #e7f5ee; color: #11674a; border: 1px solid #bfe3d2; }
.msg-err { background: #fdeaec; color: #9c0c23; border: 1px solid #f6c6cd; }

/* ── month grid ───────────────────────────────────────────────────────────── */

.cal { background: var(--surface); border-radius: var(--radius);
       box-shadow: var(--shadow); overflow: hidden; }
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr);
            background: var(--psni); color: rgba(255,255,255,.8); }
.cal-head div { padding: 9px 2px; text-align: center; font-size: 10.5px;
                font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-cell { border-right: 1px solid var(--line-soft);
            border-bottom: 1px solid var(--line-soft);
            min-height: 62px; padding: 4px 3px; position: relative; }
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell.pad { background: var(--surface-2); }
.cal-cell .dnum { font-size: 11.5px; font-weight: 700; color: var(--ink-faint);
                  display: block; text-align: right; padding: 0 2px; }
.cal-cell.is-today .dnum {
  color: #fff; background: var(--mint); border-radius: 999px;
  width: 20px; height: 20px; line-height: 20px; text-align: center;
  margin-left: auto; font-weight: 800;
}
.cal-ev { display: block; margin-top: 3px; padding: 3px 4px; border-radius: 5px;
          background: var(--psni); color: #fff; font-size: 9.5px; font-weight: 800;
          line-height: 1.25; overflow: hidden; text-decoration: none; }
.cal-ev:hover { text-decoration: none; filter: brightness(1.15); }
.cal-ev.short { background: var(--fire); }
.cal-ev.cancelled { background: var(--ink-faint); text-decoration: line-through; }
.cal-ev.draft { background: var(--blue); }
.cal-ev .t { opacity: .85; font-weight: 700; }

/* ── event detail ─────────────────────────────────────────────────────────── */

.hero {
  background: linear-gradient(160deg, var(--psni) 0%, var(--psni-dark) 100%);
  color: #fff; border-radius: var(--radius); padding: 17px;
  box-shadow: var(--shadow); margin-bottom: 14px;
}
.hero .when {
  font-size: 11.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--mint); margin: 0 0 5px;
}
.hero h2 { font-size: 23px; margin: 0 0 4px; color: #fff; }
.hero .where { font-size: 13.5px; color: rgba(255,255,255,.82); margin: 0; }
.hero-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 15px; }

.perf { display: flex; gap: 12px; padding: 12px 15px; border-bottom: 1px solid var(--line-soft); }
.perf:last-child { border-bottom: none; }
.perf-time { flex: 0 0 62px; font-size: 15px; font-weight: 800; color: var(--psni);
             font-variant-numeric: tabular-nums; }
.perf-time span { display: block; font-size: 11px; font-weight: 600; color: var(--ink-faint); }
.perf-body { min-width: 0; }
.perf-body .lbl { font-weight: 700; font-size: 14px; }
.perf-body .det { font-size: 12.5px; color: var(--ink-soft); }

.rolerow { padding: 11px 15px; border-bottom: 1px solid var(--line-soft); }
.rolerow:last-child { border-bottom: none; }
.rolerow .names { font-size: 13px; color: var(--ink-soft); margin-top: 6px; }
.rolerow .names b { color: var(--ink); font-weight: 700; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 999px;
       background: var(--ink-faint); flex: 0 0 auto; }
.dot-confirmed { background: var(--ok); }
.dot-invited   { background: var(--warn); }
.dot-declined  { background: var(--bad); }

/* ── my dates ─────────────────────────────────────────────────────────────── */

.mine-head {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 15px; border-left: 5px solid var(--mint);
}
.mine-head .nm { font-size: 20px; font-weight: 800; letter-spacing: -.3px; }
.answer { display: flex; gap: 8px; margin-top: 11px; }
.answer .btn { flex: 1 1 0; }
.answered { font-size: 12.5px; font-weight: 700; display: flex; align-items: center;
            gap: 6px; margin-top: 10px; }

/* ── subscribe ────────────────────────────────────────────────────────────── */

.steps { counter-reset: s; display: grid; gap: 11px; }
.step { display: flex; gap: 12px; }
.step::before {
  counter-increment: s; content: counter(s);
  flex: 0 0 26px; height: 26px; border-radius: 999px; background: var(--mint);
  color: #01302a; font-weight: 800; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.step div { font-size: 13.5px; padding-top: 3px; }
.urlbox {
  display: flex; gap: 8px; align-items: center; background: var(--surface-2);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 9px 11px;
}
.urlbox code {
  flex: 1 1 auto; font-size: 11.5px; word-break: break-all; color: var(--ink-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; line-height: 1.45;
}

/* ── tables (admin) ───────────────────────────────────────────────────────── */

.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; padding: 9px 12px; font-size: 10.5px; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint);
  border-bottom: 1.5px solid var(--line); white-space: nowrap;
}
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft);
          vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.stat { display: grid; gap: 1px; }
.stat .v { font-size: 25px; font-weight: 800; letter-spacing: -.5px; color: var(--psni); }
.stat .k { font-size: 10.5px; font-weight: 800; letter-spacing: .08em;
           text-transform: uppercase; color: var(--ink-faint); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.empty { text-align: center; padding: 42px 20px; color: var(--ink-faint); }
.empty .big { font-size: 15px; font-weight: 700; color: var(--ink-soft); margin-bottom: 4px; }

.foot { text-align: center; font-size: 11.5px; color: var(--ink-faint); padding: 8px 16px 20px; }

/* ── wider screens ────────────────────────────────────────────────────────── */

@media (max-width: 400px) {
  .btn-top { padding: 0 9px; font-size: 11.5px; min-height: 34px; }
  .top-logo, .top-logo img { height: 32px; }
}
@media (min-width: 860px) {
  .nav { -webkit-mask-image: none; mask-image: none; }
}
@media (min-width: 560px) {
  .grid2 { grid-template-columns: 1fr 1fr; }
  .grid3 { grid-template-columns: repeat(3, 1fr); }
  .ev-date { flex-basis: 78px; }
  .cal-cell { min-height: 86px; }
  .cal-ev { font-size: 10.5px; }
}
@media (min-width: 720px) {
  body { font-size: 15.5px; }
  .wrap { padding: 22px 18px 64px; }
  .top-txt h1 { font-size: 20px; }
  .top-logo, .top-logo img { height: 44px; }
  .hero { padding: 24px; }
  .hero h2 { font-size: 28px; }
  .cal-cell { min-height: 104px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Printing a crew list for a venue that has no signal. */
@media print {
  .nav, .top-act, .hero-acts, .answer { display: none !important; }
  body { background: #fff; }
  .card, .ev { box-shadow: none; border: 1px solid #ccc; }
}
