:root {
  --primary: #1e3a5f;
  --primary-strong: #172f4f;
  --accent: #047857;
  --accent-soft: #d1fae5;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef3f8;
  --text: #102033;
  --muted: #5b6b7d;
  --border: #dbe4ee;
  --danger: #b91c1c;
  --warning: #b45309;
  --shadow: 0 18px 50px rgba(16, 32, 51, 0.08);
  --radius: 8px;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}
a { color: inherit; }
.skip-link {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 10;
  background: var(--text);
  color: white;
  padding: 10px 14px;
  border-radius: var(--radius);
}
.skip-link:focus { top: 12px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px clamp(16px, 4vw, 48px);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}
.task-topbar {
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  min-width: max-content;
}
.brand-mark, .success-mark {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--primary);
  color: white;
  font-weight: 800;
}
.brand small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}
.nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--muted);
  text-decoration: none;
  font-weight: 650;
}
.nav a:hover, .nav a:focus-visible { background: var(--surface-2); color: var(--text); }
.task-header-link {
  margin-left: auto;
}
.logout { margin: 0; }
.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}
.task-page {
  width: min(920px, calc(100% - 24px));
}
.auth-shell {
  min-height: calc(100dvh - 120px);
  display: grid;
  place-items: center;
}
.auth-panel {
  width: min(460px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(24px, 4vw, 40px);
}
.auth-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 16px 0;
}
.auth-links a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--primary);
  font-weight: 800;
}
.hero-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 24px;
  padding: clamp(24px, 5vw, 44px);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary), #263f60);
  color: white;
}
.hero-band.admin { background: linear-gradient(135deg, #14253b, var(--primary)); }
.hero-band p { max-width: 780px; color: rgba(255,255,255,0.86); }
.hero-band h1, .section-head h1, .auth-panel h1 { margin: 0 0 10px; line-height: 1.12; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.hero-band .eyebrow { color: #9ef0c8; }
.progress-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: var(--radius);
}
.progress-card strong { font-size: 42px; line-height: 1; }
.progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(30,58,95,0.16);
}
.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}
.grid { display: grid; gap: 24px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel, .form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(16, 32, 51, 0.05);
  padding: clamp(20px, 3vw, 28px);
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}
.task-head {
  margin-bottom: 16px;
}
.muted { color: var(--muted); }
.large-number { display: block; font-size: 44px; margin-bottom: 10px; }
.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}
.button:hover { transform: translateY(-1px); }
.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}
.button.primary { background: var(--accent); color: white; }
.button.secondary { background: var(--primary); color: white; }
.button.ghost { background: white; border-color: var(--border); color: var(--text); }
.button.small { min-height: 36px; padding: 7px 10px; font-size: 14px; }
.button.full { width: 100%; }
input, select, textarea {
  width: 100%;
  min-height: 44px;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
  color: var(--text);
  font: inherit;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus, .button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(4, 120, 87, 0.28);
  outline-offset: 2px;
}
label { display: block; font-weight: 700; }
.form-stack { display: grid; gap: 16px; }
.form-card { display: grid; gap: 22px; }
.step-tabs {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.step-tabs a,
.step-tabs > div {
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  text-decoration: none;
}
.step-tabs a.active,
.step-tabs > div.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #064e3b;
}
.step-tabs span {
  width: 24px;
  height: 24px;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--primary);
}
.step-tabs a.active span,
.step-tabs > div.active span {
  background: var(--accent);
  color: white;
}
.tenant-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}
.tenant-mark {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--primary);
  font-weight: 800;
  font-size: 20px;
}
.tenant-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
fieldset {
  margin: 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
legend {
  padding: 0 8px;
  color: var(--primary);
  font-size: 18px;
  font-weight: 850;
}
.checkbox, .checkbox-grid .checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 650;
}
.checkbox input {
  width: 18px;
  min-height: 18px;
  margin-top: 4px;
}
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.security-note {
  padding: 12px 14px;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: #064e3b;
  font-weight: 650;
}
.alert {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-weight: 700;
}
.alert.success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert.error { background: #fee2e2; color: var(--danger); border: 1px solid #fecaca; }
.checklist { display: grid; gap: 10px; }
.check-row {
  min-height: 54px;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
}
.check {
  width: 18px;
  height: 18px;
  border: 2px solid var(--muted);
  border-radius: 50%;
}
.check.done { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 4px white; }
.status {
  display: inline-flex;
  width: max-content;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--primary);
  font-size: 13px;
  font-weight: 850;
}
.status.submitted, .status.approved { background: #dcfce7; color: #166534; }
.status.needs-review { background: #fef3c7; color: var(--warning); }
.status.in-progress { background: #dbeafe; color: #1d4ed8; }
.sticky-actions {
  position: sticky;
  bottom: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 12px;
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
}
.doc-list, .table-wrap { overflow-x: auto; }
.document-review {
  margin: 24px 0;
}
.review-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.review-head h2 {
  margin: 0 0 6px;
}
.review-head strong {
  min-width: max-content;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--primary);
}
.review-list {
  display: grid;
  gap: 10px;
}
.verification-panel {
  margin-top: 20px;
}
.verification-list {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}
.verification-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 16px;
  align-items: start;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
}
.verification-item.complete {
  border-color: #86efac;
  background: #f0fdf4;
}
.verification-item p {
  margin: 4px 0 8px;
  color: var(--muted);
}
.review-doc {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
}
.review-doc.complete {
  border-color: #86efac;
  background: #f0fdf4;
}
.review-doc p {
  margin: 4px 0 8px;
  color: var(--muted);
}
.review-doc small {
  grid-column: 1 / -1;
}
.doc-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.doc-actions form {
  margin: 0;
}
.doc-row, .log-row {
  display: grid;
  gap: 4px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.doc-row:last-child, .log-row:last-child { border-bottom: 0; }
.doc-row span, .log-row span { color: var(--muted); font-size: 14px; }
.inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-row, .action-row {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.template-asset {
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.template-asset h3 {
  margin: 0 0 8px;
  font-size: 18px;
}
table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}
th, td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
th { color: var(--muted); font-size: 13px; text-transform: uppercase; }
.details {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 10px 16px;
}
.details dt { color: var(--muted); font-weight: 800; }
.details dd { margin: 0; overflow-wrap: anywhere; }
.confirmation {
  width: min(680px, 100%);
  margin: 64px auto;
  text-align: center;
}
.site-footer {
  margin-top: 40px;
  padding: 20px 24px 32px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}
.success-mark {
  margin-bottom: 16px;
  background: var(--accent);
}
.success-mark::before {
  content: "";
  width: 18px;
  height: 10px;
  border-left: 3px solid white;
  border-bottom: 3px solid white;
  transform: rotate(-45deg) translate(1px, -2px);
}
@media (max-width: 820px) {
  .topbar {
    min-height: auto;
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 16px;
  }
  .nav { margin-left: 0; width: 100%; }
  .brand { width: 100%; }
  .logout { width: 100%; }
  .logout .button { width: 100%; }
  .hero-band, .grid.two, .form-grid, .checkbox-grid { grid-template-columns: 1fr; }
  .step-tabs { grid-template-columns: 1fr; }
  .review-head, .review-doc { grid-template-columns: 1fr; }
  .verification-item { grid-template-columns: 1fr; }
  .doc-actions { justify-content: stretch; }
  .doc-actions .button, .doc-actions form { width: 100%; }
  .section-head { align-items: stretch; flex-direction: column; }
  .sticky-actions { flex-direction: column; }
  .details { grid-template-columns: 1fr; }
  .check-row { grid-template-columns: 24px 1fr; }
  .check-row small { grid-column: 2; }
  .task-page {
    width: 100%;
    min-height: calc(100dvh - 56px);
    padding: 0 0 24px;
  }
  .task-topbar {
    position: sticky;
    top: 0;
    z-index: 8;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    padding: 10px 16px;
  }
  .task-topbar .brand {
    width: auto;
    min-width: 0;
    font-size: 15px;
  }
  .task-topbar .task-header-link {
    margin-left: auto;
    min-height: 36px;
    padding: 6px 10px;
    font-size: 13px;
  }
  .task-topbar .nav,
  .task-topbar .logout {
    display: none;
  }
  .task-page .task-head {
    margin: 0;
    padding: 18px 16px 8px;
  }
  .task-page .task-head .button.secondary {
    display: none;
  }
  .task-page .step-tabs { display: none; }
  .task-page .tenant-hero {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .task-page .panel,
  .task-page .form-card {
    margin: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    box-shadow: none;
  }
  .task-page .form-card {
    padding: 0;
    background: transparent;
    border: 0;
    gap: 16px;
  }
  .task-page .sticky-actions {
    position: static;
    margin: 0 16px;
    padding: 16px 0 0;
    border: 0;
    border-top: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
    backdrop-filter: none;
  }
  .task-page .sticky-actions .button,
  .task-page .section-head .button {
    width: 100%;
  }
  .task-page .panel,
  .task-page .form-card,
  .task-page fieldset,
  .task-page .verification-item {
    padding-left: 16px;
    padding-right: 16px;
  }
  .task-page fieldset {
    margin: 0;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    background: var(--surface);
  }
  .task-page .verification-panel,
  .task-page .privacy-consent,
  .task-page .confirmation {
    margin-top: 0;
  }
  .task-page + .site-footer {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
