:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --ink: #16202a;
  --muted: #5f6f82;
  --line: #d7dde6;
  --accent: #0b6f6a;
  --accent-dark: #084f4b;
  --warning: #a15800;
  --soft: #e7f3f1;
  --shadow: 0 16px 40px rgba(22, 32, 42, 0.08);
  font-family: "Oracle Sans", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  min-height: 40px;
  padding: 0 14px;
}

button:hover,
button:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.query-panel,
.answer-panel,
.data-editor,
.signals {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.query-panel,
.answer-panel {
  padding: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.18;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
}

h2 {
  font-size: 1.25rem;
}

.intro {
  margin: 10px 0 0;
  color: var(--muted);
  max-width: 760px;
}

.query-form {
  margin-top: 24px;
}

.query-form label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
}

.query-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.query-row input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  color: var(--ink);
}

.query-row button,
#apply-data {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}

.query-row button:hover,
#apply-data:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.examples button,
.tab,
.pill {
  background: var(--soft);
  border-color: #b7d7d2;
  color: var(--accent-dark);
}

.answer-header,
.editor-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #b7d7d2;
  border-radius: 999px;
  min-height: 32px;
  padding: 0 12px;
  white-space: nowrap;
  font-size: 0.9rem;
}

.answer-body {
  margin-top: 18px;
  font-size: 1.06rem;
  line-height: 1.55;
}

.evidence-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.evidence-item {
  border-left: 4px solid var(--accent);
  background: #f8fbfb;
  padding: 12px 14px;
}

.evidence-item strong {
  display: block;
  margin-bottom: 4px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
}

.tabs {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.data-editor,
.signals {
  padding: 18px;
}

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

textarea {
  display: block;
  width: 100%;
  min-height: 390px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  color: #14202c;
  resize: vertical;
  line-height: 1.45;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.9rem;
}

.status {
  min-height: 24px;
  margin: 10px 0 0;
  color: var(--muted);
}

.status.error {
  color: #b33121;
}

.summary-grid {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.summary-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
}

.summary-card strong {
  display: block;
  margin-top: 3px;
  font-size: 1.45rem;
}

@media (max-width: 780px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding: 18px 0;
  }

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

  .answer-header,
  .editor-toolbar {
    flex-direction: column;
  }

  .toolbar-actions {
    width: 100%;
  }

  .toolbar-actions button {
    flex: 1;
  }
}
