/* ========== Variables & Reset ========== */
:root {
  /* Dark mode (default): pure white + dark */
  --bg: #0A0A12;
  --bg-secondary: #141420;
  --bg-card: #101018;
  --bg-card-solid: #101018;
  --bg-glass: #16161E;
  --bg-glass-strong: #1A1A24;
  --text: #FFFFFF;
  --text-secondary: #888898;
  --text-muted: #505060;
  --accent: #FFFFFF;
  --border: rgba(255, 255, 255, 0.12);
  --primary: #FFFFFF;
  --primary-light: #E0E0E8;
  --primary-dark: #C0C0C8;
  --primary-bg: rgba(255, 255, 255, 0.08);
  --success: #6A9A70;
  --gradient-1: linear-gradient(135deg, #FFFFFF 0%, #E0E0E8 100%);
  --glass-border: rgba(255, 255, 255, 0.05);
  --glass-shadow: none;
  --shadow-sm: none;
  --shadow: none;
  --shadow-lg: none;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 50px;
  --nav-height: 64px;
  --transition: 0.15s ease;
}

/* Light mode: pure white + dark */
[data-theme="light"] {
  --bg: #FFFFFF;
  --bg-secondary: #F4F4F6;
  --bg-card: #FFFFFF;
  --bg-card-solid: #FFFFFF;
  --bg-glass: #F4F4F6;
  --bg-glass-strong: #F8F8FA;
  --text: #0A0A12;
  --text-secondary: #606068;
  --text-muted: #A0A0A8;
  --accent: #0A0A12;
  --border: rgba(10, 10, 18, 0.12);
  --primary: #0A0A12;
  --primary-light: #303038;
  --primary-dark: #000000;
  --primary-bg: rgba(10, 10, 18, 0.06);
  --glass-border: rgba(10, 10, 18, 0.05);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  font-weight: 350;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: calc(var(--nav-height) + 28px);
}

/* ========== Typography ========== */
h1, h2, h3, .app-title, .greeting-text, .mood-hero-label, .checkin-greeting {
  font-family: 'Google Sans Flex', 'Manrope', sans-serif;
}

h1 { font-family: 'Google Sans Flex', sans-serif; font-size: 1.3rem; font-weight: 400; letter-spacing: 0.02em; }
h2 { font-size: 0.9rem; font-weight: 350; letter-spacing: 0.01em; }
h3 { font-size: 1rem; font-weight: 350; }

.app-title {
  font-family: 'Google Sans Flex', sans-serif;
  font-size: 1.5rem;
  font-weight: 250;
  color: var(--text);
  letter-spacing: 0.06em;
}

/* ========== Layout ========== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 20px 8px;
}

.page-header-simple { padding: 24px 20px 10px; }
.page-header-simple + .card { border-top: none; }

.date-display {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-top: 2px;
  font-weight: 400;
}

.tab-content { animation: fadeIn 0.25s ease; }

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

/* ========== Greeting ========== */
.greeting-banner {
  margin: 6px 20px 4px;
  padding: 16px 4px;
}

.greeting-text {
  font-family: 'Google Sans Flex', sans-serif;
  font-size: 1.5rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--text);
}

.greeting-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 6px;
  font-weight: 350;
}

/* ========== Glass Cards ========== */
.card {
  background: transparent;
  border: none;
  border-radius: 0;
  border-top: 1px solid var(--border);
  padding: 22px 24px;
  margin: 0;
  box-shadow: none;
}

.card-title {
  font-family: 'Google Sans Flex', 'Manrope', sans-serif;
  margin-bottom: 14px;
  font-size: 0.72rem;
  font-weight: 350;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.card-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: -10px;
  margin-bottom: 14px;
  font-weight: 400;
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.card-header-row .card-title { margin-bottom: 0; }

.card-divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: 50px;
  border: none;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: -0.01em;
}

.btn-primary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--text-muted);
  box-shadow: none;
}

.btn-primary:hover { border-color: var(--text); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover { background: var(--primary-bg); color: var(--primary); }

.btn-danger { background: transparent; color: #C44; border: 1px solid #C44; }
.btn-danger:hover { background: rgba(204,68,68,0.06); }

.btn-sm { padding: 7px 16px; font-size: 0.8rem; }

.btn-icon {
  background: var(--primary-bg);
  color: var(--primary);
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.btn-icon:hover { background: var(--primary); color: var(--bg); }

/* ========== Bottom Navigation ========== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--nav-height);
  background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 4px;
  z-index: 100;
  box-shadow: none;
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.6rem;
  font-family: inherit;
  font-weight: 400;
  cursor: pointer;
  padding: 6px 10px;
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.nav-btn.active { color: var(--text); }
.nav-btn:hover { color: var(--primary); }
.nav-btn.checkin-btn { position: relative; top: -14px; }

.checkin-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--text);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg);
  box-shadow: none;
  transition: all var(--transition);
}

.checkin-btn:hover .checkin-circle { opacity: 0.85; }
.checkin-btn span { color: var(--text-secondary); font-weight: 400; }

/* ========== Streak Badge ========== */
.streak-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 50px;
  padding: 5px 12px;
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

[data-theme="light"] .streak-badge {
  background: rgba(0, 0, 0, 0.05);
}

.streak-icon { width: 14px; height: 14px; stroke: var(--text-secondary); fill: none; stroke-width: 1.5; }

/* ========== Mood Display ========== */
.mood-summary {
  padding: 0 20px;
}

.mood-summary + .card {
  border-top: none;
}

.mood-card {
  background: var(--bg-secondary);
  border-radius: 20px;
  padding: 28px 24px 22px;
  position: relative;
  overflow: hidden;
}

.mood-glow {
  position: absolute;
  top: 50%;
  left: 15%;
  transform: translate(-50%, -50%);
  width: 120px;
  height: 120px;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.25;
  pointer-events: none;
  z-index: 0;
}

.mood-empty {
  text-align: center;
  padding: 24px 0;
}

.mood-empty-text {
  color: var(--text-muted);
  margin-bottom: 16px;
  font-size: 0.82rem;
  font-weight: 350;
}

.btn-minimal {
  display: inline-flex;
  align-items: center;
  padding: 8px 20px;
  border-radius: 50px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 350;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-minimal:hover { border-color: var(--text-muted); }

.mood-display-main {
  display: flex;
  align-items: center;
  gap: 18px;
  position: relative;
  z-index: 1;
}

.mood-shape {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mood-word {
  font-family: 'Google Sans Flex', sans-serif;
  font-size: 2.4rem;
  font-weight: 450;
  letter-spacing: 0.02em;
  color: var(--text);
  line-height: 1;
}

.mood-tags-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 14px;
  position: relative;
  z-index: 1;
}

.mood-tags-row .tag-pill {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text);
  opacity: 0.7;
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50px;
}

[data-theme="light"] .mood-tags-row .tag-pill {
  background: rgba(0, 0, 0, 0.07);
}

/* ========== Week Grid ========== */
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.week-day { text-align: center; }

.week-day-label {
  font-size: 0.66rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  margin-bottom: 8px;
  font-weight: 500;
}

.week-day-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  margin: 0 auto;
  background: var(--bg-secondary);
  opacity: 0.7;
  transition: all var(--transition);
}
.week-day-dot.filled { opacity: 1; }
.week-day-dot.today { outline: 2px solid var(--primary); outline-offset: 3px; }

/* ========== Month Grid ========== */
.month-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.month-nav { display: flex; align-items: center; gap: 14px; }

.month-nav-btn {
  background: var(--bg-secondary);
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.month-nav-btn:hover { color: var(--primary); background: var(--primary-bg); }

.month-label {
  font-size: 0.85rem;
  font-weight: 500;
  min-width: 120px;
  text-align: center;
}

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

.month-grid .day-label {
  text-align: center;
  font-size: 0.6rem;
  color: var(--text-muted);
  font-weight: 500;
  padding: 2px 0 8px;
}

.month-dot-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.month-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-secondary);
  transition: all var(--transition);
  border: none;
  opacity: 0.7;
}

.month-dot.filled { opacity: 1; }
.month-dot.today-ring { outline: 2px solid var(--primary); outline-offset: 3px; border-color: transparent; }
.month-dot.future { opacity: 0.9; }

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

.habit-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-radius: 0;
  background: transparent;
  border-bottom: 1px solid var(--border);
  transition: all var(--transition);
}
.habit-item:last-child { border-bottom: none; }

.habit-icon-box {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-secondary);
}

.habit-icon-box svg { width: 16px; height: 16px; stroke-width: 1.5; }

.habit-icon-wrap {
  position: relative;
  width: 36px; height: 36px;
  flex-shrink: 0;
}

.habit-icon-wrap .habit-icon-box {
  position: absolute;
  top: 2px; left: 2px;
}

.habit-goal-ring {
  position: absolute; top: 0; left: 0;
  width: 36px; height: 36px;
  transform: rotate(-90deg);
}

.habit-goal-ring circle {
  fill: none; stroke-width: 2;
}

.habit-goal-ring .ring-bg { stroke: var(--border); }
.habit-goal-ring .ring-fill { transition: stroke-dashoffset 0.4s ease; }
.habit-info { flex: 1; min-width: 0; }
.habit-name { font-weight: 400; font-size: 0.84rem; letter-spacing: 0; }

.habit-streak-info {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 400;
}

.habit-streak-bar {
  display: inline-block;
  height: 2.5px;
  border-radius: 50px;
  opacity: 0.45;
  min-width: 4px;
}

.habit-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
  background: transparent;
  color: transparent;
}

.habit-check:hover { border-color: var(--success); }
.habit-check.checked { border-color: var(--success); background: var(--success); color: #fff; }
.habit-check svg { width: 14px; height: 14px; stroke-width: 2.5; }

.habit-delete {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: 4px; opacity: 0; transition: opacity var(--transition); display: flex;
}
.habit-item:hover .habit-delete { opacity: 0.6; }
.habit-delete:hover { color: #C44; }

.empty-state { text-align: center; padding: 28px 12px; color: var(--text-muted); }
.empty-state p { font-size: 0.86rem; font-weight: 400; }

/* ========== Check-in Modal ========== */
.modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: fadeIn 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
}

.modal-content {
  background: rgba(16, 16, 24, 0.85);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border-radius: 28px 28px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 94vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 26px 22px 26px;
  animation: slideUp 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
  flex-shrink: 0;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.checkin-header { text-align: center; margin-bottom: 12px; }

.checkin-greeting {
  display: block; font-size: 1.3rem; font-weight: 600;
  margin-bottom: 4px; letter-spacing: -0.03em;
}

.checkin-subtext { color: var(--text-muted); font-size: 0.85rem; font-weight: 400; }

/* ========== Mood Display ========== */
.mood-display { text-align: center; margin-bottom: 4px; position: relative; }

.mood-number {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  position: relative;
  z-index: 1;
}

.checkin-mood-glow {
  position: fixed;
  bottom: 30%;
  left: 50%;
  transform: translateX(-50%);
  width: 500px;
  height: 500px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 201;
  /* No filter:blur — use radial-gradient for instant rendering */
  background: radial-gradient(circle, var(--glow-color, transparent) 0%, transparent 70%);
  opacity: 0.3;
}
.mood-label {
  position: relative; z-index: 1;
  display: block; font-size: 0.9rem; font-weight: 400;
  margin-top: 4px; transition: color 0.25s ease;
  letter-spacing: 0.02em;
}

/* ========== Glass Slider ========== */
.glass-slider-wrap {
  padding: 10px 4px 20px;
  user-select: none; -webkit-user-select: none; touch-action: none;
}

.glass-slider-track {
  position: relative;
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 50px;
  cursor: pointer;
}

.glass-slider-fill-clip {
  position: absolute;
  inset: 0;
  border-radius: 50px;
  overflow: hidden;
  pointer-events: none;
}

.glass-slider-glow {
  position: absolute;
  top: -20px;
  left: 0;
  height: 54px;
  border-radius: 50px;
  filter: blur(20px);
  opacity: 0.3;
  pointer-events: none;
  transition: width 0.12s ease, background-color 0.25s ease;
}

.glass-slider-fill {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  border-radius: 50px;
  transition: width 0.12s ease, background-color 0.2s ease;
  opacity: 0.7;
}

.glass-slider-thumb {
  position: absolute;
  top: 50%;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--active-mood-color, var(--text-muted));
  box-shadow: none;
  transform: translate(-50%, -50%);
  transition: left 0.12s ease, border-color 0.2s ease;
  z-index: 2;
  cursor: grab;
}

.glass-slider-thumb:active { cursor: grabbing; transform: translate(-50%, -50%) scale(1.08); }

/* ========== Context Sliders ========== */
.context-sliders { margin-bottom: 16px; }

.ctx-slider-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px; padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04); border-radius: 50px;
}

.ctx-label { font-size: 0.76rem; font-weight: 500; color: var(--text-secondary); min-width: 60px; }

.ctx-slider-track {
  flex: 1; position: relative; height: 5px;
  background: var(--bg-secondary); border-radius: 50px; cursor: pointer;
}

.ctx-slider-fill {
  position: absolute; top: 0; left: 0; height: 100%;
  border-radius: 50px; background: var(--text); opacity: 0.3;
  transition: width 0.12s ease;
}

.ctx-slider-thumb {
  position: absolute; top: 50%; width: 14px; height: 14px;
  border-radius: 50%; background: var(--text); border: none;
  transition: left 0.12s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  transform: translate(-50%, -50%); transition: left 0.12s ease;
  cursor: grab; z-index: 2;
}

.ctx-value {
  font-size: 0.75rem; font-weight: 400; color: var(--text-secondary);
  min-width: 18px; text-align: right;
}

/* ========== Tags ========== */
.tags-section { margin-bottom: 18px; }

.tags-title {
  font-size: 0.78rem; font-weight: 500; color: var(--text-muted);
  margin-bottom: 10px;
}

.tags-grid { display: flex; flex-wrap: wrap; gap: 8px; }

.tag-add-btn {
  border-style: dashed !important;
  color: var(--text-muted) !important;
  padding: 6px 10px !important;
}
.tag-add-btn:hover { border-color: var(--text-secondary) !important; color: var(--text-secondary) !important; }

.checkin-new-tag-panel {
  margin-top: 10px;
  padding: 10px 0 0;
  animation: fadeIn 0.15s ease;
}

.checkin-new-tag-panel .add-tag-row { display: flex; gap: 8px; align-items: center; }
.checkin-new-tag-panel input[type="text"] {
  flex: 1; padding: 8px 14px; border-radius: var(--radius-xs);
  border: 1px solid var(--border); background: var(--bg-secondary);
  color: var(--text); font-family: inherit; font-size: 0.8rem;
}
.checkin-new-tag-panel input[type="text"]:focus { outline: none; border-color: var(--primary); }

.tag-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 14px; border-radius: 50px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-secondary); font-family: inherit; font-size: 0.78rem; font-weight: 350;
  cursor: pointer; transition: all var(--transition);
}

.tag-btn:hover { border-color: var(--text-muted); }
.tag-btn.selected { background: color-mix(in srgb, var(--active-mood-color, var(--text)) 12%, transparent); border-color: var(--active-mood-color, var(--text)); color: var(--text); font-weight: 400; }
.tag-btn .tag-icon { width: 14px; height: 14px; display: inline-flex; align-items: center; justify-content: center; }
.tag-btn .tag-icon svg { width: 13px; height: 13px; stroke-width: 2; }

/* ========== Check-in Note ========== */
.checkin-note {
  width: 100%; padding: 10px 18px;
  border-radius: 50px; border: 1px solid var(--border);
  background: transparent; color: var(--text);
  font-family: inherit; font-size: 0.82rem; resize: none; height: 42px;
  transition: border-color var(--transition); font-weight: 350;
}

.checkin-note:focus { outline: none; border-color: var(--active-mood-color, var(--text-muted)); }

.checkin-actions { display: flex; gap: 8px; margin-top: 14px; }
.checkin-actions .btn { flex: 1; height: 42px; padding: 0 16px; }
.checkin-actions .btn-primary { background: var(--active-mood-color, var(--text)); color: var(--bg); border: none; transition: background 0.25s ease; }

.checkin-edit-banner {
  text-align: center; padding: 6px 12px; margin-bottom: 12px;
  background: var(--primary-bg); border-radius: 50px;
  font-size: 0.75rem; font-weight: 500; color: var(--primary);
}

/* ========== Habit Form Modal ========== */
.habit-form h3 { text-align: center; margin-bottom: 22px; font-weight: 600; }

.form-group { margin-bottom: 18px; }

.form-group label {
  display: block; font-size: 0.78rem; font-weight: 500;
  color: var(--text-secondary); margin-bottom: 6px;
}

.form-group input[type="text"] {
  width: 100%; padding: 10px 16px; border-radius: 50px;
  border: 1px solid var(--border); background: var(--bg-secondary);
  color: var(--text); font-family: inherit; font-size: 0.88rem; font-weight: 400;
}

.form-group input:focus { outline: none; border-color: var(--primary); }

.icon-picker { display: flex; flex-wrap: wrap; gap: 6px; }

.icon-pick-btn {
  width: 42px; height: 42px; border-radius: var(--radius-xs);
  border: 1.5px solid var(--border); background: var(--bg-secondary);
  cursor: pointer; transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}

.icon-pick-btn svg { width: 20px; height: 20px; stroke-width: 1.8; }
.icon-pick-btn:hover { border-color: var(--primary-light); color: var(--text-secondary); }
.icon-pick-btn.selected { border-color: var(--primary); background: var(--primary-bg); color: var(--primary); }

.color-picker { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }

.color-btn {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2.5px solid transparent; cursor: pointer; transition: all var(--transition);
}

.color-btn:hover { transform: scale(1.1); }
.color-btn.selected { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg-card-solid); }

.modal-actions { display: flex; gap: 10px; margin-top: 22px; }
.modal-actions .btn { flex: 1; }

/* ========== Charts ========== */
.chart-container { position: relative; height: 220px; }
.chart-container-sm { position: relative; height: 160px; }

/* ========== Insights ========== */
.avg-mood-display { text-align: center; margin-bottom: 18px; }

.avg-mood-score {
  display: flex; align-items: center; justify-content: center;
  min-height: 56px;
}

.avg-mood-label {
  display: block; color: var(--text-muted); font-size: 0.85rem;
  margin-top: 4px; font-weight: 400;
}

/* ========== Insights Tabs ========== */
.insights-tabs {
  position: relative;
  display: flex;
  margin: 4px 20px 12px;
  background: var(--bg-secondary);
  border-radius: 50px;
  padding: 4px;
}

.insights-tab-slider {
  position: absolute;
  top: 4px;
  left: 4px;
  height: calc(100% - 8px);
  border-radius: 50px;
  background: var(--primary);
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 0;
}

.insights-tab {
  flex: 1;
  padding: 10px 0;
  border: none;
  border-radius: 50px;
  background: transparent;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.25s ease;
  position: relative;
  z-index: 1;
}

.insights-tab.active { color: var(--bg); }

.insights-tab:hover:not(.active) { color: var(--text-secondary); }

/* Mini Toggle (Sleep/Activity) */
.mini-toggle {
  display: flex;
  background: var(--bg-secondary);
  border-radius: 50px;
  padding: 2px;
  gap: 2px;
}

.mini-toggle-btn {
  padding: 5px 12px;
  border: none;
  border-radius: 50px;
  background: transparent;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.mini-toggle-btn.active {
  background: var(--bg-card-solid);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* Language Toggle */
.lang-toggle {
  display: flex;
  background: var(--bg-secondary);
  border-radius: 50px;
  padding: 2px;
  gap: 2px;
}

.lang-btn {
  padding: 5px 14px;
  border: none;
  border-radius: 50px;
  background: transparent;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.lang-btn.active {
  background: var(--primary);
  color: var(--bg);
}

/* ========== Correlations ========== */
.correlations-list { display: flex; flex-direction: column; gap: 6px; }

.corr-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--bg-card);
}

.corr-arrow {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.corr-arrow svg { width: 14px; height: 14px; stroke-width: 2.5; }
.corr-arrow.up { background: rgba(48, 165, 106, 0.12); color: #30A56A; }
.corr-arrow.down { background: rgba(91, 79, 199, 0.12); color: #5B4FC7; }

.corr-name { flex: 1; font-weight: 500; font-size: 0.85rem; }

.corr-diff { font-weight: 600; font-size: 0.85rem; letter-spacing: -0.02em; }
.corr-diff.positive { color: #30A56A; }
.corr-diff.negative { color: #5B4FC7; }

/* ========== Tips ========== */
.tips-card {
  background: rgba(200, 170, 130, 0.06); backdrop-filter: blur(20px);
}

.tips-list { display: flex; flex-direction: column; gap: 8px; }

.tip-item {
  background: rgba(200, 170, 130, 0.06);
  border-radius: var(--radius-sm);
  padding: 14px 16px; font-size: 0.84rem; line-height: 1.55; font-weight: 400;
}

/* ========== History ========== */
.history-list { padding: 0 20px; }
.history-day { margin-bottom: 20px; }

.history-day-label {
  font-size: 0.78rem; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 10px; padding-left: 2px;
}

.history-entry {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 14px 0; margin-bottom: 0;
  display: flex; align-items: center; gap: 12px;
}

.history-shape { flex-shrink: 0; display: flex; align-items: center; }
.history-entry-info { flex: 1; min-width: 0; }
.history-entry-time { font-size: 0.72rem; color: var(--text-muted); font-weight: 400; }
.history-entry-score { font-weight: 500; font-size: 0.9rem; }
.history-entry-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

.history-entry-tags .tag-pill {
  font-size: 0.68rem; padding: 2px 8px; border-radius: 50px;
  background: var(--primary-bg); color: var(--primary); font-weight: 500;
}

.history-entry-note { font-size: 0.76rem; color: var(--text-muted); font-style: italic; margin-top: 3px; }
.history-entry-ctx { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }

.history-entry-edit,
.history-entry-delete {
  background: none; border: none; color: var(--text-secondary);
  cursor: pointer; padding: 6px; opacity: 0.7;
  transition: opacity var(--transition), color var(--transition); display: flex;
}

.history-entry:hover .history-entry-edit,
.history-entry:hover .history-entry-delete { opacity: 1; }
.history-entry-edit:hover { color: var(--primary); }
.history-entry-delete:hover { color: #C44; }
.history-entry-edit svg,
.history-entry-delete svg { width: 18px; height: 18px; }

/* ========== Settings ========== */
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}

.setting-row:last-child { border-bottom: none; }
.setting-label span:first-child { display: block; font-weight: 500; font-size: 0.86rem; }
.setting-desc { font-size: 0.74rem; color: var(--text-muted); }

.time-input {
  padding: 8px 14px; border-radius: 50px;
  border: 1px solid var(--border); background: var(--bg-secondary);
  color: var(--text); font-family: inherit; font-size: 0.84rem;
}

.name-input {
  padding: 8px 16px; border-radius: 50px;
  border: 1px solid var(--border); background: var(--bg-secondary);
  color: var(--text); font-family: inherit; font-size: 0.86rem;
  width: 160px; text-align: left; font-weight: 500;
}

.name-input:focus { outline: none; border-color: var(--primary); }

.time-input:focus { outline: none; border-color: var(--primary); }

.evening-start-control { display: flex; align-items: center; gap: 10px; }
.evening-start-btn {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--bg-secondary); color: var(--text); font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  padding: 0; line-height: 1; text-indent: 0;
}
.evening-start-btn:active { background: var(--border); }
.evening-start-btn:disabled { opacity: 0.3; pointer-events: none; }
#morning-start-value, #evening-start-value { font-size: 0.9rem; font-weight: 500; min-width: 44px; text-align: center; }

.toggle { position: relative; display: inline-block; width: 46px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute; inset: 0; background: var(--bg-secondary);
  border-radius: 50px; cursor: pointer; transition: var(--transition);
}

.toggle-slider::before {
  content: ''; position: absolute; height: 18px; width: 18px;
  left: 3px; bottom: 3px; background: var(--text-secondary); border-radius: 50%;
  transition: var(--transition); box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { background: var(--bg); transform: translateX(22px); }

.tags-settings { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }

.tag-setting {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 50px;
  background: var(--primary-bg); color: var(--primary);
  font-size: 0.78rem; font-weight: 500;
}

.tag-setting svg { width: 12px; height: 12px; }

.tag-remove {
  background: none; border: none; color: var(--primary);
  cursor: pointer; font-size: 0.9rem; line-height: 1;
  padding: 0 0 0 2px; opacity: 0.5;
}
.tag-remove:hover { opacity: 1; }

.add-tag-row { display: flex; gap: 8px; align-items: center; }

.add-tag-row input[type="text"] {
  flex: 1; padding: 8px 16px; border-radius: var(--radius-xs);
  border: 1px solid var(--border); background: var(--bg-secondary);
  color: var(--text); font-family: inherit; font-size: 0.8rem;
}

.add-tag-row input[type="text"]:focus { outline: none; border-color: var(--primary); }

.tag-icon-picker-wrap { position: relative; }

.tag-icon-trigger {
  width: 38px; height: 34px; border-radius: var(--radius-xs);
  border: 1px solid var(--border); background: var(--bg-secondary);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: all var(--transition); flex-shrink: 0;
}

.tag-icon-trigger:hover { border-color: var(--primary); color: var(--primary); }
.tag-icon-trigger svg { width: 16px; height: 16px; stroke-width: 1.8; }

.tag-icon-dropdown {
  position: absolute; bottom: calc(100% + 6px); right: 0;
  width: 250px; max-height: 190px; overflow-y: auto;
  background: var(--bg-card-solid); border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  padding: 8px; display: flex; flex-wrap: wrap; gap: 4px;
  z-index: 50; animation: fadeIn 0.15s ease;
}

.tag-icon-option {
  width: 36px; height: 36px; border-radius: var(--radius-xs);
  border: 1px solid transparent; background: var(--bg-secondary);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: all var(--transition);
}

.tag-icon-option:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }
.tag-icon-option.selected { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }
.tag-icon-option svg { width: 16px; height: 16px; stroke-width: 1.8; }

/* ========== Toast ========== */
.toast {
  position: fixed; bottom: 92px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg-card-solid);
  padding: 9px 22px; border-radius: 50px;
  font-size: 0.82rem; font-weight: 500;
  z-index: 300; animation: toastIn 0.3s ease; box-shadow: var(--shadow-lg);
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.app-version {
  text-align: center; color: var(--text-muted);
  font-size: 0.72rem; padding: 24px 0; font-weight: 400;
}

[data-theme="light"] .modal-content {
  background: rgba(255, 255, 255, 0.88);
}

@media (min-width: 481px) {
  .modal-content { border-radius: 28px; margin: auto; max-width: 420px; }
}

body, .card, .bottom-nav, .btn, .tag-btn, input, textarea {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* ========== Goals ========== */
.goals-list { display: flex; flex-direction: column; gap: 10px; }

.goal-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.goal-row:last-child { border-bottom: none; }

.goal-habit-name { flex: 1; font-size: 0.85rem; font-weight: 500; }

.goal-selector {
  display: flex; align-items: center; gap: 6px;
}

.goal-dot {
  width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid var(--border); background: transparent;
  cursor: pointer; transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6rem; color: transparent; padding: 0;
}

.goal-dot.active {
  border-color: var(--primary); background: var(--primary); color: var(--bg);
}

.goal-dot:hover { border-color: var(--text-muted); }

.goal-label { font-size: 0.72rem; color: var(--text-muted); min-width: 30px; text-align: right; }

/* ========== Goal Complete Animation ========== */
.goal-complete-overlay {
  position: fixed; inset: 0; z-index: 400;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}

.goal-complete-content {
  text-align: center;
  animation: goalPop 1.2s ease forwards;
}

.goal-complete-check {
  font-size: 3rem; color: var(--success);
  animation: goalCheckBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.goal-complete-text {
  font-family: 'Google Sans Flex', sans-serif;
  font-size: 1.1rem; font-weight: 500; color: var(--text);
  margin-top: 8px; opacity: 0;
  animation: goalTextFade 0.5s ease 0.3s forwards;
}

@keyframes goalCheckBounce {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); opacity: 1; }
}

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

@keyframes goalPop {
  0% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

/* ========== Micro Interactions ========== */
.card:active { transform: scale(0.99); }

.nav-btn:active { transform: scale(0.92); }

.habit-check:active { transform: scale(0.88); }

.tag-btn:active { transform: scale(0.96); }

.btn-primary:active { transform: scale(0.97); }

.streak-badge:hover { transform: scale(1.03); }

.week-day-dot.filled:hover { transform: scale(1.1); }
.month-dot.filled:hover { transform: scale(1.2); }

.history-entry:active { transform: scale(0.99); }

/* ========== Focus Visible ========== */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.nav-btn:focus-visible,
.btn:focus-visible,
.tag-btn:focus-visible,
.habit-check:focus-visible,
.insights-tab:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
