:root {
  color-scheme: light;
  --paper: #f7f4ed;
  --panel: #fffdf8;
  --ink: #17211d;
  --muted: #66706a;
  --line: #d9d1c2;
  --accent: #0f6b5f;
  --accent-strong: #084d45;
  --warn: #a64612;
  --shadow: 0 18px 45px rgba(26, 31, 28, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background:
    linear-gradient(130deg, rgba(15, 107, 95, 0.12), transparent 40%),
    linear-gradient(20deg, rgba(166, 70, 18, 0.08), transparent 38%),
    var(--paper);
}

button,
input,
select,
textarea {
  font: inherit;
}

.shell {
  width: min(1240px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 0;
}

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

.eyebrow {
  margin: 0 0 5px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

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

h1 {
  font-size: clamp(2rem, 5vw, 4.5rem);
  line-height: 0.95;
}

h2 {
  font-size: clamp(1.25rem, 2vw, 1.8rem);
}

.back-link,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: var(--accent);
  color: white;
  padding: 0 14px;
  text-decoration: none;
  cursor: pointer;
}

button.secondary {
  background: var(--panel);
  color: var(--ink);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.5fr);
  gap: 18px;
  align-items: start;
}

.left-pane,
.editor-pane {
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.left-pane {
  min-height: 620px;
  padding: 18px;
}

.editor-pane {
  min-height: 620px;
  padding: 22px;
}

.toolbar {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.toolbar label,
.field span {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  padding: 10px 11px;
}

textarea {
  min-height: 132px;
  resize: vertical;
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  line-height: 1.45;
}

.tree {
  display: grid;
  gap: 8px;
}

.tree-node {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  text-align: left;
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 10px 12px;
}

.tree-node[data-depth="1"] {
  margin-left: 18px;
  width: calc(100% - 18px);
}

.tree-node[data-depth="2"] {
  margin-left: 36px;
  width: calc(100% - 36px);
}

.tree-node.active {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.tree-node .meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.tree-node .value {
  font-weight: 800;
  color: var(--accent-strong);
}

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

.value-pill {
  min-width: 96px;
  border: 1px solid var(--line);
  background: white;
  padding: 9px 12px;
  text-align: center;
  font-weight: 800;
  color: var(--accent-strong);
}

.field {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 18px 0;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  background: white;
  margin: 20px 0;
}

.status-strip div {
  min-width: 0;
  padding: 12px;
  border-right: 1px solid var(--line);
}

.status-strip div:last-child {
  border-right: 0;
}

.status-strip span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.status-strip strong {
  display: block;
  overflow-wrap: anywhere;
}

.diagnostics {
  min-height: 150px;
  margin: 0;
  border: 1px solid var(--line);
  background: #181f1c;
  color: #e8f1ec;
  padding: 14px;
  white-space: pre-wrap;
  overflow: auto;
}

.diagnostics.error {
  color: #ffe6d8;
}

@media (max-width: 840px) {
  .topbar {
    align-items: start;
    flex-direction: column;
  }

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

  .left-pane,
  .editor-pane {
    min-height: auto;
  }

  .status-strip {
    grid-template-columns: 1fr;
  }

  .status-strip div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .status-strip div:last-child {
    border-bottom: 0;
  }
}
