/* ═══════════════════════════════════════════════════════════════
   ARCONZA — Warm Copper Theme (Light)
   Soft warm cream · crisp white cards · copper-gold accents
   Inspired by modern smart-home interiors · optimized for smooth scroll
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Jost:wght@300;400;500;600;700;800;900&family=IBM+Plex+Mono:wght@400;500;600;700&display=swap');

:root {
  /* ── Silver-Gray Backgrounds (Dragon Body) ── */
  --bg:             #ECEEF2;   /* cool off-white page bg */
  --bg-elev:        #FCFDFF;   /* crisp cool-white cards */
  --bg-elev-2:      #F3F5F9;   /* soft platinum panel */
  --bg-elev-3:      #E4E7ED;   /* platinum hover state */
  --bg-appbar:      rgba(248, 250, 253, 0.78);
  --bg-bottomnav:   rgba(252, 253, 255, 0.94);
  --scrim:          rgba(30, 35, 42, 0.40);

  /* ── Copper / Chocolate Accents (Dragon Belly & Tail) ── */
  --amber:          #7B4626;   /* copper brown — primary action */
  --amber-soft:     #965934;   /* lighter copper — hover, gradients */
  --amber-light:    #C88E68;   /* pale copper */
  --amber-glow:     rgba(123, 70, 38, 0.08);
  --amber-border:   rgba(123, 70, 38, 0.20);

  /* ── Chocolate & Clay Accents ── */
  --sand-wet:       #401902;   /* deep chocolate brown */
  --sand-mid:       #5C2809;   /* rich dark cocoa */
  --sand-dry:       #7B4626;   /* copper brown */
  --coral:          #8A4B29;
  --coral-light:    #A85E3B;
  --sunset-orange:  #945027;
  --sunset-gold:    #B46C3F;

  /* ── Text (cool charcoal on silver-gray) ── */
  --text:           #1C2024;   /* very dark neutral gray */
  --text-secondary: #434950;   /* dark slate gray */
  --text-muted:     #5A6168;   /* cool gray — H-11: WCAG AA 5.4:1 */
  --text-faint:     #7A828C;   /* light cool gray — H-11: WCAG AA 4.5:1 */

  /* ── Semantic ── */
  --success:        #5C8A58;   /* sage green */
  --warning:        #A55729;   /* copper warning */
  --danger:         #A8453D;   /* terracotta danger */
  --info:           #4A7392;   /* cool slate blue */

  /* ── Borders (cool/neutral gray) ── */
  --border:         rgba(67, 73, 80, 0.12);
  --border-strong:  rgba(67, 73, 80, 0.20);
  --divider:        rgba(67, 73, 80, 0.07);

  /* ── Legacy compat (module JS uses these) ── */
  --charcoal:           var(--bg);
  --charcoal-light:     var(--bg-elev-2);
  --charcoal-surface:   var(--bg-elev-2);
  --charcoal-dark:      var(--bg);
  --charcoal-hover:     var(--bg-elev-3);
  --charcoal-deep:      var(--bg);
  --charcoal-mid:       var(--bg-elev);
  --charcoal-elev:      var(--bg-elev-2);
  --charcoal-border:    var(--border);
  --charcoal-line:      var(--divider);
  --amber-light-bg:     rgba(123, 70, 38, 0.06);
  --amber-muted:        rgba(123, 70, 38, 0.45);
  --text-primary:       var(--text);
  --off-white-dim:      #E4E6EA;
  --red-light:          #C26B63;
  --bg-card:            var(--bg-elev);
  --safety:             var(--amber-soft);
  --steel:              var(--amber);
  --steel-light:        var(--amber-soft);
  --purple:             #A78BFA;

  /* ── Type ── */
  --font-body:    'Jost', system-ui, -apple-system, sans-serif;
  --font-mono:    'Jost', monospace;
  --font-display: 'Jost', system-ui, sans-serif;

  /* ── Radii (rounded & modern) ── */
  --r-xs: 8px; --r-sm: 12px; --r-md: 16px;
  --r-lg: 22px; --r-xl: 28px; --r-pill: 999px;
  --radius-sm: var(--r-sm); --radius-md: var(--r-md);
  --radius-lg: var(--r-lg); --radius-xl: var(--r-xl);

  /* ── Shadows (sleek neutral/cool slate) ── */
  --shadow-sm:    0 1px 2px rgba(20, 28, 40, 0.04), 0 2px 6px rgba(20, 28, 40, 0.05);
  --shadow-md:    0 4px 10px rgba(20, 28, 40, 0.05), 0 12px 28px rgba(20, 28, 40, 0.08);
  --shadow-lg:    0 12px 24px rgba(20, 28, 40, 0.08), 0 28px 56px rgba(20, 28, 40, 0.12);
  --shadow-amber: 0 6px 18px rgba(123, 70, 38, 0.22), 0 2px 4px rgba(123, 70, 38, 0.10);
  --shadow-glass: 0 8px 32px rgba(20, 28, 40, 0.06), inset 0 1px 0 rgba(255,255,255,0.6);
  --shadow-card:  0 1px 2px rgba(20, 28, 40, 0.04), 0 6px 18px rgba(20, 28, 40, 0.05), inset 0 1px 0 rgba(255,255,255,0.85);

  /* ── Motion ── */
  --ease-out:    cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-fast: 140ms; --t-med: 240ms; --t-slow: 380ms;

  /* ── Layout ── */
  --appbar-h:     68px;
  --bottomnav-h:  66px;
  --safe-bottom:  env(safe-area-inset-bottom, 0px);
  --safe-top:     env(safe-area-inset-top, 0px);
  --touch:        48px;
}

/* ════════════════════════════════════════
   RESET & BASE
   ════════════════════════════════════════ */
*, ::before, ::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
  min-height: 100vh;
}
img, svg { display: block; max-width: 100%; }
button { font-family: inherit; font-size: inherit; color: inherit; }
input, select, textarea { font-family: inherit; }
.hidden { display: none !important; }
.mono { font-family: var(--font-mono); }

/* Cool silver-gray/copper ambient glow */
body {
  background: var(--bg);
  position: relative;
  overflow-x: hidden;
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 800px 500px at 15% 10%, rgba(123, 70, 38, 0.06), transparent 60%),
    radial-gradient(ellipse 600px 400px at 85% 90%, rgba(67, 73, 80, 0.05), transparent 55%);
}

/* ── GLASSMORPHISM UTILITY ── */
.glass {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(180, 122, 60,0.18); border-radius: 99px; }

/* ════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════ */
.m-btn {
  min-height: var(--touch);
  padding: 0 22px;
  border: 0; border-radius: var(--r-md);
  font-weight: 500; font-size: 14px; letter-spacing: 0.01em;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast), background var(--t-fast);
  white-space: nowrap;
  will-change: transform;
  transform: translateZ(0);
}
.m-btn:active { transform: scale(0.95); }
.m-btn-sm { min-height: 38px; padding: 0 14px; font-size: 13px; border-radius: var(--r-sm); }
.m-btn-block { width: 100%; }
.m-btn-grow { flex: 1; }

.m-btn-primary {
  background: linear-gradient(135deg, var(--amber-soft) 0%, var(--amber) 100%);
  color: #fff;
  box-shadow: var(--shadow-amber);
}
.m-btn-primary:hover { filter: brightness(1.06); box-shadow: 0 8px 24px rgba(180, 122, 60,0.30); }

.m-btn-ghost {
  background: var(--bg-elev-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.m-btn-ghost:hover { background: var(--bg-elev-3); border-color: var(--border-strong); }

.m-btn-sand {
  background: linear-gradient(135deg, var(--sand-dry), var(--sand-wet));
  color: var(--text);
}

.m-btn-text {
  background: transparent;
  color: var(--text-muted);
  border: 0;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: color var(--t-fast);
}
.m-btn-text:hover { color: var(--amber); }
.m-btn-text:active { transform: scale(0.95); }

.m-btn-danger { background: var(--danger); color: #fff; }
.m-btn-danger:disabled { opacity: 0.4; cursor: not-allowed; }

/* Legacy compat */
.btn, .btn-primary, button.btn-primary {
  background: linear-gradient(135deg, var(--amber-soft), var(--amber));
  color: #fff; border: 0; border-radius: var(--r-md);
  padding: 12px 20px; font-weight: 500; cursor: pointer;
  min-height: var(--touch); font-family: inherit;
  box-shadow: var(--shadow-amber);
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
}
.btn-secondary, .btn-ghost {
  background: var(--bg-elev-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 12px 18px; font-weight: 500; cursor: pointer;
  min-height: var(--touch); font-family: inherit;
}
.btn-ghost-sm {
  background: transparent; color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 8px 12px; font-weight: 500; cursor: pointer;
  font-family: inherit; font-size: 12px;
}
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 13px; border-radius: var(--r-sm); }
.btn-xl { min-height: 56px; padding: 0 28px; font-size: 16px; font-weight: 600; border-radius: var(--r-lg); }
.btn-icon {
  width: var(--touch); height: var(--touch); border-radius: var(--r-md);
  background: transparent; border: 0; color: var(--text-secondary);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.btn-icon:hover { background: var(--amber-glow); color: var(--amber); }
.btn-icon-sm {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  background: transparent; border: 0; color: var(--text-secondary);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  /* H-13: keep visual size 32px but expand hit area to 44px (WCAG 2.5.5). */
  min-width: 44px; min-height: 44px;
}

/* ════════════════════════════════════════
   WELCOME / PROJECT PICKER
   ════════════════════════════════════════ */
.m-welcome {
  min-height: 100vh;
  padding: calc(var(--safe-top) + 32px) 22px calc(var(--safe-bottom) + 16px);
  display: flex; flex-direction: column;
  justify-content: center;
  max-width: 520px; margin: 0 auto;
  text-align: center;
}

.m-welcome-hero {
  text-align: center;
  margin: 0 0 32px;
  position: relative;
}

/* Soft glow behind logo */
.m-welcome-hero::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 180px; height: 180px;
  background: radial-gradient(ellipse, rgba(123, 70, 38, 0.08) 0%, transparent 70%);
  border-radius: 50%;
  animation: heroGlow 4s ease-in-out infinite alternate;
  will-change: transform, opacity;  /* M-17: continuously animating */
}
@keyframes heroGlow {
  0%   { opacity: 0.5; transform: translateX(-50%) scale(0.9); }
  100% { opacity: 1;   transform: translateX(-50%) scale(1.1); }
}

.m-welcome-logo {
  width: 80px; height: 80px;
  margin: 0 auto 20px;
  display: inline-flex; align-items: center; justify-content: center;
  position: relative; z-index: 1;
}
.m-welcome-logo img {
  width: 100%; height: 100%; object-fit: contain;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,0.15));
}

.m-welcome-title {
  font-size: 34px; font-weight: 600;
  margin: 0 0 4px; letter-spacing: -0.02em;
  background: linear-gradient(160deg, var(--amber-soft) 0%, var(--amber) 50%, var(--sand-wet) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

.m-welcome-tag {
  margin: 0 0 6px;
  font-size: 11px; font-weight: 500;
  color: var(--amber);
  letter-spacing: 0.18em; text-transform: uppercase;
  opacity: 0.9;
}

.m-welcome-sub {
  margin: 14px auto 0; max-width: 300px;
  color: var(--text-secondary); font-size: 14px; line-height: 1.6;
}

.m-existing-list { margin-top: 24px; display: flex; flex-direction: column; gap: 10px; }
.existing-projects-divider {
  text-align: center; color: var(--text-muted);
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  margin: 18px 0 6px; font-weight: 700;
}

.existing-project-row { display: flex; gap: 8px; align-items: stretch; }
.existing-project-btn {
  flex: 1; min-height: 70px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  color: var(--text); text-align: left; cursor: pointer;
  transition: all var(--t-fast);
  box-shadow: var(--shadow-card);
}
.existing-project-btn:hover {
  background: var(--bg-elev-2);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}
.existing-project-btn:active { transform: scale(0.99); }
.existing-project-delete-btn {
  width: 48px; min-height: 70px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg); cursor: pointer; color: var(--text-muted);
  font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center;
}
.existing-project-delete-btn:hover { color: var(--danger); border-color: rgba(196, 93, 82,0.3); }

.existing-project-sync-btn {
  width: 48px; min-height: 70px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg); cursor: pointer; color: var(--text-muted);
  font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center;
}
.existing-project-sync-btn:hover { color: var(--amber); border-color: var(--amber-border); }

.m-signin { margin-top: auto; text-align: center; padding-top: 24px; }
.m-signin a {
  color: var(--text-muted); font-size: 12px; text-decoration: none;
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  display: inline-block;
  background: var(--bg-elev);
}

/* ════════════════════════════════════════
   PROJECT WIZARD
   ════════════════════════════════════════ */
.m-wizard {
  min-height: 100vh;
  display: flex; flex-direction: column;
  background: var(--bg);
  padding-top: var(--safe-top);
}
.m-wizard-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px 16px 20px;
  display: flex;
  flex-direction: column;
}
.m-wizard-body > * {
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
  margin-top: auto;
  margin-bottom: auto;
  width: 100%;
}

/* Wizard step card — groups fields in a glass panel */
.wizard-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 22px 20px;
  box-shadow: var(--shadow-card);
  margin-bottom: 0;
  animation: fadeUp 400ms var(--ease-out);
}
.wizard-card .field-group:last-child {
  margin-bottom: 0;
}

/* Wizard summary card (step 3) */
.wizard-summary {
  margin-top: 20px;
}

.m-wizard-nav {
  display: flex; gap: 10px;
  padding: 14px 16px calc(14px + var(--safe-bottom));
  background: var(--bg-appbar);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border-top: 1px solid var(--border);
}
.m-wizard-stepdots { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.m-wizard-stepdots .dot {
  width: 7px; height: 7px; border-radius: 99px;
  background: var(--border-strong);
  transition: all var(--t-med) var(--ease-out);
}
.m-wizard-stepdots .dot.active { background: var(--amber); width: 24px; }

/* ════════════════════════════════════════
   APP SHELL
   ════════════════════════════════════════ */
.m-app {
  min-height: 100vh;
  display: flex; flex-direction: column;
  padding-top: calc(var(--appbar-h) + var(--safe-top));
  padding-bottom: calc(var(--bottomnav-h) + var(--safe-bottom));
}

/* ── TOP APP BAR ── */
.m-appbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: calc(var(--appbar-h) + var(--safe-top));
  padding: var(--safe-top) 14px 0;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-appbar);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-bottom: 1px solid var(--border);
  transform: translateZ(0);
}

/* Shimmer line at appbar bottom */
.m-appbar::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(180, 122, 60,0.25) 30%,
    rgba(180, 122, 60,0.40) 50%,
    rgba(180, 122, 60,0.25) 70%,
    transparent 100%
  );
  animation: shimmerLine 4s ease-in-out infinite;
  will-change: transform, opacity;  /* M-17: continuously animating */
}
@keyframes shimmerLine {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 1; }
}

.m-appbar--wizard { position: relative; }
.m-appbar-title-wrap {
  flex: 1; min-width: 0; padding: 0 4px;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  gap: 4px;
}
.m-appbar-eyebrow {
  font-size: 10px; font-weight: 700;
  color: var(--amber); letter-spacing: 0.18em; text-transform: uppercase;
  line-height: 1; opacity: 0.85;
}
.m-appbar-title {
  font-size: 17px; font-weight: 700; color: var(--text);
  line-height: 1.15; letter-spacing: -0.005em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}

.m-iconbtn {
  width: var(--touch); height: var(--touch); min-width: var(--touch);
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--text-secondary);
  border: 0; border-radius: var(--r-md); cursor: pointer; position: relative;
  transition: background var(--t-fast), color var(--t-fast);
}
.m-iconbtn:hover { background: var(--amber-glow); color: var(--amber); }
.m-iconbtn:active { background: var(--amber-border); }
.m-iconbtn--accent { color: var(--amber); }

/* AI pulse dot */
.m-ai-pulse {
  position: absolute; top: 10px; right: 10px;
  width: 8px; height: 8px; border-radius: 99px; background: var(--amber);
  opacity: 0; transform: scale(0.6);
  transition: all var(--t-med);
}
.m-ai-pulse.active {
  opacity: 1; transform: scale(1);
  animation: tealPulse 1.8s infinite;
  will-change: transform, opacity;  /* M-17: continuously animating */
}
@keyframes tealPulse {
  0%   { box-shadow: 0 0 0 0 rgba(180, 122, 60,0.7); }
  70%  { box-shadow: 0 0 0 10px rgba(180, 122, 60,0); }
  100% { box-shadow: 0 0 0 0 rgba(180, 122, 60,0); }
}

/* ── USER DROPDOWN ── */
.m-user-dropdown {
  position: fixed;
  top: calc(var(--appbar-h) + var(--safe-top) + 8px);
  right: 8px; z-index: 60;
  width: 240px;
  background: rgba(250, 252, 255, 0.96);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  animation: menuIn 160ms var(--ease-out);
}
@keyframes menuIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
.m-user-email {
  font-size: 11px; color: var(--text-muted);
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border); margin-bottom: 4px;
  word-break: break-all;
}
.m-menu-item {
  display: block; width: 100%; min-height: 44px;
  text-align: left; padding: 10px 12px;
  background: transparent; border: 0; border-radius: var(--r-sm);
  color: var(--text-secondary); font-size: 14px; font-weight: 600; cursor: pointer;
}
.m-menu-item:hover { background: var(--amber-glow); color: var(--text); }
.m-menu-item--danger { color: var(--danger); }
.m-menu-item--danger:hover { background: rgba(196, 93, 82,0.08); }
.m-menu-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── MAIN CONTENT ── */
.m-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 14px 24px;
  position: relative; z-index: 1;
}

/* ── BOTTOM NAV ── */
.m-bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  height: calc(var(--bottomnav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--bg-bottomnav);
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  border-top: 1px solid var(--border);
  transform: translateZ(0);
}

.m-bottomnav::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 5%,
    rgba(180, 122, 60,0.20) 25%,
    rgba(180, 122, 60,0.35) 50%,
    rgba(180, 122, 60,0.20) 75%,
    transparent 95%
  );
}

.m-tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; background: transparent; border: 0; cursor: pointer;
  color: var(--text-muted);
  font-size: 10px; font-weight: 700; letter-spacing: 0.03em;
  min-height: var(--touch); position: relative;
  transition: color var(--t-fast);
}
.m-tab svg { transition: transform var(--t-med) var(--ease-spring); }
.m-tab.active { color: var(--amber); }
.m-tab.active svg { transform: translateY(-2px); }
.m-tab.active::before {
  content: '';
  position: absolute; top: 0; left: 50%;
  width: 32px; height: 2.5px;
  transform: translateX(-50%);
  background: var(--amber);
  border-radius: 0 0 99px 99px;
  box-shadow: 0 0 8px rgba(180, 122, 60,0.4);
}
.m-tab:active { background: var(--amber-glow); }

/* ── FAB ── */
#fab-container {
  position: fixed;
  right: 16px;
  bottom: calc(var(--bottomnav-h) + var(--safe-bottom) + 18px);
  z-index: 45;
}
.m-fab {
  width: 58px; height: 58px; border-radius: 50%;
  background: linear-gradient(135deg, var(--amber-soft) 0%, var(--amber) 100%);
  color: #fff; border: 0; cursor: pointer;
  box-shadow: var(--shadow-amber), var(--shadow-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  transition: transform var(--t-med) var(--ease-spring), box-shadow var(--t-med);
}
.m-fab:active { transform: scale(0.90); }
.m-fab-menu {
  position: absolute; right: 0; bottom: 68px;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
}
.m-fab-menu.hidden { display: none; }
.m-fab-action {
  display: flex; align-items: center; gap: 10px;
  background: rgba(250, 252, 255, 0.95);
  color: var(--text); padding: 0 16px 0 18px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  height: 44px; font-weight: 600; font-size: 13px;
  cursor: pointer; box-shadow: var(--shadow-md);
  animation: fabIn 220ms var(--ease-spring);
  max-width: min(260px, 72vw); white-space: nowrap;
  overflow: hidden;
}
.m-fab-action span {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@keyframes fabIn {
  from { opacity: 0; transform: translateY(10px) scale(0.95); }
  to   { opacity: 1; transform: none; }
}

/* ════════════════════════════════════════
   SCRIM + DRAWER
   ════════════════════════════════════════ */
.m-scrim {
  position: fixed; inset: 0; z-index: 70;
  background: var(--scrim);
  backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none;
  transition: opacity 340ms var(--ease-out);
}
.m-scrim.open { opacity: 1; pointer-events: all; }

.m-drawer {
  position: fixed; top: 0; right: 0; z-index: 80;
  width: min(400px, 92vw); height: 100vh;
  background: rgba(250, 252, 255, 0.97);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-left: 1px solid var(--border-strong);
  box-shadow: -20px 0 60px rgba(96, 72, 45,0.12);
  display: flex; flex-direction: column;
  transform: translateX(100%) translateZ(0);
  transition: transform var(--t-slow) var(--ease-out);
  will-change: transform;
}
.m-drawer.open { transform: translateX(0); }
.m-drawer-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 8px 12px 18px;
  border-bottom: 1px solid var(--border);
  padding-top: calc(12px + var(--safe-top));
}
.m-drawer-title { display: flex; align-items: center; gap: 8px; flex: 1; font-weight: 700; }
.m-drawer-title svg { color: var(--amber); }
.m-status-dot {
  width: 8px; height: 8px; border-radius: 99px;
  background: var(--success); margin-left: 4px;
}
.m-drawer-watching {
  padding: 8px 18px; font-size: 10px; color: var(--text-muted);
  border-bottom: 1px solid var(--divider);
  letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700;
}
.m-drawer-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.m-drawer-input {
  display: flex; gap: 8px; padding: 12px;
  border-top: 1px solid var(--border);
  padding-bottom: calc(12px + var(--safe-bottom));
}
.m-drawer-input input {
  flex: 1; min-height: 44px; padding: 0 14px;
  background: var(--bg-elev-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-md);
  font-size: 14px; outline: none;
}
.m-drawer-input input:focus { border-color: var(--amber); }

/* AI message bubbles */
.ai-message {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px; font-size: 13px; line-height: 1.55;
}
.ai-message.ai-intro {
  border-color: var(--amber-border);
  background: linear-gradient(180deg, var(--amber-glow), transparent), var(--bg-elev);
}
.ai-msg-body p { margin: 0 0 6px; }
.ai-msg-body p:last-child { margin: 0; }

/* ════════════════════════════════════════
   DASHBOARD HERO CARD
   ════════════════════════════════════════ */
.m-hero-card {
  position: relative; overflow: hidden;
  background: linear-gradient(
    160deg,
    var(--bg-elev) 0%,
    var(--bg-elev-2) 100%
  );
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  padding: 22px 20px 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-card);
}

/* Glowing orb top-right */
.m-hero-card::before {
  content: '';
  position: absolute; top: -40px; right: -40px;
  width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(180, 122, 60,0.10) 0%, transparent 70%);
  border-radius: 50%;
  animation: heroOrb 5s ease-in-out infinite alternate;
  will-change: transform, opacity;  /* M-17: continuously animating */
}
@keyframes heroOrb {
  0%   { transform: translate(0,0) scale(1); opacity: 0.5; }
  100% { transform: translate(-8px, 8px) scale(1.15); opacity: 1; }
}

/* Sand accent at card bottom */
.m-hero-card::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--amber), var(--amber-soft), var(--amber), transparent);
  opacity: 0.5;
}

.m-hero-eyebrow {
  font-size: 10.5px; color: var(--amber);
  text-transform: uppercase; letter-spacing: 0.16em; font-weight: 700;
}
.m-hero-amount {
  font-family: var(--font-mono);
  font-size: 32px; font-weight: 600;
  margin: 8px 0 2px; letter-spacing: -0.03em;
  background: linear-gradient(160deg, var(--amber) 0%, var(--amber-soft) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.m-hero-sub { color: var(--text-secondary); font-size: 13px; }

.m-health-bar {
  margin-top: 20px; height: 6px; border-radius: 99px;
  background: rgba(180, 122, 60,0.08);
  overflow: hidden; position: relative;
}
.m-health-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--success), var(--amber));
  transition: width 900ms var(--ease-out);
}
.m-health-fill.over { background: linear-gradient(90deg, var(--warning), var(--danger)); }
.m-health-meta {
  display: flex; justify-content: space-between;
  margin-top: 8px; font-size: 11.5px; color: var(--text-muted);
}

/* ════════════════════════════════════════
   STAT CARDS
   ════════════════════════════════════════ */
.m-stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.m-stat {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 14px 12px;
  box-shadow: var(--shadow-card);
}
.m-stat-label {
  font-size: 10px; color: var(--text-muted);
  font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase;
}
.m-stat-value {
  font-family: var(--font-mono); font-size: 20px; font-weight: 500;
  margin-top: 6px; color: var(--text);
}
.m-stat-value.success { color: var(--success); }
.m-stat-value.danger  { color: var(--warning); }

/* ════════════════════════════════════════
   SECTION TITLES
   ════════════════════════════════════════ */
.m-section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 500; color: var(--text-muted);
  letter-spacing: 0.14em; text-transform: uppercase;
  margin: 22px 4px 10px;
}
.m-section-title .count {
  font-family: var(--font-mono); color: var(--text-faint);
  font-weight: 500; letter-spacing: 0;
}

/* ════════════════════════════════════════
   PHASE CARDS (dashboard list)
   ════════════════════════════════════════ */
.m-phase-grid { display: flex; flex-direction: column; gap: 10px; }
.m-phase-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 14px;
  min-height: 74px; cursor: pointer;
  transition: all var(--t-fast);
  text-align: left; width: 100%; color: var(--text);
  font-family: inherit;
  will-change: transform; transform: translateZ(0);
  box-shadow: var(--shadow-card);
}
.m-phase-card:active { transform: scale(0.97); }
.m-phase-card:hover {
  background: var(--bg-elev-2);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}
.m-phase-card-icon {
  flex-shrink: 0; width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: var(--amber-glow);
  border: 1px solid var(--border);
  border-radius: var(--r-md); font-size: 20px; color: var(--amber);
}
.m-phase-card-body { flex: 1; min-width: 0; }
.m-phase-card-name { font-weight: 500; font-size: 14.5px; }
.m-phase-card-meta {
  display: flex; align-items: center; gap: 10px;
  margin-top: 5px; font-size: 12px; color: var(--text-muted);
}
.m-phase-card-cost { font-family: var(--font-mono); color: var(--text-secondary); font-weight: 500; }
.m-phase-card-progress {
  height: 3px; border-radius: 99px;
  background: rgba(180, 122, 60,0.08); overflow: hidden; margin-top: 8px;
}
.m-phase-card-progress > i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--amber), var(--amber-soft));
}
.m-phase-card-chev { color: var(--text-faint); font-size: 18px; }

/* Alert card */
.m-alert-card {
  display: flex; gap: 12px; align-items: center;
  background: linear-gradient(180deg, rgba(196, 93, 82,0.04), transparent);
  border: 1px solid rgba(196, 93, 82,0.18);
  border-radius: var(--r-lg); padding: 12px 14px; cursor: pointer; margin-bottom: 8px;
}
.m-alert-card .badge {
  width: 32px; height: 32px; border-radius: 99px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(196, 93, 82,0.12); color: var(--warning); font-weight: 600;
}
.m-alert-card .body { flex: 1; }
.m-alert-card .name { font-weight: 500; font-size: 14px; }
.m-alert-card .meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.m-alert-card .over { font-family: var(--font-mono); color: var(--warning); font-weight: 500; }

/* ════════════════════════════════════════════════════════════════
   DASHBOARD INSIGHT CARDS — ARCONZA
   · Cost Breakdown donut + legend
   · Phase Progress mini-grid
   · Vendor Khata snapshot
   · Operations quick-stats
   · Recent Activity feed
   All cards use the shared --bg-elev / --border / --shadow-card tokens
   so they match the existing hero / stat cards visually.
   ════════════════════════════════════════════════════════════════ */

/* ── Cost Breakdown donut ── */
.dash-breakdown-card {
  display: flex; align-items: center; gap: 20px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
  transition: all var(--t-fast);
}
.dash-breakdown-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.dash-donut-wrap { flex-shrink: 0; }
.dash-donut {
  width: 100px; height: 100px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: transform 300ms var(--ease-spring);
}
.dash-breakdown-card:hover .dash-donut { transform: scale(1.04); }
.dash-donut-hole {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--bg-elev);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.dash-donut-total {
  font-family: var(--font-mono); font-size: 13px; font-weight: 800; color: var(--text);
  line-height: 1;
}
.dash-donut-label { font-size: 8px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 3px; }
.dash-legend { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.dash-legend-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
}
.dash-legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.dash-legend-label { font-weight: 600; color: var(--text); }
.dash-legend-pct { color: var(--text-muted); font-weight: 500; min-width: 32px; }
.dash-legend-val { font-family: var(--font-mono); font-weight: 600; color: var(--text-secondary); margin-left: auto; }

/* ── Phase Progress mini-grid ── */
.dash-phase-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-bottom: 16px;
}
.dash-phase-mini {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 12px;
  cursor: pointer; font-family: inherit;
  transition: all var(--t-fast);
  text-align: left; box-shadow: var(--shadow-card);
}
.dash-phase-mini:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.dash-phase-mini:active { transform: scale(0.98); }
.dash-phase-mini-top { display: flex; align-items: center; gap: 6px; }
.dash-phase-mini-icon { color: var(--amber); flex-shrink: 0; display: flex; }
.dash-phase-mini-name { font-size: 11.5px; font-weight: 600; color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-phase-mini-pct { font-size: 11px; font-weight: 700; color: var(--amber); font-family: var(--font-mono); }
.dash-phase-mini-bar { height: 4px; border-radius: 99px; background: rgba(180,122,60,0.10); overflow: hidden; }
.dash-phase-mini-bar > i { display: block; height: 100%; border-radius: 99px; transition: width 400ms var(--ease-out); }
.dash-phase-mini-cost { font-size: 12px; font-family: var(--font-mono); font-weight: 600; color: var(--text-secondary); }

/* ── Vendor Khata snapshot ── */
.dash-vendor-card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 18px;
  margin-bottom: 16px; box-shadow: var(--shadow-card);
  transition: all var(--t-fast);
}
.dash-vendor-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.dash-vendor-hero { text-align: center; margin-bottom: 14px; }
.dash-vendor-hero-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; color: var(--text-muted); }
.dash-vendor-hero-amount { font-family: var(--font-mono); font-size: 28px; font-weight: 800; margin: 4px 0; }
.dash-vendor-hero-sub { font-size: 11px; color: var(--text-muted); }
.dash-vendor-list { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.dash-vendor-row { display: flex; align-items: center; justify-content: space-between; }
.dash-vendor-name { font-size: 12.5px; font-weight: 600; color: var(--text); }
.dash-vendor-amt { font-family: var(--font-mono); font-size: 12.5px; font-weight: 700; }

/* ── Operations quick-stats ── */
.dash-ops-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px;
  margin-bottom: 16px;
}
.dash-ops-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 14px;
  box-shadow: var(--shadow-card);
  transition: all var(--t-fast);
}
.dash-ops-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.dash-ops-icon { flex-shrink: 0; display: flex; }
.dash-ops-body { min-width: 0; }
.dash-ops-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; color: var(--text-muted); }
.dash-ops-value { font-size: 18px; font-weight: 800; color: var(--text); font-family: var(--font-mono); }
.dash-ops-sub { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }

/* ── Recent Activity feed ── */
.dash-recents-list {
  display: flex; flex-direction: column; gap: 4px;
  margin-bottom: 16px;
}
.dash-recent-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: all var(--t-fast);
}
.dash-recent-item:hover { border-color: var(--border-strong); background: var(--bg-elev-2); }
.dash-recent-icon { flex-shrink: 0; color: var(--amber); display: flex; }
.dash-recent-body { flex: 1; min-width: 0; }
.dash-recent-title { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-recent-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.dash-recent-amount { font-family: var(--font-mono); font-size: 13px; font-weight: 700; color: var(--text-secondary); flex-shrink: 0; }

/* ── Desktop responsive ── */
body.desktop-mode .dash-breakdown-card { padding: 22px; }
body.desktop-mode .dash-donut { width: 120px; height: 120px; }
body.desktop-mode .dash-donut-hole { width: 76px; height: 76px; }
body.desktop-mode .dash-donut-total { font-size: 15px; }
body.desktop-mode .dash-phase-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
body.desktop-mode .dash-ops-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
body.desktop-mode .dash-recent-item { padding: 14px 16px; }
body.desktop-mode .dash-recent-title { font-size: 14px; }
body.desktop-mode .dash-recent-sub { font-size: 12px; }
body.desktop-mode .dash-recent-amount { font-size: 14px; }

/* ════════════════════════════════════════
   LEDGER TABS
   ════════════════════════════════════════ */
.m-tabbar {
  display: flex; gap: 4px; padding: 4px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  margin-bottom: 16px;
}
.m-tabbar button {
  flex: 1; min-height: 40px; border: 0; cursor: pointer;
  background: transparent; color: var(--text-muted);
  font-weight: 500; font-size: 12.5px; letter-spacing: 0.02em;
  border-radius: var(--r-pill);
  transition: all var(--t-fast);
}
.m-tabbar button.active {
  background: linear-gradient(135deg, var(--amber-soft), var(--amber));
  color: #fff; box-shadow: var(--shadow-amber);
}

/* ════════════════════════════════════════
   LIST ITEMS
   ════════════════════════════════════════ */
.m-list { display: flex; flex-direction: column; gap: 8px; }
.m-list-group {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
}
.m-list-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; min-height: 60px;
  background: transparent; border: 0; width: 100%;
  cursor: pointer; color: var(--text); text-align: left;
  border-bottom: 1px solid var(--divider);
  font-family: inherit; font-size: 14px;
  transition: background var(--t-fast), transform var(--t-fast);
  will-change: transform; transform: translateZ(0);
}
.m-list-row:last-child { border-bottom: 0; }
.m-list-row:hover { background: var(--bg-elev-2); }
.m-list-row:active { transform: scale(0.98); }
.m-list-row .icon {
  width: 38px; height: 38px; border-radius: var(--r-md); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  background: var(--amber-glow); color: var(--amber);
  border: 1px solid var(--border);
}
.m-list-row .body { flex: 1; min-width: 0; }
.m-list-row .label { font-weight: 500; font-size: 14px; }
.m-list-row .desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.m-list-row .chev { color: var(--text-faint); font-size: 18px; }

/* ════════════════════════════════════════
   FORM FIELDS
   ════════════════════════════════════════ */
.field-group { margin-bottom: 16px; }
.field-row { display: grid; gap: 12px; }
.field-row.cols-2 { grid-template-columns: repeat(2, 1fr); }
.field-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
.field-row.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 480px) {
  .field-row.cols-2, .field-row.cols-3, .field-row.cols-4 { grid-template-columns: 1fr; }
}

.field-label {
  display: block; margin-bottom: 7px;
  font-size: 10.5px; font-weight: 500;
  color: var(--amber); letter-spacing: 0.10em; text-transform: uppercase;
  opacity: 0.85;
}

.field-input, .field-select, .field-textarea,
input[type=text], input[type=number], input[type=date],
input[type=email], input[type=password], select, textarea {
  width: 100%;
  min-height: var(--touch);
  padding: 12px 14px;
  background: rgba(250, 252, 255, 0.70);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-size: 15px; font-family: inherit;
  outline: none;
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
  -webkit-appearance: none;
}
.field-textarea, textarea { min-height: 96px; padding: 12px 14px; resize: vertical; }
.field-input:focus, .field-select:focus, .field-textarea:focus,
input:focus, select:focus, textarea:focus {
  border-color: var(--amber);
  background: rgba(250, 252, 255, 0.95);
  box-shadow: 0 0 0 3px var(--amber-glow);
}
.field-input.mono, input.mono { font-family: var(--font-mono); }
.field-input.saved, input.saved {
  border-color: var(--success);
  box-shadow: 0 0 0 3px rgba(110, 155, 106,0.12);
}

/* Currency input */
.currency-input-wrap { position: relative; }
.currency-symbol {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--amber); font-weight: 700; font-family: var(--font-mono);
  pointer-events: none; font-size: 14px;
}
.currency-input-wrap input { padding-left: 30px; }

/* Toggle switch */
.toggle-switch, .ts {
  position: relative; width: 48px; height: 28px;
  background: rgba(180, 122, 60,0.15); border-radius: 99px; cursor: pointer;
  transition: background var(--t-fast);
  flex-shrink: 0;
}
.toggle-switch::after, .ts::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; background: #fff; border-radius: 99px;
  transition: transform var(--t-fast) var(--ease-spring);
  box-shadow: 0 1px 3px rgba(0,0,0,0.10);
}
.toggle-switch.on, .ts.on { background: var(--amber); }
.toggle-switch.on::after, .ts.on::after { transform: translateX(20px); background: #fff; }

/* ════════════════════════════════════════
   CARDS — the glass panels
   ════════════════════════════════════════ */
.section-card, .dashboard-chart-card, .card, .stat-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-card);
}

.section-card, .card { position: relative; }
.section-card-title, .dashboard-chart-title, .card-title {
  font-size: 13px; font-weight: 600; color: var(--text);
  letter-spacing: 0.04em; margin: 0 0 14px;
  display: flex; align-items: center; gap: 8px;
}
.stat-card { padding: 14px 16px; }
.stat-card-label { font-size: 10px; color: var(--text-muted); font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; }
.stat-card-value { font-family: var(--font-mono); font-size: 20px; font-weight: 500; margin-top: 6px; color: var(--text); }
.stat-card-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
@media (max-width: 480px) { .dashboard-grid { grid-template-columns: 1fr; } }
.dashboard-grid .stat-card { padding: 12px 14px; margin: 0; }
.dashboard-grid .stat-card-value { font-size: 16px; }

/* Donut chart */
.donut-container { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.donut-svg { width: 160px; height: 160px; }
.donut-center-text { fill: var(--text); font-family: var(--font-mono); }
.donut-legend { width: 100%; display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--text-secondary); }
.donut-legend-item { display: flex; align-items: center; gap: 8px; }
.donut-legend-dot { width: 10px; height: 10px; border-radius: 99px; }

/* Phase bar rows */
.phase-bar-row {
  display: grid; grid-template-columns: 1fr; gap: 6px;
  padding: 10px 12px; border-radius: var(--r-md);
  background: var(--bg-elev-2); margin-bottom: 8px; cursor: pointer;
  border: 1px solid var(--border);
  transition: background var(--t-fast);
}
.phase-bar-row:hover { background: var(--bg-elev-3); }
.phase-bar-label { font-size: 13px; font-weight: 500; color: var(--text); }
.phase-bar-outer { height: 5px; background: rgba(180, 122, 60,0.08); border-radius: 99px; overflow: hidden; }
.phase-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--amber), var(--amber-soft));
  border-radius: 99px;
}
.phase-bar-value { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); text-align: right; }

.variance-card {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border-radius: var(--r-md);
  background: rgba(196, 93, 82,0.04); border: 1px solid rgba(196, 93, 82,0.16);
  margin-bottom: 8px; cursor: pointer;
}
.variance-label { font-weight: 500; font-size: 13px; }
.variance-amount { font-family: var(--font-mono); color: var(--warning); font-weight: 500; font-size: 13px; }

/* ════════════════════════════════════════
   CATEGORY HUB — card grid
   ════════════════════════════════════════ */
.category-hub { display: block; }
.category-hub-header { padding: 4px 4px 16px; }
.category-hub-title { font-size: 17px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.category-hub-subtitle { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.category-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .category-grid { grid-template-columns: 1fr; } }

.category-card {
  position: relative; text-align: left;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 16px;
  cursor: pointer; min-height: 140px;
  display: flex; flex-direction: column; gap: 8px;
  font-family: inherit; color: var(--text);
  transition: all var(--t-fast);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.category-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.category-card:active { transform: scale(0.97); }
.category-card-icon { color: var(--amber); display: inline-flex; }
.category-card-name { font-weight: 500; font-size: 14.5px; color: var(--text); }
.category-card-desc { font-size: 12px; color: var(--text-muted); line-height: 1.45; }
.category-card-arrow { position: absolute; top: 14px; right: 14px; color: var(--text-faint); }
.category-card-meta { margin-top: auto; }
.category-card-progress { font-size: 11px; color: var(--text-muted); }
.category-card-cost { font-family: var(--font-mono); color: var(--amber); font-weight: 500; font-size: 14.5px; }

/* ════════════════════════════════════════
   "ALL BILLS" CARD — visually distinct from regular category/phase cards.
   Used in: per-phase hub (category-grid), Construction hub (m-phase-grid),
   Interior hub (m-phase-grid). Always rendered at the BOTTOM of its container,
   spanning full width, with an amber-tinted dashed border + "AI Scanner" badge
   so users immediately recognise it as a different kind of action
   (jumping into the BillScanner gallery, not a category drill-in).
   ════════════════════════════════════════ */

/* Variant 1: inside .category-grid (per-phase hub) — spans both columns */
.all-bills-card {
  grid-column: 1 / -1;            /* always full-width, on its own row */
  position: relative; text-align: left;
  background: linear-gradient(135deg, var(--amber-glow), var(--bg-elev) 65%);
  border: 1.5px dashed var(--amber-border);
  border-radius: var(--r-lg); padding: 16px 18px;
  cursor: pointer; min-height: 0;                /* override category-card min-height */
  display: flex; flex-direction: row; align-items: center; gap: 16px;
  font-family: inherit; color: var(--text);
  transition: all var(--t-fast);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.all-bills-card:hover {
  border-color: var(--amber);
  border-style: solid;
  box-shadow: 0 6px 24px rgba(232,124,42,0.18);
  background: linear-gradient(135deg, var(--amber-glow), var(--bg-elev-2) 65%);
}
.all-bills-card:active { transform: scale(0.99); }
.all-bills-card-icon {
  flex-shrink: 0; width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  background: var(--amber); color: #fff;
  border-radius: var(--r-md);
  box-shadow: 0 2px 8px rgba(232,124,42,0.35);
}
.all-bills-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.all-bills-card-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.all-bills-card-name { font-weight: 600; font-size: 15px; color: var(--text); }
.all-bills-card-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--amber); color: #fff;
  padding: 2px 7px; border-radius: 99px;
}
.all-bills-card-desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.all-bills-card-meta {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 2px; font-size: 11.5px; color: var(--text-muted);
}
.all-bills-card-count { font-weight: 600; color: var(--text-secondary); }
.all-bills-card-cost { font-family: var(--font-mono); color: var(--amber); font-weight: 600; font-size: 15px; }
.all-bills-card-chev { color: var(--amber); font-size: 20px; flex-shrink: 0; }

/* Variant 2: inside .m-phase-grid (Construction / Interior hub) — already full-width */
.m-all-bills-card {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(135deg, var(--amber-glow), var(--bg-elev) 65%);
  border: 1.5px dashed var(--amber-border);
  border-radius: var(--r-lg); padding: 16px;
  min-height: 74px; cursor: pointer;
  transition: all var(--t-fast);
  text-align: left; width: 100%; color: var(--text);
  font-family: inherit;
  will-change: transform; transform: translateZ(0);
  box-shadow: var(--shadow-card);
  margin-top: 6px;                 /* small breathing space above (separates from grid) */
}
.m-all-bills-card:hover {
  border-color: var(--amber);
  border-style: solid;
  background: linear-gradient(135deg, var(--amber-glow), var(--bg-elev-2) 65%);
  box-shadow: 0 6px 24px rgba(232,124,42,0.18);
}
.m-all-bills-card:active { transform: scale(0.99); }
.m-all-bills-card-icon {
  flex-shrink: 0; width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  background: var(--amber); color: #fff;
  border-radius: var(--r-md); font-size: 22px;
  box-shadow: 0 2px 8px rgba(232,124,42,0.35);
}
.m-all-bills-card-body { flex: 1; min-width: 0; }
.m-all-bills-card-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.m-all-bills-card-name { font-weight: 600; font-size: 15px; color: var(--text); }
.m-all-bills-card-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--amber); color: #fff;
  padding: 2px 7px; border-radius: 99px;
}
.m-all-bills-card-meta {
  display: flex; align-items: center; gap: 10px;
  margin-top: 5px; font-size: 12px; color: var(--text-muted);
}
.m-all-bills-card-cost { font-family: var(--font-mono); color: var(--amber); font-weight: 600; }
.m-all-bills-card-chev { color: var(--amber); font-size: 20px; flex-shrink: 0; }

/* Hub cost summary strip */
.hub-cost-summary {
  margin-bottom: 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 14px 18px;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px;
}
.hub-cost-label { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 500; }
.hub-cost-value {
  font-family: var(--font-mono); font-size: 22px; font-weight: 500;
  color: var(--amber);
}

/* ════════════════════════════════════════
   TABLES
   ════════════════════════════════════════ */
@media (max-width: 700px) {
  table, .phase-workspace table {
    width: 100%; border-collapse: collapse; font-size: 12px;
  }
  .phase-workspace table th, .phase-workspace table td {
    padding: 8px 6px;
    border-bottom: 1px solid var(--divider);
  }
}

.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
  padding: 10px 12px; font-size: 10px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--amber); text-align: left;
  border-bottom: 1px solid var(--border-strong);
}
.data-table thead th.right { text-align: right; }
.data-table tbody td {
  padding: 10px 12px; border-bottom: 1px solid var(--divider);
  font-size: 13px; color: var(--text-secondary);
}
.data-table tbody td.mono { font-family: var(--font-mono); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tfoot td {
  padding: 10px 12px; font-weight: 500;
  background: var(--bg-elev-2);
  border-top: 1px solid var(--border-strong);
}

/* ════════════════════════════════════════
   TOAST
   ════════════════════════════════════════ */
#toast-container {
  position: fixed; left: 0; right: 0;
  bottom: calc(var(--bottomnav-h) + var(--safe-bottom) + 16px);
  z-index: 9400; pointer-events: none;  /* H-15: above modals (was 200) */
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 0 16px;
}
.toast {
  pointer-events: all;
  background: rgba(250, 252, 255, 0.95);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  padding: 10px 20px;
  font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: inline-flex; align-items: center; gap: 8px;
  animation: toastIn 280ms var(--ease-spring);
  max-width: 92%;
}
.toast.success { border-color: rgba(110, 155, 106,0.40); }
.toast.warning { border-color: rgba(214, 154, 74,0.40); color: var(--warning); }
.toast.error   { border-color: rgba(196, 93, 82,0.40); color: var(--danger); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to   { opacity: 1; transform: none; }
}

/* ════════════════════════════════════════
   MODAL — bottom sheet
   ════════════════════════════════════════ */
.m-modal-overlay, .confirm-modal-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: var(--scrim);
  backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 16px;
  animation: fadeIn 180ms var(--ease-out);
}
.m-modal-overlay.hidden, .confirm-modal-overlay.hidden { display: none; }
.m-modal-box, .confirm-modal-box {
  background: rgba(250, 252, 255, 0.98);
  color: var(--text);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 24px 22px calc(20px + var(--safe-bottom));
  width: 100%; max-width: 500px; max-height: 90vh;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 -20px 60px rgba(96, 72, 45,0.12);
  animation: sheetUp 300ms var(--ease-out);
  will-change: transform, opacity;
  position: relative;
}

/* Ocean glow at top of modal */
.m-modal-box::before, .confirm-modal-box::before {
  content: '';
  position: absolute; top: 0; left: 30%; right: 30%; height: 2px;
  background: linear-gradient(90deg, transparent, var(--amber), transparent);
  opacity: 0.6;
}

/* Drag handle */
.m-modal-box::after {
  content: '';
  position: absolute; top: 10px; left: 50%;
  transform: translateX(-50%);
  width: 36px; height: 4px;
  background: rgba(180, 122, 60,0.20);
  border-radius: 99px;
}

@media (min-width: 600px) {
  .m-modal-overlay, .confirm-modal-overlay { align-items: center; }
  .m-modal-box, .confirm-modal-box { border-radius: var(--r-xl); padding-bottom: 24px; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Site Photos: delete button shows on card hover */
.photo-delete-btn { opacity: 0 !important; transition: opacity .15s !important; }
div:hover > .photo-delete-btn,
div:hover > div > .photo-delete-btn { opacity: 1 !important; }

@keyframes sheetUp {
  from { transform: translateY(50px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.m-modal-icon, .confirm-modal-icon { font-size: 36px; margin-bottom: 10px; }
.m-modal-title, .confirm-modal-title {
  font-size: 18px; font-weight: 600; color: var(--text); margin: 0 0 8px;
}
.m-modal-body, .confirm-modal-body {
  font-size: 14px; color: var(--text-secondary); line-height: 1.55; margin: 0 0 18px;
}
.m-modal-actions, .confirm-modal-actions { display: flex; gap: 10px; }
.confirm-modal-cancel {
  flex: 1; padding: 13px;
  border: 1px solid var(--border);
  background: var(--bg-elev-2); color: var(--text);
  border-radius: var(--r-md); cursor: pointer; font-weight: 500;
  font-family: inherit; min-height: var(--touch);
}
.confirm-modal-confirm {
  flex: 1; padding: 13px;
  border: 0; background: var(--danger); color: #fff;
  border-radius: var(--r-md); cursor: pointer; font-weight: 500;
  font-family: inherit; min-height: var(--touch);
}
.confirm-modal-confirm:disabled { opacity: 0.4; cursor: not-allowed; }
.confirm-modal-input {
  width: 100%; padding: 12px 14px;
  background: var(--bg-elev-2); color: var(--text);
  border: 1.5px solid var(--border); border-radius: var(--r-md);
  font-family: var(--font-mono); font-size: 14px; outline: none;
}

/* ════════════════════════════════════════
   LEGACY MODULE COMPAT
   ════════════════════════════════════════ */
.phase-workspace { display: block; animation: fadeUp 300ms var(--ease-out); }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.phase-workspace.active { display: block; }

.phase-header { padding: 4px 4px 16px; }
.phase-title { font-size: 18px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.phase-subtitle { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

.breadcrumb {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-muted); margin: 0 0 12px;
}
.breadcrumb a {
  color: var(--text-secondary); cursor: pointer; text-decoration: none; font-weight: 600;
  padding: 4px 8px; border-radius: var(--r-sm);
  transition: all var(--t-fast);
}
.breadcrumb a:hover { color: var(--amber); background: var(--amber-glow); }
.breadcrumb-sep { color: var(--text-faint); }
.breadcrumb-current { color: var(--text); font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }

.back-to-hub {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 14px;
  background: var(--bg-elev-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-pill);
  font-size: 13px; font-weight: 600; cursor: pointer; margin-bottom: 14px;
}
.back-to-hub:hover { background: var(--bg-elev-3); border-color: var(--border-strong); }

/* ── Empty State ── */
.m-empty {
  text-align: center; padding: 48px 24px; color: var(--text-muted);
}
.m-empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.m-empty-title { font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.m-empty-desc { font-size: 13px; line-height: 1.55; }
.empty-state-module {
  padding: 40px 20px; text-align: center;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--bg-elev);
}
.empty-state-module p { color: var(--text-secondary); font-size: 13px; margin: 8px 0 20px; }

/* ════════════════════════════════════════
   MODULE COMPONENTS
   ════════════════════════════════════════ */

/* Hub header */
.hub-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}
.hub-header-left { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.hub-header-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.hub-header-right .btn,
.hub-header-right .m-btn { flex-shrink: 0; white-space: nowrap; font-size: 12px; padding: 8px 12px; }

@media (max-width: 600px) {
  .hub-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .hub-header-left {
    flex: none;
    width: 100%;
  }
  .hub-header-right {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
  }
  .hub-header-right .btn,
  .hub-header-right .m-btn { font-size: 11px; padding: 7px 10px; }
  .hub-header-right .phase-chip { font-size: 10px; padding: 4px 8px; }
}
.hub-title { font-size: 18px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; margin: 0; }
.hub-subtitle { font-size: 13px; color: var(--text-muted); margin: 3px 0 0; }

/* Stat grids */
.stat-grid-3 {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px;
}
@media (max-width: 500px) { .stat-grid-3 { grid-template-columns: 1fr; } }
.stat-grid-3 > div {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 14px;
}
.stat-grid-3 .stat-label {
  font-size: 10px; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--amber); margin-bottom: 6px; opacity: 0.85;
}
.stat-grid-3 .stat-value {
  font-family: var(--font-mono); font-weight: 500; font-size: 18px;
}

/* Cards grid */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }

/* Cat card */
.cat-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.cat-card-icon {
  width: 40px; height: 40px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  background: var(--amber-glow); border: 1px solid var(--border);
  flex-shrink: 0; font-size: 18px; color: var(--amber);
}
.cat-card-title { font-weight: 500; font-size: 15px; color: var(--text); }
.cat-card-meta { font-size: 12px; color: var(--text-muted); }
.cat-card-footer {
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--divider);
}

/* Badges */
.phase-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: var(--r-pill);
  background: var(--bg-elev-2); color: var(--text-secondary);
  border: 1px solid var(--border);
  font-size: 11px; font-weight: 500; letter-spacing: 0.02em;
}
.phase-pct { font-size: 11px; }
.status-badge { display: inline-block; padding: 3px 10px; border-radius: var(--r-pill); font-size: 11px; font-weight: 500; }
.status-badge-paid     { background: rgba(110, 155, 106,0.12); color: var(--success); }
.status-badge-partial  { background: var(--amber-glow); color: var(--amber); }
.status-badge-pending  { background: rgba(214, 154, 74,0.12); color: var(--warning); }
.status-badge-draft    { background: rgba(110, 148, 176,0.12); color: var(--info); }
.status-badge-sent     { background: var(--amber-glow); color: var(--amber); }
.status-badge-open     { background: rgba(214, 154, 74,0.12); color: var(--warning); }
.status-badge-resolved { background: rgba(110, 155, 106,0.12); color: var(--success); }

/* Live total */
.live-total {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 16px; padding: 12px 14px;
  background: var(--bg-elev-2); border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.live-total-label { font-size: 11px; font-weight: 500; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.08em; }
.live-total-value { font-family: var(--font-mono); font-size: 18px; font-weight: 500; color: var(--amber); }

/* Completion bar */
.completion-bar-section {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 10px 14px; margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}
.completion-label { font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); white-space: nowrap; }
.completion-bar-outer { flex: 1; height: 5px; background: rgba(180, 122, 60,0.08); border-radius: 99px; overflow: hidden; }
.completion-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--amber), var(--amber-soft));
  border-radius: 99px; transition: width 500ms var(--ease-out);
}
.completion-pct-input {
  width: 46px; min-height: unset; padding: 5px 8px;
  background: var(--bg-elev-2); color: var(--text);
  border: 1.5px solid var(--border); border-radius: var(--r-sm);
  font-family: var(--font-mono); font-size: 13px; font-weight: 500;
  text-align: center; outline: none;
}
.completion-pct-input:focus { border-color: var(--amber); }

/* Add/Delete row buttons */
.add-row-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 0 16px;
  background: var(--bg-elev-2); color: var(--amber);
  border: 1.5px dashed var(--border-strong); border-radius: var(--r-md);
  font-size: 12px; font-weight: 500; cursor: pointer;
  font-family: inherit; transition: all var(--t-fast);
}
.add-row-btn:hover { background: var(--bg-elev-3); border-color: var(--amber); border-style: solid; }
.delete-row-btn {
  width: 30px; height: 30px; border-radius: var(--r-sm);
  background: transparent; border: 1px solid var(--border);
  cursor: pointer; color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  transition: all var(--t-fast);
  /* H-13: keep visual size 30px but expand hit area to 44px (WCAG 2.5.5). */
  min-width: 44px; min-height: 44px;
}
.delete-row-btn:hover { color: var(--danger); border-color: rgba(196, 93, 82,0.35); background: rgba(196, 93, 82,0.06); }

/* Section card collapsible */
.section-card-header {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none; padding: 2px 0;
}
.section-card-meta { display: flex; align-items: center; gap: 10px; }
.section-card-total { font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--amber); }
.section-toggle-icon { font-size: 10px; color: var(--text-faint); transition: transform var(--t-fast); }
.section-card.collapsed .section-card-body { display: none; }
.section-card.collapsed .section-toggle-icon { transform: rotate(-90deg); }
.section-card-body { padding-top: 14px; }

/* Budget bar */
.budget-bar-container { margin-bottom: 10px; }
.budget-bar-label { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-muted); margin-bottom: 4px; }
.budget-bar-outer { height: 4px; background: rgba(180, 122, 60,0.08); border-radius: 99px; overflow: hidden; }
.budget-bar-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--success), var(--amber));
  transition: width 600ms var(--ease-out);
}
.budget-bar-fill.over { background: linear-gradient(90deg, var(--warning), var(--danger)); }

/* Phase total display */
.phase-summary-box { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.phase-total-display { text-align: right; }
.phase-total-label { font-size: 10px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; }
.phase-total-amount {
  font-family: var(--font-mono); font-size: 22px; font-weight: 600;
  color: var(--amber);
}

/* Line table */
.line-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.line-table thead th {
  padding: 8px 10px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--amber); text-align: left;
  border-bottom: 1px solid var(--border-strong);
}
.line-table thead th.right { text-align: right; }
.line-table tbody td { padding: 8px 6px; border-bottom: 1px solid var(--divider); }
.line-table tbody td.computed {
  font-family: var(--font-mono); font-size: 13px;
  font-weight: 600; color: var(--amber); text-align: right;
}
.line-table .input-td { padding: 4px 6px; }
.line-table input, .line-table select { min-height: 36px; }

/* Toggle card */
.toggle-card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--r-lg); margin-bottom: 10px; overflow: hidden;
}
.toggle-card.active { border-color: var(--amber); }
.toggle-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; cursor: pointer;
  transition: background var(--t-fast);
}
.toggle-card-header:hover { background: var(--bg-elev-2); }
.toggle-card-title { font-weight: 700; font-size: 13px; color: var(--text); }
.toggle-card-body { padding: 0 14px 14px; display: none; }
.toggle-card.active .toggle-card-body { display: block; }

/* Form helpers */
.fs-label { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 5px; }
.fs-inp {
  width: 100%; padding: 9px 11px; min-height: 40px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm); font-size: 13px;
  background: rgba(250, 252, 255, 0.70); color: var(--text);
  outline: none; font-family: inherit; box-sizing: border-box;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.fs-inp:focus { border-color: var(--amber); background: rgba(250, 252, 255, 0.95); box-shadow: 0 0 0 3px var(--amber-glow); }

/* Modal buttons */
.modal-btn-primary { background: linear-gradient(135deg, var(--amber-soft), var(--amber)) !important; color: #fff !important; }
.modal-btn-cancel { background: var(--bg-elev-2) !important; border: 1.5px solid var(--border) !important; color: var(--text-secondary) !important; }
.modal-btn-success { background: var(--success) !important; color: #fff !important; }
.modal-btn-warning { background: var(--warning) !important; color: #fff !important; }
.modal-btn-danger  { background: var(--danger) !important; color: #fff !important; }

.modal-input {
  width: 100%; padding: 10px 12px; min-height: 40px;
  border: 1.5px solid var(--border); border-radius: var(--r-sm);
  font-size: 13px; background: rgba(250, 252, 255, 0.70); color: var(--text);
  outline: none;
}
.modal-input:focus { border-color: var(--amber); }
.modal-label { display: block; color: var(--amber); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; opacity: 0.85; }
.modal-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 20px; }

/* ════════════════════════════════════════════════════════════════
   AI THINKING ANIMATION — ARCONZA Build Assistant
   A delightful bouncing-dots loader that keeps users engaged while
   the AI processes their request. Three amber dots bounce in sequence
   with a wave-like rhythm. Includes a subtle "breathing" glow.
   ════════════════════════════════════════════════════════════════ */
.ai-thinking-dots {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
}
.ai-thinking-dots > span:nth-child(1) { /* "Thinking" text */
  margin-right: 4px;
}
/* The three bouncing dots are the <span> children after the text */
.ai-thinking-dots > span:nth-child(2),
.ai-thinking-dots > span:nth-child(3),
.ai-thinking-dots > span:nth-child(4) {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--amber, #E8923A);
  animation: aiThinkBounce 1.4s ease-in-out infinite;
  will-change: transform, opacity;
}
.ai-thinking-dots > span:nth-child(2) { animation-delay: 0s; }
.ai-thinking-dots > span:nth-child(3) { animation-delay: 0.18s; }
.ai-thinking-dots > span:nth-child(4) { animation-delay: 0.36s; }

@keyframes aiThinkBounce {
  0%, 80%, 100% {
    transform: scale(0.6) translateY(0);
    opacity: 0.4;
    box-shadow: 0 0 0 0 rgba(232,124,42,0);
  }
  40% {
    transform: scale(1.2) translateY(-6px);
    opacity: 1;
    box-shadow: 0 4px 12px rgba(232,124,42,0.3);
  }
}

/* ── AI message entrance animation ──
   New messages slide up + fade in with a gentle spring. */
.ai-message {
  animation: aiMsgIn 380ms var(--ease-out) both;
  will-change: transform, opacity;
}
@keyframes aiMsgIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── AI bot avatar pulse ──
   A subtle breathing ring on the bot's icon while thinking. */
.ai-message.ai-bot .ai-msg-icon {
  position: relative;
}
.ai-message.ai-bot.is-thinking .ai-msg-icon::after {
  content: '';
  position: absolute; inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--amber, #E8923A);
  opacity: 0;
  animation: aiAvatarPulse 1.6s ease-out infinite;
}
@keyframes aiAvatarPulse {
  0%   { opacity: 0.6; transform: scale(0.8); }
  100% { opacity: 0;   transform: scale(1.6); }
}

/* ── AI message bubble polish ── */
.ai-message {
  border-radius: 14px;
  transition: border-color 200ms ease-out, box-shadow 200ms ease-out;
}
.ai-message:hover {
  border-color: var(--border-strong);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.ai-message.ai-user {
  background: linear-gradient(135deg, var(--amber-glow), var(--bg-elev-2));
  border-color: var(--amber-border);
  margin-left: 24px;
}
.ai-message.ai-bot {
  margin-right: 12px;
}
.ai-msg-icon {
  flex-shrink: 0; width: 28px; height: 28px;
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  background: var(--amber-glow); color: var(--amber);
}
.ai-msg-type {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 4px;
}
.ai-action-btn {
  font-size: 11px; font-weight: 600;
  padding: 5px 12px; border-radius: 99px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev); color: var(--text-secondary);
  cursor: pointer; transition: all 180ms ease-out;
}
.ai-action-btn:hover {
  background: var(--amber-glow); color: var(--amber);
  border-color: var(--amber-border);
}
.ai-action-btns {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px;
}

/* ── AI status dot ── */
.ai-status-dot { width: 8px; height: 8px; border-radius: 99px; transition: all 200ms; }
.ai-status-dot.ready { background: var(--success); box-shadow: 0 0 0 0 rgba(110,155,106,0); }
.ai-status-dot.thinking {
  background: var(--amber);
  animation: aiStatusPulse 1s ease-in-out infinite;
}
@keyframes aiStatusPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232,124,42,0.4); }
  50%      { box-shadow: 0 0 0 5px rgba(232,124,42,0); }
}

/* ── AI input field focus glow ── */
.m-drawer-input input:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(232,124,42,0.12);
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .ai-thinking-dots > span:nth-child(2),
  .ai-thinking-dots > span:nth-child(3),
  .ai-thinking-dots > span:nth-child(4) { animation: none; opacity: 1; transform: none; }
  .ai-message { animation: none; }
  .ai-message.ai-bot.is-thinking .ai-msg-icon::after { animation: none; display: none; }
  .ai-status-dot.thinking { animation: none; }
}

/* Sub ledger cards — mobile-first, replaces old overflow table */
.sub-card {
  background: var(--charcoal-mid);
  border: 1px solid var(--charcoal-border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.sub-card-top {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 10px;
}
.sub-card-identity { flex: 1; min-width: 0; }
.sub-card-name {
  font-weight: 700; font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sub-card-trade {
  font-size: 11px; color: var(--amber);
  margin-top: 2px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.sub-card-meta {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.sub-card-chip {
  font-size: 10px; font-weight: 600;
  background: var(--amber-glow); color: var(--amber);
  border-radius: var(--r-pill); padding: 2px 9px;
  white-space: nowrap; letter-spacing: 0.04em;
}
.sub-card-contact {
  font-size: 11px; color: var(--text-muted);
  display: flex; align-items: center; gap: 3px;
}
.sub-card-financials {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 8px;
  background: var(--charcoal-surface);
  border-radius: 8px;
  padding: 10px 12px;
}
.sub-card-fin-item { display: flex; flex-direction: column; gap: 2px; }
.sub-card-fin-label {
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted);
}
.sub-card-fin-value {
  font-family: var(--font-mono);
  font-size: 13px; font-weight: 700;
  color: var(--text-primary);
}
.sub-card-progress {
  display: flex; align-items: center; gap: 10px;
}
.sub-card-progress-bar {
  flex: 1; height: 4px;
  background: var(--charcoal-border); border-radius: 3px;
  overflow: hidden;
}
.sub-card-progress-label {
  font-size: 10px; font-weight: 700;
  color: var(--text-muted); white-space: nowrap;
  font-family: var(--font-mono);
}
.sub-card-notes {
  font-size: 11px; color: var(--text-muted);
  border-top: 1px solid var(--divider);
  padding-top: 8px; line-height: 1.5;
  font-style: italic;
}

/* Colour Lab */
.colour-lab-root { display: block; }
.colour-lab-header { margin-bottom: 20px; }
.colour-lab-title { font-size: 20px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.colour-lab-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.colour-lab-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 800px) { .colour-lab-layout { grid-template-columns: 1fr; } }
.colour-lab-canvas-wrap {
  position: relative; background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
}
.colour-lab-canvas-wrap canvas { display: block; width: 100%; height: auto; }
.colour-lab-badge {
  position: absolute; bottom: 10px; right: 10px;
  padding: 4px 10px; background: rgba(0,0,0,0.45); color: #fff;
  border-radius: var(--r-pill); font-size: 10px; font-weight: 700; pointer-events: none;
}
.colour-lab-controls { max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.clb-section-label { font-size: 11px; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 10px; }
.clb-colour-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  background: var(--bg-elev-2); border: 1px solid var(--border);
  border-radius: var(--r-md); margin-bottom: 6px;
}
.clb-colour-label { font-size: 12px; font-weight: 600; color: var(--text); min-width: 80px; }
.clb-colour-pick { display: flex; align-items: center; gap: 6px; }
.clb-colour-pick input[type=color] { width: 36px; height: 36px; border: 2px solid var(--border); border-radius: var(--r-sm); cursor: pointer; padding: 2px; background: white; }
.clb-hex { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.clb-swatch { width: 36px; height: 36px; border-radius: var(--r-sm); border: 1px solid var(--border); margin-left: auto; }
.clb-presets { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.clb-preset-btn {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--bg-elev-2); cursor: pointer; font-size: 11px; font-weight: 600;
  font-family: inherit; color: var(--text); transition: all var(--t-fast);
}
.clb-preset-btn:hover { background: var(--bg-elev-3); border-color: var(--border-strong); }
.clb-preset-swatch { width: 20px; height: 20px; border-radius: 4px; border: 1px solid var(--border); flex-shrink: 0; }
.clb-mode-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
@media (max-width: 600px) { .clb-mode-grid { grid-template-columns: repeat(3, 1fr); } }
.clb-mode-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--bg-elev-2); cursor: pointer; font-size: 10px; font-weight: 700;
  font-family: inherit; color: var(--text-muted); transition: all var(--t-fast);
}
.clb-mode-btn.active { background: linear-gradient(135deg, var(--amber-soft), var(--amber)); color: #fff; border-color: var(--amber); box-shadow: var(--shadow-amber); }
.clb-mode-btn:hover:not(.active) { background: var(--bg-elev-3); }
.clb-mode-icon { font-size: 18px; }
.clb-sun-row { display: flex; align-items: center; gap: 10px; }
.clb-slider { flex: 1; height: 6px; -webkit-appearance: none; appearance: none; background: rgba(180, 122, 60,0.12); border-radius: 99px; outline: none; cursor: pointer; }
.clb-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--amber); border: 2px solid #fff; box-shadow: var(--shadow-amber); cursor: pointer; }
.clb-sun-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.clb-apparent-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.clb-apparent-item { background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px; text-align: center; }
.clb-apparent-swatches { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 6px; }
.clb-apparent-sw { width: 32px; height: 32px; border-radius: var(--r-sm); border: 1px solid var(--border); }
.clb-apparent-arrow { color: var(--text-faint); font-size: 14px; }
.clb-apparent-label { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.clb-apparent-hex { font-family: var(--font-mono); font-size: 10px; color: var(--text-secondary); margin-top: 2px; }

/* Suppress legacy desktop chrome */
.top-bar, .sidebar, .ai-drawer, .app-body, .main-app > .top-bar,
.welcome-screen, .project-wizard.hidden, .hamburger { display: none !important; }

/* ════════════════════════════════════════
   DISPLAY TYPOGRAPHY (modern, warm)
   ════════════════════════════════════════ */
.m-welcome-title, .hub-title, .category-hub-title, .phase-title,
.colour-lab-title, .m-modal-title, .confirm-modal-title, .modal-title,
.m-appbar-title, .m-hero-amount, .hub-cost-value, .phase-total-amount,
.section-card-title, .card-title, .dashboard-chart-title {
  font-family: var(--font-display);
}
.m-welcome-title, .hub-title, .category-hub-title, .phase-title {
  letter-spacing: -0.02em;
}

/* Crisp white cards lift gently on hover */
.m-stat, .m-phase-card, .category-card, .section-card, .card {
  transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-med) var(--ease-out), border-color var(--t-fast);
}
.m-stat:hover, .category-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}


/* ════════════════════════════════════════
   MISC HELPERS
   ════════════════════════════════════════ */
.text-right { text-align: right; }
.flex { display: flex; }
.flex-grow { flex: 1; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.font-bold { font-weight: 700; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

.m-content::-webkit-scrollbar { width: 3px; }
.m-content::-webkit-scrollbar-thumb { background: rgba(180, 122, 60,0.15); border-radius: 99px; }

/* ════════════════════════════════════════
   REDUCED MOTION
   ════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  /* M-18: keep AI thinking dots visible when motion is reduced. */
  .ai-thinking-dots span { opacity: 1; animation: none; }
}

/* ═══════════════════════════════════════════════════════════════
   SPLASH · ONBOARDING · ENHANCED GLASS  (added)
   Aesthetic warm-copper launch experience · performance-aware
   ═══════════════════════════════════════════════════════════════ */

/* ── Shared frosted-glass card (selective, GPU-friendly) ── */
.glass-card {
  background: rgba(250, 252, 255, 0.66);
  border: 1px solid rgba(255,255,255,0.55);
  box-shadow: 0 10px 34px rgba(96,72,44,0.10), inset 0 1px 0 rgba(255,255,255,0.65);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
}

/* ════════════════════════════════════════
   SPLASH SCREEN — ARCONZA redesign
   · Centered logo + wordmark + tag
   · Smooth circular progress ring (SVG) replaces the old sideways bar
   · GPU-only animations (transform / opacity / stroke-dashoffset)
   · 560ms cross-fade exit
   ════════════════════════════════════════ */
#splash-screen {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse 90% 60% at 50% 22%, rgba(123, 70, 38, 0.15), transparent 60%),
    radial-gradient(ellipse 70% 50% at 50% 100%, rgba(67, 73, 80, 0.08), transparent 60%),
    linear-gradient(160deg, #EAECEF 0%, #F4F6F9 45%, #FFFFFF 100%);
  overflow: hidden;
  transition: opacity 560ms var(--ease-out), visibility 560ms;
}
#splash-screen.splash-hide { opacity: 0; visibility: hidden; pointer-events: none; }

/* floating ambient orbs */
#splash-screen::before, #splash-screen::after {
  content: ''; position: absolute; border-radius: 50%;
  background: radial-gradient(circle, rgba(123, 70, 38, 0.12), transparent 70%);
  filter: blur(8px); pointer-events: none;
}
#splash-screen::before { width: 320px; height: 320px; top: -80px; left: -90px; animation: splashFloat 9s ease-in-out infinite alternate; }
#splash-screen::after  { width: 380px; height: 380px; bottom: -120px; right: -110px; background: radial-gradient(circle, rgba(67, 73, 80, 0.10), transparent 70%); animation: splashFloat 11s ease-in-out infinite alternate-reverse; }
@keyframes splashFloat { 0% { transform: translate(0,0) scale(1); } 100% { transform: translate(28px,-22px) scale(1.12); } }

.splash-core { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; }
.splash-logo {
  width: 104px; height: 104px;
  display: flex; align-items: center; justify-content: center;
  animation: splashLogoIn 900ms var(--ease-spring) both;
  position: relative;
}
.splash-logo img {
  width: 100%; height: 100%; object-fit: contain;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,0.18));
}
@keyframes splashLogoIn { 0% { transform: scale(0.4) translateY(20px); opacity: 0; } 100% { transform: scale(1) translateY(0); opacity: 1; } }

.splash-title {
  margin: 22px 0 4px; font-family: var(--font-display);
  font-size: 34px; font-weight: 600; letter-spacing: 0.06em;
  background: linear-gradient(160deg, var(--amber-soft) 0%, var(--amber) 45%, #2E2820 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: splashFade 700ms 200ms var(--ease-out) both;
}
.splash-tag {
  font-size: 11px; font-weight: 500; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--amber); opacity: 0.9;
  animation: splashFade 700ms 360ms var(--ease-out) both;
}
@keyframes splashFade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── Circular progress ring (replaces the old sideways bar) ──
   Uses an SVG circle with stroke-dasharray + stroke-dashoffset so the
   ring fills smoothly 0 → 100% in ~1.6s, then a gentle idle scale pulse
   gives a "live" feel without distracting from the logo.

   IMPORTANT centering note: the wrap is absolutely positioned at
   `left: 50%` and centered via `translateX(-50%)`. The entrance
   animation MUST preserve this translateX — using the shared
   `splashFade` keyframe would clobber it with `translateY(0)`,
   causing the ring to shift right. So we use a dedicated
   `splashRingFadeIn` keyframe that animates only opacity + translateY
   while keeping the -50% X offset baked in. */
.splash-ring-wrap {
  position: absolute; bottom: calc(var(--safe-bottom, 0px) + 54px); left: 50%;
  width: 44px; height: 44px;
  /* Centering transform — preserved by the entrance animation below */
  transform: translateX(-50%);
  animation: splashRingFadeIn 600ms 500ms var(--ease-out) both;
}
@keyframes splashRingFadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.splash-ring-svg {
  width: 100%; height: 100%;
  transform: rotate(-90deg); /* start fill from top — rotate around SVG center (22,22) */
  transform-origin: 50% 50%;
  filter: drop-shadow(0 2px 8px rgba(232,124,42,0.25));
  display: block; /* remove inline-SVG baseline gap */
}
.splash-ring-track { fill: none; stroke: rgba(180,122,60,0.14); stroke-width: 3; }
.splash-ring-fill {
  fill: none; stroke: url(#splashGrad); stroke-width: 3; stroke-linecap: round;
  stroke-dasharray: 113;              /* 2πr where r≈18 → ~113 */
  stroke-dashoffset: 113;
  animation: splashRingFill 1600ms 400ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes splashRingFill {
  0%   { stroke-dashoffset: 113; }
  60%  { stroke-dashoffset: 28; }
  100% { stroke-dashoffset: 0; }
}
/* After the ring fills, a gentle scale pulse keeps it alive.
   Targets the SVG (not the wrap) so the wrap's translateX(-50%) centering
   is never clobbered by the idle animation. */
.splash-ring-wrap.is-filled .splash-ring-svg {
  animation: splashRingIdle 2.4s 1.6s ease-in-out infinite;
}
@keyframes splashRingIdle {
  0%, 100% { transform: rotate(-90deg) scale(1); }
  50%      { transform: rotate(-90deg) scale(1.08); }
}

/* ════════════════════════════════════════════════════════════════
   ONBOARDING — Aura redesign · stacked morphing slides · spring feel
   GPU-only animations: transform / opacity / filter / clip-path.
   ════════════════════════════════════════════════════════════════ */
:root {
  --onb-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --onb-glide:  cubic-bezier(0.22, 1, 0.36, 1);
}

#onboarding-screen {
  position: fixed; inset: 0; z-index: 8500;
  display: flex; flex-direction: column;
  padding: 0;
  opacity: 0;
  transition: opacity 480ms var(--onb-glide);
  background-color: #1F1812;
  will-change: opacity;
  overflow: hidden;
}
#onboarding-screen.onb-show { opacity: 1; }
#onboarding-screen.onb-hide { opacity: 0; pointer-events: none; }
#onboarding-screen > :not(.onb-bg-wrap) { position: relative; z-index: 2; }

/* ── Background morph layers ─────────────────────────────────── */
.onb-bg-wrap {
  position: absolute; inset: 0; z-index: 0;
  overflow: hidden;
  will-change: transform;
  transition: transform 900ms var(--onb-glide);
}
.onb-bg {
  position: absolute; inset: -8%;
  background-size: cover; background-position: center;
  background-color: #1F1812;
  opacity: 0;
  filter: blur(18px) brightness(0.55) saturate(108%);
  transform: scale(1.18);
  transition:
    opacity 900ms var(--onb-glide),
    filter  900ms var(--onb-glide),
    transform 1400ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform, opacity, filter;
}
.onb-bg.is-active {
  opacity: 1;
  filter: blur(2px) brightness(0.62) saturate(112%);
  transform: scale(1.04);
  animation: onbKenBurns 18s ease-in-out infinite alternate;
}
@keyframes onbKenBurns {
  0%   { transform: scale(1.04) translate3d(0, 0, 0); }
  100% { transform: scale(1.12) translate3d(-2%, -1.5%, 0); }
}

.onb-bg-vignette {
  position: absolute; inset: 0; z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(0,0,0,0) 40%, rgba(0,0,0,0.55) 100%),
    linear-gradient(180deg, rgba(20,14,8,0.30) 0%, rgba(20,14,8,0.10) 35%, rgba(10,6,3,0.78) 100%);
}

/* ── Top bar ─────────────────────────────────────────────────── */
.onb-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--safe-top) + 14px) 20px 0;
}
.onb-brand {
  display: inline-flex; align-items: center; gap: 8px;
  color: rgba(255,255,255,0.92);
  font-family: var(--font-display); font-weight: 800;
  font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase;
}
.onb-brand img { border-radius: 6px; opacity: 0.95; }
.onb-skip {
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.85);
  font-weight: 600; font-size: 12px;
  padding: 8px 16px;
  border-radius: var(--r-pill);
  cursor: pointer;
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  transition: background 220ms ease-out, color 220ms ease-out, transform 160ms var(--onb-spring);
}
.onb-skip:hover { background: rgba(255,255,255,0.20); color: #fff; }
.onb-skip:active { transform: scale(0.94); }

/* ── Slide stage (stacked, only active visible) ──────────────── */
.onb-stage {
  position: relative;
  flex: 1;
  display: block;
  margin-top: 8px;
  touch-action: pan-y;
}
.onb-slide {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 8px 28px 12px;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate3d(0, 0, 0);
  will-change: transform, opacity;
}
.onb-slide.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Card — staggered children */
.onb-card {
  display: flex; flex-direction: column;
  align-items: center;
  max-width: 360px;
  width: 100%;
}

/* ── Art tile · morphing in/out ─────────────────────────────── */
.onb-art {
  position: relative;
  width: min(62vw, 248px); aspect-ratio: 1;
  margin-bottom: 30px;
  border-radius: 28px;
  overflow: hidden;
  isolation: isolate;
  box-shadow:
    0 28px 60px rgba(0,0,0,0.45),
    0 0 0 1.5px rgba(255,255,255,0.18) inset;
  transform: translateZ(0);
}
.onb-art img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 28px;
  display: block;
  transform: scale(1.02);
}
.onb-art-ring {
  position: absolute; inset: -2px;
  border-radius: 30px;
  padding: 1.5px;
  background: conic-gradient(from 140deg,
    rgba(220,225,235,0.0) 0%,
    rgba(220,225,235,0.7) 28%,
    rgba(123,70,38,0.0) 52%,
    rgba(220,225,235,0.6) 78%,
    rgba(220,225,235,0.0) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  z-index: 2;
}
.onb-art-glow {
  position: absolute; inset: 10% -25% -40% 10%;
  background: radial-gradient(60% 60% at 50% 50%, rgba(123,70,38,0.40), rgba(123,70,38,0.0) 70%);
  filter: blur(40px);
  z-index: 0;
  opacity: 0;
  pointer-events: none;
}

/* Active slide — morph art + ring + glow in */
.onb-slide.is-active .onb-art {
  animation: onbArtMorph 900ms var(--onb-spring) both;
}
.onb-slide.is-active .onb-art img {
  animation: onbArtZoom 1200ms var(--onb-glide) both;
}
.onb-slide.is-active .onb-art-ring {
  animation: onbRingSpin 1100ms var(--onb-glide) both;
}
.onb-slide.is-active .onb-art-glow {
  animation: onbGlowIn 1100ms var(--onb-glide) both;
}
@keyframes onbArtMorph {
  0%   { opacity: 0; transform: translate3d(0, 22px, 0) scale(0.86); border-radius: 60px; filter: blur(8px); }
  55%  { opacity: 1; transform: translate3d(0, -2px, 0) scale(1.02); border-radius: 30px; filter: blur(0); }
  100% { opacity: 1; transform: translate3d(0, 0, 0)     scale(1);    border-radius: 28px; filter: blur(0); }
}
@keyframes onbArtZoom {
  0%   { transform: scale(1.25); }
  100% { transform: scale(1.02); }
}
@keyframes onbRingSpin {
  0%   { opacity: 0; transform: rotate(-40deg); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: rotate(0deg); }
}
@keyframes onbGlowIn {
  0%   { opacity: 0; transform: translate3d(0, 14px, 0) scale(0.8); }
  100% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

/* ── Text · stagger ─────────────────────────────────────────── */
.onb-step-badge {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.20em; text-transform: uppercase;
  color: rgba(220,225,235,0.95);
  background: rgba(255,255,255,0.08);
  padding: 6px 14px;
  margin-bottom: 14px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(220,225,235,0.25);
  display: inline-block;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.onb-title {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(22px, 6.2vw, 28px); line-height: 1.22; letter-spacing: -0.015em;
  color: #fff; margin: 0 0 12px; max-width: 22ch;
  text-shadow: 0 2px 14px rgba(0,0,0,0.30);
}
.onb-desc {
  font-size: 14.5px; line-height: 1.65;
  color: rgba(235,240,245,0.85);
  max-width: 30ch; margin: 0;
  text-shadow: 0 1px 6px rgba(0,0,0,0.20);
}
.onb-slide.is-active .onb-step-badge { animation: onbTextRise 700ms 180ms var(--onb-spring) both; }
.onb-slide.is-active .onb-title      { animation: onbTextRise 760ms 260ms var(--onb-spring) both; }
.onb-slide.is-active .onb-desc       { animation: onbTextRise 760ms 360ms var(--onb-spring) both; }
@keyframes onbTextRise {
  0%   { opacity: 0; transform: translate3d(0, 18px, 0); filter: blur(6px); }
  100% { opacity: 1; transform: translate3d(0, 0, 0);    filter: blur(0); }
}

/* Exit (previous slide while morphing out) */
.onb-slide.is-exit-left  { animation: onbSlideOutLeft  360ms var(--onb-glide) both; }
.onb-slide.is-exit-right { animation: onbSlideOutRight 360ms var(--onb-glide) both; }
@keyframes onbSlideOutLeft {
  to { opacity: 0; transform: translate3d(-32px, 0, 0) scale(0.98); filter: blur(4px); }
}
@keyframes onbSlideOutRight {
  to { opacity: 0; transform: translate3d( 32px, 0, 0) scale(0.98); filter: blur(4px); }
}

/* ── Footer · progress pills + CTA ──────────────────────────── */
.onb-footer {
  padding: 12px 22px calc(20px + var(--safe-bottom));
  display: flex; flex-direction: column; gap: 18px;
}
.onb-progress {
  display: flex; justify-content: center; gap: 8px;
  height: 6px;
}
.onb-pill {
  flex: 0 0 28px;
  height: 6px;
  border-radius: 99px;
  background: rgba(255,255,255,0.22);
  position: relative; overflow: hidden;
  transition: flex-basis 520ms var(--onb-spring), background 320ms ease-out;
}
.onb-pill::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, #ECCBB5, #7B4626);
  transform: translateX(-101%);
  transition: transform 520ms var(--onb-glide);
  border-radius: 99px;
}
.onb-pill.is-done { background: rgba(255,255,255,0.32); }
.onb-pill.is-done::after { transform: translateX(0); }
.onb-pill.is-current {
  flex-basis: 56px;
  background: rgba(255,255,255,0.18);
}
.onb-pill.is-current::after {
  transform: translateX(0);
  animation: onbPillFill 520ms var(--onb-glide) both;
}
@keyframes onbPillFill {
  from { transform: translateX(-101%); }
  to   { transform: translateX(0); }
}

.onb-next {
  position: relative;
  width: 100%; min-height: 56px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(180deg, #FFFFFF 0%, #E2E6E9 100%);
  color: #1A2024;
  font-family: var(--font-body);
  font-size: 16px; font-weight: 700; letter-spacing: 0.01em;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow:
    0 10px 30px rgba(0,0,0,0.30),
    0 1px 0 rgba(255,255,255,0.6) inset,
    0 -1px 0 rgba(0,0,0,0.05) inset;
  transition:
    transform 200ms var(--onb-spring),
    box-shadow 280ms ease-out,
    background 320ms ease-out;
  overflow: hidden;
}
.onb-next::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(60% 80% at 50% 120%, rgba(123,70,38,0.30), transparent 70%);
  opacity: 0; transition: opacity 320ms ease-out;
}
.onb-next:hover::before { opacity: 1; }
.onb-next:active { transform: scale(0.97); }
.onb-next-label {
  position: relative; z-index: 1;
  display: inline-block;
  transition: transform 360ms var(--onb-spring), opacity 240ms ease-out;
}
.onb-next-arrow {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  transition: transform 380ms var(--onb-spring);
}
.onb-next:hover .onb-next-arrow { transform: translateX(3px); }
.onb-next.is-morph { background: linear-gradient(180deg, #ECCBB5 0%, #7B4626 100%); color: #fff; }
.onb-next.is-morph .onb-next-arrow { transform: translateX(4px) scale(1.08); }
.onb-label-swap { animation: onbLabelSwap 380ms var(--onb-spring) both; }
@keyframes onbLabelSwap {
  0%   { opacity: 0; transform: translateY(10px) scale(0.92); filter: blur(4px); }
  100% { opacity: 1; transform: translateY(0)    scale(1);    filter: blur(0); }
}

@media (prefers-reduced-motion: reduce) {
  .onb-slide.is-active .onb-art,
  .onb-slide.is-active .onb-art img,
  .onb-slide.is-active .onb-art-ring,
  .onb-slide.is-active .onb-art-glow,
  .onb-slide.is-active .onb-step-badge,
  .onb-slide.is-active .onb-title,
  .onb-slide.is-active .onb-desc,
  .onb-bg.is-active { animation: none !important; }
  .onb-slide { transition: opacity 200ms ease-out; }
}

/* ════════════════════════════════════════
   ONBOARDING SLIDE 3 — Yes/No choice buttons
   ════════════════════════════════════════ */
.onb-choice-row {
  display: flex; flex-direction: column; gap: 10px;
  width: 100%; margin-top: 20px;
  animation: onbTextRise 760ms 460ms var(--onb-glide) both;
}
.onb-choice-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px 18px;
  border-radius: 14px; border: 1.5px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  color: #F5F1EB;
  font-family: inherit; font-size: 14.5px; font-weight: 600;
  cursor: pointer;
  transition: all 220ms var(--onb-glide);
  -webkit-tap-highlight-color: transparent;
}
.onb-choice-btn:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.28);
  transform: translateY(-1px);
}
.onb-choice-btn:active { transform: scale(0.98); }
.onb-choice-btn.onb-choice-yes {
  background: linear-gradient(135deg, var(--amber) 0%, var(--amber-soft) 100%);
  border-color: var(--amber);
  color: #1F1812;
  box-shadow: 0 6px 20px rgba(232,124,42,0.30);
}
.onb-choice-btn.onb-choice-yes:hover {
  background: linear-gradient(135deg, var(--amber-soft) 0%, var(--amber) 100%);
  box-shadow: 0 8px 28px rgba(232,124,42,0.40);
}
body.desktop-mode #onboarding-screen .onb-choice-row {
  flex-direction: row;
}
body.desktop-mode #onboarding-screen .onb-choice-btn { flex: 1; }

/* ════════════════════════════════════════════════════════════════
   WALKTHROUGH TOOLTIP SYSTEM — ARCONZA
   · Spotlight overlay (dims everything except the target element)
   · Floating tooltip card with title, description, step counter
   · Next / Skip / Back controls
   · Smooth fade + scale transitions, GPU-only
   · Auto-positions tooltip above or below the target based on viewport
   ════════════════════════════════════════════════════════════════ */
#walkthrough-overlay {
  position: fixed; inset: 0; z-index: 9600;
  pointer-events: none;           /* let clicks pass through to the target */
  opacity: 0; visibility: hidden;
  transition: opacity 280ms var(--ease-out, ease-out),
              visibility 280ms;
}
#walkthrough-overlay.is-active {
  opacity: 1; visibility: visible;
  pointer-events: auto;           /* overlay catches clicks (except on the spotlight hole) */
}
/* The 4 dark panels that form the spotlight "hole" around the target.
   Each panel is a solid dark rectangle; together they cover everything
   except the target's bounding box. */
.wt-panel {
  position: fixed; background: rgba(28, 25, 23, 0.72);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  transition: all 320ms var(--ease-spring, cubic-bezier(0.34, 1.56, 0.64, 1));
  pointer-events: auto;
}
.wt-panel-top    { top: 0; left: 0; right: 0; }
.wt-panel-bottom { left: 0; right: 0; bottom: 0; }
.wt-panel-left   { left: 0; }
.wt-panel-right  { right: 0; }
/* Spotlight ring around the target (animated dashed amber border) */
.wt-spotlight {
  position: fixed; border-radius: 10px;
  border: 2px solid var(--amber, #E8923A);
  box-shadow: 0 0 0 4px rgba(232,124,42,0.18), 0 0 32px rgba(232,124,42,0.35);
  pointer-events: none;
  transition: all 320ms var(--ease-spring, cubic-bezier(0.34, 1.56, 0.64, 1));
  animation: wtPulse 1.8s ease-in-out infinite;
}
@keyframes wtPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(232,124,42,0.18), 0 0 32px rgba(232,124,42,0.35); }
  50%      { box-shadow: 0 0 0 8px rgba(232,124,42,0.10), 0 0 48px rgba(232,124,42,0.45); }
}
/* Tooltip card */
.wt-tooltip {
  position: fixed; z-index: 9601;
  max-width: 320px; min-width: 260px;
  padding: 18px 20px 16px;
  background: #FFFFFF;
  border: 1px solid rgba(180,122,60,0.15);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.20), 0 2px 8px rgba(0,0,0,0.06);
  opacity: 0; transform: translateY(8px) scale(0.96);
  transition: opacity 260ms var(--ease-out, ease-out),
              transform 260ms var(--ease-spring, cubic-bezier(0.34, 1.56, 0.64, 1));
  pointer-events: auto;
}
#walkthrough-overlay.is-active .wt-tooltip {
  opacity: 1; transform: translateY(0) scale(1);
}
.wt-tooltip::before {
  content: ''; position: absolute;
  width: 0; height: 0;
  border: 8px solid transparent;
}
/* Arrow when tooltip is BELOW the target (arrow points UP) */
.wt-tooltip.wt-below::before {
  top: -16px; left: 50%; transform: translateX(-50%);
  border-bottom-color: #FFFFFF;
}
/* Arrow when tooltip is ABOVE the target (arrow points DOWN) */
.wt-tooltip.wt-above::before {
  bottom: -16px; left: 50%; transform: translateX(-50%);
  border-top-color: #FFFFFF;
}
.wt-step-badge {
  display: inline-block; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--amber, #E8923A);
  background: rgba(232,124,42,0.10);
  padding: 3px 8px; border-radius: 99px;
  margin-bottom: 8px;
}
.wt-title {
  font-family: var(--font-display, 'Jost', sans-serif);
  font-size: 16px; font-weight: 700; color: #2E2820;
  margin: 0 0 6px; line-height: 1.3;
}
.wt-desc {
  font-size: 13px; font-weight: 400; color: #5C544A;
  line-height: 1.5; margin: 0 0 14px;
}
.wt-controls {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.wt-progress {
  font-size: 11px; font-weight: 600; color: #9C8F7E;
  letter-spacing: 0.04em;
}
.wt-btn-group { display: flex; gap: 8px; }
.wt-btn {
  font-family: inherit; font-size: 12.5px; font-weight: 600;
  padding: 8px 14px; border-radius: 10px;
  border: 1.5px solid rgba(180,122,60,0.20);
  background: transparent; color: #5C544A;
  cursor: pointer;
  transition: all 200ms var(--ease-out, ease-out);
  -webkit-tap-highlight-color: transparent;
}
.wt-btn:hover { background: rgba(180,122,60,0.08); }
.wt-btn:active { transform: scale(0.96); }
.wt-btn.wt-btn-primary {
  background: linear-gradient(135deg, var(--amber, #E8923A) 0%, var(--amber-soft, #C28543) 100%);
  border-color: var(--amber, #E8923A);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(232,124,42,0.25);
}
.wt-btn.wt-btn-primary:hover {
  box-shadow: 0 6px 16px rgba(232,124,42,0.35);
}
.wt-btn.wt-btn-skip {
  border: none; background: transparent; color: #9C8F7E;
  font-weight: 500;
}
@media (prefers-reduced-motion: reduce) {
  .wt-panel, .wt-spotlight, .wt-tooltip { transition-duration: 100ms; }
  .wt-spotlight { animation: none; }
}

/* ════════════════════════════════════════
   GLASS POLISH — welcome / hero / cards
   ════════════════════════════════════════ */

.existing-project-btn {
  background: rgba(255,253,249,0.62);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
}
.m-signin a {
  background: rgba(255,253,249,0.6);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}

.m-welcome-title {
  background: linear-gradient(135deg, var(--amber-soft) 0%, var(--amber) 55%, var(--sand-wet) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.m-welcome p { color: var(--text-secondary); max-width: 32ch; margin-left: auto; margin-right: auto; }

/* ═══════════════════════════════════════════════════════════════
   AURA LAYER — ambient mesh, frosted glass, spring transitions
   GPU-accelerated: only transform / opacity / filter animated.
   ═══════════════════════════════════════════════════════════════ */
body { position: relative; isolation: isolate; }
body::before, body::after {
  content: ""; position: fixed; inset: -20%; z-index: -1;
  pointer-events: none; will-change: transform, opacity;
  transform: translateZ(0); background-repeat: no-repeat;
}
body::before {
  background-image:
    radial-gradient(38% 32% at 18% 22%, rgba(67, 73, 80, 0.15) 0%, transparent 60%),
    radial-gradient(34% 30% at 82% 18%, rgba(123, 70, 38, 0.10) 0%, transparent 65%),
    radial-gradient(46% 40% at 70% 88%, rgba(67, 73, 80, 0.12)  0%, transparent 65%);
  animation: auraDrift 26s ease-in-out infinite alternate;
}
body::after {
  background-image:
    radial-gradient(40% 36% at 30% 80%, rgba(123, 70, 38, 0.08) 0%, transparent 65%),
    radial-gradient(30% 28% at 88% 60%, rgba(255, 255, 255, 0.40) 0%, transparent 70%),
    radial-gradient(36% 30% at 10% 50%, rgba(67, 73, 80, 0.08) 0%, transparent 70%);
  animation: auraDrift 32s ease-in-out infinite alternate-reverse;
  mix-blend-mode: soft-light; opacity: 0.9;
}
@keyframes auraDrift {
  0%   { transform: translate3d(-2%, -1%, 0) scale(1)    rotate(0deg);  }
  50%  { transform: translate3d( 3%,  2%, 0) scale(1.08) rotate(6deg);  }
  100% { transform: translate3d(-1%,  3%, 0) scale(1.04) rotate(-4deg); }
}
@media (prefers-reduced-motion: reduce) {
  body::before, body::after { animation: none; }
}
html, body { background: var(--bg); }
#main-app, #welcome-screen, #project-wizard { background: transparent; }

/* Frosted glass surfaces */
.m-bottomnav, .m-appbar, #ai-drawer,
.modal-sheet, .bottom-sheet, .m-card.glass, .aura-glass {
  background: rgba(244, 246, 249, 0.68);
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  border: 1px solid rgba(255,255,255,0.45);
  box-shadow: var(--shadow-glass);
}

/* View / tab transitions — spring fade + lift */
#content-area { position: relative; }
#content-area > * { transform: translateZ(0); }
.view-fade-enter { animation: viewEnter 400ms cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.view-fade-exit  { animation: viewExit  220ms cubic-bezier(0.4, 0, 0.2, 1) both; }
@keyframes viewEnter {
  from { opacity: 0; transform: translate3d(0, 10px, 0) scale(0.98); }
  to   { opacity: 1; transform: translate3d(0, 0,    0) scale(1);    }
}
@keyframes viewExit {
  from { opacity: 1; transform: translate3d(0, 0,    0) scale(1);    }
  to   { opacity: 0; transform: translate3d(0, -4px, 0) scale(0.98); }
}

/* AI drawer slide-in — smooth, no overshoot (fixes the "jump to left" gap on Android) */
#ai-drawer {
  transition: transform 340ms var(--ease-out);
  transform: translate3d(100%, 0, 0);
  will-change: transform;
  contain: layout style paint;
}
#ai-drawer.open { transform: translate3d(0, 0, 0); }

/* On touch devices, disable backdrop-filter during the slide to eliminate
   the one-frame repaint lag that amplifies the "jump" perception.
   The filter is re-enabled once the drawer is open via a settled class. */
@media (hover: none) and (pointer: coarse) {
  #ai-drawer { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(250,252,255,0.99); }
  #ai-drawer.open { backdrop-filter: blur(20px) saturate(120%); -webkit-backdrop-filter: blur(20px) saturate(120%); transition: transform 340ms var(--ease-out), backdrop-filter 200ms 100ms ease-out; }
}

/* Bottom-nav tap micro-interaction */
.m-tab { transition: transform 180ms var(--ease-spring), color 180ms ease-out; }
.m-tab:active { transform: scale(0.92); }
.m-tab.active { transform: translateY(-1px); }

/* Onboarding — minimal stack over aura */
#project-wizard {
  min-height: 100vh; display: flex; flex-direction: column;
  padding: 0;
}
#project-wizard h1 {
  font-family: var(--font-display); font-weight: 800; letter-spacing: -0.02em;
  font-size: clamp(28px, 7vw, 40px);
  background: linear-gradient(120deg, var(--coral) 0%, var(--amber) 55%, #6b4a2c 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* Lateral onboarding slides */
.onb-slide { will-change: transform, opacity; }
.onb-slide-enter-right { animation: onbInRight 420ms cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.onb-slide-enter-left  { animation: onbInLeft  420ms cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.onb-slide-exit-left   { animation: onbOutLeft  260ms ease-in both; }
.onb-slide-exit-right  { animation: onbOutRight 260ms ease-in both; }
@keyframes onbInRight  { from { opacity:0; transform: translate3d( 24px,0,0);} to { opacity:1; transform: translate3d(0,0,0);} }
@keyframes onbInLeft   { from { opacity:0; transform: translate3d(-24px,0,0);} to { opacity:1; transform: translate3d(0,0,0);} }
@keyframes onbOutLeft  { from { opacity:1; transform: translate3d(0,0,0);} to { opacity:0; transform: translate3d(-24px,0,0);} }
@keyframes onbOutRight { from { opacity:1; transform: translate3d(0,0,0);} to { opacity:0; transform: translate3d( 24px,0,0);} }

/* Aura buttons — micro press + glowing focus ring */
.btn, .m-btn, .btn-primary, .onb-btn {
  transition: transform 160ms var(--ease-spring),
              box-shadow 220ms ease-out,
              background-color 200ms ease-out;
  will-change: transform;
}
.btn:active, .m-btn:active, .btn-primary:active, .onb-btn:active { transform: scale(0.96); }
.btn:focus-visible, .m-btn:focus-visible, .btn-primary:focus-visible, .onb-btn:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(180,122,60,0.28),
    0 0 0 6px rgba(197,120,80,0.18),
    var(--shadow-amber);
}

/* ── Connection & Sync Status Badge ── */
.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
  border-radius: var(--r-xs, 8px);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all var(--t-fast) var(--ease-out);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.sync-badge:hover {
  filter: brightness(1.15);
}
.sync-badge:active {
  transform: scale(0.95);
}
.sync-badge svg {
  flex-shrink: 0;
}
.sync-badge.online-synced {
  background: var(--amber-glow);
  color: var(--amber);
  border: 1px solid var(--amber-border);
}
.sync-badge.offline-local {
  background: var(--bg-elev-2);
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
}
.sync-badge.unsynced {
  background: rgba(199, 121, 102, 0.08);
  border: 1px dashed var(--warning);
  color: var(--warning);
}
.sync-badge.syncing {
  background: rgba(110, 148, 176, 0.1);
  color: var(--info);
  border: 1px solid rgba(110, 148, 176, 0.3);
}

/* Spinning sync icon animation */
@keyframes sync-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.sync-spin-icon {
  animation: sync-spin 1s linear infinite;
}

/* ════════════════════════════════════════════════════════════════
   UNIFIED LOADING SYSTEM — ARCONZA
   · `.spinner` — inline spinner (for buttons, toasts, status lines)
   · `#arconza-loading-overlay` — full-screen loading overlay for
     cloud sync, project connection, data sending. Smooth fade in/out,
     non-blocking (pointer-events: none on the overlay so the user can
     still interact if needed, but with a subtle backdrop blur).
   All animations are GPU-only (transform/opacity) for 60fps.
   ════════════════════════════════════════════════════════════════ */

/* ── Inline spinner (replaces every ad-hoc spinner in the app) ── */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(180, 122, 60, 0.20);
  border-top-color: var(--amber, #E8923A);
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 6px;
  animation: arconza-spin 0.65s linear infinite;
  will-change: transform;
}
.spinner.spinner-sm  { width: 12px; height: 12px; border-width: 2px; }
.spinner.spinner-lg  { width: 28px; height: 28px; border-width: 3px; }
.spinner.spinner-xl  { width: 40px; height: 40px; border-width: 3px; }
.spinner.spinner-light {
  border-color: rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
}
.spinner.spinner-info {
  border-color: rgba(110, 148, 176, 0.20);
  border-top-color: var(--info, #6E94B0);
}
@keyframes arconza-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 1.2s; }
}

/* ── Full-screen loading overlay ──
   Shown via App.showLoading(message) / App.hideLoading().
   Non-blocking: pointer-events: none on the overlay so the user can
   still tap through, but a subtle backdrop blur + dim signals "working".
   The card is centered, fades in 220ms, fades out 180ms. */
#arconza-loading-overlay {
  position: fixed; inset: 0; z-index: 9500;
  display: flex; align-items: center; justify-content: center;
  background: rgba(28, 25, 23, 0.18);
  backdrop-filter: blur(3px) saturate(120%);
  -webkit-backdrop-filter: blur(3px) saturate(120%);
  opacity: 0; visibility: hidden;
  transition: opacity 220ms var(--ease-out, ease-out),
              visibility 220ms;
  pointer-events: none;             /* let taps pass through to the app */
}
#arconza-loading-overlay.is-visible {
  opacity: 1; visibility: visible;
}
.arconza-loading-card {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: 32px 40px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(180, 122, 60, 0.15);
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.04);
  transform: translateY(8px) scale(0.96);
  transition: transform 280ms var(--ease-spring, cubic-bezier(0.34, 1.56, 0.64, 1));
  pointer-events: auto;             /* the card itself can receive taps (e.g. to cancel) */
}
#arconza-loading-overlay.is-visible .arconza-loading-card {
  transform: translateY(0) scale(1);
}
.arconza-loading-spinner {
  width: 44px; height: 44px;
  border: 3px solid rgba(180, 122, 60, 0.15);
  border-top-color: var(--amber, #E8923A);
  border-radius: 50%;
  animation: arconza-spin 0.7s linear infinite;
  will-change: transform;
  filter: drop-shadow(0 2px 8px rgba(232, 124, 42, 0.2));
}
.arconza-loading-message {
  font-family: var(--font-body, 'Jost', sans-serif);
  font-size: 13.5px; font-weight: 600;
  color: #2E2820;
  letter-spacing: 0.01em;
  max-width: 220px; text-align: center; line-height: 1.4;
}
.arconza-loading-sub {
  font-size: 11px; font-weight: 500;
  color: rgba(46, 40, 32, 0.55);
  letter-spacing: 0.02em;
}

/* ════════════════════════════════════════════════════════════════════════
   DESKTOP / WEB MODE  ·  v2  (activated when body.desktop-mode is set)
   ════════════════════════════════════════════════════════════════════════
   Goal: real 3-column website layout (sidebar | content | AI panel) with
   a full-width top app bar. Mobile / Capacitor are NEVER touched — body
   only gets `desktop-mode` in a real browser at ≥900px.
   ──────────────────────────────────────────────────────────────────────── */

/* ── GLOBAL PERF FIXES (apply everywhere — fix desktop lag, harmless on mobile) ── */
/* M-16: global focus-visible so every interactive element gets a visible ring. */
*:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* M-23: only opt-in will-change on hover so we don't burn GPU layers. */
.m-btn { will-change: auto; }
.m-btn:hover { will-change: transform; }
.m-phase-card { will-change: auto; }
.m-phase-card:hover { will-change: transform; }
.m-list-row { will-change: auto; }
.m-list-row:hover { will-change: transform; }
.m-content { contain: layout paint style; }

body.desktop-mode {
  --desk-sidebar-w: 248px;
  --desk-ai-w: 340px;
  --desk-header-h: 60px;
  --desk-content-max: 1200px;
  --desk-gutter: 36px;
  background:
    radial-gradient(1200px 700px at 85% -10%, rgba(180,122,60,0.06), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(120,90,60,0.05), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  overflow: hidden;
}

/* Kill heavy mobile-only ambience that causes desktop lag */
body.desktop-mode .aura-bg,
body.desktop-mode .aura-layer { animation: none !important; }
body.desktop-mode .m-appbar::after,
body.desktop-mode .m-bottomnav::before,
body.desktop-mode .m-bottomnav::after { animation: none !important; display: none !important; }

/* ── Welcome / Onboarding / Wizard: centered card layout ── */
body.desktop-mode #welcome-screen.m-welcome {
  max-width: 560px; margin: 6vh auto; padding: 48px 56px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 30px 80px -40px rgba(40,28,12,0.25), 0 2px 6px rgba(40,28,12,0.04);
}
body.desktop-mode #onboarding-screen .onb-card { max-width: 760px; }
body.desktop-mode #project-wizard.m-wizard {
  max-width: 720px; margin: 4vh auto; min-height: auto;
  border: 1px solid var(--border); border-radius: 20px;
  background: var(--bg-elev); overflow: hidden;
  box-shadow: 0 30px 80px -40px rgba(40,28,12,0.22);
}
body.desktop-mode #project-wizard .m-appbar { position: relative; }

/* ════════════════════════════════════════════════════════════════════════
   MAIN APP SHELL ON DESKTOP — 3-column CSS Grid
   ──────────────────────────────────────────────────────────────────────── */
body.desktop-mode #main-app.m-app {
  display: grid;
  grid-template-columns: var(--desk-sidebar-w) minmax(0,1fr) var(--desk-ai-w);
  grid-template-rows: var(--desk-header-h) minmax(0,1fr);
  grid-template-areas:
    "sidebar appbar  appbar"
    "sidebar content aipanel";
  padding: 0;
  height: 100vh; min-height: 100vh;
  max-width: 100vw;
  overflow: hidden;
}

/* ── LEFT SIDEBAR ── */
body.desktop-mode .m-bottomnav {
  display: none !important;
}

.m-desktop-sidebar {
  display: none;
}
body.desktop-mode .m-desktop-sidebar {
  grid-area: sidebar;
  display: flex; flex-direction: column;
  height: 100vh; width: var(--desk-sidebar-w);
  background: linear-gradient(180deg, rgba(255,252,245,0.96), rgba(247,242,234,0.9));
  border-right: 1px solid var(--border);
  padding: 24px 12px 20px;
  overflow-y: auto;
  z-index: 10;
}

.m-desktop-sidebar .ds-nav-section {
  font-size: 10px; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--text-muted);
  padding: 16px 12px 6px;
}
.m-desktop-sidebar .ds-nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; font-size: 13.5px; font-weight: 500;
  color: var(--text-secondary); cursor: pointer;
  border: none; background: none; width: 100%; text-align: left;
  border-radius: 10px;
  transition: background var(--t-fast), color var(--t-fast);
  font-family: var(--font-body);
}
.m-desktop-sidebar .ds-nav-item svg {
  width: 18px; height: 18px;
  color: var(--text-secondary);
  transition: color var(--t-fast);
}
.m-desktop-sidebar .ds-nav-item:hover {
  background: var(--bg-elev-3);
  color: var(--text);
}
.m-desktop-sidebar .ds-nav-item:hover svg {
  color: var(--text);
}
.m-desktop-sidebar .ds-nav-item.active {
  background: var(--amber-glow);
  color: var(--amber);
  font-weight: 600;
}
.m-desktop-sidebar .ds-nav-item.active svg {
  color: var(--amber);
}

/* ── TOP HEADER (spans content + aipanel columns) ── */
body.desktop-mode .m-appbar {
  position: relative; top: auto; left: auto; right: auto;
  grid-area: appbar;
  height: var(--desk-header-h);
  padding: 0 var(--desk-gutter);
  gap: 12px;
  background: rgba(255,252,245,0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  z-index: 5;
}
body.desktop-mode .m-appbar-title { font-size: 17px; }
body.desktop-mode .m-appbar-eyebrow { font-size: 10px; }
body.desktop-mode .m-appbar-title-wrap { padding: 0; }

/* User dropdown anchored to header */
body.desktop-mode .m-user-dropdown {
  top: calc(var(--desk-header-h) + 4px);
  right: calc(var(--desk-ai-w) + 12px);
}

/* Hide AI toggle (AI panel is always open) */
body.desktop-mode #ai-toggle-btn,
body.desktop-mode .m-appbar [onclick*="toggleAI"] { display: none !important; }

/* ── CONTENT CANVAS ── */
body.desktop-mode #main-app .m-content {
  grid-area: content;
  height: 100%;
  min-height: 0;
  padding: 28px var(--desk-gutter) 64px;
  overflow-y: auto;
  scroll-behavior: smooth;
  contain: layout paint style;
}
body.desktop-mode #main-app .m-content > * {
  max-width: var(--desk-content-max);
  margin-left: auto; margin-right: auto;
}

/* Web typography bump */
body.desktop-mode .m-content h1,
body.desktop-mode .m-content .hub-title,
body.desktop-mode .m-content .page-title { font-size: 26px; line-height: 1.2; }
body.desktop-mode .m-content h2 { font-size: 19px; }

/* Generic grid promotion for hubs */
body.desktop-mode .m-content .hub-grid,
body.desktop-mode .m-content .card-grid,
body.desktop-mode .m-content .tile-grid,
body.desktop-mode .m-content .dashboard-grid,
body.desktop-mode .m-content .category-grid,
body.desktop-mode .m-content [data-grid="auto"] {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
body.desktop-mode .m-content .stats-row,
body.desktop-mode .m-content .stat-row,
body.desktop-mode .m-content .kpi-row,
body.desktop-mode .m-content .stat-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
body.desktop-mode .m-content .m-phase-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
/* On desktop, the "All Bills" card spans both columns so it stays
   full-width and visually separated at the bottom of the grid. */
body.desktop-mode .m-content .m-phase-grid .m-all-bills-card {
  grid-column: 1 / -1;
}
/* Same for the per-phase category-grid "All Bills" card on desktop */
body.desktop-mode .m-content .category-grid .all-bills-card {
  grid-column: 1 / -1;
}
body.desktop-mode .m-content .m-card { transition: transform var(--t-fast), box-shadow var(--t-fast); }
body.desktop-mode .m-content .m-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 40px -22px rgba(40,28,12,0.25);
}

body.desktop-mode .m-content table { width: 100%; }

/* ── FAB → bottom of content column ── */
body.desktop-mode #fab-container {
  right: calc(var(--desk-ai-w) + 28px);
  bottom: 28px;
}

/* ── AI DRAWER becomes the permanent 3rd column ── */
body.desktop-mode .m-drawer {
  position: relative !important;
  grid-area: aipanel;
  transform: none !important;
  width: 100% !important;
  height: 100%;
  max-width: none;
  border-left: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
  display: flex !important;
  flex-direction: column;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: rgba(255,252,245,0.7);
  z-index: 5;
}
body.desktop-mode .m-drawer[aria-hidden="true"] { display: flex !important; }
body.desktop-mode .m-scrim { display: none !important; }

/* ── Buttons feel desktopy ── */
body.desktop-mode .m-btn { transition: transform var(--t-fast), background var(--t-fast), box-shadow var(--t-fast); }
body.desktop-mode .m-btn:hover { transform: translateY(-1px); }

/* ── Scrollbars (subtle, web-style) ── */
body.desktop-mode .m-content::-webkit-scrollbar,
body.desktop-mode .m-bottomnav::-webkit-scrollbar,
body.desktop-mode .m-drawer-messages::-webkit-scrollbar { width: 10px; }
body.desktop-mode .m-content::-webkit-scrollbar-track,
body.desktop-mode .m-drawer-messages::-webkit-scrollbar-track { background: transparent; }
body.desktop-mode .m-content::-webkit-scrollbar-thumb,
body.desktop-mode .m-drawer-messages::-webkit-scrollbar-thumb {
  background: rgba(120,90,60,0.18); border-radius: 99px; border: 2px solid transparent; background-clip: padding-box;
}
body.desktop-mode .m-content::-webkit-scrollbar-thumb:hover,
body.desktop-mode .m-drawer-messages::-webkit-scrollbar-thumb:hover { background: rgba(120,90,60,0.32); background-clip: padding-box; }

/* ── Modals ── */
body.desktop-mode .m-modal-box { max-width: 540px; }

/* ── Tablet (600 – 899px) — wider gutters but still 1-column shell ── */
@media (min-width: 600px) and (max-width: 899px) {
  .m-content { padding: 20px 24px; }
  .m-phase-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
  /* "All Bills" card spans both columns on tablet too */
  .m-phase-grid .m-all-bills-card { grid-column: 1 / -1; }
  .category-grid .all-bills-card { grid-column: 1 / -1; }
  .stat-grid-3 { grid-template-columns: repeat(3, 1fr); }
}

/* ── Honor reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  body.desktop-mode * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ── Narrow desktop (< 1180px) — collapse AI panel to keep things readable ── */
@media (max-width: 1179px) {
  body.desktop-mode #main-app.m-app {
    grid-template-columns: var(--desk-sidebar-w) minmax(0,1fr);
    grid-template-areas:
      "sidebar appbar"
      "sidebar content";
  }
  body.desktop-mode .m-drawer {
    position: fixed !important;
    grid-area: unset;
    top: 0; right: 0; bottom: 0;
    width: 400px !important;
    border-left: 1px solid var(--border);
    transform: translateX(100%) !important;
    transition: transform .28s var(--ease-out);
    z-index: 80;
  }
  body.desktop-mode .m-drawer.open { transform: translateX(0) !important; }
  body.desktop-mode .m-scrim { display: block !important; }
  body.desktop-mode .m-scrim.open { opacity: 1; pointer-events: auto; }
  body.desktop-mode #ai-toggle-btn,
  body.desktop-mode .m-appbar [onclick*="toggleAI"] { display: inline-flex !important; }
  body.desktop-mode #fab-container { right: 28px; }
  body.desktop-mode .m-user-dropdown { right: var(--desk-gutter); }
}
/* ──────────── END DESKTOP MODE ──────────── */

/* ════════════════════════════════════════════════════════════
   ESTIMATION MODULE — Project Cost Estimation Card
   ════════════════════════════════════════════════════════════ */

/* ── Outer card ─────────────────────────────────────────────── */
.est-card {
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--t-med) var(--ease-out);
}
.est-card--collapsed { box-shadow: none; }

/* ── Card header ─────────────────────────────────────────────── */
.est-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 15px;
  cursor: pointer; user-select: none;
  border-bottom: 1px solid var(--divider);
  background: linear-gradient(160deg, var(--bg-elev) 0%, var(--bg-elev-2) 100%);
  gap: 10px;
}
.est-card--collapsed .est-card-header { border-bottom: none; }

.est-card-icon-wrap {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  background: var(--amber-glow); border: 1px solid var(--amber-border);
  display: flex; align-items: center; justify-content: center;
  color: var(--amber); flex-shrink: 0;
}
.est-card-title-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.est-card-title { font-size: 13.5px; font-weight: 700; color: var(--text); letter-spacing: 0.01em; }
.est-card-subtitle { font-size: 10.5px; color: var(--text-muted); margin-top: 1px; }

.est-card-header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.est-card-badge {
  font-size: 12px; font-weight: 600;
  color: var(--amber); background: var(--amber-glow);
  border: 1px solid var(--amber-border);
  border-radius: var(--r-pill);
  padding: 2px 10px; letter-spacing: -0.01em;
}
.est-card-badge-empty { font-size: 11px; color: var(--text-faint); font-style: italic; }
.est-collapse-icon {
  color: var(--text-muted); flex-shrink: 0;
  transition: transform var(--t-med) var(--ease-out);
}

/* ── Body (collapsible) ──────────────────────────────────────── */
.est-body {
  padding: 12px 14px 10px;
  transition: max-height var(--t-slow) var(--ease-out),
              opacity var(--t-med) var(--ease-out),
              padding var(--t-med) var(--ease-out);
  overflow: hidden;
}
@media (min-width: 480px) {
  .est-body { padding: 16px 18px 10px; }
}
.est-body--collapsed {
  max-height: 0 !important; opacity: 0;
  padding-top: 0; padding-bottom: 0; pointer-events: none;
}

/* ── Section ─────────────────────────────────────────────────── */
.est-section {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 14px 8px;
  margin-bottom: 10px;
}
.est-section-title {
  display: flex; align-items: center; gap: 7px;
  font-size: 10.5px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.13em;
  color: var(--amber); margin-bottom: 12px;
}
.est-section-num {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--amber); color: #fff;
  font-size: 10px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; letter-spacing: 0;
}

/* ── Developing fees group ───────────────────────────────────── */
.est-group {
  margin: 4px 0 6px 0;
  border-radius: var(--r-sm);
  border: 1px solid var(--amber-border);
  overflow: hidden;
}
.est-group-label {
  display: flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.11em;
  color: var(--amber); background: var(--amber-glow);
  padding: 6px 12px; border-bottom: 1px solid var(--amber-border);
}
.est-group-body { padding: 2px 10px 4px; }

/* ── Label rows ──────────────────────────────────────────────── */
/* ── Label + input row — stacked on mobile, inline on wide ───── */
.est-row {
  display: flex; flex-direction: column;
  gap: 5px; padding: 10px 0;
  border-bottom: 1px solid var(--divider);
}
.est-row:last-of-type { border-bottom: none; }
.est-row-left { display: flex; flex-direction: column; min-width: 0; }
.est-row-label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.est-row-note  { font-size: 10px; color: var(--text-muted); margin-top: 1px; }
.est-row-right { width: 100%; }

@media (min-width: 480px) {
  .est-row {
    flex-direction: row; align-items: center;
    justify-content: space-between; gap: 10px; padding: 7px 0;
  }
  .est-row-left { flex: 1; }
  .est-row-right { flex-shrink: 0; width: auto; }
}

/* ── Amount input field — full width on mobile ───────────────── */
.est-amt-wrap {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-elev-2);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 0 12px;
  width: 100%; min-height: 42px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.est-amt-wrap:focus-within {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-glow);
  background: var(--bg-elev-3);
}
@media (min-width: 480px) {
  .est-amt-wrap { width: 148px; min-height: 38px; }
}
.est-rupee { font-size: 14px; font-weight: 800; color: var(--amber); flex-shrink: 0; user-select: none; }
.est-input {
  background: none; border: none; outline: none;
  font-size: 15px; font-weight: 700;
  color: var(--text); width: 100%;
  font-family: var(--font-mono); min-width: 0;
  /* Always scroll from right so most-significant digits stay visible */
  direction: ltr; text-align: left;
}
.est-input::placeholder { color: var(--text-faint); font-weight: 400; font-size: 13px; }
.est-input::-webkit-outer-spin-button,
.est-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.est-input[type=number] { -moz-appearance: textfield; }

/* ── Sub-total row ───────────────────────────────────────────── */
.est-subtotal-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 2px 4px; margin-top: 4px;
  border-top: 1px solid var(--border-strong);
}
.est-subtotal-label {
  font-size: 10.5px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.11em; color: var(--text-muted);
}
.est-subtotal-val { font-size: 16px; font-weight: 700; color: var(--text); }

/* ── Construction trades list ────────────────────────────────── */
.est-trade-header-row {
  display: flex; align-items: center;
  padding: 0 4px 7px; border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}
.est-trades-list { display: flex; flex-direction: column; }

/* ── Individual trade accordion row ─────────────────────────── */
.est-trade-row { border-bottom: 1px solid var(--divider); }
.est-trade-row:last-child { border-bottom: none; }

.est-trade-header {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 4px; cursor: pointer; user-select: none;
  border-radius: 8px; transition: background var(--t-fast);
}
.est-trade-header:hover  { background: var(--bg-elev-3); }
.est-trade-header:active { transform: scale(0.99); }

.est-trade-icon { color: var(--text-muted); flex-shrink: 0; opacity: 0.7; }
.est-trade-name { flex: 1; font-size: 13px; font-weight: 500; color: var(--text); }
.est-trade-total {
  font-size: 12.5px; font-weight: 700; color: var(--text-secondary);
  min-width: 64px; text-align: right;
}
.est-trade-row--open .est-trade-total { color: var(--amber); }
.est-trade-chevron {
  color: var(--text-faint); flex-shrink: 0;
  transition: transform var(--t-med) var(--ease-out);
}
.est-trade-row--open .est-trade-chevron { transform: rotate(180deg); }

/* ── Trade body ──────────────────────────────────────────────── */
.est-trade-body {
  max-height: 0; overflow: hidden; opacity: 0;
  transition: max-height var(--t-slow) var(--ease-out), opacity var(--t-med) var(--ease-out);
}
.est-trade-row--open .est-trade-body { max-height: 360px; opacity: 1; }
@media (min-width: 480px) {
  .est-trade-row--open .est-trade-body { max-height: 220px; }
}

.est-trade-fields { padding: 4px 4px 14px; }
.est-trade-cols { display: flex; flex-direction: column; gap: 12px; }
.est-trade-col { display: flex; flex-direction: column; gap: 5px; }
.est-trade-col .est-amt-wrap { width: 100%; }

@media (min-width: 480px) {
  .est-trade-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
}
.est-trade-field-label {
  font-size: 10px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.10em; color: var(--text-muted);
}
.est-trade-col-total { font-size: 11px; color: var(--text-muted); padding-left: 2px; }

.est-trade-row-total {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px; padding: 8px 10px;
  background: var(--amber-glow); border: 1px solid var(--amber-border);
  border-radius: var(--r-sm);
}
.est-trade-row-total-label {
  font-size: 10px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.10em; color: var(--amber);
}
.est-trade-row-total-val { font-size: 14px; font-weight: 700; color: var(--amber); }

/* ── Grand total row ─────────────────────────────────────────── */
.est-grand-row {
  display: flex; flex-direction: column;
  background: linear-gradient(160deg, var(--bg-elev-2), var(--bg-elev-3));
  border: 1.5px solid var(--amber-border);
  border-radius: var(--r-lg);
  padding: 16px 18px; margin: 12px 0 12px;
  gap: 10px; box-shadow: 0 2px 12px var(--amber-glow);
}
@media (min-width: 480px) {
  .est-grand-row {
    flex-direction: row; align-items: center;
    justify-content: space-between; gap: 12px;
  }
}
.est-grand-left { min-width: 0; flex: 1; }
.est-grand-label {
  font-size: 10.5px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-muted); margin-bottom: 5px;
}
.est-grand-breakdown {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px;
  font-size: 11.5px; color: var(--text-muted);
}
.est-grand-breakdown .mono { font-weight: 700; color: var(--text-secondary); }
.est-grand-plus { color: var(--text-faint); font-size: 11px; }

.est-grand-diff {
  font-size: 11.5px; font-weight: 700; margin-top: 6px;
  padding: 3px 9px; border-radius: var(--r-pill); display: inline-block;
}
.est-grand-diff.over   { color: var(--danger);  background: rgba(168,69,61,0.10);  border: 1px solid rgba(168,69,61,0.18); }
.est-grand-diff.under  { color: var(--success); background: rgba(92,138,88,0.10);  border: 1px solid rgba(92,138,88,0.18); }
.est-grand-diff.match  { color: var(--amber);   background: var(--amber-glow);     border: 1px solid var(--amber-border); }

.est-grand-val {
  font-size: 28px; font-weight: 800;
  color: var(--amber); letter-spacing: -0.03em;
  /* On mobile show at top-right, on narrow stack it goes below label */
}

/* ── Action buttons ──────────────────────────────────────────── */
.est-actions {
  display: flex; flex-direction: column; gap: 10px;
  padding-bottom: 4px; margin-top: 2px;
}
@media (min-width: 400px) {
  .est-actions { flex-direction: row; flex-wrap: wrap; }
}

.est-btn-apply {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  background: linear-gradient(180deg, var(--amber-soft) 0%, var(--amber) 100%);
  color: #fff; border: none; border-radius: var(--r-md);
  font-size: 13px; font-weight: 700; font-family: var(--font-body);
  padding: 12px 16px; cursor: pointer;
  box-shadow: var(--shadow-amber);
  transition: opacity var(--t-fast), transform var(--t-fast);
  min-height: 46px;
}
.est-btn-apply:hover  { opacity: 0.91; }
.est-btn-apply:active { transform: scale(0.97); }

.est-btn-clear {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: none; color: var(--text-muted);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  font-size: 12.5px; font-weight: 600; font-family: var(--font-body);
  padding: 12px 16px; cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
  min-height: 46px;
}
.est-btn-clear:hover  { background: var(--bg-elev-3); color: var(--danger); border-color: rgba(168,69,61,0.30); }
.est-btn-clear:active { transform: scale(0.97); }

/* ── Custom Items (Add New) ───────────────────────────────────── */
.est-custom-items { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.est-custom-item {
  display: flex; flex-direction: column; align-items: stretch; gap: 6px;
  background: var(--bg-elev); border: 1px solid var(--border-strong);
  border-radius: var(--r-sm); padding: 8px 10px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.est-custom-item:focus-within {
  border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-glow);
}
.est-custom-item-main {
  display: grid; align-items: center; gap: 8px;
  grid-template-columns: minmax(76px, 1fr) minmax(96px, 112px) 32px;
}
.est-custom-item-title {
  width: 100%; min-width: 0; min-height: 38px;
  background: var(--bg-elev); border: 1px solid var(--border-strong); outline: none;
  font-size: 12.5px; font-weight: 500; color: var(--text);
  padding: 6px 7px; border-radius: var(--r-xs);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.est-custom-item-title::placeholder { color: var(--text-faint); }
.est-custom-item-title:focus {
  border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-glow);
  background: var(--bg-elev-2);
}
.est-custom-amt-wrap { width: 100%; min-width: 0; padding: 0 8px; }
.est-custom-item-amt-input::placeholder { color: var(--text-faint); font-weight: 400; }
.est-custom-item-amt-input::-webkit-outer-spin-button,
.est-custom-item-amt-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.est-custom-item-amt-input[type=number] { -moz-appearance: textfield; }
.est-custom-item-remove {
  flex-shrink: 0; width: 32px; height: 32px; border-radius: var(--r-sm);
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background var(--t-fast), color var(--t-fast);
  /* H-13: keep visual size 32px but expand hit area to 44px (WCAG 2.5.5). */
  min-width: 44px; min-height: 44px;
}
.est-custom-item-remove:hover { background: rgba(168,69,61,0.10); color: var(--danger); }
.est-custom-item-remove svg { width: 16px; height: 16px; }
.est-btn-add-custom {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; margin-top: 4px;
  background: var(--amber-glow); color: var(--amber);
  border: 1px dashed var(--amber-border); border-radius: var(--r-sm);
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.est-btn-add-custom:hover { background: var(--amber); color: #fff; border-color: var(--amber); }

@media (min-width: 560px) {
  .est-custom-item {
    flex-direction: row; align-items: center;
  }
  .est-custom-item-main {
    flex: 1; min-width: 0;
    grid-template-columns: minmax(0, 1fr) minmax(130px, 155px) 34px;
  }
  .est-custom-item-title { font-size: 13px; padding: 6px 8px; }
}

/* ── Desktop responsive ──────────────────────────────────────── */
@media (min-width: 900px) {
  .est-section   { padding: 16px 18px 10px; }
  .est-row-label { font-size: 13.5px; }
  .est-amt-wrap  { width: 155px; }
  .est-custom-amt-wrap { width: 155px; }
  .est-grand-val { font-size: 28px; }
}
/* ────────────── END ESTIMATION ────────────── */


/* ═══════════════════════════════════════════════════════════════
   MOBILE HEADER REFINEMENT — spacious, modern, premium
   (only applies when NOT in desktop-mode)
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 899px) {
  body:not(.desktop-mode) {
    --appbar-h: 72px;
  }
  body:not(.desktop-mode) .m-appbar {
    padding: var(--safe-top) 16px 0;
    gap: 10px;
  }
  body:not(.desktop-mode) .m-appbar-title-wrap {
    padding: 4px 6px;
    gap: 5px;
  }
  body:not(.desktop-mode) .m-appbar-eyebrow {
    font-size: 10.5px;
    letter-spacing: 0.2em;
    opacity: 0.9;
  }
  body:not(.desktop-mode) .m-appbar-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
  }
  body:not(.desktop-mode) .m-iconbtn {
    border-radius: 14px;
  }
  body:not(.desktop-mode) .m-content {
    padding: 18px 16px 28px;
  }
  body:not(.desktop-mode) .m-hero-card {
    padding: 24px 22px 22px;
    border-radius: 26px;
  }
  body:not(.desktop-mode) .m-hero-eyebrow {
    font-size: 11px;
    letter-spacing: 0.2em;
  }
  body:not(.desktop-mode) .m-hero-amount {
    font-size: 34px;
    margin-top: 10px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   DESKTOP REFINEMENT — keep elements grounded, not artificially huge
   ═══════════════════════════════════════════════════════════════ */
@media (min-width: 1180px) {
  body.desktop-mode .m-content { padding: 24px 28px 32px; }
  body.desktop-mode .m-hero-card {
    padding: 22px 24px;
    border-radius: 22px;
  }
  body.desktop-mode .m-hero-amount { font-size: 30px; }
}

/* Crisper cards everywhere — premium platinum surfaces */
.glass,
.m-hero-card,
.est-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

/* Cleaner cohesive hover lift on interactive surfaces */
.m-hero-card,
.est-card,
.glass {
  transition: box-shadow var(--t-med) var(--ease-out),
              transform var(--t-med) var(--ease-out),
              border-color var(--t-med) var(--ease-out);
}
@media (hover: hover) {
  .est-card:hover,
  .glass.is-interactive:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
  }
}

/* ════════════════════════════════════════
   H-12: PRINT STYLESHEET
   Hide app chrome, expand content for paper output.
   ════════════════════════════════════════ */
@media print {
  #splash-screen, #onboarding-screen, #walkthrough-overlay, #arconza-loading-overlay,
  .m-bottomnav, .m-appbar, #ai-drawer, #fab-container, .m-scrim, .m-desktop-sidebar,
  #global-search-overlay { display: none !important; }
  .m-content { overflow: visible !important; padding: 0 !important; }
  body { background: #fff !important; }
  .m-hero-card, .m-stat, .dash-breakdown-card, .dash-vendor-card { break-inside: avoid; }
}
