@font-face {
  font-family: "Brown";
  src: url("./brown-regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Brown";
  src: url("./brown-bold.woff") format("woff");
  font-weight: 800 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f6f7f8;
  --surface: #ffffff;
  --surface-soft: #f1f4f7;
  --ink: #222733;
  --muted: #667085;
  --line: #d9dee7;
  --line-strong: #b9c2d0;
  --nav: #101114;
  --nav-soft: #1c2028;
  --blue: #2f6fed;
  --teal: #0f766e;
  --green: #2f9461;
  --amber: #b76e00;
  --red: #bc2f2f;
  --purple: #6941c6;
  --shadow: 0 12px 30px rgba(16, 24, 40, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #344054;
  background: #fff;
  font-weight: 800;
  text-decoration: none;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  grid-template-rows: 64px minmax(0, 1fr);
  grid-template-areas:
    "top top"
    "left main";
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 74px minmax(0, 1fr);
}

.app-shell > *,
.screen,
.screen-head > *,
.metric-grid > *,
.source-layout > *,
.input-grid > *,
.rules-grid > *,
.review-desk > *,
.template-grid > * {
  min-width: 0;
}

.topbar {
  grid-area: top;
  position: sticky;
  top: 0;
  z-index: 20;
  min-width: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 0 22px;
  color: #f7f7f8;
  background: var(--nav);
  border-bottom: 1px solid #000;
}

.brand,
.topbar-actions,
.left-nav a,
.nav-note a {
  color: inherit;
  text-decoration: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #111;
  background: #fff;
  font-weight: 900;
}

.brand span:last-child {
  display: grid;
  min-width: 0;
}

.brand strong {
  line-height: 1.1;
}

.brand small {
  color: #b9c0cb;
  font-size: 0.78rem;
  line-height: 1.35;
}

.brand-subtitle {
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  color: #d8dde7;
  font-weight: 650;
}

.topbar-actions a {
  margin-left: 8px;
  padding: 7px 10px;
  border: 1px solid #303642;
  border-radius: 8px;
}

.topbar-save {
  min-height: 34px;
  padding: 6px 12px;
  border-color: #475467;
  color: #111827;
  background: #fff;
}

.job-save-status {
  max-width: min(420px, 42vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #b9c0cb;
  font-size: 0.84rem;
  font-weight: 700;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22a06b;
}

.left-nav {
  grid-area: left;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px 16px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  transition: width 160ms ease, padding 160ms ease;
}

.sidebar-toggle {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-start;
  padding: 8px 12px;
  border-color: var(--line);
  color: #344054;
  background: #f8fafc;
}

.sidebar-toggle:hover {
  border-color: #c7d4ea;
  color: #173b85;
  background: #f1f6ff;
}

.sidebar-toggle-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  position: relative;
}

.sidebar-toggle-icon::before,
.sidebar-toggle-icon::after {
  content: "";
  position: absolute;
  top: 5px;
  width: 9px;
  height: 9px;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: rotate(-45deg);
}

.sidebar-toggle-icon::before {
  left: 1px;
}

.sidebar-toggle-icon::after {
  left: 8px;
}

.sidebar-toggle-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.left-nav nav {
  display: grid;
  gap: 6px;
}

.left-nav a {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 8px;
  color: #48546a;
  font-weight: 750;
}

.left-nav a span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.left-nav a.active,
.left-nav a:hover {
  color: #173b85;
  background: #eaf1ff;
}

.app-shell.sidebar-collapsed .left-nav {
  gap: 12px;
  padding: 18px 10px;
}

.app-shell.sidebar-collapsed .sidebar-toggle {
  justify-content: center;
  padding: 8px;
}

.app-shell.sidebar-collapsed .sidebar-toggle-icon::before,
.app-shell.sidebar-collapsed .sidebar-toggle-icon::after {
  transform: rotate(135deg);
}

.app-shell.sidebar-collapsed .sidebar-toggle-icon::before {
  left: 0;
}

.app-shell.sidebar-collapsed .sidebar-toggle-icon::after {
  left: 7px;
}

.app-shell.sidebar-collapsed .sidebar-toggle-label,
.app-shell.sidebar-collapsed .left-nav a span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.app-shell.sidebar-collapsed .left-nav a {
  justify-content: center;
  padding: 8px;
}

.app-shell.sidebar-collapsed .left-nav a::before {
  content: attr(data-short);
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: inherit;
  background: #f1f4f7;
  font-weight: 900;
}

.app-shell.sidebar-collapsed .left-nav a.active::before,
.app-shell.sidebar-collapsed .left-nav a:hover::before {
  background: #d9e7ff;
}

.nav-note {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfc;
}

.nav-note strong {
  font-size: 0.82rem;
  text-transform: uppercase;
  color: #596579;
}

.nav-note a {
  color: #174ea6;
  font-weight: 850;
}

.nav-note span {
  color: var(--muted);
  font-size: 0.86rem;
}

.workspace {
  grid-area: main;
  min-width: 0;
  overflow: hidden;
  padding: 30px;
}

.screen {
  display: none;
  min-width: 0;
  animation: fade-in 140ms ease-out;
}

.screen.active-screen {
  display: block;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.screen-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: end;
  margin-bottom: 24px;
}

.screen-head.compact {
  grid-template-columns: minmax(0, 880px);
}

.eyebrow {
  margin: 0 0 6px;
  color: #52627a;
  font-size: 0.76rem;
  line-height: 1.25;
  text-transform: uppercase;
  font-weight: 900;
  letter-spacing: 0;
}

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

h1 {
  max-width: 980px;
  margin-bottom: 16px;
  font-size: clamp(2.1rem, 4.5vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: 0;
  overflow-wrap: break-word;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(1.65rem, 2.4vw, 2.5rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 14px;
  font-size: 1.1rem;
  line-height: 1.25;
}

.lede {
  max-width: 860px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
  overflow-wrap: break-word;
}

.decision-card,
.metric-grid article,
.source-card,
.input-section,
.rules-grid > div,
.template-fields,
.document-pane,
.evidence-pane {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.decision-card {
  padding: 18px;
}

.decision-card span,
.metric-grid span,
.source-card span,
.pane-title span,
.field-kind,
.note-kind {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.decision-card strong,
.metric-grid strong {
  display: block;
  margin: 7px 0;
  font-size: 1.16rem;
}

.decision-card p,
.metric-grid p,
.source-card p,
.field-card p,
.check-card p,
.review-note p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

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

.metric-grid article {
  min-height: 150px;
  padding: 18px;
}

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

.jobs-panel {
  display: grid;
  gap: 14px;
}

.new-job-setup {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(240px, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  border: 1px solid #d9e5f8;
  border-radius: 8px;
  background: #f8fbff;
  box-shadow: var(--shadow);
}

.new-job-setup[hidden] {
  display: none;
}

.new-job-setup label {
  display: grid;
  gap: 6px;
  color: #3f4a5f;
  font-size: 0.82rem;
  font-weight: 850;
}

.new-job-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.job-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.42);
}

.job-modal[hidden] {
  display: none;
}

.job-modal-panel {
  width: min(520px, 100%);
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 1px solid #d9e5f8;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.job-modal-panel h2 {
  margin-bottom: 4px;
}

.job-modal-panel label {
  display: grid;
  gap: 6px;
  color: #3f4a5f;
  font-size: 0.82rem;
  font-weight: 850;
}

.jobs-controls {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(240px, 1fr) auto auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.jobs-controls label {
  display: grid;
  gap: 6px;
  color: #3f4a5f;
  font-size: 0.82rem;
  font-weight: 850;
}

.scope-toggle {
  display: inline-flex;
  min-height: 42px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.scope-toggle button {
  min-height: 34px;
  padding: 6px 12px;
  border: 0;
  border-radius: 6px;
  color: #52627a;
  background: transparent;
}

.scope-toggle button.active {
  color: #173b85;
  background: #eaf1ff;
}

.current-job-banner {
  padding: 11px 13px;
  border: 1px solid #d9e5f8;
  border-radius: 8px;
  color: #24519a;
  background: #f1f6ff;
  font-size: 0.9rem;
  font-weight: 760;
}

.warning-text {
  color: #8a4b00;
  font-weight: 780;
}

.jobs-list {
  display: grid;
  gap: 10px;
}

.job-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.job-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.job-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.job-meta span {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
}

.job-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.icon-button.job-delete-button {
  width: 42px;
  min-width: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: #9f1d1d;
  border-color: #f0c8c8;
  background: #fff8f8;
}

.icon-button.job-delete-button:hover,
.icon-button.job-delete-button:focus-visible {
  color: #7f1111;
  border-color: #e49a9a;
  background: #feecec;
}

.icon-button.job-delete-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.source-drop-zone {
  min-height: 178px;
  display: grid;
  place-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 24px;
  border: 2px dashed #8ea7d3;
  border-radius: 8px;
  color: #193b73;
  background: #f5f8ff;
  text-align: center;
  cursor: pointer;
}

.source-drop-zone.is-dragging,
.source-drop-zone:focus-visible {
  outline: 0;
  border-color: var(--blue);
  background: #eaf1ff;
}

.source-drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.source-drop-zone strong {
  font-size: 1.25rem;
}

.source-drop-zone span {
  max-width: 720px;
  color: #4d5e78;
  line-height: 1.45;
}

.source-pack-status {
  min-height: 28px;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.staged-source-files {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
}

.staged-source-files[hidden] {
  display: none;
}

.staged-source-file {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.staged-source-file strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.staged-source-file span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.staged-source-file button {
  min-height: 32px;
  padding: 5px 9px;
  color: var(--red);
  border-color: #e4b0b0;
  background: #fff;
}

.source-process-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -4px 0 14px;
  flex-wrap: wrap;
}

.source-process-controls[hidden] {
  display: none;
}

.source-process-controls span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
}

.source-progress {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid #d9e5f8;
  border-radius: 8px;
  background: #f8fbff;
}

.source-progress[hidden] {
  display: none;
}

.source-progress-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dde8fb;
}

.source-progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 240ms ease;
}

.source-progress strong {
  color: #24519a;
  font-size: 0.86rem;
}

.source-progress.is-complete {
  border-color: #abefc6;
  background: #ecfdf3;
}

.source-progress.is-complete .source-progress-bar {
  background: #d1fadf;
}

.source-progress.is-complete .source-progress-bar span {
  background: var(--green);
}

.source-progress.is-complete strong {
  color: #067647;
}

.source-card {
  min-height: 218px;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 18px;
}

.source-card .source-status {
  justify-self: start;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: #344054;
  background: #f8fafc;
  font-size: 0.8rem;
  font-weight: 800;
}

.source-card.required .source-status {
  border-color: #fedf89;
  color: #874a00;
  background: #fffaeb;
}

.source-card.ready .source-status {
  border-color: #abefc6;
  color: #067647;
  background: #ecfdf3;
}

.source-file-name {
  margin: -4px 0 0;
  color: #344054;
  font-size: 0.88rem;
  font-weight: 760;
  overflow-wrap: anywhere;
}

.source-file-name span {
  color: var(--muted);
  font-size: 0.74rem;
}

.upload-control {
  min-height: 42px;
  display: grid;
  place-items: center;
  border: 1px dashed #9aa8bd;
  border-radius: 8px;
  color: #174ea6;
  background: #f8fbff;
  cursor: pointer;
}

.upload-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-control span {
  color: inherit;
  font-size: 0.86rem;
}

.source-extracts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.source-extracts span,
.field-source {
  display: inline-flex;
  max-width: 100%;
  min-height: 24px;
  align-items: center;
  padding: 4px 7px;
  border: 1px solid #d9e5f8;
  border-radius: 999px;
  color: #24519a;
  background: #f1f6ff;
  font-size: 0.74rem;
  font-weight: 820;
  overflow-wrap: anywhere;
}

.view-tabs {
  display: inline-flex;
  gap: 6px;
  margin: 0 0 16px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.view-tabs button {
  min-height: 34px;
  border-color: transparent;
  color: #475467;
  background: transparent;
}

.view-tabs button.active {
  color: #173b85;
  border-color: #d9e5f8;
  background: #eaf1ff;
}

.template-tab-panel {
  display: none;
}

.template-tab-panel.active {
  display: block;
}

.template-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.template-doc {
  min-height: calc(100vh - 172px);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  font-family: "Brown", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
}

.template-doc h3 {
  margin-bottom: 4px;
  font-size: 1.8rem;
}

.template-doc h4 {
  margin: 24px 0 8px;
  font-size: 1rem;
}

.template-doc p {
  color: #303847;
}

.doc-list,
.template-doc ul,
.draft-output ul {
  margin: 8px 0 14px 22px;
  padding: 0;
}

.doc-list li,
.template-doc li,
.draft-output li {
  margin: 5px 0;
  color: #303847;
}

.template-value {
  display: inline;
  padding: 2px 4px;
  border-radius: 4px;
  outline: 0;
}

.template-value.source-field {
  background: #dff3ff;
}

.template-value.edited-field {
  background: #dff7e8;
}

.template-value.missing-field {
  color: #6b7280;
  background: #f3f4f6;
}

.template-value:focus {
  box-shadow: 0 0 0 2px rgba(47, 111, 237, 0.24);
}

.template-target {
  display: block;
  margin: -3px -6px;
  padding: 3px 6px;
  border-radius: 6px;
  outline: 0;
}

.template-target.source-field {
  background: #f3faff;
  box-shadow: inset 0 0 0 1px #9bd5ff;
}

.template-target.edited-field {
  background: #f3fbf6;
  box-shadow: inset 0 0 0 1px #abefc6;
}

.template-target.missing-field {
  color: #6b7280;
  background: #fafbfc;
  box-shadow: inset 0 0 0 1px #d6dbe5;
}

.template-target.is-template-linked {
  background: #eaf1ff !important;
  box-shadow: inset 0 0 0 2px var(--blue);
}

.template-target.is-template-linked p {
  color: #173b85;
}

.template-section.source-field {
  border-color: #9bd5ff;
  background: #f3faff;
}

.template-section.edited-field {
  border-color: #abefc6;
  background: #f3fbf6;
}

.template-section.missing-field {
  border-color: #d6dbe5;
  background: #fafbfc;
}

.template-section.is-template-linked {
  border-color: #2f6fed;
  background: #eef5ff !important;
  box-shadow: inset 0 0 0 2px rgba(47, 111, 237, 0.34);
}

.template-section.is-template-linked p {
  color: #173b85;
}

.template-fields {
  position: relative;
  overflow: visible;
  padding: 16px;
}

.template-fields-title {
  margin-bottom: 16px;
}

.field-card {
  position: relative;
  width: calc(100% - 32px);
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.08);
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.field-card + .field-card {
  margin-top: 0;
}

.field-card strong {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 0;
}

.field-card textarea,
.field-card select {
  margin-top: 6px;
}

.field-card textarea {
  min-height: 66px;
  overflow: hidden;
}

.field-help {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  border: 1px solid #c7d4ea;
  border-radius: 50%;
  color: #24519a;
  background: #f1f6ff;
  font-size: 0.72rem;
  font-weight: 900;
  cursor: help;
  position: relative;
}

.field-help-float {
  position: fixed;
  z-index: 1000;
  padding: 10px 11px;
  border: 1px solid #c7d4ea;
  border-radius: 8px;
  color: #243042;
  background: #fff;
  box-shadow: 0 12px 30px rgba(16, 24, 40, 0.18);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
  pointer-events: none;
}

.field-help-float[hidden] {
  display: none;
}

.is-template-linked {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  background: #eaf1ff !important;
}

#reviewerInputsTab .is-template-linked,
#reviewerInputsTab [data-template-key] {
  outline: 0;
  background: transparent !important;
}

.field-card.is-surfaced {
  z-index: 5;
  border-color: var(--blue);
  box-shadow: 0 14px 34px rgba(47, 111, 237, 0.18);
  transform: translateX(-4px);
}

.field-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 760;
}

.field-kind.client { color: var(--blue); }
.field-kind.year { color: var(--amber); }
.field-kind.review { color: var(--purple); }

.template-note-list {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  width: calc(100% - 32px);
}

.template-note {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid #c7d4ea;
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  background: #f8fbff;
}

.template-note + .template-note {
  margin-top: 8px;
}

.template-note span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.template-note strong,
.template-note p {
  margin: 0;
  overflow-wrap: anywhere;
}

.template-note p {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.clarico-wordmark {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 18px;
  margin: 0 0 22px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-family: "Brown", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.clarico-wordmark-text {
  display: grid;
  gap: 4px;
  text-align: left;
}

.clarico-wordmark span {
  color: #111827;
  font-size: 1.2rem;
  font-weight: 900;
}

.clarico-wordmark small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
  text-transform: uppercase;
}

.clarico-logo {
  width: 150px;
  height: auto;
  object-fit: contain;
}

.signature-block {
  margin-top: 28px;
  display: grid;
  gap: 16px;
}

.signature-line {
  display: inline-block;
  min-width: 260px;
  border-top: 1px solid #111827;
  padding-top: 8px;
}

.date-line {
  display: inline-block;
  min-width: 220px;
  border-bottom: 1px solid #111827;
  margin-left: 8px;
}

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

.input-section {
  min-width: 0;
  padding: 18px;
}

.wide-section {
  grid-column: 1 / -1;
}

.input-source-note {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #d9e5f8;
  border-radius: 8px;
  color: #24519a;
  background: #f1f6ff;
  font-size: 0.88rem;
  font-weight: 760;
}

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

.reviewer-field-grid {
  align-items: start;
}

.reviewer-field-block {
  display: grid;
  gap: 6px;
  color: #3f4a5f;
  font-size: 0.82rem;
  font-weight: 850;
}

.reviewer-field-block.wide-field {
  grid-column: 1 / -1;
}

.reviewer-field-label {
  color: #3f4a5f;
  font-size: 0.82rem;
  font-weight: 850;
}

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

.allocation-summary-field textarea {
  background: #f8fbff;
}

label {
  display: grid;
  gap: 6px;
  color: #3f4a5f;
  font-size: 0.82rem;
  font-weight: 850;
}

.field-hint {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 650;
  line-height: 1.35;
}

.step-purpose {
  max-width: 760px;
  margin: 2px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cfd6e2;
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fff;
}

textarea {
  min-height: 74px;
  resize: vertical;
}

textarea.auto-grow {
  min-height: 42px;
  overflow: hidden;
  resize: none;
  line-height: 1.42;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title h3 {
  margin-bottom: 0;
}

.section-title p {
  max-width: 760px;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.section-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.section-action-help {
  margin-right: 2px;
}

button {
  min-height: 38px;
  border: 1px solid #2f6fed;
  border-radius: 8px;
  padding: 8px 12px;
  color: #fff;
  background: var(--blue);
  font-weight: 850;
  cursor: pointer;
}

button.secondary {
  color: #344054;
  border-color: var(--line);
  background: #fff;
}

.topbar-actions .topbar-save {
  min-height: 34px;
  padding: 6px 12px;
  border-color: #475467;
  color: #111827;
  background: #fff;
}

.allocation-editor {
  display: grid;
  gap: 10px;
}

.beneficiary-list-label {
  margin-bottom: 14px;
}

.allocation-row {
  display: grid;
  grid-template-columns: 1.05fr 1fr 0.72fr 0.72fr 1.15fr 1.15fr 38px;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.readonly-output {
  color: #455164;
  background: #f6f7f8;
}

.empty-state {
  margin: 0;
  padding: 14px;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #fff;
}

.remove-row {
  width: 38px;
  padding: 0;
  color: var(--red);
  border-color: #f1b7b7;
  background: #fff;
}

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

.rules-grid > div {
  padding: 18px;
}

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

.check-card,
.review-note {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.review-note {
  cursor: pointer;
  width: 100%;
  min-height: 74px;
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.08);
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease, min-height 120ms ease;
}

.review-note.manual-note {
  border-left: 5px solid var(--blue);
}

.review-note.manual-note strong {
  color: #344054;
  font-size: 0.84rem;
  line-height: 1.35;
}

.manual-note-field {
  display: grid;
  gap: 5px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.manual-note-field textarea {
  min-height: 48px;
  color: #344054;
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.4;
  text-transform: none;
  overflow: hidden;
  resize: vertical;
}

.manual-note-quote textarea {
  min-height: 44px;
  border-left: 4px solid var(--blue);
  color: #475467;
  background: #f8fbff;
  font-size: 0.82rem;
  font-weight: 700;
}

.review-note + .review-note {
  margin-top: 10px;
}

.review-note.is-selected {
  z-index: 8;
  border-color: #2f6fed;
  box-shadow: 0 14px 34px rgba(47, 111, 237, 0.18);
  transform: translateX(-6px);
}

.check-card {
  border-left: 5px solid var(--green);
}

.check-card.warn,
.review-note.warn {
  border-left: 5px solid var(--amber);
}

.check-card.block,
.review-note.block {
  border-left: 5px solid var(--red);
}

.check-card.decision,
.review-note.decision {
  border-left: 5px solid var(--purple);
}

.check-card strong,
.review-note strong {
  display: block;
  margin: 4px 0 5px;
}

.review-note p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.review-note.is-selected p {
  display: block;
  overflow: visible;
}

.clear-review-note {
  margin-top: 6px;
  padding: 6px 9px;
  border-color: var(--line);
  color: var(--muted);
  background: #fff;
  font-size: 0.76rem;
}

.review-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  margin-bottom: 16px;
}

.review-toolbar h2 {
  margin-bottom: 0;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.review-desk {
  display: grid;
  grid-template-columns: minmax(0, 820px) minmax(300px, 340px);
  gap: 18px;
  justify-content: center;
  min-height: calc(100vh - 166px);
  align-items: start;
}

.document-pane,
.evidence-pane {
  min-width: 0;
  overflow: hidden;
}

.pane-title {
  min-height: 62px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.pane-title strong {
  text-align: right;
}

.draft-output {
  min-height: calc(100vh - 228px);
  margin: 0;
  padding: 32px;
  color: #1f2937;
  background: #fff;
  font: 0.96rem/1.62 "Brown", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.draft-output h3 {
  margin: 0 0 12px;
  font: 850 1.02rem/1.3 "Brown", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.draft-output p {
  margin: 0 0 12px;
}

.draft-output table {
  width: 100%;
  margin: 12px 0;
  border-collapse: collapse;
  font: 0.86rem/1.35 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.draft-output th,
.draft-output td {
  padding: 9px 10px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.draft-output th {
  background: #f6f7f8;
  font-weight: 850;
}

.doc-section {
  margin: 0 0 22px;
  padding: 10px 12px;
  border: 2px solid transparent;
  border-radius: 8px;
  transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.doc-section.has-comment {
  cursor: pointer;
  border-left-width: 5px;
}

.doc-section.has-manual-note {
  border-left-color: var(--blue);
  background: #f8fbff;
}

.doc-section.has-comment.warn {
  border-left-color: var(--amber);
  background: #fff8e8;
}

.doc-section.has-comment.block {
  border-left-color: var(--red);
  background: #fff1f1;
}

.doc-section.has-comment.decision {
  border-left-color: var(--purple);
  background: #f6f1ff;
}

.doc-section.is-linked {
  border-color: #2f6fed;
  background: #eef5ff;
  box-shadow: inset 0 0 0 1px rgba(47, 111, 237, 0.24);
}

.loss-accumulation {
  margin-top: 1rem;
}

.review-note.is-linked {
  border-color: #2f6fed;
  background: #eef5ff;
}

.evidence-pane {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  box-shadow: none;
  background: transparent;
  border-color: transparent;
}

.annotation-composer,
.google-doc-status {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.annotation-composer {
  display: grid;
  gap: 8px;
}

.annotation-composer[hidden] {
  display: none;
}

.annotation-composer span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.annotation-composer blockquote {
  margin: 0;
  padding-left: 10px;
  border-left: 4px solid var(--blue);
  color: #344054;
  font-size: 0.88rem;
  line-height: 1.4;
}

.google-doc-status {
  display: none;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 760;
  line-height: 1.4;
}

.google-doc-status:not(:empty) {
  display: block;
}

.google-doc-status a {
  color: #174ea6;
  font-weight: 850;
}

.review-notes {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 0;
}

.comment-reply {
  display: none;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.review-note.is-selected .comment-reply {
  display: grid;
}

.comment-reply textarea {
  min-height: 70px;
  font-size: 0.86rem;
  line-height: 1.4;
}

.comment-reply button {
  justify-self: start;
}

.reply-status {
  min-height: 18px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
}

.cleared-review-notes {
  margin-top: 14px;
}

.cleared-review-notes details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.cleared-review-notes summary {
  padding: 10px 12px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 850;
}

.cleared-note {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 9px 12px;
  border-top: 1px solid var(--line);
}

.cleared-note strong {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cleared-note button {
  padding: 6px 9px;
  font-size: 0.76rem;
}

.note-kind {
  display: inline-flex;
  margin-bottom: 4px;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #111318;
}

.login-shell {
  width: min(100%, 460px);
}

.login-panel {
  padding: 26px;
  border: 1px solid #2c3340;
  border-radius: 8px;
  color: #f7f8fb;
  background: #181c24;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.26);
}

.login-brand {
  margin-bottom: 26px;
}

.login-copy {
  color: #c6ccd7;
  line-height: 1.5;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.login-form input {
  color: #111827;
}

.login-error {
  display: none;
  margin: 14px 0 0;
  color: #ffb4a8;
  font-weight: 800;
}

.has-login-error .login-error {
  display: block;
}

@media (max-width: 1480px) {
  .allocation-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .allocation-row label:nth-of-type(6),
  .allocation-row label:nth-of-type(5) {
    grid-column: span 2;
  }
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-rows: 64px minmax(0, 1fr);
    grid-template-areas:
      "top top"
      "left main";
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 74px minmax(0, 1fr);
  }

  .workspace {
    padding-bottom: 18px;
  }

  .screen-head,
  .new-job-setup,
  .jobs-controls,
  .template-grid,
  .review-desk,
  .rules-grid {
    grid-template-columns: 1fr;
  }

  .template-fields {
    position: static;
    max-height: none;
  }

  .field-card {
    width: 100%;
  }

  .field-card + .field-card {
    margin-top: 10px;
  }

  .evidence-pane {
    position: static;
    max-height: none;
  }

  .draft-output {
    min-height: 560px;
  }
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
    width: 100vw;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .app-shell.sidebar-collapsed {
    display: block;
  }

  .topbar {
    position: static;
    min-height: 64px;
    align-items: start;
    flex-direction: column;
    padding: 14px 16px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .left-nav {
    position: static;
    height: auto;
  }

  .left-nav {
    padding: 12px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-toggle {
    display: none;
  }

  .app-shell.sidebar-collapsed .left-nav {
    gap: 24px;
    padding: 12px 16px;
  }

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

  .app-shell.sidebar-collapsed .left-nav a {
    justify-content: flex-start;
    padding: 8px 12px;
  }

  .app-shell.sidebar-collapsed .left-nav a::before {
    content: none;
  }

  .app-shell.sidebar-collapsed .left-nav a span {
    position: static;
    width: auto;
    height: auto;
    overflow: hidden;
    clip: auto;
  }

  .nav-note {
    margin-top: 0;
  }

  .workspace {
    padding: 18px 16px;
    width: 100vw;
    max-width: 100vw;
  }

  .screen,
  .screen-head,
  .decision-card,
  .metric-grid,
  .metric-grid article {
    width: 100%;
    max-width: calc(100vw - 32px);
  }

  .source-layout,
  .metric-grid,
  .input-grid,
  .form-grid,
  .reviewer-subgrid {
    grid-template-columns: 1fr;
  }

  .allocation-row {
    grid-template-columns: 1fr;
  }

  .review-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-actions {
    justify-content: flex-start;
  }

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

  .pane-title strong {
    text-align: left;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: 1.95rem;
    line-height: 1.05;
    max-width: 330px;
  }

  h2 {
    max-width: 330px;
    font-size: 1.5rem;
    line-height: 1.12;
    overflow-wrap: break-word;
  }

  .lede {
    font-size: 0.94rem;
    max-width: 330px;
  }

  .decision-card,
  .metric-grid article {
    max-width: 330px;
  }

  .decision-card p,
  .metric-grid p {
    max-width: 292px;
  }

  .left-nav nav {
    grid-template-columns: 1fr;
  }

  .template-doc {
    padding: 20px;
  }

  .draft-output {
    padding: 18px;
    font-size: 0.84rem;
  }
}
