/* ── Design Tokens ── */
:root {
  color-scheme: dark;
  --bg: #0d1117;
  --bg-card: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --danger: #f85149;
  --success: #3fb950;

  /* Heat map colors */
  --heat-0: #2d333b;
  --heat-1: #9be9a8;
  --heat-2: #40c463;
  --heat-3: #30a14e;
  --heat-4: #216e39;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --bg-card: #f6f8fa;
  --border: #d0d7de;
  --text: #1f2328;
  --text-muted: #656d76;
  --accent: #0969da;
  --danger: #cf222e;
  --success: #1a7f37;

  /* Heat map colors */
  --heat-0: #ebedf0;
  --heat-1: #9be9a8;
  --heat-2: #40c463;
  --heat-3: #30a14e;
  --heat-4: #216e39;
}

/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ── Auth Screen ── */
#auth-screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#auth-screen[hidden] {
  display: none;
}

#auth-screen .built-by {
  margin-top: auto;
  padding-bottom: 24px;
}

.auth-container {
  max-width: 380px;
  margin: 0 auto;
  padding: 60px 20px;
  text-align: center;
}

.auth-container h1 {
  font-size: 1.8rem;
  margin-bottom: 4px;
}

.auth-subtitle {
  color: var(--text-muted);
  margin-bottom: 32px;
}

/* ── Auth Features ── */
.auth-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 24px;
  margin-bottom: 24px;
  justify-items: start;
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
}

.auth-feature {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.feature-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.btn-demo {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-demo:hover {
  border-color: var(--accent);
  color: var(--text);
}

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

.auth-form input {
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
}

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

.auth-form button {
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.auth-form button:hover {
  opacity: 0.9;
}

.auth-toggle {
  margin-top: 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.auth-toggle a {
  color: var(--accent);
  text-decoration: none;
}

.error {
  color: var(--danger);
  margin-top: 12px;
  font-size: 0.9rem;
}

.success-msg {
  color: var(--success);
  margin-top: 12px;
  font-size: 0.9rem;
}


/* ── Demo Banner ── */
.demo-banner {
  background: var(--accent);
  color: #fff;
  text-align: center;
  padding: 8px 16px;
  margin: -20px 0 12px;
  margin-left: calc(-50vw + 50%);
  margin-right: calc(-50vw + 50%);
  font-size: 0.8rem;
  font-weight: 500;
}

.demo-banner[hidden] {
  display: none;
}

.demo-banner a {
  color: #fff;
  font-weight: 700;
  text-decoration: underline;
}

/* ── App Screen ── */
#app-screen {
  max-width: 700px;
  margin: 0 auto;
  padding: 20px 16px 80px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

#app-screen .footer-links {
  margin-top: auto;
}

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

header h1 {
  font-size: 1.4rem;
}

.btn-text {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: none;
}

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

/* ── Sections ── */
section {
  margin-bottom: 48px;
}

section h2 {
  font-size: 1.1rem;
  margin-bottom: 12px;
  color: var(--text-muted);
}

section h2 span {
  font-weight: 400;
  font-size: 0.9rem;
}

/* ── Section Header with Date Picker ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-header h2 {
  margin-bottom: 0;
}

.section-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Quick Add ── */
.btn-quick-add {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-quick-add:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.quick-add-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  animation: fadeIn 0.2s ease;
}

.quick-add-form[hidden] {
  display: none;
}

.quick-add-row {
  display: flex;
  gap: 8px;
}

.quick-add-row input {
  flex: 1;
  min-width: 0;
}

.quick-add-form .emoji-trigger {
  width: 44px;
  height: 44px;
  font-size: 1.2rem;
}

.quick-add-form .emoji-trigger:not(.has-emoji)::after {
  content: '🏃';
  color: var(--text-muted);
  font-size: 1.1rem;
  opacity: 0.5;
}

.quick-add-form input[type="text"] {
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
}

.quick-add-form input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
}

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

.btn-quick-add-submit {
  padding: 8px 20px;
  background: var(--success);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-quick-add-submit:hover {
  opacity: 0.9;
}

.btn-quick-add-cancel {
  padding: 8px 16px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-quick-add-cancel:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

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

#date-picker {
  padding: 6px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
  color-scheme: inherit;
}

#date-picker:focus {
  outline: none;
  border-color: var(--accent);
}

/* ── Today's Habits ── */
#today-habits {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.today-habit {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.today-habit:hover {
  border-color: var(--accent);
}

.today-habit.completed {
  border-color: var(--success);
}

.habit-checkbox {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}

.today-habit.completed .habit-checkbox {
  background: var(--success);
  border-color: var(--success);
}

.habit-checkbox::after {
  content: "";
  display: none;
  width: 10px;
  height: 6px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}

.today-habit.completed .habit-checkbox::after {
  display: block;
}

.habit-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}

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

.habit-info strong {
  display: block;
  font-size: 0.95rem;
}

.habit-info small {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.empty-state {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
}

.empty-state a {
  color: var(--accent);
  text-decoration: none;
}

.empty-state a:hover {
  text-decoration: underline;
}

/* ── Starter Templates ── */
.starter-templates {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 16px;
}

@media (max-width: 480px) {
  .starter-templates {
    grid-template-columns: 1fr;
  }
}

.starter-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}

.starter-btn:hover {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}

.starter-btn span {
  font-size: 1.1rem;
}

/* ── Heatmap Hint ── */
.heatmap-hint {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 36px 10px 14px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  position: relative;
  animation: fadeIn 0.3s ease;
}

.heatmap-hint[hidden] {
  display: none;
}

.hint-dismiss {
  position: absolute;
  top: 6px;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  padding: 2px;
}

.hint-dismiss:hover {
  color: var(--text);
}

/* ── Nudge ── */
.nudge {
  text-align: center;
  padding: 12px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-style: italic;
  animation: fadeIn 0.3s ease;
}

/* Disabled buttons during async operations */
button:disabled,
.auth-form button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Focus-visible for keyboard navigation */
.today-habit:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Heat Map ── */
#habit-selector {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}


#habit-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
}

#habit-tabs::-webkit-scrollbar {
  display: none;
}

.habit-tab {
  padding: 6px 14px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.habit-tab:hover {
  color: var(--text);
}

.habit-tab.active {
  background: var(--border);
  color: var(--text);
}

#heatmap-stats {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  margin-bottom: 16px;
}

.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  flex: 1;
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--success);
}

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

#heatmap-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  overflow-x: auto;
}

#heatmap-months {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  width: max-content;
}

#heatmap-months span {
  display: inline-block;
}

#heatmap-grid {
  display: grid;
  grid-template-rows: repeat(7, 13px);
  grid-auto-flow: column;
  grid-auto-columns: 13px;
  gap: 3px;
  width: max-content;
  contain: layout style;
}

.heatmap-cell {
  width: 13px;
  height: 13px;
  border-radius: 3px;
  background: var(--heat-0);
  outline: 1px solid rgba(27, 31, 35, 0.06);
  outline-offset: -1px;
}

.heatmap-cell[data-level="1"] { background: var(--heat-1); }
.heatmap-cell[data-level="2"] { background: var(--heat-2); }
.heatmap-cell[data-level="3"] { background: var(--heat-3); }
.heatmap-cell[data-level="4"] { background: var(--heat-4); }

.heatmap-cell.today {
  outline: none;
}

#heatmap-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 8px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.legend-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

/* ── Manage Habits ── */
#add-habit-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
  margin-bottom: 16px;
}

#add-habit-form .name-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

#add-habit-form .name-row #habit-name {
  flex: 1;
  min-width: 0;
}

/* ── Emoji Picker ── */
.emoji-picker-wrap {
  position: relative;
  flex-shrink: 0;
}

.emoji-trigger {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emoji-trigger:not(.has-emoji)::after {
  content: '+';
  color: var(--text-muted);
  font-size: 1.2rem;
}

.emoji-trigger:hover {
  border-color: var(--accent);
}

.emoji-picker {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  width: 300px;
  max-height: 320px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
}

@media (max-width: 480px) {
  .emoji-picker {
    position: fixed;
    left: 8px;
    right: 8px;
    top: auto;
    bottom: 0;
    width: auto;
    max-height: 50vh;
    border-radius: 14px 14px 0 0;
    padding: 14px;
  }
}

.emoji-category-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 2px 4px;
}

.emoji-category-label:first-child {
  padding-top: 0;
}

.emoji-category-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
}

.emoji-option {
  background: none;
  border: none;
  font-size: 1.3rem;
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1;
}

.emoji-option:hover {
  background: var(--bg-card);
}

.edit-row-top {
  display: flex;
  gap: 8px;
  width: 100%;
}

.edit-row-top .edit-name {
  flex: 1;
}

#add-habit-form input {
  flex: 1;
  min-width: 120px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
}

#add-habit-form input:focus {
  outline: none;
  border-color: var(--accent);
}

#add-habit-form > button[type="submit"] {
  padding: 10px 20px;
  background: var(--success);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

#habit-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.habit-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

@media (max-width: 480px) {
  .habit-item {
    grid-template-columns: auto 1fr;
    gap: 4px 10px;
  }
  .habit-item-icon {
    grid-row: span 2;
    align-self: start;
    margin-top: 2px;
  }
  .habit-item-actions {
    grid-column: 2;
    justify-self: start;
    margin-left: -4px;
  }
}

.habit-item-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.habit-item-info strong {
  display: block;
  font-size: 0.95rem;
}

.habit-item-info small {
  color: var(--text-muted);
  font-size: 0.8rem;
}

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

.btn-edit, .btn-delete {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px 8px;
  opacity: 0.7;
}

.btn-edit { color: var(--text-muted); }
.btn-delete { color: var(--danger); }
.btn-edit:hover, .btn-delete:hover { opacity: 1; }

.edit-habit-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
}

.edit-habit-form input {
  flex: 1;
  min-width: 100px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 1rem;
}

.edit-habit-form input:focus {
  outline: none;
  border-color: var(--accent);
}

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

.btn-save {
  padding: 8px 16px;
  background: var(--success);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
}

.btn-cancel {
  padding: 8px 16px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
}

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

/* ── Tooltip ── */
.heatmap-cell {
  position: relative;
}

#heatmap-tooltip {
  position: fixed;
  background: var(--text);
  color: var(--bg);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.7rem;
  white-space: pre-line;
  text-align: left;
  pointer-events: none;
  z-index: 100;
  display: none;
  line-height: 1.4;
}

/* ── Footer Links ── */
.footer-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 8px 0 16px;
}

.footer-links a {
  text-decoration: none;
}


/* ── Motivational Quote ── */
.motivational-quote {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-style: italic;
  text-align: center;
  margin-bottom: 24px;
}

/* ── Built By Footer ── */
.built-by {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.6;
  margin-top: 24px;
  margin-bottom: 12px;
}

.built-by a {
  color: inherit;
  text-decoration: none;
}

.built-by a:hover {
  text-decoration: underline;
}

/* ── Skeleton Loading ── */
.skeleton {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.04), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.skeleton-habit {
  height: 56px;
  margin-bottom: 8px;
}

.skeleton-heatmap {
  height: 140px;
}

.skeleton-stats {
  display: flex;
  gap: 16px;
  margin-top: 16px;
}

.skeleton-stat {
  height: 72px;
  flex: 1;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 24px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text);
}

.modal h2 {
  font-size: 1.3rem;
  margin-bottom: 20px;
  color: var(--text);
}

/* ── Daily Reminder ── */
#reminder-section {
  margin-bottom: 16px;
}

.reminder-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.reminder-label strong {
  display: block;
  font-size: 0.95rem;
}

.reminder-label small {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.reminder-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

#reminder-time {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
  color-scheme: inherit;
}

#reminder-time:focus {
  outline: none;
  border-color: var(--accent);
}

.btn-reminder {
  padding: 6px 14px;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  background: var(--success);
  transition: opacity 0.15s;
}

.btn-reminder:hover {
  opacity: 0.9;
}

.btn-reminder.active {
  background: var(--danger);
}

/* ── Settings Page ── */
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
}

.settings-label {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.settings-value {
  font-size: 0.95rem;
}

.btn-settings {
  padding: 6px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}

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

.btn-danger-outline {
  width: 100%;
  padding: 12px;
  background: none;
  border: 1px solid var(--danger);
  border-radius: 10px;
  color: var(--danger);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-danger-outline:hover {
  background: var(--danger);
  color: #fff;
}

/* ── Toast Notifications ── */
#toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  z-index: 300;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}

.toast {
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #fff;
  pointer-events: auto;
  animation: toast-in 0.3s ease, toast-out 0.3s ease 2s forwards;
  text-align: center;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--accent); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(12px); }
}

/* ── Mobile ── */
@media (max-width: 480px) {
  #app-screen {
    padding-top: 16px;
  }

  header {
    margin-bottom: 16px;
  }

  .motivational-quote {
    margin-bottom: 16px;
  }

  section {
    margin-bottom: 32px;
  }

  #heatmap-stats {
    flex-direction: row;
    gap: 8px;
  }

  .stat {
    padding: 10px 8px;
  }

  .stat-value {
    font-size: 1.2rem;
  }

  #add-habit-form {
    flex-direction: column;
  }

  #add-habit-form > button[type="submit"] {
    width: 100%;
  }
}
