/* ==========================================================================
   Layout — the public marketing site and the customer portal shell
   ========================================================================== */

/* --------------------------------------------------------------------------
   Public site
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--c-bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--c-border);
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: var(--s-6);
  height: 60px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-weight: 650;
  font-size: var(--fs-md);
  letter-spacing: -0.02em;
  color: var(--c-text);
  text-decoration: none;
  white-space: nowrap;
}

.brand:hover { color: var(--c-text); text-decoration: none; }
.brand svg { flex: 0 0 auto; }

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--s-5);
  font-size: var(--fs-base);
}

.site-nav a {
  color: var(--c-text-secondary);
  font-weight: 500;
}

.site-nav a:hover,
.site-nav a.is-active {
  color: var(--c-text);
  text-decoration: none;
}

@media (max-width: 860px) {
  .site-nav { display: none; }
}

.site-footer {
  margin-top: var(--s-24);
  padding: var(--s-16) 0 var(--s-8);
  border-top: 1px solid var(--c-border);
  background: var(--c-bg-subtle);
  font-size: var(--fs-sm);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: var(--s-8);
}

@media (max-width: 860px) {
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px) {
  .footer-grid { grid-template-columns: 1fr; }
}

.footer-grid h4 {
  margin-bottom: var(--s-3);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-text-muted);
}

.footer-grid ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-grid li + li { margin-top: var(--s-2); }
.footer-grid a { color: var(--c-text-secondary); }
.footer-grid a:hover { color: var(--c-text); }

.footer-bottom {
  margin-top: var(--s-10);
  padding-top: var(--s-5);
  border-top: 1px solid var(--c-border);
  display: flex;
  justify-content: space-between;
  gap: var(--s-4);
  flex-wrap: wrap;
  color: var(--c-text-muted);
}

/* Hero */

.hero {
  padding: var(--s-20) 0 var(--s-16);
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* A soft radial wash behind the hero. Purely atmospheric, and low enough in
   contrast that it never competes with the text sitting on it. */
.hero::before {
  content: "";
  position: absolute;
  inset: -40% 0 auto;
  height: 620px;
  background: radial-gradient(
    ellipse 60% 50% at 50% 40%,
    color-mix(in srgb, var(--c-accent) 12%, transparent),
    transparent 70%
  );
  pointer-events: none;
}

.hero > * { position: relative; }

.hero h1 {
  font-size: clamp(2.25rem, 5vw, var(--fs-4xl));
  line-height: 1.08;
  letter-spacing: -0.035em;
  max-width: 18ch;
  margin-inline: auto;
}

.hero .lead {
  max-width: 58ch;
  margin: var(--s-5) auto 0;
  font-size: var(--fs-lg);
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: var(--s-3);
  margin-top: var(--s-8);
  flex-wrap: wrap;
}

.hero-note {
  margin-top: var(--s-4);
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}

.section { padding: var(--s-16) 0; }
.section-tight { padding: var(--s-12) 0; }

.section-head {
  max-width: 62ch;
  margin: 0 auto var(--s-10);
  text-align: center;
}

.section-head h2 {
  font-size: clamp(1.5rem, 3vw, var(--fs-3xl));
  letter-spacing: -0.025em;
}

.section-head p { margin-top: var(--s-3); }

/* Feature cards */

.feature {
  padding: var(--s-6);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition), box-shadow var(--transition),
    transform var(--transition);
}

.feature:hover {
  border-color: var(--c-border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-bottom: var(--s-4);
  border-radius: var(--radius);
  background: var(--c-accent-subtle);
  color: var(--c-accent);
}

.feature h3 {
  margin-bottom: var(--s-2);
  font-size: var(--fs-md);
}

.feature p {
  font-size: var(--fs-sm);
  color: var(--c-text-secondary);
}

/* Numbered phase list, for the four operational phases */

.phase {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: var(--s-5);
  padding: var(--s-6) 0;
  border-bottom: 1px solid var(--c-border);
}

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

.phase-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--c-accent-subtle);
  color: var(--c-accent);
  font-weight: 650;
  font-size: var(--fs-sm);
}

.phase h3 { margin-bottom: var(--s-2); }
.phase p { color: var(--c-text-secondary); }

.phase ul {
  margin: var(--s-3) 0 0;
  padding-left: var(--s-5);
  color: var(--c-text-secondary);
  font-size: var(--fs-sm);
}

.phase li + li { margin-top: var(--s-2); }

/* Pricing */

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--s-5);
  align-items: start;
}

.plan {
  display: flex;
  flex-direction: column;
  padding: var(--s-6);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-xl);
  height: 100%;
}

.plan.is-featured {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 1px var(--c-accent), var(--shadow-md);
}

.plan-badge {
  align-self: flex-start;
  margin-bottom: var(--s-3);
}

.plan h3 {
  font-size: var(--fs-lg);
  margin-bottom: var(--s-1);
}

.plan-tagline {
  font-size: var(--fs-sm);
  color: var(--c-text-secondary);
  min-height: 2.6em;
}

.plan-price {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  margin: var(--s-5) 0 var(--s-1);
}

.plan-price .amount {
  font-size: var(--fs-3xl);
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1;
}

.plan-price .period {
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}

.plan-billing-note {
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
  min-height: 1.4em;
}

.plan .btn { margin: var(--s-5) 0; }

.plan-features {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: var(--fs-sm);
  flex: 1;
}

.plan-features li {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  padding: var(--s-2) 0;
  color: var(--c-text-secondary);
}

.plan-features li svg { flex: 0 0 auto; margin-top: 0.2em; color: var(--c-success); }
.plan-features li.is-absent { color: var(--c-text-muted); }
.plan-features li.is-absent svg { color: var(--c-text-muted); }

.billing-toggle {
  display: inline-flex;
  padding: 3px;
  margin: 0 auto var(--s-8);
  background: var(--c-bg-sunken);
  border-radius: var(--radius-full);
}

.billing-toggle button {
  padding: 0.3rem var(--s-4);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 550;
  color: var(--c-text-secondary);
  background: transparent;
  border: 0;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.billing-toggle button.is-active {
  background: var(--c-surface);
  color: var(--c-text);
  box-shadow: var(--shadow-sm);
}

/* Comparison table on the pricing page */

.compare th:first-child { width: 34%; }
.compare td { text-align: center; }
.compare td:first-child { text-align: left; }
.compare .yes { color: var(--c-success); }
.compare .no { color: var(--c-text-muted); }

/* Call to action band */

.cta-band {
  padding: var(--s-16) var(--s-8);
  text-align: center;
  background: var(--c-accent-subtle);
  border: 1px solid var(--c-accent-border);
  border-radius: var(--radius-xl);
}

.cta-band h2 {
  font-size: clamp(1.4rem, 3vw, var(--fs-2xl));
  max-width: 24ch;
  margin-inline: auto;
}

.cta-band p { margin: var(--s-4) auto 0; max-width: 54ch; color: var(--c-text-secondary); }

/* --------------------------------------------------------------------------
   Authentication pages
   -------------------------------------------------------------------------- */

.auth-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--s-8) var(--s-4);
  background: var(--c-bg-subtle);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: var(--s-8);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

.auth-card h1 {
  font-size: var(--fs-xl);
  margin-bottom: var(--s-2);
}

.auth-card .lead {
  font-size: var(--fs-base);
  margin-bottom: var(--s-6);
}

.auth-footer {
  margin-top: var(--s-6);
  padding-top: var(--s-5);
  border-top: 1px solid var(--c-border);
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--c-text-secondary);
}

/* --------------------------------------------------------------------------
   Portal shell
   -------------------------------------------------------------------------- */

.portal {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100dvh;
  background: var(--c-bg-subtle);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  overflow: hidden;
}

.sidebar-head {
  display: flex;
  align-items: center;
  height: var(--topbar-height);
  padding: 0 var(--s-4);
  border-bottom: 1px solid var(--c-border);
  flex: 0 0 auto;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-4) var(--s-3);
}

.nav-group + .nav-group { margin-top: var(--s-5); }

.nav-group-label {
  padding: 0 var(--s-3) var(--s-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-text-muted);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 0.4rem var(--s-3);
  margin-bottom: 1px;
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--c-text-secondary);
  border-radius: var(--radius);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}

.nav-link:hover {
  background: var(--c-bg-subtle);
  color: var(--c-text);
  text-decoration: none;
}

.nav-link.active {
  background: var(--c-accent-subtle);
  color: var(--c-accent);
  font-weight: 550;
}

.nav-link svg { flex: 0 0 auto; opacity: 0.85; }

.nav-count {
  margin-left: auto;
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 0.05rem 0.4rem;
  border-radius: var(--radius-full);
  background: var(--c-bg-sunken);
  color: var(--c-text-secondary);
}

.nav-count.is-critical {
  background: var(--c-critical-bg);
  color: var(--c-critical);
}

.sidebar-foot {
  flex: 0 0 auto;
  padding: var(--s-3);
  border-top: 1px solid var(--c-border);
}

/* Main column */

.portal-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: var(--s-4);
  height: var(--topbar-height);
  padding: 0 var(--s-6);
  background: color-mix(in srgb, var(--c-bg-subtle) 90%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--c-border);
}

.topbar h1 {
  font-size: var(--fs-md);
  font-weight: 600;
}

.page {
  flex: 1;
  padding: var(--s-6);
  min-width: 0;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
  flex-wrap: wrap;
  margin-bottom: var(--s-6);
}

.page-head h1 { font-size: var(--fs-xl); }
.page-head .lead { font-size: var(--fs-base); margin-top: var(--s-1); }

.page-actions {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
}

/* Mobile: the sidebar collapses to a bottom bar. A depot manager checking a
   task on a phone should not have to pan around a desktop layout. */
@media (max-width: 900px) {
  .portal { grid-template-columns: minmax(0, 1fr); }

  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    height: auto;
    z-index: 60;
    border-right: 0;
    border-top: 1px solid var(--c-border);
  }

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

  .sidebar-nav {
    display: flex;
    overflow-x: auto;
    padding: var(--s-2);
    gap: var(--s-1);
  }

  .nav-group { display: contents; }
  .nav-group + .nav-group { margin-top: 0; }

  .nav-link {
    flex-direction: column;
    gap: 2px;
    padding: var(--s-2) var(--s-3);
    font-size: var(--fs-xs);
    white-space: nowrap;
  }

  .nav-count { display: none; }

  .page { padding: var(--s-4) var(--s-4) var(--s-20); }
  .topbar { padding-inline: var(--s-4); }
}

/* --------------------------------------------------------------------------
   Filter bar
   -------------------------------------------------------------------------- */

.filters {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
  padding: var(--s-3) var(--s-4);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--s-4);
}

.filters input[type="search"],
.filters select {
  width: auto;
  min-width: 140px;
  font-size: var(--fs-sm);
  padding: 0.3rem var(--s-3);
}

.filters input[type="search"] { min-width: 220px; flex: 1; }

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  padding: 0.15rem var(--s-2) 0.15rem var(--s-3);
  font-size: var(--fs-xs);
  font-weight: 550;
  background: var(--c-accent-subtle);
  color: var(--c-accent);
  border: 1px solid var(--c-accent-border);
  border-radius: var(--radius-full);
}

.filter-chip button {
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  font-size: 1.1em;
  line-height: 1;
  padding: 0 0.1em;
}

/* --------------------------------------------------------------------------
   Detail pages
   -------------------------------------------------------------------------- */

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--s-5);
  align-items: start;
}

@media (max-width: 1080px) {
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
}

.definition-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--s-2) var(--s-4);
  font-size: var(--fs-sm);
  margin: 0;
}

.definition-list dt { color: var(--c-text-muted); }
.definition-list dd { margin: 0; color: var(--c-text); }

.tab-bar {
  display: flex;
  gap: var(--s-1);
  border-bottom: 1px solid var(--c-border);
  margin-bottom: var(--s-5);
  overflow-x: auto;
}

.tab {
  padding: var(--s-2) var(--s-4);
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--c-text-secondary);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}

.tab:hover { color: var(--c-text); }

.tab.is-active {
  color: var(--c-accent);
  border-bottom-color: var(--c-accent);
  font-weight: 550;
}

/* Timeline, used for risk assessment history and task activity */

.timeline { position: relative; padding-left: var(--s-6); }

.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--c-border);
}

.timeline-item { position: relative; padding-bottom: var(--s-5); }
.timeline-item:last-child { padding-bottom: 0; }

.timeline-item::before {
  content: "";
  position: absolute;
  left: calc(var(--s-6) * -1 + 1px);
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c-surface);
  border: 2px solid var(--c-border-strong);
}

.timeline-item.is-current::before {
  background: var(--c-accent);
  border-color: var(--c-accent);
}
