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

:root {
  --bg: #f6f2ed;
  --bg-strong: #efe9e2;
  --panel: #ffffff;
  --panel-soft: #faf7f3;
  --ink: #17151f;
  --muted: #6f6b66;
  --border: #e7dfd7;
  --accent: #ef5b4f;
  --accent-strong: #e04a3d;
  --accent-soft: #ffe7e4;
  --green: #1e9b6b;
  --shadow: 0 24px 50px rgba(18, 14, 11, 0.08);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

body.console-body {
  margin: 0;
  font-family: "Space Grotesk", "DM Sans", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top right, #fbe8df 0%, transparent 48%),
    radial-gradient(circle at 10% 20%, #f3f0ff 0%, transparent 45%),
    var(--bg);
  min-height: 100vh;
}

.console-shell {
  display: flex;
  min-height: 100vh;
}

.console-sidebar {
  width: 260px;
  padding: 28px 20px;
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, #ff7b6e, #ffbd6b);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 12px 24px rgba(239, 91, 79, 0.3);
}

.brand-title {
  font-weight: 700;
  margin: 0;
  font-size: 14px;
}

.brand-subtitle {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.nav-sections {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.nav-label {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #9f988f;
  margin: 0 0 8px;
  font-weight: 600;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  text-decoration: none;
  color: var(--muted);
  font-size: 14px;
}

.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
  box-shadow: 0 8px 16px rgba(239, 91, 79, 0.12);
}

.nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d3ccc5;
}

.nav-link.active .nav-dot {
  background: var(--accent-strong);
}

.console-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.console-topbar {
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.75);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  backdrop-filter: blur(10px);
}

.top-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.top-link {
  text-decoration: none;
  font-size: 13px;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 999px;
}

.top-link.active {
  background: var(--ink);
  color: #fff;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.console-content {
  padding: 28px 32px 40px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn.primary {
  background: var(--ink);
  color: #fff;
}

.btn.ghost {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--muted);
}

.input,
.textarea,
select.input {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--panel-soft);
  font-size: 13px;
  font-family: inherit;
}

.textarea {
  min-height: 120px;
}

.search {
  width: 180px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  background: #fff;
}

.pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.pill .green {
  background: var(--green);
}

.lang {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
}

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

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: linear-gradient(140deg, #d8d3cc, #f5f2ed);
}

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

.page-header h1 {
  margin: 0;
  font-size: 28px;
}

.page-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.page-actions {
  display: flex;
  gap: 10px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}

.panel.soft {
  background: var(--panel-soft);
  box-shadow: none;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-header h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.panel-header p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.panel-actions {
  display: flex;
  gap: 8px;
}

.panel-actions.right {
  justify-content: flex-end;
}

.panel-title {
  margin: 0 0 6px;
  font-weight: 600;
}

.panel-text {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 18px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid.two-thirds {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
}

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

.form-grid.logs-search {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: #a7a097;
  margin-bottom: 6px;
}

.eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: #a7a097;
  margin: 0 0 8px;
}

.stat-card {
  text-align: left;
}

.stat-value {
  font-size: 24px;
  margin: 0 0 6px;
  font-weight: 600;
}

.stat-sub {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.status.ok {
  color: var(--green);
  font-size: 24px;
  font-weight: 600;
  margin: 0;
}

.stack {
  display: grid;
  gap: 12px;
}

.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 13px;
}

.toggle-pill {
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(120deg, #31c480, #28a06e);
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.chip {
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.chip.trace,
.chip.debug {
  background: #f1efeb;
  color: #7d756c;
}

.chip.info {
  background: #e6f1ff;
  color: #3a6fb7;
}

.chip.warn {
  background: #fff1d7;
  color: #c47916;
}

.chip.error,
.chip.fatal {
  background: #ffe2e2;
  color: #cc3c3c;
}

.log-table {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.log-header,
.log-row {
  display: grid;
  grid-template-columns: 120px 110px 1fr;
  gap: 16px;
  padding: 12px 16px;
}

.log-header {
  background: var(--panel-soft);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: #9f988f;
}

.log-row {
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}

.log-time {
  color: #a7a097;
}

.log-message strong {
  color: var(--ink);
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  text-align: center;
}

.playground {
  display: grid;
  gap: 20px;
}

.tile-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tile {
  background: #fff;
  border: 1px dashed var(--border);
  border-radius: 16px;
  padding: 12px;
  width: 120px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}

.tile.active {
  border-color: var(--accent);
  color: var(--ink);
  box-shadow: 0 12px 24px rgba(239, 91, 79, 0.12);
}

.tile-thumb {
  height: 48px;
  border-radius: 10px;
  background: linear-gradient(160deg, #f2f1ef, #e4dfd7);
}

.tile-thumb.add {
  display: grid;
  place-items: center;
  font-size: 20px;
  color: var(--muted);
}

.playground-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.3fr) minmax(0, 0.9fr);
  height: calc(100vh - 420px);
  min-height: 600px;
}

.preview-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
  overflow: hidden;
}

.preview-canvas {
  flex: 1;
  background: #f5f3f0;
  border-radius: var(--radius-md);
  padding: 20px;
  display: grid;
  place-items: center;
  overflow: auto;
  min-height: 0;
}

.preview-page {
  width: 80%;
  background: #fff;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06);
  display: grid;
  gap: 10px;
}

.preview-line {
  height: 8px;
  background: #ece7e1;
  border-radius: 999px;
}

.preview-line.thick {
  height: 12px;
  width: 70%;
  background: #e6e0d9;
}

.preview-card {
  height: 80px;
  border-radius: 12px;
  background: linear-gradient(140deg, #e9f1ff, #fdf7e6);
}

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

.zoom {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.zoom-track {
  width: 80px;
  height: 4px;
  background: #e7dfd7;
  border-radius: 999px;
  position: relative;
}

.zoom-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--ink);
  position: absolute;
  top: -4px;
  left: 40%;
}

.output-panel .tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.tab {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

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

.tab-body {
  background: var(--panel-soft);
  border-radius: var(--radius-md);
  padding: 16px;
  min-height: 240px;
  max-height: calc(100vh - 600px);
  overflow: auto;
}

.tab-body textarea {
  width: 100%;
  min-height: 400px;
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  resize: vertical;
}

.playground-grid .panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.panel-header {
  flex-shrink: 0;
}

.output-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.output-panel .tabs {
  flex-shrink: 0;
}

.config-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: auto;
}

/* Universal Extraction Styles */
.universal-extraction {
  display: grid;
  gap: 20px;
}

.extraction-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.schema-panel textarea {
  width: 100%;
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
}

.review-panel {
  max-height: 600px;
  overflow: auto;
}

.review-list {
  max-height: 500px;
  overflow: auto;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  align-items: center;
}

.step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.step-num {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  display: grid;
  place-items: center;
  font-weight: 700;
}

.step-title {
  margin: 0;
  font-weight: 600;
}

.step-text {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.upload-panel {
  display: grid;
  gap: 16px;
}

.upload-drop {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 24px;
  text-align: center;
  background: #fffdfb;
  display: grid;
  gap: 10px;
  justify-items: center;
}

.upload-drop.audio {
  background: #fff7f2;
}

.upload-icon {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: var(--accent-soft);
  display: grid;
  place-items: center;
  font-size: 20px;
}

.upload-title {
  font-weight: 600;
  margin: 0;
}

.upload-sub {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.sample-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.sample {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--panel-soft);
  font-size: 12px;
}

.review-list {
  display: grid;
  gap: 12px;
}

.review-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--panel-soft);
}

.review-key {
  margin: 0 0 4px;
  font-weight: 600;
}

.review-value {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.review-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.code {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
}

.audio-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.waveform {
  height: 80px;
  border-radius: var(--radius-md);
  background: repeating-linear-gradient(
    90deg,
    #f0e8df 0,
    #f0e8df 6px,
    #f6f2ed 6px,
    #f6f2ed 12px
  );
}

.preview-text h3 {
  margin: 0 0 8px;
}

.code-block {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  white-space: pre-wrap;
}

.confidence {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 12px;
}

.config-panel .config-group {
  margin-bottom: 16px;
}

.segmented {
  display: flex;
  gap: 8px;
}

.segmented button {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px;
  font-size: 12px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.segmented button.active {
  background: var(--ink);
  color: #fff;
}

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

  .grid.two-thirds {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 900px) {
  .console-shell {
    flex-direction: column;
  }

  .console-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .grid.four,
  .grid.three,
  .grid.two {
    grid-template-columns: 1fr;
  }

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