:root {
  --bg: #f6f4f0;
  --bg-alt: #ebe6de;
  --ink: #1a1814;
  --muted: #5c574e;
  --accent: #2d4a3e;
  --accent-hover: #1f352c;
  --border: rgba(26, 24, 20, 0.12);
  --radius: 12px;
  --shadow: 0 24px 48px rgba(26, 24, 20, 0.08);
  --max: 64rem;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-hover);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.logo {
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}

.logo:hover {
  color: var(--accent);
}

.nav {
  display: flex;
  gap: 1.5rem;
}

.nav a {
  font-weight: 500;
  font-size: 0.9375rem;
  text-decoration: none;
  color: var(--muted);
}

.nav a:hover {
  color: var(--ink);
}

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.hero {
  padding: 4rem 0 3.5rem;
}

@media (min-width: 40rem) {
  .hero {
    padding: 5.5rem 0 4rem;
  }
}

.hero-eyebrow {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero-title {
  margin: 0 0 1.25rem;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.hero-title em {
  font-style: italic;
  color: var(--accent);
}

.hero-lede {
  margin: 0 0 2rem;
  max-width: 38rem;
  color: var(--muted);
  font-size: 1.0625rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.5rem;
  font-weight: 600;
  font-size: 0.9375rem;
  color: #fff;
  background: var(--accent);
  border-radius: var(--radius);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: background 0.15s ease, transform 0.15s ease;
}

.button:hover {
  color: #fff;
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.section {
  padding: 2.75rem 0;
  border-top: 1px solid var(--border);
}

.section-alt {
  background: var(--bg-alt);
  margin: 0 -1.5rem;
  padding: 2.75rem 1.5rem;
  border-radius: var(--radius);
  border-top: none;
  box-shadow: 0 1px 0 var(--border);
}

.section h2,
.section-alt h2 {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section p,
.section-alt p {
  margin: 0;
  max-width: 40rem;
  color: var(--muted);
}

.site-footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  border-top: 1px solid var(--border);
}

.site-footer p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

/* Forms (login, install, admin) */
.form-page {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.form-card {
  max-width: 26rem;
  margin: 0 auto;
  padding: 2rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.form-title {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.form-lede {
  margin: 0 0 1.5rem;
  font-size: 0.9375rem;
  color: var(--muted);
}

.form-lede code {
  font-size: 0.85em;
  background: var(--bg-alt);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 1.125rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink);
}

.field-input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  font: inherit;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
}

.field-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.button-block {
  width: 100%;
  border: none;
  cursor: pointer;
  font: inherit;
}

.form-error {
  margin: 0 0 1rem;
  padding: 0.65rem 0.75rem;
  font-size: 0.9375rem;
  color: #7a1f1f;
  background: rgba(122, 31, 31, 0.08);
  border-radius: 8px;
}

.form-success {
  margin: 0 0 1rem;
  padding: 0.65rem 0.75rem;
  font-size: 0.9375rem;
  color: var(--accent);
  background: rgba(45, 74, 62, 0.1);
  border-radius: 8px;
}

.form-foot {
  margin: 1.25rem 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.nav-muted {
  font-size: 0.9375rem;
  color: var(--muted);
  font-weight: 500;
}

/* —— Enterprise portal login (subsidiary / org access) —— */
body.portal-login {
  --portal-navy: #0f172a;
  --portal-navy-mid: #1e293b;
  --portal-accent: #1d4ed8;
  --portal-accent-hover: #1e40af;
  --portal-border: #e2e8f0;
  --portal-muted: #64748b;
  --portal-ink: #0f172a;
  --portal-error-bg: #fef2f2;
  --portal-error-text: #991b1b;
  min-height: 100vh;
  margin: 0;
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--portal-ink);
  background: #f8fafc;
}

.portal-login a {
  color: var(--portal-accent);
}

.portal-login a:hover {
  color: var(--portal-accent-hover);
}

.portal-skip {
  position: absolute;
  left: -9999px;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--portal-navy);
  color: #fff;
  text-decoration: none;
}

.portal-skip:focus {
  left: 1rem;
  top: 1rem;
}

.portal-topbar {
  background: #fff;
  border-bottom: 1px solid var(--portal-border);
}

.portal-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 120rem;
  margin: 0 auto;
  padding: 0.875rem 1.5rem;
}

.portal-topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--portal-ink);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.portal-topbar-brand:hover {
  color: var(--portal-navy-mid);
}

.portal-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 6px;
  background: linear-gradient(145deg, var(--portal-navy) 0%, var(--portal-navy-mid) 100%);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.portal-topbar-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.portal-topbar-nav a {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--portal-muted);
  text-decoration: none;
}

.portal-topbar-nav a:hover {
  color: var(--portal-ink);
}

.portal-grid {
  display: grid;
  min-height: calc(100vh - 57px);
  grid-template-columns: 1fr;
}

@media (min-width: 64rem) {
  .portal-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    max-width: 120rem;
    margin: 0 auto;
  }
}

.portal-brand {
  position: relative;
  padding: 2.5rem 1.75rem 3rem;
  background: linear-gradient(165deg, var(--portal-navy) 0%, #0c1222 55%, var(--portal-navy-mid) 100%);
  color: #f1f5f9;
  overflow: hidden;
}

@media (min-width: 64rem) {
  .portal-brand {
    padding: 4rem 3.5rem;
    min-height: calc(100vh - 57px);
    display: flex;
    align-items: center;
  }
}

.portal-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(ellipse 80% 50% at 100% 0%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 0% 100%, rgba(148, 163, 184, 0.08) 0%, transparent 45%);
  pointer-events: none;
}

.portal-brand-inner {
  position: relative;
  max-width: 28rem;
}

.portal-brand-eyebrow {
  margin: 0 0 0.75rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #94a3b8;
}

.portal-brand-title {
  margin: 0 0 1rem;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: #fff;
}

.portal-brand-text {
  margin: 0 0 1.75rem;
  font-size: 0.9375rem;
  line-height: 1.65;
  color: #cbd5e1;
}

.portal-brand-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.portal-brand-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: #e2e8f0;
}

.portal-brand-icon {
  flex-shrink: 0;
  margin-top: 0.1rem;
  color: #60a5fa;
  opacity: 0.95;
}

.portal-main {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2rem 1.5rem 2.5rem;
  background: #f8fafc;
}

@media (min-width: 64rem) {
  .portal-main {
    padding: 3rem 3.5rem 2rem;
    justify-content: center;
  }
}

.portal-panel {
  width: 100%;
  max-width: 26rem;
  margin: 0 auto;
  padding: 2rem 2rem 1.75rem;
  background: #fff;
  border: 1px solid var(--portal-border);
  border-radius: 12px;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 12px 40px rgba(15, 23, 42, 0.08);
}

@media (min-width: 64rem) {
  .portal-panel {
    margin: 0;
    margin-left: 0;
    max-width: 28rem;
  }
}

.portal-panel--wide {
  max-width: 32rem;
}

@media (min-width: 64rem) {
  .portal-panel--wide {
    max-width: 34rem;
  }
}

.portal-panel-header {
  margin-bottom: 1.5rem;
}

.portal-panel-title {
  margin: 0 0 0.5rem;
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--portal-ink);
}

.portal-panel-sub {
  margin: 0;
  font-size: 0.875rem;
  color: var(--portal-muted);
  line-height: 1.5;
}

.portal-alert {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 1.25rem;
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--portal-error-text);
  background: var(--portal-error-bg);
  border: 1px solid #fecaca;
  border-radius: 8px;
}

.portal-alert-icon {
  flex-shrink: 0;
  margin-top: 0.05rem;
}

.portal-success {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 1.25rem;
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: #166534;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
}

.portal-success-icon {
  flex-shrink: 0;
  margin-top: 0.05rem;
  color: #16a34a;
}

.portal-alt-auth {
  margin: 1.25rem 0 0;
  text-align: center;
  font-size: 0.875rem;
  color: var(--portal-muted);
}

.portal-alt-auth a {
  font-weight: 600;
}

.portal-honeypot {
  position: absolute !important;
  left: -9999px !important;
  height: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.portal-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.portal-form-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.portal-form-section-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--portal-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0;
  padding-top: 0.25rem;
}

.portal-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.portal-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--portal-ink);
}

.portal-input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--portal-ink);
  background: #fff;
  border: 1px solid var(--portal-border);
  border-radius: 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.portal-input::placeholder {
  color: #94a3b8;
}

.portal-input:hover {
  border-color: #cbd5e1;
}

.portal-input:focus {
  outline: none;
  border-color: var(--portal-accent);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.15);
}

.portal-hint {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--portal-muted);
}

.portal-submit {
  margin-top: 0.25rem;
  width: 100%;
  padding: 0.8rem 1.25rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #fff;
  background: var(--portal-accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.portal-submit:hover {
  background: var(--portal-accent-hover);
}

.portal-submit:focus-visible {
  outline: 2px solid var(--portal-accent);
  outline-offset: 2px;
}

.portal-submit:active {
  transform: translateY(1px);
}

.portal-divider {
  margin: 1.5rem 0 1.25rem;
  height: 1px;
  background: var(--portal-border);
}

.portal-meta {
  margin: 0;
  font-size: 0.6875rem;
  line-height: 1.55;
  color: #94a3b8;
}

.portal-footer {
  margin-top: 2.5rem;
  padding-top: 1rem;
  text-align: center;
}

@media (min-width: 64rem) {
  .portal-footer {
    margin-top: auto;
    padding-top: 2rem;
    text-align: left;
    max-width: 28rem;
    margin-left: 0;
    margin-right: auto;
  }
}

.portal-footer-row {
  margin: 0;
  font-size: 0.75rem;
  color: var(--portal-muted);
}

.portal-footer-row a {
  color: var(--portal-muted);
  text-decoration: none;
}

.portal-footer-row a:hover {
  color: var(--portal-accent);
}

.portal-footer-sep {
  margin: 0 0.35rem;
  opacity: 0.5;
}

/* Logged-in portal shell (per-organization branding via --portal-primary / --portal-accent) */
body.portal-app {
  margin: 0;
  min-height: 100vh;
  font-family: "DM Sans", system-ui, sans-serif;
  background: #f1f5f9;
  color: #0f172a;
}

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

.portal-sidebar {
  background: var(--portal-accent, #0f172a);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem 1rem;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.portal-sidebar-brand {
  margin-bottom: 1.5rem;
}

.portal-brand-logo-link {
  display: block;
  line-height: 0;
}

.portal-brand-logo {
  max-width: 100%;
  height: auto;
  max-height: 52px;
  object-fit: contain;
  object-position: left center;
}

.portal-brand-text {
  font-weight: 700;
  font-size: 1.125rem;
  color: #fff;
  text-decoration: none;
  line-height: 1.3;
}

.portal-brand-text:hover {
  color: #e2e8f0;
}

.portal-sidebar-org {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  color: rgba(248, 250, 252, 0.65);
  line-height: 1.35;
}

.portal-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.portal-nav-link {
  display: block;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: rgba(248, 250, 252, 0.85);
  text-decoration: none;
  border: 1px solid transparent;
}

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

.portal-nav-link.is-active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.portal-sidebar-foot {
  margin-top: auto;
  padding-top: 1rem;
  font-size: 0.75rem;
}

.portal-code-pill {
  margin: 0 0 0.75rem;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(248, 250, 252, 0.55);
}

.portal-code-pill span {
  display: inline-block;
  margin-top: 0.2rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #fff;
  font-family: ui-monospace, monospace;
}

.portal-sidebar-muted-link {
  color: rgba(248, 250, 252, 0.55);
  text-decoration: none;
}

.portal-sidebar-muted-link:hover {
  color: #fff;
}

.portal-main-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #f1f5f9;
}

.portal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.85rem 1.5rem;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
}

.portal-topbar-user {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  font-size: 0.875rem;
}

.portal-user-name {
  font-weight: 600;
  color: #0f172a;
}

.portal-user-email {
  color: #64748b;
}

.portal-user-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  background: rgba(29, 78, 216, 0.12);
  color: var(--portal-primary, #1d4ed8);
}

.portal-signout {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--portal-primary, #1d4ed8);
  text-decoration: none;
}

.portal-signout:hover {
  text-decoration: underline;
}

.portal-content {
  flex: 1;
  padding: 1.5rem;
  max-width: 52rem;
  width: 100%;
}

.portal-shell-footer {
  padding: 0.75rem 1.5rem 1.25rem;
  font-size: 0.75rem;
  color: #94a3b8;
}

.portal-shell-footer a {
  color: #64748b;
}

.portal-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.5rem 1.75rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.portal-card h1 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
}

.portal-card .portal-lede {
  margin: 0 0 1rem;
  color: #64748b;
  line-height: 1.55;
}

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

  .portal-sidebar {
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .portal-sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .portal-nav-link {
    padding: 0.45rem 0.65rem;
    font-size: 0.8125rem;
  }
}
