:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef3f1;
  --ink: #172126;
  --muted: #60717a;
  --line: #d9e0e3;
  --accent: #0e7c66;
  --accent-dark: #075948;
  --blue: #315f9e;
  --red: #b53b4a;
  --amber: #9a6a12;
  --violet: #6c4f9f;
  --radius: 8px;
  --shadow: 0 10px 30px rgba(23, 33, 38, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

a {
  color: inherit;
}

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

.public-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 68px;
  padding: 12px clamp(16px, 4vw, 48px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.public-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.public-brand span span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.landing-page {
  background: #f7f9fa;
}

.landing-hero {
  min-height: min(560px, calc(100vh - 120px));
  background:
    linear-gradient(90deg, rgba(11, 20, 24, 0.84) 0%, rgba(11, 20, 24, 0.62) 42%, rgba(11, 20, 24, 0.12) 100%),
    url("/assets/review-assessment-hero.png") center right / cover no-repeat;
  color: #fff;
  display: grid;
}

.hero-scrim {
  display: grid;
  align-items: center;
  padding: clamp(56px, 8vw, 92px) clamp(18px, 5vw, 68px);
}

.hero-content {
  max-width: 720px;
}

.hero-content .eyebrow {
  color: #98dfcd;
}

.hero-content h1 {
  max-width: 760px;
  font-size: clamp(42px, 7vw, 76px);
  line-height: 0.98;
}

.hero-content p:not(.eyebrow) {
  max-width: 640px;
  margin: 18px 0 0;
  color: #dce6e6;
  font-size: 18px;
  line-height: 1.55;
}

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

.button.light {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.44);
}

.landing-intake-band {
  padding: 34px clamp(16px, 4vw, 48px) 56px;
}

.landing-intake-layout {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(240px, 0.75fr) minmax(0, 1.25fr);
  gap: 28px;
  align-items: start;
}

.landing-intro {
  padding-top: 12px;
}

.landing-intro h2 {
  font-size: 30px;
}

.landing-intro .muted {
  max-width: 420px;
  line-height: 1.55;
}

.assurance-list {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.assurance-list div {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.assurance-list strong {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #dff1eb;
  color: var(--accent-dark);
}

.assurance-list span {
  color: var(--muted);
  line-height: 1.45;
}

.landing-form,
.login-panel,
.lead-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.landing-form {
  padding: 18px;
}

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

.landing-checks {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.landing-checks .check {
  align-items: flex-start;
}

.landing-checks .check input {
  margin-top: 2px;
}

.landing-footer {
  align-items: flex-end;
}

.form-status {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.form-status[data-tone="success"] {
  color: var(--accent-dark);
}

.form-status[data-tone="error"] {
  color: var(--red);
}

.login-body {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(14, 124, 102, 0.14), rgba(49, 95, 158, 0.11)),
    #f4f6f8;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 18px;
  padding: 24px;
}

.login-brand .brand-subtitle {
  color: var(--muted);
}

.muted-link {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: #152127;
  color: #f7fbfc;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #e1f4ed;
  color: #0b5d4c;
  font-weight: 800;
}

.brand-name {
  font-size: 17px;
  font-weight: 750;
}

.brand-subtitle {
  margin-top: 2px;
  color: #aab9bf;
  font-size: 12px;
}

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

.nav-link {
  color: #d8e3e7;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.sidebar-status {
  margin-top: auto;
  padding: 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #d8e3e7;
  font-size: 12px;
  line-height: 1.45;
}

.main {
  min-width: 0;
}

.section {
  padding: 28px 34px;
  border-bottom: 1px solid var(--line);
}

.overview-band {
  background:
    linear-gradient(90deg, rgba(14, 124, 102, 0.11), rgba(49, 95, 158, 0.08)),
    #fff;
}

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

.section-title-row.compact {
  align-items: center;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 750;
  color: var(--accent-dark);
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.1;
}

h2 {
  font-size: 22px;
}

h3 {
  font-size: 15px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.metric {
  min-height: 96px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 6px 16px rgba(23, 33, 38, 0.05);
}

.metric .value {
  font-size: 28px;
  font-weight: 800;
}

.metric .label {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}

.button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 700;
  text-decoration: none;
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.button-icon {
  font-size: 16px;
  line-height: 1;
}

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

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

.button.secondary {
  background: #e9f2f0;
  color: var(--accent-dark);
  border-color: #c7dcd6;
}

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

.button.danger {
  background: #fae7ea;
  color: #8d2532;
  border-color: #edc4cb;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.intake-form,
.case-detail,
.case-list-wrap,
.integration-panel,
.audit-table {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.intake-form {
  padding: 18px;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.35;
}

.span-2 {
  grid-column: span 2;
}

.form-footer {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}

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

.lead-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 16px;
}

.lead-main {
  min-width: 0;
}

.lead-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

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

.lead-grid p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.lead-actions {
  min-width: 150px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.check,
.switch {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

.check input,
.switch input {
  width: 16px;
  height: 16px;
  min-height: auto;
}

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

.case-list-wrap {
  padding: 16px;
}

.case-list {
  display: grid;
  gap: 8px;
  max-height: 680px;
  overflow: auto;
  padding-right: 2px;
}

.case-item {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #fff;
  cursor: pointer;
}

.case-item:hover,
.case-item.selected {
  border-color: #85b9aa;
  background: #f5fbf9;
}

.case-title {
  font-weight: 800;
  margin-bottom: 4px;
}

.case-meta,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.case-detail {
  min-height: 560px;
  padding: 18px;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

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

.detail-block {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  background: #fbfcfd;
}

.detail-block.full {
  grid-column: 1 / -1;
}

.detail-block h3 {
  margin-bottom: 10px;
}

.detail-block p {
  margin: 0;
  line-height: 1.45;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  background: #edf1f4;
  color: #41515a;
}

.badge.triage,
.badge.draft_ready,
.badge.ready_for_case {
  background: #e7f0ff;
  color: var(--blue);
}

.badge.approved_for_submission,
.badge.removed,
.badge.invoiced,
.badge.closed,
.badge.converted {
  background: #e2f5ed;
  color: var(--accent-dark);
}

.badge.new {
  background: #edf1f4;
  color: #41515a;
}

.badge.needs_escalation,
.badge.failed,
.badge.not_removed {
  background: #fae7ea;
  color: var(--red);
}

.badge.monitoring,
.badge.submitted,
.badge.awaiting_evidence,
.badge.awaiting_mandate {
  background: #fff1d7;
  color: var(--amber);
}

.badge.paperclip {
  background: #ece8f6;
  color: var(--violet);
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 10px;
  font-size: 13px;
}

.integration-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
}

.integration-panel {
  padding: 16px;
}

.kv {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid #edf1f2;
  font-size: 13px;
}

.kv:last-child {
  border-bottom: 0;
}

.event-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}

.event-item {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fff;
  font-size: 13px;
}

.audit-table {
  overflow: hidden;
}

.audit-row {
  display: grid;
  grid-template-columns: 190px 220px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.audit-row:last-child {
  border-bottom: 0;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  border-radius: 6px;
  background: #172126;
  color: #fff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  transform: translateY(120px);
  opacity: 0;
  transition: transform 160ms ease, opacity 160ms ease;
  font-size: 13px;
  z-index: 10;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  padding: 16px;
  text-align: center;
}

@media (max-width: 1080px) {
  .metric-grid {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }

  .form-grid,
  .landing-intake-layout {
    grid-template-columns: 1fr;
  }

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

  .two-column,
  .integration-grid,
  .lead-grid {
    grid-template-columns: 1fr;
  }

  .lead-item {
    grid-template-columns: 1fr;
  }

  .lead-actions {
    min-width: 0;
    flex-direction: row;
    flex-wrap: wrap;
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

  .public-topbar {
    position: static;
  }

  .public-brand span span {
    display: none;
  }

  .landing-hero {
    min-height: 520px;
    background-position: 65% center;
  }

  .hero-content h1 {
    font-size: 42px;
  }

  .landing-intake-band {
    padding-top: 24px;
  }

  .nav-list {
    grid-template-columns: repeat(6, minmax(96px, 1fr));
    overflow-x: auto;
  }

  .nav-link {
    text-align: center;
    white-space: nowrap;
  }

  .section {
    padding: 22px 16px;
  }

  .section-title-row,
  .detail-header {
    display: grid;
  }

  .metric-grid,
  .form-grid,
  .landing-form-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }

  .audit-row,
  .timeline-item,
  .kv,
  .lead-heading {
    grid-template-columns: 1fr;
  }

  .lead-heading {
    display: grid;
  }
}
