/* MDriven deployment console
   Palette: cold navy-slate instrumentation ground, warm copper for the one
   action that actually costs money. Semantic green/amber/red stay separate from
   the accent so status never reads as a button. */

:root {
  --ground:      #f4f6f8;
  --surface:     #ffffff;
  --surface-2:   #eceff3;
  --line:        #d3dae2;
  --line-strong: #b6c0cc;
  --text:        #17202b;
  --text-muted:  #5c6b7d;
  --text-faint:  #8494a6;

  --accent:      #a85820;
  --accent-hot:  #c26a28;
  --accent-ink:  #ffffff;
  --accent-wash: #f6ece3;

  --ok:          #1f7a52;
  --warn:        #9a6b12;
  --crit:        #a52c2c;

  --radius: 4px;
  --gap: 1rem;

  --font-ui: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground:      #0e141b;
    --surface:     #151d26;
    --surface-2:   #1c2632;
    --line:        #26333f;
    --line-strong: #3a4a5a;
    --text:        #e3eaf2;
    --text-muted:  #93a3b5;
    --text-faint:  #6b7c8e;

    --accent:      #d98243;
    --accent-hot:  #eb9354;
    --accent-ink:  #16202b;
    --accent-wash: #241a12;

    --ok:          #4bbd88;
    --warn:        #d6a641;
    --crit:        #e07272;
  }
}

:root[data-theme="dark"] {
  --ground:      #0e141b;
  --surface:     #151d26;
  --surface-2:   #1c2632;
  --line:        #26333f;
  --line-strong: #3a4a5a;
  --text:        #e3eaf2;
  --text-muted:  #93a3b5;
  --text-faint:  #6b7c8e;

  --accent:      #d98243;
  --accent-hot:  #eb9354;
  --accent-ink:  #16202b;
  --accent-wash: #241a12;

  --ok:          #4bbd88;
  --warn:        #d6a641;
  --crit:        #e07272;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------- chrome -- */

.masthead {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.masthead h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.masthead .sub {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.masthead .spacer { flex: 1; }

.theme-toggle {
  font: inherit;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.3rem 0.6rem;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); border-color: var(--line-strong); }

.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.75rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.75rem;
  align-items: start;
}

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
}

/* ----------------------------------------------------------------- stages -- */

.stage { margin-bottom: 1.75rem; }

.stage-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.stage-num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-faint);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.05rem 0.35rem;
}

.stage-head h2 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ---------------------------------------------------------------- targets -- */

.targets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

@media (max-width: 560px) { .targets { grid-template-columns: minmax(0, 1fr); } }

.target {
  text-align: left;
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 0.9rem;
  cursor: pointer;
  display: grid;
  gap: 0.3rem;
  transition: border-color 0.12s, background 0.12s;
}

.target:hover { border-color: var(--line-strong); }
.target:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.target[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-wash);
  box-shadow: inset 3px 0 0 var(--accent);
}

.target .name { font-weight: 600; font-size: 0.95rem; }
.target .blurb { color: var(--text-muted); font-size: 0.82rem; line-height: 1.45; }

.target-detail {
  margin-top: 0.7rem;
  padding: 0.6rem 0.75rem;
  border-left: 2px solid var(--line-strong);
  color: var(--text-muted);
  font-size: 0.84rem;
}

/* ------------------------------------------------------------------ form -- */

.fields { display: grid; gap: 0.9rem; }

.row { display: grid; gap: 0.9rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 560px) { .row { grid-template-columns: minmax(0, 1fr); } }

.field { display: grid; gap: 0.3rem; }

.field label {
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.field .hint { font-size: 0.79rem; color: var(--text-faint); }

.field input,
.field select {
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.5rem 0.6rem;
  width: 100%;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

.field input::placeholder { color: var(--text-faint); }

.check { display: flex; align-items: center; gap: 0.5rem; }
.check input { width: auto; }
.check label { text-transform: none; letter-spacing: 0; font-size: 0.88rem; font-weight: 500; color: var(--text); }

/* ------------------------------------------------------------------ sizes -- */

.sizes { display: grid; gap: 0.5rem; }

.size {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
  cursor: pointer;
}

.size:hover { border-color: var(--line-strong); }
.size:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.size:has(input:checked) { border-color: var(--accent); background: var(--accent-wash); }

.size .tier { font-weight: 600; font-size: 0.9rem; text-transform: capitalize; }
.size .note { color: var(--text-muted); font-size: 0.8rem; }
.size .spec {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.size .machine {
  display: block;
  color: var(--text-faint);
  font-size: 0.72rem;
}

/* ----------------------------------------------------------------- output -- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.panel-head h3 {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.panel-head .spacer { flex: 1; }

.copy {
  font: inherit;
  font-size: 0.78rem;
  color: var(--accent);
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.2rem 0.55rem;
  cursor: pointer;
}
.copy:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

pre.command {
  margin: 0;
  padding: 0.9rem 0.85rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.65;
  color: var(--text);
  tab-size: 4;
}

.errors {
  margin: 0;
  padding: 0.75rem 0.85rem 0.75rem 2rem;
  border-bottom: 1px solid var(--line);
  color: var(--crit);
  font-size: 0.85rem;
}
.errors li { margin: 0.15rem 0; }

.steps { list-style: none; margin: 0; padding: 0; }

.steps li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.7rem;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--line);
}
.steps li:last-child { border-bottom: none; }

.steps .marker {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
  padding-top: 0.15rem;
}

.steps .title { font-weight: 600; font-size: 0.88rem; }
.steps .body { color: var(--text-muted); font-size: 0.84rem; }

.urls { list-style: none; margin: 0; padding: 0; }
.urls li {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0.6rem;
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.urls li:last-child { border-bottom: none; }
.urls .what { font-size: 0.8rem; color: var(--text-muted); }
.urls .where {
  font-family: var(--font-mono);
  font-size: 0.79rem;
  color: var(--text);
  overflow-wrap: anywhere;
}

.prereqs { list-style: none; margin: 0; padding: 0.6rem 0.85rem; }
.prereqs li {
  display: grid;
  grid-template-columns: 1.1rem 1fr;
  gap: 0.4rem;
  font-size: 0.84rem;
  color: var(--text-muted);
  padding: 0.15rem 0;
}
.prereqs .tick { color: var(--ok); }

.stack-note {
  margin-top: 1rem;
  font-size: 0.82rem;
  color: var(--text-faint);
  line-height: 1.6;
}
.stack-note code {
  font-family: var(--font-mono);
  font-size: 0.95em;
  color: var(--text-muted);
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ------------------------------------------------- access & deploy flow -- */

.rehearsal-banner {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: baseline;
  padding: 0.7rem 1.75rem;
  background: var(--accent-wash);
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--text-muted);
}
.rehearsal-banner strong { color: var(--accent); font-weight: 600; }

.shell.single { grid-template-columns: minmax(0, 760px); justify-content: center; }

.access-note {
  margin: 0 0 0.9rem;
  padding: 0.6rem 0.75rem;
  border-left: 2px solid var(--accent);
  background: var(--accent-wash);
  color: var(--text-muted);
  font-size: 0.84rem;
}

.field textarea {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.5rem 0.6rem;
  width: 100%;
  min-height: 6.5rem;
  resize: vertical;
}
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

.panel.launch { margin-top: 1.25rem; }

.launch-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  padding: 0.85rem;
}

button.primary {
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.55rem 1.15rem;
  cursor: pointer;
}
button.primary:hover { background: var(--accent-hot); border-color: var(--accent-hot); }
button.primary:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

button.secondary {
  font: inherit;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.45rem 0.9rem;
  cursor: pointer;
}
button.secondary:hover { color: var(--text); }

.launch-hint { font-size: 0.82rem; color: var(--text-faint); }

.advanced { margin-top: 1.25rem; }
.advanced summary {
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.3rem 0;
}
.advanced summary:hover { color: var(--text); }
.advanced .panel { margin-top: 0.6rem; }

/* --------------------------------------------------------- job progress -- */

.elapsed {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.stages { list-style: none; margin: 0; padding: 0; }

.stages li {
  display: grid;
  grid-template-columns: 1.4rem 1fr auto;
  gap: 0.7rem;
  align-items: baseline;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
}
.stages li:last-child { border-bottom: none; }

.stages .dot {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-faint);
}
.stages li[data-state="running"] .dot { color: var(--accent); }
.stages li[data-state="done"] .dot,
.stages li[data-state="rehearsed"] .dot { color: var(--ok); }
.stages li[data-state="failed"] .dot { color: var(--crit); }

.stages li[data-state="pending"] .what { color: var(--text-faint); }
.stages li[data-state="running"] .what { color: var(--text); font-weight: 500; }

.stages .flag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.stages li[data-state="failed"] .flag { color: var(--crit); }

.handover { margin-top: 1rem; }
.handover-note {
  margin: 0;
  padding: 0.6rem 0.85rem 0.75rem;
  font-size: 0.82rem;
  color: var(--text-faint);
}
.handover-note code { font-family: var(--font-mono); color: var(--text-muted); }

/* ------------------------------------------------------- model upload -- */

.dropzone {
  display: grid;
  gap: 0.2rem;
  place-items: center;
  text-align: center;
  padding: 1.5rem 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.dropzone:hover,
.dropzone:focus-visible { border-color: var(--accent); background: var(--accent-wash); }
.dropzone:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dropzone[data-dragging="true"] { border-color: var(--accent); background: var(--accent-wash); }
.dropzone[hidden] { display: none; }

.drop-title { font-weight: 600; font-size: 0.92rem; }
.drop-sub { color: var(--text-faint); font-size: 0.82rem; }

.attached {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent-wash);
}

.file-kind {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 2px;
  padding: 0.15rem 0.4rem;
}

.file-meta { display: grid; gap: 0.1rem; min-width: 0; }
.file-name {
  font-size: 0.88rem;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.file-size {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.remove {
  font: inherit;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.25rem 0.6rem;
  cursor: pointer;
}
.remove:hover { color: var(--crit); border-color: var(--crit); }

.drop-note {
  margin: 0.7rem 0 0;
  font-size: 0.82rem;
  color: var(--text-faint);
  line-height: 1.6;
}

.drop-error {
  margin: 0.6rem 0 0;
  padding: 0.5rem 0.7rem;
  border-left: 2px solid var(--crit);
  color: var(--crit);
  font-size: 0.83rem;
}

.job-model {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.84rem;
  color: var(--text-muted);
}
