:root {
  color-scheme: light;
  --ink: #15302f;
  --muted: #60706e;
  --line: #d8dfde;
  --brand: #256763;
  --accent: #c9a33a;
  --surface: #ffffff;
  --page: #f4f7f6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 24px;
  background: var(--brand);
  color: white;
  border-bottom: 4px solid var(--accent);
}

h1, h2 {
  margin: 0;
  letter-spacing: 0;
}

header p {
  margin: 6px 0 0;
  color: #e8f1ef;
}

main {
  display: grid;
  grid-template-columns: minmax(320px, 1fr);
  gap: 18px;
  padding: 18px;
  max-width: 1280px;
  margin: 0 auto;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.application-form {
  margin-top: 14px;
}

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

.form-card {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.form-card h3 {
  margin: 0;
  font-size: 16px;
}

.final-declaration-box {
  border-color: #8fb3d9;
  background: #f4f9ff;
}

.final-declaration-box ul {
  margin: 0;
  padding-left: 20px;
}

.final-declaration-box li {
  margin: 6px 0;
}

.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.fee-summary-card,
.document-card {
  grid-column: 1 / -1;
}

.fee-summary-card .fee-summary {
  margin-top: 0;
}

.document-card .save-review {
  margin-top: 0;
  background: white;
}

.document-card .actions {
  margin-top: 0;
}

.public-application {
  max-width: 1040px;
  margin: 0 auto;
}

.application-type-landing {
  max-width: 880px;
  margin: 0 auto;
}

.application-type-landing h2 {
  font-size: 28px;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.choice-card {
  display: grid;
  gap: 8px;
  min-height: 128px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  text-decoration: none;
}

.choice-card strong {
  font-size: 20px;
}

.choice-card span {
  color: var(--muted);
}

.choice-card:hover {
  border-color: var(--brand);
  box-shadow: 0 8px 20px rgba(21, 48, 47, 0.08);
}

.public-application form {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.honeypot {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.error-message {
  border: 1px solid #b95c00;
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff7ed;
  color: #7c2d12;
}

.form-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.form-section h3 {
  margin: 0;
  font-size: 17px;
}

.reviewer-table td {
  vertical-align: top;
}

.reviewer-table th,
.reviewer-table td {
  min-width: 120px;
}

.signature-preview {
  display: block;
  max-width: 140px;
  max-height: 56px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
}

.inline-reviewer-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  align-items: end;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
}

.checkline input {
  width: auto;
  min-height: 0;
}

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

textarea {
  min-height: 88px;
  resize: vertical;
  font: inherit;
}

input.low-confidence,
select.low-confidence {
  border-color: #b95c00;
  background: #fff7ed;
}

button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  padding: 8px 12px;
  background: var(--brand);
  color: white;
  cursor: pointer;
}

button:hover,
.button:hover {
  filter: brightness(1.08);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button.danger {
  background: #9f2f2f;
}

a.button {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border-radius: 6px;
  padding: 8px 12px;
  background: var(--brand);
  color: white;
  text-decoration: none;
}

.document-link {
  color: white;
  background: var(--brand);
}

.ghost {
  background: rgba(255, 255, 255, 0.16) !important;
}

.terms-pdf-link {
  background: var(--brand);
  color: white;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.terms-pdf-link:hover,
.terms-pdf-link:focus-visible {
  background: #0c2423;
  color: white;
  outline: 3px solid rgba(21, 48, 47, 0.28);
  outline-offset: 2px;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.userline {
  font-size: 13px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.bottom-action-bar {
  align-items: center;
}

.payment-status-inline {
  display: inline-flex;
  grid-auto-flow: column;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  color: var(--ink);
  white-space: nowrap;
}

.payment-status-inline select {
  width: auto;
  min-width: 170px;
}

.action-field {
  display: flex;
  justify-content: flex-end;
}

.action-field span {
  font-weight: 700;
}

.save-review {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 14px;
  align-items: start;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfc;
}

.save-review > div {
  display: grid;
  gap: 3px;
}

.save-review-heading {
  display: grid;
  grid-template-columns: 1fr max-content;
  align-items: center;
  column-gap: 10px;
  grid-column: 1 / -1;
}

.save-review-heading span {
  grid-column: 1 / -1;
}

.save-review span {
  color: var(--muted);
  font-size: 13px;
}

.save-review label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 600;
}

.save-review input {
  width: auto;
  margin: 0;
}

.upload-row {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}

.method-note {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfc;
}

.processing-screen {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin-top: 18px;
  padding: 34px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  text-align: center;
}

.processing-screen[hidden] {
  display: none;
}

[hidden] {
  display: none !important;
}

.processing-screen h3,
.processing-screen p {
  margin: 0;
}

.loader {
  width: 42px;
  height: 42px;
  border: 4px solid #d8dfde;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.is-processing {
  display: none;
}

.status-message {
  margin-top: 12px;
  color: var(--muted);
}

.document-ready {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfc;
}

pre {
  white-space: pre-wrap;
  background: #edf3f2;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  min-height: 44px;
  overflow-x: auto;
}

.fee-preview {
  margin-top: 14px;
}

.fee-summary {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: white;
}

.fee-row,
.fee-total {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(120px, max-content);
  gap: 18px;
  align-items: center;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
}

.fee-row:last-of-type {
  border-bottom: 0;
}

.fee-row span,
.fee-total span {
  text-align: left;
}

.fee-row strong,
.fee-total strong {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.fee-total {
  margin-top: 6px;
  padding-top: 10px;
  padding-bottom: 10px;
  border-top: 3px solid var(--ink);
  border-bottom: 0;
  font-weight: 700;
  font-size: 18px;
}

.fee-total strong {
  font-size: 20px;
}

button.small {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 13px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.audit-detail {
  margin: 0 0 8px;
  background: white;
}

.ai-review {
  margin-top: 12px;
}

.ai-review h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.low-confidence-row td {
  background: #fff7ed;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfc;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.section-heading-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.status-badge {
  display: inline-block;
  margin-right: 6px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #e8f1ef;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}

.dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dashboard-list-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.file-action summary {
  display: inline-block;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--brand);
  cursor: pointer;
  font-weight: 700;
}

.file-action div {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

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

.login {
  min-height: 100vh;
  align-content: center;
}

.login-panel {
  max-width: 520px;
  margin: 0 auto;
}

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

th {
  background: #edf3f2;
  color: var(--ink);
}

td:last-child {
  min-width: 420px;
}

td button {
  margin: 0 4px 6px 0;
  background: #395d5a;
}

.user-guide {
  max-width: 820px;
}

.user-guide h3 {
  margin: 6px 0 18px;
}

.user-guide ol {
  display: grid;
  gap: 12px;
  padding-left: 24px;
}

.user-guide li span {
  display: block;
  margin-top: 4px;
}

@media print {
  header,
  .user-guide button {
    display: none;
  }

  body {
    background: white;
  }

  main {
    display: block;
    padding: 0;
    max-width: none;
  }

  .panel {
    border: 0;
    padding: 0;
  }
}

@media (max-width: 760px) {
  header {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel {
    padding: 14px;
  }

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

  .application-sections {
    grid-template-columns: 1fr;
  }

  td:last-child {
    min-width: 0;
  }
}
