:root {
  --bg: #f3efe6;
  --bg-strong: #ede4d4;
  --panel: #fffdf8;
  --panel-strong: #f9f2e5;
  --text: #1f1f1a;
  --text-muted: #55513f;
  --line: #d8cdb8;
  --brand: #1d6b5c;
  --brand-strong: #12463c;
  --warning: #a35a00;
  --danger: #8a3022;
  --shadow: 0 10px 26px rgba(20, 18, 10, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans", "Segoe UI", Tahoma, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 15%, #f9f6ee 0, #f9f6ee 22%, transparent 23%),
    radial-gradient(circle at 90% 85%, #f2e7d5 0, #f2e7d5 20%, transparent 22%),
    linear-gradient(140deg, #efe5d4 0%, #f7f4eb 100%);
}

.app-shell {
  width: min(1600px, 100%);
  margin: 0 auto;
  padding: 1.25rem;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 1.25rem;
  align-items: end;
  margin-bottom: 1rem;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--text-muted);
  font-size: 0.82rem;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", Tahoma, sans-serif;
}

h1 {
  margin-top: 0.2rem;
  font-size: clamp(1.45rem, 2.2vw, 2.2rem);
}

h2 {
  font-size: 1.18rem;
}

h3 {
  font-size: 0.98rem;
}

.subtitle {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
}

.hero-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 390px) minmax(620px, 1fr);
  gap: 1rem;
}

.panel {
  background: linear-gradient(165deg, var(--panel) 0%, var(--panel-strong) 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1rem;
}

.panel-left {
  max-height: calc(100vh - 145px);
  overflow-y: auto;
}

.panel-right {
  min-height: 70vh;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.compact {
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.5);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field span {
  font-size: 0.82rem;
  color: var(--text-muted);
}

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

input,
select,
textarea {
  background: #ffffff;
  border: 1px solid #c9bea8;
  border-radius: 10px;
  padding: 0.52rem 0.62rem;
  color: var(--text);
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus {
  outline: 2px solid #91cabf;
  outline-offset: 1px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.checkbox-row.inline {
  margin-top: 1.45rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 0.54rem 0.78rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.button.primary {
  background: linear-gradient(160deg, var(--brand), #2f7f6f);
  color: #fff;
}

.button.secondary {
  border-color: var(--line);
  background: #fff;
  color: var(--text);
}

.button.ghost {
  border-color: transparent;
  background: rgba(255, 255, 255, 0.45);
  color: var(--text);
}

.button.warning {
  border-color: #f0d4aa;
  background: #fdf3df;
  color: #7a4a00;
}

.button.danger {
  border-color: #efc6be;
  background: #fce8e3;
  color: var(--danger);
}

.button[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.toolbar {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--line);
}

.field.inline {
  min-width: 155px;
}

.split {
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: minmax(260px, 350px) 1fr;
  gap: 0.8rem;
  min-height: 60vh;
}

.list-panel,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.52);
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
}

.minor {
  margin: 0.5rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.node-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.node-entry {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 0.55rem;
  cursor: pointer;
  text-align: left;
}

.node-entry.active {
  border-color: #7ba99f;
  background: #ecf6f3;
}

.node-entry .title {
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.node-entry .meta {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  font-size: 0.79rem;
}

.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 0.12rem 0.46rem;
  border: 1px solid var(--line);
}

.pill.warn {
  border-color: #f0d4aa;
  color: var(--warning);
  background: #fff5e5;
}

.detail-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0.88rem;
  overflow-y: auto;
}

.detail-card.empty {
  display: grid;
  place-items: center;
  color: var(--text-muted);
  min-height: 180px;
}

.detail-headline {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: start;
}

.detail-title {
  margin-bottom: 0.2rem;
}

.detail-grid {
  margin: 0.7rem 0 0;
  display: grid;
  gap: 0.5rem;
}

.detail-row {
  border-bottom: 1px dashed #dfd5c2;
  padding-bottom: 0.4rem;
}

.detail-row:last-child {
  border-bottom: 0;
}

.detail-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.detail-value {
  margin-top: 0.12rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.entity-list {
  list-style: none;
  margin: 0.55rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.entity-list-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem;
}

.entity-list-item .row {
  display: flex;
  justify-content: space-between;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.entity-list-item .actions {
  margin-top: 0.45rem;
}

.message {
  margin: 0 0 0.9rem;
  min-height: 1.35rem;
  font-size: 0.9rem;
}

.message.info {
  color: var(--brand-strong);
}

.message.success {
  color: #145640;
}

.message.error {
  color: var(--danger);
}

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

  .panel-left {
    max-height: none;
  }

  .split {
    grid-template-columns: 1fr;
    min-height: auto;
  }
}
