:root {
  --page: #f4f7fb;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --ink: #132033;
  --muted: #667085;
  --border: #d9e1ec;
  --navy: #12335c;
  --green: #1f8a70;
  --green-soft: #eaf6f2;
  --amber: #b7791f;
  --shadow: 0 16px 36px rgba(18, 51, 92, 0.08);
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select { font: inherit; }

button { cursor: pointer; }

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

.sidebar {
  width: 260px;
  flex: 0 0 260px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

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

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  font-weight: 800;
}

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

.brand strong { font-size: 17px; }

.brand span,
.principle span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.nav-list { display: grid; gap: 8px; }

.nav-item {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 12px 14px;
  border-radius: 8px;
  color: #4b5565;
  font-weight: 700;
}

.nav-item.active {
  background: #eef4ff;
  color: var(--navy);
}

.principle {
  margin-top: auto;
  border: 1px solid #cae7de;
  background: #f1fbf7;
  border-radius: 8px;
  padding: 16px;
  display: grid;
  gap: 8px;
}

.principle strong { color: #146c57; }

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  padding: 24px;
}

.main-panel,
.rail-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.main-panel { padding: 24px; }

.panel-heading,
.draft-heading,
.rail-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.overline {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2 { margin: 0; line-height: 1.18; }
h1 { font-size: 24px; }
h2 { font-size: 19px; }

.status-badge,
.confidence {
  border-radius: 999px;
  background: #edf4ff;
  color: var(--navy);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.upload-zone {
  margin-top: 24px;
  border: 1px dashed #b8c6d8;
  background: var(--surface-muted);
  border-radius: 8px;
  min-height: 104px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
}

.icon,
.check-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--green);
  font-weight: 900;
}

.upload-zone span:nth-child(2) {
  display: grid;
  gap: 4px;
  color: var(--muted);
}

.upload-zone strong { color: var(--ink); }

.upload-zone input {
  margin-left: auto;
  max-width: 220px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 22px;
}

label {
  display: grid;
  gap: 8px;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  font-size: 14px;
}

.upload-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.mini-upload {
  border: 1px solid var(--border);
  background: var(--surface-muted);
  border-radius: 8px;
  min-height: 92px;
  display: grid;
  justify-items: start;
  gap: 6px;
  padding: 14px;
  color: var(--ink);
  text-align: left;
}

.doc-icon { color: var(--navy); font-weight: 900; }
.mini-upload span { color: var(--muted); font-size: 13px; }

.source-note {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--green-soft);
  border-left: 3px solid var(--green);
  color: #285c50;
  border-radius: 8px;
  padding: 14px;
  margin-top: 20px;
}

.source-note p { margin: 0; line-height: 1.5; }

.actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.primary-action {
  border: 0;
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  min-height: 44px;
  padding: 0 16px;
  font-weight: 800;
}

.draft-preview {
  border-top: 1px solid var(--border);
  margin-top: 22px;
  padding-top: 22px;
}

.stem {
  color: #243247;
  line-height: 1.7;
  font-weight: 650;
}

.choices {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  padding: 0;
  list-style: none;
}

.choices li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #f3f6fb;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 12px;
  line-height: 1.55;
}

.choices li.answer {
  border-color: #8bd3be;
  background: #eefbf7;
}

.choices span {
  color: var(--navy);
  font-weight: 900;
}

.answer-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
}

.answer-row strong { color: var(--navy); }

.json-output {
  margin: 16px 0 0;
  max-height: 260px;
  overflow: auto;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 16px;
  font-size: 12px;
  line-height: 1.55;
}

.right-rail { display: grid; gap: 20px; align-content: start; }
.rail-panel { padding: 22px; }
.workflow-list { display: grid; gap: 14px; margin-top: 18px; }

.workflow-step {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
}

.workflow-step span {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--navy);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 900;
}

.scope-list {
  display: grid;
  gap: 10px;
  padding-left: 18px;
  color: #475467;
  line-height: 1.55;
}

.warning {
  display: grid;
  gap: 8px;
  color: #684600;
  background: #fff8e6;
  border-color: #f2d088;
}

.warning span { color: #7a5b16; line-height: 1.5; }

@media (max-width: 1120px) {
  .workspace { grid-template-columns: 1fr; }
  .right-rail { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 880px) {
  .app-shell { display: block; }
  .sidebar { width: 100%; flex: none; }
  .workspace { padding: 16px; }
  .form-grid,
  .upload-cards,
  .right-rail { grid-template-columns: 1fr; }
  .upload-zone { align-items: flex-start; flex-direction: column; }
  .upload-zone input { margin-left: 0; max-width: 100%; }
}

