/* ═══════════════════════════════════════════
   STRIVE PRO — Botanical Journal Design System
   ═══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600&display=swap');

/* ─── VARIABLES ─── */
:root {
  --cream:       #f8f1e7;
  --cream-mid:   #ede2cf;
  --cream-dark:  #ddd0b8;
  --parchment:   #fefcf8;
  --forest:      #1c3329;
  --forest-2:    #2d5040;
  --green:       #4a8c62;
  --green-2:     #5fa878;
  --green-pale:  #c6e8d4;
  --green-faint: #edf8f1;
  --amber:       #e09c3a;
  --amber-2:     #f0b84a;
  --amber-pale:  #fdecc8;
  --terra:       #c85d3e;
  --terra-pale:  #fde0d6;
  --sky:         #5a9ec0;
  --sky-pale:    #d4ecf8;
  --lavender:    #9080c0;
  --lav-pale:    #e8e4f4;
  --sage:        #8ab8a0;
  --coral:       #e87868;
  
  --text:        #1a2e22;
  --text-2:      #3a5848;
  --text-muted:  #7a9888;
  --white:       #fefcf8;

  --r-sm:  10px;
  --r-md:  18px;
  --r-lg:  28px;
  --r-xl:  40px;
  --r-pill: 999px;

  --shadow-1: 0 2px 12px rgba(30,60,40,0.07);
  --shadow-2: 0 6px 28px rgba(30,60,40,0.10);
  --shadow-3: 0 12px 48px rgba(30,60,40,0.14);
  --shadow-up: 0 -4px 20px rgba(30,60,40,0.06);
}

/* ─── RESET ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background-color: var(--cream);
  background-image:
    radial-gradient(ellipse at 10% 15%, rgba(74,140,98,.07) 0%, transparent 55%),
    radial-gradient(ellipse at 90% 85%, rgba(224,156,58,.07) 0%, transparent 55%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%234a8c62' fill-opacity='0.025'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--green-pale); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--sage); }

/* ─── APP SHELL ─── */
#app {
  display: flex;
  min-height: 100vh;
}

/* ════════════════════════════════
   SIDEBAR
════════════════════════════════ */
.sidebar {
  width: 250px;
  min-height: 100vh;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
  overflow-y: auto;
  z-index: 200;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--forest);
  background-image:
    radial-gradient(circle at 20% 5%, rgba(90,168,120,.22) 0%, transparent 55%),
    radial-gradient(circle at 80% 95%, rgba(224,156,58,.14) 0%, transparent 50%);
  padding: 28px 18px 24px;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 36px;
  padding: 0 6px;
}
.logo-leaf {
  font-size: 28px;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(90,200,100,.3));
  animation: leafSway 4s ease-in-out infinite;
}
@keyframes leafSway {
  0%, 100% { transform: rotate(-5deg); }
  50%       { transform: rotate(5deg); }
}
.logo-text {
  font-family: 'Playfair Display', serif;
  font-size: 21px;
  font-weight: 700;
  color: var(--cream);
  letter-spacing: -.3px;
}
.logo-pro { color: var(--amber-2); margin-left: 2px; }
.logo-tagline { font-size: 10px; color: var(--sage); letter-spacing: .8px; text-transform: uppercase; margin-top: 1px; }

/* Nav menu */
.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  color: var(--sage);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 500;
  transition: background .25s, color .25s, transform .2s;
  cursor: pointer;
}
.nav-item:hover {
  background: rgba(255,255,255,.08);
  color: var(--cream);
  transform: translateX(3px);
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(74,140,98,.3), rgba(74,140,98,.15));
  color: var(--green-pale);
  border-left: 3px solid var(--green-2);
}
.nav-icon { font-size: 17px; }

.sidebar-spacer { flex: 1; }

/* Load Guard Widget in sidebar */
.load-guard-widget {
  background: rgba(255,255,255,.07);
  border-radius: var(--r-md);
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,.06);
}
.lgw-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.lgw-title { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--sage); opacity: .8; }
.lgw-pct { font-size: 12px; font-weight: 600; color: var(--green-pale); }
.lgw-track { height: 6px; background: rgba(255,255,255,.12); border-radius: 3px; overflow: hidden; }
.lgw-fill {
  height: 100%;
  border-radius: 3px;
  width: 0%;
  transition: width .6s ease, background .4s ease;
  background: var(--green);
}
.lgw-status { font-size: 11.5px; color: var(--sage); margin-top: 7px; }

/* Mobile nav button */
.mobile-nav-btn {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 999;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--forest);
  color: var(--cream);
  border: none;
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-3);
}

/* ════════════════════════════════
   MAIN CONTENT
════════════════════════════════ */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 38px 44px;
  overflow-y: auto;
}

/* ─── VIEWS ─── */
.view { display: none; animation: fadeUp .4s ease; }
.view.active { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── PAGE HEADER ─── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 34px;
  gap: 20px;
}
.greeting-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--green);
  background: var(--green-faint);
  padding: 4px 12px;
  border-radius: var(--r-pill);
  margin-bottom: 10px;
}
.page-title {
  font-family: 'Playfair Display', serif;
  font-size: 34px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
  margin-bottom: 7px;
}
.page-quote {
  font-size: 14px;
  color: var(--text-muted);
  font-style: italic;
}

/* ─── BUTTONS ─── */
.btn-plant {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--forest);
  color: var(--cream);
  border: none;
  padding: 13px 26px;
  border-radius: var(--r-pill);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all .25s ease;
  box-shadow: 0 4px 20px rgba(28,51,41,.28);
}
.btn-plant:hover {
  background: var(--forest-2);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(28,51,41,.32);
}
.btn-plant .btn-icon {
  font-size: 18px;
  font-weight: 300;
  line-height: 1;
}
.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 2px solid var(--cream-dark);
  padding: 11px 22px;
  border-radius: var(--r-pill);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  cursor: pointer;
  transition: all .2s;
}
.btn-ghost:hover { background: var(--cream-mid); }

/* ════════════════════════════════
   OVERVIEW GRID
════════════════════════════════ */
.overview-grid {
  display: grid;
  grid-template-columns: 2.2fr 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 36px;
}

.ov-card {
  background: var(--parchment);
  border-radius: var(--r-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-1);
  border: 1.5px solid rgba(255,255,255,.85);
  position: relative;
  overflow: hidden;
  transition: transform .25s, box-shadow .25s;
}
.ov-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-2);
}
.ov-card::after {
  content: '';
  position: absolute;
  top: -24px; right: -24px;
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--green-faint);
  pointer-events: none;
}
.ov-main::after { background: var(--green-faint); }
.ov-icon { font-size: 26px; margin-bottom: 6px; line-height: 1; }
.ov-label { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--text-muted); margin-bottom: 6px; font-weight: 600; }
.ov-value {
  font-family: 'Playfair Display', serif;
  font-size: 36px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.ov-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

.ov-bar-track { height: 5px; background: var(--cream-mid); border-radius: 3px; margin-top: 10px; overflow: hidden; }
.ov-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .7s ease;
  background: linear-gradient(90deg, var(--terra) 0%, var(--amber) 50%, var(--green) 100%);
  background-size: 200% 100%;
}

.ov-level { background: linear-gradient(135deg, #f8f1e7, #edf8f1); }
.ov-level-icon { font-size: 28px; margin-bottom: 4px; }
.ov-level-name { font-size: 22px !important; color: var(--green); }

/* ════════════════════════════════
   HABIT SECTION
════════════════════════════════ */
.section-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}
.section-title {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
}

.filter-group { display: flex; gap: 7px; flex-wrap: wrap; }
.filter-chip {
  padding: 6px 15px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--cream-dark);
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-2);
  transition: all .2s;
}
.filter-chip:hover, .filter-chip.active {
  background: var(--forest);
  color: var(--cream);
  border-color: var(--forest);
}

/* ─── HABITS GRID ─── */
.habits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(295px, 1fr));
  gap: 18px;
}

/* ════════════════════════════════
   HABIT CARD
════════════════════════════════ */
.habit-card {
  background: var(--parchment);
  border-radius: var(--r-lg);
  padding: 22px 22px 18px;
  border: 2px solid transparent;
  box-shadow: var(--shadow-1);
  position: relative;
  overflow: hidden;
  transition: transform .3s ease, box-shadow .3s ease, border-color .3s;
  cursor: default;
}
.habit-card:hover {
  transform: translateY(-5px) rotate(.3deg);
  box-shadow: var(--shadow-2);
}
.habit-card.completed {
  border-color: var(--green-2);
  background: linear-gradient(160deg, var(--parchment) 0%, #eef8f2 100%);
}
.habit-card.stack-alert {
  border-color: var(--amber);
  animation: stackPulse 2s ease infinite;
}
@keyframes stackPulse {
  0%, 100% { box-shadow: var(--shadow-1); }
  50%       { box-shadow: 0 0 0 6px rgba(224,156,58,.2), var(--shadow-1); }
}

/* Top accent stripe */
.hc-stripe {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
/* Decorative leaf bg */
.habit-card::before {
  content: '';
  position: absolute;
  bottom: -18px; right: -18px;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(74,140,98,.04);
  pointer-events: none;
}

/* Card menu button */
.hc-menu {
  position: absolute;
  top: 14px; right: 14px;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
  line-height: 1;
  z-index: 2;
}
.hc-menu:hover { background: var(--cream-mid); }

/* Card header */
.hc-head {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  margin-bottom: 14px;
  margin-top: 2px;
}
.hc-emoji {
  font-size: 34px;
  line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.1));
}
.hc-name {
  font-family: 'Playfair Display', serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.3;
}
.hc-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.hc-tag {
  font-size: 10.5px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.tag-checkpoint { background: #deeaf8; color: #2a5898; }
.tag-quantity   { background: var(--lav-pale); color: #5040a0; }
.tag-focus      { background: var(--green-faint); color: #2a6a42; }
.tag-easy       { background: #daf5e4; color: #1e6a3a; }
.tag-medium     { background: var(--amber-pale); color: #8a5a10; }
.tag-hard       { background: var(--terra-pale); color: #8a3020; }

/* Momentum bar */
.hc-momentum { margin-bottom: 14px; }
.hc-mom-row {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.hc-mom-score { font-weight: 700; color: var(--text); }
.hc-mom-track { height: 8px; background: var(--cream-mid); border-radius: 4px; overflow: hidden; }
.hc-mom-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .5s ease;
  position: relative;
}
.hc-mom-fill::after {
  content: '';
  position: absolute;
  top: 1px; left: 6px; right: 6px;
  height: 3px;
  background: rgba(255,255,255,.35);
  border-radius: 2px;
}

/* Streak pill */
.hc-streak {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--amber-pale);
  color: var(--amber);
  padding: 5px 11px;
  border-radius: var(--r-pill);
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 14px;
}

/* Stack hint */
.hc-stack-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--cream-mid);
}
.hc-stack-notify {
  font-size: 12px;
  color: var(--amber);
  font-weight: 600;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ── Action Areas ── */
/* Checkbox */
.action-checkbox {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--r-md);
  border: 2px solid var(--cream-dark);
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-2);
  transition: all .3s ease;
}
.action-checkbox:hover:not(:disabled) {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-faint);
}
.action-checkbox.done {
  background: var(--green);
  color: white;
  border-color: var(--green);
  cursor: default;
}
.action-checkbox:disabled { opacity: .8; }

/* Quantity */
.action-quantity { display: flex; align-items: center; gap: 12px; }
.qty-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid var(--cream-dark);
  background: var(--parchment);
  font-size: 20px;
  font-weight: 300;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text);
  transition: all .2s;
  flex-shrink: 0;
}
.qty-btn:hover { background: var(--cream-mid); border-color: var(--text-muted); }
.qty-progress { flex: 1; min-width: 0; }
.qty-nums { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-bottom: 5px; }
.qty-current { font-size: 15px; font-weight: 700; color: var(--text); }
.qty-track { height: 8px; background: var(--cream-mid); border-radius: 4px; overflow: hidden; }
.qty-fill { height: 100%; border-radius: 4px; transition: width .3s ease; }

/* Focus Timer */
.action-focus {}
.timer-face {
  font-family: 'Playfair Display', serif;
  font-size: 30px;
  font-weight: 700;
  text-align: center;
  color: var(--text);
  letter-spacing: 3px;
  margin-bottom: 10px;
}
.timer-btns { display: flex; gap: 8px; }
.timer-btn {
  flex: 1;
  padding: 10px 8px;
  border-radius: var(--r-sm);
  border: 2px solid var(--cream-dark);
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  color: var(--text-2);
}
.timer-btn.running { background: var(--amber); color: white; border-color: var(--amber); }
.timer-btn.start   { background: var(--forest); color: white; border-color: var(--forest); }
.timer-btn.reset   { color: var(--text-muted); }
.timer-btn:hover   { opacity: .85; }
.timer-progress { height: 4px; background: var(--cream-mid); border-radius: 2px; margin-bottom: 10px; overflow: hidden; }
.timer-progress-fill { height: 100%; background: var(--sky); border-radius: 2px; transition: width .5s ease; }

/* ─── EMPTY STATE ─── */
.empty-state {
  display: none;
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
}
.es-art { margin-bottom: 20px; }
.empty-state h3 {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  color: var(--text);
  margin-bottom: 8px;
}
.empty-state p { font-size: 14px; margin-bottom: 24px; }

/* ════════════════════════════════
   ARBORETUM
════════════════════════════════ */
.arboretum-card {
  background: var(--parchment);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-2);
  border: 2px solid rgba(255,255,255,.7);
  margin-bottom: 24px;
}

.tree-detail {
  background: var(--parchment);
  border-radius: var(--r-lg);
  padding: 28px;
  box-shadow: var(--shadow-2);
  position: relative;
  animation: fadeUp .3s ease;
  border: 2px solid rgba(255,255,255,.7);
}
.td-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--cream-mid);
  cursor: pointer;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: background .2s;
}
.td-close:hover { background: var(--cream-dark); }

/* ════════════════════════════════
   STATS / ANALYTICS
════════════════════════════════ */
.chart-card {
  background: var(--parchment);
  border-radius: var(--r-lg);
  padding: 28px;
  box-shadow: var(--shadow-1);
  border: 2px solid rgba(255,255,255,.7);
  margin-bottom: 20px;
}
.chart-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 14px;
}
.chart-title {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  color: var(--text);
  margin-bottom: 8px;
}
.chart-legend { display: flex; gap: 16px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-muted); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.legend-dot.green { background: var(--green); }
.legend-dot.ghost { background: transparent; border: 2px dashed var(--amber); width: 12px; height: 12px; }

.habit-select-input {
  padding: 10px 14px;
  border-radius: var(--r-sm);
  border: 2px solid var(--cream-dark);
  background: var(--cream);
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  color: var(--text);
  outline: none;
  cursor: pointer;
  min-width: 200px;
  transition: border-color .2s;
}
.habit-select-input:focus { border-color: var(--green); }

#ghostCanvas {
  display: block;
  width: 100% !important;
  height: 260px !important;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.stat-tile {
  background: var(--parchment);
  border-radius: var(--r-lg);
  padding: 22px 18px;
  text-align: center;
  box-shadow: var(--shadow-1);
  border: 2px solid rgba(255,255,255,.7);
  transition: transform .2s, box-shadow .2s;
}
.stat-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.st-icon { font-size: 28px; margin-bottom: 8px; }
.st-val {
  font-family: 'Playfair Display', serif;
  font-size: 34px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 5px;
  line-height: 1;
}
.st-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }

/* ════════════════════════════════
   MODAL
════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28,51,41,.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}
.modal-backdrop.open {
  opacity: 1;
  pointer-events: all;
}
.modal-box {
  background: var(--parchment);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-3);
  transform: translateY(32px) scale(.96);
  transition: transform .38s cubic-bezier(.34,1.56,.64,1);
  border: 2px solid rgba(255,255,255,.8);
}
.modal-backdrop.open .modal-box { transform: translateY(0) scale(1); }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 28px 0;
}
.modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  color: var(--text);
}
.modal-x {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--cream-mid);
  border: none;
  cursor: pointer;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: background .2s;
}
.modal-x:hover { background: var(--cream-dark); }

.modal-body { padding: 22px 28px; }
.modal-footer {
  padding: 0 28px 28px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Form fields */
.field-group { margin-bottom: 20px; }
.field-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-2);
  margin-bottom: 8px;
}
.field-input {
  width: 100%;
  padding: 12px 15px;
  border-radius: var(--r-sm);
  border: 2px solid var(--cream-dark);
  background: var(--cream);
  font-family: 'DM Sans', sans-serif;
  font-size: 14.5px;
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(74,140,98,.12);
}
.field-select { appearance: none; cursor: pointer; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; font-style: italic; }

/* Emoji row */
.emoji-name-row { display: flex; gap: 10px; position: relative; }
.emoji-trigger {
  font-size: 22px;
  width: 50px; height: 50px;
  border-radius: var(--r-sm);
  border: 2px solid var(--cream-dark);
  background: var(--cream);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color .2s, transform .15s;
  display: flex; align-items: center; justify-content: center;
}
.emoji-trigger:hover { border-color: var(--green); transform: scale(1.05); }

.emoji-picker-panel {
  position: absolute;
  top: 56px; left: 0;
  background: var(--parchment);
  border-radius: var(--r-md);
  padding: 12px;
  box-shadow: var(--shadow-3);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  width: 240px;
  z-index: 600;
  border: 2px solid rgba(255,255,255,.8);
  animation: fadeUp .2s ease;
}
.ep-btn {
  font-size: 22px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--r-sm);
  transition: background .15s, transform .1s;
  line-height: 1;
}
.ep-btn:hover { background: var(--cream-mid); transform: scale(1.1); }

/* Color swatches */
.color-swatches { display: flex; gap: 9px; flex-wrap: wrap; }
.color-swatch {
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all .2s;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.15);
}
.color-swatch:hover    { transform: scale(1.15); }
.color-swatch.selected { border-color: var(--text); transform: scale(1.2); box-shadow: 0 0 0 2px var(--parchment), 0 0 0 4px var(--text); }

/* Cognitive Load Alert */
.load-alert {
  background: #fffbf0;
  border: 2px solid var(--amber);
  border-radius: var(--r-md);
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-top: 4px;
  animation: fadeUp .3s ease;
}
.la-icon { font-size: 24px; flex-shrink: 0; margin-top: 2px; }
.la-body strong { display: block; color: var(--text); margin-bottom: 4px; font-size: 14px; }
.la-body p { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.la-proceed {
  display: inline-block;
  margin-top: 10px;
  padding: 7px 16px;
  background: var(--amber);
  color: white;
  border: none;
  border-radius: var(--r-pill);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s;
}
.la-proceed:hover { opacity: .85; }

/* ════════════════════════════════
   CONTEXT MENU
════════════════════════════════ */
.ctx-menu {
  position: fixed;
  background: var(--parchment);
  border-radius: var(--r-md);
  padding: 6px;
  box-shadow: var(--shadow-3);
  z-index: 800;
  min-width: 150px;
  animation: fadeUp .15s ease;
  border: 2px solid rgba(255,255,255,.8);
}
.ctx-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  border-radius: var(--r-sm);
  color: var(--text);
  transition: background .15s;
  white-space: nowrap;
}
.ctx-item:hover { background: var(--cream-mid); }
.ctx-item.danger { color: var(--terra); }
.ctx-item.danger:hover { background: var(--terra-pale); }

/* ════════════════════════════════
   TOAST
════════════════════════════════ */
#toastContainer {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--forest);
  color: var(--cream);
  padding: 13px 18px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  line-height: 1.4;
  max-width: 310px;
  box-shadow: var(--shadow-3);
  pointer-events: all;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border-left: 4px solid var(--green);
  animation: toastIn .4s cubic-bezier(.34,1.56,.64,1);
}
.toast.success  { border-color: var(--green); }
.toast.warning  { border-color: var(--amber); background: #2e2a18; }
.toast.celebrate{ border-color: var(--amber-2); background: var(--forest-2); }
.toast.out { animation: toastOut .3s ease forwards; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(28px) scale(.9); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(28px); }
}

/* ════════════════════════════════
   CONFETTI
════════════════════════════════ */
#confettiCanvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  width: 100%;
  height: 100%;
}

/* ════════════════════════════════
   RESPONSIVE
════════════════════════════════ */
@media (max-width: 1100px) {
  .overview-grid { grid-template-columns: 1fr 1fr 1fr 1fr; }
  .ov-main { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .main-content { padding: 28px 24px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .overview-grid { grid-template-columns: 1fr 1fr; }
  .ov-main { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
  .sidebar { position: fixed; left: -260px; transition: left .3s ease; }
  .sidebar.open { left: 0; }
  .mobile-nav-btn { display: flex; align-items: center; justify-content: center; }
  .main-content { padding: 20px 16px; }
  .page-title { font-size: 26px; }
  .overview-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .habits-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .chart-top { flex-direction: column; }
  .habit-select-input { min-width: 100%; }
  .page-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .overview-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .btn-plant { font-size: 13px; padding: 11px 20px; }
}

/* ─── Tree hover tooltip ─── */
.tree-tooltip {
  pointer-events: none;
  position: absolute;
  background: var(--forest);
  color: var(--cream);
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  white-space: nowrap;
  box-shadow: var(--shadow-2);
  z-index: 300;
  opacity: 0;
  transition: opacity .2s;
}
.tree-tooltip.visible { opacity: 1; }
