:root {
  color-scheme: light;
  --ink: #082044;
  --muted: #546276;
  --line: #cbd8e6;
  --soft-line: #e3ebf4;
  --panel: #ffffff;
  --page: #f4f8fb;
  --accent: #2f6f5e;
  --accent-dark: #245849;
  --warning: #8a5a00;
  --warning-bg: #fff5dd;
  --blue: #244f7a;
  --blue-soft: #e9f2fb;
  --danger: #9a2f2f;
  --danger-bg: #fff0f0;
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
}

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

button,
.link-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  padding: 10px 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.link-button:hover {
  border-color: var(--blue);
}

button:disabled {
  color: #8b96a7;
  background: #f1f5f9;
  border-color: var(--soft-line);
  cursor: not-allowed;
}

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

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

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px clamp(18px, 4vw, 48px) 16px;
  background: #fff;
  border-bottom: 1px solid var(--soft-line);
}

.eyebrow {
  margin: 0 0 4px;
  color: #669f9b;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(36px, 5vw, 52px);
  line-height: 1;
}

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

h3 {
  margin-bottom: 8px;
  font-size: 17px;
}

.header-actions,
.button-row,
.tabs,
.mode-picker,
.panel-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.workspace {
  width: min(1240px, calc(100% - 32px));
  margin: 24px auto 48px;
}

.mode-picker {
  align-items: stretch;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.mode-card {
  display: grid;
  gap: 6px;
  align-content: start;
  text-align: left;
  min-height: 94px;
  padding: 16px;
  background: #fff;
}

.mode-card span {
  font-size: 18px;
}

.mode-card small,
.panel-note {
  color: var(--muted);
  line-height: 1.45;
}

.mode-card.active {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.mode-card.active small {
  color: #e8f2fc;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.status-strip > div {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.status-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.status-strip strong {
  font-size: 22px;
}

.tabs {
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}

.tab-button {
  border: 0;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--muted);
  padding: 14px 18px;
}

.tab-button.active {
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-bottom-color: #fff;
  margin-bottom: -1px;
}

.tab-panel {
  display: none;
}

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

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  gap: 18px;
}

.form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  max-width: 980px;
  margin: 0 auto;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 16px 35px rgba(8, 32, 68, 0.05);
}

.panel + .panel {
  margin-top: 18px;
}

.summary-panel {
  margin-top: 18px;
}

.panel-heading {
  justify-content: space-between;
  margin-bottom: 14px;
}

.panel-heading h2 {
  margin-bottom: 0;
}

.small-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 12px;
  font-weight: 800;
}

.file-drop {
  display: grid;
  gap: 6px;
  padding: 18px;
  margin-bottom: 16px;
  border: 1px dashed var(--blue);
  border-radius: 8px;
  background: var(--blue-soft);
  cursor: pointer;
}

.file-drop input {
  display: none;
}

.file-drop span {
  font-weight: 800;
}

.file-drop small,
.field span,
.clean-list,
.notice,
.empty-state,
.guide-output,
td {
  color: var(--muted);
}

.upload-status {
  margin: -4px 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  font-weight: 700;
}

.upload-status.ready {
  color: var(--green);
  border-color: rgba(92, 133, 103, 0.4);
  background: #f4fbf5;
}

.upload-status.error {
  color: #9f2f24;
  border-color: rgba(159, 47, 36, 0.35);
  background: #fff5f4;
}

.field {
  display: grid;
  gap: 7px;
}

.field.stack {
  margin-top: 16px;
}

.field span {
  font-size: 13px;
  font-weight: 800;
}

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

textarea {
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(47, 111, 94, 0.18);
  border-color: var(--accent);
}

.clean-list {
  display: grid;
  gap: 10px;
  padding-left: 20px;
}

.notice {
  border-left: 4px solid var(--warning);
  border-radius: 6px;
  background: var(--warning-bg);
  padding: 12px;
  line-height: 1.45;
}

.transcript-help {
  margin: 12px 0 16px;
}

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

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

.payment-gate,
.period-check,
.qualifier-callout,
.signature-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 16px;
  margin-top: 16px;
}

.payment-gate {
  margin-top: 0;
}

.period-check {
  margin-bottom: 16px;
}

.qualifier-callout {
  margin-top: 16px;
}

.qualifier-callout p {
  color: var(--muted);
  line-height: 1.45;
}

.button-field {
  align-content: end;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.summary-metric {
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.summary-metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 8px;
}

.summary-metric strong {
  font-size: 28px;
}

.price-line {
  font-size: 34px;
  font-weight: 900;
  margin-bottom: 8px;
}

.payment-message {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.unlock-banner {
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: #e8f7ee;
  color: #1f5f3d;
  font-weight: 800;
  padding: 12px;
  margin-bottom: 14px;
}

.signature-pad {
  width: 100%;
  height: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  touch-action: none;
}

.form-layout .panel {
  padding: 16px;
  box-shadow: 0 10px 24px rgba(8, 32, 68, 0.04);
}

.form-layout .panel-heading {
  margin-bottom: 10px;
}

.form-layout h2 {
  margin-bottom: 10px;
  font-size: 18px;
}

.form-layout h3 {
  font-size: 15px;
}

.form-layout .form-grid {
  gap: 10px;
}

.form-layout .field {
  gap: 5px;
}

.form-layout .field span,
.form-layout .status-label {
  font-size: 12px;
}

.form-layout input,
.form-layout select,
.form-layout textarea {
  min-height: 38px;
  padding: 8px 10px;
  font-size: 14px;
}

.form-layout .notice,
.form-layout .payment-message,
.form-layout .guide-section,
.form-layout .qualifier-callout p {
  font-size: 14px;
}

.form-layout .guide-output {
  gap: 10px;
}

.form-layout .guide-section {
  padding: 11px 12px;
}

.form-layout .guide-section p {
  margin-bottom: 6px;
  line-height: 1.38;
}

.form-layout .signature-card,
.form-layout .qualifier-callout,
.form-layout .spouse-signature-block {
  padding: 12px;
  margin-top: 12px;
}

.form-layout .spouse-signature-block {
  border-top: 1px solid var(--soft-line);
  padding-right: 0;
  padding-bottom: 0;
  padding-left: 0;
}

.form-layout .signature-pad {
  height: 130px;
}

.form-layout .button-row {
  gap: 8px;
}

.form-layout button,
.form-layout .link-button {
  padding: 8px 12px;
  font-size: 14px;
}

.locked-blur {
  user-select: none;
  pointer-events: none;
}

.covid-notice {
  margin-top: 12px;
  border-left-color: var(--blue);
  background: var(--blue-soft);
}

body:not([data-workflow="covid"]) .covid-only,
body:not([data-workflow="covid"]) .covid-notice {
  display: none;
}

#clientExplanationField,
#supportingDocsField {
  display: none;
}

.empty-state {
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  padding: 28px;
  text-align: center;
  background: #fbfdff;
}

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

.period-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.period-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 94, 0.14);
}

.period-card-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 12px;
}

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

.metric {
  border-radius: 8px;
  background: #f7fafc;
  padding: 12px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
}

.metric strong {
  font-size: 18px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--soft-line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--ink);
  background: #f8fbfe;
  font-size: 13px;
}

td {
  font-size: 14px;
}

.line-cell {
  max-width: 360px;
  white-space: normal;
}

.confidence {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.confidence.high {
  color: #1f5f3d;
  background: #e8f7ee;
}

.confidence.medium {
  color: #7b5208;
  background: #fff1cf;
}

.confidence.low {
  color: var(--danger);
  background: var(--danger-bg);
}

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

.full-row {
  grid-column: 1 / -1;
}

.guide-panel {
  position: static;
}

.guide-output {
  display: grid;
  gap: 14px;
}

.guide-section {
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdff;
}

.guide-section.important {
  border-color: #a9c3df;
  background: #f0f7ff;
}

.guide-section h3 {
  margin-bottom: 8px;
}

.guide-section p {
  margin-bottom: 8px;
  line-height: 1.45;
}

.guide-section p:last-child {
  margin-bottom: 0;
}

.preview-signature {
  width: 260px;
  max-width: 100%;
  height: 76px;
  object-fit: contain;
  border-bottom: 1px solid var(--ink);
}

.signature-placeholder {
  display: block;
  padding: 20px 0 8px;
  border-bottom: 1px solid var(--ink);
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 32, 68, 0.38);
  z-index: 20;
}

.modal {
  width: min(680px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 22px;
  box-shadow: 0 24px 80px rgba(8, 32, 68, 0.28);
}

@media (max-width: 900px) {
  .app-header,
  .period-card-header {
    display: grid;
  }

  .status-strip,
  .two-column,
  .form-layout,
  .period-metrics,
  .mode-picker,
  .summary-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .guide-panel {
    position: static;
  }
}

@media print {
  body {
    background: #fff;
  }

  .app-header,
  .status-strip,
  .tabs,
  .payment-gate,
  .unlock-banner,
  .tab-panel:not(#form843),
  .form-layout > .panel:first-child,
  .button-row {
    display: none !important;
  }

  .workspace,
  .two-column,
  .form-layout {
    display: block;
    width: 100%;
    margin: 0;
  }

  .panel,
  .guide-section {
    box-shadow: none;
    border-color: #999;
  }
}
