:root {
  color-scheme: light;
  --page: #f4f5f7;
  --surface: #ffffff;
  --surface-alt: #f9fafb;
  --line: #d7dce2;
  --line-strong: #b8c0ca;
  --text: #1f2933;
  --muted: #657384;
  --nav: #25211f;
  --nav-soft: #3b3633;
  --accent: #c74634;
  --accent-dark: #8f2d24;
  --ok: #217346;
  --warn: #8a5a00;
  --blue: #1d5f8c;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--text);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  background: var(--nav);
  color: #ffffff;
  padding: 18px 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.brand-mark {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 6px;
  background: var(--accent);
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: #c7c0ba;
}

.nav-list {
  display: grid;
  gap: 3px;
  margin-top: 18px;
}

.nav-list a {
  color: #ece7e3;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
}

.nav-list a.active,
.nav-list a:hover {
  background: var(--nav-soft);
}

.workspace {
  min-width: 0;
  padding: 22px 28px 32px;
}

.console-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
}

.console-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.breadcrumb {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.15;
  font-weight: 760;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
}

.runtime,
.pill,
.resource-type {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.runtime {
  border-color: rgba(33, 115, 70, 0.28);
  background: #edf7f0;
  color: var(--ok);
}

.pill {
  color: var(--accent-dark);
  background: #fff3ef;
  border-color: #f0c4ba;
}

.pill.subtle {
  color: var(--blue);
  background: #edf6fb;
  border-color: #c5dcea;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.status-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 16px;
  background: var(--surface);
  color: var(--muted);
}

.status-item span {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: #eef0f2;
  font-size: 12px;
  font-weight: 800;
}

.status-item.active {
  color: var(--text);
}

.status-item.active span {
  background: var(--accent);
  color: #ffffff;
}

.status-item.done span {
  background: var(--ok);
  color: #ffffff;
}

.operator-feedback {
  display: grid;
  gap: 3px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid #bdd7c7;
  border-radius: 8px;
  background: #edf7f0;
  color: var(--ok);
}

.operator-feedback.warning {
  border-color: #f2d28b;
  background: #fff8e7;
  color: var(--warn);
}

.operator-feedback span {
  font-size: 13px;
}

.home-view {
  display: grid;
  gap: 16px;
}

.home-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.home-hero p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
  gap: 18px;
  align-items: start;
}

.primary-flow,
.summary-panel {
  display: grid;
  gap: 14px;
}

.section-card,
.resource-card,
.summary-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 1px 2px rgba(31, 41, 51, 0.04);
}

.section-heading,
.resource-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.section-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.field-grid {
  display: grid;
  gap: 14px;
}

.field-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-grid.three {
  grid-template-columns: 1.5fr 0.8fr 0.8fr;
}

label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-size: 13px;
  font-weight: 680;
}

input,
select,
button {
  min-height: 40px;
  border-radius: 6px;
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  padding: 8px 10px;
  background: var(--surface);
  color: var(--text);
}

input[readonly] {
  background: var(--surface-alt);
  color: var(--muted);
}

input:focus,
select:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(29, 95, 140, 0.15);
}

.info-card {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-alt);
}

.info-card.compact {
  grid-template-columns: minmax(0, 1fr);
}

.info-card span,
.summary-meta,
.summary-list small,
.warning-list {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.resource-card {
  border-left: 4px solid var(--accent);
}

.switch-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--text);
  font-size: 16px;
}

.switch-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-row span {
  position: relative;
  width: 42px;
  height: 22px;
  border-radius: 999px;
  background: #aab4c0;
}

.switch-row span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.16s ease;
}

.switch-row input:checked + span {
  background: var(--accent);
}

.switch-row input:checked + span::after {
  transform: translateX(20px);
}

.advanced {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.advanced summary,
.payload summary {
  cursor: pointer;
  color: var(--blue);
  font-size: 13px;
  font-weight: 760;
}

.advanced .field-grid {
  margin-top: 12px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

button {
  border: 1px solid var(--accent);
  padding: 0 16px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 760;
}

button.secondary,
.console-actions .secondary {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--text);
}

button:hover {
  border-color: var(--accent-dark);
}

button:disabled {
  cursor: progress;
  opacity: 0.72;
}

.summary-panel {
  position: sticky;
  top: 18px;
}

.empty-state {
  min-height: 86px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.summary-list {
  display: grid;
  gap: 10px;
}

.last-action {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #c5dcea;
  border-radius: 8px;
  background: #edf6fb;
  color: var(--blue);
  font-size: 13px;
  line-height: 1.45;
}

.summary-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-alt);
}

.summary-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 6px;
  background: #f3e4df;
  color: var(--accent-dark);
  font-weight: 800;
}

.summary-item strong,
.summary-item small {
  display: block;
}

.summary-item strong {
  margin-bottom: 3px;
}

.warning-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.warning-item {
  padding: 10px;
  border: 1px solid #f2d28b;
  border-radius: 8px;
  background: #fff8e7;
  color: var(--warn);
}

.activity-list {
  display: grid;
  gap: 8px;
}

.activity-item {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-alt);
  font-size: 13px;
  line-height: 1.4;
}

.activity-item strong {
  display: block;
  margin-bottom: 2px;
}

.activity-item.muted {
  color: var(--muted);
}

.plan-list {
  display: grid;
  gap: 10px;
}

.plan-empty {
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.plan-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-alt);
}

.plan-grid .plan-item {
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(31, 41, 51, 0.04);
}

.plan-item header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.plan-item strong,
.plan-item small {
  display: block;
}

.plan-item small {
  color: var(--muted);
  line-height: 1.4;
}

.plan-item button {
  justify-self: end;
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.plan-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.payload {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 10px;
}

pre {
  max-height: 280px;
  overflow: auto;
  margin: 10px 0 0;
  padding: 12px;
  border-radius: 8px;
  background: #111827;
  color: #d1fae5;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

@media (max-width: 1050px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 18px;
    overflow-x: auto;
  }

  .brand {
    flex: 0 0 auto;
    padding-bottom: 4px;
    border-bottom: 0;
  }

  .nav-list {
    display: flex;
    margin: 0;
  }
}

@media (max-width: 860px) {
  .workspace {
    padding: 18px 16px 28px;
  }

  .console-bar,
  .layout {
    grid-template-columns: 1fr;
    display: grid;
  }

  .console-actions {
    justify-content: stretch;
  }

  .console-actions button,
  .console-actions .runtime {
    width: 100%;
    justify-content: center;
  }

  .home-hero {
    display: grid;
  }

  .summary-panel {
    position: static;
  }

  .field-grid.two,
  .field-grid.three,
  .status-strip {
    grid-template-columns: 1fr;
  }

  .form-actions {
    display: grid;
  }
}
