:root {
  --bg: #101217;
  --surface: #181d24;
  --surface-2: #202733;
  --surface-3: #252218;
  --line: #343b46;
  --text: #f4f0e8;
  --muted: #abb4c2;
  --green: #8ed081;
  --blue: #77b7ff;
  --amber: #e7b95f;
  --red: #f07d6b;
  --violet: #b8a2ff;
  --font-sans: Inter, "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    var(--bg);
  background-size: 40px 40px;
  color: var(--text);
  font-family: var(--font-sans);
}

button,
input {
  font: inherit;
}

button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #4c5563;
  border-radius: 6px;
  background: #2f3948;
  color: var(--text);
  cursor: pointer;
}

button:hover {
  background: #3c485a;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.shell {
  width: min(1520px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 16px 0 28px;
}

.topbar {
  display: flex;
  min-height: 86px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #151a21;
}

.eyebrow,
h1,
h2,
p {
  margin: 0;
}

.eyebrow {
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
}

h1 {
  margin-top: 4px;
  font-size: 2rem;
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: 1rem;
  letter-spacing: 0;
}

.status-strip,
.button-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.status-strip span,
.check-label {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.82rem;
}

.workspace {
  display: grid;
  grid-template-columns: 1.05fr 1.3fr 0.95fr;
  gap: 12px;
  margin-top: 12px;
}

.panel {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 29, 36, 0.96);
}

.modal-panel,
.json-panel {
  grid-row: span 2;
}

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

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

label span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

input[type="text"],
input:not([type]) {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid #444d5c;
  border-radius: 6px;
  background: #11161d;
  color: var(--text);
}

.large-value {
  padding: 12px;
  border: 1px solid #3c4654;
  border-radius: 8px;
  background: #11161d;
  color: var(--blue);
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
}

.record-list,
.gate-list,
.action-list,
.flow-list,
.source-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.record,
.gate,
.action,
.flow-node,
.source {
  padding: 10px;
  border: 1px solid #3a4350;
  border-radius: 8px;
  background: #141920;
}

.record strong,
.gate strong,
.action strong,
.flow-node strong,
.source strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.92rem;
}

.record span,
.gate span,
.action span,
.flow-node span,
.source span {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.gate[data-status="pass"] {
  border-color: rgba(142, 208, 129, 0.6);
}

.gate[data-status="review"],
.gate[data-status="locked"] {
  border-color: rgba(231, 185, 95, 0.72);
}

.gate[data-status="blocked"],
.record[data-status="blocked"] {
  border-color: rgba(240, 125, 107, 0.72);
}

.action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.role {
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.flow-node {
  border-left: 4px solid var(--violet);
}

.source {
  border-left: 4px solid var(--blue);
}

pre {
  min-height: 620px;
  max-height: 680px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid #3c4654;
  border-radius: 8px;
  background: #0c1015;
  color: #d9e6f2;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.45;
}

@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: 1fr 1fr;
  }

  .json-panel {
    grid-column: span 2;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100vw - 16px, 720px);
    padding-top: 8px;
  }

  .topbar,
  .workspace,
  .form-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .modal-panel,
  .json-panel {
    grid-column: auto;
    grid-row: auto;
  }

  pre {
    min-height: 360px;
  }
}
