:root {
  --bg: #fff8f3;
  --bg-accent: #ffeef2;
  --card: #ffffff;
  --text: #3f3448;
  --muted: #7c6f88;
  --border: #f0e3ea;
  --primary: #ff758f;
  --primary-hover: #ff5c7a;
  --good: #52b788;
  --warn: #f4a261;
  --low: #e63946;
  --shadow: 0 10px 28px rgba(74, 63, 85, 0.08);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Nunito', 'Quicksand', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top left, var(--bg-accent), var(--bg) 55%);
  min-height: 100vh;
}

.app-shell {
  max-width: 1060px;
  margin: 0 auto;
  padding: 16px;
}

/* Topbar */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  font-size: 2rem;
  line-height: 1;
}

.brand h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
}

.brand-sub {
  font-size: 0.85rem;
  color: var(--muted);
}

.nav-pills {
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.75);
  padding: 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.nav-btn {
  border: none;
  background: transparent;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(255, 117, 143, 0.35);
}

/* Cards & Grids */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.home-grid,
.manager-grid,
.avatar-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

@media (min-width: 768px) {
  .home-grid {
    grid-template-columns: 1.05fr 1.15fr;
    align-items: start;
  }
  .manager-grid,
  .avatar-grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

/* Pet Stage */
.pet-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(180deg, #fffdf9 0%, #fff3f6 100%);
}

.stage-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.pet-name-tag {
  background: #ffe5ec;
  color: #b53855;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.9rem;
}

.clock-pill {
  font-size: 0.82rem;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
}

.speech-bubble {
  position: relative;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 18px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 0.95rem;
  text-align: center;
  max-width: 310px;
  box-shadow: 0 4px 12px rgba(74, 63, 85, 0.06);
  margin-bottom: 6px;
}

.speech-bubble.bubble-happy {
  border-color: #ffb3c1;
  background: #fff5f7;
  color: #b53855;
}

.pet-canvas {
  width: 220px;
  height: 210px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pet-canvas.sm {
  width: 175px;
  height: 165px;
}

.pet-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

@keyframes petIdle {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-4px) scale(1.01, 0.99); }
}

@keyframes petHappy {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-7px) rotate(-2deg); }
  75% { transform: translateY(-7px) rotate(2deg); }
}

@keyframes petJump {
  0%, 100% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-18px) scale(1.04); }
  60% { transform: translateY(-6px) scale(0.98); }
}

@keyframes petTired {
  0%, 100% { transform: translateY(2px) scale(1, 0.98); }
  50% { transform: translateY(4px) scale(1.02, 0.96); }
}

@keyframes floatProp {
  0%, 100% { transform: translateY(0); opacity: 0.95; }
  50% { transform: translateY(-6px); opacity: 1; }
}

.pet-idle { animation: petIdle 3.2s ease-in-out infinite; }
.pet-happy { animation: petHappy 1.8s ease-in-out infinite; }
.pet-jump { animation: petJump 0.65s ease-in-out infinite; }
.pet-tired { animation: petTired 3.6s ease-in-out infinite; }
.float-prop { animation: floatProp 1.5s ease-in-out infinite; }

.wellness-box {
  width: 100%;
  margin-top: 8px;
}

.bar-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.demo-clock {
  width: 100%;
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--muted);
  border-top: 1px dashed var(--border);
  padding-top: 10px;
}

.demo-clock summary {
  cursor: pointer;
  font-weight: 700;
}

.demo-clock-controls {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.demo-clock-controls input[type='range'] {
  width: 100%;
  accent-color: var(--primary);
}

/* Progress bars */
.progress-track {
  width: 100%;
  height: 10px;
  background: #f3eaf0;
  border-radius: 999px;
  overflow: hidden;
}

.progress-track.lg {
  height: 14px;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.35s ease, background-color 0.35s ease;
}

.progress-fill.good { background: var(--good); }
.progress-fill.warn { background: var(--warn); }
.progress-fill.low { background: var(--low); }

/* Habits list */
.habits-column {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.section-head h2,
.section-head h3 {
  margin: 0;
}

.badge {
  background: #f6edf2;
  color: var(--text);
  font-weight: 800;
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 999px;
}

.habit-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.habit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fffdfb;
  transition: transform 0.15s ease, border-color 0.2s ease;
}

.habit-row.is-done {
  background: #f4fbf7;
  border-color: #cdecd9;
}

.habit-info {
  flex: 1;
  min-width: 0;
}

.habit-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.habit-icon {
  font-size: 1.45rem;
}

.habit-name {
  font-weight: 800;
  font-size: 0.96rem;
}

.habit-meta {
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot.good { background: var(--good); }
.status-dot.warn { background: var(--warn); }
.status-dot.low { background: var(--low); }

.habit-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-checkin {
  border: none;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.1s ease, background 0.2s ease;
}

.btn-checkin:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-checkin.done {
  background: var(--good);
  cursor: default;
}

.btn-icon-undo {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  width: 34px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
}

/* History */
.history-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  text-align: center;
}

.history-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: 12px;
  background: #faf5f8;
}

.history-day.today {
  border: 2px solid #ffb3c1;
  background: #fff5f7;
}

.day-label {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--muted);
}

.day-face {
  font-size: 1.25rem;
}

/* Manager & Forms */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.preset-grid.compact {
  grid-template-columns: repeat(auto-fill, minmax(125px, 1fr));
}

.preset-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 10px;
  border-radius: 16px;
  border: 2px solid var(--border);
  background: #fff;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.preset-card.selected {
  border-color: var(--primary);
  background: #fff5f7;
}

.preset-icon { font-size: 1.6rem; }
.preset-name { font-weight: 800; font-size: 0.88rem; }
.preset-sub { font-size: 0.75rem; color: var(--muted); }
.preset-check { font-size: 0.78rem; font-weight: 800; color: var(--primary); margin-top: 2px; }

.active-habit-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.active-habit-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #faf5f8;
  border-radius: 12px;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 18px 0;
}

.custom-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.custom-form label,
.field-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

.custom-form input,
.custom-form select,
.inline-name input {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 0.92rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.chip-group.centered,
.color-dots.centered {
  justify-content: center;
}

.chip {
  border: 1.5px solid var(--border);
  background: #fff;
  padding: 7px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
}

.chip.active {
  border-color: var(--primary);
  background: #ffe5ec;
  color: #b53855;
}

.color-dots {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.color-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
}

.color-dot.active {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.btn-primary {
  border: none;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  padding: 11px 18px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 0.95rem;
}

.btn-primary.lg {
  padding: 14px 26px;
  font-size: 1.05rem;
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-ghost {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 6px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
}

.btn-ghost.danger {
  color: var(--low);
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Onboarding */
.onboarding-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.onboarding-card {
  max-width: 820px;
  width: 100%;
}

.onboarding-head {
  text-align: center;
  margin-bottom: 20px;
}

.onboarding-head h1 {
  margin: 6px 0 6px;
}

.onboarding-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 720px) {
  .onboarding-body {
    grid-template-columns: 1fr 1.15fr;
    align-items: center;
  }
}

.onboarding-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: #fff7fa;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
}

.inline-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.9rem;
}

.onboarding-footer {
  margin-top: 22px;
  display: flex;
  justify-content: center;
}

.pet-preview-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* XP, Rewards, Calendar & New Controls */
.xp-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  margin: 10px 0 4px;
}

.progress-track.sm {
  height: 7px;
}

.progress-fill.xp {
  background: linear-gradient(90deg, #ffd166, #ff9f1c);
}

.biometrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.bio-pill {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px 8px;
}

body.dark .bio-pill,
.pet-stage.sky-night .bio-pill {
  background: rgba(15, 18, 32, 0.35);
  border-color: rgba(255, 255, 255, 0.14);
}

.bio-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.progress-track.xs {
  height: 5px;
}

.progress-fill.bio-energy { background: #52b788; }
.progress-fill.bio-focus { background: #4ea8de; }
.progress-fill.bio-zen { background: #b79ced; }

.stage-footer-actions {
  width: 100%;
  margin-top: 12px;
  display: flex;
  justify-content: center;
}

.reward-toast {
  background: linear-gradient(90deg, #fff0b3, #ffe5ec);
  border: 2px solid #ffd166;
  color: #5b3b00;
  font-weight: 800;
  padding: 12px 18px;
  border-radius: 16px;
  margin-bottom: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}

.btn-mini {
  border: 1.5px solid #ffd166;
  background: #fff9e6;
  color: #8a5a00;
  font-weight: 800;
  font-size: 0.78rem;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
}

.mini-tag {
  background: #fff3cd;
  color: #8a5a00;
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 800;
}

.challenge-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fff9 100%);
}

/* Calendar */
.cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.cal-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 6px;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.cal-cell {
  min-height: 52px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: #faf7f9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  padding: 4px;
}

.cal-cell.empty {
  border: none;
  background: transparent;
  cursor: default;
}

.cal-cell.good,
.cal-cell.rest {
  background: #eafaf1;
  border-color: #95d5b2;
}

.cal-cell.warn {
  background: #fff4e6;
  border-color: #f4a261;
}

.cal-cell.low {
  background: #ffeef0;
  border-color: #ff8fa3;
}

.cal-cell.selected {
  outline: 3px solid var(--primary);
  outline-offset: 1px;
}

.cal-num {
  font-weight: 800;
  font-size: 0.85rem;
}

.cal-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
}

.cal-habit-status {
  font-weight: 800;
  font-size: 0.82rem;
}

.cal-habit-status.ok { color: var(--good); }
.cal-habit-status.miss { color: var(--low); }

.summary-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.stat-box {
  background: #faf5f8;
  border-radius: 14px;
  padding: 12px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-box strong {
  font-size: 1.05rem;
}

.stat-box span {
  font-size: 0.75rem;
  color: var(--muted);
}

.room-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(125px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.preset-card.locked {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Time-of-day dynamic stage backgrounds */
.pet-stage {
  transition: background 0.6s ease, color 0.4s ease;
}

.pet-stage.sky-morning {
  background: linear-gradient(180deg, #fff3b0 0%, #ffe0e9 55%, #fff9f5 100%);
}

.pet-stage.sky-day {
  background: linear-gradient(180deg, #d8f3ff 0%, #effaff 55%, #ffffff 100%);
}

.pet-stage.sky-sunset {
  background: linear-gradient(180deg, #ffcad4 0%, #ffd6a5 52%, #fff1e6 100%);
}

.pet-stage.sky-night {
  background: linear-gradient(180deg, #2b2d42 0%, #433a6b 60%, #5c548a 100%);
  color: #f8f7ff;
  border-color: #4d4575;
}

.pet-stage.sky-night .xp-row,
.pet-stage.sky-night .demo-clock {
  color: #ded9f2;
  border-top-color: rgba(255, 255, 255, 0.18);
}

.pet-stage.sky-night .speech-bubble {
  color: var(--text);
}

.pet-canvas {
  cursor: pointer;
}

/* Random character micro-animations */
@keyframes quirkWiggle {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(-7deg) scale(1.03); }
  40% { transform: rotate(7deg) scale(1.03); }
  60% { transform: rotate(-5deg); }
  80% { transform: rotate(4deg); }
}

@keyframes quirkHop {
  0%, 100% { transform: translateY(0); }
  30% { transform: translateY(-20px) scale(1.03); }
  55% { transform: translateY(0) scale(1.04, 0.94); }
  75% { transform: translateY(-9px); }
}

@keyframes quirkTilt {
  0%, 100% { transform: rotate(0deg) translateX(0); }
  35% { transform: rotate(8deg) translateX(6px); }
  70% { transform: rotate(-6deg) translateX(-4px); }
}

@keyframes quirkBoing {
  0%, 100% { transform: scale(1, 1); }
  25% { transform: scale(1.1, 0.9); }
  50% { transform: scale(0.92, 1.1) translateY(-10px); }
  75% { transform: scale(1.04, 0.97); }
}

.pet-svg.quirk-wiggle { animation: quirkWiggle 1.1s ease-in-out; }
.pet-svg.quirk-hop { animation: quirkHop 1.05s ease-in-out; }
.pet-svg.quirk-tilt { animation: quirkTilt 1.15s ease-in-out; }
.pet-svg.quirk-boing { animation: quirkBoing 1.0s ease-in-out; }

/* Focus Timer, Daily Note, Backup & Share Card */
.focus-banner {
  background: linear-gradient(90deg, #eef7ff, #f5f0ff);
  border-color: #b79ced;
}

.focus-clock {
  font-size: 1.3rem;
  color: #5a3ea6;
  font-variant-numeric: tabular-nums;
}

.focus-actions {
  display: flex;
  gap: 8px;
}

.daily-note-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--text);
}

.day-note-box {
  margin-top: 12px;
  padding: 10px 12px;
  background: #fff9f5;
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  font-size: 0.9rem;
}

.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.file-btn {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.share-card-preview {
  margin-top: 14px;
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, #fff3f6 0%, #fff8e8 100%);
  border: 2px solid #ffb3c1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
}

.share-head {
  width: 100%;
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
}

/* Habit reminder banner */
.reminder-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #fff4e6;
  border: 2px solid #f4a261;
  border-radius: 16px;
  padding: 12px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.reminder-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Strict mode proof modal, habit stats & Dark Mode */
.proof-modal {
  margin-bottom: 16px;
  border: 2px solid var(--primary);
  background: #fff9fb;
}

.proof-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.proof-badge {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}

.habit-stats-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  border-radius: 10px;
  background: #faf5f8;
  font-size: 0.88rem;
}

.habit-row-btns {
  display: flex;
  gap: 6px;
}

/* Global Dark Mode */
body.dark-mode {
  --bg: #181622;
  --bg-accent: #241f35;
  --card: #232030;
  --text: #f3effa;
  --muted: #b6aec7;
  --border: #38334d;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

body.dark-mode .nav-pills,
body.dark-mode .btn-ghost,
body.dark-mode .preset-card,
body.dark-mode .chip,
body.dark-mode .custom-form input,
body.dark-mode .custom-form select,
body.dark-mode .daily-note-input,
body.dark-mode .speech-bubble {
  background: #2c283d;
  color: var(--text);
  border-color: var(--border);
}

body.dark-mode .habit-row,
body.dark-mode .history-day,
body.dark-mode .stat-box,
body.dark-mode .stat-row,
body.dark-mode .active-habit-list li,
body.dark-mode .cal-cell:not(.good):not(.warn):not(.low):not(.rest):not(.empty) {
  background: #2b273b;
}

body.dark-mode .habit-row.is-done {
  background: #1f332b;
  border-color: #2f5947;
}

body.dark-mode .preset-card.selected,
body.dark-mode .chip.active {
  background: #402638;
}

/* Day-of-week schedule pills & Smart Coach */
.active-habit-item {
  flex-direction: column;
  align-items: stretch !important;
  gap: 8px;
}

.active-habit-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.day-pills {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.day-pill {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-weight: 800;
  font-size: 0.75rem;
  cursor: pointer;
}

.day-pill.on {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.habit-row.off-day {
  opacity: 0.65;
}

.coach-tips {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.coach-tip {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff9e6;
  border: 1px solid #ffd166;
  font-size: 0.85rem;
  color: #5b3b00;
}
