/* Layout: one product shell (top bar + one screen at a time), white surfaces on a
   cool-grey ground, a single blue accent for actions, validated categorical hues
   reserved for the five schedule sources. Light theme by choice. Numbers are from
   the 2026-11-07 build. */
:root {
  --bg: #f5f5f7; --surface: #ffffff; --surface-2: #fafafc;
  --ink: #1d1d1f; --ink-2: #6e6e73; --ink-3: #aeaeb2; --line: #e3e3e8; --line-2: #d2d2d7;
  --accent: #0071e3; --accent-ink: #ffffff; --accent-soft: #e8f1fd;
  --good: #1f8a4c; --warn: #b7791f; --warn-soft: #fff6e5; --bad: #c0392b;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; /* master, OPAL-1, ESI-M4, OSCAT, IRW */
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
  --radius: 18px; --radius-s: 12px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; padding-inline: 24px; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.02em; text-wrap: balance; }
h1 { font-size: 34px; line-height: 1.15; }
h2 { font-size: 22px; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
button { font: inherit; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer; border-radius: 999px;
  padding: 12px 22px; font-weight: 600; font-size: 15px; background: var(--accent); color: var(--accent-ink); transition: transform .12s ease, opacity .12s; }
.btn:hover { opacity: .92; } .btn:active { transform: scale(.98); } .btn:disabled { opacity: .4; cursor: default; }
.btn.secondary { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn:focus-visible, .field input:focus-visible, [contenteditable]:focus-visible, .chip:focus-visible, .mode:focus-visible, .zone:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-block: 12px; background: rgba(245,245,247,.85); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.01em; }
.brand svg { width: 26px; height: 26px; }
.crumbs { display: none; }
.crumbs span { font-size: 12px; color: var(--ink-3); padding: 4px 10px; border-radius: 999px; }
.crumbs span.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.crumbs span.done { color: var(--ink-2); cursor: pointer; }
.crumbs span.done:hover { color: var(--accent); background: var(--surface); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 13px; font-weight: 600; }
.screen { max-width: 1120px; margin: 0 auto; padding-block: 28px 64px; animation: rise .35s ease both; }
.screen:not(.on) { display: none; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .screen, .btn, .node, .mode { animation: none !important; transition: none !important; } }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- login ---------- */
.login { min-height: 70vh; display: grid; place-items: center; }
.login .card { width: min(400px, 100%); padding: 40px 36px 32px; display: grid; gap: 22px; text-align: center; }
.mark-lg svg { width: 56px; height: 56px; }
.field { text-align: left; display: grid; gap: 6px; }
.field label { font-size: 12px; color: var(--ink-2); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.field input { width: 100%; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink); border-radius: var(--radius-s); padding: 12px 14px; font-size: 16px; }
.field input:focus { border-color: var(--accent); outline: none; }

/* ---------- choose ---------- */
.choose { display: grid; gap: 28px; }
.modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 20px; }
.mode { position: relative; padding: 28px 30px; display: flex; align-items: center; gap: 18px; cursor: pointer; border: 2px solid transparent; transition: transform .15s ease, border-color .15s; text-align: left; color: inherit; min-height: 120px; }
.mode:hover { transform: translateY(-2px); border-color: var(--accent); }
.mode.off { cursor: default; opacity: .6; } .mode.off:hover { transform: none; border-color: transparent; }
.mode svg { width: 64px; height: 44px; flex: none; }
.mode h2 { font-size: 24px; }
.badge { position: absolute; top: 18px; right: 18px; font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--bg); padding: 4px 10px; border-radius: 999px; }

/* ---------- create ---------- */
.create { display: grid; gap: 16px; }
.zones { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 20px; align-items: stretch; }
@media (max-width: 820px) { .zones { grid-template-columns: 1fr; } }
.zone { padding: 20px; display: grid; gap: 14px; align-content: start; min-width: 0; border: 2px solid transparent; transition: border-color .15s; }
.zone.over { border-color: var(--accent); }
.zone header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.zone header h2 { font-size: 17px; }
.count { font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--bg); padding: 3px 9px; border-radius: 999px; }
.drop { border: 2px dashed var(--line-2); border-radius: var(--radius-s); display: grid; place-items: center; min-height: 150px; cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover { border-color: var(--accent); background: var(--surface-2); }
.drop .inner { display: flex; align-items: center; gap: 12px; padding: 18px; text-align: left; }
.drop .inner div { display: grid; gap: 2px; }
.drop svg { width: 30px; height: 30px; flex: none; }
.drop strong { font-size: 14px; }
.drop span { font-size: 12px; color: var(--ink-3); }
.zone.master .drop { min-height: 150px; }
.files { display: grid; gap: 10px; }
.file { display: grid; grid-template-columns: 10px 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--radius-s); background: var(--surface-2); border: 1px solid var(--line); min-width: 0; animation: pop .3s ease both; }
.file.master { grid-template-columns: 44px 1fr auto; padding: 16px; }
.file .dot { width: 10px; height: 10px; border-radius: 50%; }
.file .big { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 12px; }
.file .name { display: grid; gap: 2px; min-width: 0; }
.file .name [contenteditable] { font-weight: 600; outline: none; border-bottom: 1px dashed transparent; padding-bottom: 1px; }
.file .name [contenteditable]:hover, .file .name [contenteditable]:focus { border-bottom-color: var(--accent); }
.file .meta { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file .x { border: 0; background: transparent; color: var(--ink-3); cursor: pointer; font-size: 18px; line-height: 1; padding: 4px 6px; border-radius: 50%; }
.file .x:hover { background: var(--bg); color: var(--ink); }
.pill { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); white-space: nowrap; }
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.hub { padding: 10px 18px; }
.hub svg { width: min(100%, 820px); height: auto; display: block; margin: 0 auto; }
.node-label { font-size: 13px; font-weight: 600; fill: var(--ink); }
.node-sub { font-size: 11px; fill: var(--ink-2); }
.spoke { stroke: var(--line-2); stroke-width: 2; fill: none; }
.spoke.linked { stroke: var(--accent); stroke-width: 3; stroke-linecap: round; }
.spoke.none { stroke-dasharray: 4 6; }
.spoke-label { font-size: 11px; font-weight: 600; fill: var(--ink-2); }
.node { animation: pop .4s cubic-bezier(.2,.9,.3,1.3) both; }
.create-actions { display: flex; align-items: center; justify-content: flex-end; gap: 16px; flex-wrap: wrap; }
.progress { display: none; align-items: center; gap: 14px; }
.progress.on { display: flex; }
.progress .step { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-3); }
.progress .step.done { color: var(--good); } .progress .step.on { color: var(--ink); }

/* ---------- results ---------- */
.results { display: grid; gap: 22px; }
.hero { display: grid; gap: 10px; padding: 26px 28px; }
.downloads { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 14px; max-width: 760px; }
.dl { display: flex; align-items: center; gap: 14px; padding: 16px 18px; text-align: left; border: 2px solid transparent; cursor: pointer; color: inherit; transition: border-color .15s, transform .15s; }
.dl:hover { border-color: var(--accent); transform: translateY(-1px); }
.dl svg { width: 36px; height: 36px; flex: none; }
.dl .t { display: grid; gap: 2px; }
.dl strong { font-size: 15px; }
.dl span { font-size: 12px; color: var(--ink-2); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 14px; }
.stat { padding: 18px 20px; display: grid; gap: 4px; }
.stat .v { font-size: 30px; font-weight: 600; letter-spacing: -0.03em; }
.stat .l { font-size: 13px; color: var(--ink-2); }
.stat .d { font-size: 12px; color: var(--ink-3); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 7px 12px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); border: 0; color: var(--ink); cursor: pointer; }
.chip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--ink-3); }
.chip.warn i { background: var(--warn); }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 16px; }
.chart { padding: 20px 20px 16px; display: grid; gap: 12px; min-width: 0; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.bar { rx: 3; }
.grid-line { stroke: var(--line); stroke-width: 1; }
.axis-label { font-size: 14px; fill: var(--ink-2); }
.val-label { font-size: 14px; font-weight: 600; fill: var(--ink); }
.tip { position: fixed; z-index: 20; pointer-events: none; background: var(--ink); color: var(--surface); font-size: 12px; padding: 6px 10px; border-radius: 8px; opacity: 0; transition: opacity .1s; white-space: nowrap; }
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { font-weight: 600; color: var(--ink-2); font-size: 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.toggle { display: inline-flex; background: var(--bg); border-radius: 999px; padding: 3px; }
.toggle button { border: 0; background: transparent; color: var(--ink-2); padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer; }
.toggle button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- app-only additions ---------- */
.err { color: var(--bad); font-size: 13px; min-height: 1.2em; }
.file .hubmark { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); display: inline-block; margin-left: 6px; vertical-align: middle; }
.file.hub-warn { border-color: var(--warn); }
.spin { width: 16px; height: 16px; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.project-id { display: flex; align-items: center; gap: 8px; }
.project-id input { border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 10px 14px; font: inherit; font-weight: 600; width: 220px; }
.project-id input:focus { outline: none; border-color: var(--accent); }
.create-actions { justify-content: space-between; }
.dl[aria-disabled="true"] { opacity: .4; pointer-events: none; }
.hero .err { margin-top: 4px; }
.ledger { display: grid; gap: 10px; }
.ledger details { background: var(--surface); border-radius: var(--radius-s); box-shadow: var(--shadow); padding: 12px 16px; }
.ledger summary { cursor: pointer; font-weight: 600; font-size: 14px; list-style: none; display: flex; justify-content: space-between; }
.ledger summary::-webkit-details-marker { display: none; }
.ledger summary .n { color: var(--ink-2); font-weight: 500; }
.ledger .body { margin-top: 10px; display: grid; gap: 6px; font-size: 13px; color: var(--ink-2); }
.ledger .body b { color: var(--ink); font-weight: 600; }
.topbar .right { display: flex; align-items: center; gap: 10px; }
.btn.small { padding: 7px 14px; font-size: 13px; }
a.dl, a.dl:hover { text-decoration: none; color: inherit; }
.file.warn { border-color: var(--bad); }
.file .meta.err { color: var(--bad); white-space: normal; }
.file .x:disabled { opacity: .3; cursor: default; }
@media (max-width: 560px) { .crumbs { display: none; } .topbar { gap: 8px; } h1 { font-size: 26px; } .create-actions { flex-direction: column; align-items: stretch; } .project-id input { width: 100%; } .btn#buildBtn { width: 100%; } }
[hidden] { display: none !important; }
.projpick { margin-top: 6px; font: inherit; font-size: 12px; font-weight: 600; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: 999px; padding: 4px 10px; max-width: 100%; }
.projpick:focus { outline: none; border-color: var(--accent); }
