:root {
  --canvas: #f6f7f9;
  --surface: #ffffff;
  --text: #18212f;
  --muted: #647084;
  --border: #d8dee8;
  --primary: #1f7a5b;
  --primary-hover: #175f47;
  --danger: #a43d3d;
  --info: #245ea8;
  --warning: #8a5a00;
  --radius: 6px;
}

* { box-sizing: border-box; }

html { background: var(--canvas); color: var(--text); }

body {
  margin: 0;
  min-width: 320px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0;
}

button, input, select { font: inherit; letter-spacing: 0; }
button, a { touch-action: manipulation; }

a { color: var(--primary-hover); }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, .ca-table-scroll:focus-visible {
  outline: 3px solid #0b5fa5;
  outline-offset: 3px;
}

.site-header {
  min-height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  width: min(1120px, calc(100% - 40px));
  min-height: 64px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  color: var(--text);
  font-size: 20px;
  font-weight: 750;
  text-decoration: none;
}

.page-shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 56px 0 72px;
}

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { text-wrap: balance; }
h1 { max-width: 720px; margin-bottom: 16px; font-size: 36px; line-height: 1.2; }
h2 { font-size: 22px; line-height: 1.3; }
h3 { font-size: 18px; line-height: 1.35; }

.eyebrow {
  margin-bottom: 10px;
  color: var(--primary-hover);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
}

.auth-flow { max-width: 560px; }
.auth-flow__intro { max-width: 520px; margin-bottom: 32px; color: var(--muted); font-size: 18px; text-wrap: pretty; }
.auth-form { max-width: 480px; }
.auth-flow__switch { margin-top: 24px; color: var(--muted); }
.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-weight: 700; }
.field__hint { margin-bottom: 8px; color: var(--muted); }
.field input {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid #8792a5;
  border-radius: var(--radius);
}
.field input[aria-invalid="true"] { border: 2px solid var(--danger); }
.field--code { max-width: 240px; }
.field--code input { font-variant-numeric: tabular-nums; font-size: 24px; letter-spacing: 0; }

.form-error {
  min-height: 24px;
  margin: 0 0 16px;
  color: var(--danger);
  font-weight: 650;
}

.form-status {
  min-height: 24px;
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 650;
}
.form-status--error, .logout-status { color: var(--danger); }
.logout-status { min-height: 24px; margin: 0 0 -24px; font-weight: 650; }

.button {
  min-height: 46px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
}
.button--primary { color: #fff; background: var(--primary); font-weight: 700; }
.button--primary:hover { background: var(--primary-hover); }
.button--secondary { color: var(--text); background: var(--surface); border-color: #8792a5; font-weight: 700; }
.button--secondary:hover { border-color: var(--text); }
.button:disabled, .button-link:disabled { cursor: not-allowed; opacity: .62; }
.button-link {
  min-height: 44px;
  padding: 8px 0;
  color: var(--primary-hover);
  background: transparent;
  border: 0;
  text-decoration: underline;
  cursor: pointer;
}
.header-action { flex: none; }
.back-link { display: inline-block; min-height: 44px; margin-bottom: 18px; padding-top: 8px; }
.destination { margin: -18px 0 28px; color: var(--text); font-weight: 650; overflow-wrap: anywhere; }
.resend { display: flex; align-items: center; gap: 8px 16px; margin-top: 24px; color: var(--muted); }

.landing { display: grid; gap: 72px; }
.landing-hero { max-width: 820px; padding: 32px 0 20px; }
.landing-hero h1 { max-width: 780px; font-size: clamp(40px, 6vw, 64px); line-height: 1.08; }
.landing-hero__lead { max-width: 680px; margin-bottom: 18px; color: var(--muted); font-size: 20px; text-wrap: pretty; }
.landing-hero__note { margin-bottom: 24px; color: var(--text); font-weight: 650; }
.landing-hero__actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.landing-hero__action { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.landing-process { border-top: 2px solid var(--text); }
.landing-process__heading { max-width: 720px; padding: 28px 0 12px; }
.landing-process__heading h2 { margin-bottom: 0; }
.landing-steps { margin: 0; padding: 0; list-style: none; border-bottom: 1px solid var(--border); }
.landing-steps li { min-height: 112px; padding: 22px 0; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 18px; border-top: 1px solid var(--border); }
.landing-steps li > span { color: var(--primary-hover); font-size: 14px; font-weight: 750; font-variant-numeric: tabular-nums; }
.landing-steps h3 { margin-bottom: 5px; }
.landing-steps p { max-width: 640px; margin-bottom: 0; color: var(--muted); text-wrap: pretty; }

.dashboard { display: grid; gap: 44px; }
.dashboard__heading { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr); align-items: end; gap: 40px; }
.dashboard__heading h1 { margin-bottom: 0; }
.dashboard__heading > p { margin-bottom: 4px; color: var(--muted); text-wrap: pretty; }
.dashboard-section { min-width: 0; }
.section-heading { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 2px solid var(--text); }
.section-heading h2 { margin-bottom: 10px; }
.section-heading span { color: var(--muted); font-variant-numeric: tabular-nums; }
.row-list { background: var(--surface); }
.access-notice { padding: 20px 22px; background: #edf6f2; border-bottom: 1px solid #bad8cc; }
.access-notice h3 { margin-bottom: 5px; }
.access-notice p { max-width: 760px; margin-bottom: 0; color: var(--muted); text-wrap: pretty; }
.module-row, .request-row {
  min-width: 0;
  min-height: 96px;
  padding: 20px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--border);
}
.row-main { min-width: 0; }
.row-main h3 { margin-bottom: 5px; overflow-wrap: anywhere; }
.row-main p { margin-bottom: 0; color: var(--muted); overflow-wrap: anywhere; text-wrap: pretty; }
.file-types { flex: none; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.module-row__actions { flex: none; display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 12px; }
.module-row--primary { border-left: 3px solid var(--primary); }
.module-row--secondary { background: #fbfcfd; }
.file-types span { padding: 3px 7px; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; font-size: 14px; }
.status { flex: none; max-width: 210px; padding: 5px 9px; border-radius: 4px; font-size: 14px; font-weight: 700; text-align: center; }
.status--draft, .status--action_required, .status--payment_required { color: #684300; background: #fff1c9; }
.status--under_review, .status--in_progress { color: #174d82; background: #e7f1fc; }
.status--failed { color: #852f2f; background: #fbeaea; }
.status--ready, .status--completed { color: #175b43; background: #e2f3eb; }
.status--closed { color: #4e5969; background: #edf0f4; }
.request-meta { font-size: 14px; }
.ca-artifacts { min-width: 0; display: grid; gap: 6px; margin-top: 12px; }
.ca-order-summary { min-height: 44px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 16px; }
.ca-position-counters { min-width: 0; display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.ca-position-counters span { white-space: nowrap; }
.ca-order-actions { flex: none; }
.ca-resume-clarification, .ca-resume-order { display: inline-flex; align-items: center; color: var(--primary-hover); font-size: 14px; font-weight: 700; }
.ca-artifacts__actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; }
.ca-artifacts__actions .button { min-width: 252px; min-height: 36px; padding: 6px 10px; font-size: 14px; }
.ca-artifacts__status { min-height: 21px; margin: 0; color: var(--muted); font-size: 14px; }
.ca-artifacts__list { display: grid; gap: 6px; }
.ca-artifact-row { min-height: 32px; display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 14px; }
.ca-artifact-row > div { display: grid; gap: 1px; }
.ca-artifact-row time { font-size: 13px; }
.ca-artifact-row a { flex: none; min-width: 96px; min-height: 32px; display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; text-align: right; font-weight: 700; }
.ca-artifact-download__icon { width: 16px; height: 16px; flex: none; }
.ca-intake { scroll-margin-top: 24px; }
.ca-intake > .form-status { margin: 18px 0 -2px; }
.ca-workspace { padding: 28px 22px; background: var(--surface); border-bottom: 1px solid var(--border); }
.ca-workspace__intro { max-width: 720px; margin-bottom: 24px; }
.ca-workspace__intro h3 { margin-bottom: 6px; }
.ca-workspace__intro p:last-child { margin-bottom: 0; color: var(--muted); }
.ca-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; max-width: 760px; }
.ca-field-grid--mapping { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: none; }
.ca-field-grid .field { min-width: 0; }
.ca-field-grid input, .ca-field-grid select, .ca-workspace > .field input { width: 100%; min-height: 48px; padding: 10px 12px; color: var(--text); background: var(--surface); border: 1px solid #8792a5; border-radius: var(--radius); }
.ca-workspace__command { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.ca-table-scroll { overflow-x: auto; border: 1px solid var(--border); }
.ca-position-table { width: 100%; min-width: 760px; border-collapse: collapse; background: var(--surface); }
.ca-position-table th, .ca-position-table td { padding: 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.ca-position-table th { color: var(--muted); font-size: 14px; font-weight: 700; }
.ca-position-table input { width: 100%; min-height: 40px; padding: 7px 8px; color: var(--text); background: var(--surface); border: 1px solid #8792a5; border-radius: 4px; }
.ca-position-table td:first-child { width: 92px; }
.ca-position-table td:nth-child(3) { width: 128px; }
.ca-position-table td:nth-child(4) { width: 144px; }
.ca-position-table td:nth-child(5) { min-width: 190px; }
.ca-position-table td:last-child { width: 84px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.empty-state { padding: 28px 22px; color: var(--muted); border-bottom: 1px solid var(--border); }
.empty-state h3 { margin-bottom: 6px; color: var(--text); }
.empty-state p { margin-bottom: 0; }

@media (max-width: 700px) {
  .site-header__inner, .page-shell { width: min(100% - 32px, 1120px); }
  .page-shell { padding: 36px 0 52px; }
  h1 { font-size: 30px; }
  .auth-flow__intro { font-size: 17px; }
  .landing { gap: 52px; }
  .landing-hero { padding-top: 16px; }
  .landing-hero h1 { font-size: 38px; }
  .landing-hero__lead { font-size: 18px; }
  .landing-hero__actions { align-items: stretch; }
  .landing-steps li { grid-template-columns: 44px minmax(0, 1fr); gap: 10px; }
  .dashboard { gap: 34px; }
  .dashboard__heading { grid-template-columns: 1fr; gap: 14px; }
  .dashboard__heading > p { max-width: 560px; }
  .module-row, .request-row { align-items: flex-start; flex-direction: column; gap: 14px; padding: 18px 16px; }
  .request-row .row-main { width: 100%; }
  .module-row__actions { width: 100%; justify-content: flex-start; }
  .file-types { justify-content: flex-start; }
  .status { max-width: 100%; }
  .ca-order-summary { align-items: flex-start; flex-direction: column; gap: 2px; }
  .ca-order-actions { width: 100%; }
  .ca-resume-clarification, .ca-resume-order { min-height: 44px; }
  .ca-artifacts__actions { align-items: stretch; flex-direction: column; }
  .ca-artifacts__actions .button { width: 100%; min-height: 44px; }
  .ca-artifact-row { align-items: flex-start; flex-wrap: wrap; }
  .ca-artifact-row a { min-height: 44px; justify-content: flex-start; }
  .ca-field-grid, .ca-field-grid--mapping { grid-template-columns: 1fr; }
  .ca-workspace { padding: 22px 16px; }
  .resend { align-items: flex-start; flex-direction: column; gap: 2px; }
}

@media (max-width: 380px) {
  .site-header__inner, .page-shell { width: calc(100% - 24px); }
  h1 { font-size: 28px; }
  .button--primary { width: 100%; }
  .landing-hero__actions .button { width: 100%; }
}
