/*
 * bcf.css — Backcountry Forecast project stylesheet
 *
 * Complete design system: tokens, reset, shell layout, page components.
 * CSS extracted directly from authoritative HTML mockups.
 */


/* ═══════════════════════════════════════════════════════════════════
   1. DESIGN TOKENS
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --brand-dark: #1E2125;
  --mint: #8FFCD3;
  --mint-mid: #3DBA88;
  --logo-green: #61FFD0;

  --surface: #F4F5F4;
  --card: #FFFFFF;
  --card-border: #E2E5E2;
  --divider: #F0F2F0;
  --canvas: #E8EBE8;

  --text-primary: #1E2125;
  --text-secondary: #8A8F88;
  --label: #5A5F58;
  --text-inactive: #CDD0CC;
  --placeholder: #CDD0CC;

  --status-green: #3DBA88;
  --status-green-bg: #E4F7EE;
  --status-green-text: #1D7A50;

  --amber: #D4A033;
  --amber-bg: #FEF3E0;
  --amber-border: #EDD9A8;
  --amber-text: #8A6520;

  --error: #D4504F;
  --error-text: #A32D2D;
  --error-bg: #FCEAEA;
  --disconnect-bg: #FCEAEA;
  --disconnect-border: #E8ABAB;
  --disconnect-text: #993333;
  --disconnect-hover-bg: #F9DADA;
  --disconnect-hover-border: #D4504F;

  --link: #3DBA88;
  --link-hover: #2D8A5E;
  --link-border: #C8EDD9;
  --link-bg: #F7FDF9;

  --font-sans: 'DM Sans', system-ui, -apple-system, sans-serif;

  --max-width-shell: 960px;
  --max-width-content: 720px;

  --radius-card: 12px;
  --radius-btn: 9px;
  --radius-badge: 6px;
  --radius-input: 8px;
  --radius-modal: 14px;

  --shadow-shell: 0 0 60px rgba(0,0,0,0.08);
  --shadow-dropdown: 0 8px 24px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.06);
  --shadow-modal: 0 16px 48px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);

  --transition-fast: 0.12s;
  --transition-med: 0.15s;
}


/* ═══════════════════════════════════════════════════════════════════
   2. RESET
   ═══════════════════════════════════════════════════════════════════ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; tab-size: 4; overscroll-behavior: none; }
body {
  font-family: var(--font-sans);
  color: var(--text-primary);
  line-height: normal;
  background: var(--canvas);
  min-height: 100vh;
  overflow-x: clip;
}
img, svg { display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea {
  font-family: inherit; font-size: inherit;
  line-height: inherit; color: inherit;
}
button { cursor: pointer; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
[x-cloak] { display: none !important; }


/* ═══════════════════════════════════════════════════════════════════
   3. PAGE SHELL
   ═══════════════════════════════════════════════════════════════════ */

.page {
  max-width: var(--max-width-shell);
  margin: 0 auto;
  min-height: 100vh;
  background: var(--surface);
  box-shadow: var(--shadow-shell);
  display: flex;
  flex-direction: column;
}


/* ═══════════════════════════════════════════════════════════════════
   4. HEADER — SHARED
   Logo, nav, hamburger, mint line. Used by both header variants.
   ═══════════════════════════════════════════════════════════════════ */

.logo {
  display: flex; align-items: center; gap: 10px; text-decoration: none;
}
.logo-mark { width: 26px; height: 26px; flex-shrink: 0; }
.logo-text {
  font-size: 16px; font-weight: 500; color: #FFF;
  letter-spacing: -0.01em;
}
.logo-text span { color: var(--mint); }

.nav { display: flex; align-items: center; gap: 24px; }
.nav-link {
  font-size: 13.5px; color: rgba(255,255,255,0.45); text-decoration: none;
  cursor: pointer; transition: color var(--transition-med); font-weight: 400;
}
.nav-link:hover { color: rgba(255,255,255,0.85); }
.nav-link.active { color: rgba(255,255,255,0.9); }

.nav-account {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 500; color: rgba(255,255,255,0.7);
  cursor: pointer; transition: background var(--transition-med);
  text-decoration: none; border: none;
}
.nav-account:hover { background: rgba(255,255,255,0.2); }

.hamburger {
  display: none; flex-direction: column; gap: 3.5px;
  cursor: pointer; padding: 6px; background: none; border: none;
}
.hamburger span {
  display: block; width: 18px; height: 1.8px;
  background: #FFF; opacity: 0.45; border-radius: 1px;
}

.mint-line {
  height: 3px;
  background: linear-gradient(90deg, var(--mint) 0%, rgba(143,252,211,0) 40%);
  flex-shrink: 0;
}


/* ── 4a. STATIC TOPO HEADER ──────────────────────────────────────── */
/* Used on all signed-in pages except dashboard, and all signed-out pages.
   Matches the dashboard header's collapsed state exactly (56px). */

.header-topo {
  position: relative; overflow: hidden; background: var(--brand-dark);
  flex-shrink: 0; height: 56px;
}
.header-topo .header-topo-svg {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  opacity: 0.06; pointer-events: none;
}
.header-topo .header-inner {
  position: relative; z-index: 1;
  max-width: var(--max-width-content); margin: 0 auto;
  padding: 0 32px; height: 100%;
  display: flex; align-items: center; justify-content: space-between;
}


/* ── 4b. DASHBOARD COLLAPSING PHOTO HEADER ───────────────────────── */
/* Collapses from 160px → 56px on scroll. JS handles the animation. */

.header-dashboard {
  position: fixed; top: 0; z-index: 100;
  overflow: hidden;
  background: var(--brand-dark); flex-shrink: 0;
  height: 160px;
  width: 100%; max-width: var(--max-width-shell);
}
.header-dashboard-spacer {
  height: 160px; flex-shrink: 0;
}
.header-dashboard .header-photo {
  position: absolute; top: 0; left: 0; right: 0; height: 160px;
  min-width: 375px; overflow: hidden;
}
.header-dashboard .header-photo img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center 45%;
}
.header-dashboard .header-overlay {
  position: absolute; top: 0; left: 0; right: 0; height: 300px;
  min-width: 375px;
  background: linear-gradient(180deg,
    rgba(30,33,37,0.50) 0%,
    rgba(30,33,37,0.20) 40%,
    rgba(30,33,37,0.55) 100%);
}
.header-dashboard .header-menu-darken {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(30, 33, 37, 0.45);
  opacity: 0; transition: opacity 0.15s ease-out;
  pointer-events: none;
}
.header-dashboard .header-topo-svg {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  opacity: 0; pointer-events: none;
}
/* Padded (default) — nav constrained to content width */
.header-dashboard .header-inner {
  position: relative; z-index: 2;
  max-width: var(--max-width-content); margin: 0 auto;
  padding: 0 32px; height: 100%;
  display: flex; flex-direction: column;
}
/* Fullwidth variant — nav spans full shell width */
.header-dashboard.header-fullwidth .header-inner {
  max-width: none;
}
.header-dashboard .header-top {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; flex-shrink: 0;
}
.greeting {
  font-size: 18px; color: rgba(255,255,255,0.85);
  margin-top: auto; padding-bottom: 20px;
}
.greeting strong { font-weight: 500; color: #FFF; }

/* Content wrap — no special properties needed with fixed header */


/* ── 4c. SIGNED-OUT HEADER RIGHT ─────────────────────────────────── */

.header-right { display: flex; align-items: center; gap: 18px; }
.header-right a {
  font-size: 13.5px; color: rgba(255,255,255,0.55);
  text-decoration: none; transition: color var(--transition-med);
}
.header-right a:hover { color: rgba(255,255,255,0.9); }


/* ── 4d. ACCOUNT DROPDOWN ────────────────────────────────────────── */

/* Dropdown panel is position:fixed via Alpine :style binding,
   rendered outside .page to escape all stacking/overflow contexts. */
.dropdown-panel {
  width: 200px; z-index: 9000;
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: 10px; box-shadow: var(--shadow-dropdown);
  overflow: hidden;
}
.dropdown-panel::before {
  content: ''; display: block; height: 3px;
  background: linear-gradient(90deg, var(--mint) 0%, var(--mint-mid) 100%);
}
.dropdown-identity {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--divider);
}
.dropdown-name { font-size: 13.5px; font-weight: 500; color: var(--text-primary); }
.dropdown-email { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; text-decoration: none;
  font-size: 13px; color: var(--text-primary);
  transition: background var(--transition-fast);
}
.dropdown-item:hover { background: #FAFBFA; }
.dropdown-item.muted { color: var(--text-secondary); }
.dropdown-item svg { width: 16px; height: 16px; color: var(--text-secondary); flex-shrink: 0; }
.dropdown-divider { height: 1px; background: var(--divider); }
.dropdown-section-label {
  padding: 10px 16px 4px; font-size: 11px; font-weight: 500;
  color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.03em;
}


/* ── 4e. MOBILE HAMBURGER MENU ───────────────────────────────────── */

/* Mobile menu — fixed below header, rendered outside .page */
.mobile-menu-backdrop {
  position: fixed; inset: 0; z-index: 7999;
  background: transparent;
}
.mobile-menu {
  position: fixed; top: 56px; left: 0; right: 0; z-index: 8000;
  background: var(--card); border-bottom: 1px solid var(--card-border);
  box-shadow: var(--shadow-modal);
}
.mobile-menu::before {
  content: ''; display: block; height: 3px;
  background: linear-gradient(90deg, var(--mint) 0%, var(--mint-mid) 100%);
  margin-bottom: 3px;
}
.mobile-menu-link {
  display: block; padding: 13px 20px;
  font-size: 14px; font-weight: 450; color: var(--text-primary);
  text-decoration: none; transition: background var(--transition-fast);
}
.mobile-menu-link:hover { background: #FAFBFA; }
.mobile-menu-link.active { color: var(--mint-mid); }
.mobile-menu-identity {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px 8px;
}
.mobile-menu-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--divider);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 500; color: var(--label); flex-shrink: 0;
}
.mobile-menu-name { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.mobile-menu-email { font-size: 12px; color: var(--text-secondary); }
.mobile-menu-divider { height: 1px; background: var(--divider); margin: 4px 0; }

/* Mobile menu transition */
.mobile-menu-enter { transition: opacity 0.15s ease-out; }
.mobile-menu-enter-start { opacity: 0; }
.mobile-menu-enter-end { opacity: 1; }
.mobile-menu-leave { transition: opacity 0.12s ease-in; }
.mobile-menu-leave-start { opacity: 1; }
.mobile-menu-leave-end { opacity: 0; }


/* ═══════════════════════════════════════════════════════════════════
   5. BODY CONTENT AREA
   ═══════════════════════════════════════════════════════════════════ */

.body {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 32px 48px;
}
.section + .section { margin-top: 20px; }
.section-label {
  font-size: 13px; font-weight: 500; color: var(--label);
  margin-bottom: 9px; letter-spacing: 0.01em;
}


/* ═══════════════════════════════════════════════════════════════════
   6. FOOTER
   ═══════════════════════════════════════════════════════════════════ */

.footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 32px 32px;
  display: flex; flex-direction: column;
  align-items: center; gap: 6px;
}
.footer-feedback {
  font-size: 12px; color: var(--text-secondary);
  text-decoration: none; transition: color var(--transition-fast);
}
.footer-feedback:hover { color: var(--label); }
.footer-legal { display: flex; align-items: center; gap: 6px; }
.footer-link {
  font-size: 11.5px; color: #B0B4AF;
  text-decoration: none; transition: color var(--transition-fast);
}
.footer-link:hover { color: var(--text-secondary); }
.footer-link.current { color: var(--text-secondary); }
.footer-sep { font-size: 16px; color: #C0C4BF; line-height: 1; }
.footer-attribution { font-size: 10.5px; color: #C0C4BF; margin-top: 2px; }
.footer-attribution a {
  color: #C0C4BF; text-decoration: none; transition: color var(--transition-fast);
}
.footer-attribution a:hover { color: var(--text-secondary); }


/* ═══════════════════════════════════════════════════════════════════
   7. DASHBOARD COMPONENTS
   ═══════════════════════════════════════════════════════════════════ */

/* Top grid — number + devices side by side */
.grid-top {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 16px; align-items: start;
}

/* Card base */
.card {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius-card); overflow: hidden;
}

/* Service number card */
.number-card {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius-card); overflow: hidden;
  display: flex; flex-direction: column;
}
.number-stripe {
  height: 3px;
  background: linear-gradient(90deg, var(--mint) 0%, var(--mint-mid) 100%);
}
.number-inner { padding: 18px 20px 16px; flex: 1; cursor: pointer; }
.number-inner:active .copy-icon-btn { background: #EEF9F3; }
.number-sublabel {
  font-size: 12.5px; color: var(--text-secondary);
  font-weight: 400; margin-bottom: 6px;
  transition: color var(--transition-med);
}
.number-row {
  display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
}
.number-value {
  font-size: 24px; font-weight: 500; color: var(--text-primary);
  letter-spacing: 0.02em; white-space: nowrap;
}
.copy-icon-btn {
  width: 32px; height: 32px; border-radius: 7px;
  border: 1px solid var(--link-border); background: var(--link-bg);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background var(--transition-med); flex-shrink: 0;
}
.copy-icon-btn:hover { background: #EEF9F3; }
.copy-icon-btn svg { width: 15px; height: 15px; color: var(--link); }

/* Device rows */
.device-row {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 18px; cursor: pointer;
  transition: background var(--transition-fast);
}
.device-row:hover { background: #FAFBFA; }
.device-row + .device-row { border-top: 1px solid var(--divider); }
.status-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.status-dot.connected { background: var(--status-green); }
.status-dot.pending { background: var(--amber); }
.status-dot.inactive { background: var(--text-inactive); }
.device-info { flex: 1; min-width: 0; }
.device-name { font-size: 14px; color: var(--text-primary); font-weight: 450; }
.device-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.badge {
  display: inline-block; font-size: 11px; padding: 3px 9px;
  border-radius: var(--radius-badge); font-weight: 500; white-space: nowrap;
}
.badge-connected { background: var(--status-green-bg); color: var(--status-green-text); }
.badge-pending { background: var(--amber-bg); color: var(--amber-text); }
.badge-inactive { background: var(--divider); color: var(--text-secondary); }
.chevron {
  color: #C0C4BF; font-size: 20px; font-weight: 300;
  margin-left: 4px; line-height: 1;
}

/* Add device row */
.add-device-row {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 18px; cursor: pointer;
  transition: background var(--transition-fast);
  border-top: 1px solid var(--divider);
}
.add-device-row:hover { background: #FAFBFA; }
.add-icon {
  width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px dashed var(--link-border);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.add-icon svg { width: 10px; height: 10px; color: var(--link); }
.add-label { font-size: 13px; color: var(--link); font-weight: 450; }

/* Quick-access cards */
.grid-quick {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px;
}
.quick-card {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius-card); padding: 16px;
  cursor: pointer; transition: border-color var(--transition-fast);
  text-decoration: none; display: block;
}
.quick-card:hover { border-color: #B8BCB7; }
.quick-icon { width: 20px; height: 20px; margin-bottom: 15px; color: var(--label); }
.quick-title { font-size: 13.5px; color: var(--text-primary); font-weight: 450; }
.quick-desc {
  font-size: 11.5px; color: var(--text-secondary);
  margin-top: 3px; font-weight: 400; line-height: 1.4;
}

/* Subscription row */
.plan-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius-card); padding: 15px 18px;
}
.plan-name { font-size: 14px; color: var(--text-primary); font-weight: 450; }
.plan-detail { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.plan-link {
  font-size: 13px; color: var(--link); font-weight: 500;
  text-decoration: none; transition: color var(--transition-fast);
}
.plan-link:hover { color: var(--link-hover); }

/* Empty state */
.empty-card {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius-card); overflow: hidden;
  display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: 20px; padding: 32px 32px 28px;
}
.empty-illustration {
  width: 220px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.empty-illustration img { width: 100%; height: auto; }
.empty-text { max-width: 400px; }
.empty-title { font-size: 17px; color: var(--text-primary); font-weight: 500; }
.empty-desc {
  font-size: 13.5px; color: var(--text-secondary);
  margin-top: 6px; line-height: 1.5;
}
.empty-actions {
  margin-top: 16px; display: flex; flex-direction: column;
  align-items: center; gap: 14px;
}
.empty-btn {
  font-size: 13.5px; color: #FFF; font-weight: 500;
  background: var(--brand-dark); padding: 10px 24px;
  border-radius: var(--radius-btn); cursor: pointer;
  transition: opacity var(--transition-fast); border: none;
  font-family: inherit;
  will-change: opacity;
}
.empty-btn:hover { opacity: 0.88; }
.empty-link {
  font-size: 12.5px; color: var(--link); font-weight: 450;
  text-decoration: none; transition: color var(--transition-fast);
}
.empty-link:hover { color: var(--link-hover); }

/* Email verification banner */
.amber-banner {
  display: flex; align-items: center; gap: 12px;
  background: var(--amber-bg); border: 1px solid var(--amber-border);
  border-radius: 10px; padding: 12px 16px; margin-bottom: 20px;
}
.amber-banner svg { width: 18px; height: 18px; color: var(--amber-text); flex-shrink: 0; }
.amber-banner p { flex: 1; font-size: 13px; color: var(--label); line-height: 1.45; }
.amber-banner a { color: var(--link); font-weight: 450; text-decoration: none; }
.amber-banner a:hover { text-decoration: underline; }
.amber-banner-close {
  width: 24px; height: 24px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; background: none; border: none;
  color: var(--text-secondary); cursor: pointer;
  transition: background var(--transition-fast);
}
.amber-banner-close:hover { background: rgba(0,0,0,0.06); }
.amber-banner-close svg { width: 14px; height: 14px; }


/* ═══════════════════════════════════════════════════════════════════
   8. MODAL COMPONENTS
   ═══════════════════════════════════════════════════════════════════ */

/* Backdrop + scaffold */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(30,33,37,0.45); z-index: 200;
}
/* Lock background scroll when modal is open */
body.modal-open { overflow: hidden; }
.modal-wrapper {
  position: fixed; inset: 0; z-index: 210;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-card {
  background: var(--card); border-radius: var(--radius-modal);
  width: 100%; max-width: 400px;
  max-height: calc(100vh - 48px);
  box-shadow: var(--shadow-modal); overflow: hidden;
  display: flex; flex-direction: column;
}
#bcf-modal-content {
  display: contents;
}
/* The x-data wrapper div inside modal content needs to pass flex layout
   through to .modal-body (scrollable) and .modal-footer (pinned).
   Hidden inputs and csrf tokens inside don't affect flex layout. */
#bcf-modal-content > [x-data] {
  display: flex; flex-direction: column;
  min-height: 0; flex: 1;
}
#bcf-modal-content > form {
  display: flex; flex-direction: column;
  min-height: 0; flex: 1;
}

/* Step dots */
.step-dots {
  display: flex; align-items: center; gap: 6px;
  justify-content: center; padding: 16px 24px 0;
  flex-shrink: 0;
}
.step-dot { width: 6px; height: 6px; border-radius: 50%; background: #E2E5E2; }
.step-dot.active, .step-dot.done { background: var(--status-green); }

/* Header row */
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 0;
  flex-shrink: 0;
}
.modal-title { font-size: 17px; font-weight: 500; color: var(--text-primary); }
.modal-back {
  font-size: 13px; color: var(--text-secondary); cursor: pointer;
  text-decoration: none; display: flex; align-items: center; gap: 4px;
  transition: color var(--transition-fast);
}
.modal-back:hover { color: var(--label); }
.modal-back svg { width: 14px; height: 14px; }
.modal-close {
  width: 28px; height: 28px; border-radius: 6px; border: none;
  background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); transition: background var(--transition-fast);
}
.modal-close:hover { background: var(--divider); }
.modal-close svg { width: 16px; height: 16px; }

/* Body & footer */
.modal-body {
  padding: 16px 24px 24px; overflow-y: auto; flex: 1; min-height: 0;
  overscroll-behavior: contain;
}
/* Fade gradient at bottom of scrollable body — indicates more content below.
   Applied via .has-overflow class (set by JS when content overflows).
   Removed when scrolled to bottom or when content fits without scrolling. */
.modal-body.has-overflow {
  mask-image: linear-gradient(to bottom, #000 calc(100% - 48px), transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 48px), transparent 100%);
}
.modal-footer { padding: 0 24px 20px; flex-shrink: 0; }
.modal-desc {
  font-size: 13.5px; color: var(--text-secondary); line-height: 1.5;
  margin-bottom: 20px;
}

/* Drawer variant — wider modal for device detail views.
   Applied via .modal-card.drawer on the card element.
   Desktop: wider + scale animation. Mobile: bottom sheet + handle bar + swipe. */
.modal-card.drawer { max-width: 420px; }

/* Handle bar — hidden on desktop, visible on mobile drawer */
.drawer-handle { display: none; }
.drawer-handle-bar {
  width: 36px; height: 4px; border-radius: 2px; background: #D0D4CF;
}

/* Drawer header — title + subtitle + close */
.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 0; flex-shrink: 0;
}
.drawer-title { font-size: 17px; font-weight: 500; color: var(--text-primary); }
.drawer-subtitle { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }

/* Drawer status row */
.drawer-status {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 24px 0; flex-shrink: 0;
}

/* Drawer body — uses .modal-body for scroll behavior */

/* Device detail sections */
.detail-section { margin-top: 20px; }
.detail-section:first-child { margin-top: 0; }
.detail-section-label {
  font-size: 11.5px; font-weight: 500; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px;
}
.detail-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 0; border-bottom: 1px solid var(--divider);
}
.detail-row:last-child { border-bottom: none; }
.detail-label { font-size: 13px; color: var(--text-secondary); }
.detail-value { font-size: 13.5px; color: var(--text-primary); font-weight: 450; text-align: right; }
.detail-value-editable {
  font-size: 13.5px; color: var(--text-primary); font-weight: 450;
  display: flex; align-items: center; gap: 6px; cursor: pointer;
  transition: color var(--transition-fast);
}
.detail-value-editable:hover { color: var(--link); }
.detail-value-editable svg { width: 13px; height: 13px; color: var(--text-secondary); }
.detail-value-editable:hover svg { color: var(--link); }
.detail-value-add {
  font-size: 13px; color: var(--link); font-weight: 450;
  cursor: pointer; text-decoration: none;
}
.detail-value-add:hover { color: var(--link-hover); }

/* Inline edit — small input with pill save/cancel buttons */
.inline-edit-group {
  display: flex; align-items: center; gap: 6px;
}
.inline-edit-input {
  font-size: 13px; font-family: inherit; color: var(--text-primary);
  padding: 5px 10px; border: 1px solid var(--card-border); border-radius: 6px;
  outline: none; width: 140px; transition: border-color var(--transition-fast);
}
textarea.inline-edit-input {
  line-height: 1.4; overflow: hidden;
}
select.inline-edit-input {
  appearance: auto; cursor: pointer;
}
.inline-edit-input:focus { border-color: var(--status-green); }
.inline-edit-input::placeholder { color: var(--placeholder); }
.inline-edit-save, .inline-edit-cancel {
  width: 26px; height: 26px; border-radius: 6px; border: none;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background var(--transition-fast);
  font-family: inherit; padding: 0;
}
.inline-edit-save {
  background: var(--status-green-bg); color: var(--status-green);
}
.inline-edit-save:hover { background: #C8EDD9; }
.inline-edit-save svg { width: 12px; height: 12px; }
.inline-edit-cancel {
  background: var(--divider); color: var(--text-secondary);
}
.inline-edit-cancel:hover { background: #E2E5E2; }
.inline-edit-cancel svg { width: 12px; height: 12px; }

/* Status checkmark (alternative to dot) */
.status-check {
  width: 16px; height: 16px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--status-green);
}
.status-check svg { width: 14px; height: 14px; }

/* Last forecast preview */
.message-preview {
  background: var(--surface); border-radius: var(--radius-input);
  padding: 12px 14px; margin-top: 8px;
}
.message-preview.scrollable {
  max-height: 200px; overflow-y: auto;
}
.message-preview.scrollable.has-overflow {
  mask-image: linear-gradient(to bottom, #000 calc(100% - 48px), transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 48px), transparent 100%);
}
.message-label { font-size: 11px; color: var(--text-secondary); font-weight: 500; margin-bottom: 4px; }
.message-text { font-size: 12.5px; color: var(--text-primary); line-height: 1.5; }
.message-text p { margin: 0; }
.message-text p + p { margin-top: 0.6em; }
.message-time { font-size: 11px; color: #B0B4AF; margin-top: 8px; }
.no-activity {
  text-align: center; padding: 16px 0 8px;
  font-size: 13px; color: #B0B4AF; font-style: italic;
}

/* Signature display */
.signature-value {
  background: var(--surface); border-radius: var(--radius-input);
  padding: 10px 14px; margin-top: 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.signature-text { font-size: 13px; color: var(--text-primary); font-style: italic; }
.signature-edit { cursor: pointer; flex-shrink: 0; color: var(--text-secondary); transition: color var(--transition-fast); }
.signature-edit:hover { color: var(--link); }
.signature-edit svg { width: 13px; height: 13px; }

/* Backup OTP display */
.backup-otp {
  background: var(--surface); border: 1px solid var(--card-border);
  border-radius: var(--radius-input); padding: 12px 14px; margin-top: 8px;
  cursor: pointer;
}
.backup-otp-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.backup-otp-code {
  font-size: 16px; font-weight: 500; color: var(--text-primary); letter-spacing: 0.08em;
}
.copy-icon-sm {
  width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--link-border);
  background: var(--card); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition-fast); flex-shrink: 0;
}
.copy-icon-sm:hover { background: #EEF9F3; }
.copy-icon-sm svg { width: 12px; height: 12px; color: var(--link); }
.backup-security {
  font-size: 11.5px; color: var(--text-secondary);
  margin-top: 8px; line-height: 1.4; font-style: italic;
}
.backup-sent-note {
  font-size: 11.5px; color: var(--text-secondary);
  margin-top: 6px; line-height: 1.4;
}

/* Expandable toggle (e.g. "Why do I need this?") */
.expand-toggle {
  font-size: 12px; color: var(--link); cursor: pointer; text-decoration: none;
  font-weight: 450; display: inline-block; margin-top: 8px;
}
.expand-toggle:hover { color: var(--link-hover); }
.expand-content {
  font-size: 12px; color: var(--text-secondary);
  line-height: 1.5; margin-top: 6px;
}

/* Field note — explanatory text below a field */
.field-note {
  font-size: 11.5px; color: var(--text-secondary);
  line-height: 1.5; margin-top: 6px;
}

/* Danger / disconnect section */
.danger-section {
  margin-top: 24px; padding-top: 20px;
  border-top: 1px solid var(--divider);
}
.btn-danger {
  width: 100%; font-size: 13px; color: var(--disconnect-text); font-weight: 500;
  background: var(--disconnect-bg); padding: 10px 24px;
  border-radius: var(--radius-btn); cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  border: 1px solid var(--disconnect-border); font-family: inherit;
}
.btn-danger:hover {
  background: var(--disconnect-hover-bg);
  border-color: var(--disconnect-hover-border);
}

/* Form fields */
.field-label-row {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 6px;
}
.field-label {
  font-size: 12.5px; font-weight: 500; color: var(--label);
  display: block; margin-bottom: 6px;
}
.field-label-row .field-label { margin-bottom: 0; }

.field-input {
  width: 100%; font-size: 15px; font-family: inherit; color: var(--text-primary);
  padding: 10px 14px; border: 1px solid var(--card-border);
  border-radius: var(--radius-input); outline: none;
  transition: border-color var(--transition-fast);
}
.field-input:focus { border-color: var(--status-green); }
.field-input::placeholder { color: var(--placeholder); }
.field-input.error { border-color: var(--error); }

.field-message { font-size: 12px; margin-top: 8px; line-height: 1.5; }
.field-message.error { color: var(--error-text); }
.field-message.info { color: var(--label); }
.field-message a { color: var(--link); text-decoration: none; font-weight: 450; }
.field-message a:hover { text-decoration: underline; }
.field-hint { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }

/* Phone input group */
.phone-input-group {
  display: flex; border: 1px solid var(--card-border);
  border-radius: var(--radius-input); overflow: hidden;
  transition: border-color var(--transition-fast);
}
.phone-input-group:focus-within { border-color: var(--status-green); }
.phone-input-group.error { border-color: var(--error); }
.phone-prefix {
  font-size: 14px; color: var(--label); font-weight: 450;
  padding: 10px; background: #FAFBFA; flex-shrink: 0;
  display: flex; align-items: center; user-select: none;
  border-right: 1px solid var(--card-border); gap: 5px;
  cursor: pointer; transition: background var(--transition-fast);
}
.phone-prefix:hover { background: var(--divider); }
.phone-number-input {
  font-size: 14px; color: var(--text-primary);
  padding: 10px 14px 10px 12px; border: none; outline: none;
  flex: 1; min-width: 0; background: transparent;
}
.phone-number-input::placeholder { color: var(--placeholder); }
.prefix-info-icon {
  width: 13px; height: 13px; color: #B0B4AF;
  transition: color var(--transition-fast); flex-shrink: 0;
}
.phone-prefix:hover .prefix-info-icon { color: var(--text-secondary); }
.phone-info-popover {
  font-size: 12.5px; color: var(--label); line-height: 1.55;
  padding: 11px 14px; margin-top: 8px;
  background: var(--surface); border-radius: var(--radius-input);
}
.phone-info-popover a { color: var(--link); text-decoration: none; font-weight: 450; }
.phone-info-popover a:hover { text-decoration: underline; }

/* Consent checkboxes */
.consent-group { margin-top: 18px; }
.consent-row { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.consent-row + .consent-row { margin-top: 12px; }
.consent-checkbox {
  width: 16px; height: 16px; border-radius: 4px;
  border: 1.5px solid var(--text-inactive); flex-shrink: 0; margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.consent-row.checked .consent-checkbox {
  border-color: var(--status-green); background: var(--status-green);
}
.consent-checkbox svg { width: 10px; height: 10px; color: #FFF; display: none; }
.consent-row.checked .consent-checkbox svg { display: block; }
.consent-label { font-size: 12.5px; color: var(--label); line-height: 1.5; }
.consent-label a { color: var(--link); text-decoration: none; }
.consent-label a:hover { text-decoration: underline; }
.consent-error { font-size: 12px; color: var(--error-text); margin-top: 10px; }

/* Resend link */
.resend-link {
  font-size: 12px; color: var(--link); cursor: pointer; text-decoration: none;
  font-weight: 450; transition: color var(--transition-fast); white-space: nowrap;
}
.resend-link:hover { color: var(--link-hover); }
.resend-link.disabled { color: #B0B4AF; cursor: default; pointer-events: none; }

/* Buttons */
.btn-primary {
  width: 100%; font-size: 13.5px; color: #FFF; font-weight: 500;
  background: var(--brand-dark); padding: 11px 24px;
  border-radius: var(--radius-btn); cursor: pointer;
  transition: opacity var(--transition-fast);
  border: none; font-family: inherit;
  position: relative;
}
.btn-primary:hover { opacity: 0.88; }
.btn-primary:disabled { opacity: 0.4; cursor: default; }

/* HTMX loading state — spinner replaces text while request is in flight */
.btn-primary.htmx-request { color: transparent; pointer-events: none; }
.btn-primary.htmx-request::after {
  content: ''; position: absolute;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #FFF;
  border-radius: 50%;
  animation: bcf-spin 0.6s linear infinite;
}
@keyframes bcf-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.btn-cancel {
  flex: 1; font-size: 13.5px; color: var(--label); font-weight: 500;
  background: var(--card); padding: 11px 24px;
  border-radius: var(--radius-btn); cursor: pointer;
  transition: background var(--transition-fast);
  border: 1px solid var(--card-border); font-family: inherit;
}
.btn-cancel:hover { background: #FAFBFA; }

.btn-disconnect {
  flex: 1; font-size: 13.5px; color: var(--disconnect-text); font-weight: 500;
  background: var(--disconnect-bg); padding: 11px 24px;
  border-radius: var(--radius-btn); cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  border: 1px solid var(--disconnect-border); font-family: inherit;
}
.btn-disconnect:hover {
  background: var(--disconnect-hover-bg);
  border-color: var(--disconnect-hover-border);
}

.btn-skip {
  display: block; width: 100%; text-align: center;
  font-size: 13px; color: var(--text-secondary); cursor: pointer;
  background: none; border: none; font-family: inherit;
  margin-top: 10px; padding: 8px;
  transition: color var(--transition-fast);
}
.btn-skip:hover { color: var(--label); }

.help-link {
  display: block; text-align: center; font-size: 12.5px;
  color: var(--text-secondary); text-decoration: none;
  margin-top: 12px; transition: color var(--transition-fast);
}
.help-link:hover { color: var(--label); }

/* Device type option cards */
.device-option {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border: 1px solid var(--card-border); border-radius: 10px;
  cursor: pointer; transition: border-color var(--transition-fast), background var(--transition-fast);
}
.device-option:hover { border-color: #B8BCB7; background: #FAFBFA; }
.device-option.selected { border-color: var(--status-green); background: var(--link-bg); }
.device-option + .device-option { margin-top: 10px; }
.device-option-icon {
  width: 36px; height: 36px; border-radius: 8px; background: var(--divider);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: background var(--transition-fast);
}
.device-option.selected .device-option-icon { background: var(--status-green-bg); }
.device-option-icon svg { width: 18px; height: 18px; color: var(--label); transition: color var(--transition-fast); }
.device-option.selected .device-option-icon svg { color: var(--status-green); }
.device-option-name { font-size: 14px; font-weight: 500; color: var(--text-primary); flex: 1; }
.device-option-radio {
  width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--text-inactive);
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  transition: border-color var(--transition-fast);
}
.device-option.selected .device-option-radio { border-color: var(--status-green); }
.device-option-radio-dot {
  width: 8px; height: 8px; border-radius: 50%; background: transparent;
  transition: background var(--transition-fast);
}
.device-option.selected .device-option-radio-dot { background: var(--status-green); }

/* Copyable chip */
.copyable {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--card-border);
  border-radius: 7px; padding: 10px 14px; margin-top: 8px;
  cursor: pointer; transition: border-color var(--transition-fast);
}
.copyable:hover { border-color: var(--link-border); }
.copyable:active { background: #EEF9F3; }
.copyable-value { font-size: 15px; font-weight: 500; color: var(--text-primary); letter-spacing: 0.02em; }
.copyable-value.code { letter-spacing: 0.12em; }
.copyable-icon { width: 14px; height: 14px; color: var(--link); flex-shrink: 0; }

/* Reassurance box */
.reassurance {
  background: var(--status-green-bg); border-radius: var(--radius-input);
  padding: 12px 14px; font-size: 13.5px; color: var(--status-green-text);
  line-height: 1.5;
}
.reassurance strong { font-weight: 550; }

/* Why toggle */
.why-toggle {
  font-size: 12.5px; color: var(--link); cursor: pointer; text-decoration: none;
  font-weight: 450; display: inline-block; margin-top: 14px;
  transition: color var(--transition-fast);
}
.why-toggle:hover { color: var(--link-hover); }
.why-content { font-size: 12.5px; color: var(--text-secondary); line-height: 1.55; margin-top: 8px; }

/* Tip row */
.tip-row {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 11px 14px; background: var(--surface);
  border-radius: var(--radius-input);
}
.tip-row svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--text-secondary); margin-top: 1px; }
.tip-row .tip-text { font-size: 12.5px; color: var(--label); line-height: 1.5; }
.tip-row .tip-text strong { font-weight: 500; color: var(--text-primary); }

.code-note {
  font-size: 11.5px; color: var(--text-secondary);
  margin-top: 8px; line-height: 1.4; font-style: italic; text-align: center;
}

.success-icon {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--status-green-bg);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.success-icon svg {
  width: 24px; height: 24px; stroke: var(--status-green); fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.success-icon.pending { background: var(--divider); }
.success-icon.pending svg { stroke: var(--text-secondary); }

/* Field select (styled <select>) */
.field-select {
  width: 100%; font-size: 14px; font-family: inherit; color: var(--text-primary);
  padding: 10px 14px; border: 1px solid var(--card-border); border-radius: var(--radius-input);
  outline: none; background: var(--card); appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238A8F88' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px;
  transition: border-color var(--transition-fast);
}
.field-select:focus { border-color: var(--status-green); }

/* Other-device text input (revealed when "Other / not sure" selected) */
.other-input { margin-top: 8px; display: none; }
.other-input.visible { display: block; }

/* Country selector — searchable autocomplete */
.country-section { margin-top: 14px; }
.country-input-wrapper { position: relative; }
.country-search { padding-right: 32px !important; cursor: pointer; }
.country-input-chevron {
  width: 12px; height: 12px; color: var(--text-secondary);
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  pointer-events: none;
}
.country-dropdown {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius-input);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1); max-height: 200px; overflow-y: auto;
  z-index: 20;
}
.country-dropdown.open { display: block; }
.country-dropdown-divider { height: 1px; background: var(--divider); margin: 4px 0; }
.country-option {
  padding: 9px 14px; font-size: 13.5px; color: var(--text-primary); cursor: pointer;
  transition: background 0.08s; display: flex; align-items: center; gap: 8px;
}
.country-option:hover { background: #FAFBFA; }
.country-option-flag { font-size: 15px; line-height: 1; flex-shrink: 0; width: 22px; text-align: center; }
.country-option-name { flex: 1; }
.country-option-featured { font-weight: 450; }
.country-no-results { padding: 12px 14px; font-size: 13px; color: var(--text-secondary); text-align: center; }
.country-other-note {
  font-size: 12.5px; color: var(--label); line-height: 1.5;
  margin-top: 10px; padding: 11px 14px;
  background: var(--surface); border-radius: var(--radius-input);
}
.country-other-note a { color: var(--link); text-decoration: none; font-weight: 450; }
.country-other-note a:hover { text-decoration: underline; }

/* Step list (numbered steps with green circles — satellite step 2) */
.step-list { list-style: none; counter-reset: step; margin-bottom: 20px; }
.step-item {
  counter-increment: step; padding-left: 36px; position: relative;
  font-size: 13.5px; color: var(--label); line-height: 1.5;
}
.step-item + .step-item { margin-top: 16px; }
.step-item::before {
  content: counter(step); width: 24px; height: 24px; border-radius: 50%;
  background: var(--status-green-bg); color: var(--status-green-text);
  font-size: 12px; font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  position: absolute; left: 0; top: 0;
}

/* Copyable block (full-width, used for connection code) */
.copyable-block {
  display: block; background: var(--surface); border: 1px solid var(--card-border);
  border-radius: var(--radius-input); padding: 12px 16px 10px; margin-top: 8px;
  cursor: pointer; transition: border-color var(--transition-fast); text-align: center;
}
.copyable-block:hover { border-color: var(--link-border); }
.copyable-block:active { background: #EEF9F3; }

/* Device guidance box (grey, split layout variant) */
.device-guidance {
  margin-bottom: 20px; background: var(--surface); border-radius: var(--radius-input);
  padding: 11px 14px; font-size: 12.5px; color: var(--label); line-height: 1.5;
}

/* Framing paragraph (satellite step 2 intro) */
.framing { font-size: 13.5px; color: var(--label); line-height: 1.55; margin-bottom: 20px; }
.framing strong { font-weight: 550; color: var(--text-primary); }

/* Reassurance — multi-paragraph support */
.reassurance p { margin: 0; }
.reassurance p + p { margin-top: 8px; }

/* Optional section divider (step 3 nickname area) */
.optional-section { border-top: 1px solid var(--divider); padding-top: 20px; }
.optional-header { font-size: 13.5px; font-weight: 500; color: var(--text-primary); margin-bottom: 4px; }


/* ═══════════════════════════════════════════════════════════════════
   9. AUTH PAGE COMPONENTS
   ═══════════════════════════════════════════════════════════════════ */

/* Auth page layout — centered card */
.auth-wrap {
  display: flex; justify-content: center; align-items: flex-start;
  padding: 40px 28px 32px;
}
.auth-card {
  width: 100%; max-width: 380px;
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  padding: 28px 28px 24px;
}
.auth-title {
  font-size: 19px; font-weight: 500; color: var(--text-primary);
  margin-bottom: 6px;
}
.auth-desc {
  font-size: 13.5px; color: var(--text-secondary); line-height: 1.45;
  margin-bottom: 20px;
}

/* Auth form fields — icon-in-field, placeholder as label */
.auth-field { margin-bottom: 12px; }
.auth-field-wrap {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--card-border); border-radius: var(--radius-input);
  padding: 0 14px; transition: border-color var(--transition-fast);
}
.auth-field-wrap:focus-within { border-color: var(--status-green); }
.auth-field-wrap.error {
  border-color: var(--disconnect-border); background: rgba(252,234,234,0.2);
}
.auth-field-icon {
  width: 16px; height: 16px; color: #B0B4AF; flex-shrink: 0;
  transition: color var(--transition-fast);
}
.auth-field-wrap:focus-within .auth-field-icon { color: var(--text-secondary); }
.auth-field-input {
  width: 100%; font-size: 14px; font-family: inherit; color: var(--text-primary);
  padding: 11px 0; border: none; outline: none; background: transparent;
}
.auth-field-input::placeholder { color: var(--placeholder); }
.auth-field-error {
  font-size: 12px; color: var(--disconnect-text); margin-top: 6px;
}

/* Forgot password link — sits above the password field */
.auth-field-above-row {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 6px;
}
.auth-field-label {
  display: block; font-size: 12.5px; font-weight: 500;
  color: var(--label); margin-bottom: 6px;
}
.auth-field-link {
  font-size: 12px; color: var(--link); text-decoration: none;
  transition: color var(--transition-fast);
}
.auth-field-link:hover { text-decoration: underline; }

/* Auth error banner */
.auth-error-box {
  background: var(--error-bg); border: 1px solid var(--disconnect-border);
  border-radius: var(--radius-input); padding: 12px 14px; margin-bottom: 16px;
}
.auth-error-box p {
  font-size: 13px; color: var(--disconnect-text); line-height: 1.45;
}

/* Auth submit button */
.auth-btn {
  width: 100%; font-size: 13.5px; font-weight: 500; color: #FFF;
  background: var(--brand-dark); padding: 11px 24px;
  border-radius: var(--radius-btn); border: none; cursor: pointer;
  font-family: inherit; transition: opacity var(--transition-fast);
  margin-top: 6px;
}
.auth-btn:hover { opacity: 0.88; }

/* Auth footer text (below card or below button) */
.auth-footer-text {
  text-align: center; font-size: 13px; color: var(--text-secondary);
  margin-top: 16px;
}
.auth-footer-text a {
  color: var(--link); font-weight: 450; text-decoration: none;
}
.auth-footer-text a:hover { text-decoration: underline; }

/* Auth confirmation / success states */
.auth-confirm-icon {
  width: 48px; height: 48px; border-radius: 50%; background: var(--status-green-bg);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 16px;
}
.auth-confirm-icon svg { width: 24px; height: 24px; color: var(--status-green); }
.auth-confirm-title { font-size: 17px; font-weight: 500; color: var(--text-primary); text-align: center; }
.auth-confirm-desc {
  font-size: 13.5px; color: var(--text-secondary); line-height: 1.5;
  text-align: center; margin-top: 8px;
}
.auth-confirm-email { font-weight: 500; color: var(--text-primary); }
.auth-resend-note {
  font-size: 12.5px; color: var(--text-secondary); text-align: center; margin-top: 20px;
}
.auth-resend-note a { color: var(--link); text-decoration: none; font-weight: 450; }
.auth-resend-note a:hover { text-decoration: underline; }

/* Terms acceptance — document cards */
.terms-doc-card {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; background: var(--surface);
  border: 1px solid var(--card-border); border-radius: var(--radius-input);
  text-decoration: none; transition: border-color var(--transition-fast);
}
.terms-doc-card:hover { border-color: #B8BCB7; }
.terms-doc-card > svg:first-child { width: 20px; height: 20px; color: var(--label); flex-shrink: 0; }
.terms-doc-title { font-size: 13.5px; font-weight: 450; color: var(--text-primary); }
.terms-doc-meta { font-size: 11.5px; color: var(--text-secondary); margin-top: 1px; }
.terms-doc-arrow { width: 14px; height: 14px; color: #C0C4BF; flex-shrink: 0; margin-left: auto; }

@media (max-width: 540px) {
  .auth-wrap { padding: 28px 16px 24px; }
  .auth-card { padding: 24px 20px 20px; }
}


/* ═══════════════════════════════════════════════════════════════════
   9a. FORECAST CONFIG PAGE
   ═══════════════════════════════════════════════════════════════════ */

.config-section { margin-bottom: 28px; }
.config-section-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 12px; width: 50%; min-width: 340px;
}
.quick-set { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-secondary); }
.quick-set-link {
  font-size: 12.5px; color: var(--link); text-decoration: none;
  font-weight: 450; cursor: pointer;
}
.quick-set-link:hover { color: var(--link-hover); }
.quick-set-link.active { color: var(--status-green-text); text-decoration: underline; text-underline-offset: 2px; }
.quick-set-sep { color: var(--text-inactive); }

/* Compact panel — constrained width */
.units-panel {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius-card); padding: 6px 16px;
  width: 50%; min-width: 340px;
}
.unit-row {
  display: flex; align-items: center; justify-content: flex-start;
  padding: 9px 0; gap: 12px;
}
.unit-row-left { display: flex; align-items: center; gap: 7px; flex-shrink: 0; width: 105px; }
.unit-name { font-size: 13px; color: var(--label); font-weight: 450; white-space: nowrap; }

/* Connected button groups */
.unit-btns {
  display: flex; border: 1px solid var(--card-border); border-radius: 6px;
  overflow: hidden; flex-shrink: 0; width: fit-content;
}
.unit-btn {
  font-size: 11.5px; font-weight: 500; font-family: inherit;
  padding: 5px 10px; border: none; cursor: pointer;
  transition: background var(--transition-med), color var(--transition-med);
  background: var(--card); color: var(--text-secondary); white-space: nowrap; text-align: center;
}
.unit-btn.active { background: var(--mint-mid); color: #FFF; }
.unit-btn:not(.active):hover { background: #FAFBFA; color: var(--label); }
.unit-btn + .unit-btn { border-left: 1px solid var(--card-border); }
.unit-btns-error { border-color: var(--error); transition: border-color 0.15s, background 0.15s; background: var(--error-bg); }
.unit-btns-error .unit-btn { background: var(--error-bg); }
.unit-btns-error .unit-btn:not(.active):hover { background: var(--error-bg); color: var(--text-secondary); }
.unit-btns-error .unit-btn.active { background: var(--error); }

/* Coming soon placeholder */
.future-card {
  background: var(--card); border: 1px dashed var(--text-inactive);
  border-radius: var(--radius-card); padding: 28px 20px; text-align: center;
}
.future-title { font-size: 14px; font-weight: 500; color: #B0B4AF; margin-bottom: 4px; }
.future-desc { font-size: 12.5px; color: var(--text-inactive); }

@media (max-width: 540px) {
  .config-section-header { flex-direction: column; gap: 8px; width: 100%; min-width: 0; }
  .units-panel { padding: 4px 14px; width: 100%; min-width: 0; }
  .unit-row { padding: 8px 0; }
}


/* ═══════════════════════════════════════════════════════════════════
   9b. ACCOUNT PAGE
   ═══════════════════════════════════════════════════════════════════ */

.page-title { font-size: 19px; font-weight: 500; color: var(--text-primary); margin-bottom: 24px; }

/* Account card rows — three-column: label | value | action */
.account-section { margin-bottom: 28px; }
.account-card {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius-card); overflow: hidden;
}
.account-row {
  display: flex; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid var(--divider); gap: 12px;
}
.account-row:last-child { border-bottom: none; }
.account-row-label { font-size: 13px; color: var(--text-secondary); flex-shrink: 0; width: 76px; }
.account-row-value {
  font-size: 13.5px; color: var(--text-primary); font-weight: 450; text-align: right;
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.account-row-value-group { flex: 1; min-width: 0; text-align: right; }
.account-row-value-group .account-row-value { flex: none; }
.email-pending {
  font-size: 11.5px; color: var(--amber-text); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.email-unverified { font-size: 11.5px; color: var(--text-secondary); margin-top: 2px; }
.email-unverified a { color: var(--link); text-decoration: none; font-weight: 450; }
.email-unverified a:hover { text-decoration: underline; }
.account-row-action {
  font-size: 13px; color: var(--link); font-weight: 450; cursor: pointer;
  text-decoration: none; transition: color var(--transition-fast);
  flex-shrink: 0; text-align: right; width: 54px;
}
.account-row-action:hover { color: var(--link-hover); }

/* Toggle row (email preferences) */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
}
.toggle-label-group { flex: 1; }
.toggle-label { font-size: 13.5px; color: var(--text-primary); font-weight: 450; }
.toggle-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; line-height: 1.4; }
.toggle-track {
  position: relative; width: 38px; height: 22px;
  background: var(--text-inactive); border-radius: 11px;
  cursor: pointer; transition: background 0.2s; flex-shrink: 0; margin-left: 16px;
  border: none; padding: 0;
}
.toggle-track.on { background: var(--mint-mid); }
.toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--card); transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle-track.on .toggle-thumb { transform: translateX(16px); }
.toggle-track.toggle-error { background: var(--error); transition: background 0.15s; }
.toggle-track.toggle-error .toggle-thumb { background: #FFF; }
.toggle-note {
  font-size: 11.5px; color: var(--text-secondary); padding: 8px 4px 0; line-height: 1.4;
}

/* Subscription / plan card */
.plan-card {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius-card); padding: 20px; overflow: hidden;
}
.plan-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px;
}
.plan-card .plan-name { font-size: 15px; font-weight: 500; }
.plan-badge {
  font-size: 10.5px; font-weight: 500; padding: 3px 9px;
  border-radius: var(--radius-badge);
}
.plan-badge-free { background: var(--divider); color: var(--text-secondary); }
.plan-badge-pro { background: var(--status-green-bg); color: var(--status-green-text); }
.plan-card .plan-detail {
  font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; line-height: 1.5;
}
.plan-actions { display: flex; gap: 10px; }
.btn-secondary {
  font-size: 13px; color: var(--link); font-weight: 500;
  background: var(--link-bg); padding: 9px 20px; border-radius: var(--radius-input);
  cursor: pointer; transition: background var(--transition-fast), border-color var(--transition-fast);
  border: 1px solid var(--link-border); font-family: inherit;
}
.btn-secondary:hover { background: #EEF9F3; }
.btn-primary-sm {
  font-size: 13px; color: #FFF; font-weight: 500;
  background: var(--brand-dark); padding: 9px 20px; border-radius: var(--radius-input);
  cursor: pointer; transition: opacity var(--transition-fast); border: none; font-family: inherit;
}
.btn-primary-sm:hover { opacity: 0.88; }
.plan-billing { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--divider); }
.plan-billing-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; color: var(--text-secondary);
}
.plan-billing-row + .plan-billing-row { margin-top: 6px; }
.plan-billing-value { color: var(--text-primary); font-weight: 450; }

/* Support section */
.support-card {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius-card); overflow: hidden;
}
.support-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px; cursor: pointer;
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--divider); text-decoration: none; color: inherit;
}
.support-row:last-child { border-bottom: none; }
.support-row:hover { background: #FAFBFA; }
.support-icon { width: 20px; height: 20px; color: var(--text-secondary); flex-shrink: 0; }
.support-text { flex: 1; min-width: 0; }
.support-label { font-size: 13.5px; color: var(--text-primary); font-weight: 450; }
.support-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.support-chevron { font-size: 18px; color: var(--text-inactive); flex-shrink: 0; }

/* Account deletion link */
.delete-section { text-align: center; padding: 4px 0 8px; }
.delete-link {
  font-size: 12px; color: var(--text-secondary); text-decoration: none;
  transition: color var(--transition-fast);
}
.delete-link:hover { color: var(--label); text-decoration: underline; }

/* Account verify banner (account page variant, mirrors amber-banner) */
.verify-banner {
  background: var(--amber-bg); border: 1px solid var(--amber-border); border-radius: 10px;
  padding: 12px 16px; display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px;
}
.verify-banner-icon { width: 18px; height: 18px; flex-shrink: 0; color: var(--amber-text); }
.verify-banner-text { flex: 1; font-size: 13px; color: var(--label); line-height: 1.5; }
.verify-banner-text a { color: var(--link); text-decoration: none; font-weight: 450; }
.verify-banner-text a:hover { text-decoration: underline; }
.verify-banner-dismiss {
  width: 24px; height: 24px; border-radius: 6px; border: none; background: transparent;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); transition: background var(--transition-fast); flex-shrink: 0;
}
.verify-banner-dismiss:hover { background: rgba(0,0,0,0.06); }
.verify-banner-dismiss svg { width: 14px; height: 14px; }

@media (max-width: 540px) {
  .page-title { font-size: 17px; margin-bottom: 20px; }
  .account-row { padding: 12px 16px; }
  .account-row-label { width: 64px; font-size: 12.5px; }
  .account-row-value { font-size: 13px; }
  .account-row-action { font-size: 12.5px; width: 48px; }
  .toggle-row { padding: 12px 16px; }
  .plan-card { padding: 16px; }
  .support-row { padding: 12px 16px; }
}


/* ═══════════════════════════════════════════════════════════════════
   10. LEGAL CONTENT PROSE
   ═══════════════════════════════════════════════════════════════════ */

/* Legal page header */
.legal-title { font-size: 22px; font-weight: 500; color: var(--text-primary); margin-bottom: 6px; }
.legal-date { font-size: 13px; color: var(--text-secondary); margin-bottom: 32px; }

/* Legal page content */
.legal-content h2 { font-size: 16px; font-weight: 500; color: var(--text-primary); margin-top: 32px; margin-bottom: 12px; }
.legal-content h2:first-child { margin-top: 0; }
.legal-content h3 { font-size: 14px; font-weight: 500; color: var(--text-primary); margin-top: 24px; margin-bottom: 8px; }
.legal-content p { font-size: 14px; color: var(--label); line-height: 1.7; margin-bottom: 12px; }
.legal-content ul, .legal-content ol { font-size: 14px; color: var(--label); line-height: 1.7; margin-bottom: 12px; padding-left: 24px; }
.legal-content li { margin-bottom: 6px; }
.legal-content a { color: var(--link); }
.legal-content a:hover { text-decoration: underline; }
.legal-content strong { font-weight: 500; color: var(--text-primary); }
.legal-content hr { border: none; border-top: 1px solid var(--card-border); margin: 28px 0; }


/* ═══════════════════════════════════════════════════════════════════
   10b. ERROR PAGES
   ═══════════════════════════════════════════════════════════════════ */

.error-body { padding: 60px 40px; text-align: center; }
.error-code { font-size: 64px; font-weight: 500; color: #E2E5E2; line-height: 1; margin-bottom: 12px; }
.error-title { font-size: 19px; font-weight: 500; color: var(--text-primary); margin-bottom: 8px; }
.error-desc { font-size: 14px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 28px; }
.error-btn {
  display: inline-block; font-size: 13.5px; color: #FFF; font-weight: 500;
  background: var(--brand-dark); padding: 11px 28px; border-radius: var(--radius-btn);
  cursor: pointer; text-decoration: none; transition: opacity var(--transition-fast);
  font-family: inherit;
}
.error-btn:hover { opacity: 0.88; }


/* ═══════════════════════════════════════════════════════════════════
   11. ANIMATIONS
   ═══════════════════════════════════════════════════════════════════ */

@keyframes bcf-fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* Entrance animation — elements start invisible, JS adds .animate-in after first paint.
   This guarantees the browser renders the transparent state before animating.
   Stagger delay is set per-element via inline style in the JS loop. */
.bcf-entrance {
  opacity: 0; transform: translateY(8px);
}
.bcf-entrance.animate-in {
  animation: bcf-fade-up 0.35s ease-out forwards;
}

@keyframes bcf-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}
.bcf-pulse { animation: bcf-pulse 2s ease-in-out infinite; }


/* ═══════════════════════════════════════════════════════════════════
   12. RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 700px) {
  .grid-top { grid-template-columns: 1fr; }
  .body { padding: 28px 32px 48px; }
  .footer { padding: 0 32px 32px; }
}

/* Nav → hamburger switch — separate from full mobile breakpoint */
@media (max-width: 620px) {
  .nav { display: none; }
  .nav-account { display: none; }
  .hamburger { display: flex; }
}

@media (max-width: 540px) {
  .page { box-shadow: none; }

  /* Header */
  .header-topo .header-inner { padding: 0 16px; }
  .header-dashboard .header-inner { padding: 0 16px; }
  .logo-mark { width: 22px; height: 22px; }
  .logo-text { font-size: 15px; }
  .greeting { font-size: 16px; }

  /* Body */
  .body { padding: 24px 16px 32px; }

  /* Number card */
  .number-sublabel { font-size: 12px; }
  .number-value { font-size: 22px; }

  /* Devices */
  .device-name { font-size: 13.5px; }
  .device-meta { font-size: 11.5px; }
  .badge { font-size: 10.5px; padding: 3px 8px; }

  /* Quick cards — 2 column */
  .grid-quick { grid-template-columns: 1fr 1fr; }
  .quick-icon { width: 18px; height: 18px; margin-bottom: 8px; }
  .quick-title { font-size: 13px; }
  .quick-desc { font-size: 11px; }

  /* Plan */
  .plan-name { font-size: 13.5px; }
  .plan-detail { font-size: 11.5px; }
  .plan-link { font-size: 12.5px; }

  /* Empty state */
  .empty-card { padding: 24px 20px 22px; }
  .empty-illustration { width: 160px; }
  .empty-title { font-size: 15px; }
  .empty-desc { font-size: 12.5px; max-width: 260px; margin-left: auto; margin-right: auto; }

  /* Footer */
  .footer { padding: 0 16px 24px; }

  /* Legal pages */
  .legal-title { font-size: 19px; }

  /* Modal — bottom sheet on mobile */
  .modal-wrapper { align-items: flex-end; padding: 0; }
  .modal-card {
    border-radius: var(--radius-modal) var(--radius-modal) 0 0;
    max-width: 100%;
    max-height: calc(100vh - 24px);
  }

  /* Drawer variant — mobile bottom sheet adjustments */
  .modal-card.drawer { max-height: 85vh; }
  .modal-card.drawer .drawer-handle {
    display: flex; justify-content: center; padding: 10px 0 2px; flex-shrink: 0;
  }
  .modal-card.drawer .drawer-header { padding: 10px 20px 0; }
  .modal-card.drawer .drawer-status { padding: 10px 20px 0; }
  .modal-card.drawer .modal-body { padding: 14px 20px 20px; }
}
