/* Safety Team portal. Brand colours are set in .env and injected as CSS variables (see src/brand.js). */
@font-face { font-family: "Montserrat"; src: url("/static/fonts/montserrat-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("/static/fonts/cormorant-garamond-latin-600-normal.woff2") format("woff2"); font-weight: 600 700; font-display: swap; }
:root {
  --ink: #111111; --ink-2: #2b2b2b; --steel: #626262; --line: #dedbd4; --chalk: #f8f6f1; --card: #ffffff;
  /* overridden per site from BRAND_COLOR_PRIMARY / ACCENT / ALERT */
  --brand: #16324f; --on-brand: #ffffff; --brand-accent: #e0a526;
  --gold: #e0a526; --on-accent: #000000; --gold-ink: #6b4c08; --gold-bg: #faf0d9;
  --red: #c62828; --red-bg: #fbe9e9;
  --green: var(--brand); --green-bg: #ececec; --amber: var(--gold); --amber-ink: var(--gold-ink); --amber-bg: var(--gold-bg); --blue: var(--ink);
  --display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --body: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--chalk); color: var(--ink); font: 500 15.5px/1.55 var(--body); }
a { color: var(--ink); text-decoration-color: var(--gold); text-decoration-thickness: 2px; text-underline-offset: 3px; }
h1, h2 { font-family: var(--display); font-weight: 600; line-height: 1.1; margin: 0 0 .45em; }
h1 { font-size: 2.5rem; }
h2 { font-size: 1.7rem; margin-top: 1.6em; padding-top: .5em; border-top: 1px solid var(--red); }
h3 { font: 700 1rem var(--body); margin: 0 0 .5em; }
p { margin: 0 0 1em; max-width: 68ch; }
.muted { color: var(--steel); }
.small { font-size: .875rem; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 5px var(--gold); }

/* header */
.top { background: var(--brand); color: var(--on-brand); border-bottom: 4px solid var(--gold); }
.top-in { max-width: 1040px; margin: 0 auto; padding: 12px 16px 0; }
.brand { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand a.name { display: flex; align-items: center; gap: 14px; color: var(--on-brand); text-decoration: none; font: 600 1.05rem var(--body); letter-spacing: .04em; }
.brand a.name img { height: 38px; width: auto; max-width: 240px; display: block; }
.brand a.name span { border-left: 1px solid color-mix(in srgb, var(--on-brand) 40%, transparent); padding-left: 14px; }
.brand a.name b { font: 600 1.5rem var(--display); letter-spacing: .01em; }
@media (max-width: 480px) { .brand a.name img { height: 30px; } }
.who { font-size: .85rem; color: color-mix(in srgb, var(--on-brand) 82%, transparent); display: flex; gap: 10px; align-items: center; }
.who form { display: inline; }
.linkbtn { background: none; border: 0; padding: 0; color: color-mix(in srgb, var(--on-brand) 82%, transparent); text-decoration: underline; font: inherit; cursor: pointer; }
nav.main { display: flex; gap: 2px; margin-top: 10px; overflow-x: auto; }
nav.main a { color: color-mix(in srgb, var(--on-brand) 82%, transparent); text-decoration: none; padding: 9px 13px; font: 600 .9rem var(--body); letter-spacing: .02em; white-space: nowrap; border-radius: 6px 6px 0 0; }
nav.main a:hover { color: var(--on-brand); }
nav.main a.on { background: var(--chalk); color: var(--ink); }
nav.sub { background: #efece5; border-bottom: 1px solid var(--line); }
nav.sub div { max-width: 1040px; margin: 0 auto; padding: 0 16px; display: flex; gap: 4px; overflow-x: auto; }
nav.sub a { color: var(--ink-2); text-decoration: none; padding: 9px 10px; font-size: .9rem; white-space: nowrap; border-bottom: 3px solid transparent; }
nav.sub a.on { border-bottom-color: var(--ink); font-weight: 600; }
main { max-width: 1040px; margin: 0 auto; padding: 24px 16px 64px; }
main.narrow { max-width: 560px; }

/* flash */
.flash { padding: 12px 14px; border-radius: 6px; margin-bottom: 20px; border-left: 6px solid var(--gold); background: var(--gold-bg); }
.flash.error { border-left-color: var(--red); background: var(--red-bg); }

/* forms */
label { display: block; font-weight: 600; margin-bottom: 4px; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 10px 0; }
label.check input { margin-top: 4px; width: 18px; height: 18px; flex: none; }
input[type=text], input[type=password], input[type=email], input[type=tel], input[type=date], input[type=time], input[type=number], input[type=url], input[type=file], select, textarea {
  width: 100%; padding: 10px 11px; border: 1px solid #a9a59c; border-radius: 6px; font: inherit; background: #fff; color: var(--ink); min-height: 44px;
}
textarea { min-height: 84px; }
.field { margin-bottom: 14px; }
.hint { font-size: .85rem; color: var(--steel); margin-top: 4px; }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); align-items: end; }
.btn { display: inline-block; border: 1px solid var(--ink); background: #fff; color: var(--ink); padding: 10px 16px; border-radius: 6px; font: 600 .95rem var(--body); cursor: pointer; text-decoration: none; min-height: 44px; line-height: 1.4; }
.btn:hover { background: #f1eee7; }
.btn.go { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.go:hover { filter: brightness(1.25); }
.btn.warn { background: var(--gold); border-color: color-mix(in srgb, var(--gold) 78%, #000); color: var(--on-accent); }
.btn.warn:hover { filter: brightness(.94); }
.btn.no { border-color: var(--red); color: var(--red); }
.btn.sm { padding: 5px 10px; min-height: 34px; font-size: .875rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 18px; margin-bottom: 18px; }
details.panel > summary { cursor: pointer; font-weight: 600; }
details.panel[open] > summary { margin-bottom: 14px; }

/* duty tags: the left stripe carries the status */
.duty { background: var(--card); border: 1px solid var(--line); border-left: 8px solid var(--steel); border-radius: 6px; padding: 14px 16px; margin-bottom: 10px; display: grid; gap: 10px; grid-template-columns: 1fr auto; align-items: center; }
.duty.pending { border-left-color: var(--amber); }
.duty.accepted { border-left-color: var(--green); }
.duty.declined { border-left-color: var(--red); }
.duty .when { font: 600 1.55rem var(--display); line-height: 1.15; }
.duty .what { color: var(--ink-2); }
.duty .note { grid-column: 1 / -1; font-size: .9rem; color: var(--steel); }
.duty form { display: inline; }
@media (max-width: 560px) { .duty { grid-template-columns: 1fr; } }

.chip { display: inline-block; font-size: .75rem; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: #ebe8e1; color: var(--ink-2); white-space: nowrap; }
.chip.pending { background: var(--amber-bg); color: var(--amber-ink); }
.chip.accepted { background: var(--brand); color: var(--on-brand); }
.chip.declined, .chip.failed { background: var(--red-bg); color: var(--red); }
.chip.open { background: #fff; border: 1px solid var(--red); color: var(--red); }
.chip.draft { background: #fff; border: 1px dashed var(--steel); }

/* posted roster */
.monthbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.monthbar h1 { margin: 0; }
.roster { display: grid; grid-template-columns: 92px 1fr; background: var(--card); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 12px; overflow: hidden; }
.roster .day { background: var(--brand); color: var(--on-brand); padding: 14px 8px; text-align: center; font-family: var(--display); }
.roster.unpub .day { background: #77736b; }
.roster.unpub .day span { color: #fff; }
.roster .day b { display: block; font-size: 2.6rem; font-weight: 600; line-height: 1; }
.roster .day span { display: block; font: 600 .8rem var(--body); letter-spacing: .08em; margin-top: 6px; color: var(--brand-accent); }
.roster .body { padding: 12px 16px; min-width: 0; }
.roster .title { font: 700 1rem var(--body); display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.roster .title small { font: 500 .875rem var(--body); color: var(--steel); }
.slots { list-style: none; margin: 8px 0 0; padding: 0; }
.slots li { display: grid; grid-template-columns: minmax(110px, 30%) 1fr auto; gap: 10px; padding: 7px 0; border-top: 1px solid #ece9e2; align-items: center; }
.slots .pos { color: var(--steel); font-size: .9rem; }
.slots .name { font-weight: 600; }
.slots .name.none { font-weight: 400; color: var(--steel); font-style: italic; }
.slots .me { background: var(--amber-bg); padding: 0 4px; border-radius: 3px; }
@media (max-width: 560px) { .roster { grid-template-columns: 64px 1fr; } .roster .day b { font-size: 1.6rem; } .slots li { grid-template-columns: 1fr auto; } .slots .pos { grid-column: 1 / -1; } }

/* tables */
.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid #ece9e2; vertical-align: top; }
th { font: 700 .82rem var(--body); background: #f1eee7; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.c, th.c { text-align: center; }
.yes { color: var(--ink); font-weight: 700; }
.no-mark { color: #8d897f; }
.inactive td { color: var(--steel); }

.counts { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.count { background: var(--card); border: 1px solid var(--line); border-top: 5px solid var(--green); border-radius: 6px; padding: 10px 16px; min-width: 130px; }
.count.bad { border-top-color: var(--red); } .count.wait { border-top-color: var(--amber); }
.count b { font: 600 2.2rem var(--display); display: block; line-height: 1; }
.count span { font-size: .875rem; color: var(--steel); }
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 9px 0; border-top: 1px solid #ece9e2; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; }
.list li:first-child { border-top: 0; }
.video { position: relative; padding-top: 56.25%; background: #000; border-radius: 8px; overflow: hidden; margin-bottom: 16px; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.bar { height: 10px; background: #e6e2d9; border-radius: 99px; overflow: hidden; max-width: 320px; }
.bar i { display: block; height: 100%; background: var(--gold); }
.builder-slot { display: grid; grid-template-columns: minmax(100px, 26%) 1fr auto auto; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px solid #ece9e2; }
.builder-slot select { min-height: 38px; padding: 6px 8px; }
.sticky { position: sticky; bottom: 0; background: var(--chalk); border-top: 1px solid var(--line); padding: 12px 0; margin-top: 18px; z-index: 2; }
@media (max-width: 560px) { .builder-slot { grid-template-columns: 1fr auto; } .builder-slot .pos { grid-column: 1 / -1; } }
@media print {
  .top, nav.sub, .noprint, .flash { display: none !important; }
  body { background: #fff; } main { padding: 0; max-width: none; }
  .roster { break-inside: avoid; border-color: #000; } .roster .day { background: #fff; color: #000; border-right: 2px solid #000; }
}

.loginmark { display: block; width: min(100%, 380px); height: auto; margin: 8px 0 26px; }
main.narrow h1:first-of-type { margin-top: 0; }
main > h2:first-child, h1 + h2 { border-top: 0; padding-top: 0; }

/* ---- phones and the installed app ---- */
input, select, textarea { font-size: 16px; }            /* 16px stops iPhone from zooming in on focus */
.codebox { font: 600 1.7rem var(--body) !important; letter-spacing: .3em; text-align: center; max-width: 260px; }
.top-in { padding-top: calc(12px + env(safe-area-inset-top)); padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
main { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
nav.main, nav.sub div { scrollbar-width: none; -webkit-overflow-scrolling: touch; }
nav.main::-webkit-scrollbar, nav.sub div::-webkit-scrollbar { display: none; }
button, .btn, nav a, select { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
@media (max-width: 640px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.45rem; }
  main { padding-top: 18px; }
  .brand { flex-wrap: nowrap; }
  .who span { display: none; }                           /* name is on the profile page; keeps the header to one line */
  nav.main a { padding: 10px 12px; }
  .monthbar .actions { width: 100%; }
  .duty .actions .btn { flex: 1 1 auto; text-align: center; }
  .duty form { display: flex; flex: 1 1 auto; }
  .duty form .btn { width: 100%; }
  .panel { padding: 14px; }
  .counts { display: grid; grid-template-columns: 1fr 1fr; }
  .count { min-width: 0; }
  th, td { padding: 8px 9px; }
  .sticky { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .sticky .btn { flex: 1 1 100%; }
  .builder-slot { grid-template-columns: 1fr auto; row-gap: 4px; }
  .builder-slot .pos { grid-column: 1 / -1; }
  .builder-slot > span:empty { display: none; }
  .list li { align-items: flex-start; }
}
@media (display-mode: standalone) { .top { position: sticky; top: 0; z-index: 5; } }

.brand a.name, .who, .who * { white-space: nowrap; }
td a[href^="tel:"] { white-space: nowrap; }
td a[href^="mailto:"] { overflow-wrap: anywhere; }
table.wide { min-width: 640px; }
table.wide td:nth-child(3) { white-space: nowrap; }
@media (max-width: 640px) {
  .brand a.name { gap: 10px; font-size: .95rem; min-width: 0; }
  .brand a.name img { height: 28px; max-width: 54vw; }
  .brand a.name span { padding-left: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .top-in { padding-bottom: 12px; }
  /* Main navigation becomes a tab bar at the bottom of the screen, within thumb reach. */
  nav.main { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; margin: 0; gap: 0; background: var(--brand); border-top: 3px solid var(--gold);
    padding: 0 max(4px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(4px, env(safe-area-inset-left)); overflow: visible; }
  nav.main a { flex: 1 1 0; min-width: 0; text-align: center; padding: 13px 2px 12px; font-size: .72rem; letter-spacing: 0; border-radius: 0; white-space: normal; line-height: 1.2; }
  nav.main a.on { background: none; color: var(--brand-accent); box-shadow: inset 0 3px 0 var(--brand-accent); margin-top: -3px; padding-top: 16px; }
  main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .sticky { bottom: calc(52px + env(safe-area-inset-bottom)); padding-bottom: 12px; }
  .builder-slot { grid-template-columns: 1fr auto; grid-template-areas: "pos pos" "sel rm" "chips chips"; }
  .builder-slot .pos { grid-area: pos; } .builder-slot .sel { grid-area: sel; min-width: 0; } .builder-slot .rm { grid-area: rm; } .builder-slot .chips { grid-area: chips; }
  .builder-slot .del { grid-column: 1 / -1; }
  .roster { grid-template-columns: 56px 1fr; }
  .roster .body { padding: 10px 12px; }
}
@media (display-mode: standalone) and (max-width: 640px) { .who { display: none; } }

@media (max-width: 640px) {
  table.stack tr:first-child { display: none; }
  table.stack tr { display: block; padding: 10px 12px; border-bottom: 1px solid #ece9e2; }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack td { display: block; padding: 1px 0; border: 0; }
  table.stack td:first-child { font-weight: 700; }
  table.stack td:empty { display: none; }
}

.loginname { font: 600 1.05rem var(--body); letter-spacing: .04em; margin: 8px 0 6px; color: var(--steel); }
.loginmark { max-height: 120px; object-fit: contain; object-position: left; }

.pills { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 16px; }
.pills a { padding: 6px 13px; border: 1px solid var(--line); border-radius: 99px; text-decoration: none; background: var(--card); color: var(--ink-2); font-size: .9rem; font-weight: 600; }
.pills a.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }

@media (max-width: 480px) { .brand a.name span { display: none; } .brand a.name img { max-width: 72vw; } }
.brand { min-width: 0; } .brand a.name { max-width: 100%; }
