/* ==========================================================================
   HoneyTrack — Design Tokens & Variables
   ========================================================================== */
:root,
body[data-color-theme="blue"] {
  /* Backgrounds */
  --bg-primary: #f0f7ff;
  --bg-secondary: #f5f9ff;
  --bg-tertiary: #e1f0ff;

  /* Card background — near-white with faintest blue tint */
  --card-bg: #f0f8ff;

  /* Accents */
  --hero-blue: #70b2ff;
  --hero-blue-hover: #4d9eff;
  --hero-blue-light: #ebf4ff;

  /* Text */
  --text-primary: #1e293b;
  --text-secondary: #5b7290;
  --text-muted: #94a3b8;

  /* Borders & Statuses */
  --border-color: #bfdbfe;
  --complete-green: #10b981;
  --complete-green-light: rgba(16, 185, 129, 0.10);

  --streak-orange: #f97316;
  --streak-orange-light: rgba(249, 115, 22, 0.10);

  --danger-red: #ef4444;
  --danger-red-hover: #dc2626;
  --danger-red-light: rgba(239, 68, 68, 0.05);

  /* Gradient */
  --ms-gradient-bg: linear-gradient(170deg, #f0f7ff, #ffffff, #e0f2fe, #bae6fd);

  /* Soft shadows */
  --card-shadow: 0 2px 12px rgba(30,41,59,0.07), 0 1px 3px rgba(30,41,59,0.05);
  --card-shadow-hover: 0 6px 20px rgba(30,41,59,0.12), 0 2px 6px rgba(30,41,59,0.07);

  /* Fonts */
  --font-sans: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;

  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Grid & Calendar Sizes */
  --grid-cell-size: 9px;
  --grid-cell-gap: 2px;
  --day-circle-size: 44px;
  --calendar-gap: 8px;
}

body[data-color-theme="amber"] {
  /* Backgrounds */
  --bg-primary: #fffdf5;
  --bg-secondary: #ffffff;
  --bg-tertiary: #fef6df;
  --card-bg: #ffffff;

  /* Accents */
  --hero-blue: #fbbf24;
  --hero-blue-hover: #f59e0b;
  --hero-blue-light: #fef3c7;

  /* Text */
  --text-primary: #322718;
  --text-secondary: #785e3a;
  --text-muted: #a8906d;

  /* Borders & Statuses */
  --border-color: #fde68a;
  --complete-green: #10b981;
  --streak-orange: #f97316;
  --danger-red: #ef4444;

  /* Gradient */
  --ms-gradient-bg: linear-gradient(170deg, #fffdf5, #ffffff, #fef3c7, #fde68a);
  /* Custom Buttons for Amber Theme */
  --btn-primary-bg: linear-gradient(180deg, #fef3c7, #ffffff);
  --btn-primary-color: #785e3a;
  --btn-primary-border: 1px solid #fbbf24;
  --btn-primary-shadow: none;
  --btn-primary-hover-bg: #ffffff;
}

body[data-color-theme="amber"] .btn-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-color);
  border: var(--btn-primary-border);
  box-shadow: var(--btn-primary-shadow);
}
body[data-color-theme="amber"] .btn-primary:hover {
  background: var(--btn-primary-hover-bg);
  border-color: #f59e0b;
}
body[data-color-theme="amber"] .btn-primary:active {
  box-shadow: none;
  background: #fffdf5;
}
body[data-color-theme="amber"] .btn-secondary {
  box-shadow: none;
  border: 1px solid #fde68a;
}
body[data-color-theme="amber"] .btn-secondary:hover {
  background-color: #fffdf5;
}
body[data-color-theme="amber"] .btn-secondary:active {
  box-shadow: none;
}

body[data-color-theme="blush"] {
  /* Backgrounds */
  --bg-primary: #fcf8f6;
  --bg-secondary: #ffffff;
  --bg-tertiary: #faf0ee;
  --card-bg: var(--bg-primary);

  /* Accents */
  --hero-blue: #f1bba5;
  --hero-blue-hover: #d99c85;
  --hero-blue-light: #fce8df;

  /* Text */
  --text-primary: #2b2725;
  --text-secondary: #a87f73;
  --text-muted: #cca99f;

  /* Borders & Statuses */
  --border-color: #f7e7e3;
  --complete-green: #10b981;
  --streak-orange: #f97316;
  --danger-red: #ef4444;

  /* Gradient */
  --ms-gradient-bg: linear-gradient(170deg, #fcf8f6, #fefcfb, #faece8, #f4d5cc);
}

body.dark-theme,
body.dark-theme[data-color-theme="blue"] {
  /* Backgrounds */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --card-bg: #162033;

  /* Accents */
  --hero-blue: #82c0ff;
  --hero-blue-hover: #a5d4ff;
  --hero-blue-light: #1e3a8a;

  /* Text */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Borders */
  --border-color: #1e3a5f;

  /* Gradient */
  --ms-gradient-bg: linear-gradient(170deg, #0f172a, #111827, #1e293b, #0c4a6e);

  --complete-green-light: rgba(16, 185, 129, 0.15);
  --streak-orange-light: rgba(249, 115, 22, 0.15);

  --card-shadow: 0 2px 12px rgba(0,0,0,0.4), 0 1px 3px rgba(0,0,0,0.3);
  --card-shadow-hover: 0 6px 20px rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.35);
}

body.dark-theme[data-color-theme="amber"] {
  /* Backgrounds */
  --bg-primary: #1c1917;
  --bg-secondary: #292524;
  --bg-tertiary: #3d3228;
  --card-bg: var(--bg-primary);

  /* Accents */
  --hero-blue: #fbbf24;
  --hero-blue-hover: #fcd34d;
  --hero-blue-light: #451a03;

  /* Text */
  --text-primary: #fffbeb;
  --text-secondary: #d6c5a0;
  --text-muted: #968469;

  /* Borders */
  --border-color: #443a2e;

  /* Gradient */
  --ms-gradient-bg: linear-gradient(170deg, #1c1917, #241e17, #2d2318, #451a03);
}

body.dark-theme[data-color-theme="blush"] {
  /* Backgrounds */
  --bg-primary: #1a1614;
  --bg-secondary: #231d1b;
  --bg-tertiary: #2c2421;
  --card-bg: var(--bg-primary);

  /* Accents */
  --hero-blue: #f1bba5;
  --hero-blue-hover: #d99c85;
  --hero-blue-light: rgba(241, 187, 165, 0.15);

  /* Text */
  --text-primary: #f5ece9;
  --text-secondary: #c2a399;
  --text-muted: #8c736b;

  /* Borders */
  --border-color: #3a2e2a;

  /* Gradient */
  --ms-gradient-bg: linear-gradient(170deg, #1a1614, #1e1917, #221a18, #271c19);
}

/* ==========================================================================
   Mono (Black & White) Theme — Light
   ========================================================================== */
body[data-color-theme="mono"] {
  /* Backgrounds */
  --bg-primary: #f5f5f5;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e8e8e8;
  --card-bg: #ffffff;

  /* Accents — charcoal ink */
  --hero-blue: #1a1a1a;
  --hero-blue-hover: #000000;
  --hero-blue-light: #ebebeb;

  /* Text */
  --text-primary: #0a0a0a;
  --text-secondary: #4a4a4a;
  --text-muted: #909090;

  /* Borders & Statuses */
  --border-color: #d4d4d4;
  --complete-green: #2d7a4f;
  --complete-green-light: rgba(45, 122, 79, 0.10);
  --streak-orange: #b45309;
  --streak-orange-light: rgba(180, 83, 9, 0.10);
  --danger-red: #c0392b;
  --danger-red-hover: #96281b;
  --danger-red-light: rgba(192, 57, 43, 0.05);

  /* Gradient — clean white fog */
  --ms-gradient-bg: linear-gradient(170deg, #f5f5f5, #ffffff, #ececec, #e0e0e0);

  /* Shadows — crisp, ink-like */
  --card-shadow: 0 2px 10px rgba(0,0,0,0.10), 0 1px 3px rgba(0,0,0,0.08);
  --card-shadow-hover: 0 6px 22px rgba(0,0,0,0.16), 0 2px 6px rgba(0,0,0,0.10);

  /* Fonts (inherit global) */
  --font-sans: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;

  /* Transitions (inherit global) */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Grid & Calendar Sizes */
  --grid-cell-size: 9px;
  --grid-cell-gap: 2px;
  --day-circle-size: 44px;
  --calendar-gap: 8px;
}

/* ==========================================================================
   Mono (Black & White) Theme — Dark
   ========================================================================== */
body.dark-theme[data-color-theme="mono"] {
  /* Backgrounds */
  --bg-primary: #111111;
  --bg-secondary: #1e1e1e;
  --bg-tertiary: #2a2a2a;
  --card-bg: #1e1e1e;

  /* Accents — silver/white */
  --hero-blue: #d4d4d4;
  --hero-blue-hover: #ffffff;
  --hero-blue-light: #2a2a2a;

  /* Text */
  --text-primary: #f0f0f0;
  --text-secondary: #a0a0a0;
  --text-muted: #606060;

  /* Borders */
  --border-color: #2e2e2e;

  /* Gradient — deep ink */
  --ms-gradient-bg: linear-gradient(170deg, #111111, #161616, #1e1e1e, #252525);

  --complete-green: #4caf82;
  --complete-green-light: rgba(76, 175, 130, 0.15);
  --streak-orange: #d4843a;
  --streak-orange-light: rgba(212, 132, 58, 0.15);
  --danger-red: #e05555;
  --danger-red-hover: #c43939;
  --danger-red-light: rgba(224, 85, 85, 0.08);

  --card-shadow: 0 2px 12px rgba(0,0,0,0.6), 0 1px 3px rgba(0,0,0,0.5);
  --card-shadow-hover: 0 6px 20px rgba(0,0,0,0.7), 0 2px 6px rgba(0,0,0,0.55);
}

/* ==========================================================================
   Base resets & typography
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  overflow-x: hidden;
  max-width: 100%;
}

body,
input,
button,
select,
textarea {
  font-family: var(--font-sans);
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  transition: background var(--transition-normal);
}

body.dark-theme {
  background: var(--bg-primary);
}

/* Constrained device wrapper */
.app-container {
  width: 100%;
  max-width: 680px;
  min-height: 100vh;
  background-color: transparent;
  box-shadow: none;
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 32px 24px 110px 24px;
}

@media (max-width: 480px) {
  .app-container {
    padding: 24px 16px 100px 16px;
  }
}

/* ==========================================================================
   Header Component
   ========================================================================== */
.app-header {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.header-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.greeting-container h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.25;
}

.greeting-container h1 .greeting-time {
  font-size: 20px;
  font-weight: 500;
  color: var(--text-secondary);
  display: inline-block;
}

.greeting-container h1 .greeting-name {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  display: inline-block;
}

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

/* Greeting container when inside dashboard tab */
#greeting-section {
  margin-bottom: 24px;
  padding-top: 4px;
}

.header-badges {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: center;
}

.theme-toggle-btn {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: transform var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast);
  flex-shrink: 0;
}

.theme-toggle-btn:hover {
  background-color: var(--bg-secondary);
  border-color: var(--text-muted);
}

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

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}

.streak-badge {
  background-color: var(--streak-orange-light);
  color: var(--streak-orange);
  border-color: rgba(249, 115, 22, 0.15);
}

.score-badge {
  background-color: var(--complete-green-light);
  color: var(--complete-green);
  border-color: rgba(34, 197, 94, 0.15);
}

.icon {
  flex-shrink: 0;
}

.flame-icon {
  stroke: var(--streak-orange);
  fill: rgba(249, 115, 22, 0.1);
}

/* Progress Card */
.progress-card {
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 20px;
  background-color: var(--bg-primary);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.015);
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 12px;
}

.progress-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.progress-percent {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.progress-bar-bg {
  height: 10px;
  background-color: var(--bg-tertiary);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--hero-blue) 0%, var(--complete-green) 100%);
  border-radius: 99px;
  width: 0%;
  transition: width var(--transition-slow);
}

/* ==========================================================================
   Navigation (Bottom Tab Bar)
   ========================================================================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 680px;
  height: 76px;
  background-color: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 99;
  padding: 0 16px;
  transition: background-color var(--transition-normal), border-top-color var(--transition-normal);
}

body.dark-theme .bottom-nav {
  background-color: rgba(21, 21, 26, 0.65);
  border-top-color: var(--border-color);
}

.nav-item {
  flex: 1;
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 0;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color var(--transition-fast), transform 0.1s ease;
  white-space: nowrap;
}

.nav-item:active {
  transform: scale(0.95);
}

.nav-item svg {
  transition: stroke-width 0.2s;
}

.nav-item.active {
  color: var(--hero-blue);
}

.nav-item.active svg {
  stroke-width: 2.5;
}

.nav-item span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ==========================================================================
   Tabs View & Contents
   ========================================================================== */
.app-main {
  flex: 1;
  position: relative;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: tabFadeIn var(--transition-normal) forwards;
}

@keyframes tabFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   Cards & Layout Components
   ========================================================================== */
.dashboard-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card {
  position: relative;
  background-color: var(--card-bg, var(--bg-primary));
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 22px;
  box-shadow: var(--card-shadow);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal), transform var(--transition-normal);
}

.card:hover {
  border-color: var(--text-muted);
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-2px);
}

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

.card-title-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title-area h2 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

/* Round Badge Indicator */
.indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.hero-indicator {
  background-color: var(--hero-blue);
  box-shadow: 0 0 8px rgba(0, 122, 255, 0.3);
}

.routine-indicator {
  background-color: var(--text-secondary);
}

/* ==========================================================================
   Lists & Task Styling
   ========================================================================== */
.task-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: 12px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  transition: all var(--transition-normal);
}

.task-item:hover {
  background-color: var(--bg-secondary);
  border-color: var(--text-muted);
}

.task-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
  /* Ensures overflow text-ellipsis works */
}

/* Checkbox design */
.task-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  background-color: var(--bg-primary);
  flex-shrink: 0;
  border: 2px solid var(--border-color);
}

/* Uncompleted states styling */
.hero-task .task-checkbox {
  border-color: rgba(0, 122, 255, 0.4);
}

.hero-task .task-checkbox:hover {
  border-color: var(--hero-blue);
  background-color: var(--hero-blue-light);
}

.routine-task .task-checkbox {
  border-color: var(--text-muted);
}

.routine-task .task-checkbox:hover {
  border-color: var(--text-secondary);
  background-color: var(--bg-tertiary);
}

.task-checkbox svg {
  stroke: var(--bg-primary);
  opacity: 0;
  transform: scale(0.6);
  transition: transform var(--transition-spring), opacity var(--transition-fast);
}

/* Completed task state styling */
.task-item.completed {
  background-color: var(--bg-secondary);
  border-color: var(--border-color);
  opacity: 0.8;
}

.task-item.completed .task-checkbox {
  background-color: var(--complete-green);
  border-color: var(--complete-green);
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.25);
}

.task-item.completed .task-checkbox svg {
  opacity: 1;
  transform: scale(1);
}

.task-text {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color var(--transition-normal), text-decoration-color var(--transition-normal);
  text-decoration: none;
  position: relative;
}

.task-item.completed .task-text {
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-color: var(--text-muted);
}

.task-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.task-item:hover .task-actions {
  opacity: 1;
}

/* Active Inline Edit Input */
.task-edit-input {
  flex: 1;
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
  font-size: 15px !important;
  font-weight: 500 !important;
  font-family: var(--font-sans);
  color: var(--text-primary);
  outline: none !important;
  box-shadow: none !important;
}

/* Empty states */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 10px;
  text-align: center;
  transition: opacity var(--transition-normal);
}

.empty-state.hidden {
  display: none !important;
}

.empty-icon {
  font-size: 32px;
  margin-bottom: 8px;
  filter: grayscale(0.2);
}

.empty-state p {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 260px;
}

/* ==========================================================================
   Activity Stats Grid
   ========================================================================== */
.stats-section {
  margin-top: 4px;
}

.section-subtitle {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

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

.stat-card {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.stat-card:hover {
  border-color: var(--text-muted);
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 4px 0 2px 0;
}

.stat-value.text-green {
  color: var(--complete-green);
}

.stat-value.text-blue {
  color: var(--hero-blue);
}

.stat-subtext {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.col-span-2 {
  grid-column: span 2;
}

/* ==========================================================================
   Forms, Inputs & Custom UI Actions
   ========================================================================== */
.inline-task-form,
.inline-template-form {
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  padding: 14px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
  animation: slideDown var(--transition-normal) forwards;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.inline-task-form.hidden,
.inline-template-form.hidden {
  display: none !important;
}

input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--bg-primary);
  transition: all var(--transition-fast);
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--hero-blue);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  position: relative;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background-color var(--transition-fast);
  white-space: nowrap;
}

.btn:active {
  transform: translateY(3px);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 8px;
}

.btn-primary {
  background-color: var(--hero-blue);
  color: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 4px 0 #0056b3, inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-primary:hover {
  background-color: var(--hero-blue-hover);
}

.btn-primary:active {
  box-shadow: 0 1px 0 #0056b3, inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-secondary {
  background-color: var(--bg-primary);
  border-color: var(--border-color);
  color: var(--text-primary);
  box-shadow: 0 4px 0 var(--border-color), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.btn-secondary:hover {
  background-color: var(--bg-secondary);
  border-color: var(--text-muted);
}

.btn-secondary:active {
  box-shadow: 0 1px 0 var(--border-color), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

body.dark-theme .btn-secondary {
  box-shadow: 0 4px 0 var(--bg-tertiary), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

body.dark-theme .btn-secondary:active {
  box-shadow: 0 1px 0 var(--bg-tertiary), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-secondary);
  box-shadow: none;
}

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

.btn-ghost:active {
  transform: translateY(2px);
  box-shadow: none;
}

.btn-danger {
  background-color: var(--danger-red);
  color: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 4px 0 #b91c1c, inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-danger:hover {
  background-color: var(--danger-red-hover);
}

.btn-danger:active {
  box-shadow: 0 1px 0 #b91c1c, inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Icon Button */
.btn-icon {
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

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

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

.add-task-btn {
  border: 1px solid rgba(0, 122, 255, 0.15);
  background-color: var(--hero-blue-light);
  color: var(--hero-blue);
  box-shadow: 0 4px 0 rgba(0, 122, 255, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: transform 0.1s ease, box-shadow 0.1s ease, background-color var(--transition-fast);
}

.add-task-btn:hover {
  background-color: rgba(0, 122, 255, 0.14);
  color: var(--hero-blue-hover);
  border-color: rgba(0, 122, 255, 0.25);
}

.add-task-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(0, 122, 255, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* ==========================================================================
   History View & List
   ========================================================================== */
.history-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.history-header h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
}

.history-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

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

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.history-item:hover {
  border-color: var(--text-muted);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.015);
  transform: translateY(-1px);
}

.history-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.history-meta {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.history-score {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 8px;
}

.history-score.high {
  background-color: var(--complete-green-light);
  color: var(--complete-green);
}

.history-score.mid {
  background-color: var(--hero-blue-light);
  color: var(--hero-blue);
}

.history-score.low {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
}

/* ==========================================================================
   Settings View
   ========================================================================== */
.settings-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.settings-header h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
}

.settings-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

.settings-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-card h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.settings-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.settings-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.template-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.template-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
}

.template-text {
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  margin-right: 12px;
}

.border-danger {
  border-color: rgba(239, 68, 68, 0.2);
  background-color: var(--danger-red-light);
}

.text-danger {
  color: var(--danger-red);
}

/* ==========================================================================
   Modals & Overlay Dialogs
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(9, 9, 11, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-card {
  background-color: var(--bg-primary);
  border-radius: 24px;
  border: 1px solid var(--border-color);
  width: 90%;
  max-width: 480px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  transform: scale(0.92) translateY(15px);
  opacity: 0;
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s ease;
  display: flex;
  flex-direction: column;
  max-height: 85vh;
}

.modal-overlay.active .modal-card {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
}

.modal-close-btn:hover {
  background-color: var(--danger-red-light);
  color: var(--danger-red);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-score-box {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px;
}

.modal-score-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}

.modal-score-container {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
}

.modal-score-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: var(--complete-green);
  line-height: 1;
}

.modal-progress-track {
  height: 8px;
  background-color: var(--bg-tertiary);
  border-radius: 99px;
  flex: 1;
  overflow: hidden;
}

.modal-progress-fill {
  height: 100%;
  background-color: var(--complete-green);
  border-radius: 99px;
  width: 0%;
}

.modal-lists-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-task-section h4 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.modal-task-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-task-item {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  padding: 10px 14px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-task-item.completed {
  border-color: rgba(34, 197, 94, 0.15);
  background-color: var(--complete-green-light);
}

.modal-task-item.missed {
  border-color: var(--border-color);
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  text-decoration: line-through;
}

.modal-task-item svg {
  flex-shrink: 0;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.hidden {
  display: none !important;
}

.flex-align {
  display: flex;
  align-items: center;
}

.text-green {
  color: var(--complete-green);
}

.text-secondary {
  color: var(--text-secondary);
}

.m-r-4 {
  margin-right: 4px;
}

/* ==========================================================================
   Phase 2 Features Styling
   ========================================================================== */

/* Icy Blue Theme for Freeze Badges and Amber for warnings */
:root {
  --leave-purple: #0ea5e9;
  /* remapped leave-purple variable to freeze-blue for compatibility */
  --leave-purple-light: rgba(14, 165, 233, 0.08);

  --freeze-blue: #0ea5e9;
  --freeze-blue-light: rgba(14, 165, 233, 0.08);

  --warning-amber: #d97706;
  --warning-amber-light: rgba(217, 119, 6, 0.08);
}

.leave-badge {
  background-color: var(--freeze-blue-light);
  color: var(--freeze-blue);
  border-color: rgba(14, 165, 233, 0.15);
}

.snowflake-icon {
  stroke: var(--freeze-blue);
  fill: rgba(14, 165, 233, 0.05);
}

/* Warnings layout classes for unprotected break cards */
.leave-status-card.unprotected-break {
  border-color: rgba(217, 119, 6, 0.2);
  background-color: var(--warning-amber-light);
}

.leave-status-card.unprotected-break:hover {
  border-color: var(--warning-amber);
}

.leave-status-card.unprotected-break .leave-balance-number {
  color: var(--warning-amber);
}

.leave-status-card.unprotected-break h3 {
  color: var(--warning-amber) !important;
}

/* Form textareas */
.task-notes-textarea {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--bg-primary);
  transition: all var(--transition-fast);
  resize: vertical;
  min-height: 50px;
}

.task-notes-textarea:focus {
  outline: none;
  border-color: var(--hero-blue);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}

/* Accordion Tasks Styling */
.task-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0 !important;
  overflow: hidden;
}

.task-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  width: 100%;
}

.task-notes-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-normal), padding var(--transition-normal), border-color var(--transition-normal);
  padding: 0 16px;
  font-size: 13px;
  color: var(--text-secondary);
  border-top: 1px solid transparent;
  background-color: var(--bg-secondary);
}

.task-item.expanded .task-notes-panel {
  max-height: 250px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
}

.notes-editor-trigger {
  cursor: text;
  min-height: 20px;
  padding: 4px 0;
}

.notes-editor-trigger:hover {
  color: var(--text-primary);
}

.notes-edit-textarea {
  width: 100%;
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  resize: vertical;
  outline: none;
}

.notes-edit-textarea:focus {
  border-color: var(--hero-blue);
}

/* Carry-Forward Banner Styling */
.carry-forward-card {
  background-color: rgba(0, 122, 255, 0.02);
  border-color: rgba(0, 122, 255, 0.15);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.banner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.banner-title h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.banner-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.banner-task-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 14px;
}

.banner-task-list li {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.banner-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Leave Actions Widget Styling */
.leave-status-card {
  border-color: rgba(139, 92, 246, 0.15);
  background-color: rgba(139, 92, 246, 0.02);
  transition: all var(--transition-normal);
}

.leave-status-card:hover {
  border-color: var(--leave-purple);
}

.leave-view-content {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.leave-large-icon {
  font-size: 36px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0% {
    transform: translateY(0px);
  }

  50% {
    transform: translateY(-4px);
  }

  100% {
    transform: translateY(0px);
  }
}

.leave-text-content h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.leave-text-content p {
  font-size: 13px;
  color: var(--text-secondary);
}

.leave-prompt-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.leave-prompt-left h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.leave-balance-settings {
  display: flex;
  flex-direction: column;
}

.leave-balance-number {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  color: var(--leave-purple);
}

/* ==========================================================================
   Phase 3 Analytics Styling
   ========================================================================== */

/* Grid Scroll wrapper */
.habit-grid-container {
  position: relative;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-bottom: 4px;
}

/* Custom premium scrollbar for habit grid container */
.habit-grid-container::-webkit-scrollbar {
  height: 6px;
}

.habit-grid-container::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 99px;
}

.habit-grid-container::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 99px;
  transition: background var(--transition-fast);
}

.habit-grid-container::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

.habit-grid {
  display: grid;
  grid-template-columns: repeat(53, var(--grid-cell-size));
  grid-template-rows: repeat(7, var(--grid-cell-size));
  grid-auto-flow: column;
  gap: var(--grid-cell-gap);
  width: max-content;
  margin: 0 auto;
  padding: 4px 0 12px 0;
}

/* Day cell styles */
.grid-cell {
  width: var(--grid-cell-size);
  height: var(--grid-cell-size);
  border-radius: 1.5px;
  transition: transform var(--transition-fast), outline var(--transition-fast);
  cursor: pointer;
}

.grid-cell.placeholder {
  visibility: hidden;
  pointer-events: none;
}

.grid-cell:hover {
  transform: scale(1.25);
  outline: 1px solid var(--text-primary);
  z-index: 5;
}

/* Cell Colors - Nectar / Amber Gold Honey Palette */
.grid-cell.empty {
  background-color: rgba(245, 158, 11, 0.08);
  border: 1px solid var(--border-color);
}

.grid-cell.low {
  background-color: rgba(245, 158, 11, 0.35);
}

.grid-cell.mid {
  background-color: rgba(245, 158, 11, 0.65);
}

.grid-cell.success {
  background-color: #f59e0b;
}

.grid-cell.perfect {
  background-color: #d97706;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.grid-cell.freeze {
  background-color: var(--freeze-blue);
}

.grid-cell.break {
  background-color: var(--warning-amber);
}

/* Tooltip for cells */
.grid-tooltip {
  position: absolute;
  background-color: #18181b;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -100%) translateY(-6px);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  z-index: 100;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.grid-tooltip.active {
  opacity: 1;
  transform: translate(-50%, -100%) translateY(-10px);
}

.grid-tooltip::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 4px 4px 0;
  border-style: solid;
  border-color: #18181b transparent;
  display: block;
  width: 0;
}

/* Legend Styling */
.grid-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  flex-wrap: wrap;
}

.legend-cell {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
  cursor: help;
}

.legend-cell.empty {
  background-color: rgba(245, 158, 11, 0.08);
  border: 1px solid var(--border-color);
}
.legend-cell.low {
  background-color: rgba(245, 158, 11, 0.35);
}
.legend-cell.mid {
  background-color: rgba(245, 158, 11, 0.65);
}
.legend-cell.success {
  background-color: #f59e0b;
}
.legend-cell.perfect {
  background-color: #d97706;
}
.legend-cell.freeze {
  background-color: var(--freeze-blue);
}
.legend-cell.break {
  background-color: var(--warning-amber);
}

/* SVG Chart styles */
#svg-chart-container {
  height: 220px;
  display: flex;
  align-items: flex-end;
}

.chart-bar-rect {
  fill: var(--hero-blue);
  opacity: 0.85;
  transition: opacity var(--transition-fast), fill var(--transition-fast), height var(--transition-normal);
  cursor: pointer;
}

.chart-bar-rect:hover {
  opacity: 1;
  fill: var(--hero-blue-hover);
}

.chart-bg-rect {
  fill: var(--bg-tertiary);
  opacity: 0.5;
}

.chart-text-label {
  font-family: var(--font-sans);
  font-size: 11px;
  fill: var(--text-secondary);
  font-weight: 600;
  text-anchor: middle;
}

.chart-text-value {
  font-family: var(--font-display);
  font-size: 11px;
  fill: var(--text-primary);
  font-weight: 700;
  text-anchor: middle;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.chart-bar-group:hover .chart-text-value {
  opacity: 1;
}

/* Habit & Hero Insights list */
.insight-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  transition: border-color var(--transition-normal);
}

.insight-item:hover {
  border-color: var(--text-muted);
}

.insight-icon {
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 50%;
}

.insight-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.insight-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.insight-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ==========================================================================
   Phase 4 Diary & Envelope Styling
   ========================================================================== */

/* Calendar Grid & Headers */
.calendar-grid-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--calendar-gap, 6px);
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 10px;
  letter-spacing: 0.05em;
  width: 100%;
  box-sizing: border-box;
}

.calendar-grid-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--calendar-gap, 6px);
  text-align: center;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

/* Calendar alignment cells */
.calendar-day-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  user-select: none;
  min-width: 0;           /* prevent grid blowout */
  overflow: hidden;
}

.day-circle {
  /* fluid: fills 1/7 of the card, capped at 44px */
  width:  min(var(--day-circle-size, 44px), calc((100vw - 100px) / 7));
  height: min(var(--day-circle-size, 44px), calc((100vw - 100px) / 7));
  border-radius: 50%;
  background-color: var(--bg-tertiary);
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all var(--transition-normal);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
  flex-shrink: 0;
}

.calendar-day-cell:hover .day-circle {
  transform: scale(1.08);
  border-color: var(--text-muted);
}

/* Calendar circles mood icon sizing override */
.day-circle .mood-icon-wrapper {
  width: 140% !important;
  height: 140% !important;
}

.day-circle .mood-icon-fallback {
  font-size: calc(var(--day-circle-size) * 0.8) !important;
}

.day-number {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
}

/* Day circular mood color schemes (matching mockup HSL accents) */
.day-circle.soso {
  background-color: #f4f4f5;
  border-color: #e4e4e7;
}

.day-circle.fantastic {
  background-color: #ffedd5;
  border-color: #ffe0b2;
}

.day-circle.happy {
  background-color: #fce7f3;
  border-color: #fbcfe8;
}

.day-circle.peaceful {
  background-color: #e8f5e9;
  border-color: #c8e6c9;
}

.day-circle.depressed {
  background-color: #e0f2fe;
  border-color: #bae6fd;
}

.day-circle.tired {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
}

.calendar-day-cell.today .day-circle {
  border: 2px solid var(--hero-blue) !important;
}

/* Mood Selection (Horizontal row) */
.mood-selector-row {
  scrollbar-width: none;
  /* Firefox */
}

.mood-selector-row::-webkit-scrollbar {
  display: none;
  /* Safari & Chrome */
}

.mood-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: none;
  border: none;
  cursor: pointer;
  gap: 6px;
  transition: transform var(--transition-fast);
  flex-shrink: 0;
  width: 68px;
  padding: 4px 0;
}

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

/* Global Mood Icon Centering Rules */
.mood-icon-wrapper {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.mood-icon-img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
}

.mood-emoji {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  transition: all var(--transition-normal);
}

/* Diary editor mood picker icon sizing override */
.mood-emoji .mood-icon-wrapper {
  width: 140% !important;
  height: 140% !important;
}

.mood-emoji .mood-icon-fallback {
  font-size: 32px !important;
}

.mood-btn:hover .mood-emoji {
  transform: scale(1.06);
}

.mood-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.mood-btn.active .mood-label {
  color: var(--text-primary);
  font-weight: 700;
}

/* Active mood selection ring styles */
.mood-btn[data-mood="soso"].active .mood-emoji {
  background-color: #f4f4f5;
  border-color: #a1a1aa;
  box-shadow: 0 0 10px rgba(161, 161, 170, 0.2);
}

.mood-btn[data-mood="fantastic"].active .mood-emoji {
  background-color: #ffedd5;
  border-color: #f97316;
  box-shadow: 0 0 10px rgba(249, 115, 22, 0.25);
}

.mood-btn[data-mood="happy"].active .mood-emoji {
  background-color: #fce7f3;
  border-color: #db2777;
  box-shadow: 0 0 10px rgba(219, 39, 119, 0.25);
}

.mood-btn[data-mood="peaceful"].active .mood-emoji {
  background-color: #e8f5e9;
  border-color: #2e7d32;
  box-shadow: 0 0 10px rgba(46, 125, 50, 0.25);
}

.mood-btn[data-mood="depressed"].active .mood-emoji {
  background-color: #e0f2fe;
  border-color: #0284c7;
  box-shadow: 0 0 10px rgba(2, 132, 199, 0.25);
}

.mood-btn[data-mood="tired"].active .mood-emoji {
  background-color: #f1f5f9;
  border-color: #475569;
  box-shadow: 0 0 10px rgba(71, 85, 105, 0.25);
}

/* Envelope transitions and floating animations */
@keyframes pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.15);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes float {
  0% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }

  100% {
    transform: translateY(0);
  }
}

.envelope-wrapper:hover {
  transform: scale(1.05) rotate(1deg);
}

.envelope-heart {
  animation: pulse 1.5s infinite;
}

.envelope-hint-badge {
  animation: float 3s infinite;
}

/* Timeline listing cards */
.timeline-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.timeline-card:hover {
  border-color: var(--text-muted);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.015);
  transform: translateY(-1px);
}

.timeline-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.timeline-card-date {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.timeline-card-mood {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
}

/* Timeline mood bg themes */
.timeline-card-mood.soso {
  background-color: #f4f4f5;
  color: #71717a;
}

.timeline-card-mood.fantastic {
  background-color: #ffedd5;
  color: #d97706;
}

.timeline-card-mood.happy {
  background-color: #fce7f3;
  color: #db2777;
}

.timeline-card-mood.peaceful {
  background-color: #e8f5e9;
  color: #2e7d32;
}

.timeline-card-mood.depressed {
  background-color: #e0f2fe;
  color: #0284c7;
}

.timeline-card-mood.tired {
  background-color: #f1f5f9;
  color: #475569;
}

.timeline-card-content {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.timeline-card-letter-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #f97316;
}

/* Watermark element on paper reflection letter sheets */
.letter-body-content::before {
  content: "HERO";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-30deg);
  font-size: 80px;
  font-weight: 900;
  color: #5c4033;
  opacity: 0.03;
  pointer-events: none;
  letter-spacing: 0.1em;
}

/* Letter Envelope & Paper transition classes */
.envelope-card-view {
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.envelope-card-view.hidden {
  opacity: 0 !important;
  transform: scale(0.8) translateY(20px) !important;
  pointer-events: none !important;
  display: none !important;
}

.letter-paper-view {
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.letter-paper-view.hidden {
  opacity: 0 !important;
  transform: scale(0.8) translateY(20px) !important;
  pointer-events: none !important;
  display: none !important;
}

/* Perfect Day Celebration Button Hover Effects */
#btn-close-celebration {
  transition: background-color var(--transition-fast), transform 0.1s ease;
}

#btn-close-celebration:hover {
  background-color: #d97706 !important;
}

#btn-close-celebration:active {
  transform: translateY(2px) !important;
  box-shadow: 0 1px 0 #b45309, inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
}

/* Mobile responsive fixes */
@media (max-width: 480px) {
  .header-main {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .header-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
  }

  .badge {
    padding: 5px 8px;
    font-size: 11px;
    flex: 1 1 auto;
    min-width: max-content;
    justify-content: center;
    white-space: nowrap;
  }

  /* Custom Responsive Tokens for Mobile */
  :root {
    --day-circle-size: 36px;
    --calendar-gap: 6px;
  }

  .card {
    padding: 16px !important;
  }

  .day-circle {
    font-size: 16px !important;
  }

  .greeting-container h1 {
    font-size: 22px !important;
  }

  .stat-label {
    font-size: 10.5px !important;
  }

  .stat-value {
    font-size: 20px !important;
  }



  .modal-body {
    padding: 20px 16px;
  }

  /* Always show task action buttons on mobile since there is no hover state */
  .task-actions {
    opacity: 1 !important;
  }
}

/* Extra small viewport safety overrides */
@media (max-width: 360px) {
  :root {
    --day-circle-size: 32px;
    --calendar-gap: 4px;
  }

  .app-container {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  .card {
    padding: 12px !important;
  }

  .nav-item span {
    font-size: 9.5px !important;
  }
}

/* ==========================================================================
   CLOUD SYNC & AUTHENTICATION STYLES
   ========================================================================== */

/* Sync status badge states */
.sync-badge {
  background: var(--bg-tertiary) !important;
  color: var(--text-secondary) !important;
  border: 1px solid var(--border-color) !important;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  font-size: 11.5px;
  font-weight: 600;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.sync-badge .sync-label-text {
  display: none;
}

.sync-badge:hover {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  border-color: var(--text-secondary) !important;
}

.sync-badge.syncing {
  color: var(--hero-blue) !important;
  border-color: rgba(59, 130, 246, 0.3) !important;
  background: rgba(59, 130, 246, 0.05) !important;
}

.sync-badge.synced {
  color: var(--complete-green) !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
  background: rgba(16, 185, 129, 0.05) !important;
}

.sync-badge.error {
  color: var(--danger-red) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
  background: rgba(239, 68, 68, 0.05) !important;
}

.sync-label-text {
  font-size: 11px;
}

/* Spin animation for loading */
.spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}

/* Toast Message Container */
.toast-message {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15, 15, 20, 0.85);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  color: #ffffff;
  padding: 12px 24px;
  border-radius: 12px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s, visibility 0.3s;
  z-index: 10000;
  text-align: center;
  pointer-events: none;
  max-width: 90vw;
}

.toast-message.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Theme adaptation for toast in light mode */
body:not(.dark-theme) .toast-message {
  background: rgba(255, 255, 255, 0.9);
  color: #111827;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

/* Small device overrides */
@media (max-width: 480px) {
  .toast-message {
    bottom: 90px;
  }
}

/* ==========================================================================
   DRAG AND DROP SORTING STYLES
   ========================================================================== */

.draggable-item {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}

.draggable-item.dragging {
  opacity: 0.5;
  transform: scale(0.98);
  border: 1px dashed var(--hero-blue) !important;
  background: var(--bg-tertiary) !important;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1) !important;
}

.drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: grab;
  padding: 0 8px 0 0;
  touch-action: none;
  /* Disables standard touch scroll behavior on the handle */
  user-select: none;
  -webkit-user-drag: none;
}

.drag-handle:active {
  cursor: grabbing;
  color: var(--text-primary);
}

.drag-handle svg {
  opacity: 0.4;
  transition: opacity var(--transition-fast), color var(--transition-fast);
}

.drag-handle:hover svg {
  opacity: 1;
  color: var(--text-primary);
}

/* Template item drag handle alignment */
.template-item {
  position: relative;
  display: flex !important;
  align-items: center !important;
  gap: 8px;
}

.template-item .drag-handle {
  padding: 0 4px 0 0;
}

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

/* Template edit input field */
.template-edit-input {
  flex: 1;
  padding: 6px 12px;
  font-size: 14px;
  font-family: var(--font-sans);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  outline: none;
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: border-color var(--transition-fast);
}

.template-edit-input:focus {
  border-color: var(--hero-blue);
}

.text-success {
  color: var(--complete-green) !important;
}

.text-danger {
  color: var(--danger-red) !important;
}

/* ==========================================================================
   LOCAL CLOUD SYNC PROMO CARD & STREAK MODAL STYLES
   ========================================================================== */

.local-sync-promo-card {
  margin-top: 16px;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--streak-orange-light) 100%);
  border: 1px dashed rgba(249, 115, 22, 0.4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-radius: 18px;
  transition: all var(--transition-normal);
}

.local-sync-promo-card:hover {
  border-color: var(--streak-orange);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.05);
}

.local-sync-promo-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.local-sync-promo-icon {
  font-size: 26px;
  animation: pulse 2s infinite;
}

.local-sync-promo-text h4 {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.local-sync-promo-text p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 0;
}

.local-sync-promo-btn {
  background-color: var(--streak-orange) !important;
  border-color: var(--streak-orange) !important;
  color: #ffffff !important;
  font-weight: 700;
  border-radius: 10px;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(249, 115, 22, 0.2);
  transition: all var(--transition-fast);
}

.local-sync-promo-btn:hover {
  background-color: #ea580c !important;
  border-color: #ea580c !important;
  transform: translateY(-1px);
}

/* Streak modal specific styles */
.streak-flame {
  font-size: 64px;
  filter: drop-shadow(0 4px 12px rgba(249, 115, 22, 0.3));
  animation: float 3s ease-in-out infinite;
}

.broken-streak-emoji {
  font-size: 64px;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
  animation: float 3s ease-in-out infinite;
}

/* ==========================================================================
   AI VOICE TYPING & AUTO TASK ASSIGNMENT STYLES
   ========================================================================== */

.ai-voice-promo-card {
  margin-top: 16px;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(59, 130, 246, 0.03) 100%);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-radius: 18px;
  transition: all var(--transition-normal);
}

.ai-voice-promo-card:hover {
  border-color: var(--hero-blue);
  transform: translateY(-2px);
  box-shadow: var(--card-shadow-hover);
}

.ai-voice-promo-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ai-voice-promo-icon {
  font-size: 26px;
  animation: float 3s ease-in-out infinite;
}

.ai-voice-promo-text h4 {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.ai-voice-promo-text p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
  margin: 0;
}

.ai-voice-promo-btn {
  background-color: var(--streak-orange) !important;
  border-color: var(--streak-orange) !important;
  color: #ffffff !important;
  font-weight: 700;
  border-radius: 10px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.2);
  transition: all var(--transition-fast);
}

.ai-voice-promo-btn:hover {
  background-color: #ea580c !important;
  border-color: #ea580c !important;
  transform: translateY(-1px);
}

/* Voice task button header adjustments */
.voice-task-btn:hover {
  color: var(--streak-orange) !important;
  border-color: rgba(249, 115, 22, 0.3) !important;
  background-color: var(--streak-orange-light) !important;
  transform: scale(1.08);
}

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


/* Siri/Gemini style Voice soundwave loader */
.voice-wave-loader {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  height: 48px;
  padding: 8px 0;
}

.voice-wave-loader .loader-bar {
  width: 5px;
  height: 12px;
  border-radius: 99px;
  background: linear-gradient(180deg, #fbbf24 0%, #f97316 100%);
  animation: loader-bar-scale 1.2s ease-in-out infinite;
  transform-origin: center;
}

/* Unified Recording State Soundwave color redirect (Premium Blue-to-Cyan gradient) */
.voice-wave-loader.recording-state .loader-bar {
  background: linear-gradient(180deg, #60a5fa 0%, var(--hero-blue) 100%);
  animation-duration: 0.9s;
  /* Slightly faster frequency while recording to reflect active voice detection */
}

.voice-wave-loader .loader-bar:nth-child(1) {
  animation-delay: 0.1s;
  height: 16px;
}

.voice-wave-loader .loader-bar:nth-child(2) {
  animation-delay: 0.25s;
  height: 28px;
}

.voice-wave-loader .loader-bar:nth-child(3) {
  animation-delay: 0.4s;
  height: 38px;
}

.voice-wave-loader .loader-bar:nth-child(4) {
  animation-delay: 0.55s;
  height: 24px;
}

.voice-wave-loader .loader-bar:nth-child(5) {
  animation-delay: 0.7s;
  height: 14px;
}

@keyframes loader-bar-scale {

  0%,
  100% {
    transform: scaleY(1);
  }

  50% {
    transform: scaleY(2.2);
  }
}

/* Voice Preview items list */
.voice-preview-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 12px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  transition: all var(--transition-fast) ease-in-out;
}

.voice-preview-item:hover {
  background-color: var(--bg-secondary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

.voice-preview-item.match-found {
  border-color: rgba(245, 158, 11, 0.35);
  background: linear-gradient(135deg, var(--bg-primary) 0%, rgba(245, 158, 11, 0.03) 100%);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.04);
}

.voice-preview-item.match-found:hover {
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.07);
}

.voice-preview-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.voice-preview-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--streak-orange);
  cursor: pointer;
  flex-shrink: 0;
}

.voice-preview-text-input {
  flex: 1;
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  color: var(--text-primary);
  outline: none !important;
  box-shadow: none !important;
  text-overflow: ellipsis;
}

.voice-match-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  background-color: rgba(245, 158, 11, 0.1);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.2);
  white-space: nowrap;
}

/* ==========================================================================
   Capacitor & Mobile Native Interaction Layer
   ========================================================================== */

/* Disable tap highlights, outlines, and browser context overlays globally across ALL elements */
*, *::before, *::after {
  -webkit-tap-highlight-color: transparent !important;
  -webkit-touch-callout: none !important;
}

/* Explicitly enforce touch hygiene on all interactive components and calendar elements */
button,
a,
input,
select,
textarea,
.btn,
.badge,
.tab-link,
.action-chip,
.hero-card,
.routine-card,
.settings-card,
.nav-bar-item,
.task-checkbox,
.calendar-day,
.calendar-day-cell,
.day-circle,
.day-number,
.theme-toggle-btn,
.mood-btn,
.mood-icon-wrapper {
  -webkit-tap-highlight-color: transparent !important;
  -webkit-touch-callout: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  outline: none !important;
}

/* Global text selection lock on UI labels, headers, and backgrounds */
html, body, div, span, h1, h2, h3, h4, h5, h6, p, button, a, label {
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
}

/* Make sure UI and decorative images cannot be dragged or long-pressed */
img {
  -webkit-user-drag: none !important;
  user-drag: none !important;
  -webkit-touch-callout: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

/* Preserve text copy/paste/selection and default tap behaviors ONLY for editable fields */
input,
textarea,
[contenteditable="true"],
.letter-body-content,
.copyable-text {
  -webkit-tap-highlight-color: auto !important;
  -webkit-touch-callout: default !important;
  user-select: text !important;
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
}

/* Reusable touch-scale micro-interactions (Capacitor/WebView Optimized) */
.mobile-interactive-btn,
.btn,
.floating-btn,
.theme-toggle-btn {
  transition: transform var(--transition-fast), filter var(--transition-fast) !important;
}
.mobile-interactive-btn:active,
.btn:active,
.floating-btn:active,
.theme-toggle-btn:active {
  transform: scale(0.96) !important;
  filter: brightness(0.92) !important;
}

.mobile-interactive-card,
.card,
.settings-card,
.task-item,
.carry-forward-card {
  transition: transform var(--transition-fast), box-shadow var(--transition-fast) !important;
}
.mobile-interactive-card:active,
.card:active,
.settings-card:active,
.task-item:active,
.carry-forward-card:active {
  transform: scale(0.985) !important;
  box-shadow: var(--card-shadow) !important;
}

.mobile-interactive-chip,
.tab-link,
.nav-bar-item,
.mood-btn,
.action-chip,
.calendar-day {
  transition: transform var(--transition-fast), opacity var(--transition-fast) !important;
}
.mobile-interactive-chip:active,
.tab-link:active,
.nav-bar-item:active,
.mood-btn:active,
.action-chip:active,
.calendar-day:active {
  transform: scale(0.94) !important;
  opacity: 0.85;
}/* ==========================================================================
   Mind Space Aesthetic Additions
   Appended — no existing rules changed above this line
   ========================================================================== */

/* --- Full-viewport warm gradient background --- */
.ms-gradient-bg {
  position: fixed;
  inset: 0;
  background: var(--ms-gradient-bg);
  z-index: -2;
  pointer-events: none;
}

/* --- Thinking Blob --- */
.thinking-blob-wrap {
  position: fixed;
  left: 50%;
  width: 250px;
  height: 250px;
  z-index: 0;
  pointer-events: none;
  isolation: isolate;
  will-change: transform;
  transform: translate(-50%, -50%);
  animation: htBlobMaster 15s ease-in-out infinite;
  transition: opacity 0.4s ease-in, top 0.5s ease;
}

.blob-l { 
  position: absolute; 
  border-radius: 50%; 
  will-change: transform; 
}

.blob-l1 {
  inset: -20px;
  background: radial-gradient(circle at center, var(--hero-blue) 0%, transparent 70%);
  animation: htPulse1 8s ease-in-out infinite;
  opacity: 0.75;
}
.blob-l2 {
  inset: -10px;
  background: radial-gradient(circle at center, var(--hero-blue-light) 0%, transparent 65%);
  animation: htPulse2 10s ease-in-out infinite;
  opacity: 0.8;
}
.blob-l3 {
  inset: 10px;
  background: radial-gradient(circle at center, var(--bg-tertiary) 0%, transparent 60%);
  animation: htPulse3 7s ease-in-out infinite;
  opacity: 0.85;
}

@keyframes htBlobMaster {
  0%,100% { transform: translate(-50%, -50%) scale(0.9) rotate(0deg); }
  50%     { transform: translate(-50%, -50%) scale(1.1) rotate(45deg); }
}
@keyframes htPulse1 {
  0%,100% { transform: translate(10px, 10px) scale(0.9); }
  50%     { transform: translate(-10px, -20px) scale(1.15); }
}
@keyframes htPulse2 {
  0%,100% { transform: translate(-15px, 5px) scale(1.1); }
  50%     { transform: translate(15px, -10px) scale(0.85); }
}
@keyframes htPulse3 {
  0%,100% { transform: translate(5px, -15px) scale(0.95); }
  50%     { transform: translate(-15px, 15px) scale(1.2); }
}

.ht-onboard-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 0 24px 60px;
  pointer-events: all;
  background: var(--ms-gradient-bg);
}

.ht-onboard-overlay.hidden {
  display: none;
}

.ht-onboard-sheet {
  width: 100%;
  max-width: 480px;
  text-align: left;
  animation: htSlideUp 0.7s cubic-bezier(0.16,1,0.3,1) forwards;
}

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

.ht-onboard-title {
  font-family: var(--font-display);
  font-size: clamp(40px, 12vw, 60px);
  color: var(--text-primary);
  margin-bottom: 14px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.ht-onboard-subtitle {
  font-family: var(--font-sans);
  font-size: 20px;
  color: var(--text-muted);
  margin-bottom: 36px;
  line-height: 1.4;
}

.ht-onboard-btn {
  width: 100%;
  padding: 18px 24px;
  background: var(--hero-blue);
  color: #fff;
  border: none;
  border-radius: 100px;
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(112, 178, 255, 0.35);
  transition: transform .15s ease, opacity .15s ease, background-color .15s ease;
}

.ht-onboard-btn:hover {
  background: var(--hero-blue-hover);
}

.ht-onboard-btn:active { transform: scale(.97); opacity: .9; }

/* Dots progress for onboarding */
.ht-onboard-dots {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
}

.ht-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border-color);
  transition: background .3s, width .3s;
}
.ht-dot.active {
  width: 24px;
  border-radius: 4px;
  background: var(--hero-blue);
}

/* --- Nav pill upgrade --- */
.bottom-nav {
  border-radius: 100px !important;
  width: calc(100% - 32px) !important;
  max-width: 620px !important;
  bottom: 20px !important;
  border-top: none !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: 0 8px 32px rgba(43,39,37,.1) !important;
  height: 68px !important;
}

body.dark-theme .bottom-nav {
  background-color: rgba(26,22,20,.85) !important;
  border-color: var(--border-color) !important;
}

.nav-item.active {
  color: #d99c85 !important;
}

/* --- Card radius upgrade --- */
.card {
  border-radius: 20px !important;
}

/* --- Animations for onboarding slide transitions --- */
@keyframes htFadeSlide {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ht-anim-in {
  animation: htFadeSlide .5s cubic-bezier(0.16,1,0.3,1) forwards;
}


/* ==========================================================================
   Home Screen Bottom-Sheet Layout
   When .ht-home-mode is active on app-container:
   - blob is visible in the top 45% of viewport
   - header + dashboard content slide up from 45vh in a rounded sheet
   Other tabs: normal full-height layout, no blob, no sheet.
   ========================================================================== */

/* Drag handle — hidden by default, shown in home mode */
.ht-drag-handle {
  width: 36px;
  height: 3px;
  background: rgba(30, 41, 59, 0.2);
  border-radius: 3px;
  margin: 12px auto 16px auto;
  display: none;
}

/* Home mode: make the app-container a bottom sheet */
.ht-home-mode {
  padding-top: 0 !important;
  margin-top: 45vh !important;
  border-radius: 32px 32px 0 0 !important;
  background-color: var(--bg-primary) !important;
  box-shadow: 0 -8px 32px rgba(43,39,37,0.09) !important;
  min-height: 60vh !important;
}

.ht-home-mode .ht-drag-handle {
  display: block;
  margin-top: 14px;
  margin-bottom: 12px;
}

/* When home-mode: header sits inside the sheet, no extra top spacing */
.ht-home-mode .app-header {
  padding-top: 4px !important;
}

/* Keep header flush with sheet top */
.ht-home-mode .header-main {
  margin-bottom: 16px;
}

/* Non-home tabs: full background, no sheet look */
.ht-plain-mode {
  margin-top: 0 !important;
  border-radius: 0 !important;
  background-color: var(--bg-primary) !important;
  box-shadow: none !important;
  padding-top: 32px !important;
}

@media (max-width: 480px) {
  .ht-plain-mode {
    padding-top: 24px !important;
  }
}

/* Welcome tour button in settings - warm accent */
#btn-show-welcome-tour {
  color: var(--text-secondary);
  border-color: var(--border-color);
  background: var(--bg-tertiary);
  font-weight: 600;
  font-size: 13px;
}

#btn-show-welcome-tour:hover {
  background: var(--hero-blue-light);
  border-color: var(--hero-blue);
  color: var(--hero-blue-hover);
}

/* ==========================================================================
   Edit Profile Modal Sheet
   ========================================================================== */
.edit-profile-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  pointer-events: all;
  animation: htModalFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.edit-profile-overlay.hidden {
  display: none;
}

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

.edit-profile-sheet {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  padding: 20px 24px 40px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.edit-profile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.btn-text-action {
  background: none;
  border: none;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
}

.btn-text-action.action-save {
  color: var(--hero-blue);
  font-weight: 700;
}

.edit-profile-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.edit-profile-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}

.edit-avatar-main {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border: 3px solid var(--bg-secondary);
  margin-bottom: 4px;
}

.edit-avatar-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-gender-selector {
  display: flex;
  gap: 24px;
  margin-bottom: 12px;
}

.gender-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  opacity: 0.55;
  transition: all var(--transition-fast);
}

.gender-option.active {
  opacity: 1;
}

.gender-avatar-thumb {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid transparent;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transition: all var(--transition-fast);
}

.gender-option.active .gender-avatar-thumb {
  border-color: var(--hero-blue);
  box-shadow: 0 4px 16px rgba(112, 178, 255, 0.4);
  transform: scale(1.05);
}

.gender-avatar-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gender-option span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.edit-form-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.edit-form-group label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.edit-form-group input,
.edit-form-group textarea {
  width: 100%;
  padding: 16px 18px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--text-primary);
  box-sizing: border-box;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.edit-form-group input:focus,
.edit-form-group textarea:focus {
  border-color: var(--hero-blue);
  box-shadow: 0 0 0 3px var(--hero-blue-light);
}

/* Custom Dropdown System */
.card.dropdown-active,
.card:has(.custom-dropdown.open) {
  z-index: 100 !important;
}

.custom-dropdown {
  position: relative;
  width: 100%;
}

.custom-dropdown.open {
  z-index: 105;
}

.custom-dropdown-trigger {
  width: 100%;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all var(--transition-fast);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.custom-dropdown-trigger:hover {
  border-color: var(--hero-blue);
  background-color: var(--bg-secondary);
}

.custom-dropdown-trigger:focus,
.custom-dropdown.open .custom-dropdown-trigger {
  border-color: var(--hero-blue);
  box-shadow: 0 0 0 3px var(--hero-blue-light);
  background-color: var(--bg-secondary);
}

.custom-dropdown-selected {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.15);
}

.dropdown-chevron {
  transition: transform var(--transition-fast);
  color: var(--text-secondary);
}

.custom-dropdown.open .dropdown-chevron {
  transform: rotate(180deg);
}

.custom-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 6px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.08);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.98);
  transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.custom-dropdown.open .custom-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.custom-dropdown-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.custom-dropdown-option .option-label {
  flex: 1;
}

.custom-dropdown-option .check-icon {
  opacity: 0;
  color: var(--hero-blue);
  transition: opacity var(--transition-fast);
}

.custom-dropdown-option:hover {
  background-color: var(--hero-blue-light);
  color: var(--text-primary);
}

.custom-dropdown-option.active {
  background-color: var(--hero-blue-light);
  color: var(--text-primary);
  font-weight: 700;
}

.custom-dropdown-option.active .check-icon {
  opacity: 1;
}

/* ==========================================================================
   Auth Overlay Styles
   ========================================================================== */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--ms-gradient-bg);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 1;
  pointer-events: all;
  transition: opacity var(--transition-normal);
  overflow-y: auto;
  padding: 24px 16px;
}

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

.auth-modal-card {
  width: 100%;
  max-width: 420px;
  background: transparent;
  padding: 16px 20px;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateY(0);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.auth-overlay.hidden .auth-modal-card {
  transform: translateY(20px);
}

/* App Icon Header Emblem */
.auth-emblem-wrap {
  width: 110px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  position: relative;
}

.auth-icon-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: authIconFloat 6s ease-in-out infinite alternate;
}

.auth-app-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.12));
}

@keyframes authIconFloat {
  0% {
    transform: translateY(0px) scale(1);
  }
  50% {
    transform: translateY(-6px) scale(1.03);
  }
  100% {
    transform: translateY(3px) scale(0.98);
  }
}

.auth-modal-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-title {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 400;
  font-style: italic;
  color: var(--text-primary);
  margin-bottom: 10px;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.auth-subtitle {
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 320px;
  margin: 0 auto;
  line-height: 1.45;
  font-weight: 500;
}

.auth-body {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Privacy Policy Toggle Row */
.auth-privacy-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 4px;
  margin-bottom: 8px;
}

.auth-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.auth-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.auth-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(148, 163, 184, 0.3);
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 34px;
}

.auth-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}

.auth-switch input:checked + .auth-slider {
  background-color: var(--hero-blue);
}

.auth-switch input:checked + .auth-slider:before {
  transform: translateX(20px);
}

.auth-privacy-text {
  font-size: 13.5px;
  color: var(--text-primary);
  font-weight: 600;
}

.auth-privacy-text a {
  color: var(--text-primary);
  text-decoration: underline;
  font-weight: 700;
}

/* Input Form & Pill Inputs */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.auth-input-pill {
  width: 100%;
  padding: 16px 20px;
  font-size: 15px;
  font-family: var(--font-sans);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  background-color: rgba(255, 255, 255, 0.85);
  color: var(--text-primary);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
  transition: all var(--transition-normal);
  outline: none;
}

body.dark-theme .auth-input-pill {
  background-color: rgba(30, 41, 59, 0.7);
  border-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.auth-input-pill::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.auth-input-pill:focus {
  background-color: #ffffff;
  border-color: var(--hero-blue);
  box-shadow: 0 0 0 3px rgba(112, 178, 255, 0.25), 0 4px 14px rgba(0, 0, 0, 0.05);
}

/* Submit Action Button */
.auth-submit-pill {
  width: 100%;
  padding: 16px;
  margin-top: 4px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 28px;
  background-color: #524e4c;
  color: #ffffff;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

body[data-color-theme="blue"] .auth-submit-pill {
  background-color: #3b4252;
}

.auth-submit-pill:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
}

.auth-submit-pill:active {
  transform: translateY(0);
}

/* Toggle Footer Text */
.auth-footer-link-wrap {
  text-align: center;
  margin-top: 4px;
  margin-bottom: 4px;
}

.auth-toggle-text {
  font-size: 13.5px;
  color: var(--text-secondary);
  font-weight: 500;
}

.auth-toggle-text a {
  color: var(--text-primary);
  font-weight: 700;
  text-decoration: underline;
  margin-left: 4px;
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 6px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

body.dark-theme .auth-divider::before,
body.dark-theme .auth-divider::after {
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

.auth-divider span {
  padding: 0 12px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* Google Sign-In Pill Button */
.auth-google-pill {
  width: 100%;
  padding: 15px 20px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 28px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  background-color: rgba(255, 255, 255, 0.9);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: all var(--transition-fast);
}

body.dark-theme .auth-google-pill {
  background-color: rgba(30, 41, 59, 0.8);
  border-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.auth-google-pill:hover {
  background-color: #ffffff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

/* Continue without an account (Guest Pill) */
.auth-guest-pill {
  width: 100%;
  padding: 12px;
  margin-top: 4px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.auth-guest-pill:hover {
  color: var(--text-primary);
}

.auth-error-msg {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--danger-red);
  padding: 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
  text-align: center;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ==========================================================================
   Responsive Navbar & Footer & Legal Modal Styles
   ========================================================================== */

/* --- Enhanced Bottom Navbar Responsiveness --- */
@media (max-width: 600px) {
  .bottom-nav {
    width: calc(100% - 20px) !important;
    bottom: 12px !important;
    height: 64px !important;
    padding: 0 8px !important;
  }

  .nav-item {
    padding: 6px 0 !important;
    gap: 2px !important;
  }

  .nav-item svg {
    width: 20px !important;
    height: 20px !important;
  }

  .nav-item span {
    font-size: 10px !important;
  }
}

@media (max-width: 380px) {
  .bottom-nav {
    width: calc(100% - 12px) !important;
    bottom: 8px !important;
    height: 60px !important;
    padding: 0 4px !important;
  }

  .nav-item svg {
    width: 18px !important;
    height: 18px !important;
  }

  .nav-item span {
    font-size: 9px !important;
  }
}

/* iOS Safe Area Padding Support */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .bottom-nav {
    padding-bottom: calc(0px + env(safe-area-inset-bottom)) !important;
  }
}

/* --- App Footer Styles --- */
.app-footer {
  margin-top: 40px;
  padding: 24px 16px 110px 16px;
  border-top: 1px solid var(--border-color);
  text-align: center;
  transition: all var(--transition-normal);
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 500px;
  margin: 0 auto;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.footer-logo {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  object-fit: cover;
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.footer-link-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.footer-link-btn:hover {
  color: var(--hero-blue);
  background-color: var(--hero-blue-light);
}

.footer-dot {
  color: var(--text-muted);
  font-size: 12px;
}

.footer-copyright {
  font-size: 11.5px;
  color: var(--text-muted);
  margin: 0;
}

/* --- Legal Terms & Privacy Modal Styles --- */
.legal-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10005;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 1;
  transition: opacity 0.25s ease;
}

.legal-modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  display: none;
}

.legal-modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  width: 100%;
  max-width: 580px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  animation: legalModalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes legalModalPop {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.legal-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
}

.legal-modal-tabs {
  display: flex;
  background: var(--bg-tertiary);
  padding: 4px;
  border-radius: 12px;
  gap: 4px;
}

.legal-tab-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.legal-tab-btn.active {
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.legal-close-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.legal-close-btn:hover {
  color: var(--text-primary);
  background: var(--border-color);
}

.legal-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
}

.legal-tab-content {
  display: none;
}

.legal-tab-content.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

.legal-tab-content h2 {
  font-family: var(--font-display);
  font-size: 22px;
  margin-top: 0;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.legal-updated {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.legal-tab-content h3 {
  font-size: 15px;
  font-weight: 700;
  margin-top: 18px;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.legal-tab-content p {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.legal-tab-content p strong {
  color: var(--text-primary);
}

.legal-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-primary);
  display: flex;
  justify-content: flex-end;
}

.legal-modal-footer .btn {
  padding: 8px 24px;
  font-size: 13.5px;
  border-radius: 10px;
}

/* ==========================================================================
   Amber Gold Theme Enhancements & History Detail Modal
   ========================================================================== */
body[data-color-theme="amber"] .auth-submit-pill {
  background-color: #d97706 !important;
  color: #ffffff !important;
}

body[data-color-theme="amber"] .auth-submit-pill:hover {
  background-color: #b45309 !important;
}

.modal-score-box {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 16px 20px;
  border-radius: 16px;
  margin-bottom: 20px;
}

.modal-score-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 8px;
}

.modal-score-container {
  display: flex;
  align-items: center;
  gap: 16px;
}

.modal-score-value {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  min-width: 55px;
}

.modal-progress-track {
  flex: 1;
  height: 10px;
  background: var(--border-color);
  border-radius: 999px;
  overflow: hidden;
}

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

.modal-lists-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-task-section h4 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

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

.modal-task-item {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  padding: 11px 15px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-task-item.completed {
  border-color: rgba(16, 185, 129, 0.25);
  background-color: rgba(16, 185, 129, 0.06);
}

.modal-task-item.missed {
  border-color: var(--border-color);
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
}

/* Username Handle Real-time Validation Message */
.validation-msg {
  font-size: 12.5px;
  font-weight: 600;
  margin-top: 6px;
  min-height: 18px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.validation-msg.available {
  color: #10b981; /* Success Green */
}

.validation-msg.taken {
  color: #ef4444; /* Error Red */
}

.validation-msg.checking {
  color: #f59e0b; /* Amber Checking */
}



