:root {
  --bg: #faf7f5; --panel: #ffffff; --text: #221f1e; --muted: #6b6461; --line: #e4ddd9;
  --brand: #5b0f0f; --brand-ink: #ffffff; --brand-soft: #f6eaea;
  --ok-bg: #e6f4ea; --ok-ink: #1e5631; --busy-bg: #fff6d6; --busy-ink: #5c4a00; --bad-bg: #fce8e6; --bad-ink: #8a1c13;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171414; --panel: #221e1d; --text: #eeeae8; --muted: #a8a09c; --line: #3a3331;
    --brand: #c9706b; --brand-ink: #1a0b0b; --brand-soft: #3a2422;
    --ok-bg: #1f3a28; --ok-ink: #b8e6c6; --busy-bg: #3d3416; --busy-ink: #f3e3a8; --bad-bg: #4a2420; --bad-ink: #ffcdc6;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #171414; --panel: #221e1d; --text: #eeeae8; --muted: #a8a09c; --line: #3a3331;
  --brand: #c9706b; --brand-ink: #1a0b0b; --brand-soft: #3a2422;
  --ok-bg: #1f3a28; --ok-ink: #b8e6c6; --busy-bg: #3d3416; --busy-ink: #f3e3a8; --bad-bg: #4a2420; --bad-ink: #ffcdc6;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
a { color: var(--brand); }
code { background: var(--brand-soft); padding: 1px 5px; border-radius: 4px; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 .5rem; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 .5rem; }
.muted { color: var(--muted); } .small { font-size: .875rem; }

.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; background: var(--brand); color: var(--brand-ink); }
.brand { font-weight: 700; font-size: 1.1rem; }
.who { font-size: .9rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.who .link { color: var(--brand-ink); }
main { max-width: 880px; margin: 0 auto; padding: 24px 16px 40px; }
.foot { max-width: 880px; margin: 0 auto; padding: 0 16px 32px; color: var(--muted); font-size: .85rem; }

button, .btn { font: inherit; cursor: pointer; border-radius: 8px; }
button:disabled { opacity: .55; cursor: default; }
.primary, .secondary, .btn { border: 1px solid var(--brand); padding: 10px 16px; text-decoration: none; display: inline-block; text-align: center; }
.primary { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
.secondary, .btn { background: var(--panel); color: var(--brand); }
.big { font-size: 1.1rem; padding: 14px 22px; margin: 8px 0 16px; }
.link { background: none; border: 0; padding: 0; text-decoration: underline; color: var(--brand); }
button:focus-visible, .btn:focus-visible, .card-btn:focus-within, a:focus-visible { outline: 3px solid #f2b705; outline-offset: 2px; }

.lead { font-size: 1.1rem; max-width: 60ch; }
.facts { padding-left: 1.2rem; color: var(--muted); max-width: 62ch; }
.facts li { margin: .35rem 0; }

.cards { display: grid; gap: 12px; }
.cards.three { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.card-btn { display: flex; flex-direction: column; gap: 6px; text-align: left; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; cursor: pointer; }
.card-btn:hover { border-color: var(--brand); }
.card-btn b { color: var(--brand); font-size: 1.05rem; }
.card-btn span { color: var(--muted); font-size: .92rem; }

.recent { list-style: none; padding: 0; margin: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.recent li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); }
.recent li:first-child { border-top: 0; }
.recent .open { background: none; border: 0; color: var(--brand); font-weight: 600; text-align: left; padding: 0; overflow-wrap: anywhere; }
.recent .forget { background: none; border: 0; color: var(--muted); font-size: .85rem; }
.how, .more { margin-top: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 16px; }
.how summary, .more summary { cursor: pointer; font-weight: 600; color: var(--brand); }
.morebtns { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0 6px; }

.showbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.showname { margin: 0; overflow-wrap: anywhere; }
.showlinks { display: flex; gap: 8px; flex-wrap: wrap; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.step { display: flex; justify-content: space-between; align-items: center; gap: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.step b { display: block; }
.step span { color: var(--muted); font-size: .92rem; display: block; }
.step > button { min-width: 210px; }
.check { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; font-size: .92rem; }
.check input { margin-top: 4px; }
@media (max-width: 640px) {
  .step { flex-direction: column; align-items: stretch; }
  .step > button { min-width: 0; width: 100%; }
}

.status { margin: 16px 0; padding: 12px 14px; border-radius: var(--radius); white-space: pre-wrap; }
.status.busy { background: var(--busy-bg); color: var(--busy-ink); }
.status.ok { background: var(--ok-bg); color: var(--ok-ink); }
.status.bad { background: var(--bad-bg); color: var(--bad-ink); }
.status .spin { display: inline-block; width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 1s linear infinite; vertical-align: -2px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .status .spin { animation: none; } }

#results .box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin: 12px 0; }
#results h3 { margin: 0 0 8px; font-size: 1rem; }
#results table { border-collapse: collapse; width: 100%; }
#results td { padding: 5px 6px; border-top: 1px solid var(--line); vertical-align: top; }
#results td.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
#results .items { list-style: none; padding: 0; margin: 0; }
#results .items li { padding: 8px 0; border-top: 1px solid var(--line); }
#results .items li:first-child { border-top: 0; }
#results .fix { color: var(--muted); font-size: .92rem; }
#results .changes { max-height: 260px; overflow: auto; font-size: .92rem; }
#results .links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 0; max-width: min(560px, calc(100vw - 32px)); width: 100%; background: var(--panel); color: var(--text); }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog form { padding: 18px 20px; margin: 0; }
dialog h2 { margin: 0 0 10px; }
.dlgbtns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
dialog input[type=text] { width: 100%; font: inherit; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); }
.locklist { max-height: 50vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; }
.locklist label { display: flex; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.locklist label:first-child { border-top: 0; }

/* ---------------------------------------------------------------- AWS version additions */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.narrow { max-width: 460px; display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.narrow input { font: inherit; font-size: 1.1rem; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); }
#inCode { letter-spacing: .3em; font-variant-numeric: tabular-nums; }
.narrow .big { margin: 4px 0 0; }
.danger { color: #a3261b; border-color: #a3261b; }
.filebtn { cursor: pointer; display: inline-block; }
.filebtn.disabled, .card-btn.disabled { opacity: .55; pointer-events: none; }
.stepbtns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.stepbtns > * { min-width: 170px; }
@media (max-width: 640px) { .stepbtns { justify-content: stretch; } .stepbtns > * { flex: 1 1 100%; } }
.recent .meta { display: block; }

.tabs { display: flex; gap: 4px; margin: 28px 0 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { background: none; border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0; padding: 9px 14px; color: var(--muted); white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--panel); border-color: var(--line); color: var(--brand); font-weight: 600; margin-bottom: -1px; }
.tabpanel { background: var(--panel); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); padding: 14px; min-height: 80px; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); margin: 0 0 10px; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 5px; border: 1px solid rgba(0,0,0,.15); }
.gridwrap { overflow: auto; max-height: 75vh; border: 1px solid var(--line); border-radius: 8px; }
table.grid { border-collapse: separate; border-spacing: 0; font-size: .86rem; }
table.grid th, table.grid td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px 6px; vertical-align: top; background: var(--panel); }
table.grid thead th { position: sticky; top: 0; z-index: 2; background: var(--brand); color: var(--brand-ink); font-weight: 600; white-space: pre-line; min-width: 158px; text-align: left; line-height: 1.3; }
table.grid th.role { position: sticky; left: 0; z-index: 1; min-width: 170px; max-width: 220px; text-align: left; font-weight: 600; }
table.grid thead th.role { z-index: 3; }
table.grid td { min-width: 158px; }
table.grid select { width: 100%; font: inherit; font-size: .86rem; padding: 3px 4px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: inherit; }
table.grid select:hover, table.grid select:focus { border-color: var(--brand); background: rgba(255,255,255,.7); }
table.grid td.locked select { font-weight: 600; }
table.grid td .note { display: block; font-size: .75rem; color: #5c1a12; margin-top: 2px; line-height: 1.25; }
table.grid td.c-locked { background: #fff2cc; }
table.grid td.c-gap { background: #f4cccc; }
table.grid td.c-bad { background: #ea9999; }
table.grid td.c-band { background: #f3f6fb; }
table.grid td.c-locked, table.grid td.c-gap, table.grid td.c-bad, table.grid td.c-band, table.grid td.c-locked select, table.grid td.c-gap select, table.grid td.c-bad select, table.grid td.c-band select { color: #221f1e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) table.grid td.c-band { background: #2b2a33; color: inherit; } :root:not([data-theme="light"]) table.grid td.c-band select { color: inherit; } }
.cellnote { margin-top: 10px; font-size: .9rem; min-height: 1.4em; }
table.simple { border-collapse: collapse; width: 100%; font-size: .9rem; }
table.simple th, table.simple td { border-bottom: 1px solid var(--line); padding: 6px; text-align: left; vertical-align: top; white-space: pre-line; }
.email { border-top: 1px solid var(--line); padding: 10px 0; }
.email:first-child { border-top: 0; }
.email pre { white-space: pre-wrap; font: inherit; font-size: .9rem; background: var(--bg); padding: 8px 10px; border-radius: 6px; margin: 6px 0; max-height: 220px; overflow: auto; }
.email .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.versions li { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line); }
.versions { list-style: none; padding: 0; margin: 0; max-height: 50vh; overflow: auto; }
.diffs { max-height: 40vh; overflow: auto; font-size: .9rem; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.primary.danger-fill { background: #a3261b; border-color: #a3261b; color: #fff; }
.step.next { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.btn.small { padding: 5px 10px; }

/* ---------------------------------------------------------------- schedule viewing controls */
#tab-schedule { --gz: 1; }
.gridbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 10px; }
.gridbar .zoomgroup { display: inline-flex; gap: 4px; align-items: center; }
.gridbar .zoomval { min-width: 3.2em; text-align: center; font-variant-numeric: tabular-nums; font-size: .9rem; }
.gridbar .btn-dl { margin-left: auto; }
table.grid { font-size: calc(.86rem * var(--gz)); }
table.grid th, table.grid td { padding: calc(4px * var(--gz)) calc(6px * var(--gz)); }
table.grid thead th, table.grid td { min-width: calc(158px * var(--gz)); }
table.grid th.role { min-width: calc(170px * var(--gz)); max-width: calc(220px * var(--gz)); }
table.grid select { font-size: inherit; padding: calc(3px * var(--gz)) calc(4px * var(--gz)); }
table.grid td .note { font-size: .87em; }
.compact table.grid td .note { display: none; }
.compact table.grid thead th { line-height: 1.15; }
/* full screen: the schedule takes the whole window */
#tab-schedule.gridfull { position: fixed; inset: 0; z-index: 60; margin: 0; border: 0; border-radius: 0; padding: 12px 14px 8px; display: flex; flex-direction: column; background: var(--panel); }
#tab-schedule.gridfull .gridwrap { flex: 1 1 auto; max-height: none; min-height: 0; }
#tab-schedule.gridfull .cellnote { flex: 0 0 auto; margin-top: 6px; }
#tab-schedule:fullscreen { background: var(--panel); }
body.grid-is-full { overflow: hidden; }
@media (max-width: 640px) { .gridbar .btn-dl { margin-left: 0; } }

/* ---------------------------------------------------------------- full notes on hover */
table.grid td.has-note { position: relative; }
table.grid td.has-note::after { content: ''; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 9px 9px 0; border-color: transparent #b3261e transparent transparent; pointer-events: none; }
.gridtip { position: fixed; z-index: 80; background: #2b2523; color: #fbf7f5; border-radius: 8px; padding: 9px 11px; font-size: .86rem; line-height: 1.4; box-shadow: 0 6px 22px rgba(0,0,0,.28); max-height: 55vh; overflow: auto; white-space: pre-line; pointer-events: none; }
.gridtip b { display: block; margin-bottom: 4px; color: #ffd9b3; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .gridtip { background: #f3eeeb; color: #221f1e; } :root:not([data-theme="light"]) .gridtip b { color: #7a1f14; } }
