/* ==========================================================================
   Veritas — Design System
   Black + Gold + Warm Ivory. No gradients. Sharp, institutional, bank-grade.
   ========================================================================== */

/* ---------- Tokens ------------------------------------------------------- */

:root {
  /* Brand palette */
  --gold: #CA9426;
  --gold-bright: #E4BA4B;
  --gold-deep: #866023;
  --black: #0D0D0D;
  --black-soft: #111111;
  --black-raised: #161616;
  --black-line: #232323;
  --ivory: #E7E4D7;
  --muted: #928E75;

  /* Status colours (flat, palette-aligned) */
  --status-pending: #928E75;
  --status-approved: #CA9426;
  --status-paid: #E4BA4B;
  --status-overdue: #B23B3B;
  --status-rejected: #6E2E2E;

  /* Typography */
  --font-display: "Cormorant Garamond", "Times New Roman", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  /* Spacing scale (8pt base) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;

  /* Radii — intentionally tight for an institutional feel */
  --r-1: 2px;
  --r-2: 4px;

  /* Layout */
  --container: 1200px;
  --container-narrow: 560px;

  --nav-h: 72px;
}

/* ---------- Reset -------------------------------------------------------- */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ivory);
  background: var(--black);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 600; }
p { margin: 0; }
table { border-collapse: collapse; width: 100%; }

::selection { background: var(--gold); color: var(--black); }

:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}

/* ---------- Type scale --------------------------------------------------- */

.display {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(2.4rem, 5vw, 4rem); line-height: 1.07; letter-spacing: -0.01em; }
.h2 { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.9rem, 3.4vw, 2.8rem); line-height: 1.12; letter-spacing: -0.005em; }
.h3 { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.4rem, 2.2vw, 1.8rem); line-height: 1.2; }
.h4 { font-size: 1.05rem; font-weight: 600; letter-spacing: 0.01em; }

.lead { font-size: clamp(1.05rem, 1.4vw, 1.2rem); color: var(--ivory); opacity: 0.85; line-height: 1.6; }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.eyebrow {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
}

.gold { color: var(--gold); }
.gold-bright { color: var(--gold-bright); }

/* ---------- Layout primitives ------------------------------------------- */

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--s-5); }
.container.narrow { max-width: var(--container-narrow); }

.section { padding: var(--s-9) 0; }
.section.tight { padding: var(--s-7) 0; }

.rule { height: 1px; background: var(--black-line); border: 0; }
.rule.gold { background: var(--gold); height: 2px; width: 56px; }

/* Accent rule used under section headers */
.section-head { max-width: 720px; margin-bottom: var(--s-7); }
.section-head .eyebrow { margin-bottom: var(--s-3); display: block; }
.section-head .h2 { margin-bottom: var(--s-3); }
.section-head.center { margin-inline: auto; text-align: center; }
.section-head.center .rule.gold { margin-inline: auto; }

/* ---------- Buttons ------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 12px 22px;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  border-radius: var(--r-1);
  transition: background-color .18s ease, color .18s ease, border-color .18s ease;
  white-space: nowrap;
  text-align: center;
}

.btn-gold { background: var(--gold); color: var(--black); }
.btn-gold:hover { background: var(--gold-bright); }

.btn-outline { background: transparent; color: var(--ivory); border-color: var(--black-line); }
.btn-outline:hover { border-color: var(--gold); color: var(--gold-bright); }

.btn-ghost { background: transparent; color: var(--muted); padding-inline: 12px; }
.btn-ghost:hover { color: var(--gold-bright); }

.btn-block { display: flex; width: 100%; }
.btn-lg { padding: 15px 30px; font-size: 0.95rem; }
.btn-sm { padding: 10px 16px; font-size: 0.8rem; min-height: 40px; }

.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Forms -------------------------------------------------------- */

.field { margin-bottom: var(--s-5); }
.field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--s-2);
}
.input, .select, .textarea {
  width: 100%;
  font-size: 16px;
  background: var(--black-soft);
  border: 1px solid var(--black-line);
  border-radius: var(--r-1);
  padding: 13px 14px;
  color: var(--ivory);
  transition: border-color .18s ease, background-color .18s ease;
}
.input::placeholder, .textarea::placeholder { color: #5a5747; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--gold);
  background: var(--black-raised);
}
.textarea { min-height: 120px; resize: vertical; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23CA9426' stroke-width='1.5' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

.form-help { font-size: 0.82rem; color: var(--muted); margin-top: var(--s-2); }
.form-error {
  background: rgba(178,59,59,.08);
  border: 1px solid var(--status-overdue);
  border-radius: var(--r-1);
  padding: var(--s-3) var(--s-4);
  font-size: 0.88rem;
  color: #e7b4b4;
  margin-bottom: var(--s-5);
}
.form-success {
  background: rgba(202,148,38,.08);
  border: 1px solid var(--gold);
  border-radius: var(--r-1);
  padding: var(--s-4);
  font-size: 0.9rem;
  margin-bottom: var(--s-5);
}

.checkbox-row { display: flex; align-items: flex-start; gap: var(--s-3); }
.checkbox-row input { margin-top: 3px; accent-color: var(--gold); width: 20px; height: 20px; }
.checkbox-row label { text-transform: none; letter-spacing: 0; color: var(--ivory); font-size: 0.88rem; font-weight: 400; }

/* ---------- Cards -------------------------------------------------------- */

.card {
  background: var(--black-soft);
  border: 1px solid var(--black-line);
  border-radius: var(--r-2);
  padding: var(--s-6);
}
.card.flush { padding: 0; }
.card-head { padding: var(--s-5) var(--s-6); border-bottom: 1px solid var(--black-line); display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); }
.card-body { padding: var(--s-6); }
.card-title { font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; }

/* Feature card (landing) */
.feature {
  background: var(--black-soft);
  border: 1px solid var(--black-line);
  border-radius: var(--r-2);
  padding: var(--s-6);
  transition: border-color .2s ease, transform .2s ease;
  height: 100%;
}
.feature:hover { border-color: var(--gold-deep); transform: translateY(-2px); }
.feature .icon {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 1px solid var(--gold-deep);
  border-radius: var(--r-1);
  color: var(--gold-bright);
  margin-bottom: var(--s-5);
}
.feature h3 { font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; margin-bottom: var(--s-2); }
.feature p { color: var(--ivory); opacity: .8; font-size: 0.95rem; }

/* KPI card */
.kpi {
  background: var(--black-soft);
  border: 1px solid var(--black-line);
  border-radius: var(--r-2);
  padding: var(--s-5);
}
.kpi .label { font-size: 0.74rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.kpi .value { font-family: var(--font-mono); font-size: 1.7rem; font-weight: 600; color: var(--ivory); margin-top: var(--s-2); }
.kpi .value.gold { color: var(--gold-bright); }
.kpi .delta { font-size: 0.8rem; margin-top: var(--s-2); }
.kpi .delta.up { color: var(--gold-bright); }
.kpi .delta.down { color: #e7b4b4; }

/* ---------- Badges ------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--r-1);
  border: 1px solid var(--black-line);
  color: var(--muted);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.pending { color: var(--status-pending); border-color: rgba(146,142,117,.4); }
.badge.approved, .badge.paid { color: var(--status-approved); border-color: rgba(202,148,38,.4); }
.badge.overdue { color: var(--status-overdue); border-color: rgba(178,59,59,.4); }
.badge.rejected { color: #e7b4b4; border-color: rgba(110,46,46,.6); }

/* ---------- Tables ------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
table.data {
  font-size: 0.9rem;
  min-width: 520px;
}
table.data th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--black-line);
  white-space: nowrap;
}
table.data td {
  padding: var(--s-4);
  border-bottom: 1px solid var(--black-line);
  vertical-align: middle;
}
table.data tbody tr:hover { background: var(--black-raised); }
table.data .num { font-family: var(--font-mono); text-align: right; white-space: nowrap; }
table.data th.num { text-align: right; }

/* ---------- Navigation --------------------------------------------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(13,13,13,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--black-line);
}
.nav-inner {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-5);
}
.nav .brand { height: 100%; }
.brand { display: flex; align-items: center; }

/* Logo image — navbar variant: fills navbar height, preserves aspect ratio */
.brand .brand-logo {
  display: block;
  height: 100%;
  width: auto;
  max-width: none;
  object-fit: contain;
  padding: 0.25rem 0;
}

/* Logo image — sidebar / footer / auth variant: fits container width */
.brand .brand-logo-side {
  display: block;
  max-height: 40px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.nav-links { display: flex; align-items: center; gap: var(--s-6); }
.nav-links a { font-size: 0.9rem; color: var(--ivory); opacity: .8; transition: opacity .18s, color .18s; }
.nav-links a:hover { opacity: 1; color: var(--gold-bright); }

.nav-actions { display: flex; align-items: center; gap: var(--s-3); }

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--black-line);
  border-radius: var(--r-1);
  padding: 10px 12px;
  color: var(--ivory);
  min-height: 44px;
}

/* ---------- Footer ------------------------------------------------------- */

.footer {
  border-top: 1px solid var(--black-line);
  background: var(--black-soft);
  padding: var(--s-8) 0 var(--s-6);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: var(--s-7);
  margin-bottom: var(--s-7);
}
.footer h4 { font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--s-4); }
.footer ul li { margin-bottom: var(--s-2); }
.footer ul a { color: var(--ivory); opacity: .75; font-size: 0.92rem; }
.footer ul a:hover { opacity: 1; color: var(--gold-bright); }
.footer-bottom {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--s-3);
  padding-top: var(--s-5); border-top: 1px solid var(--black-line);
  font-size: 0.82rem; color: var(--muted);
}

/* ---------- Landing: hero ----------------------------------------------- */

.hero { padding: var(--s-9) 0 var(--s-8); position: relative; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: var(--s-8);
  align-items: center;
}
.hero h1 { margin-bottom: var(--s-5); }
.hero .lead { margin-bottom: var(--s-6); max-width: 540px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-bottom: var(--s-6); }
.hero-trust { display: flex; gap: var(--s-6); flex-wrap: wrap; padding-top: var(--s-5); border-top: 1px solid var(--black-line); }
.hero-trust .stat .num { font-family: var(--font-mono); font-size: 1.5rem; color: var(--gold-bright); font-weight: 600; }
.hero-trust .stat .lbl { font-size: 0.8rem; color: var(--muted); }

/* Hero visual: a stylised "vault" panel built from CSS only */
.hero-visual {
  background: var(--black-soft);
  border: 1px solid var(--black-line);
  border-radius: var(--r-2);
  padding: var(--s-6);
  position: relative;
}
.hero-visual::before {
  content: "";
  position: absolute; inset: 0;
  border: 1px solid var(--gold-deep);
  border-radius: var(--r-2);
  margin: 6px;
  pointer-events: none;
}
.hv-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--s-5); }
.hv-title { font-family: var(--font-display); font-size: 1.1rem; }
.hv-balance { font-family: var(--font-mono); font-size: 2.2rem; font-weight: 600; color: var(--gold-bright); margin: var(--s-2) 0 var(--s-1); }
.hv-sub { font-size: 0.82rem; color: var(--muted); }
.hv-bars { display: flex; align-items: flex-end; gap: 10px; height: 120px; margin: var(--s-6) 0; }
.hv-bars .bar { flex: 1; background: var(--gold-deep); border-radius: 2px 2px 0 0; }
.hv-bars .bar.alt { background: var(--gold); }
.hv-rows { display: flex; flex-direction: column; gap: var(--s-3); }
.hv-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.88rem; padding-bottom: var(--s-3); border-bottom: 1px solid var(--black-line); }
.hv-row:last-child { border-bottom: 0; }
.hv-row .l { color: var(--muted); }
.hv-row .r { font-family: var(--font-mono); }

/* ---------- Landing: feature grid --------------------------------------- */

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

/* ---------- Landing: communities band ----------------------------------- */

.band {
  background: var(--black-soft);
  border-block: 1px solid var(--black-line);
  padding: var(--s-8) 0;
}
.band-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: var(--s-8);
  align-items: center;
}
.band-quote {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  line-height: 1.3;
  font-style: italic;
  color: var(--ivory);
}
.band-quote .gold { color: var(--gold-bright); font-style: normal; }
.band-author { margin-top: var(--s-5); font-size: 0.9rem; }
.band-author .name { color: var(--gold-bright); font-weight: 600; }
.band-author .role { color: var(--muted); }

/* Mosaic of community tiles (CSS-only imagery) */
.mosaic { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-3); }
.tile {
  aspect-ratio: 1 / 1;
  border: 1px solid var(--black-line);
  border-radius: var(--r-1);
  background: var(--black-raised);
  display: grid; place-items: center;
  text-align: center;
  padding: var(--s-3);
}
.tile .num { font-family: var(--font-mono); font-size: 1.4rem; color: var(--gold-bright); font-weight: 600; }
.tile .lbl { font-size: 0.72rem; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 4px; }
.tile.wide { grid-column: span 2; aspect-ratio: 2.1 / 1; }

/* ---------- Landing: how it works --------------------------------------- */

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-5);
  counter-reset: step;
}
.step {
  position: relative;
  padding-top: var(--s-7);
  border-top: 1px solid var(--black-line);
}
.step::before {
  counter-increment: step;
  content: "0" counter(step);
  position: absolute;
  top: -14px;
  left: 0;
  background: var(--black);
  padding-right: var(--s-3);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--gold);
  font-weight: 600;
}
.step h3 { font-family: var(--font-display); font-size: 1.25rem; margin-bottom: var(--s-2); }
.step p { font-size: 0.92rem; color: var(--ivory); opacity: .8; }

/* ---------- Landing: pricing -------------------------------------------- */

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-5);
  align-items: start;
}
.plan {
  background: var(--black-soft);
  border: 1px solid var(--black-line);
  border-radius: var(--r-2);
  padding: var(--s-6);
  display: flex; flex-direction: column;
}
.plan.featured { border-color: var(--gold); position: relative; }
.plan.featured::after {
  content: "Most chosen";
  position: absolute; top: -11px; left: var(--s-6);
  background: var(--gold); color: var(--black);
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 3px 10px; border-radius: var(--r-1);
}
.plan .name { font-family: var(--font-display); font-size: 1.4rem; margin-bottom: var(--s-2); }
.plan .price { font-family: var(--font-mono); font-size: 2.2rem; font-weight: 600; color: var(--ivory); }
.plan .price .per { font-size: 0.9rem; color: var(--muted); font-weight: 400; }
.plan .desc { color: var(--muted); font-size: 0.9rem; margin: var(--s-3) 0 var(--s-5); }
.plan ul { margin-bottom: var(--s-6); flex: 1; }
.plan ul li { padding: var(--s-2) 0; border-bottom: 1px solid var(--black-line); font-size: 0.92rem; display: flex; gap: var(--s-3); }
.plan ul li:last-child { border-bottom: 0; }
.plan ul li::before { content: "✓"; color: var(--gold); font-weight: 700; }

/* ---------- Landing: closing CTA ---------------------------------------- */

.cta-band {
  border: 1px solid var(--gold-deep);
  border-radius: var(--r-2);
  background: var(--black-soft);
  padding: var(--s-8) var(--s-7);
  text-align: center;
}
.cta-band .h2 { margin-bottom: var(--s-3); }
.cta-band .lead { margin-bottom: var(--s-6); }
.cta-band .hero-cta { justify-content: center; }

/* ---------- Auth shell -------------------------------------------------- */

.auth-shell {
  min-height: calc(100vh - var(--nav-h));
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
}
.auth-aside {
  background: var(--black-soft);
  border-right: 1px solid var(--black-line);
  padding: var(--s-8);
  display: flex; flex-direction: column; justify-content: space-between;
}
.auth-aside .quote { font-family: var(--font-display); font-size: 1.6rem; line-height: 1.3; }
.auth-aside .quote .gold { color: var(--gold-bright); }
.auth-aside .trust-list { margin-top: var(--s-6); }
.auth-aside .trust-list li { padding: var(--s-3) 0; border-top: 1px solid var(--black-line); font-size: 0.9rem; display: flex; gap: var(--s-3); }
.auth-aside .trust-list li:first-child { border-top: 0; }
.auth-aside .trust-list li::before { content: "◆"; color: var(--gold); font-size: 0.7rem; margin-top: 4px; }

.auth-main { padding: var(--s-8) var(--s-5); display: flex; align-items: center; justify-content: center; }
.auth-card { width: 100%; max-width: 440px; }
.auth-card .h2 { margin-bottom: var(--s-2); }
.auth-card .sub { color: var(--muted); margin-bottom: var(--s-6); font-size: 0.95rem; }
.auth-foot { margin-top: var(--s-6); font-size: 0.9rem; color: var(--muted); text-align: center; }
.auth-foot a { color: var(--gold-bright); }

/* Step indicator (register) */
.steps-indicator { display: flex; gap: var(--s-2); margin-bottom: var(--s-6); }
.steps-indicator .seg {
  flex: 1; height: 3px; background: var(--black-line); border-radius: 2px;
}
.steps-indicator .seg.active { background: var(--gold); }
.steps-indicator .seg.done { background: var(--gold-deep); }
.step-labels { display: flex; justify-content: space-between; font-size: 0.74rem; color: var(--muted); margin-bottom: var(--s-6); letter-spacing: 0.06em; text-transform: uppercase; }

/* OTP boxes */
.otp-row { display: flex; gap: var(--s-3); justify-content: center; }
.otp-row input {
  flex: 1 1 0; min-width: 0; max-width: 52px; height: 60px; text-align: center;
  font-family: var(--font-mono); font-size: 1.4rem;
  background: var(--black-soft); border: 1px solid var(--black-line); border-radius: var(--r-1);
  color: var(--ivory);
}
.otp-row input:focus { border-color: var(--gold); outline: none; }

/* Pending approval */
.pending-wrap { text-align: center; max-width: 520px; margin: 0 auto; padding: var(--s-9) var(--s-5); }
.pending-icon {
  width: 72px; height: 72px; margin: 0 auto var(--s-6);
  border: 1px solid var(--gold); border-radius: 50%;
  display: grid; place-items: center; color: var(--gold-bright);
}
.pending-clock { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .55; } 50% { opacity: 1; } }

/* ---------- App shell (console / portal / owner) ----------------------- */

.app-shell { display: grid; grid-template-columns: 248px 1fr; min-height: calc(100vh - var(--nav-h)); }
.sidebar {
  background: var(--black-soft);
  border-right: 1px solid var(--black-line);
  padding: var(--s-5);
  position: sticky; top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow-y: auto;
}
.sidebar .group-label { font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin: var(--s-5) 0 var(--s-2); }
.sidebar a.nav-item {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 10px 12px; border-radius: var(--r-1);
  font-size: 0.9rem; color: var(--ivory); opacity: .8;
  border: 1px solid transparent;
}
.sidebar a.nav-item:hover { background: var(--black-raised); opacity: 1; }
.sidebar a.nav-item.active { background: var(--black-raised); border-color: var(--gold-deep); color: var(--gold-bright); opacity: 1; }
.sidebar a.nav-item .ic { width: 18px; color: var(--muted); }
.sidebar a.nav-item.active .ic { color: var(--gold-bright); }

.app-main { padding: var(--s-6) var(--s-6) var(--s-8); min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: var(--s-4); margin-bottom: var(--s-6); }
.page-head .eyebrow { margin-bottom: var(--s-2); }
.page-head h1 { font-family: var(--font-display); font-size: clamp(1.6rem, 2.6vw, 2.2rem); }
.page-head .actions { display: flex; gap: var(--s-3); flex-wrap: wrap; }

/* Toolbar / filter bar */
.toolbar {
  display: flex; gap: var(--s-3); flex-wrap: wrap; align-items: center;
  background: var(--black-soft); border: 1px solid var(--black-line);
  border-radius: var(--r-2); padding: var(--s-3) var(--s-4);
  margin-bottom: var(--s-5);
}
.toolbar .search { flex: 1 1 100%; min-width: 120px; position: relative; }
.toolbar .search input { width: 100%; background: transparent; border: 1px solid var(--black-line); border-radius: var(--r-1); padding: 9px 12px 9px 36px; color: var(--ivory); }
.toolbar .search input:focus { border-color: var(--gold); outline: none; }
.toolbar .search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.toolbar .select { width: auto; min-width: 120px; padding: 9px 32px 9px 12px; }

/* KPI grid */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-4); margin-bottom: var(--s-6); }
.kpi-grid-3 { grid-template-columns: repeat(3, 1fr); }

/* Two-column app layout */
.app-cols { display: grid; grid-template-columns: 2fr 1fr; gap: var(--s-5); align-items: start; }
.app-cols .col-main, .app-cols .col-side { display: flex; flex-direction: column; gap: var(--s-5); }

/* Chart (CSS-only bars) */
.chart { display: flex; align-items: flex-end; gap: var(--s-3); height: 200px; padding-top: var(--s-4); }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: var(--s-2); justify-content: flex-end; height: 100%; }
.chart .col .bars { display: flex; gap: 4px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.chart .col .bars .b { width: 14px; background: var(--gold-deep); border-radius: 2px 2px 0 0; }
.chart .col .bars .b.alt { background: var(--gold); }
.chart .col .lbl { font-size: 0.72rem; color: var(--muted); }

/* Proportion bar (solid colours only — no gradients) */
.proportion-head { text-align: center; margin-bottom: var(--s-4); }
.proportion-head .big { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 600; color: var(--gold-bright); }
.proportion-head .sm { font-size: 0.74rem; color: var(--muted); }
.proportion { display: flex; height: 14px; border-radius: var(--r-1); overflow: hidden; border: 1px solid var(--black-line); }
.proportion .seg { height: 100%; }
.proportion .seg.s1 { background: var(--gold); }
.proportion .seg.s2 { background: var(--gold-deep); }
.proportion .seg.s3 { background: var(--muted); }

.legend { display: flex; flex-direction: column; gap: var(--s-3); margin-top: var(--s-5); }
.legend .li { display: flex; align-items: center; gap: var(--s-3); font-size: 0.88rem; }
.legend .sw { width: 10px; height: 10px; border-radius: 2px; }
.legend .li .v { margin-left: auto; font-family: var(--font-mono); color: var(--ivory); }

/* Member portal */
.portal-hero {
  background: var(--black-soft); border: 1px solid var(--black-line); border-radius: var(--r-2);
  padding: var(--s-6); margin-bottom: var(--s-6);
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--s-4);
}
.portal-hero .greet { font-family: var(--font-display); font-size: 1.6rem; }
.portal-hero .greet .gold { color: var(--gold-bright); }
.portal-hero .meta { font-size: 0.85rem; color: var(--muted); }

.summary-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-4); margin-bottom: var(--s-6); }
.summary-cards .kpi .value { font-size: 1.5rem; }

.guarantor {
  display: flex; align-items: center; gap: var(--s-4); padding: var(--s-4);
  border: 1px solid var(--gold-deep); border-radius: var(--r-2);
  background: rgba(202,148,38,.05); margin-bottom: var(--s-4);
  flex-wrap: wrap;
}
.guarantor .ic { width: 40px; height: 40px; border: 1px solid var(--gold); border-radius: var(--r-1); display: grid; place-items: center; color: var(--gold-bright); flex-shrink: 0; }
.guarantor .body { flex: 1; }
.guarantor .body .t { font-weight: 600; }
.guarantor .body .s { font-size: 0.85rem; color: var(--muted); }
.guarantor .actions { display: flex; gap: var(--s-2); }

/* Modal / dialog */
.dialog-overlay {
  position: fixed; inset: 0; background: rgba(13,13,13,.8);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: var(--s-4);
  overflow-y: auto;
}
.dialog-overlay.open { display: flex; }
.dialog {
  background: var(--black-soft); border: 1px solid var(--gold-deep); border-radius: var(--r-2);
  width: 100%; max-width: 460px; max-height: calc(100vh - 2 * var(--s-4)); overflow-y: auto;
  padding: var(--s-6); margin: auto;
}
.dialog h3 { font-family: var(--font-display); font-size: 1.4rem; margin-bottom: var(--s-2); }
.dialog .sub { color: var(--muted); font-size: 0.9rem; margin-bottom: var(--s-5); }
.dialog .amount-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-2); margin-bottom: var(--s-5); }
.dialog .amount-grid button {
  background: var(--black); border: 1px solid var(--black-line); border-radius: var(--r-1);
  padding: var(--s-3); color: var(--ivory); font-family: var(--font-mono); font-size: 0.95rem;
}
.dialog .amount-grid button:hover, .dialog .amount-grid button.sel { border-color: var(--gold); color: var(--gold-bright); }
.dialog-close { float: right; background: transparent; border: 0; color: var(--muted); font-size: 1.4rem; line-height: 1; }
.dialog-close:hover { color: var(--gold-bright); }

/* Sidebar toggle — mobile only */
.sidebar-toggle { display: none; }
.input.invalid, .select.invalid { border-color: var(--status-overdue); }

/* Owner dashboard queue */
.queue-item {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
  padding: var(--s-5); border-bottom: 1px solid var(--black-line); flex-wrap: wrap;
}
.queue-item:last-child { border-bottom: 0; }
.queue-item .info .name { font-weight: 600; font-size: 1rem; }
.queue-item .info .meta { font-size: 0.82rem; color: var(--muted); margin-top: 2px; }
.queue-item .actions { display: flex; gap: var(--s-2); }

/* Empty state */
.empty { text-align: center; padding: var(--s-8) var(--s-5); color: var(--muted); }
.empty .ic { width: 48px; height: 48px; margin: 0 auto var(--s-4); border: 1px solid var(--black-line); border-radius: 50%; display: grid; place-items: center; }

/* ---------- Hero: trust badges ----------------------------------------- */

.trust-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-5);
  padding-top: var(--s-5);
  border-top: 1px solid var(--black-line);
}
.trust-badges .badge-item {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: 0.88rem;
  color: var(--ivory);
}
.trust-badges .badge-item svg { color: var(--gold-bright); flex-shrink: 0; }

/* ---------- Hero: eyebrow + display title ------------------------------ */

.hero-eyebrow {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: var(--s-4);
  display: block;
}
.hero-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.6rem, 5.6vw, 4.6rem);
  line-height: 1.04;
  letter-spacing: -0.015em;
  margin-bottom: var(--s-3);
}
.hero-brand-line {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.1rem, 1.8vw, 1.4rem);
  color: var(--gold-bright);
  letter-spacing: 0.04em;
  margin-bottom: var(--s-5);
  display: block;
}
.hero-cta-three { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-bottom: var(--s-6); }

/* ---------- Communities: illustration ---------------------------------- */

.community-illustration {
  background: var(--black-soft);
  border: 1px solid var(--black-line);
  border-radius: var(--r-2);
  padding: var(--s-6);
  position: relative;
  overflow: hidden;
}
.community-illustration::before {
  content: "";
  position: absolute; inset: 6px;
  border: 1px solid var(--gold-deep);
  border-radius: var(--r-2);
  pointer-events: none;
  z-index: 2;
}
.community-illustration img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--r-1);
}
.community-caption {
  position: relative;
  display: block;
  margin-top: var(--s-4);
  font-size: 0.78rem; color: var(--muted);
  letter-spacing: 0.06em; text-transform: uppercase;
}

/* ---------- Pricing: single plan (centered) ---------------------------- */

.pricing-single {
  display: flex;
  justify-content: center;
}
.pricing-single .plan {
  max-width: 460px;
  width: 100%;
}
.plan .price-currency { font-family: var(--font-mono); font-size: 1rem; color: var(--muted); vertical-align: super; margin-right: 2px; }
.plan .price-period { font-size: 0.95rem; color: var(--muted); font-weight: 400; }

/* ---------- Footer: simple --------------------------------------------- */

.footer-simple { padding: var(--s-7) 0 var(--s-5); }
.footer-simple-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s-4);
  padding-bottom: var(--s-5);
  border-bottom: 1px solid var(--black-line);
}
.footer-links { display: flex; gap: var(--s-6); flex-wrap: wrap; }
.footer-links a { font-size: 0.92rem; color: var(--ivory); opacity: .8; }
.footer-links a:hover { opacity: 1; color: var(--gold-bright); }
.footer-simple-bottom { padding-top: var(--s-4); display: block; text-align: left; }

/* Utility */
.flex { display: flex; }
.between { justify-content: space-between; }
.center { justify-content: center; align-items: center; }
.wrap { flex-wrap: wrap; }
.gap-2 { gap: var(--s-2); } .gap-3 { gap: var(--s-3); } .gap-4 { gap: var(--s-4); } .gap-5 { gap: var(--s-5); }
.mt-2 { margin-top: var(--s-2); } .mt-4 { margin-top: var(--s-4); } .mt-5 { margin-top: var(--s-5); } .mt-6 { margin-top: var(--s-6); }
.mb-6 { margin-bottom: var(--s-6); }
.text-sm { font-size: 0.88rem; } .text-xs { font-size: 0.78rem; }
.hide-mobile { } .show-mobile { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ==========================================================================
   Responsive
   Breakpoints: 1024px (tablet landscape), 768px (tablet portrait),
   560px (large phone), 400px (small phone)
   ========================================================================== */

@media (max-width: 1024px) {
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .app-cols { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .steps { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  /* Nav: hide desktop links, show hamburger */
  .nav-links { display: none; }
  .nav-toggle { display: inline-flex; }
  .brand .brand-logo { padding: 0.375rem 0; }
  .nav-links.open {
    display: flex; flex-direction: column; align-items: stretch;
    position: absolute; top: var(--nav-h); left: 0; right: 0;
    background: var(--black-soft); border-bottom: 1px solid var(--black-line);
    padding: var(--s-4) var(--s-5); gap: var(--s-2);
  }
  .nav-links.open a { padding: 12px 0; min-height: 44px; display: flex; align-items: center; }

  /* Hero: stack to single column, visual first */
  .hero { padding: var(--s-7) 0 var(--s-6); }
  .hero-grid { grid-template-columns: 1fr; gap: var(--s-6); }
  .hero-visual { order: -1; }
  .hero-cta-three { gap: var(--s-2); }

  /* Band: stack */
  .band-grid { grid-template-columns: 1fr; gap: var(--s-6); }
  .band { padding: var(--s-6) 0; }

  /* Pricing: single column */
  .pricing-grid { grid-template-columns: 1fr; }

  /* Auth: hide aside, single column */
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-main { padding: var(--s-6) var(--s-4); }

  /* App shell: sidebar becomes toggleable */
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--black-line);
    display: none;
  }
  .sidebar.open { display: block; }
  .sidebar-toggle { display: inline-flex; }
  .app-main { padding: var(--s-4) var(--s-4) var(--s-6); }

  /* Summary cards: 2-col on tablet to reduce scroll */
  .summary-cards { grid-template-columns: repeat(2, 1fr); }

  /* Footer */
  .footer-grid { grid-template-columns: 1fr; gap: var(--s-5); }
  .footer-simple-top { flex-direction: column; align-items: flex-start; }
  .footer-links { gap: var(--s-4); }

  /* Section padding: reduce for tablet */
  .section { padding: var(--s-7) 0; }
  .section-head { margin-bottom: var(--s-6); }
  .cta-band { padding: var(--s-6) var(--s-5); }
}

@media (max-width: 560px) {
  .container { padding: 0 var(--s-4); }

  /* Feature grid: 2-col on phones to reduce scroll length */
  .feature-grid { grid-template-columns: repeat(2, 1fr); gap: var(--s-3); }
  .feature { padding: var(--s-4); }
  .feature .icon { width: 36px; height: 36px; margin-bottom: var(--s-3); }
  .feature h3 { font-size: 1.1rem; }
  .feature p { font-size: 0.85rem; }

  /* KPI grid: 2-col on phones */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: var(--s-3); }
  .kpi { padding: var(--s-4); }
  .kpi .value { font-size: 1.3rem; }
  .kpi .label { font-size: 0.68rem; }

  /* Summary cards: 2-col on phones */
  .summary-cards { grid-template-columns: repeat(2, 1fr); gap: var(--s-3); }
  .summary-cards .kpi .value { font-size: 1.2rem; }

  /* Steps: 2-col on phones */
  .steps { grid-template-columns: repeat(2, 1fr); gap: var(--s-4); }
  .step { padding-top: var(--s-5); }
  .step h3 { font-size: 1.1rem; }
  .step p { font-size: 0.85rem; }

  /* Mosaic: 2-col */
  .mosaic { grid-template-columns: repeat(2, 1fr); }
  .tile.wide { grid-column: span 2; }

  /* Hero trust badges: tighter */
  .hero-trust { gap: var(--s-4); }
  .hero-trust .stat .num { font-size: 1.2rem; }

  /* Nav: hide outline button on small phones, keep gold + hamburger */
  .nav-actions .btn-outline { display: none; }
  .nav-actions { gap: var(--s-2); }

  /* Section padding: further reduce for phones */
  .section { padding: var(--s-6) 0; }
  .hero { padding: var(--s-6) 0; }
  .cta-band { padding: var(--s-5) var(--s-4); }

  /* OTP: smaller boxes */
  .otp-row input { height: 52px; font-size: 1.2rem; max-width: 44px; }
  .otp-row { gap: var(--s-2); }

  /* Pending wrap: reduce padding */
  .pending-wrap { padding: var(--s-6) var(--s-4); }

  /* Card padding: reduce */
  .card { padding: var(--s-4); }
  .card-head { padding: var(--s-4); }
  .card-body { padding: var(--s-4); }
  .plan { padding: var(--s-4); }

  /* Dialog: full width with minimal padding */
  .dialog { padding: var(--s-4); }
  .dialog .amount-grid button { padding: var(--s-2); font-size: 0.85rem; }

  /* Page head: tighter */
  .page-head { margin-bottom: var(--s-4); }
}

@media (max-width: 400px) {
  /* Very small phones: hero CTA buttons stack full-width */
  .hero-cta-three { flex-direction: column; }
  .hero-cta-three .btn { width: 100%; }
  .hero-cta { flex-direction: column; }
  .hero-cta .btn { width: 100%; }

  /* Brand logo: more padding on very small screens */
  .brand .brand-logo { padding: 0.5rem 0; }

  /* Feature grid: back to 1-col on very narrow screens */
  .feature-grid { grid-template-columns: 1fr; }

  /* KPI grid: 1-col on very narrow screens */
  .kpi-grid { grid-template-columns: 1fr; }
  .summary-cards { grid-template-columns: 1fr; }

  /* Steps: 1-col */
  .steps { grid-template-columns: 1fr; }

  /* Nav actions: gold button text shorter */
  .nav-actions .btn-gold { padding: 8px 12px; font-size: 0.78rem; }

  /* Container: minimal padding */
  .container { padding: 0 var(--s-3); }

  /* OTP: even tighter */
  .otp-row input { max-width: 38px; height: 48px; font-size: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
