@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap");

:root {
  --bg: #f3efe9;
  --panel: #fff9f2;
  --panel-border: #e0d7cc;
  --ink: #1c1b1a;
  --muted: #5b5a57;
  --accent: #c84630;
  --accent-2: #2f5d62;
  --accent-3: #f6c453;
  --shadow: 0 18px 40px rgba(28, 27, 26, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #f9f2e7 0%, #f0e8dd 45%, #e8e0d5 100%);
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 38% 62%;
  grid-template-rows: 60% 40%;
  gap: 18px;
  padding: 20px;
}

.pane {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.pane-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--panel-border);
  background: linear-gradient(120deg, #fef7ec, #f7efe3);
  gap: 12px;
}

.pane-header h1,
.pane-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.graph-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.pane.left {
  grid-column: 1;
  grid-row: 1;
  overflow-y: auto;
}

.pane.right {
  grid-column: 2;
  grid-row: 1;
}

.pane.bottom {
  grid-column: 1 / span 2;
  grid-row: 2;
}

.subtitle {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.status {
  display: flex;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--muted);
}

.panel {
  padding: 16px 20px;
  border-bottom: 1px solid var(--panel-border);
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

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

.button-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

button,
.file-upload {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover,
.file-upload:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(28, 27, 26, 0.12);
}

button.danger {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

button.ghost,
.file-upload {
  background: transparent;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.field label {
  font-size: 0.8rem;
  color: var(--muted);
}

input {
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  padding: 10px 12px;
  font-family: inherit;
  background: #fffefb;
}

select {
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  padding: 10px 12px;
  font-family: inherit;
  background: #fffefb;
}

.pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--panel-border);
  display: inline-flex;
  align-items: center;
  font-size: 0.85rem;
}

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

.hint {
  font-size: 0.85rem;
  color: var(--muted);
}

#graph-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#graph {
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 20% 20%, rgba(200, 70, 48, 0.08), transparent 55%),
    radial-gradient(circle at 80% 30%, rgba(47, 93, 98, 0.1), transparent 60%);
}

.json-view {
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
  font-size: 0.82rem;
  margin: 0;
  padding: 16px 20px;
  overflow: auto;
  white-space: pre;
  flex: 1;
  background: #11110f;
  color: #f3e9dc;
}

.json-view.collapsed {
  display: none;
}

.file-upload input {
  display: none;
}

.hidden {
  display: none !important;
}

.selection-block {
  padding: 10px 0 0;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 14, 13, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

.modal {
  width: min(820px, 90vw);
  background: #fffdf7;
  border-radius: 18px;
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}

.modal-header,
.modal-footer {
  padding: 14px 18px;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-footer {
  border-top: 1px solid var(--panel-border);
  border-bottom: none;
  gap: 10px;
}

.modal-body {
  padding: 12px 18px 18px;
  overflow: auto;
}

.modal-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.modal-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  cursor: pointer;
  background: #fff;
}

.modal-item.selected {
  border-color: var(--accent);
  box-shadow: 0 6px 14px rgba(200, 70, 48, 0.18);
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.breadcrumb span {
  cursor: pointer;
}

.preview-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preview-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.preview-item {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: #fff;
  font-size: 0.9rem;
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
  font-size: 0.82rem;
}

.preview-table th,
.preview-table td {
  border: 1px solid var(--panel-border);
  padding: 6px 8px;
  text-align: left;
}

.preview-table th {
  background: #f1e7dc;
}

@media (max-width: 1100px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }
  .pane.left,
  .pane.right,
  .pane.bottom {
    grid-column: 1;
  }
}
