/* === DESIGN SYSTEM & SETUP === */
:root {
  --font-sans: 'Ubuntu', -apple-system, BlinkMacSystem-Font, 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
  --font-mono: 'Wix Madefor Display', 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;

  --color-bg: #0B0B0F;
  --color-bg-gradient-start: #1C1C21;
  --color-bg-gradient-end: #0B0B0F;
  
  --color-surface-1: #1C1C21;
  --color-surface-2: #2A2A30;
  --color-surface-inset: rgba(255, 255, 255, 0.03);

  --color-text-primary: #F0F2F5;
  --color-text-secondary: #A0AEC0;
  --color-text-tertiary: #718096;
  
  --color-border: rgba(255, 255, 255, 0.08);
  --color-border-hover: rgba(79, 138, 245, 0.4);
  --color-border-focus: #4F8AF5;

  --color-primary: #4F8AF5;
  --color-primary-gradient: linear-gradient(135deg, #3b82f6, #60a5fa);
  --color-shadow-primary: rgba(79, 138, 245, 0.2);
  --color-success: #4ade80;
  --color-warning: #facc15;
  --color-danger: #f87171;
  --color-info: #38bdf8;

  /* === HEADER SIZE CONTROLS === */
  /* Adjust --header-scale to resize the entire header/scores section (0.7 = 70%, 1.0 = 100%, etc.) */
  --header-scale: 0.75; /* DEFAULT: 0.75 (75% size) - Change this single value to scale everything */
  
  --score-ring-size: calc(96px * var(--header-scale)); /* Base: 96px */
  --score-ring-stroke: calc(10px * var(--header-scale)); /* Base: 10px */
  --score-gap: calc(20px * var(--header-scale)); /* Base: 20px */
  --header-padding: calc(1px * var(--header-scale)); /* Base: 1px */

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4), inset 0 1px 0 var(--color-surface-inset);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);

  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  --sleep: #1e90ff; /* Blue */
  --fitness: #ff3b30; /* Red */
  --mind: #7c3aed; /* Purple */
  --spirit: #16a34a; /* Green */
  
  /* Spirit widget mood colors */
  --color-mantra: #fbff00; /* Yellow mantra text */
  
  /* Mood quadrant corner colors:
     Top-Right (High Energy + Positive) = Yellow
     Top-Left (High Energy + Negative) = Red
     Bottom-Right (Low Energy + Positive) = Green
     Bottom-Left (Low Energy + Negative) = Blue */
  --mood-high-energy-positive: rgba(255, 204, 0, 0.7);    /* Yellow - top right */
  --mood-high-energy-negative: rgba(255, 71, 71, 0.7);    /* Red - top left */
  --mood-low-energy-positive: rgba(74, 222, 128, 0.7);    /* Green - bottom right */
  --mood-low-energy-negative: rgba(59, 130, 246, 0.7);    /* Blue - bottom left */
}

html { 
  height: 100%; 
  width: 100%;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text-primary);
  width: 100%;
  max-width: 100%;
  margin: 0;
  min-height: 100dvh;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: hidden;
  touch-action: pan-y pinch-zoom;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Desktop: constrain width and center */
@media (min-width: 480px) {
  body {
    max-width: 480px;
    margin: 0 auto;
  }
}

/* === LAYOUT COMPONENTS === */
.app-header, .app-footer {
  padding: var(--header-padding);
  background: rgba(22, 22, 27, 0.8);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10;
  flex-shrink: 0;
}
.app-footer {
  border-bottom: none;
  border-top: 1px solid var(--color-border);
  padding: 8px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
}
.app-main {
  flex: 1 1 auto;
  display: block;
  padding: 8px 16px 16px;
  padding-bottom: calc(120px + env(safe-area-inset-bottom));
  background: radial-gradient(circle at top, var(--color-bg-gradient-start) 0%, var(--color-bg-gradient-end) 100%);
  width: 100%;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  scroll-behavior: smooth;
  touch-action: pan-y pinch-zoom;

  /* Hide scrollbars while keeping scroll functionality */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

@media (min-width: 480px) {
  .app-main {
    padding: 12px 24px 24px;
  }
}

.app-main::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

/* === HEADER === */
/* Three-row header: Identity, Quarterly Progress, Compact Scores */
.header-row {
  display: flex;
  align-items: center;
  width: 100%;
}

/* Row 1: Menu Icon (Left) + App Title (Center) */
.header-row--identity {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 8px 16px;
  margin-bottom: 0px;
}

.menu-icon-btn {
  position: absolute;
  left: 16px;
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  border-radius: 8px;
  flex-shrink: 0;
}

.menu-icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: scale(1.05);
}

.menu-icon-btn:active {
  transform: scale(0.95);
}

.menu-icon {
  width: 24px;
  height: 24px;
  color: rgba(255, 255, 255, 0.85);
  transition: color 0.2s ease;
}

.menu-icon-btn:hover .menu-icon {
  color: rgba(255, 255, 255, 1);
}

.app-title {
  font-size: 24px;
  font-weight: 400;
  letter-spacing: 4px;
  text-transform: lowercase;
  color: var(--color-text-primary);
  margin: 0;
  font-family: var(--font-sans);
  text-align: center;
}

/* Row 2: Quarterly Progress Bar & Status */
.header-row--progress {
  margin-bottom: 16px;
}

.quarter-progress {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.quarter-progress__bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: visible;
  position: relative;
  box-shadow: 
    inset 0 1px 3px rgba(0, 0, 0, 0.4),
    0 1px 0 rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Quarter divider lines - on top of everything */
.quarter-progress__bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    linear-gradient(90deg, 
      transparent 0%, 
      transparent calc(25% - 1px),
      rgba(255, 255, 255, 0.35) calc(25% - 1px),
      rgba(255, 255, 255, 0.35) calc(25% + 1px),
      transparent calc(25% + 1px),
      transparent calc(50% - 1px),
      rgba(255, 255, 255, 0.35) calc(50% - 1px),
      rgba(255, 255, 255, 0.35) calc(50% + 1px),
      transparent calc(50% + 1px),
      transparent calc(75% - 1px),
      rgba(255, 255, 255, 0.35) calc(75% - 1px),
      rgba(255, 255, 255, 0.35) calc(75% + 1px),
      transparent calc(75% + 1px),
      transparent 100%
    );
  border-radius: 999px;
  pointer-events: none;
  z-index: 10;
}

.quarter-progress__fill {
  height: 100%;
  background: linear-gradient(180deg, 
    rgba(79, 138, 245, 0.85) 0%, 
    rgba(79, 138, 245, 0.65) 50%, 
    rgba(79, 138, 245, 0.75) 100%
  );
  border-radius: 999px;
  width: 0%;
  transition: width 600ms cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2);
  position: relative;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1;
}

.quarter-progress__labels {
  position: absolute;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-secondary);
}

.quarter-label,
.week-label {
  color: var(--color-text-secondary);
}

.label-divider {
  color: var(--color-text-tertiary);
  font-weight: 400;
}

/* OLD LABEL STYLE - DEPRECATED */
.quarter-progress__label {
  display: none;
}

/* OLD HEADER STYLES - DEPRECATED */
/* Kept for reference but can be removed after verification */
.app-header__top {
  display: none; /* Deprecated: replaced by header-row--identity */
}

.settings-icon-btn {
  display: none; /* Deprecated: replaced by menu-icon-btn */
}

.settings-icon {
  display: none;
}

.date { 
  display: none; /* Date moved to footer or removed */
}

/* === DATA CONTROLS & TOAST === */
.data-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.data-btn {
  flex: 1 1 120px;
  min-width: 140px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: rgba(79, 138, 245, 0.12);
  color: var(--color-text-primary);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: center;
  -webkit-tap-highlight-color: rgba(79, 138, 245, 0.2);
}

.data-btn:hover,
.data-btn:focus-visible {
  border-color: var(--color-border-focus);
  background: rgba(79, 138, 245, 0.2);
  outline: none;
}

.app-toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(96px + env(safe-area-inset-bottom));
  background: rgba(28, 28, 33, 0.95);
  color: var(--color-text-primary);
  padding: 12px 20px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 200;
  font-size: 13px;
}

.app-toast.show {
  opacity: 1;
  transform: translate(-50%, -8px);
}

/* === DOMAIN SCORES SECTION === */
.scores-section {
  width: 100%;
  margin-bottom: 20px;
  padding: 12px 0 16px;
  background: linear-gradient(180deg, rgba(28, 28, 33, 0.5) 0%, transparent 100%);
  border-radius: var(--radius-xl);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Hide scores section when not on home page */
.app-main:not([data-current-page="home"]) .scores-section {
  display: none;
}

.scores-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--score-gap);
  padding: 0 4px;
}

.score-item {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(12px * var(--header-scale));
  padding-bottom: calc(2px * var(--header-scale));
  position: relative;
}

.score-meter {
  position: relative;
  width: var(--score-ring-size);
  height: var(--score-ring-size);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(28, 28, 33, 0.95) 0%, rgba(10, 10, 14, 0.75) 100%);
  box-shadow: 0 20px 38px rgba(0, 0, 0, 0.45);
  overflow: visible;
}

.score-ring {
  width: 100%;
  height: 100%;
  transform: rotate(180deg);
}

.score-ring__track,
.score-ring__arc {
  fill: none;
  stroke-width: var(--score-ring-stroke);
}

.score-ring__track {
  stroke: rgba(240, 242, 245, 0.12);
}

.score-ring__arc {
  stroke-linecap: round;
  /* Solid full circles - no animation, no fill logic */
}

/* Static domain colors - always solid, always visible */
.score-item[data-domain="sleep"] .score-ring__arc { stroke: var(--sleep); }
.score-item[data-domain="fitness"] .score-ring__arc { stroke: var(--fitness); }
.score-item[data-domain="mind"] .score-ring__arc { stroke: var(--mind); }
.score-item[data-domain="spirit"] .score-ring__arc { stroke: var(--spirit); }

.score-item[data-domain="fitness"] .score-meter__icon img {
  filter: brightness(0) saturate(100%) invert(34%) sepia(91%) saturate(5453%) hue-rotate(352deg) brightness(103%) contrast(105%);
}

.score-item[data-domain="sleep"] .score-meter {
  box-shadow: 0 20px 38px rgba(0, 0, 0, 0.45), 0 0 28px rgba(30, 144, 255, 0.22);
}

.score-item[data-domain="fitness"] .score-meter {
  box-shadow: 0 20px 38px rgba(0, 0, 0, 0.45), 0 0 28px rgba(255, 59, 48, 0.22);
}

.score-item[data-domain="mind"] .score-meter {
  box-shadow: 0 20px 38px rgba(0, 0, 0, 0.45), 0 0 28px rgba(124, 58, 237, 0.22);
}

.score-item[data-domain="spirit"] .score-meter {
  box-shadow: 0 20px 38px rgba(0, 0, 0, 0.45), 0 0 28px rgba(22, 163, 74, 0.22);
}

.score-meter__center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -56%);
  text-align: center;
  pointer-events: none;
}

.score-value {
  font-size: calc(32px * var(--header-scale));
  font-weight: 600;
  color: var(--color-text-primary);
  font-family: var(--font-mono);
  line-height: 1;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

.score-meter__icon {
  position: absolute;
  bottom: calc(-18px * var(--header-scale));
  left: 50%;
  transform: translateX(-50%);
  width: calc(38px * var(--header-scale));
  height: calc(38px * var(--header-scale));
  border-radius: calc(12px * var(--header-scale));
  background: rgba(18, 18, 24, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.45);
}

.score-meter__icon img {
  width: calc(22px * var(--header-scale));
  height: calc(22px * var(--header-scale));
  display: block;
}

/* Domain-specific icon colors */
.score-item[data-domain="sleep"] .score-meter__icon img {
  filter: brightness(0) saturate(100%) invert(55%) sepia(73%) saturate(2446%) hue-rotate(188deg) brightness(102%) contrast(101%);
  /* Applies --sleep: #1e90ff blue */
}

.score-item[data-domain="fitness"] .score-meter__icon img {
  filter: brightness(0) saturate(100%) invert(35%) sepia(85%) saturate(7471%) hue-rotate(355deg) brightness(102%) contrast(104%);
  /* Applies --fitness: #ff3b30 red */
}

.score-item[data-domain="mind"] .score-meter__icon img {
  filter: brightness(0) saturate(100%) invert(30%) sepia(93%) saturate(4234%) hue-rotate(260deg) brightness(97%) contrast(95%);
  /* Applies --mind: #7c3aed purple */
}

.score-item[data-domain="spirit"] .score-meter__icon img {
  filter: brightness(0) saturate(100%) invert(52%) sepia(93%) saturate(1834%) hue-rotate(102deg) brightness(94%) contrast(87%);
  /* Applies --spirit: #16a34a green */
}

.score-name {
  font-size: calc(11px * var(--header-scale));
  color: var(--color-text-tertiary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.55px;
  margin-top: calc(16px * var(--header-scale));
}

/* === BASELINE MESSAGE CARD === */
.baseline-card {
  max-width: 480px;
  margin: 24px auto;
  padding: 24px;
  background: linear-gradient(135deg, rgba(79, 138, 245, 0.08) 0%, rgba(79, 138, 245, 0.02) 100%);
  border: 1px solid rgba(79, 138, 245, 0.15);
  border-radius: var(--radius-lg);
  text-align: center;
  animation: fadeIn 400ms ease;
}

.baseline-icon {
  font-size: 48px;
  margin-bottom: 12px;
  line-height: 1;
}

.baseline-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.baseline-text {
  font-size: 15px;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}

.baseline-text strong {
  color: var(--color-text-primary);
  font-weight: 600;
}

.baseline-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.baseline-progress-bar {
  height: 8px;
  background: rgba(240, 242, 245, 0.08);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.baseline-progress-fill {
  height: 100%;
  background: var(--color-primary-gradient);
  border-radius: 999px;
  transition: width 600ms cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 12px var(--color-shadow-primary);
}

.baseline-progress-label {
  font-size: 13px;
  color: var(--color-text-tertiary);
  font-weight: 600;
  font-family: var(--font-mono);
}

.baseline-encouragement {
  font-size: 14px;
  color: rgba(79, 138, 245, 0.9);
  font-weight: 500;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(79, 138, 245, 0.1);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 360px) {
  :root {
    --score-ring-size: 88px;
  }
}

.visually-hidden,
.sr-announce {
  position: absolute !important;
  height: 1px; width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

/* === PAGE LAYOUTS === */
.page {
  display: none;
  animation: fadeUp 240ms ease;
}

.page.active {
  display: block;
}

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

.page-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 24px;
}

.page-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--color-primary);
}

.page-header h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.page-subtitle {
  font-size: 14px;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

/* === HOME PAGE === */
.page--home .home-actions {
  margin-top: 24px;
}

/* NEW: Replaces .adaptive-grid with a vertical list wrapper */
.action-list-wrapper {
  display: flex;
  flex-direction: column;
  gap: 16px; /* Spacing between the full-width cards */
}

.action-card {
  position: relative;
  background: linear-gradient(160deg, rgba(33, 35, 42, 0.95), rgba(23, 25, 31, 0.95));
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
  padding: 20px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: auto; /* Allow height to adapt to content in vertical layout */
  transition: var(--transition-fast);
  overflow: hidden;
}

.action-card.sleep-card { border-left: 3px solid var(--sleep); }
.action-card.fitness-card { border-left: 3px solid var(--fitness); }
.action-card.mind-card { border-left: 3px solid var(--mind); }
.action-card.spirit-card { border-left: 3px solid var(--spirit); }

.action-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(79, 138, 245, 0.08), rgba(79, 138, 245, 0));
  opacity: 0;
  transition: opacity var(--transition-fast);
  pointer-events: none;
}

.action-card:hover::before {
  opacity: 1;
}

.action-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between; /* Spreads icon/title and the dropdown button */
  gap: 14px;
}

.action-card__header > div {
  flex-grow: 1;
}

.action-card__icon {
  width: 40px;
  height: 40px;
}

/* Domain-specific icon colors */
.sleep-card .action-card__icon {
  filter: brightness(0) saturate(100%) invert(55%) sepia(73%) saturate(2446%) hue-rotate(188deg) brightness(102%) contrast(101%);
  /* Applies --sleep: #1e90ff blue */
}

.fitness-card .action-card__icon {
  filter: brightness(0) saturate(100%) invert(35%) sepia(85%) saturate(7471%) hue-rotate(355deg) brightness(102%) contrast(104%);
  /* Applies --fitness: #ff3b30 red */
}

.mind-card .action-card__icon {
  filter: brightness(0) saturate(100%) invert(30%) sepia(93%) saturate(4234%) hue-rotate(260deg) brightness(97%) contrast(95%);
  /* Applies --mind: #7c3aed purple */
}

.spirit-card .action-card__icon {
  filter: brightness(0) saturate(100%) invert(52%) sepia(93%) saturate(1834%) hue-rotate(102deg) brightness(94%) contrast(87%);
  /* Applies --spirit: #16a34a green */
}

.action-card__title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.action-card__subtitle {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--color-text-secondary);
}

.sleep-card__inputs {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.time-input-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: var(--color-text-tertiary);
}

.time-input-control {
  display: flex;
  align-items: center;
  gap: 12px;
}

.time-input-control input[type="time"] {
  flex: 1;
  background: rgba(12, 14, 20, 0.75);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  color: var(--color-text-primary);
  padding: 10px 12px;
  font-size: 14px;
}

.log-current-btn {
  border: 1px solid var(--color-border-hover);
  background: rgba(79, 138, 245, 0.12);
  color: var(--color-primary);
  border-radius: var(--radius-lg);
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition-fast);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.log-current-btn:hover {
  background: rgba(79, 138, 245, 0.2);
}

.log-current-btn.is-flashing {
  animation: logButtonFlash 420ms ease;
}

@keyframes logButtonFlash {
  0% {
    background: rgba(79, 138, 245, 0.12);
    color: var(--color-primary);
    box-shadow: 0 0 0 0 rgba(104, 247, 180, 0.25);
    transform: scale(1);
  }
  45% {
    background: rgba(104, 247, 180, 0.32);
    color: var(--color-bg);
    box-shadow: 0 0 0 4px rgba(104, 247, 180, 0.22);
    transform: scale(1.04);
  }
  100% {
    background: rgba(79, 138, 245, 0.12);
    color: var(--color-primary);
    box-shadow: 0 0 0 0 rgba(104, 247, 180, 0.15);
    transform: scale(1);
  }
}

.text-status {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin: 0;
}

.pill-toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill-toggle {
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-text-primary);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: var(--transition-fast);
}

.pill-toggle.is-active {
  background: rgba(79, 138, 245, 0.22);
  border-color: rgba(79, 138, 245, 0.45);
  box-shadow: 0 6px 18px rgba(79, 138, 245, 0.25);
}

/* Mind Widget Specific Styles */
.mind-widget-body {
  display: flex;
  flex-direction: column;
  flex-grow: 1; /* Pushes status text to the bottom */
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 0;
}

.tiered-selection-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin: 0; /* Allow full width inside action-card */
}

.tiered-selection {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px; /* Match pill-toggle spacing */
}

.pill-toggle-stack .tiered-selection {
  margin-bottom: 12px; /* Consistent spacing within pill stacks */
}

.tiered-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* === COLLAPSIBLE PRACTICE SECTIONS === */
.collapsible-practice {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(255, 255, 255, 0.02);
  width: 100%;
  display: block;
}

.collapsible-practice.is-expanded {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
}

/* Practice Header - Clickable to expand/collapse */
.practice-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

.practice-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

.practice-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: color 0.2s ease;
}

.practice-value {
  flex: 1;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-primary);
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 8px;
  border-radius: 6px;
  margin: 0 8px;
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.practice-value:empty {
  background: transparent;
  padding: 0;
  margin: 0;
}

.chevron-icon {
  width: 20px;
  height: 20px;
  stroke: var(--color-text-secondary);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.2s ease;
}

.collapsible-practice.is-expanded .chevron-icon {
  transform: rotate(180deg);
}

/* Practice Content - Hidden by default */
.practice-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.36s cubic-bezier(0.4, 0, 0.2, 1), padding 0.28s ease;
  padding: 0 20px;
  box-sizing: border-box;
  width: 100%;
}

.collapsible-practice.is-expanded .practice-content {
  max-height: 1000px; /* generous max to allow all content */
  padding: 12px 20px 20px 20px;
}

/* === LOGGED STATE - Domain-colored glow === */
.collapsible-practice.is-logged .practice-name {
  font-weight: 700;
}

.collapsible-practice.is-logged .chevron-icon {
  stroke-width: 2.5;
}

/* Sleep (Blue) */
.sleep-card .collapsible-practice.is-logged {
  background: rgba(30, 144, 255, 0.08);
  border-color: rgba(30, 144, 255, 0.3);
  box-shadow: 0 0 20px rgba(30, 144, 255, 0.15), inset 0 1px 0 rgba(30, 144, 255, 0.2);
}

.sleep-card .collapsible-practice.is-logged .practice-name,
.sleep-card .collapsible-practice.is-logged .chevron-icon {
  color: #93c5fd;
  stroke: #93c5fd;
}

/* Fitness (Red) */
.fitness-card .collapsible-practice.is-logged {
  background: rgba(255, 59, 48, 0.08);
  border-color: rgba(255, 59, 48, 0.3);
  box-shadow: 0 0 20px rgba(255, 59, 48, 0.15), inset 0 1px 0 rgba(255, 59, 48, 0.2);
}

.fitness-card .collapsible-practice.is-logged .practice-name,
.fitness-card .collapsible-practice.is-logged .chevron-icon {
  color: #fca5a5;
  stroke: #fca5a5;
}

/* Mind (Purple) */
.mind-card .collapsible-practice.is-logged {
  background: rgba(124, 58, 237, 0.08);
  border-color: rgba(124, 58, 237, 0.3);
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.15), inset 0 1px 0 rgba(124, 58, 237, 0.2);
}

.mind-card .collapsible-practice.is-logged .practice-name,
.mind-card .collapsible-practice.is-logged .chevron-icon {
  color: #c4b5fd;
  stroke: #c4b5fd;
}

/* Spirit (Green) */
.spirit-card .collapsible-practice.is-logged {
  background: rgba(22, 163, 74, 0.08);
  border-color: rgba(22, 163, 74, 0.3);
  box-shadow: 0 0 20px rgba(22, 163, 74, 0.15), inset 0 1px 0 rgba(22, 163, 74, 0.2);
}

.spirit-card .collapsible-practice.is-logged .practice-name,
.spirit-card .collapsible-practice.is-logged .chevron-icon {
  color: #86efac;
  stroke: #86efac;
}

/* Control wrappers for non-tier-button content */
.run-controls,
.skill-controls,
.mindfulness-controls,
.mood-energy-controls,
.wake-controls,
.rest-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  width: 100%;
}

.run-controls {
  gap: 12px;
}

.mood-energy-controls {
  gap: 12px;
}

.tier-buttons {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.tier-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  color: var(--color-text-primary);
  cursor: pointer;
  transition: var(--transition-fast);
  flex: 1;
  text-align: center;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tier-btn.selected {
  background: rgba(124, 58, 237, 0.22); /* Mind purple */
  border-color: rgba(124, 58, 237, 0.45);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25);
  color: #c4b5fd; /* Lighter purple text */
}

/* Domain-specific tier button styling */
.mind-card .tier-btn.selected {
  background: rgba(124, 58, 237, 0.22); /* Mind purple */
  border-color: rgba(124, 58, 237, 0.45);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25);
  color: #c4b5fd; /* Lighter purple text */
}

.fitness-card .tier-btn.selected {
  background: rgba(255, 59, 48, 0.22); /* Fitness red */
  border-color: rgba(255, 59, 48, 0.45);
  box-shadow: 0 4px 12px rgba(255, 59, 48, 0.25);
  color: #fca5a5; /* Lighter red text */
}

.spirit-card .tier-btn.selected {
  background: rgba(22, 163, 74, 0.22); /* Spirit green */
  border-color: rgba(22, 163, 74, 0.45);
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25);
  color: #86efac; /* Lighter green text */
}

.sleep-card .tier-btn.selected {
  background: rgba(30, 144, 255, 0.22); /* Sleep blue */
  border-color: rgba(30, 144, 255, 0.45);
  box-shadow: 0 4px 12px rgba(30, 144, 255, 0.25);
  color: #93c5fd; /* Lighter blue text */
}

.tier-btn:focus {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 2px;
}

.pill-toggle-stack {
  display: flex;
  flex-direction: column; /* Stacks the pills vertically */
  gap: 0; /* Remove gap - dropdowns will provide spacing */
  width: 100%;
  max-width: 280px; /* Unified width for all pill stacks (was 220px) */
  margin: 0 auto;
}

.pill-toggle-stack .pill-toggle {
  text-align: center;
  width: 100%; /* Pill toggles now take full available width of their container */
  margin-bottom: 12px; /* Space between buttons */
}

.pill-toggle-stack .pill-toggle.is-active {
  background: rgba(124, 58, 237, 0.22); /* Mind purple with transparency */
  border-color: rgba(124, 58, 237, 0.45);
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.25);
  margin-bottom: 8px; /* Reduced margin when active (dropdown follows) */
}

/* === FITNESS WIDGET === */

/* Fitness Widget Specific Styles (mirrors Mind widget) */
.fitness-widget-body {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 0;
}



.fitness-card .pill-toggle-stack .pill-toggle.is-active {
  background: rgba(255, 59, 48, 0.22); /* Fitness red theme */
  border-color: rgba(255, 59, 48, 0.45);
  box-shadow: 0 6px 18px rgba(255, 59, 48, 0.25);
}

/* Fitness dropdowns for Run and Skill */
.fitness-dropdown {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px; /* Space after dropdown before next button */
  width: 100%;
}

.fitness-dropdown[hidden] {
  display: none;
}

/* === FITNESS & SPIRIT INLINE CONTROLS === */
.run-presets {
  display: flex;
  gap: 6px; /* Reduced from 10px to fit all three in one row */
  flex-wrap: wrap;
  justify-content: center;
}

.run-preset {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 9px 16px;
  color: var(--color-text-primary);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: var(--transition-fast);
  flex: 1;
  text-align: center;
  min-width: 0;
}

.run-adjust {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.run-step {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--color-text-primary);
  font-size: 20px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: var(--transition-fast);
}

.run-step:hover {
  border-color: rgba(255, 59, 48, 0.35); /* Fitness red */
  background: rgba(255, 255, 255, 0.08);
}

.run-step:active {
  background: rgba(255, 59, 48, 0.15);
}

.run-display {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 24px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.run-display span {
  color: var(--color-text-primary);
}

.run-unit {
  font-size: 14px;
  color: var(--color-text-secondary);
  font-weight: 500;
}

.run-unit {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-secondary);
}

.pane-label {
  margin: 0;
  font-size: 13px;
  color: var(--color-text-secondary);
}

.skill-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.skill-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  color: var(--color-text-primary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.skill-chip.is-active {
  background: rgba(255, 59, 48, 0.22); /* Fitness red */
  border-color: rgba(255, 59, 48, 0.45);
  box-shadow: 0 4px 12px rgba(255, 59, 48, 0.25);
  color: #fca5a5; /* Lighter red text */
}

.skill-chip--add {
  background: rgba(255, 255, 255, 0.03);
  border-style: dashed;
  color: var(--color-text-secondary);
}

/* Legacy style - now using unified fitness red above */
.skill-chip--fitness.is-active {
  background: rgba(255, 59, 48, 0.22);
  border-color: rgba(255, 59, 48, 0.45);
  box-shadow: 0 4px 12px rgba(255, 59, 48, 0.25);
  color: #fca5a5;
}

.mood-dot-area {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 18px;
  align-items: center;
}

.mood-grid {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-xl);
  background: radial-gradient(circle at center, rgba(79, 138, 245, 0.18), rgba(12, 14, 20, 0.85));
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.mood-axis {
  position: absolute;
  background: rgba(255, 255, 255, 0.08);
}

.mood-axis--vertical {
  width: 2px;
  inset: 0;
  margin: auto;
  height: 100%;
}

.mood-axis--horizontal {
  height: 2px;
  inset: auto 0;
  margin: auto;
  width: 100%;
}

.mood-dot {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--color-primary-gradient);
  box-shadow: 0 8px 18px var(--color-shadow-primary);
  transform: translate(-50%, -50%);
  bottom: var(--mood-y, 50%);
  left: var(--mood-x, 50%);
  top: auto;
  transition: bottom 0.2s ease, left 0.2s ease;
}

.mood-label {
  position: absolute;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.mood-label--top {
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
}

.mood-label--bottom {
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
}

.mood-label--left {
  top: 50%;
  left: 8px;
  transform: translateY(-50%);
}

.mood-label--right {
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
}

.slider-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slider-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.slider-stack input[type="range"] {
  width: 100%;
  accent-color: var(--color-primary);
}

.spirit-controls {
  display: flex;
  gap: 10px;
}

/* === WEEKLY HEATMAP COMPONENT === */
.weekly-heatmap {
    margin-top: 24px;
    padding: 20px;
    background: var(--color-surface-2);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    text-align: center;
    border: 1px solid var(--color-border);
}

.heatmap-title {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.heatmap-container {
    display: grid;
    grid-template-columns: auto repeat(7, 1fr); /* Label column + 7 day columns */
    gap: 6px;
    max-width: 400px;
    margin: 0 auto;
    align-items: center;
}

.day-label {
    font-size: 10px;
    font-weight: 700;
    text-align: center;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    padding: 4px 0;
}

.domain-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-align: right;
    padding-right: 8px;
    text-transform: capitalize;
}

/* Heatmap Cell Styling (using data-intensity) */
.heatmap-cell {
    aspect-ratio: 1;
    border-radius: 4px;
    transition: all 0.2s ease;
    cursor: pointer;
}

/* Intensity Coloring: Fading from background to the primary success/spirit color */
.heatmap-cell[data-intensity="none"] { 
    background: var(--color-surface-1);
    border: 1px dashed rgba(255, 255, 255, 0.05);
} 
/* Using green for the success color */
.heatmap-cell[data-intensity="low"] { 
    background: rgba(22, 163, 74, 0.25); 
} 
.heatmap-cell[data-intensity="med"] { 
    background: rgba(22, 163, 74, 0.5); 
} 
.heatmap-cell[data-intensity="high"] { 
    background: rgba(22, 163, 74, 0.85);
    box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.1);
} 

.heatmap-cell:hover {
    transform: scale(1.1);
    z-index: 1;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.3);
}

.heatmap-summary {
    font-size: 13px;
    opacity: 0.8;
    margin-top: 20px;
    line-height: 1.5;
    color: var(--color-text-secondary);
}
/* === END WEEKLY HEATMAP COMPONENT === */

/* === VISION PAGE === */
.vision-intent {
  background: url('./icons/vision_hero.png') center/cover no-repeat, linear-gradient(135deg, rgba(31, 35, 47, 0.85), rgba(21, 23, 29, 0.75));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  margin-bottom: 0; /* Remove bottom margin since grid handles spacing */
  backdrop-filter: blur(8px);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.vision-card {
  background: linear-gradient(135deg, rgba(31, 35, 47, 0.85), rgba(21, 23, 29, 0.75));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  margin-bottom: 0; /* Remove bottom margin since grid handles spacing */
  backdrop-filter: blur(8px);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.vision-intent:hover,
.vision-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.vision-intent h3,
.vision-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-top: 4px;
  color: var(--color-text-primary);
  padding-bottom: 4px;
}

.vision-intent p,
.vision-card p {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.vision-textarea {
  width: 100%;
  margin-top: 12px;
  border-radius: var(--radius-lg);
  background: rgba(12, 14, 20, 0.6);
  border: 1px solid rgba(79, 138, 245, 0.25);
  color: var(--color-text-primary);
  padding: 12px 14px;
  font-family: var(--font-sans);
  font-size: 14px;
  resize: none;
  transition: border var(--transition-fast), box-shadow var(--transition-fast);
  
  /* Hide scrollbars while keeping scroll functionality */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.vision-textarea::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.vision-textarea:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 2px rgba(79, 138, 245, 0.15);
}

.vision-empty-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--color-text-tertiary);
  line-height: 1.5;
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  border: 1px dashed rgba(79, 138, 245, 0.25);
  background: rgba(79, 138, 245, 0.08);
  display: none;
}

.vision-empty-hint.is-visible {
  display: block;
}

.vision-tip {
  margin-top: 12px;
  font-size: 12px;
  color: var(--color-text-tertiary);
}

.vision-grid {
  display: grid;
  grid-template-columns: 1fr; /* Single column layout */
  gap: 20px;
  margin-top: 20px;
}

.vision-card__header {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}

.vision-card__header img {
  width: 40px;
  height: 40px;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.45));
}

/* Domain-specific icon colors in vision cards */
.vision-card[data-domain="sleep"] .vision-card__header img {
  filter: brightness(0) saturate(100%) invert(55%) sepia(73%) saturate(2446%) hue-rotate(188deg) brightness(102%) contrast(101%) drop-shadow(0 0 8px var(--sleep));
  /* Applies --sleep: #1e90ff blue with glow */
}

.vision-card[data-domain="fitness"] .vision-card__header img {
  filter: brightness(0) saturate(100%) invert(35%) sepia(85%) saturate(7471%) hue-rotate(355deg) brightness(102%) contrast(104%) drop-shadow(0 0 8px var(--fitness));
  /* Applies --fitness: #ff3b30 red with glow */
}

.vision-card[data-domain="mind"] .vision-card__header img {
  filter: brightness(0) saturate(100%) invert(30%) sepia(93%) saturate(4234%) hue-rotate(260deg) brightness(97%) contrast(95%) drop-shadow(0 0 8px var(--mind));
  /* Applies --mind: #7c3aed purple with glow */
}

.vision-card[data-domain="spirit"] .vision-card__header img {
  filter: brightness(0) saturate(100%) invert(52%) sepia(93%) saturate(1834%) hue-rotate(102deg) brightness(94%) contrast(87%) drop-shadow(0 0 8px var(--spirit));
  /* Applies --spirit: #16a34a green with glow */
}

.vision-prompts {
  margin-top: 16px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vision-prompts li {
  font-size: 12px;
  color: var(--color-text-tertiary);
  display: flex;
  gap: 8px;
}

.vision-prompts li::before {
  content: '\2022';
  color: var(--color-primary);
}

/* === SPIRIT UPGRADE (scoped to action-card) === */
.action-card.spirit-card {
  border-left: 3px solid var(--spirit);
  padding: 16px;
}

/* Section headers */
.action-card.spirit-card .section-header {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
  padding-bottom: 8px;
  margin-bottom: 12px;
}

/* Meditation Timer Section */
.action-card.spirit-card .meditation-timer-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.action-card.spirit-card .timer-button-wrapper {
  position: relative;
  width: 100%;
  height: 56px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.action-card.spirit-card .timer-action-btn {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  border: 2px solid var(--spirit);
  background: var(--color-surface-1);
  color: var(--spirit);
  font-weight: 700;
  font-size: 16px;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 10px rgba(22, 163, 74, 0.18);
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-card.spirit-card .timer-action-btn:hover {
  box-shadow: 0 0 16px rgba(22, 163, 74, 0.3);
  transform: scale(1.01);
}

.action-card.spirit-card .timer-action-btn .timer-fill {
  position: absolute;
  inset: 0;
  background: var(--spirit);
  opacity: 0.18;
  transform: scaleX(0);
  transform-origin: left;
  border-radius: inherit;
  transition: transform 2s linear;
  z-index: 1;
}

.action-card.spirit-card .timer-action-btn.long-pressing .timer-fill {
  transform: scaleX(1);
}

.action-card.spirit-card .timer-action-btn[data-state="running"] {
  font-size: 24px;
  color: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: 0 0 12px rgba(79, 138, 245, 0.35);
}

.action-card.spirit-card .timer-action-btn[data-state="paused"] {
  border-color: var(--color-text-secondary);
  color: var(--color-text-secondary);
  box-shadow: 0 0 6px rgba(160, 174, 192, 0.2);
}

.action-card.spirit-card .timer-action-btn.logged-success {
  background: var(--spirit);
  color: var(--color-text-primary);
  border-color: var(--spirit);
  box-shadow: 0 0 20px rgba(22, 163, 74, 0.5);
  font-size: 18px;
}

/* Timer text styling */
#spirit-timer-text {
  transition: opacity 0.6s ease-in-out, transform 0.6s ease-in-out;
  transform: scale(1);
  opacity: 1;
}

#spirit-timer-text.fade-out {
  opacity: 0;
  transform: scale(1.05);
}

/* Mantra text styling */
#spirit-mantra-text {
  position: absolute;
  opacity: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--color-text-primary);
  transition: opacity 0.6s ease-in-out, transform 0.6s ease-in-out;
  transform: scale(0.95);
  pointer-events: none;
  visibility: hidden;
}

#spirit-mantra-text.fade-in {
  opacity: 1;
  transform: scale(1);
  visibility: visible;
}

/* Mood & Energy Log Section */
.action-card.spirit-card .mood-log-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.action-card.spirit-card .mood-grid-container {
  position: relative;
  width: 100%;
  max-width: 300px;
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: none;
  background: 
    radial-gradient(circle at 100% 0%, var(--mood-high-energy-positive) 0%, transparent 50%),
    radial-gradient(circle at 0% 0%, var(--mood-high-energy-negative) 0%, transparent 50%),
    radial-gradient(circle at 100% 100%, var(--mood-low-energy-positive) 0%, transparent 50%),
    radial-gradient(circle at 0% 100%, var(--mood-low-energy-negative) 0%, transparent 50%),
    rgba(20, 20, 25, 0.8);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Axis lines (subtle cross-hair) */
.action-card.spirit-card .mood-grid-container::before,
.action-card.spirit-card .mood-grid-container::after {
  content: '';
  position: absolute;
  background: rgba(255, 255, 255, 0.18);
  z-index: 1;
  pointer-events: none;
}

.action-card.spirit-card .mood-grid-container::before {
  width: 1px;
  height: 100%;
  left: 50%;
  top: 0;
}

.action-card.spirit-card .mood-grid-container::after {
  height: 1px;
  width: 100%;
  top: 50%;
  left: 0;
}

/* Axis labels (positioned at edges) */
.action-card.spirit-card .mood-axis-label {
  position: absolute;
  font-size: 10px;
  color: var(--color-text-primary);
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
  font-weight: 600;
  z-index: 2;
  pointer-events: none;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.action-card.spirit-card .label-e-high {
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
}

.action-card.spirit-card .label-e-low {
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
}

.action-card.spirit-card .label-m-neg {
  top: 50%;
  left: 8px;
  transform: translateY(-50%);
}

.action-card.spirit-card .label-m-pos {
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
}

/* Draggable mood dot */
.action-card.spirit-card .mood-dot {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.85) 100%);
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  left: var(--mood-x, 50%);
  bottom: var(--mood-y, 50%);
  transform: translate(-50%, 50%);
  cursor: grab;
  z-index: 10;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.action-card.spirit-card .mood-dot:hover {
  transform: translate(-50%, 50%) scale(1.2);
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.5),
    0 0 0 2px rgba(255, 255, 255, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  border-color: rgba(255, 255, 255, 0.5);
}

.action-card.spirit-card .mood-dot:active {
  cursor: grabbing;
  transform: translate(-50%, 50%) scale(1.25);
  box-shadow: 
    0 6px 16px rgba(0, 0, 0, 0.6),
    0 0 0 3px rgba(255, 255, 255, 0.5),
    inset 0 2px 0 rgba(255, 255, 255, 0.5);
  border-color: rgba(255, 255, 255, 0.6);
}

/* Mood description text */
.action-card.spirit-card .mood-description {
  color: var(--color-text-secondary);
  font-size: 13px;
  text-align: center;
  font-weight: 500;
  margin: 8px 0;
}

/* Mood instruction text */
.action-card.spirit-card .mood-instruction {
  color: var(--color-text-secondary);
  font-size: 12px;
  text-align: center;
  font-weight: 400;
  margin: 4px 0 8px 0;
  font-style: italic;
}



/* === GRATITUDE PAGE === */
.insights-grid {
  display: grid;
  gap: 20px;
}

.insight-card {
  background: linear-gradient(140deg, rgba(23, 26, 38, 0.85), rgba(16, 18, 24, 0.75));
  border-radius: var(--radius-xl);
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.insight-card--highlight {
  border-color: rgba(79, 138, 245, 0.35);
  background: linear-gradient(150deg, rgba(59, 130, 246, 0.25), rgba(12, 14, 24, 0.85));
}

.insight-card--focus {
  border-color: rgba(239, 68, 68, 0.35);
  background: linear-gradient(150deg, rgba(239, 68, 68, 0.18), rgba(12, 14, 24, 0.85));
}

.insight-card--momentum {
  background: linear-gradient(150deg, rgba(34, 197, 94, 0.18), rgba(12, 14, 24, 0.85));
}

.card-eyebrow {
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  font-weight: 600;
}

.insight-card h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.insight-detail {
  font-size: 14px;
  line-height: 1.6;
  color: var(--color-text-secondary);
}

.insight-metric {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.insight-metric__label {
  font-size: 16px;
  font-weight: 600;
}

.insight-metric__value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 600;
}

.progress-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.progress-row {
  display: grid;
  grid-template-columns: 80px 1fr 48px;
  align-items: center;
  gap: 12px;
}

.progress-label {
  font-size: 13px;
  color: var(--color-text-secondary);
}

.progress-bar {
  position: relative;
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  width: 0%;
  background: var(--color-primary-gradient);
  transition: width 260ms ease;
}

.progress-score {
  font-family: var(--font-mono);
  font-size: 14px;
}

.insight-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.insight-list li {
  font-size: 13px;
  line-height: 1.6;
  color: var(--color-text-secondary);
  border-left: 2px solid rgba(79, 138, 245, 0.35);
  padding-left: 12px;
}

@media (min-width: 480px) {
  .vision-grid {
    grid-template-columns: 1fr; /* Keep single column even on larger screens */
  }

  .insights-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .insight-card--momentum,
  .insight-card--reflections {
    grid-column: span 2;
  }
}


/* Loading overlay - fully opaque stylized background */
.loading-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  z-index: 9999;
  opacity: 1;
  transition: opacity 320ms ease-in-out, visibility 320ms ease-in-out;
  overflow: hidden;
}

.loading-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(circle at 30% 20%, var(--color-surface-1) 0%, transparent 50%),
    radial-gradient(circle at 70% 80%, var(--color-surface-1) 0%, transparent 50%),
    linear-gradient(135deg, var(--color-bg) 0%, var(--color-bg) 50%, var(--color-surface-1) 100%);
  opacity: 1;
}

.loading-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(79, 138, 245, 0.12) 0%, transparent 60%);
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.15); }
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.loading-logo {
  width: 280px;
  height: 280px;
  object-fit: contain;
  display: block;
  position: relative;
  z-index: 1;
  background: transparent;
  transform: translateZ(0) scale(1);
  transition: transform 420ms cubic-bezier(0.2, 0.9, 0.22, 1);
  will-change: transform;
  animation: breath 8000ms ease-in-out 1 forwards;
  flex-shrink: 0;
  pointer-events: none;
  user-select: none;
}

/* Layout wrapper for logo + word to control spacing during 'breath' */
.loading-frame {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

@keyframes breath {
  0% { transform: scale(1); }
  37.5% { transform: scale(1.25); } /* peak at 3 seconds (37.5% of 8s) */
  100% { transform: scale(1); } /* return to original size at 8 seconds */
}

/* Mobile adjustments for loading screen */
@media (max-height: 700px) {
  .loading-logo {
    width: 160px;
    height: 160px;
  }

  @keyframes breath {
    0% { transform: scale(1); }
    37.5% { transform: scale(1.2); } /* smaller peak for mobile */
    100% { transform: scale(1); }
  }
}

/* Respect reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .loading-logo { transition: none; animation: none; }
}

@media (min-width: 1200px) {
  .loading-logo {
    width: 320px;
    height: 320px;
  }
}

/* Developer UI: small pill and toast */
.dev-pill {
  position: fixed; right: 16px; bottom: 110px; z-index: 10001;
  background: rgba(255,255,255,0.04); color: var(--color-text-primary);
  padding: 8px 10px; border-radius: 10px; font-size: 12px; font-weight: 700;
  border: 1px solid rgba(255,255,255,0.03); cursor: pointer; user-select: none;
  box-shadow: 0 10px 28px rgba(0,0,0,0.55);
  display: none; /* hidden by default; shown when dev mode enabled */
}
.dev-pill.visible { display: block; transform: translateY(0); }
.dev-pill:hover { background: rgba(255,255,255,0.06); }

.dev-loader-toggle {
  position: fixed; right: 68px; bottom: 110px; z-index: 10001;
  background: rgba(255,255,255,0.04); color: var(--color-text-primary);
  padding: 8px 10px; border-radius: 10px; font-size: 16px;
  border: 1px solid rgba(255,255,255,0.03); cursor: pointer; user-select: none;
  box-shadow: 0 10px 28px rgba(0,0,0,0.55);
  display: none; /* hidden by default; shown when dev mode enabled */
  transition: var(--transition-fast);
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
}
.dev-loader-toggle.visible { display: flex; }
.dev-loader-toggle:hover { background: rgba(255,255,255,0.06); transform: scale(1.05); }
.dev-loader-toggle.disabled {
  background: rgba(255, 59, 48, 0.15);
  border-color: rgba(255, 59, 48, 0.3);
}
.dev-loader-toggle.disabled #dev-loader-icon {
  opacity: 0.5;
}

.dev-toast {
  position: fixed; right: 16px; bottom: 74px; z-index: 10002;
  background: rgba(12,14,20,0.9); color: var(--color-text-primary);
  padding: 10px 14px; border-radius: 10px; font-size: 13px; display: none;
  box-shadow: 0 10px 26px rgba(0,0,0,0.55);
}
.dev-toast.show { display: block; }

/* Developer UI: small pill and toast (styling kept further down) */

/* === FOOTER NAVIGATION === */
.bottom-nav { 
  display: flex; 
  justify-content: center; 
  align-items: center;
  height: 80px; 
  padding: 8px 24px;
  gap: 42px;
}
.nav-btn {
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: var(--transition-fast);
  padding: 8px;
  border-radius: 12px;
  position: relative;
  flex: 1;
  max-width: 90px;
  -webkit-tap-highlight-color: rgba(79, 138, 245, 0.15);
  touch-action: manipulation;
}
.nav-btn:hover { 
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
}
.nav-btn:active {
  transform: scale(0.95);
}
.nav-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.nav-btn.active { 
  color: var(--color-primary); 
  background: rgba(79, 138, 245, 0.1);
  transform: scale(1.15);
}
.nav-btn.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 3px;
  background: var(--color-primary);
  border-radius: 0 0 3px 3px;
}
.nav-icon { 
  width: 42px; 
  height: 42px; 
  display: block; 
  filter: brightness(0) invert(1);
  transition: var(--transition-fast);
}
.nav-btn:hover .nav-icon {
  filter: brightness(0) invert(1);
  transform: scale(1.1);
}
.nav-btn.active .nav-icon { 
  filter: invert(37%) sepia(96%) saturate(7451%) hue-rotate(210deg) brightness(104%) contrast(105%);
  width: 48px;
  height: 48px;
}
.nav-label { font-size: 12px; font-weight: 500; }

/* === OVERLAY / MODAL === */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 100;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  overflow: hidden;
}
.overlay.active { opacity: 1; visibility: visible; }
.overlay-content-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 24px;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUp { from { transform: translateY(5%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.overlay-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; flex-shrink: 0; }
.overlay-title { font-size: 28px; font-weight: 700; }
.close-btn {
  background: var(--color-surface-2);
  border: none;
  color: var(--color-text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  -webkit-tap-highlight-color: rgba(79, 138, 245, 0.2);
  touch-action: manipulation;
}
.close-btn:hover { background: var(--color-surface-1); color: var(--color-text-primary); transform: rotate(90deg); }

.overlay-content { 
  flex: 1; 
  overflow-y: auto; 
  padding-right: 8px;
  
  /* Hide scrollbars while keeping scroll functionality */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.overlay-content::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

/* === FORM ELEMENTS & BUTTONS === */
.input-group { margin-bottom: 32px; }
.input-label { display: block; margin-bottom: 1px; margin-top: 8px; color: var(--color-text-secondary); font-size: 14px; font-weight: 600; }
.time-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--color-surface-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-size: 16px;
  font-family: var(--font-mono);
  transition: var(--transition-fast);
}
.time-input:focus { outline: none; border-color: var(--color-border-focus); background: var(--color-bg); }

.btn-group { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btn-group[data-toggle="true"] { grid-template-columns: 1fr; }
.btn {
  padding: 16px;
  background: var(--color-surface-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  font-weight: 600;
  font-size: 14px;
  font-family: var(--font-sans);
  min-height: 48px;
  -webkit-tap-highlight-color: rgba(79, 138, 245, 0.15);
  touch-action: manipulation;
}
.btn-group[data-toggle="true"] .btn {
  position: relative;
  padding-left: 48px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
}
.btn-group[data-toggle="true"] .btn::before {
  content: '';
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  background: transparent;
  transition: var(--transition-fast);
  opacity: 0.7;
}
.btn-group[data-toggle="true"] .btn::after {
  content: '\2713';
  position: absolute;
  left: 19px;
  top: 50%;
  transform: translateY(-58%);
  font-size: 14px;
  color: transparent;
  transition: var(--transition-fast);
}
.btn:hover { background: var(--color-surface-2); border-color: var(--color-border-hover); color: var(--color-text-primary); }
.btn.active {
  background: var(--color-primary-gradient);
  border-color: transparent;
  color: var(--color-text-primary);
  box-shadow: 0 4px 12px var(--color-shadow-primary);
}
.btn-group[data-toggle="true"] .btn.active::before {
  border-color: transparent;
  background: rgba(255, 255, 255, 0.15);
  opacity: 1;
}
.btn-group[data-toggle="true"] .btn.active::after {
  color: var(--color-text-primary);
}

.preset-group {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  background: var(--color-surface-1);
  padding: 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}
.preset-btn {
  width: 44px;
  height: 44px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: 24px;
  transition: var(--transition-fast);
  min-width: 44px;
  min-height: 44px;
  -webkit-tap-highlight-color: rgba(79, 138, 245, 0.2);
  touch-action: manipulation;
}
.preset-btn:hover { background: var(--color-surface-1); color: var(--color-text-primary); }
.preset-btn:active { transform: scale(0.95); }
.preset-value { text-align: center; font-size: 28px; font-weight: 700; font-family: var(--font-mono); }

.quadrant-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quad-btn {
  padding: 20px 12px;
  background: var(--color-surface-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: 13px;
  text-align: center;
  transition: var(--transition-fast);
  font-weight: 500;
  line-height: 1.5;
  min-height: 48px;
  -webkit-tap-highlight-color: rgba(79, 138, 245, 0.15);
  touch-action: manipulation;
}
.quad-btn:hover { background: var(--color-surface-2); border-color: var(--color-border-hover); color: var(--color-text-primary); }
.quad-btn.active {
  background: var(--color-primary-gradient);
  border-color: transparent;
  color: var(--color-text-primary);
  box-shadow: 0 4px 12px var(--color-shadow-primary);
}

/* === SETTINGS SIDE MENU === */
.settings-menu {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
}

.settings-menu.active {
  pointer-events: auto;
}

.settings-menu__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.settings-menu.active .settings-menu__backdrop {
  opacity: 1;
}

.settings-menu__panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(320px, 80vw);
  background: rgba(22, 22, 27, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform var(--transition-base);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
}

.settings-menu.active .settings-menu__panel {
  transform: translateX(0);
}

.settings-menu__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.settings-menu__header h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: 0;
}

.settings-menu__content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  
  /* Hide scrollbars */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.settings-menu__content::-webkit-scrollbar {
  display: none;
}

.settings-section {
  margin-bottom: 32px;
}

.settings-section:last-child {
  margin-bottom: 0;
}

.settings-section__title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-secondary);
  margin: 0 0 12px 0;
}

.settings-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--color-surface-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  margin-bottom: 8px;
  text-align: left;
  min-height: 48px;
  -webkit-tap-highlight-color: rgba(79, 138, 245, 0.15);
  touch-action: manipulation;
}

.settings-btn:disabled,
.settings-btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.settings-btn.is-busy::after {
  content: '…';
  margin-left: auto;
  font-size: 20px;
  opacity: 0.6;
}

.settings-btn:hover {
  background: var(--color-surface-2);
  border-color: var(--color-border-hover);
}

.settings-btn:active {
  transform: scale(0.98);
}

.settings-info {
  padding: 16px;
  background: var(--color-surface-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-size: 14px;
  line-height: 1.5;
}

.settings-info p {
  margin: 0 0 12px 0;
}

.settings-info p:last-child {
  margin-bottom: 0;
}

.settings-info strong {
  color: var(--color-text-primary);
  font-weight: 600;
}

.settings-info a {
  color: var(--color-accent);
  text-decoration: none;
}

.settings-info a:hover {
  text-decoration: underline;
}

.settings-btn__icon {
  font-size: 20px;
  line-height: 1;
}

.settings-field {
  margin: 0 0 12px 0;
  padding: 12px 16px;
}

.settings-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 15px;
  color: var(--color-text);
  user-select: none;
}

.settings-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--color-primary);
}

.settings-helper-text {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin: 0 0 16px 44px;
  line-height: 1.4;
  max-width: 320px;
}

.settings-helper-text[data-state="ready"] {
  color: var(--color-success);
}

.settings-helper-text[data-state="permission"] {
  color: var(--color-warning);
}

.settings-helper-text[data-state="unsupported"],
.settings-helper-text[data-state="error"] {
  color: var(--color-danger);
}

/* SVG Icon backgrounds for settings buttons */
.icon-calendar-search {
  background-image: url('icons/calendar_search.svg');
  background-size: 20px 20px;
  background-repeat: no-repeat;
  background-position: center;
  width: 20px;
  height: 20px;
  display: inline-block;
  filter: brightness(0) invert(1);
}

.icon-database-export {
  background-image: url('icons/database_export.svg');
  background-size: 20px 20px;
  background-repeat: no-repeat;
  background-position: center;
  width: 20px;
  height: 20px;
  display: inline-block;
  filter: brightness(0) invert(1);
}

.icon-database-import {
  background-image: url('icons/database_import.svg');
  background-size: 20px 20px;
  background-repeat: no-repeat;
  background-position: center;
  width: 20px;
  height: 20px;
  display: inline-block;
  filter: brightness(0) invert(1);
}

.icon-database-delete {
  background-image: url('icons/database_delete.svg');
  background-size: 20px 20px;
  background-repeat: no-repeat;
  background-position: center;
  width: 20px;
  height: 20px;
  display: inline-block;
  filter: invert(15%) sepia(89%) saturate(7451%) hue-rotate(0deg) brightness(105%) contrast(105%);
}

.icon-folder-sync {
  background-image: url('icons/folder_sync.svg');
  background-size: 20px 20px;
  background-repeat: no-repeat;
  background-position: center;
  width: 20px;
  height: 20px;
  display: inline-block;
  filter: brightness(0) invert(1);
}

/* === HISTORY VIEW === */
.history-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-1);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.history-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-date-range {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.history-subtitle {
  font-size: 13px;
  color: var(--color-text-secondary);
  opacity: 0.8;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.history-entry {
  background: linear-gradient(145deg, var(--color-surface-1), var(--color-surface-2));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 20px;
  transition: var(--transition-fast);
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(79, 138, 245, 0.15);
}

.history-entry:hover {
  border-color: var(--color-border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.history-entry__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}

.history-entry__date {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.history-entry__total {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  color: var(--color-primary);
}

.history-entry__delete {
  width: 32px;
  height: 32px;
  background: var(--color-danger);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: rgba(248, 113, 113, 0.15);
  touch-action: manipulation;
  margin-left: 12px;
}

.history-entry__delete:hover {
  background: #dc2626;
  transform: scale(1.1);
}

.history-add-btn {
  background: var(--color-success);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: white;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 8px;
  -webkit-tap-highlight-color: rgba(74, 222, 128, 0.15);
  touch-action: manipulation;
}

.history-add-btn:hover:not(:disabled) {
  background: #16a34a;
  transform: scale(1.02);
}

.history-entry__domains {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.history-domain {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--color-surface-1);
  border-radius: var(--radius-md);
}

.history-domain__icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.history-domain__info {
  flex: 1;
  min-width: 0;
}

.history-domain__name {
  font-size: 11px;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.history-domain__score {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.history-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--color-text-secondary);
}

.history-empty__icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.history-empty__text {
  font-size: 15px;
  line-height: 1.6;
}

/* History month/week grouping */
.history-month {
  margin-bottom: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
}

.history-month__header {
  width: 100%;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.05);
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--color-text-primary);
  font-size: 16px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background-color var(--transition-fast);
}

.history-month__header:hover {
  background: rgba(255, 255, 255, 0.08);
}

.history-month__header:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

.history-month__title {
  font-family: var(--font-mono);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.9;
}

.history-month__toggle {
  font-size: 12px;
  opacity: 0.7;
  transition: transform var(--transition-fast);
}

.history-month__content {
  padding: 0;
}

.history-week {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.history-week:last-child {
  border-bottom: none;
}

.history-week__header {
  padding: 12px 20px 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.history-week__entries {
  padding: 8px 0;
}

/* === WEEKLY HEATMAP COMPONENT (Dynamic) === */
.weekly-heatmap {
  margin-top: 24px;
  padding: 16px;
  background: var(--color-surface-2);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
}

.heatmap-title {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
}

.heatmap-container {
  margin: 0;
  padding: 0;
  width: 100%;
}

/* Single grid for the entire heatmap */
.heatmap-grid {
  display: grid;
  grid-template-columns: 60px 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
  gap: 3px;
  row-gap: 4px;
  width: 100%;
}

.day-label {
  font-size: 12px;
  opacity: 0.7;
  text-align: center;
  color: var(--color-text-tertiary);
  font-weight: 600;
  letter-spacing: 0.5px;
  padding-bottom: 2px;
}

.domain-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-align: right;
  padding-right: 6px;
  font-family: var(--font-mono);
  text-transform: capitalize;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.heatmap-cell {
  width: 100%;
  height: 40px;
  border-radius: 4px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.heatmap-cell[data-intensity="none"] {
  background: var(--color-surface-1);
  border: 1px dashed rgba(255, 255, 255, 0.05);
}

.heatmap-cell[data-intensity="low"] {
  background: rgba(22, 163, 74, 0.25);
}

.heatmap-cell[data-intensity="med"] {
  background: rgba(22, 163, 74, 0.5);
}

.heatmap-cell[data-intensity="high"] {
  background: rgba(22, 163, 74, 0.85);
  box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.1);
}

.heatmap-cell:hover {
  transform: scale(1.08);
  z-index: 1;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.25);
}

.heatmap-summary {
  font-size: 13px;
  opacity: 0.8;
  margin-top: 20px;
  line-height: 1.5;
  color: var(--color-text-secondary);
  text-align: center;
}
/* === END WEEKLY HEATMAP COMPONENT CSS === */

/* === HISTORY EDIT FORM === */
.history-edit-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.history-back-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--color-text-primary);
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.history-back-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.history-edit-date {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.history-edit-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.edit-section {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 16px;
}

.edit-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: 0 0 16px 0;
}

.edit-section-icon {
  width: 20px;
  height: 20px;
  opacity: 0.8;
}

.edit-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.edit-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.edit-field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.edit-field input,
.edit-field select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--color-text-primary);
  font-size: 14px;
  transition: all 0.2s ease;
}

.edit-field input:focus,
.edit-field select:focus {
  outline: none;
  border-color: var(--color-accent);
  background: rgba(255, 255, 255, 0.08);
}

.edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}

.edit-cancel-btn,
.edit-save-btn {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.edit-cancel-btn {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.edit-cancel-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.edit-save-btn {
  background: var(--color-accent);
  color: white;
}

.edit-save-btn:hover {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
}

/* === UPDATE BANNER === */
.update-banner__content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  max-width: 600px;
  margin: 0 auto;
}

.update-banner__text {
  flex: 1;
  font-weight: 500;
}

.update-banner__button {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.update-banner__button:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}
