/* Deployment Journey: one stylesheet for every page. Layout B: checklist on the left, step on the right. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c1f24;
  --muted: #5d6573;
  --line: #dde1e7;
  --accent: #1565c0;
  --accent-soft: #e3eefb;
  --ok: #2e7d32;
  --warn: #b26a00;
  --bad: #c62828;
  --radius: 8px;
  --header-h: 56px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.5; }
a { color: var(--accent); }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 .5rem; }
h2 { font-size: 1.1rem; margin: 1.75rem 0 .5rem; }
code { font-size: 1.1rem; background: var(--accent-soft); padding: .2rem .5rem; border-radius: 4px; user-select: all; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted, .hint { color: var(--muted); }
.hint { margin: .5rem 0; }

/* Buttons: real buttons and <summary> elements styled as buttons. Big enough to tap on an iPad. */
button, .button {
  font: inherit; font-size: .95rem; display: inline-flex; align-items: center; gap: .3rem;
  min-height: 44px; padding: .45rem 1rem; border-radius: 6px; cursor: pointer;
  border: 1px solid #b9c0cb; background: var(--surface); color: var(--text); text-decoration: none;
}
button:hover, .button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--bad); }
button:disabled { opacity: .45; cursor: default; }
summary.button { list-style: none; }
summary.button::-webkit-details-marker { display: none; }
textarea, input { font: inherit; width: 100%; padding: .5rem; border: 1px solid #b9c0cb; border-radius: 6px; background: #fff; }
:focus-visible { outline: 3px solid #90caf9; outline-offset: 1px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  min-height: var(--header-h); padding: .4rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-size: 1rem; }
.hdr-district { font-weight: 600; color: var(--accent); }
.hdr-progress { display: inline-flex; align-items: center; gap: .4rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.pbar { display: inline-block; width: 90px; height: 8px; border-radius: 4px; background: #e2e5ea; overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--ok); }
.hdr-spacer { flex: 1; }
.hdr-user { color: var(--muted); }
.hdr-signout { margin: 0; }
.hdr-signout button, .menu-toggle { min-height: 36px; padding: .25rem .75rem; }
.menu-toggle { display: none; font-size: 1.2rem; }

.flash { padding: 0 1rem; }
.flash p { margin: .75rem 0 0; padding: .6rem .9rem; border-radius: var(--radius); background: #e8f5e9; border: 1px solid #c8e6c9; }
.notice { padding: .6rem .9rem; border-radius: var(--radius); background: #fff4e5; border: 1px solid #ffd8a8; margin: 0 0 1rem; }
.empty, .page { max-width: 900px; margin: 1.5rem auto; padding: 0 1rem; }

/* Two-pane journey layout */
.journey { display: grid; grid-template-columns: minmax(280px, 34%) 1fr; align-items: start; }
.sidebar {
  position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); overflow-y: auto;
  padding: .75rem .5rem 2rem .75rem; border-right: 1px solid var(--line); background: var(--surface);
  font-size: .93rem; -webkit-overflow-scrolling: touch;
}
.sidebar summary, .sidebar .phase-row, .sidebar .group-row {
  display: flex; align-items: center; gap: .4rem; padding: .45rem .5rem; border-radius: 6px; cursor: pointer;
}
.sidebar summary:hover { background: var(--bg); }
.sidebar summary { list-style: none; }
.sidebar summary::-webkit-details-marker { display: none; }
.sidebar summary::before { content: "▸"; width: .8em; flex: none; color: var(--muted); }
.sidebar details[open] > summary::before { content: "▾"; }
.sidebar details.phase > summary { font-weight: 600; }
.sidebar details.group { margin-left: .9rem; }
.sidebar .phase-row, .sidebar .group-row { margin: 0; cursor: default; }
.sidebar .group-row { margin-left: .9rem; }
.sidebar details.is-off > summary .title { opacity: .5; text-decoration: line-through; }
.sidebar .count { margin-left: auto; color: var(--muted); font-weight: 400; font-size: .85rem; font-variant-numeric: tabular-nums; }
.sidebar .icon { width: 1.3em; flex: none; text-align: center; }
.sidebar .icon.done, .state-done .icon { color: var(--ok); }
.sidebar .unread { color: var(--bad); font-size: .8rem; }
.sidebar ul.steps { list-style: none; margin: 0 0 .25rem; padding: 0 0 0 1.3rem; }
.sidebar details.group ul.steps { padding-left: .9rem; }
.step-row a {
  display: flex; align-items: flex-start; gap: .4rem; padding: .35rem .5rem; border-radius: 6px;
  color: var(--text); text-decoration: none;
}
.step-row a:hover { background: var(--bg); }
.step-row.selected a { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.step-row.state-locked a { color: var(--muted); }
.step-row.state-waiting .icon { color: var(--warn); }
.step-row.state-skipped .icon { color: var(--muted); }
.off, .step-row.state-off a { opacity: .5; text-decoration: line-through; }

.step-panel { padding: 1.25rem 1.5rem 3rem; max-width: 960px; min-width: 0; }
.crumbs { margin: 0 0 .25rem; color: var(--muted); font-size: .9rem; }
.badge { display: inline-block; margin: 0 0 1rem; padding: .1rem .6rem; border-radius: 999px; font-size: .8rem; background: #eceff3; }
.badge.state-done { background: #e8f5e9; color: var(--ok); }
.badge.state-waiting { background: #fff4e5; color: var(--warn); }
.badge.state-blocked { background: #fdecea; color: var(--bad); }
.guidance { max-width: 70ch; }
.guidance img { max-width: 100%; }

/* Content items */
.content { margin: 1rem 0; padding: .9rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.content-title { margin: 0 0 .6rem; font-weight: 600; display: flex; flex-wrap: wrap; gap: .5rem; align-items: baseline; }
.content-title .fullscreen { font-weight: 400; margin-left: auto; }
.content-links { margin: .5rem 0 0; font-size: .9rem; }
.content-status { margin: .4rem 0 0; font-size: .9rem; color: var(--muted); }
.content-status:empty { display: none; }
.content-status.ok { color: var(--ok); }
.content-status.bad { color: var(--bad); }
.pdf-page { background: #eceff3; border-radius: 6px; overflow: hidden; text-align: center; }
.pdf-page canvas { display: block; width: 100%; height: auto; }
.pdf-controls { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: .6rem; font-variant-numeric: tabular-nums; }
.wizard-frame { display: block; width: 100%; border: 1px solid var(--line); border-radius: 6px; background: #fff; }

/* Actions */
.actions { margin: 1.5rem 0; padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.action-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-start; }
.action-row form { margin: 0; }
.reveal { margin: 0; }
.actions > .reveal.stuck { margin-top: .75rem; }
.reveal[open] > summary { border-color: var(--accent); }
.reveal-form { display: grid; gap: .5rem; margin-top: .6rem; max-width: 520px; }
.reveal-form button { justify-self: start; }

/* Requests and history */
.request { padding: .75rem 1rem; margin: .75rem 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.request .meta { margin: 0 0 .3rem; font-size: .85rem; color: var(--muted); }
.request-note { margin: 0 0 .5rem; }
.reply { margin: .5rem 0 0 .75rem; padding: .4rem .75rem; border-left: 3px solid var(--line); }
.reply.from-dse { border-left-color: var(--accent); }
.reply p { margin: 0; }
.reply-form { display: flex; gap: .5rem; margin-top: .6rem; align-items: flex-start; }
.tag { font-size: .75rem; padding: .05rem .5rem; border-radius: 999px; background: #eceff3; color: var(--text); }
.tag-stuck { background: #fdecea; }
.tag-verify { background: #fff4e5; }
.history ol { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.history li { padding: .4rem 0; border-bottom: 1px solid var(--line); }

/* Team page */
.temp-password { padding: .75rem 1rem; background: #e8f5e9; border: 1px solid #c8e6c9; border-radius: var(--radius); margin-bottom: 1rem; }
.temp-password p { margin: .25rem 0; }
.people { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.people th, .people td { text-align: left; padding: .5rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.people tr.inactive td { color: var(--muted); }
.row-actions { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; }
.row-actions form { margin: 0; }
.add-person { display: grid; gap: .4rem; max-width: 420px; }
.add-person button { justify-self: start; margin-top: .4rem; }

/* DSE screens */
select { font: inherit; min-height: 44px; padding: .4rem .5rem; border: 1px solid #b9c0cb; border-radius: 6px; background: #fff; }
.dse-tabs { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; padding: 0 1rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.dse-tabs a { display: inline-flex; align-items: center; gap: .4rem; padding: .7rem 0 .55rem; color: var(--text); text-decoration: none; border-bottom: 3px solid transparent; }
.dse-tabs a[aria-current="page"] { border-bottom-color: var(--accent); font-weight: 600; }
.dse-tabs .count { min-width: 1.5em; padding: 0 .4rem; border-radius: 999px; background: var(--accent); color: #fff; font-size: .78rem; text-align: center; font-variant-numeric: tabular-nums; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.page-head h1 { margin: 0; }
.queue { list-style: none; margin: 0; padding: 0; }
.queue-row { display: flex; align-items: center; gap: 1rem; padding: .75rem 1rem; margin: .5rem 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.queue-row form { margin: 0; }
.queue-main { flex: 1; min-width: 0; }
.queue-main p { margin: 0; }
.queue-main .meta { font-size: .85rem; color: var(--muted); }
.action-row.spaced { margin-top: .9rem; align-items: center; }
.district-bar { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1.25rem; padding: .6rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line); font-size: .93rem; }
.skipped-list summary { cursor: pointer; color: var(--warn); }
.skipped-list ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.dse-controls .reveal-form select { justify-self: start; }
.start-form fieldset { margin: 0 0 1rem; padding: .5rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.start-form legend { font-weight: 600; padding: 0 .3rem; }
.check-row { display: flex; align-items: center; gap: .6rem; min-height: 44px; }
.check-row input { width: 1.2rem; height: 1.2rem; flex: none; }
.check-row .icon { width: 1.2rem; text-align: center; flex: none; }
.check-row.state-done .icon { color: var(--ok); }
.check-row.state-off { opacity: .5; text-decoration: line-through; }
.flash p.flash-error { background: #fdecea; border-color: #f5c6c2; }
.button.danger { color: var(--bad); }
button.danger-fill { background: var(--bad); border-color: var(--bad); color: #fff; }

/* Edit checklist */
.ed-phase { margin: 1rem 0; padding: .5rem 1rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.ed-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .75rem; }
.ed-row h2, .ed-row h3 { margin: .5rem 0; }
.ed-row h3 { font-size: 1rem; }
.ed-group { margin: .5rem 0 0 1rem; padding-left: .75rem; border-left: 3px solid var(--line); }
.ed-steps { list-style: none; margin: 0; padding: 0; }
.ed-step, .ed-item { padding: .3rem 0; border-bottom: 1px solid var(--line); }
.ed-title { flex: 1; min-width: 12rem; }
.ed-flags { display: inline-flex; flex-wrap: wrap; gap: .3rem; }
.ed-move { display: inline-flex; gap: .25rem; margin: 0; }
.ed-move button { min-width: 44px; padding: .2rem .5rem; }
.ed-item form { margin: 0; }
.ed-add { margin: .6rem 0 0; font-size: .93rem; }
.ed-import { display: flex; gap: .5rem; align-items: center; margin: 0; }
.ed-import input { width: auto; }
.ed-form { display: grid; gap: .4rem; max-width: 720px; }
.ed-form label { margin-top: .5rem; }
.ed-form .check-row { margin-top: .75rem; }
.ed-form .hint { margin: 0; font-size: .9rem; }
.ed-form select[multiple] { min-height: 12rem; }
.ed-preview { padding: .75rem 1rem; background: var(--surface); border: 1px dashed var(--accent); border-radius: var(--radius); }
.ed-preview > p { margin: 0 0 .4rem; font-size: .85rem; }
code.key { font-size: .9rem; }

/* iPad portrait and phones: the checklist becomes a slide-out menu */
@media (max-width: 899px) {
  .menu-toggle { display: inline-flex; }
  .hdr-user, .brand { display: none; }
  .journey { display: block; }
  .sidebar {
    position: fixed; z-index: 40; top: 0; left: 0; bottom: 0; width: min(88vw, 380px); height: auto;
    transform: translateX(-105%); transition: transform .2s ease; box-shadow: 0 0 24px rgba(0, 0, 0, .2);
    padding-top: 1rem;
  }
  .sidebar.open { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .3); }
  .step-panel { padding: 1rem 1rem 3rem; }
  .people thead { display: none; }
  .people tr { display: block; padding: .5rem 0; border-bottom: 1px solid var(--line); }
  .people td { display: block; border: 0; padding: .15rem .75rem; }
  .people td.row-actions { display: flex; justify-content: flex-start; padding-top: .4rem; }
  .reply-form { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }
