:root {
  color-scheme: light;
  --bg: #f2efe8;
  --ink: #1d1a17;
  --muted: #6d655d;
  --panel: #fffdf7;
  --line: #d7cfc3;
  --accent: #0b6bcb;
  --accent-2: #e98a15;
  --danger: #b42318;
  --shadow: 0 20px 50px rgba(42, 33, 24, 0.08);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(233, 138, 21, 0.12), transparent 32%),
    linear-gradient(180deg, #f8f4ee 0%, var(--bg) 100%);
  color: var(--ink);
}

.shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.app-shell {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 20px;
}

.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 24px;
  margin-bottom: 20px;
}

.hero {
  background: linear-gradient(135deg, rgba(11, 107, 203, 0.08), rgba(233, 138, 21, 0.08));
  padding: 14px 20px;
}

.hero-compact {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.hero-compact .eyebrow,
.hero-compact h1 {
  margin: 0;
}

.hero-compact h1 {
  font-size: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  color: var(--muted);
}

.muted,
.status {
  color: var(--muted);
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
}

.sidebar {
  position: sticky;
  top: 20px;
  align-self: start;
}

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

.nav-groups {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

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

.nav-group-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  padding: 6px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.nav-group-toggle small {
  color: var(--muted);
}

.nav-group ul,
.plain-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.nav-group ul.hidden {
  display: none;
}

.nav-group li,
.plain-list li {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
}

.nav-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.65);
  width: 100%;
  text-align: left;
  font-size: 13px;
}

.nav-item small {
  color: var(--muted);
  font-size: 11px;
}

.nav-item.active {
  background: var(--ink);
  color: #fff;
}

.nav-item.active small {
  color: rgba(255, 255, 255, 0.72);
}

.nav-item:disabled {
  opacity: 0.58;
  cursor: default;
}

.stats,
.grid {
  display: grid;
  gap: 16px;
}

.stats {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 20px;
}

.grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.grid-wide {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.workspace-top {
  margin-bottom: 16px;
  grid-column: 1 / -1;
}

.workspace-top.compact {
  padding: 12px 16px;
  margin-bottom: 10px;
}

.workspace-top.compact .toolbar {
  margin-bottom: 0;
}

.workspace-top.compact #workspace-title {
  margin: 0;
  font-size: 22px;
}

.workspace-top.compact #workspace-subtitle {
  margin: 4px 0 0;
}

.workspace-view {
  display: none;
  min-width: 0;
  grid-column: 1 / 2;
}

.workspace-view.active {
  display: block;
}

.module-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 12px;
}

.compact-form {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fcfaf5;
}

.compact-form summary {
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 600;
}

.compact-form form {
  padding: 0 14px 14px;
  margin-bottom: 0;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.detail-grid label {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fcfaf5;
}

.detail-grid select,
.detail-grid textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  background: #fff;
}

select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  background: #fff;
}

select[multiple] {
  min-height: 132px;
}

.detail-grid textarea {
  min-height: 120px;
  resize: vertical;
}

.detail-grid label.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.detail-grid label.checkbox-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.detail-impact {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.impact-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.impact-path {
  font: 13px/1.4 "IBM Plex Mono", "SFMono-Regular", monospace;
}

.runtime-review {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.runtime-change {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
}

.runtime-change-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #fcfaf5;
}

.runtime-file {
  font: 13px/1.4 "IBM Plex Mono", "SFMono-Regular", monospace;
}

.runtime-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}

.badge-unchanged {
  background: #f3f0ea;
}

.badge-update {
  background: rgba(11, 107, 203, 0.12);
  color: var(--accent);
  border-color: rgba(11, 107, 203, 0.22);
}

.badge-create {
  background: rgba(26, 127, 55, 0.12);
  color: #1a7f37;
  border-color: rgba(26, 127, 55, 0.22);
}

.badge-delete {
  background: rgba(180, 35, 24, 0.12);
  color: var(--danger);
  border-color: rgba(180, 35, 24, 0.22);
}

.runtime-hash {
  font-size: 12px;
  color: var(--muted);
}

.card {
  padding: 18px;
}

.section-note {
  margin: 0 0 12px;
  font-size: 14px;
}

form {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 14px;
}

input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  background: #fff;
}

button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  background: var(--ink);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

button.delete {
  background: var(--danger);
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.list-item {
  display: grid;
  gap: 10px;
  align-items: stretch;
}

.list-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.list-item-head span {
  min-width: 0;
}

.list-item.active {
  border-color: rgba(11, 107, 203, 0.35);
  box-shadow: inset 0 0 0 1px rgba(11, 107, 203, 0.18);
}

.sublist {
  gap: 8px;
}

.sublist li {
  padding: 10px 12px;
  background: #fcfaf5;
}

.subitem-label {
  font-size: 14px;
  color: var(--muted);
}

.nested-editor {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.nested-editor label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.runtime-output {
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fcfaf5;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font: 13px/1.45 "IBM Plex Mono", "SFMono-Regular", monospace;
}

.runtime-output.compact {
  max-height: 220px;
}

.plain-list li {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

#detail-panel {
  position: sticky;
  top: 20px;
  align-self: start;
  margin-bottom: 0;
  grid-column: 2 / 3;
}

.stat {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.stat strong {
  display: block;
  font-size: 28px;
  margin-top: 6px;
}

.hidden {
  display: none;
}

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

  .content {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  #detail-panel {
    position: static;
  }
}
