:root {
  color: #10233d;
  background: #f4f7fb;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  --ink: #102b3f;
  --muted: #5c6f86;
  --line: #dce5eb;
  --paper: #fff;
  --navy: #071a2b;
  --blue: #087f9c;
  --teal: #12a6c7;
  --teal-dark: #087f9c;
  --amber: #986000;
  --red: #b52b39;
  --shadow: 0 18px 48px rgba(21, 45, 77, .08);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: linear-gradient(180deg, #eef4fa 0, #f7f9fc 420px); color: var(--ink); }
body, button, input, select, code, td, dd { overflow-wrap: anywhere; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
a { color: inherit; }
:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 6px #005fcc; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; padding: .8rem 1rem; border-radius: .5rem; background: #fff; }
.skip-link:focus { top: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.shell-header { position: sticky; top: 0; z-index: 20; min-height: 78px; padding: 0 clamp(1rem, 4vw, 4.5rem); display: grid; grid-template-columns: minmax(150px, .8fr) minmax(0, 2fr) minmax(110px, .6fr); align-items: center; gap: 2rem; color: #fff; background: radial-gradient(circle at 88% -110%, rgba(18,166,199,.25), transparent 31rem), var(--navy); border-bottom: 1px solid rgba(140,206,230,.16); box-shadow: 0 6px 22px rgba(7,26,43,.12); }
.brand { display: inline-flex; align-items: center; gap: .75rem; text-decoration: none; justify-self: start; }
nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; gap: clamp(.5rem, 2vw, 1.75rem); }
.nav-step { display: flex; min-width: 0; min-height: 48px; gap: .6rem; align-items: center; justify-content: center; padding: .85rem 1.2rem; border: 1px solid transparent; border-radius: 999px; background: transparent; color: #c4d5e3; font-weight: 650; line-height: 1.4; }
.nav-step span { font-size: .68rem; color: #6ed0e5; }
.nav-step.is-active { color: #9beaf6; border-color: rgba(110,208,229,.65); background: transparent; }
.nav-step:not(:disabled):hover { border-color: rgba(110,208,229,.4); }
.connection { justify-self: end; display: flex; align-items: center; gap: .6rem; color: #c4d5e3; font-size: .75rem; }
.connection span { width: .55rem; height: .55rem; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 .25rem rgba(0,168,149,.13); }
main { min-height: calc(100vh - 130px); }
.screen { max-width: 1440px; margin: 0 auto; padding: clamp(2rem, 5vw, 4.6rem) clamp(1rem, 4vw, 4.5rem) 4rem; }
.screen[hidden] { display: none !important; }
.section-header { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(270px, .65fr); gap: 3rem; align-items: end; margin-bottom: 2.2rem; }
.hero-grid { display: block; margin-bottom: 2.2rem; }
#screen-plano > .section-header { grid-template-columns: 1fr; }
.eyebrow, .step-label { margin: 0 0 .7rem; color: var(--teal-dark); font-weight: 800; font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; }
h1 { margin: 0; max-width: 840px; color: var(--navy); font-size: clamp(2.2rem, 5vw, 4.6rem); line-height: .98; letter-spacing: -.055em; }
.lead { max-width: 740px; margin: 1.25rem 0 0; color: var(--muted); font-size: clamp(1rem, 1.4vw, 1.2rem); line-height: 1.6; }
h2 { margin: 0; font-size: 1.25rem; letter-spacing: -.02em; }
.brand-logo { display: block; width: 182px; height: 64px; object-fit: contain; object-position: left center; }
.deployment-logo { display: block; max-width: 80px; max-height: 38px; object-fit: contain; }
.maestro-avatar { width: 110px; height: 110px; object-fit: contain; justify-self: end; padding: 14px; border-radius: 24px; background: var(--navy); }
.sample-notice { margin: 0 0 1.25rem; }
.workspace-grid, .result-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 1.25rem; align-items: start; }
.panel { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 1rem; padding: clamp(1.1rem, 2vw, 1.7rem); box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.calendar-panel .status-pill, .upload-panel .status-pill { flex-shrink: 0; white-space: nowrap; }
.status-pill { display: inline-flex; padding: .36rem .65rem; border-radius: 999px; color: var(--amber); background: #fff3d4; font-weight: 750; font-size: .7rem; }
.status-pill.neutral { color: #42617f; background: #edf3f8; }
.status-pill.success { color: #006f61; background: #daf5ef; }
.drop-zone { min-height: 190px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .45rem; border: 1.5px dashed #8fa7bf; border-radius: .8rem; color: var(--muted); background: #f8fbfe; text-align: center; transition: border-color .18s, background .18s; }
.drop-zone.is-over { border-color: var(--teal); background: #eafaf7; }
.drop-zone:focus-within { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 6px #005fcc; border-color: var(--teal); }
.drop-zone input { position: absolute; width: 1px; height: 1px; clip: rect(0,0,0,0); }
.drop-zone strong { color: var(--navy); font-size: 1rem; }
.drop-zone span:last-child { font-size: .78rem; }
.upload-icon { display: grid; place-items: center; width: 2.7rem; height: 2.7rem; border-radius: 50%; background: #e8f0fb; color: var(--blue); font-size: 1.35rem; }
.button-row { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1rem; }
.button { border: 1px solid transparent; border-radius: .58rem; padding: .76rem 1rem; font-weight: 750; transition: transform .12s, background .15s; }
.button:not(:disabled):active { transform: translateY(1px); }
.button.primary { background: var(--navy); color: #fff; }
.button.primary:hover { background: #1b4777; }
.button.secondary { color: var(--navy); border-color: #a9bbcf; background: #fff; }
.button.ghost { color: var(--muted); background: transparent; }
.button.danger { color: var(--red); border-color: #efb8bd; background: #fff; }
.button.full { width: 100%; margin-top: 1.25rem; display: flex; justify-content: space-between; }
.notice { padding: .65rem .8rem; border-radius: .45rem; font-size: .76rem; }
.notice.warning { color: #754a00; background: #fff6df; }
.preview-summary, .metric-strip { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: .8rem; }
.preview-summary span, .metric-strip div { padding: .55rem .7rem; border-radius: .45rem; background: #edf3f8; font-size: .72rem; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .78rem; }
caption { text-align: left; padding: 0 0 .6rem; color: var(--muted); font-size: .7rem; }
th { padding: .72rem .65rem; color: #425b73; background: #edf3f8; text-align: left; white-space: nowrap; }
td { padding: .72rem .65rem; border-bottom: 1px solid #e7edf4; vertical-align: top; }
tbody tr:hover { background: #f8fbfe; }
.field-grid { display: grid; gap: .85rem; }
label > span { display: block; margin-bottom: .32rem; color: #425b73; font-size: .76rem; font-weight: 700; }
input, select { width: 100%; min-height: 43px; border: 1px solid #aabccc; border-radius: .5rem; padding: .65rem .75rem; color: var(--ink); background: #fff; }
.calendar-line { display: grid; grid-template-columns: 1fr 2rem 1fr; align-items: center; gap: .5rem; margin: 1.2rem 0; }
.calendar-line div { padding: .8rem; border-radius: .5rem; background: #edf3f8; }
.calendar-line span { display: block; color: var(--muted); font-size: .68rem; }
.calendar-line i { height: 1px; background: #9bb0c5; }
details { border-top: 1px solid var(--line); padding-top: 1rem; }
summary { color: var(--navy); font-size: .8rem; font-weight: 750; cursor: pointer; }
details ul { padding-left: 1.2rem; color: var(--muted); font-size: .77rem; line-height: 1.55; }
.run-panel, .authoritative { margin-top: 1.25rem; padding: 1.1rem 1.3rem; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; background: var(--navy); border-radius: 1rem; color: #fff; }
.run-panel > div:first-child { display: flex; align-items: center; gap: 1rem; }
.run-panel h2, .run-panel p { margin: 0; }
.run-panel p { margin-top: .25rem; color: #b9cbe0; font-size: .8rem; }
.spinner { width: 2rem; height: 2rem; border: 3px solid rgba(255,255,255,.22); border-top-color: #fff; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.run-time { text-align: right; }
.run-time span, .run-time small { display: block; color: #b9cbe0; font-size: .67rem; }
.run-time strong { display: block; font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.authoritative { background: #e8f8f4; color: var(--ink); border: 1px solid #93d6ca; }
.authoritative p:not(.step-label) { max-width: 520px; margin: .45rem 0 0; color: #425b73; font-size: .76rem; }
.attempt-actions { margin-top: 1.25rem; border-color: #efb8bd; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.attempt-actions p:not(.step-label) { margin: .45rem 0 0; color: var(--muted); font-size: .78rem; }
.section-header h1 { font-size: clamp(2.2rem, 4.5vw, 4.1rem); }
.kpi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; margin-bottom: 1.25rem; }
.kpi { min-width: 0; padding: 1.4rem; border-radius: 1rem; border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); }
.shift-kpi-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.3rem; padding-bottom: .85rem; border-bottom: 1px solid var(--line); }
.shift-kpi-heading h2 { color: var(--navy); font-size: 1.15rem; }
.shift-kpi-window { color: var(--muted); font-size: .8rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.shift-kpi-values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.35rem 1rem; margin: 0; }
.shift-kpi-values dt { color: var(--muted); font-size: .74rem; }
.shift-kpi-values dd { margin: 0; }
.shift-kpi-values strong { display: block; margin: .45rem 0 .3rem; color: var(--navy); font-size: clamp(1.45rem, 2vw, 1.8rem); letter-spacing: -.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.shift-kpi-values small { display: block; color: #62798f; font-size: .68rem; line-height: 1.45; }
.result-grid { margin-bottom: 1.25rem; }
.context-note { margin: 1rem 0 0; color: var(--muted); font-size: .75rem; }
.completion-progress { width: 100%; height: 18px; margin: 2rem 0 .6rem; border: 0; border-radius: 999px; overflow: hidden; background: #e4ebf3; }
.completion-progress::-webkit-progress-bar { background: #e4ebf3; }
.completion-progress::-webkit-progress-value { background: linear-gradient(90deg, var(--teal), var(--blue)); }
.completion-progress::-moz-progress-bar { background: var(--teal-dark); }
#completion-caption { color: var(--muted); font-size: .74rem; }
.detail-list { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: .55rem 1rem; margin: 1rem 0 0; font-size: .76rem; }
.detail-list div { display: contents; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; font-weight: 750; text-align: right; overflow-wrap: anywhere; }
.filter-row { display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.timeline { padding: .9rem; margin-bottom: 1rem; border-radius: .55rem; background: #edf3f8; }
.timeline-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-bottom: .8rem; }
.timeline-legend { display: flex; flex-wrap: wrap; gap: .7rem 1.2rem; margin: .8rem 0 1rem; font-size: .72rem; color: var(--muted); }
.timeline-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.timeline-legend i { display: inline-block; width: .7rem; height: .7rem; border-radius: 2px; }
.timeline-legend i[data-kind="work"] { background: #154875; }
.timeline-legend i[data-kind="congestion"] { background: var(--amber); }
.timeline-legend i[data-kind="transport"] { background: var(--teal); }
.timeline-legend i[data-kind="empty"] { background: #dfe8f2; border: 1px solid #c7d4e2; }
.timeline-axis, .timeline-lane { display: grid; grid-template-columns: minmax(0, 24%) minmax(0, 1fr); column-gap: .75rem; align-items: center; }
.timeline-axis { margin-bottom: .7rem; color: var(--muted); font-size: .68rem; }
.timeline-axis > div { position: relative; height: 1.3rem; }
.timeline-axis > div > span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.timeline-axis > div > span:first-child { transform: none; }
.timeline-axis > div > span:last-child { transform: translateX(-100%); }
.timeline-lane { min-height: 32px; margin: .35rem 0; }
.timeline-resource { font-size: .7rem; font-weight: 650; overflow-wrap: anywhere; }
.timeline-rail { position: relative; min-height: 26px; border-radius: 3px; background: repeating-linear-gradient(to right, transparent 0, transparent calc(12.5% - 1px), #c7d4e2 calc(12.5% - 1px), #c7d4e2 12.5%), #dfe8f2; }
.timeline-event { display: block; position: absolute; top: 2px; height: 22px; border-radius: 2px; background: #154875; }
.timeline-event[data-kind="congestion"] { background: var(--amber); }
.timeline-event[data-kind="transport"] { background: var(--teal); }
.event-detail-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-top: 1px solid var(--line); margin-top: 1.5rem; padding-top: 1rem; }
.event-detail-heading h3 { margin: 0; font-size: .95rem; }
@media (max-width: 700px) { .timeline-controls { grid-template-columns: 1fr; } .timeline-axis > div > span:nth-child(even) { visibility: hidden; } }

.row-plan-card { margin-top: 1.25rem; }
.completion-entities { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-top: 1.25rem; }
.entity-card { min-width: 0; }
.entity-card .panel-heading { align-items: center; }
.entity-card td:first-child, .entity-card td:nth-child(2) { max-width: 16rem; }
.downloads { margin-top: 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.downloads p:not(.step-label) { margin-bottom: 0; color: var(--muted); font-size: .8rem; }
.maestro-header { align-items: center; }
.explanation-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.explanation-lead { grid-column: 1 / -1; padding: 2rem; border-radius: 1rem; color: #fff; background: var(--navy); }
.explanation-lead h2 { font-size: 2rem; }
.explanation-lead p:last-child { max-width: 900px; color: #c7d5e5; line-height: 1.6; }
.explanation-card { position: relative; min-height: 220px; }
.explanation-card h2 { padding-right: 3rem; }
.explanation-card ul { padding-left: 1.15rem; color: var(--muted); line-height: 1.65; }
.card-index { position: absolute; top: 1.2rem; right: 1.2rem; color: #52677d; font-size: .7rem; font-weight: 800; }
.validation-seal { margin-top: 1rem; display: flex; align-items: center; gap: 1rem; padding: 1.2rem 1.4rem; border: 1px solid #93d6ca; border-radius: .8rem; background: #e8f8f4; }
.validation-seal > span { display: grid; place-items: center; width: 2.3rem; height: 2.3rem; border-radius: 50%; background: var(--teal-dark); color: #fff; }
.validation-seal p { margin: .25rem 0 0; color: var(--muted); font-size: .8rem; }
.toast { position: fixed; z-index: 50; right: 1rem; bottom: 1rem; max-width: min(430px, calc(100vw - 2rem)); display: flex; gap: 1rem; align-items: start; padding: 1rem 1.1rem; border-radius: .7rem; color: #fff; background: #9d2531; box-shadow: 0 18px 60px rgba(50,0,0,.25); }
.toast p { margin: 0; line-height: 1.45; }
.toast button { border: 0; color: #fff; background: transparent; font-size: 1.2rem; }
footer { min-height: 52px; padding: 0 clamp(1rem,4vw,4.5rem); display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); color: var(--muted); font-size: .7rem; }
@media (max-width: 980px) {
  .shell-header { grid-template-columns: 1fr auto; }
  .shell-header nav { order: 3; grid-column: 1 / -1; justify-content: center; overflow-x: auto; }
  .connection { grid-column: 2; grid-row: 1; }
  .hero-grid, .section-header, .workspace-grid, .result-grid, .completion-entities { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-row { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
}
@media (max-width: 620px) {
  .shell-header { padding: .8rem 1rem 0; }
  .connection { display: none; }
  .nav-step { padding: .6rem .35rem; gap: .35rem; font-size: .72rem; }
  .screen { padding-top: 2.2rem; }
  h1 { font-size: 2.45rem; }
  .run-panel, .authoritative, .attempt-actions, .downloads { align-items: stretch; flex-direction: column; }
  .run-time { text-align: left; }
  .kpi-grid, .explanation-grid { grid-template-columns: 1fr; }
  .explanation-lead { grid-column: auto; }
  .filter-row { grid-template-columns: 1fr; }
  footer { align-items: start; gap: .3rem; flex-direction: column; padding-top: 1rem; padding-bottom: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.agent-chat { margin-bottom: 1.3rem; }
.agent-history { min-height: 220px; max-height: min(60vh, 640px); overflow-y: auto; padding: .25rem .4rem .8rem 0; scroll-behavior: smooth; }
.agent-empty { display: grid; align-content: center; min-height: 210px; max-width: 650px; margin: 0 auto; padding: 1.4rem; text-align: center; }
.agent-empty h3 { margin: 0 0 .65rem; color: var(--navy); font-size: 1.4rem; }
.agent-empty p { margin: 0; color: var(--muted); line-height: 1.6; }
.agent-exchange { display: grid; gap: .85rem; margin-bottom: 1.5rem; }
.agent-message { max-width: 92%; padding: 1rem 1.2rem; border-radius: 1rem; }
.agent-message.user { justify-self: end; color: var(--navy); background: #edf3f8; }
.agent-message.maestro { justify-self: start; width: 100%; border: 1px solid var(--line); background: #fff; }
.agent-speaker { font-size: .72rem; color: var(--teal-dark); font-weight: 750; }
.agent-message p { margin: .5rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; font-size: .88rem; }
.agent-message .agent-job-state { color: var(--muted); font-size: .72rem; }
.agent-proposal { margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.agent-proposal h3 { margin: 0; font-size: 1rem; }
.agent-changes { padding-left: 1.15rem; line-height: 1.65; font-size: .82rem; }
.agent-proposal caption { padding-top: .6rem; }
.agent-proposal tbody th { white-space: normal; font-size: .74rem; background: #f7f9fc; }
.agent-proposal .button { margin-top: .8rem; }
.agent-composer { padding-top: 1rem; border-top: 1px solid var(--line); }
.agent-composer-top, .agent-composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.agent-mode { display: inline-flex; gap: .3rem; padding: .3rem; border: 1px solid var(--line); border-radius: 999px; background: #f4f7fb; }
.agent-mode button { padding: .65rem 1.15rem; border: 0; border-radius: 999px; color: var(--muted); background: transparent; font: inherit; font-weight: 700; font-size: .8rem; }
.agent-mode button[aria-pressed="true"] { color: #fff; background: var(--navy); }
.agent-keyboard-hint { color: var(--muted); font-size: .68rem; }
.agent-composer .context-note { margin: .85rem 0 .65rem; line-height: 1.5; }
.agent-composer textarea { display: block; width: 100%; min-height: 96px; resize: vertical; padding: .9rem 1rem; border: 1px solid #aabccc; border-radius: .8rem; background: #fff; color: var(--ink); font: inherit; font-size: .88rem; line-height: 1.55; overflow-wrap: anywhere; }
.agent-composer textarea:disabled { background: #f7f9fc; }
.agent-composer-actions > p { margin: .75rem 0 0; color: var(--muted); font-size: .76rem; line-height: 1.5; }
.agent-composer-actions > p[data-state="error"] { color: var(--red); }
.agent-plan-summary { margin-top: 1.5rem; border-top: 0; }
.agent-plan-summary > summary { margin-bottom: 1rem; }
@media (max-width: 620px) {
  .agent-message { max-width: 100%; padding: .85rem; }
  .agent-composer-top, .agent-composer-actions { align-items: stretch; flex-direction: column; gap: .5rem; }
  .agent-keyboard-hint { display: none; }
  .agent-mode { align-self: start; }
  .agent-composer-actions .button-row { justify-content: flex-end; }
}

.agent-proposal table { margin-bottom: .9rem; }
.agent-area-goal, .agent-removal-impact { margin: 1.1rem 0; padding-top: .85rem; border-top: 1px solid var(--line); }
.agent-area-goal h4, .agent-removal-impact h4 { margin: 0 0 .7rem; color: var(--navy); font-size: .9rem; }
.agent-message .agent-removal-warning { font-weight: 650; line-height: 1.6; margin-top: 1rem; }
.agent-message > .button.secondary { margin-top: .85rem; }

.agent-report { margin-top: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: .8rem; background: #f7f9fc; }
.agent-report h3 { margin: 0; color: var(--navy); font-size: 1rem; overflow-wrap: anywhere; }
.agent-report .button-row { margin-top: .8rem; flex-wrap: wrap; }
.agent-report .button { margin-top: 0; }
