/* ═══════════════════════════════════════════════════════════════════
   XHALE  —  Global Stylesheet  —  Design Refresh 2026
   ═══════════════════════════════════════════════════════════════════ */

/* ── Google Fonts ──────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300;1,400&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ══════════════════════════════════════════════════════════════════
   DESIGN TOKENS
   ══════════════════════════════════════════════════════════════════ */
:root {
  --forest:       #2C4A38;
  --forest-hover: #1E3529;
  --sage:         #6F8F7A;
  --sage-mid:     #8FAA9A;
  --teal:         #79B8AE;
  --teal-light:   #C8E5E1;
  --cream:        #F5E9D6;
  --ivory:        #FAF6F0;
  --sand:         #EDE1CF;
  --charcoal:     #2A2825;
  --soft-text:    #6B6560;
  --peach:        #D9906A;
  --peach-light:  #F0D0C0;
  --lavender:     #9B8EC4;
  --lav-light:    #DDD8EF;

  --pillar-mind-bg:      #DDD8EF;
  --pillar-mind-accent:  #9B8EC4;
  --pillar-body-bg:      #D4E8E3;
  --pillar-body-accent:  #6F8F7A;
  --pillar-soul-bg:      #EDD9CC;
  --pillar-soul-accent:  #D9906A;
  --pillar-money-bg:     #D6E6DA;
  --pillar-money-accent: #2C4A38;

  --accent:       var(--sage);
  --accent-light: #C5D9D1;

  --bg:         var(--cream);
  --surface:    var(--ivory);
  --border:     var(--sand);
  --text:       var(--charcoal);
  --text-soft:  var(--soft-text);
  --primary:    var(--forest);

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'DM Sans', system-ui, -apple-system, sans-serif;

  --max-width:  480px;
  --app-width:  480px;
  --nav-height: 72px;
  --page-pad:   20px;

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 20px;
  --r-xl: 28px;

  --shadow-card:  0 2px 12px rgba(0, 0, 0, 0.06);
  --shadow-float: 0 8px 32px rgba(0, 0, 0, 0.10);
}

/* ── Dark mode ─────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:        #1C1814;
  --surface:   #251F1A;
  --border:    #3A322A;
  --text:      #F5E9D6;
  --text-soft: #7A7065;
  --primary:   var(--teal);
  --forest-hover: #5EA099;

  --pillar-mind-bg:      #2A2636;
  --pillar-mind-accent:  #9B8EC4;
  --pillar-body-bg:      #1E2E2A;
  --pillar-body-accent:  #6F8F7A;
  --pillar-soul-bg:      #2E221A;
  --pillar-soul-accent:  #D9906A;
  --pillar-money-bg:     #1A2B22;
  --pillar-money-accent: #6F8F7A;
}

/* ══════════════════════════════════════════════════════════════════
   BASE RESET
   ══════════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; height: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: var(--font-body); cursor: pointer; }
img { max-width: 100%; display: block; }

/* ══════════════════════════════════════════════════════════════════
   APP SHELL
   ══════════════════════════════════════════════════════════════════ */
.app {
  max-width: var(--app-width);
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

/* ══════════════════════════════════════════════════════════════════
   PAGE HEADER
   ══════════════════════════════════════════════════════════════════ */
.page-header {
  padding: 52px var(--page-pad) 16px;
  position: relative;
  overflow: hidden;
}

.page-header::after {
  content: '';
  position: absolute;
  top: -28px; right: -28px;
  width: 130px; height: 130px;
  border-radius: 60% 40% 55% 45% / 50% 60% 40% 50%;
  background: var(--teal);
  opacity: 0.12;
  pointer-events: none;
}

.header-top { display: flex; justify-content: space-between; align-items: flex-start; }

.greeting-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: 4px;
}

.greeting-name {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 400;
  color: var(--text);
  line-height: 1.1;
}

.header-actions { display: flex; gap: 8px; align-items: center; padding-top: 4px; }

.icon-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
  cursor: pointer;
}
.icon-btn:hover { background: var(--sand); }

.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--primary);
  color: #fff;
  border-radius: 100px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 500;
  margin-top: 10px;
  letter-spacing: 0.01em;
}

/* ── Pillar page header ────────────────────────────────────────── */
.pillar-page-header {
  padding: 52px var(--page-pad) 20px;
  position: relative;
  overflow: hidden;
}

.pillar-page-header .back-link {
  font-size: 12px;
  color: var(--text-soft);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 10px;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.pillar-page-header .back-link:hover { opacity: 1; }

.pillar-page-header h1 {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 400;
  color: var(--text);
  line-height: 1.1;
}

.pillar-page-header .page-subtitle {
  font-size: 13px;
  color: var(--text-soft);
  margin-top: 4px;
}

/* ══════════════════════════════════════════════════════════════════
   MAIN CONTENT
   ══════════════════════════════════════════════════════════════════ */
.main-content {
  flex: 1;
  padding: 0 var(--page-pad) calc(var(--nav-height) + 20px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

/* ══════════════════════════════════════════════════════════════════
   PILLAR CARD GRID
   ══════════════════════════════════════════════════════════════════ */
.pillar-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.pillar-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--r-lg);
  padding: 16px;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  transition: transform 0.18s, box-shadow 0.2s;
  min-height: 108px;
  cursor: pointer;
}
.pillar-card:active { transform: scale(0.96); }
.pillar-card:hover  { box-shadow: var(--shadow-float); }

.pillar-blob {
  position: absolute;
  bottom: -20px; right: -20px;
  width: 68px; height: 68px;
  border-radius: 55% 45% 60% 40% / 50% 55% 45% 50%;
  opacity: 0.22;
  pointer-events: none;
}

.pillar-mind  { background: var(--pillar-mind-bg); }
.pillar-body  { background: var(--pillar-body-bg); }
.pillar-soul  { background: var(--pillar-soul-bg); }
.pillar-money { background: var(--pillar-money-bg); }

.pillar-mind  .pillar-blob { background: var(--pillar-mind-accent); }
.pillar-body  .pillar-blob { background: var(--pillar-body-accent); }
.pillar-soul  .pillar-blob { background: var(--pillar-soul-accent); }
.pillar-money .pillar-blob { background: var(--pillar-money-accent); }

.pillar-icon { font-size: 18px; margin-bottom: 6px; line-height: 1; }

.pillar-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--charcoal);
  line-height: 1.1;
}
[data-theme="dark"] .pillar-name { color: var(--cream); }

.pillar-sub {
  font-size: 11px;
  color: var(--soft-text);
  margin-top: 2px;
  margin-bottom: 10px;
  flex: 1;
}
[data-theme="dark"] .pillar-sub { color: rgba(200, 184, 154, 0.55); }

.pillar-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 600;
  align-self: flex-start;
}
[data-theme="dark"] .pillar-stat { background: rgba(255, 255, 255, 0.10); }

.pillar-mind  .pillar-stat { color: var(--pillar-mind-accent); }
.pillar-body  .pillar-stat { color: var(--pillar-body-accent); }
.pillar-soul  .pillar-stat { color: var(--pillar-soul-accent); }
.pillar-money .pillar-stat { color: var(--pillar-money-accent); }

/* ══════════════════════════════════════════════════════════════════
   AFFIRMATION CARD
   ══════════════════════════════════════════════════════════════════ */
.affirmation-card {
  background: var(--primary);
  border-radius: var(--r-lg);
  padding: 20px;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.affirmation-blob {
  position: absolute;
  top: -24px; right: -24px;
  width: 90px; height: 90px;
  border-radius: 50%;
  background: var(--sage);
  opacity: 0.25;
  pointer-events: none;
}

.affirmation-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.65;
  margin-bottom: 8px;
}

.affirmation-text {
  font-family: var(--font-display);
  font-size: 17px;
  font-style: italic;
  font-weight: 300;
  line-height: 1.6;
  quotes: none;
  padding-right: 36px;
}

.affirmation-refresh {
  position: absolute;
  bottom: 14px; right: 14px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  width: 30px; height: 30px;
  border-radius: 50%;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}
.affirmation-refresh:hover { background: rgba(255, 255, 255, 0.28); }

/* ══════════════════════════════════════════════════════════════════
   QUICK LOG ROW
   ══════════════════════════════════════════════════════════════════ */
.quick-log-row { display: flex; gap: 8px; }

.quick-log-pill {
  flex: 1;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 100px;
  padding: 9px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  text-align: center;
  transition: background 0.18s, transform 0.12s;
  white-space: nowrap;
}
.quick-log-pill:active { transform: scale(0.95); background: var(--sand); }

/* ══════════════════════════════════════════════════════════════════
   BOTTOM NAV
   ══════════════════════════════════════════════════════════════════ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--app-width);
  height: var(--nav-height);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom, 0);
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 0;
  color: var(--text-soft);
  text-decoration: none;
  transition: color 0.2s;
  position: relative;
}
.nav-item.active { color: var(--primary); }
.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 3px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--primary);
}

.nav-icon  { font-size: 18px; line-height: 1; }
.nav-label { font-size: 10px; font-weight: 500; letter-spacing: 0.03em; }

.nav-center .nav-icon {
  background: var(--primary);
  color: #fff;
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 14px rgba(44, 74, 56, 0.35);
  margin-bottom: 1px;
}
.nav-center.active::after { display: none; }

/* ══════════════════════════════════════════════════════════════════
   CARD
   ══════════════════════════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 18px;
  box-shadow: var(--shadow-card);
}

.card-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 14px;
}

.card-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: 10px;
}

/* ══════════════════════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════════════════════ */
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }

.form-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-soft);
  letter-spacing: 0.04em;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
  appearance: none;
  -webkit-appearance: none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus { border-color: var(--accent); }
.form-textarea { resize: vertical; min-height: 90px; }

/* ══════════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 100px;
  padding: 13px 24px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.12s;
  text-decoration: none;
}
.btn:active        { transform: scale(0.97); }
.btn-primary       { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--forest-hover); }
.btn-outline       { background: transparent; border: 1.5px solid var(--accent); color: var(--accent); }
.btn-outline:hover { background: var(--accent-light); }
.btn-ghost         { background: transparent; color: var(--text-soft); }
.btn-ghost:hover   { background: var(--sand); }
.btn-full          { width: 100%; }
.btn-danger        { background: transparent; color: #C05555; border: 1.5px solid #E8B4B4; }

/* ══════════════════════════════════════════════════════════════════
   LOG ENTRY LIST
   ══════════════════════════════════════════════════════════════════ */
.log-list { display: flex; flex-direction: column; gap: 8px; }

.log-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}

.log-entry-body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.log-entry-text { font-size: 14px; color: var(--text); }
.log-entry-meta { font-size: 11px; color: var(--text-soft); }

.delete-btn {
  background: none;
  border: none;
  color: #C05555;
  font-size: 16px;
  cursor: pointer;
  padding: 2px 4px;
  opacity: 0.5;
  transition: opacity 0.2s;
  line-height: 1;
}
.delete-btn:hover { opacity: 1; }

/* ══════════════════════════════════════════════════════════════════
   STAT ROW
   ══════════════════════════════════════════════════════════════════ */
.stat-row { display: flex; gap: 10px; }

.stat-item {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px;
  text-align: center;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 300;
  color: var(--text);
  line-height: 1;
}
.stat-unit  { font-size: 13px; color: var(--text-soft); }
.stat-label { font-size: 11px; color: var(--text-soft); margin-top: 4px; letter-spacing: 0.04em; text-transform: uppercase; }

/* ══════════════════════════════════════════════════════════════════
   MOOD PICKER
   ══════════════════════════════════════════════════════════════════ */
.mood-picker { display: flex; gap: 6px; justify-content: space-between; }

.mood-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  border: 2px solid transparent;
  border-radius: var(--r-md);
  padding: 10px 4px;
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
  font-family: var(--font-body);
}
.mood-emoji  { font-size: 24px; }
.mood-label  { font-size: 10px; color: var(--text-soft); }
.mood-btn:hover  { border-color: var(--accent); }
.mood-btn.active { border-color: var(--accent); background: var(--accent-light); }

/* ══════════════════════════════════════════════════════════════════
   PROGRESS BAR
   ══════════════════════════════════════════════════════════════════ */
.progress-wrap { background: var(--border); border-radius: 100px; height: 8px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 100px; background: var(--accent); transition: width 0.4s ease; }

/* ══════════════════════════════════════════════════════════════════
   ALERTS
   ══════════════════════════════════════════════════════════════════ */
.alert {
  border-radius: var(--r-sm);
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.5;
  display: none;
}
.alert.visible { display: block; }
.alert-success { background: #E8F5EF; color: var(--forest); border-left: 3px solid var(--sage); }
.alert-error   { background: #FAE8E8; color: #8B3333;       border-left: 3px solid #CC5555; }
[data-theme="dark"] .alert-success { background: rgba(44,74,56,0.25);  color: var(--teal-light); }
[data-theme="dark"] .alert-error   { background: rgba(204,85,85,0.15); color: #FFAAAA; }

/* ══════════════════════════════════════════════════════════════════
   AUTH PAGES
   ══════════════════════════════════════════════════════════════════ */
.auth-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: var(--max-width);
  margin: 0 auto;
}

.auth-hero {
  background: var(--forest);
  padding: 60px var(--page-pad) 30px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.auth-hero::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 170px; height: 170px;
  border-radius: 60% 40% 55% 45% / 50% 60% 40% 50%;
  background: var(--sage);
  opacity: 0.25;
}
.auth-hero::after {
  content: '';
  position: absolute;
  bottom: -30px; left: -30px;
  width: 100px; height: 100px;
  border-radius: 50%;
  background: var(--teal);
  opacity: 0.18;
}

.auth-brand {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 300;
  color: var(--cream);
  line-height: 1;
  letter-spacing: 0.04em;
  position: relative;
  z-index: 1;
}

.auth-tagline {
  font-family: var(--font-display);
  font-size: 17px;
  font-style: italic;
  font-weight: 300;
  color: rgba(245,233,214,0.65);
  margin-top: 6px;
  line-height: 1.4;
  position: relative;
  z-index: 1;
}

.auth-card {
  flex: 1;
  background: var(--ivory);
  border-radius: 28px 28px 0 0;
  padding: 28px var(--page-pad) 40px;
  margin-top: -4px;
}

.auth-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 400;
  color: var(--charcoal);
  margin-bottom: 20px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--text-soft);
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.social-row { display: flex; gap: 10px; }
.btn-social {
  flex: 1;
  padding: 11px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  text-align: center;
  transition: background 0.2s;
  font-family: var(--font-body);
}
.btn-social:hover { background: var(--sand); }

.auth-switch { text-align: center; font-size: 13px; color: var(--text-soft); margin-top: 20px; }
.auth-switch a { color: var(--primary); font-weight: 500; }

.tab-row {
  display: flex;
  background: var(--bg);
  border-radius: 100px;
  padding: 4px;
  margin-bottom: 20px;
}
.tab-btn {
  flex: 1;
  padding: 9px;
  border: none;
  border-radius: 100px;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-soft);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  font-family: var(--font-body);
}
.tab-btn.active { background: var(--primary); color: #fff; }

/* ══════════════════════════════════════════════════════════════════
   ONBOARDING
   ══════════════════════════════════════════════════════════════════ */
.onboarding-page {
  min-height: 100dvh;
  background: var(--bg);
  padding: 52px var(--page-pad) 40px;
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.onboarding-step  { font-size: 11px; color: var(--text-soft); letter-spacing: 0.08em; text-transform: uppercase; }
.onboarding-title { font-family: var(--font-display); font-size: 30px; font-weight: 400; color: var(--text); line-height: 1.2; }

.option-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.option-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  font-family: var(--font-body);
  color: var(--text);
  font-size: 14px;
}
.option-card:hover    { border-color: var(--accent); }
.option-card.selected { border-color: var(--primary); background: rgba(44,74,56,0.06); }

/* ══════════════════════════════════════════════════════════════════
   WATER TRACKER
   ══════════════════════════════════════════════════════════════════ */
.water-tracker { display: flex; flex-direction: column; gap: 12px; }
.water-cups    { display: flex; gap: 6px; flex-wrap: wrap; }

.water-cup {
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 2px solid var(--teal-light);
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.18s, border-color 0.18s;
}
.water-cup.filled { background: var(--teal); border-color: var(--teal); }

/* ══════════════════════════════════════════════════════════════════
   UTILITY CLASSES
   ══════════════════════════════════════════════════════════════════ */
.text-display { font-family: var(--font-display); font-weight: 300; }
.text-soft    { color: var(--text-soft); }
.text-primary { color: var(--primary); }
.text-accent  { color: var(--accent); }
.text-center  { text-align: center; }
.text-sm      { font-size: 13px; }
.text-xs      { font-size: 11px; }

.flex         { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center  { display: flex; justify-content: center; align-items: center; }
.gap-sm       { gap: 8px; }
.gap-md       { gap: 14px; }

.mt-1 { margin-top: 6px; }    .mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 18px; }   .mt-4 { margin-top: 24px; }
.mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 18px; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ══════════════════════════════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════════════════════════════ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.animate-in   { animation: fadeUp 0.32s ease both; }
.animate-fade { animation: fadeIn 0.28s ease both; }

.pillar-card              { animation: fadeUp 0.32s ease both; }
.pillar-card:nth-child(2) { animation-delay: 0.06s; }
.pillar-card:nth-child(3) { animation-delay: 0.12s; }
.pillar-card:nth-child(4) { animation-delay: 0.18s; }
.affirmation-card         { animation: fadeUp 0.32s 0.22s ease both; }
.quick-log-row            { animation: fadeUp 0.32s 0.28s ease both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ══════════════════════════════════════════════════════════════════
   DESKTOP — Wide browser (500px+)
   App column looks intentional, not stretched
   ══════════════════════════════════════════════════════════════════ */
@media (min-width: 500px) {
  body { background: var(--sand, #EDE1CF); }

  .app {
    box-shadow:
      0 8px 48px rgba(0, 0, 0, 0.10),
      0 0 0 1px var(--border, #EDE1CF);
    min-height: 100vh;
  }

  .bottom-nav {
    box-shadow:
      0 -1px 0 var(--border),
      0 -8px 24px rgba(0, 0, 0, 0.04);
  }

  .auth-page,
  .ob-page {
    min-height: 100vh;
    box-shadow: 0 8px 48px rgba(0, 0, 0, 0.10);
  }

  [data-theme="dark"] body { background: #111009; }

  [data-theme="dark"] .app {
    box-shadow:
      0 8px 48px rgba(0, 0, 0, 0.35),
      0 0 0 1px rgba(255, 255, 255, 0.04);
  }
}

/* Column borders on wide screens */
@media (min-width: 480px) {
  .app,
  .bottom-nav {
    border-left:  1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}

/* ══════════════════════════════════════════════════════════════════
   DESKTOP — True desktop layout (768px+)
   Wider column, bigger components
   ══════════════════════════════════════════════════════════════════ */
@media (min-width: 768px) {
  :root {
    --max-width:  760px;
    --app-width:  1100px;
    --nav-height: 64px;
    --page-pad:   28px;
  }

  /* Real dashboard grid instead of the mobile 2-column stack */
  .pillar-grid  { grid-template-columns: repeat(4, 1fr); gap: 20px; }
  .pillar-card  { min-height: 160px; padding: 24px; }
  .pillar-name  { font-size: 24px; }
  .pillar-sub   { font-size: 14px; }
  .pillar-stat  { font-size: 12px; }
  .pillar-blob  { width: 90px; height: 90px; }

  .greeting-name    { font-size: 44px; }
  .greeting-label   { font-size: 13px; }
  .streak-badge     { font-size: 14px; padding: 7px 18px; }

  .affirmation-card { padding: 28px; }
  .affirmation-text { font-size: 20px; }

  .quick-log-row  { gap: 12px; }
  .quick-log-pill { padding: 14px 16px; font-size: 14px; }

  .card       { padding: 24px; }
  .card-title { font-size: 26px; }

  .page-header,
  .pillar-page-header { padding-top: 32px; }

  .pillar-page-header h1             { font-size: 48px; }
  .pillar-page-header .page-subtitle { font-size: 15px; }

  .stat-value { font-size: 36px; }

  .btn { padding: 14px 28px; font-size: 15px; }

  /* Drop the "floating phone card" treatment — this is a real site now */
  .app {
    box-shadow: none;
    border-left: none;
    border-right: none;
    padding-top: var(--nav-height);
  }
  [data-theme="dark"] .app { box-shadow: none; }

  /* Bottom tab bar becomes a top nav bar on desktop */
  .bottom-nav {
    top: 0;
    bottom: auto;
    max-width: var(--app-width);
    border-top: none;
    border-bottom: 1px solid var(--border);
    border-left: none;
    border-right: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
    justify-content: center;
    gap: 4px;
  }

  .main-content { padding-bottom: 40px; }

  .nav-item {
    flex: 0 1 auto;
    flex-direction: row;
    padding: 0 20px;
    gap: 8px;
  }
  .nav-item.active::after { bottom: 0; }
  .nav-icon   { font-size: 22px; }
  .nav-label  { font-size: 12px; }

  /* The raised center button only makes sense on a bottom tab bar */
  .nav-center .nav-icon {
    background: none;
    color: inherit;
    width: auto; height: auto;
    box-shadow: none;
    border-radius: 0;
    font-size: 22px;
    margin-bottom: 0;
  }
}

/* ══════════════════════════════════════════════════════════════════
   MOBILE — Standard phones (up to 430px)
   ══════════════════════════════════════════════════════════════════ */
@media (max-width: 430px) {
  :root {
    --page-pad:   22px;
    --nav-height: 76px;
  }

  .greeting-name  { font-size: 36px; }
  .greeting-label { font-size: 12px; }
  .streak-badge   { font-size: 13px; padding: 6px 16px; }

  .pillar-grid  { gap: 14px; }
  .pillar-card  { min-height: 126px; padding: 18px; }
  .pillar-name  { font-size: 20px; }
  .pillar-sub   { font-size: 12px; }
  .pillar-icon  { font-size: 20px; margin-bottom: 8px; }
  .pillar-stat  { font-size: 11px; padding: 4px 10px; }
  .pillar-blob  { width: 80px; height: 80px; bottom: -24px; right: -24px; }

  .affirmation-card  { padding: 22px; }
  .affirmation-text  { font-size: 19px; }
  .affirmation-label { font-size: 11px; }

  .quick-log-pill { padding: 12px 10px; font-size: 13px; }

  .nav-icon  { font-size: 20px; }
  .nav-label { font-size: 11px; }
  .nav-center .nav-icon { width: 46px; height: 46px; font-size: 22px; }

  .card       { padding: 20px; }
  .card-title { font-size: 22px; }

  .pillar-page-header h1             { font-size: 38px; }
  .pillar-page-header .page-subtitle { font-size: 14px; }

  .stat-value { font-size: 32px; }
  .btn        { padding: 15px 24px; font-size: 15px; }

  .form-input,
  .form-select,
  .form-textarea { font-size: 16px; padding: 14px; }
  .form-label    { font-size: 13px; }

  .log-entry-text { font-size: 15px; }
  .log-entry-meta { font-size: 12px; }

  .auth-brand   { font-size: 54px; }
  .auth-tagline { font-size: 18px; }
  .auth-title   { font-size: 28px; }
  .auth-hero    { padding: 70px var(--page-pad) 32px; }
  .auth-card    { padding: 30px var(--page-pad) 48px; }

  .step-title         { font-size: 32px; }
  .pillar-select-card { min-height: 110px; padding: 18px; }
  .psc-name           { font-size: 19px; }
  .lifestyle-option   { padding: 16px; }
  .lo-label           { font-size: 15px; }
}

/* ══════════════════════════════════════════════════════════════════
   MOBILE — Extra small phones (≤375px)
   ══════════════════════════════════════════════════════════════════ */
@media (max-width: 375px) {
  .pillar-card   { min-height: 114px; padding: 14px; }
  .pillar-name   { font-size: 17px; }
  .greeting-name { font-size: 30px; }
  .card-title    { font-size: 20px; }

  .quick-log-row  { flex-wrap: wrap; }
  .quick-log-pill { flex: 0 0 calc(50% - 4px); }
}

/* ══════════════════════════════════════════════════════════════════
   iOS INPUT ZOOM PREVENTION
   ══════════════════════════════════════════════════════════════════ */
@supports (-webkit-touch-callout: none) {
  .form-input,
  .form-select,
  .form-textarea {
    font-size: 16px !important;
  }
}