:root {
  --ink: #1a1a1a;
  --text: #333333;
  --muted: #666666;
  --line: #e0e0e0;
  --wash: #f5f5f5;
  --paper: #ffffff;
  --soft: #eeeeee;
  --ok: #25382e;
  --warn: #6b5c2d;
  --bad: #5b2c2c;
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --sidebar: 248px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--wash);
  color: var(--ink);
  font-family: var(--font);
  overflow-x: hidden;
}

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

button {
  border: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
  overflow-x: hidden;
}

.marketing-shell {
  background: var(--paper);
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  min-height: 66px;
  padding: 0 34px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.brand-lockup {
  display: grid;
  gap: 3px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.brand-word {
  font-size: 0.98rem;
  font-weight: 850;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.brand-sub {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.site-nav-links,
.portal-switcher,
.tabs,
.toolbar,
.button-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tabs,
.toolbar,
.button-row {
  margin: 18px 0;
}

.panel-head .button-row,
.listing-content .button-row,
.request-card .button-row,
.site-nav .button-row,
.topbar .button-row {
  margin: 0;
}

.nav-link,
.portal-link,
.tab,
.btn,
.icon-btn {
  min-height: 36px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--text);
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav-link,
.portal-link {
  border-color: transparent;
}

.nav-link.active,
.portal-link.active,
.tab.active,
.btn.primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.btn.ghost {
  background: transparent;
}

.btn.small,
.icon-btn {
  min-height: 30px;
  padding: 0 10px;
  font-size: 0.62rem;
}

.hero {
  min-height: calc(100vh - 66px);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  align-items: stretch;
  border-bottom: 1px solid var(--line);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 52px clamp(28px, 6vw, 88px);
}

.eyebrow,
.section-label,
.metric-label,
.field label,
.table th,
.status,
.mini-label {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 780px;
  margin: 14px 0 18px;
  font-size: clamp(2.7rem, 7vw, 6.4rem);
  line-height: 0.9;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero p,
.lead {
  max-width: 640px;
  color: var(--text);
  font-size: 1.03rem;
  line-height: 1.7;
}

.hero-media {
  min-height: 520px;
  background-image:
    linear-gradient(180deg, rgba(0,0,0,0.05), rgba(0,0,0,0.18)),
    url("https://images.unsplash.com/photo-1600607687939-ce8a6c25118c?auto=format&fit=crop&w=1400&q=80");
  background-size: cover;
  background-position: center;
}

.section-band {
  padding: 48px clamp(22px, 4vw, 54px);
  border-bottom: 1px solid var(--line);
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 22px;
}

.section-head h2,
.page-title h1 {
  margin: 6px 0 0;
  font-size: clamp(1.45rem, 3vw, 2.45rem);
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.grid {
  display: grid;
  gap: 24px;
  margin: 22px 0;
  width: 100%;
}

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

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

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

.card,
.panel,
.kpi,
.listing-card,
.timeline-item,
.message-item,
.request-card {
  background: var(--paper);
  border: 1px solid var(--line);
  margin: 0 0 22px;
  min-width: 0;
  width: 100%;
}

.card {
  padding: 22px;
}

.grid > .card,
.grid > .panel,
.grid > .kpi,
.grid > .listing-card,
.grid > .timeline-item,
.grid > .message-item,
.grid > .request-card {
  margin-bottom: 0;
}

.card-title {
  margin: 0 0 14px;
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 54px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
}

.panel-body {
  padding: 20px;
  min-width: 0;
}

.panel + .panel,
.card + .card,
.request-card + .request-card,
.message-item + .message-item,
.timeline-item + .timeline-item {
  margin-top: 18px;
}

.panel-body > :first-child,
.card > :first-child,
.request-card > :first-child {
  margin-top: 0;
}

.panel-body > :last-child,
.card > :last-child,
.request-card > :last-child {
  margin-bottom: 0;
}

.listing-card {
  overflow: hidden;
}

.listing-image {
  aspect-ratio: 4 / 3;
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid var(--line);
}

.listing-content {
  padding: 18px;
}

.listing-title {
  margin: 0 0 6px;
  font-size: 1.02rem;
  font-weight: 800;
}

.listing-meta,
.muted,
.small-copy {
  color: var(--muted);
}

.small-copy {
  font-size: 0.8rem;
  line-height: 1.55;
}

.metric-row,
.info-row,
.document-row,
.contact-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.metric-row:last-child,
.info-row:last-child,
.document-row:last-child,
.contact-row:last-child {
  border-bottom: 0;
}

.metric-value,
.info-value {
  text-align: right;
  font-weight: 750;
}

.kpi {
  padding: 21px;
}

.kpi-value {
  margin-top: 9px;
  font-size: 2rem;
  font-weight: 850;
  line-height: 1;
}

.kpi-sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.76rem;
}

.portal-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  background: var(--ink);
  color: var(--paper);
}

.sidebar-head,
.sidebar-foot {
  padding: 24px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.sidebar-foot {
  border-top: 1px solid rgba(255,255,255,0.12);
  border-bottom: 0;
}

.side-nav {
  padding: 12px 0;
}

.side-link {
  width: 100%;
  min-height: 42px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  border-left: 2px solid transparent;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: left;
}

.side-link.active {
  color: var(--paper);
  background: rgba(255,255,255,0.08);
  border-left-color: var(--paper);
}

.portal-main {
  min-width: 0;
  width: 100%;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 34px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.portal-content {
  max-width: none;
  padding: 34px;
  width: 100%;
  min-width: 0;
}

.portal-content .grid.two,
.portal-content .grid.three,
.portal-content .grid.four {
  grid-template-columns: 1fr;
}

.page-title {
  margin-bottom: 24px;
}

.page-title p {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--text);
  white-space: nowrap;
}

.status.dark {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.status.ok {
  color: var(--ok);
  background: #edf3ef;
  border-color: #d5e1d8;
}

.status.warn {
  color: var(--warn);
  background: #f4f0df;
  border-color: #e2d9ae;
}

.status.bad {
  color: var(--bad);
  background: #f1e6e6;
  border-color: #dec8c8;
}

.table-wrap {
  overflow: visible;
  width: 100%;
  min-width: 0;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  table-layout: fixed;
}

.table th {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 2px solid var(--line);
  white-space: normal;
  overflow-wrap: anywhere;
}

.table td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}

.table tr:last-child td {
  border-bottom: 0;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 15px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

.field textarea {
  min-height: 104px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--ink);
}

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

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

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

.timeline-item,
.request-card {
  padding: 16px;
}

.request-card .section-head {
  margin-bottom: 10px;
}

.timeline-item h4,
.request-card h4,
.message-item h4 {
  margin: 0 0 5px;
  font-size: 0.9rem;
}

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

.message-item {
  padding: 16px;
  display: grid;
  gap: 8px;
}

.stat-stack {
  display: grid;
  gap: 12px;
}

.application-stepper {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 20px 0;
}

.step {
  border: 1px solid var(--line);
  background: var(--paper);
  min-height: 72px;
  padding: 12px;
}

.step.active {
  border-color: var(--ink);
  box-shadow: inset 0 -3px 0 var(--ink);
}

.empty-state {
  border: 1px dashed var(--line);
  background: var(--paper);
  padding: 32px;
  text-align: center;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  max-width: min(360px, calc(100vw - 36px));
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  padding: 14px 16px;
  font-size: 0.84rem;
  line-height: 1.45;
}

.hidden {
  display: none;
}

@media (max-width: 980px) {
  .hero,
  .portal-layout,
  .grid.two,
  .grid.three,
  .grid.four {
    grid-template-columns: 1fr;
  }

  .portal-layout {
    display: block;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .side-nav {
    display: flex;
    overflow: visible;
    flex-wrap: wrap;
    padding: 8px 12px;
  }

  .side-link {
    width: auto;
    flex: 1 1 150px;
    white-space: nowrap;
    border-left: 0;
    border-bottom: 2px solid transparent;
    padding: 0 12px;
  }

  .side-link.active {
    border-bottom-color: var(--paper);
  }

  .sidebar-foot {
    display: none;
  }

  .site-nav,
  .topbar,
  .portal-content {
    padding-left: 18px;
    padding-right: 18px;
  }
}

@media (max-width: 680px) {
  body {
    background: var(--paper);
  }

  .marketing-shell {
    min-height: 100vh;
    padding-bottom: 78px;
  }

  .site-nav,
  .topbar,
  .section-head,
  .metric-row,
  .info-row,
  .document-row,
  .contact-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-nav {
    position: sticky;
    top: 0;
    min-height: 62px;
    padding-top: 10px;
    padding-bottom: 10px;
    align-items: stretch;
    box-shadow: 0 1px 0 var(--line);
  }

  .brand-lockup {
    width: 100%;
  }

  .site-nav-links,
  .portal-switcher {
    width: 100%;
  }

  .site-nav-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .portal-layout {
    min-height: 100vh;
    background: var(--paper);
    padding-bottom: 132px;
  }

  .portal-main {
    background: var(--paper);
  }

  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 40;
    height: auto;
    overflow: visible;
    border-top: 1px solid rgba(255,255,255,0.16);
  }

  .sidebar-head,
  .sidebar-foot {
    display: none;
  }

  .side-nav {
    min-height: 108px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    overflow: visible;
    padding: 0;
  }

  .side-link {
    min-height: 54px;
    width: 100%;
    justify-content: center;
    text-align: center;
    padding: 8px 10px;
    border: 0;
    border-top: 3px solid transparent;
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    white-space: normal;
    line-height: 1.2;
  }

  .side-link.active {
    border-top-color: var(--paper);
    border-bottom-color: transparent;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: auto;
    padding-top: 12px;
    padding-bottom: 12px;
    background: rgba(255,255,255,0.96);
    align-items: stretch;
  }

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

  .nav-link,
  .portal-link,
  .tab,
  .btn {
    width: 100%;
  }

  .section-band,
  .portal-content {
    padding: 22px 14px;
  }

  .portal-content {
    max-width: none;
  }

  .page-title {
    margin-bottom: 18px;
  }

  .page-title h1,
  .section-head h2 {
    font-size: 1.55rem;
    line-height: 1.05;
  }

  .hero {
    min-height: auto;
  }

  .hero-media {
    min-height: 340px;
  }

  .split-form,
  .application-stepper {
    grid-template-columns: 1fr;
  }

  .grid {
    gap: 16px;
    margin: 16px 0;
  }

  .card,
  .panel,
  .kpi,
  .listing-card,
  .timeline-item,
  .message-item,
  .request-card {
    margin-bottom: 16px;
    border-left: 0;
    border-right: 0;
  }

  .card,
  .panel-body,
  .request-card,
  .message-item,
  .timeline-item,
  .kpi,
  .listing-content {
    padding-left: 16px;
    padding-right: 16px;
  }

  .panel-head {
    min-height: auto;
    padding: 14px 16px;
    align-items: flex-start;
  }

  .metric-value,
  .info-value {
    text-align: left;
  }

  .metric-row,
  .info-row,
  .document-row,
  .contact-row {
    align-items: flex-start;
    padding: 13px 0;
  }

  .document-row > span:last-child {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .table {
    display: block;
    border-collapse: separate;
    font-size: 0.84rem;
  }

  .table thead {
    display: none;
  }

  .table tbody,
  .table tr,
  .table td {
    display: block;
    width: 100%;
  }

  .table tr {
    border-bottom: 1px solid var(--line);
    padding: 12px 16px;
  }

  .table tr:last-child {
    border-bottom: 0;
  }

  .table td {
    display: grid;
    grid-template-columns: minmax(96px, 34%) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding: 8px 0;
    border-bottom: 0;
  }

  .table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    overflow-wrap: anywhere;
  }

  .status {
    white-space: normal;
    text-align: left;
  }

  .toast {
    left: 14px;
    right: 14px;
    bottom: 144px;
    max-width: none;
  }
}

@media (max-width: 420px) {
  .site-nav-links,
  .portal-switcher {
    grid-template-columns: 1fr;
  }

  .table td {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .kpi-value {
    font-size: 1.75rem;
  }
}
