body { --col: 40rem; display: flex; flex-direction: column; min-height: 100vh; }
/* The logo lines up with the content column. */
.portal-header { background: var(--ink); padding: 0.4rem max(1rem, (100% - var(--col)) / 2); }
.portal-header img { height: 40px; width: auto; }
.portal-header + .stripe { height: 6px; }
.portal-main { flex: 1; width: min(100% - 2rem, var(--col)); margin: clamp(1.75rem, 6vw, 3.5rem) auto 2.5rem; }
.portal-main h1 { font-size: clamp(1.9rem, 7vw, 2.4rem); margin-bottom: 0.3em; }
.portal-main p a { font-weight: 600; }
.who, #view-loading p { color: var(--muted); }
.who { margin-bottom: 1.5rem; }

.files { list-style: none; margin: 0 0 1.5rem; padding: 0; border-bottom: 1px solid var(--hairline); }
.files li { display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem 0; border-top: 1px solid var(--hairline); }
.files .kind {
  flex: none; width: 3.25rem; padding: 0.2rem 0; border: 1px solid var(--hairline); border-radius: var(--radius);
  background: var(--stage); color: var(--muted); font-size: 0.75rem; font-weight: 600; text-align: center;
}
.files div { flex: 1; min-width: 0; }
.files b { display: block; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.files small { font-size: 0.875rem; color: var(--muted); }
.files .open {
  flex: none; display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 1rem;
  border: 1px solid var(--ink); border-radius: var(--radius); font-weight: 600; text-decoration: none;
}
#empty-note { padding: 0.85rem 0; border-block: 1px solid var(--hairline); color: var(--muted); margin-bottom: 1.5rem; }

.portal-footer { width: min(100% - 2rem, var(--col)); margin: 0 auto 1.5rem; }

dialog {
  width: min(100% - 2rem, 24rem); padding: 1.5rem; border: 1px solid var(--hairline); border-radius: 6px;
  background: var(--paper); color: var(--ink);
}
dialog::backdrop { background: rgba(3, 20, 47, 0.5); }
dialog h2 { font-size: 1.5rem; }
dialog p { font-size: 0.95rem; color: var(--muted); }
#qr-canvas {
  width: min(100%, 15rem); height: auto; margin: 0 auto 1.25rem; display: block;
  border: 1px solid var(--hairline); image-rendering: pixelated;
}
.qr-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
#qr-download { grid-column: 1 / -1; }

/* Landing: the view without a key. */
.landing h2 { font-size: 1.25rem; margin: 1.75rem 0 0.4rem; }
.landing .lead { font-size: 1.125rem; color: var(--muted); }
.ways { list-style: none; margin: 0.6rem 0 0; padding: 0; border-bottom: 1px solid var(--hairline); }
.ways li { padding: 0.7rem 0; border-top: 1px solid var(--hairline); }
.help-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0 1.25rem; }
.safety { font-size: 0.9rem; color: var(--muted); }

/* The corner of a drawing sheet on the stage ground. Lengths are px so the plan and the title block stay in register. */
.landing-art {
  position: relative; height: 19rem; margin-top: 2rem; overflow: hidden; border-radius: 14px;
  background:
    linear-gradient(#E4E4DF 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, #E4E4DF 1px, transparent 1px) 0 0 / 32px 32px,
    var(--stage);
}
.la-sheet {
  position: absolute; inset: 0 32px 32px 0; padding: 0 10px 10px 0; background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04), 0 14px 32px -8px rgba(50, 50, 93, 0.24), 0 4px 10px -4px rgba(0, 0, 0, 0.1);
}
.la-frame { position: relative; height: 100%; overflow: hidden; border: solid var(--ink); border-width: 0 1px 1px 0; }
.la-plan { position: absolute; right: 0; bottom: 0; width: 420px; height: 420px; max-width: none; color: var(--ink); }
.la-tb { position: absolute; right: 0; bottom: 0; display: flex; width: 240px; height: 120px; border: solid var(--ink); border-width: 1px 0 0 1px; background: #fff; }
.la-cells { flex: 1; display: grid; gap: 1px; background: var(--ink); }
.la-cells span { display: flex; align-items: center; padding-left: 14px; background: #fff; }
.la-cells i { width: 72px; height: 6px; border-radius: 3px; background: #D9DBE0; }
.la-cells span:nth-child(2) i { width: 48px; }
.la-cells span:nth-child(3) i { width: 60px; }
.la-qr { flex: none; width: 120px; padding: 14px; border-left: 1px solid var(--ink); }
.la-qr svg { display: block; width: 100%; height: 100%; }

/* Two columns need the wider column. A browser without :has() keeps the stacked layout. */
@media (min-width: 44rem) {
  body:has(#view-nokey:not([hidden])) { --col: 62rem; }
  body:has(#view-nokey:not([hidden])) .landing {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(18rem, 0.8fr); gap: clamp(2rem, 5vw, 4rem); align-items: center;
  }
  body:has(#view-nokey:not([hidden])) .landing-art { height: 28rem; margin-top: 0; }
}

/* Progress. Unfinished work is hatched like a section cut on a drawing: navy is done, gold is under way, red is late. */
.progress {
  --late: #B42318; --late-bg: #FDECEA; --live: #2E8B57;
  --hatch: repeating-linear-gradient(-45deg, #D9D9D2 0 1.5px, transparent 1.5px 6px);
  margin-bottom: 2.75rem;
}
.progress h2, .docs-title { font-size: 1.25rem; margin: 0; }
.docs-title { margin-bottom: 0.6rem; }
.pg-card {
  padding: 1.25rem 1.25rem 1.1rem; border: 1px solid var(--hairline); border-radius: 14px; background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.02), 0 18px 36px -22px rgba(50, 50, 93, 0.3), 0 4px 10px -6px rgba(0, 0, 0, 0.08);
}
.pg-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.pg-pct {
  margin: 0.75rem 0 0.35rem; font-size: clamp(3.75rem, 17vw, 5rem); font-weight: 600; line-height: 0.9;
  letter-spacing: -0.035em; font-variant-numeric: tabular-nums;
}
.pg-pct small { font-size: 0.45em; letter-spacing: 0; margin-left: 0.08em; color: var(--muted); }
.pg-count { margin: 0 0 1rem; font-size: 0.95rem; color: var(--muted); }
.pg-bar { display: flex; gap: 3px; height: 16px; }
.pg-bar > span, .cl-bar, .sec-bar { flex: 1; overflow: hidden; border-radius: 2px; background: var(--hatch), var(--stage); }
.pg-bar span span, .cl-bar span, .sec-bar span {
  display: block; width: var(--p); height: 100%; background: var(--gold); transform-origin: left;
  animation: pg-grow 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.pg-bar .is-done span, .cl-tab.is-done .cl-bar span, .sec.is-done .sec-bar span { background: var(--ink); }
.pg-bar .is-delayed span, .cl-tab.is-delayed .cl-bar span, .sec.is-delayed .sec-bar span { background: var(--late); }
@keyframes pg-grow { from { transform: scaleX(0); } }

.pg-facts {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 1.25rem 0 0; overflow: hidden;
  border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--hairline);
}
.pg-facts div { padding: 0.55rem 0.8rem; background: #fff; }
.pg-facts .pg-now { grid-column: 1 / -1; }
.pg-facts dt { font-size: 0.8rem; color: var(--muted); }
.pg-facts dd { margin: 0; font-weight: 600; }

.chip {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.2rem 0.7rem; border-radius: 999px;
  background: var(--stage); color: var(--muted); font-size: 0.8rem; font-weight: 600; white-space: nowrap;
}
.chip::before { content: ""; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: currentColor; }
.chip.is-active, .chip.is-on-track { background: #FBF3E2; color: var(--gold-text); }
.chip.is-done { background: var(--tint); color: var(--ink); }
.chip.is-delayed { background: var(--late-bg); color: var(--late); }

/* One tile per checklist. The selected tile's checklist shows below it. */
.cl-tabs { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 0.5rem; margin: 2rem 0 1.5rem; }
.cl-tab {
  display: flex; flex-direction: column; align-items: stretch; gap: 0.45rem; min-height: 5.75rem; padding: 0.7rem 0.75rem;
  border: 1px solid var(--hairline); border-radius: 10px; background: #fff; color: var(--ink);
  font: inherit; text-align: left; cursor: pointer; transition: border-color 0.2s, box-shadow 0.2s;
}
.cl-tab:hover { border-color: var(--line); }
.cl-tab[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.cl-name { font-size: 0.85rem; font-weight: 600; line-height: 1.2; color: var(--muted); }
.cl-tab[aria-pressed="true"] .cl-name { color: var(--ink); }
.cl-pct { margin-top: auto; font-size: 1.5rem; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.cl-bar { flex: none; height: 4px; }
.cl-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.4rem; }
.cl-head h3 { font-size: 1.125rem; margin: 0; }
.cl-head p { margin: 0; font-size: 0.9rem; color: var(--muted); }

.sections { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--hairline); }
.sec { border-top: 1px solid var(--hairline); }
.sec summary {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 0.45rem 0.75rem;
  padding: 0.85rem 0.25rem 0.85rem 0; cursor: pointer; list-style: none;
}
.sec summary::-webkit-details-marker { display: none; }
.sec summary::after {
  content: ""; grid-area: 1 / 4; width: 0.5rem; height: 0.5rem; margin: 0 0.3rem 0.25rem;
  border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform 0.2s ease-out;
}
.sec[open] summary::after { transform: translate(0, 0.25rem) rotate(-135deg); }
.sec-dot { grid-area: 1 / 1; width: 0.8rem; height: 0.8rem; border: 2px solid var(--line); border-radius: 50%; background: #fff; }
.sec.is-done .sec-dot { border-color: var(--ink); background: var(--ink); }
.sec.is-active .sec-dot { border-color: var(--gold); background: var(--gold-light); box-shadow: 0 0 0 4px rgba(214, 170, 84, 0.22); }
.sec.is-delayed .sec-dot { border-color: var(--late); background: var(--late); box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.14); }
.sec-text { grid-area: 1 / 2; }
.sec-text b { display: block; font-weight: 600; line-height: 1.3; }
.sec-text small { font-size: 0.875rem; color: var(--muted); }
.sec.is-planned .sec-text b { color: var(--muted); }
.sec .chip { grid-area: 1 / 3; }
.sec-bar { grid-area: 2 / 2 / 3 / 5; height: 5px; border-radius: 3px; }

.items { list-style: none; margin: 0 0 1rem 1.55rem; padding: 0; animation: pg-fade 0.25s ease-out; }
.item { display: flex; gap: 0.65rem; padding: 0.45rem 0; }
.tick { position: relative; flex: none; width: 1.1rem; height: 1.1rem; margin-top: 0.12rem; border: 1.5px solid var(--line); border-radius: 50%; }
.item.is-done .tick { border-color: var(--ink); background: var(--ink); }
.item.is-done .tick::after {
  content: ""; position: absolute; left: 0.33rem; top: 0.14rem; width: 0.24rem; height: 0.5rem;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.item-name { display: block; line-height: 1.35; }
.item small { display: block; font-size: 0.8rem; color: var(--muted); }
.item-note { margin: 0.3rem 0 0; padding-left: 0.6rem; border-left: 2px solid var(--gold-light); font-size: 0.9rem; }
@keyframes pg-fade { from { opacity: 0; transform: translateY(-4px); } }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.pg-live { display: flex; align-items: center; gap: 0.55rem; margin: 0.9rem 0 0; font-size: 0.85rem; color: var(--muted); }
.pg-live span { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--live); animation: pg-pulse 2.4s ease-out infinite; }
@keyframes pg-pulse { from { box-shadow: 0 0 0 0 rgba(46, 139, 87, 0.45); } to { box-shadow: 0 0 0 8px rgba(46, 139, 87, 0); } }

@media (prefers-reduced-motion: reduce) {
  .pg-bar span span, .cl-bar span, .sec-bar span, .items, .pg-live span, .sec summary::after { animation: none; transition: none; }
}
