:root {
  color-scheme: light;
  font: 15px/1.5 system-ui, sans-serif;
  --ink: #1e2739;
  --muted: #545e71;
  --line: #dce2eb;
  --paper: #fff;
  --back: #f4f6fa;
  --accent: #3449ae;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--back); color: var(--ink); }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { border: 1px solid var(--line); border-radius: 7px; padding: .5rem .8rem; background: white; cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .4; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.primary { background: var(--accent); color: white; border-color: var(--accent); }
.quiet { background: transparent; }
.danger { color: #9b263d; }
a { color: var(--accent); }
.topbar { display: flex; justify-content: space-between; align-items: center; background: white; border-bottom: 1px solid var(--line); padding: .85rem max(1rem, 4vw); }
.brand { display: inline-flex; gap: .65rem; align-items: center; color: var(--ink); font-weight: 700; text-decoration: none; }
.brand-icon { display: grid; place-items: center; color: white; background: var(--accent); border-radius: 7px; width: 29px; height: 29px; }
main { padding: clamp(1rem, 4vw, 3.5rem); }
.heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.65rem, 3.5vw, 2.35rem); letter-spacing: -.04em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 .55rem; }
.heading p, .muted, small { color: var(--muted); }
.actions, .legend { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; }
.matrix { overflow: auto; max-height: 70vh; border: 1px solid var(--line); border-radius: 13px; background: white; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { padding: .95rem .8rem; text-align: left; border-bottom: 1px solid var(--line); background: white; }
tbody tr:last-child > * { border-bottom: 0; }
thead th { position: sticky; top: 0; z-index: 2; vertical-align: top; background: #f9fafc; }
.project-column { position: sticky; left: 0; z-index: 1; width: clamp(150px, 17vw, 235px); min-width: clamp(150px, 17vw, 235px); max-width: 235px; border-right: 1px solid var(--line); overflow-wrap: anywhere; }
thead .project-column { z-index: 3; }
.project-name { border: 0; padding: 0; text-align: left; font-weight: 750; background: transparent; }
.project-name:hover { text-decoration: underline; }
.project-column small { display: block; font-weight: 400; margin-top: .25rem; }
.blocked { display: inline-block; margin-left: .4rem; border-radius: 4px; padding: .05rem .3rem; font-size: .72rem; color: #842539; background: #ffedf0; }
.stage { border-right: 1px solid var(--line); }
.stage:last-child { border-right: 0; }
.draft { --stage: #647084; --pale: #e9edf4; }
.build { --stage: #f3c54d; --pale: #fff6d8; }
.live { --stage: #20835c; --pale: #e4f5ec; }
.stage-toggle { display: flex; align-items: center; gap: .5rem; text-align: left; white-space: nowrap; border: none; padding: 0; background: transparent; font-weight: 700; }
.stage-toggle:hover { text-decoration: underline; }
.dot { display: inline-block; width: .65rem; height: .65rem; border-radius: 50%; background: var(--stage); }
.squares { display: grid; grid-auto-flow: column; grid-auto-columns: 24px; align-items: center; width: max-content; gap: 3px; }
.squares .count { width: max-content; font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.stage td, td.stage { padding-right: 1.55rem; }
.square { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border-radius: 5px; font-size: .76rem; border: 1px solid #aab4c5; background: white; }
.square.complete { background: var(--stage); border-color: var(--stage); color: white; }
.build .square.complete { color: #412c00; }
.square.na { background: #edf0f4; color: #586477; border-color: #dce2eb; }
.square.next { outline: 2px solid var(--accent); outline-offset: 1px; }
.current { box-shadow: inset 0 -3px var(--stage); background: var(--pale); }
.matrix:has(.draft.expanded) .draft .squares,
.matrix:has(.build.expanded) .build .squares,
.matrix:has(.live.expanded) .live .squares { grid-auto-columns: 105px; }
.labels { margin-top: .75rem; align-items: start; font-size: .76rem; color: var(--muted); }
.labels span { padding-right: .45rem; overflow-wrap: anywhere; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }
.legend { margin-top: .85rem; gap: .5rem 1.15rem; font-size: .8rem; color: var(--muted); }
.login { margin: 9vh auto; max-width: 390px; padding: 1.6rem; background: white; border: 1px solid var(--line); border-radius: 13px; }
label { display: grid; gap: .35rem; margin: .7rem 0; }
input, select, textarea { width: 100%; min-width: 0; padding: .45rem .55rem; border: 1px solid #b9c4d4; border-radius: 6px; background: white; }
input[type="checkbox"] { width: auto; }
textarea { resize: vertical; }
dialog { width: min(820px, calc(100% - 1.5rem)); max-height: 90vh; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); padding: 0; }
dialog::backdrop { background: #18223885; }
.editor-header { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: .7rem; background: white; border-bottom: 1px solid var(--line); padding: .75rem 1.1rem; }
.editor-body { padding: 1rem 1.1rem; }
.error { color: #9b263d; margin-top: .55rem; }
.error:empty { display: none; }
.check { display: flex; align-items: center; gap: .5rem; }
.form-grid { display: grid; grid-template-columns: 2fr 1fr; gap: .75rem; }
.step-row, .task-row, .link-row { display: flex; gap: .35rem; align-items: center; margin-bottom: .45rem; }
.step-row select, .task-row select, .link-row select { flex: 0 1 185px; }
.archive-row, .checklist-row { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin: .55rem 0; }
.checklist-row select { width: min(42%, 180px); }
.template-group, details { padding: .65rem 0; border-bottom: 1px solid var(--line); }
.template-group h3 { margin-top: .4rem; }
summary { cursor: pointer; }
footer { display: flex; justify-content: flex-end; gap: .55rem; margin-top: 1.25rem; }
.linked-task { padding: .3rem 0; }
.linked-task small { margin-left: .5rem; }
#notice { position: fixed; right: 1rem; bottom: 1rem; background: var(--ink); color: white; padding: .5rem .8rem; border-radius: 6px; }
#notice:empty { display: none; }
@media (max-width: 650px) {
  .form-grid { grid-template-columns: 1fr; gap: 0; }
  .step-row, .task-row, .link-row { flex-wrap: wrap; padding: .4rem 0; border-bottom: 1px solid var(--line); }
  .squares { grid-auto-columns: 30px; }
  .square { width: 29px; height: 29px; }
}
