:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-soft: #f2f6f3;
  --ink: #13201d;
  --muted: #66756f;
  --line: #d7e0db;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --blue: #2563eb;
  --warn: #b45309;
  --danger: #b42318;
  --ok: #15803d;
  --shadow: 0 18px 48px rgba(19, 32, 29, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #eaf2f0 0, rgba(234, 242, 240, 0) 320px),
    var(--bg);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid rgba(215, 224, 219, 0.82);
  background: rgba(255, 255, 255, 0.88);
  padding: 14px 28px;
  backdrop-filter: blur(14px);
}

.back-link {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.brand,
.topbar-tags,
.hero-actions,
.panel-title,
.control-grid,
.ask-row,
.tabs,
.flow {
  display: flex;
  align-items: center;
}

.brand {
  gap: 11px;
  min-width: 320px;
}

.brand-mark {
  display: inline-flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.topbar-tags {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.topbar-tags span,
.flow span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 7px 11px;
  color: #24423c;
  font-size: 12px;
  font-weight: 800;
}

main {
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 28px;
  align-items: end;
  padding: 20px 0 24px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 850px;
  margin-bottom: 14px;
  font-size: clamp(38px, 6vw, 72px);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
}

.hero-copy {
  max-width: 820px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.8;
}

.hero-actions {
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.status-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
  box-shadow: var(--shadow);
}

.status-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.pulse {
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 6px rgba(21, 128, 61, 0.12);
}

.metrics-grid,
.workspace,
.records-grid {
  display: grid;
  gap: 16px;
}

.metrics-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.metric-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(19, 32, 29, 0.045);
}

.metric-card {
  padding: 16px;
}

.metric-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.metric-card strong {
  display: block;
  margin-top: 6px;
  font-size: 30px;
  line-height: 1;
}

.workspace {
  grid-template-columns: minmax(340px, 0.92fr) minmax(420px, 1.08fr);
}

.records-grid {
  grid-template-columns: minmax(420px, 1fr) minmax(320px, 0.82fr);
}

.panel {
  padding: 18px;
}

.flow-panel {
  margin: 16px 0;
}

.panel-title {
  gap: 10px;
  margin-bottom: 16px;
}

.panel-title span {
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #e3f3ef;
  color: var(--accent-dark);
  font-weight: 900;
}

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

label {
  display: grid;
  gap: 8px;
  color: #334c46;
  font-size: 14px;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.file-drop {
  border: 1px dashed #9ab2aa;
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 18px;
  cursor: pointer;
}

.file-drop input {
  display: none;
}

.file-drop span,
.file-drop strong {
  display: block;
}

.file-drop span {
  color: var(--accent-dark);
  font-size: 14px;
}

.file-drop strong {
  margin-top: 6px;
  color: var(--ink);
  font-size: 15px;
  word-break: break-word;
}

.control-grid,
.ask-row {
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.primary,
.secondary,
.tab,
.quick-questions button {
  min-height: 42px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
}

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

.primary:hover {
  background: var(--accent-dark);
}

.secondary,
.tab,
.quick-questions button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.secondary:hover,
.quick-questions button:hover {
  background: var(--surface-soft);
}

.activity,
.answer-box,
.record-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
}

.activity {
  margin-top: 16px;
  min-height: 54px;
  color: var(--muted);
  line-height: 1.55;
}

.answer-box {
  margin-top: 14px;
  min-height: 180px;
}

.quick-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.quick-questions button {
  min-height: 34px;
  padding: 0 11px;
  color: var(--accent-dark);
  font-size: 12px;
}

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

.confidence {
  display: inline-flex;
  margin-bottom: 10px;
  border-radius: 999px;
  background: #e3f3ef;
  color: var(--accent-dark);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
}

.confidence.warn {
  background: #fff3df;
  color: var(--warn);
}

.handoff,
.source-note {
  color: var(--warn);
  font-weight: 900;
}

.sources {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.source-item,
.record-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.source-item small,
.record-item small {
  color: var(--muted);
  font-weight: 800;
}

.record-item strong {
  display: block;
  margin: 7px 0;
}

.record-item p,
.source-item p {
  margin-bottom: 0;
  color: #405852;
  line-height: 1.6;
}

.flow {
  flex-wrap: wrap;
  gap: 10px;
}

.flow i {
  color: var(--muted);
  font-style: normal;
}

.tabs {
  gap: 8px;
  margin-bottom: 12px;
}

.tab {
  padding: 0 14px;
  color: var(--muted);
}

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

.record-list {
  display: grid;
  gap: 10px;
  min-height: 280px;
  max-height: 420px;
  overflow: auto;
}

.talking-points {
  margin: 0;
  padding-left: 18px;
  color: #405852;
  line-height: 1.8;
}

.error {
  color: var(--danger);
  font-weight: 900;
}

@media (max-width: 980px) {
  .topbar,
  .hero,
  .workspace,
  .records-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand {
    min-width: 0;
  }

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

@media (max-width: 560px) {
  main {
    width: min(100vw - 24px, 1280px);
    padding-top: 18px;
  }

  h1 {
    font-size: 38px;
  }

  .metrics-grid,
  .control-grid,
  .ask-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 14px;
  }
}
