/* ============================================================
   ConstructMate AI — Component Library
   Layer 2 of 2. Depends on design-system.css.
   Mobile-first throughout: base styles target 320px, media
   queries only ever ADD at 768 / 1024 / 1440.
   ============================================================ */

/* ------------------------------------------------------------
   BUTTONS
   Minimum 44x44px touch target everywhere (WCAG 2.5.5).
   ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--sp-2);
  min-height: 48px; padding: var(--sp-3) var(--sp-6);
  font-size: var(--fs-base); font-weight: var(--fw-semi);
  letter-spacing: var(--ls-snug); line-height: 1;
  border-radius: var(--r-pill);
  border: 1.5px solid transparent;
  cursor: pointer; white-space: nowrap; text-align: center;
  transition: transform var(--t-fast) var(--ease-spring),
              box-shadow var(--t-base) var(--ease-out),
              background-color var(--t-base) var(--ease-out),
              border-color var(--t-base) var(--ease-out),
              color var(--t-base) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.btn:active { transform: translateY(1px) scale(.985); }
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: .5; cursor: not-allowed; transform: none !important;
}

/* Primary = the orange accent. Reserved for the single most
   important action on a screen, never used twice side by side. */
/* Dark text, not white: white on #FF6B35 is 2.84:1 and fails WCAG AA.
   Navy on the same untouched brand orange is 6.30:1. */
.btn--primary {
  background: var(--grad-ember); color: var(--c-primary-900);
  box-shadow: var(--sh-ember); font-weight: var(--fw-bold);
}
.btn--primary:hover:not(:disabled) {
  box-shadow: 0 16px 40px -10px rgba(255,107,53,.62);
  transform: translateY(-2px);
}

.btn--secondary {
  background: var(--grad-aqua); color: #04241F;
  box-shadow: var(--sh-aqua); font-weight: var(--fw-bold);
}
.btn--secondary:hover:not(:disabled) {
  box-shadow: 0 16px 40px -10px rgba(0,194,168,.65);
  transform: translateY(-2px);
}

.btn--violet {
  background: var(--grad-violet); color: #fff;
  box-shadow: var(--sh-violet);
}
.btn--violet:hover:not(:disabled) { transform: translateY(-2px); }

.btn--dark {
  background: var(--c-primary); color: #fff;
}
.btn--dark:hover:not(:disabled) {
  background: var(--c-primary-700); transform: translateY(-2px);
  box-shadow: var(--sh-lg);
}

.btn--outline {
  background: var(--c-surface); color: var(--c-text);
  border-color: var(--c-border-strong);
}
.btn--outline:hover:not(:disabled) {
  border-color: var(--c-secondary); color: var(--c-secondary-dark);
  background: var(--c-secondary-soft); transform: translateY(-2px);
}

.btn--ghost { background: transparent; color: var(--c-text-muted); }
.btn--ghost:hover:not(:disabled) {
  background: var(--c-surface-alt); color: var(--c-text);
}

.btn--glass {
  background: rgba(255,255,255,.10); color: #fff;
  border-color: rgba(255,255,255,.28);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.btn--glass:hover:not(:disabled) { background: rgba(255,255,255,.18); }

.btn--sm  { min-height: 40px; padding: var(--sp-2) var(--sp-4); font-size: var(--fs-sm); }
.btn--lg  { min-height: 56px; padding: var(--sp-4) var(--sp-8); font-size: var(--fs-lg); }
.btn--block { width: 100%; }
.btn--icon {
  min-height: 44px; min-width: 44px; padding: 0;
  border-radius: var(--r-md);
}

.btn .spinner { width: 18px; height: 18px; }
.btn.is-loading { pointer-events: none; }
.btn.is-loading .btn__label { opacity: .55; }

/* ------------------------------------------------------------
   CARDS
   ------------------------------------------------------------ */
.card {
  background: var(--c-surface);
  /* Explicit, so a card placed inside a dark section (.hero, .result)
     does not inherit that section's inverted text colour. */
  color: var(--c-text);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--sh-sm);
  transition: transform var(--t-base) var(--ease-out),
              box-shadow var(--t-base) var(--ease-out),
              border-color var(--t-base) var(--ease-out);
}
@media (min-width: 768px) { .card { padding: var(--sp-6); } }

.card--lift:hover, .card--lift:focus-within {
  transform: translateY(-6px);
  box-shadow: var(--sh-lg);
  border-color: transparent;
}

.card--flat { box-shadow: none; }
.card--sunken { background: var(--c-surface-sunken); box-shadow: none; }
.card--pad-lg { padding: var(--sp-6); }
@media (min-width: 768px) { .card--pad-lg { padding: var(--sp-10); } }

/* A top gradient hairline — the recurring card signature */
.card--edge { position: relative; overflow: hidden; }
.card--edge::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: var(--grad-mixed);
}
.card--edge-aqua::before   { background: var(--grad-aqua); }
.card--edge-violet::before { background: var(--grad-violet); }
.card--edge-ember::before  { background: var(--grad-ember); }

.card--dark {
  background: var(--c-primary); color: var(--c-text-invert);
  border-color: rgba(255,255,255,.10);
}
.card--dark .muted { color: rgba(232,238,247,.72); }

.card__header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--sp-3); margin-bottom: var(--sp-4);
}
.card__title { font-size: var(--fs-lg); font-weight: var(--fw-bold); letter-spacing: var(--ls-snug); }
.card__footer {
  margin-top: var(--sp-5); padding-top: var(--sp-4);
  border-top: 1px solid var(--c-border);
}

/* Floating calculator card — sits over the hero on large screens */
.float-card {
  background: var(--c-surface);
  color: var(--c-text);            /* see the note on .card above */
  border-radius: var(--r-xl);
  box-shadow: var(--sh-xl);
  padding: var(--sp-5);
  border: 1px solid rgba(255,255,255,.55);
}
@media (min-width: 768px) { .float-card { padding: var(--sp-6); } }
@media (min-width: 1024px) {
  .float-card--offset { margin-bottom: -96px; position: relative; z-index: 2; }
}

/* ------------------------------------------------------------
   ICON TILE
   ------------------------------------------------------------ */
.table-wrap, .accordion, .empty, .price-card, .kpi, .calc-tile, .rate-card {
  color: var(--c-text);
}

.icon-tile {
  display: grid; place-items: center;
  width: 48px; height: 48px; flex: 0 0 auto;
  border-radius: var(--r-md);
  background: var(--c-secondary-soft); color: var(--c-secondary-dark);
}
.icon-tile svg { width: 24px; height: 24px; }
.icon-tile--lg { width: 60px; height: 60px; border-radius: var(--r-lg); }
.icon-tile--lg svg { width: 30px; height: 30px; }
.icon-tile--violet { background: var(--c-highlight-soft); color: var(--c-highlight); }
.icon-tile--ember  { background: var(--c-accent-soft);    color: var(--c-accent-dark); }
.icon-tile--navy   { background: var(--c-primary-100);    color: var(--c-primary); }
.icon-tile--success{ background: var(--c-success-soft);   color: #047857; }
.icon-tile--grad   { background: var(--grad-mixed); color: #fff; }

/* ------------------------------------------------------------
   BADGES & CHIPS
   ------------------------------------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: 5px var(--sp-3);
  font-size: var(--fs-xs); font-weight: var(--fw-bold);
  letter-spacing: var(--ls-wide);
  border-radius: var(--r-pill);
  background: var(--c-primary-100); color: var(--c-primary-600);
  white-space: nowrap;
}
.badge--aqua    { background: var(--c-secondary-soft); color: #046B5E; }
.badge--violet  { background: var(--c-highlight-soft); color: #5B21B6; }
.badge--ember   { background: var(--c-accent-soft);    color: #B23A12; }
.badge--success { background: var(--c-success-soft);   color: #046C4E; }
.badge--warning { background: var(--c-warning-soft);   color: #92400E; }
.badge--error   { background: var(--c-error-soft);     color: #B91C1C; }
.badge--solid   { background: var(--grad-ember); color: #fff; }
.badge--dot::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}

.chip {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  min-height: 40px; padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-pill);
  border: 1.5px solid var(--c-border);
  background: var(--c-surface);
  font-size: var(--fs-sm); font-weight: var(--fw-medium);
  cursor: pointer; white-space: nowrap;
  transition: all var(--t-fast) var(--ease-out);
}
.chip:hover { border-color: var(--c-secondary); }
.chip.is-active, .chip[aria-pressed="true"] {
  background: var(--c-primary); color: #fff; border-color: var(--c-primary);
}

/* Trend arrow chip used on material rate cards */
.trend {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: var(--fs-xs); font-weight: var(--fw-bold);
  padding: 3px var(--sp-2); border-radius: var(--r-pill);
}
.trend--up   { background: var(--c-error-soft);   color: #B91C1C; }
.trend--down { background: var(--c-success-soft); color: #046C4E; }
.trend--flat { background: var(--c-primary-100);  color: var(--c-primary-500); }

/* ------------------------------------------------------------
   FORMS
   16px font on inputs prevents iOS zoom-on-focus.
   ------------------------------------------------------------ */
.field { display: block; margin-bottom: var(--sp-4); }

.label {
  display: block; margin-bottom: var(--sp-2);
  font-size: var(--fs-sm); font-weight: var(--fw-semi);
  color: var(--c-text);
}
.label .req { color: var(--c-error); margin-left: 2px; }
.hint { display: block; margin-top: var(--sp-2); font-size: var(--fs-xs); color: var(--c-text-subtle); }

.input, .select, .textarea {
  width: 100%;
  min-height: 52px;
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-base);
  color: var(--c-text);
  background: var(--c-surface);
  border: 1.5px solid var(--c-border-strong);
  border-radius: var(--r-md);
  transition: border-color var(--t-fast) var(--ease-out),
              box-shadow var(--t-fast) var(--ease-out),
              background-color var(--t-fast) var(--ease-out);
  appearance: none; -webkit-appearance: none;
}
.textarea { min-height: 120px; padding-top: var(--sp-3); resize: vertical; }

.input::placeholder, .textarea::placeholder { color: var(--c-text-subtle); opacity: 1; }

.input:hover, .select:hover, .textarea:hover { border-color: var(--c-primary-300); }

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--c-secondary);
  box-shadow: var(--focus-ring);
}

.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] {
  border-color: var(--c-error);
}
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(239,68,68,.35); }

.select {
  padding-right: var(--sp-10);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-4) center;
  cursor: pointer;
}

/* Input with a unit suffix (sq ft, ₹, %) */
.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-right: 72px; }
.input-group__suffix,
.input-group__prefix {
  position: absolute; display: flex; align-items: center;
  font-size: var(--fs-sm); font-weight: var(--fw-semi);
  color: var(--c-text-subtle); pointer-events: none;
}
.input-group__suffix { right: var(--sp-4); }
.input-group__prefix { left: var(--sp-4); }
.input-group--prefixed .input { padding-left: 42px; padding-right: var(--sp-4); }

.error-text {
  display: flex; align-items: center; gap: var(--sp-2);
  margin-top: var(--sp-2);
  font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--c-error);
}

/* Segmented control — used for quality tier, currency, units */
.segmented {
  display: grid; gap: 4px; padding: 4px;
  background: var(--c-surface-alt);
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
}
.segmented--2 { grid-template-columns: repeat(2, 1fr); }
.segmented--3 { grid-template-columns: repeat(3, 1fr); }
.segmented--4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 480px) { .segmented--4 { grid-template-columns: repeat(4, 1fr); } }

.segmented input { position: absolute; opacity: 0; width: 0; height: 0; }
.segmented label {
  display: flex; align-items: center; justify-content: center;
  min-height: 44px; padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-sm); font-weight: var(--fw-semi);
  color: var(--c-text-muted);
  border-radius: var(--r-sm); cursor: pointer; text-align: center;
  transition: all var(--t-fast) var(--ease-out);
}
.segmented label:hover { color: var(--c-text); background: rgba(15,23,42,.04); }
.segmented input:checked + label {
  background: var(--c-surface); color: var(--c-primary);
  box-shadow: var(--sh-sm); font-weight: var(--fw-bold);
}
.segmented input:focus-visible + label { box-shadow: var(--focus-ring); }

/* Range slider with a large, thumb-friendly handle */
.range {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 8px; border-radius: var(--r-pill);
  background: var(--c-primary-100);
  outline: none; cursor: pointer;
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--c-surface);
  border: 4px solid var(--c-secondary);
  box-shadow: var(--sh-md); cursor: grab;
}
.range::-moz-range-thumb {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--c-surface);
  border: 4px solid var(--c-secondary);
  box-shadow: var(--sh-md); cursor: grab;
}
.range:focus-visible::-webkit-slider-thumb { box-shadow: var(--focus-ring); }

/* Checkbox / radio */
/* The whole label is the hit area, so it carries the 44px minimum. */
.check {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  cursor: pointer; padding: var(--sp-2) 0; min-height: 44px;
}
.check input {
  width: 24px; height: 24px; margin: 2px 0 0;
  accent-color: var(--c-secondary); flex: 0 0 auto; cursor: pointer;
}
.check span { font-size: var(--fs-sm); line-height: var(--lh-base); }

/* ------------------------------------------------------------
   ALERTS
   ------------------------------------------------------------ */
.alert {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-4);
  border-radius: var(--r-md);
  border-left: 4px solid;
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-4);
}
.alert svg { width: 20px; height: 20px; flex: 0 0 auto; margin-top: 1px; }
.alert--success { background: var(--c-success-soft); border-color: var(--c-success); color: #065F46; }
.alert--warning { background: var(--c-warning-soft); border-color: var(--c-warning); color: #92400E; }
.alert--error   { background: var(--c-error-soft);   border-color: var(--c-error);   color: #991B1B; }
.alert--info    { background: var(--c-secondary-soft); border-color: var(--c-secondary); color: #045F53; }

/* ------------------------------------------------------------
   HEADER + NAVIGATION
   ------------------------------------------------------------ */
.site-header {
  position: sticky; top: 0; z-index: var(--z-header);
  height: var(--h-header);
  background: color-mix(in srgb, var(--c-surface) 86%, transparent);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--c-border);
  transition: box-shadow var(--t-base) var(--ease-out);
}
.site-header.is-scrolled { box-shadow: var(--sh-md); }

.site-header__inner {
  height: 100%; display: flex; align-items: center;
  justify-content: space-between; gap: var(--sp-4);
}

.logo {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-weight: var(--fw-black); font-size: var(--fs-lg);
  letter-spacing: var(--ls-tight);
  /* On phones the wordmark hides and only the 36px mark remains, so the
     link itself carries the 44px minimum touch target. */
  min-height: 44px;
}
.logo__mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--grad-mixed);
  display: grid; place-items: center; flex: 0 0 auto;
  box-shadow: var(--sh-aqua);
}
.logo__mark svg { width: 20px; height: 20px; color: #fff; }
.logo__text { white-space: nowrap; }
.logo__text span { color: var(--c-secondary-dark); }
/* On dark surfaces the light-tuned aqua is too dark (3.6:1);
   the brighter brand aqua gives 7.5:1+ there. */
.footer .logo__text span,
.auth__aside .logo__text span,
.card--dark .logo__text span,
.hero .logo__text span { color: var(--c-secondary); }

.nav { display: none; }
@media (min-width: 1024px) {
  .nav { display: flex; align-items: center; gap: var(--sp-1); }
}
.nav__link {
  display: inline-flex; align-items: center;
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--fs-sm); font-weight: var(--fw-semi);
  color: var(--c-text-muted); border-radius: var(--r-pill);
  transition: all var(--t-fast) var(--ease-out);
}
.nav__link:hover { color: var(--c-text); background: var(--c-surface-alt); }
.nav__link.is-active { color: var(--c-secondary-dark); background: var(--c-secondary-soft); }

.header__actions { display: flex; align-items: center; gap: var(--sp-2); }
@media (max-width: 1023.98px) { .header__actions .btn--lg, .header__actions .desktop-only { display: none; } }

/* Mobile drawer */
.drawer-toggle { display: inline-flex; }
@media (min-width: 1024px) { .drawer-toggle { display: none; } }

.drawer {
  position: fixed; inset: 0; z-index: var(--z-drawer);
  visibility: hidden; pointer-events: none;
}
.drawer.is-open { visibility: visible; pointer-events: auto; }
.drawer__scrim {
  position: absolute; inset: 0;
  background: rgba(2,6,23,.55);
  opacity: 0; transition: opacity var(--t-base) var(--ease-out);
  backdrop-filter: blur(2px);
}
.drawer.is-open .drawer__scrim { opacity: 1; }
.drawer__panel {
  position: absolute; inset: 0 0 0 auto;
  width: min(88vw, 340px);
  background: var(--c-surface);
  box-shadow: var(--sh-xl);
  transform: translate3d(100%, 0, 0);
  transition: transform var(--t-base) var(--ease-out);
  display: flex; flex-direction: column;
  padding: var(--sp-5);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.drawer.is-open .drawer__panel { transform: none; }
.drawer__link {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: 52px; padding: var(--sp-3);
  font-size: var(--fs-base); font-weight: var(--fw-semi);
  border-radius: var(--r-md);
  transition: background var(--t-fast) var(--ease-out);
}
.drawer__link:hover, .drawer__link.is-active { background: var(--c-surface-alt); }
.drawer__link.is-active { color: var(--c-secondary-dark); }

/* ------------------------------------------------------------
   STICKY BOTTOM NAV (mobile only — the primary mobile nav)
   Thumb-zone placement, 5 slots, safe-area aware.
   ------------------------------------------------------------ */
.bottom-nav {
  position: fixed; inset: auto 0 0 0; z-index: var(--z-sticky);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--c-surface) 92%, transparent);
  backdrop-filter: blur(16px) saturate(170%);
  -webkit-backdrop-filter: blur(16px) saturate(170%);
  border-top: 1px solid var(--c-border);
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -4px 20px -6px rgba(15,23,42,.12);
}
@media (min-width: 1024px) { .bottom-nav { display: none; } }

.bottom-nav__item {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px;
  min-height: var(--h-bottomnav); padding: var(--sp-2) 2px;
  font-size: var(--fs-2xs); font-weight: var(--fw-semi);
  color: var(--c-text-subtle);
  position: relative;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--t-fast) var(--ease-out);
}
.bottom-nav__item svg { width: 22px; height: 22px; }
.bottom-nav__item.is-active { color: var(--c-secondary-dark); }
.bottom-nav__item.is-active::before {
  content: ''; position: absolute; top: 0; left: 50%;
  transform: translateX(-50%);
  width: 28px; height: 3px; border-radius: 0 0 4px 4px;
  background: var(--grad-aqua);
}

/* The centre "estimate" action sits proud of the bar */
.bottom-nav__fab {
  display: flex; flex-direction: column; align-items: center;
  justify-content: flex-start; gap: 3px;
  min-height: var(--h-bottomnav); padding-top: 6px;
  font-size: var(--fs-2xs); font-weight: var(--fw-bold);
  color: var(--c-text-subtle);
}
.bottom-nav__fab-ring {
  display: grid; place-items: center;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--grad-ember); color: #fff;
  box-shadow: var(--sh-ember);
  margin-top: -18px;
  border: 3px solid var(--c-surface);
}
.bottom-nav__fab-ring svg { width: 22px; height: 22px; }

/* Content needs room so the bar never covers the last element */
body.has-bottom-nav { padding-bottom: calc(var(--h-bottomnav) + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 1024px) { body.has-bottom-nav { padding-bottom: 0; } }

/* ------------------------------------------------------------
   DASHBOARD SIDEBAR (desktop only)
   ------------------------------------------------------------ */
.sidebar { display: none; }
@media (min-width: 1024px) {
  .sidebar {
    display: flex; flex-direction: column; gap: var(--sp-1);
    position: sticky; top: var(--h-header);
    height: calc(100vh - var(--h-header));
    padding: var(--sp-5) var(--sp-3);
    background: var(--c-surface);
    border-right: 1px solid var(--c-border);
    overflow-y: auto;
  }
}
.sidebar__label {
  padding: var(--sp-4) var(--sp-3) var(--sp-2);
  font-size: var(--fs-2xs); font-weight: var(--fw-bold);
  letter-spacing: var(--ls-caps); text-transform: uppercase;
  color: var(--c-text-subtle);
}
.sidebar__link {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: 46px; padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-sm); font-weight: var(--fw-semi);
  color: var(--c-text-muted); border-radius: var(--r-md);
  transition: all var(--t-fast) var(--ease-out);
}
.sidebar__link svg { width: 20px; height: 20px; flex: 0 0 auto; }
.sidebar__link:hover { background: var(--c-surface-alt); color: var(--c-text); }
.sidebar__link.is-active {
  background: var(--c-primary); color: #fff;
  box-shadow: var(--sh-md);
}

/* ------------------------------------------------------------
   HERO
   ------------------------------------------------------------ */
.hero {
  position: relative; overflow: hidden;
  background: var(--grad-hero);
  color: var(--c-text-invert);
  padding-block: clamp(3rem, 2rem + 8vw, 7rem) clamp(4rem, 3rem + 8vw, 8rem);
  isolation: isolate;
}
/* Aurora blobs — soft colour wash, GPU-cheap, no images */
.hero::before, .hero::after {
  content: ''; position: absolute; border-radius: 50%;
  filter: blur(90px); opacity: .5; z-index: -1;
  pointer-events: none;
}
.hero::before {
  width: 520px; height: 520px; top: -180px; right: -120px;
  background: radial-gradient(circle, #00C2A8 0%, transparent 70%);
}
.hero::after {
  width: 460px; height: 460px; bottom: -200px; left: -140px;
  background: radial-gradient(circle, #7C3AED 0%, transparent 70%);
}
.hero__grid {
  position: absolute; inset: 0; z-index: -1; opacity: .55;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
}
.hero__inner { display: grid; gap: var(--sp-10); align-items: center; }
@media (min-width: 1024px) {
  .hero__inner { grid-template-columns: 1.05fr .95fr; gap: var(--sp-12); }
}
.hero h1 { color: #fff; }
.hero .lead { color: rgba(232,238,247,.82); max-width: 56ch; }

.hero__cta { display: flex; flex-direction: column; gap: var(--sp-3); }
@media (min-width: 480px) { .hero__cta { flex-direction: row; flex-wrap: wrap; } }

.hero__proof {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--sp-4) var(--sp-6); margin-top: var(--sp-8);
  font-size: var(--fs-sm); color: rgba(232,238,247,.72);
}
.hero__proof-item { display: flex; align-items: center; gap: var(--sp-2); }
.hero__proof-item svg { width: 18px; height: 18px; color: var(--c-secondary); }

/* Wave divider so the hero doesn't end on a hard line */
.hero__wave { position: absolute; inset: auto 0 -1px 0; line-height: 0; z-index: 0; }
.hero__wave svg { width: 100%; height: clamp(40px, 6vw, 80px); }
.hero__wave path { fill: var(--c-bg); }

/* ------------------------------------------------------------
   KPI / STAT CARDS with animated counters
   ------------------------------------------------------------ */
.kpi {
  display: flex; flex-direction: column; gap: var(--sp-2);
  padding: var(--sp-5);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  transition: transform var(--t-base) var(--ease-out), box-shadow var(--t-base) var(--ease-out);
}
.kpi:hover { transform: translateY(-4px); box-shadow: var(--sh-lg); }
.kpi__top { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.kpi__label {
  font-size: var(--fs-xs); font-weight: var(--fw-bold);
  letter-spacing: var(--ls-caps); text-transform: uppercase;
  color: var(--c-text-subtle);
}
.kpi__value {
  font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.5rem);
  font-weight: var(--fw-black); line-height: 1.05;
  letter-spacing: var(--ls-tight);
  font-variant-numeric: tabular-nums;
}
.kpi__meta { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--c-text-muted); }

/* Stat strip on dark backgrounds */
.stat-strip {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-6);
  text-align: center;
}
@media (min-width: 768px) { .stat-strip { grid-template-columns: repeat(4, 1fr); } }
.stat-strip__value {
  font-size: clamp(2rem, 1.5rem + 2vw, 3rem);
  font-weight: var(--fw-black); line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-strip__label { margin-top: var(--sp-2); font-size: var(--fs-sm); color: var(--c-text-muted); }

/* ------------------------------------------------------------
   PROGRESS
   ------------------------------------------------------------ */
.progress {
  height: 10px; border-radius: var(--r-pill);
  background: var(--c-primary-100); overflow: hidden;
}
.progress__bar {
  height: 100%; border-radius: var(--r-pill);
  background: var(--grad-aqua);
  width: 0;
  transition: width 900ms var(--ease-out);
}
.progress__bar--ember  { background: var(--grad-ember); }
.progress__bar--violet { background: var(--grad-violet); }

/* Circular budget ring */
.ring { position: relative; display: grid; place-items: center; width: 132px; height: 132px; }
.ring svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.ring__track { fill: none; stroke: var(--c-primary-100); stroke-width: 12; }
.ring__value {
  fill: none; stroke: url(#ringGrad); stroke-width: 12; stroke-linecap: round;
  transition: stroke-dashoffset 1100ms var(--ease-out);
}
.ring__center {
  position: absolute; text-align: center;
}
.ring__center b { display: block; font-size: var(--fs-2xl); font-weight: var(--fw-black); line-height: 1; }
.ring__center small { font-size: var(--fs-xs); color: var(--c-text-subtle); }

/* ------------------------------------------------------------
   TABLES — cards on mobile, real table from 768px up
   ------------------------------------------------------------ */
.table-wrap {
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  background: var(--c-surface);
  overflow: hidden;
}
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table { width: 100%; font-size: var(--fs-sm); }
.table thead { display: none; }
@media (min-width: 768px) { .table thead { display: table-header-group; } }

.table th {
  text-align: left; padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-xs); font-weight: var(--fw-bold);
  letter-spacing: var(--ls-wide); text-transform: uppercase;
  color: var(--c-text-subtle);
  background: var(--c-surface-alt);
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}
.table td { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--c-border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--t-fast) var(--ease-out); }
@media (min-width: 768px) { .table tbody tr:hover { background: var(--c-surface-alt); } }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Mobile: each row becomes a stacked card with its label inline */
@media (max-width: 767.98px) {
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr {
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--c-border);
  }
  .table td {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--sp-4); padding: var(--sp-2) 0; border: 0;
  }
  .table td::before {
    content: attr(data-label);
    font-size: var(--fs-xs); font-weight: var(--fw-bold);
    letter-spacing: var(--ls-wide); text-transform: uppercase;
    color: var(--c-text-subtle); flex: 0 0 auto;
  }
  .table td[data-label=""]::before { content: none; }
  .table .num { text-align: right; }
}

/* ------------------------------------------------------------
   CHARTS (hand-rolled SVG — no library, no extra request)
   ------------------------------------------------------------ */
.chart { width: 100%; }
.chart-svg { width: 100%; height: auto; overflow: visible; }
.chart__bar { transition: opacity var(--t-fast) var(--ease-out); cursor: pointer; }
.chart__bar:hover { opacity: .78; }
.chart__grid-line { stroke: var(--c-border); stroke-width: 1; stroke-dasharray: 3 4; }
.chart__axis-text { font-size: 11px; fill: var(--c-text-subtle); font-weight: 600; }
/* Hover uses opacity, not transform: a CSS transform on these circles
   would fight the rotation applied to their parent <g>. */
.chart__donut-seg { transition: opacity var(--t-fast) var(--ease-out); cursor: pointer; }
.chart__donut-seg:hover { opacity: .78; }

.legend { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); margin-top: var(--sp-4); }
.legend__item { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); }
.legend__swatch { width: 12px; height: 12px; border-radius: 4px; flex: 0 0 auto; }

/* ------------------------------------------------------------
   MATERIAL RATE CARD
   ------------------------------------------------------------ */
.rate-card {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-4);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  transition: all var(--t-base) var(--ease-out);
}
.rate-card:hover { border-color: var(--c-secondary); transform: translateX(4px); box-shadow: var(--sh-md); }
.rate-card__body { min-width: 0; flex: 1; }
.rate-card__name { font-weight: var(--fw-semi); font-size: var(--fs-sm); }
.rate-card__unit { font-size: var(--fs-xs); color: var(--c-text-subtle); }
.rate-card__price {
  text-align: right; font-weight: var(--fw-black);
  font-size: var(--fs-lg); font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ------------------------------------------------------------
   PRICING CARDS
   ------------------------------------------------------------ */
.price-card {
  display: flex; flex-direction: column;
  padding: var(--sp-6);
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-xl);
  transition: all var(--t-base) var(--ease-out);
  position: relative;
}
.price-card:hover { transform: translateY(-6px); box-shadow: var(--sh-lg); }
.price-card--featured {
  border-color: var(--c-highlight);
  box-shadow: var(--sh-violet);
}
@media (min-width: 1024px) { .price-card--featured { transform: scale(1.04); } }
.price-card--featured:hover { transform: translateY(-6px) scale(1.04); }

.price-card__flag {
  position: absolute; top: -13px; left: 50%; transform: translateX(-50%);
  padding: var(--sp-1) var(--sp-4);
  background: var(--grad-violet); color: #fff;
  font-size: var(--fs-xs); font-weight: var(--fw-bold);
  letter-spacing: var(--ls-wide); text-transform: uppercase;
  border-radius: var(--r-pill); white-space: nowrap;
  box-shadow: var(--sh-violet);
}
.price-card__amount {
  display: flex; align-items: baseline; gap: var(--sp-1);
  margin-block: var(--sp-4);
}
.price-card__amount b {
  font-size: clamp(2.25rem, 1.8rem + 2vw, 3rem);
  font-weight: var(--fw-black); line-height: 1; letter-spacing: var(--ls-tight);
}
.price-card__features { display: grid; gap: var(--sp-3); margin-block: var(--sp-5); flex: 1; }
.price-card__features li { display: flex; align-items: flex-start; gap: var(--sp-3); font-size: var(--fs-sm); }
.price-card__features svg { width: 18px; height: 18px; color: var(--c-success); flex: 0 0 auto; margin-top: 2px; }

/* ------------------------------------------------------------
   CALCULATOR TILES
   ------------------------------------------------------------ */
.calc-tile {
  display: flex; flex-direction: column; gap: var(--sp-3);
  padding: var(--sp-5);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xs);
  transition: all var(--t-base) var(--ease-out);
  height: 100%;
}
.calc-tile:hover, .calc-tile:focus-visible {
  transform: translateY(-6px);
  box-shadow: var(--sh-lg);
  border-color: transparent;
}
.calc-tile__title { font-size: var(--fs-base); font-weight: var(--fw-bold); }
.calc-tile__desc { font-size: var(--fs-sm); color: var(--c-text-muted); flex: 1; }
.calc-tile__go {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-sm); font-weight: var(--fw-bold);
  color: var(--c-secondary-dark);
}
.calc-tile:hover .calc-tile__go svg { transform: translateX(4px); }
.calc-tile__go svg { width: 16px; height: 16px; transition: transform var(--t-fast) var(--ease-out); }

/* ------------------------------------------------------------
   RESULT PANEL (calculator output)
   ------------------------------------------------------------ */
.result {
  background: var(--grad-hero);
  color: var(--c-text-invert);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  position: relative; overflow: hidden;
}
.result::before {
  content: ''; position: absolute; width: 300px; height: 300px;
  top: -140px; right: -100px; border-radius: 50%;
  background: radial-gradient(circle, rgba(0,194,168,.45) 0%, transparent 70%);
  filter: blur(50px); pointer-events: none;
}
.result__label {
  font-size: var(--fs-xs); font-weight: var(--fw-bold);
  letter-spacing: var(--ls-caps); text-transform: uppercase;
  color: var(--c-secondary);
}
.result__value {
  font-size: clamp(2rem, 1.5rem + 3vw, 3.25rem);
  font-weight: var(--fw-black); line-height: 1.05;
  letter-spacing: var(--ls-tight); margin-top: var(--sp-2);
  font-variant-numeric: tabular-nums;
}
.result__sub { color: rgba(232,238,247,.78); font-size: var(--fs-sm); margin-top: var(--sp-2); }
.result__breakdown { display: grid; gap: var(--sp-2); margin-top: var(--sp-5); }
.result__row {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4); padding: var(--sp-3) 0;
  border-bottom: 1px solid rgba(255,255,255,.10);
  font-size: var(--fs-sm);
}
.result__row:last-child { border-bottom: 0; }
/* .muted is tuned for light surfaces; inside the dark result panel it
   would otherwise render dark-grey on navy. */
.result .muted, .result .subtle { color: rgba(232, 238, 247, .72); }
.result__row b { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------
   LOADING SKELETONS & SPINNER
   ------------------------------------------------------------ */
.skeleton {
  background: linear-gradient(90deg,
    var(--c-surface-alt) 25%,
    var(--c-primary-100) 37%,
    var(--c-surface-alt) 63%);
  background-size: 900px 100%;
  animation: shimmer 1.5s linear infinite;
  border-radius: var(--r-sm);
}
.skeleton--text { height: 14px; margin-bottom: var(--sp-2); }
.skeleton--title { height: 26px; width: 60%; margin-bottom: var(--sp-4); }
.skeleton--card { height: 160px; border-radius: var(--r-lg); }
.skeleton--circle { border-radius: 50%; }

.spinner {
  width: 22px; height: 22px; flex: 0 0 auto;
  border: 2.5px solid currentColor; border-top-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* ------------------------------------------------------------
   TOASTS
   ------------------------------------------------------------ */
.toast-stack {
  position: fixed; z-index: var(--z-toast);
  left: var(--sp-4); right: var(--sp-4);
  bottom: calc(var(--h-bottomnav) + var(--sp-4) + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: var(--sp-2);
  pointer-events: none;
}
@media (min-width: 1024px) {
  .toast-stack { left: auto; right: var(--sp-6); bottom: var(--sp-6); width: 360px; }
}
.toast {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--c-primary); color: #fff;
  border-radius: var(--r-md);
  box-shadow: var(--sh-xl);
  font-size: var(--fs-sm); font-weight: var(--fw-medium);
  pointer-events: auto;
  animation: fade-up var(--t-base) var(--ease-out);
}
.toast svg { width: 20px; height: 20px; flex: 0 0 auto; }
.toast--success { background: #065F46; }
.toast--error   { background: #991B1B; }

/* ------------------------------------------------------------
   MODAL
   ------------------------------------------------------------ */
.modal {
  position: fixed; inset: 0; z-index: var(--z-modal);
  display: none; align-items: flex-end; justify-content: center;
  padding: 0;
}
@media (min-width: 640px) { .modal { align-items: center; padding: var(--sp-6); } }
.modal.is-open { display: flex; }
.modal__scrim { position: absolute; inset: 0; background: rgba(2,6,23,.62); backdrop-filter: blur(3px); }
.modal__panel {
  position: relative; width: 100%; max-width: 560px;
  max-height: 92vh; overflow-y: auto;
  background: var(--c-surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: var(--sp-6);
  box-shadow: var(--sh-xl);
  animation: fade-up var(--t-base) var(--ease-out);
}
@media (min-width: 640px) { .modal__panel { border-radius: var(--r-xl); animation: scale-in var(--t-base) var(--ease-out); } }

/* ------------------------------------------------------------
   ACCORDION (FAQ)
   ------------------------------------------------------------ */
.accordion { border: 1px solid var(--c-border); border-radius: var(--r-lg); background: var(--c-surface); overflow: hidden; }
.accordion__item + .accordion__item { border-top: 1px solid var(--c-border); }
.accordion__trigger {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4); width: 100%;
  min-height: 60px; padding: var(--sp-4) var(--sp-5);
  font-size: var(--fs-base); font-weight: var(--fw-semi);
  text-align: left; cursor: pointer;
  transition: background var(--t-fast) var(--ease-out);
}
.accordion__trigger:hover { background: var(--c-surface-alt); }
.accordion__trigger svg { width: 20px; height: 20px; flex: 0 0 auto; color: var(--c-text-subtle); transition: transform var(--t-base) var(--ease-out); }
.accordion__trigger[aria-expanded="true"] svg { transform: rotate(180deg); }
.accordion__panel { display: none; padding: 0 var(--sp-5) var(--sp-5); color: var(--c-text-muted); font-size: var(--fs-sm); line-height: var(--lh-loose); }
.accordion__panel.is-open { display: block; animation: fade-in var(--t-base) var(--ease-out); }

/* ------------------------------------------------------------
   EMPTY STATE
   ------------------------------------------------------------ */
.empty {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: var(--sp-4);
  padding: var(--sp-12) var(--sp-5);
  border: 2px dashed var(--c-border-strong);
  border-radius: var(--r-lg);
  background: var(--c-surface);
}
.empty__icon {
  display: grid; place-items: center;
  width: 72px; height: 72px; border-radius: var(--r-lg);
  background: var(--c-surface-alt); color: var(--c-text-subtle);
}
.empty__icon svg { width: 34px; height: 34px; }

/* ------------------------------------------------------------
   AUTH SPLIT LAYOUT
   ------------------------------------------------------------ */
.auth { display: grid; min-height: 100vh; min-height: 100dvh; }
@media (min-width: 1024px) { .auth { grid-template-columns: 1fr 1.05fr; } }

.auth__aside {
  display: none; position: relative; overflow: hidden;
  background: var(--grad-hero); color: var(--c-text-invert);
  padding: var(--sp-12); flex-direction: column; justify-content: space-between;
}
@media (min-width: 1024px) { .auth__aside { display: flex; } }
.auth__aside::before {
  content: ''; position: absolute; width: 480px; height: 480px;
  top: -160px; right: -160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(0,194,168,.5) 0%, transparent 70%);
  filter: blur(80px);
}
.auth__main {
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-6) var(--gutter); background: var(--c-bg);
}
.auth__card { width: 100%; max-width: 440px; }

/* ------------------------------------------------------------
   FOOTER
   ------------------------------------------------------------ */
.footer {
  background: var(--c-primary); color: rgba(232,238,247,.78);
  padding-block: var(--sp-12) var(--sp-8);
  font-size: var(--fs-sm);
}
.footer h6 { color: #fff; margin-bottom: var(--sp-4); font-size: var(--fs-sm); letter-spacing: var(--ls-wide); text-transform: uppercase; }
.footer a { transition: color var(--t-fast) var(--ease-out); }
.footer a:hover { color: var(--c-secondary); }
.footer__grid { display: grid; gap: var(--sp-8); }
@media (min-width: 640px) { .footer__grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .footer__grid { grid-template-columns: 2fr 1fr 1fr 1fr; gap: var(--sp-10); } }
.footer__links { display: grid; gap: var(--sp-1); }
/* Footer links are a primary nav on phones, so they get a full
   44px touch target (WCAG 2.5.5) rather than bare text height. */
.footer__links a {
  display: inline-flex; align-items: center;
  min-height: 44px; padding-right: var(--sp-2);
}
.footer__bottom {
  margin-top: var(--sp-10); padding-top: var(--sp-6);
  border-top: 1px solid rgba(255,255,255,.12);
  display: flex; flex-direction: column; gap: var(--sp-3);
  font-size: var(--fs-xs);
}
@media (min-width: 768px) {
  .footer__bottom { flex-direction: row; align-items: center; justify-content: space-between; }
}

/* ------------------------------------------------------------
   AD SLOTS (AdSense-ready, reserved height = no layout shift)
   ------------------------------------------------------------ */
.ad-slot {
  display: grid; place-items: center;
  margin-block: var(--sp-8);
  min-height: 280px;
  background: var(--c-surface-alt);
  border: 1px dashed var(--c-border-strong);
  border-radius: var(--r-md);
  color: var(--c-text-subtle); font-size: var(--fs-xs);
  letter-spacing: var(--ls-wide); text-transform: uppercase;
  overflow: hidden;
}
@media (min-width: 768px) { .ad-slot { min-height: 250px; } }
.ad-slot--leaderboard { min-height: 100px; }
@media (min-width: 768px) { .ad-slot--leaderboard { min-height: 90px; } }

/* ------------------------------------------------------------
   BREADCRUMB
   ------------------------------------------------------------ */
.crumbs {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--sp-2); font-size: var(--fs-sm); color: var(--c-text-subtle);
}
.crumbs a, .crumbs span {
  display: inline-flex; align-items: center; min-height: 44px;
}
.crumbs a:hover { color: var(--c-secondary-dark); }
.crumbs svg { width: 14px; height: 14px; }

/* ------------------------------------------------------------
   PAGE TRANSITION
   ------------------------------------------------------------ */
.page-enter { animation: fade-in var(--t-base) var(--ease-out); }

@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
