/* ============================================================
   BUJO PWA — styles.css
   Componentes e layout principal. Mobile-first (375–430px).
   ============================================================ */

/* ── Base ───────────────────────────────────────────────── */
html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--text-base);
  transition: background var(--duration) var(--ease),
              color var(--duration) var(--ease);
}

body {
  background: var(--bg);
  max-width: var(--max-w);
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
  overflow-x: hidden;
}

/* ── App Shell ──────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* ── Header ─────────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border-subtle);
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(15, 15, 15, 0.92);
}

[data-theme="light"] .app-header {
  background: rgba(250, 250, 250, 0.92);
}

.header-logo {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.header-logo span {
  color: var(--accent);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background var(--duration-fast) var(--ease),
              color var(--duration-fast) var(--ease);
  font-size: 1.1rem;
}

.icon-btn:hover {
  background: var(--surface-raised);
  color: var(--text);
}

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

/* ── Main content ───────────────────────────────────────── */
main {
  flex: 1;
  padding-bottom: calc(var(--nav-height) + var(--space-4));
  overflow-y: auto;
}

.screen {
  display: none;
  animation: fadeIn var(--duration) var(--ease);
}

.screen.active {
  display: block;
}

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

/* ── Bottom Navigation ──────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-w);
  height: var(--nav-height);
  background: var(--bg);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 200;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(15, 15, 15, 0.95);
}

[data-theme="light"] .bottom-nav {
  background: rgba(250, 250, 250, 0.95);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-2) var(--space-5);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 500;
  transition: color var(--duration-fast) var(--ease);
  cursor: pointer;
  border-radius: var(--radius);
  position: relative;
}

.nav-item .nav-icon {
  font-size: 1.3rem;
  line-height: 1;
}

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

.nav-item.active::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 2px;
  background: var(--accent);
  border-radius: var(--radius-full);
}

/* ── FAB ────────────────────────────────────────────────── */
.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--space-5));
  right: var(--space-5);
  z-index: 300;
  width: var(--fab-size);
  height: var(--fab-size);
  border-radius: var(--radius-full);
  background: var(--accent);
  color: #fff;
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-fab);
  transition: transform var(--duration-fast) var(--ease),
              box-shadow var(--duration-fast) var(--ease),
              background var(--duration-fast) var(--ease);
  will-change: transform;
}

.fab:hover {
  background: var(--accent-hover);
  transform: scale(1.06);
  box-shadow: 0 6px 28px rgba(91, 94, 166, 0.55);
}

.fab:active {
  transform: scale(0.94);
}

.fab .fab-icon {
  transition: transform var(--duration-fast) var(--ease);
  line-height: 1;
}

.fab.open .fab-icon {
  transform: rotate(45deg);
}

/* ── Daily Log Screen ───────────────────────────────────── */
.daily-log {
  padding: 0 var(--space-5);
}

/* Date navigation */
.date-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) 0 var(--space-3);
}

.date-nav-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 1rem;
  transition: background var(--duration-fast) var(--ease),
              color var(--duration-fast) var(--ease);
}

.date-nav-btn:hover {
  background: var(--surface-raised);
  color: var(--text);
}

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

.date-display {
  text-align: center;
  flex: 1;
}

.date-display .date-weekday {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.date-display .date-main {
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
}

.date-display .date-today-badge {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-subtle);
  padding: 1px var(--space-2);
  border-radius: var(--radius-full);
  margin-top: 2px;
}

/* Sunday Review Banner */
.review-banner {
  margin: var(--space-3) 0;
  padding: var(--space-4);
  background: var(--accent-subtle);
  border: 1px solid var(--accent-glow);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease);
  animation: slideDown var(--duration-slow) var(--ease);
}

.review-banner:hover {
  background: rgba(91, 94, 166, 0.2);
}

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

.review-banner .banner-icon { font-size: 1.4rem; }
.review-banner .banner-text {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
}

.review-banner .banner-dismiss {
  color: var(--text-muted);
  font-size: 1rem;
  padding: var(--space-1);
  border-radius: var(--radius-full);
}

.review-banner .banner-dismiss:hover {
  color: var(--text);
  background: var(--accent-subtle);
}

/* Entry list */
.entry-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-bottom: var(--space-4);
}

.entry-list-empty {
  text-align: center;
  padding: var(--space-12) var(--space-4);
  color: var(--text-muted);
}

.entry-list-empty .empty-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-3);
  opacity: 0.4;
}

.entry-list-empty p {
  font-size: var(--text-sm);
  line-height: 1.6;
}

/* Individual entry row */
.entry-item {
  position: relative;
  overflow: hidden;
}

.entry-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-2);
  border-radius: var(--radius);
  background: var(--bg);
  transition: background var(--duration-fast) var(--ease),
              transform var(--duration-fast) var(--ease);
  position: relative;
  z-index: 1;
  cursor: default;
  touch-action: pan-y;
}

.entry-row:hover {
  background: var(--surface);
}

/* Left color bar */
.entry-row::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 2px;
  border-radius: var(--radius-full);
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease);
}

.entry-row:hover::before { opacity: 1; }

.entry-row[data-type="task"]::before    { background: var(--type-task); }
.entry-row[data-type="event"]::before   { background: var(--type-event); }
.entry-row[data-type="idea"]::before    { background: var(--type-idea); }
.entry-row[data-type="feeling"]::before { background: var(--type-feeling); }
.entry-row[data-type="health"]::before  { background: var(--type-health); }
.entry-row[data-type="habit"]::before   { background: var(--type-habit); }
.entry-row[data-type="note"]::before    { background: var(--type-note); }
.entry-row[data-type="review"]::before  { background: var(--type-review); }

/* Time */
.entry-time {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 400;
  min-width: 34px;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

/* Bullet symbol */
.entry-bullet {
  font-size: 1rem;
  min-width: 20px;
  text-align: center;
  margin-top: 1px;
  line-height: 1.4;
}

.entry-row[data-type="idea"]    .entry-bullet { color: var(--type-idea); }
.entry-row[data-type="feeling"] .entry-bullet { color: var(--type-feeling); }
.entry-row[data-type="health"]  .entry-bullet { color: var(--type-health); }
.entry-row[data-type="habit"]   .entry-bullet { color: var(--type-habit); }
.entry-row[data-type="event"]   .entry-bullet { color: var(--type-event); }
.entry-row[data-type="review"]  .entry-bullet { color: var(--type-review); }

/* Text content */
.entry-content {
  flex: 1;
  min-width: 0;
}

.entry-text {
  font-size: var(--text-base);
  color: var(--text);
  line-height: 1.45;
  word-break: break-word;
}

.entry-text.done {
  text-decoration: line-through;
  color: var(--text-muted);
}

.entry-text.cancelled {
  text-decoration: line-through;
  color: var(--text-muted);
  opacity: 0.5;
}

.entry-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-top: var(--space-1);
}

.tag-chip {
  font-size: var(--text-xs);
  color: var(--accent);
  background: var(--accent-subtle);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-weight: 500;
}

/* Task status toggle */
.task-toggle {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  flex-shrink: 0;
  transition: border-color var(--duration-fast) var(--ease),
              background var(--duration-fast) var(--ease);
  cursor: pointer;
  font-size: 0.65rem;
  color: transparent;
}

.task-toggle:hover {
  border-color: var(--type-health);
  color: var(--type-health);
}

.task-toggle.done {
  border-color: var(--type-health);
  background: var(--type-health-bg);
  color: var(--type-health);
}

/* Swipe actions */
.entry-actions {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: stretch;
  z-index: 0;
}

.entry-action-btn {
  width: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: opacity var(--duration-fast) var(--ease);
  font-weight: 500;
}

.entry-action-btn.edit {
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius) 0 0 var(--radius);
}

.entry-action-btn.delete {
  background: #c0392b;
  color: #fff;
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ── Entry Modal (Bottom Sheet) ─────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration) var(--ease);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

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

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: var(--max-w);
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  z-index: 600;
  padding: var(--space-4) var(--space-5) var(--space-8);
  box-shadow: var(--shadow-lg);
  transition: transform var(--duration-slow) var(--ease);
  max-height: 90dvh;
  overflow-y: auto;
}

.bottom-sheet.visible {
  transform: translateX(-50%) translateY(0);
}

.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: var(--radius-full);
  margin: 0 auto var(--space-5);
}

.sheet-title {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-5);
  color: var(--text);
}

/* Bullet type selector grid */
.type-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-2);
  border-radius: var(--radius);
  background: var(--surface-raised);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease),
              background var(--duration-fast) var(--ease),
              transform var(--duration-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.type-btn:active { transform: scale(0.93); }

.type-btn.selected {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.type-btn[data-type="idea"].selected    { border-color: var(--type-idea); background: var(--type-idea-bg); }
.type-btn[data-type="feeling"].selected { border-color: var(--type-feeling); background: var(--type-feeling-bg); }
.type-btn[data-type="health"].selected  { border-color: var(--type-health); background: var(--type-health-bg); }
.type-btn[data-type="habit"].selected   { border-color: var(--type-habit); background: var(--type-habit-bg); }

.type-symbol {
  font-size: 1.4rem;
  line-height: 1;
}

.type-btn[data-type="idea"]    .type-symbol { color: var(--type-idea); }
.type-btn[data-type="feeling"] .type-symbol { color: var(--type-feeling); }
.type-btn[data-type="health"]  .type-symbol { color: var(--type-health); }
.type-btn[data-type="habit"]   .type-symbol { color: var(--type-habit); }
.type-btn[data-type="event"]   .type-symbol { color: var(--type-event); }
.type-btn[data-type="review"]  .type-symbol { color: var(--type-review); }

.type-label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.2;
}

/* Form fields */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-2);
  display: block;
}

.form-input,
.form-textarea {
  width: 100%;
  background: var(--surface-raised);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  color: var(--text);
  transition: border-color var(--duration-fast) var(--ease);
  resize: none;
}

.form-textarea {
  min-height: 80px;
  line-height: 1.5;
}

.form-input:focus,
.form-textarea:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-muted); }

/* Habit selector in modal */
.habit-select-group {
  display: none;
}

.habit-select-group.visible {
  display: block;
}

.habit-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 160px;
  overflow-y: auto;
}

.habit-option-btn {
  padding: var(--space-3) var(--space-4);
  background: var(--surface-raised);
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  text-align: left;
  font-size: var(--text-base);
  color: var(--text);
  transition: border-color var(--duration-fast) var(--ease),
              background var(--duration-fast) var(--ease);
}

.habit-option-btn.selected {
  border-color: var(--type-habit);
  background: var(--type-habit-bg);
}

.habit-empty-note {
  font-size: var(--text-sm);
  color: var(--text-muted);
  padding: var(--space-3);
}

/* Save button */
.btn-save {
  width: 100%;
  padding: var(--space-4);
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  font-size: var(--text-base);
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: background var(--duration-fast) var(--ease),
              transform var(--duration-fast) var(--ease);
  margin-top: var(--space-2);
}

.btn-save:hover { background: var(--accent-hover); }
.btn-save:active { transform: scale(0.97); }
.btn-save:disabled {
  background: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* ── Habits Section ─────────────────────────────────────── */
.habits-section {
  margin: 0 var(--space-5) var(--space-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
}

.habits-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.habits-header:hover { background: var(--surface-raised); }

.habits-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.habits-chevron {
  color: var(--text-muted);
  font-size: 0.75rem;
  transition: transform var(--duration-fast) var(--ease);
}

.habits-section.expanded .habits-chevron {
  transform: rotate(180deg);
}

.habits-list {
  display: none;
  flex-direction: column;
  background: var(--bg);
}

.habits-section.expanded .habits-list {
  display: flex;
}

.habit-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-subtle);
  transition: background var(--duration-fast) var(--ease);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.habit-item:hover { background: var(--surface); }
.habit-item:active { background: var(--surface-raised); }

.habit-check {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: transparent;
  flex-shrink: 0;
  transition: border-color var(--duration-fast) var(--ease),
              background var(--duration-fast) var(--ease),
              color var(--duration-fast) var(--ease);
}

.habit-check.checked {
  border-color: var(--type-habit);
  background: var(--type-habit-bg);
  color: var(--type-habit);
}

.habit-name {
  font-size: var(--text-sm);
  color: var(--text);
  flex: 1;
}

.habit-name.checked {
  color: var(--text-muted);
  text-decoration: line-through;
}

/* ── Weekly Review Screen ───────────────────────────────── */
.weekly-review {
  padding: var(--space-5);
}

.review-header {
  margin-bottom: var(--space-6);
}

.review-week-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-2);
}

.review-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

.review-section {
  margin-bottom: var(--space-6);
}

.review-section-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.review-entries {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.review-entry {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  border-radius: var(--radius-sm);
  display: flex;
  gap: var(--space-2);
  line-height: 1.4;
}

.review-entry.pending {
  border-left: 2px solid var(--type-task);
}

.review-entry.done {
  opacity: 0.6;
  text-decoration: line-through;
}

.review-entry-date {
  color: var(--text-muted);
  font-size: var(--text-xs);
  white-space: nowrap;
}

/* Habits table */
.habits-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
}

.habits-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  min-width: 320px;
}

.habits-table th {
  padding: var(--space-2) var(--space-3);
  text-align: center;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.habits-table th:first-child { text-align: left; }

.habits-table td {
  padding: var(--space-2) var(--space-3);
  text-align: center;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.habits-table td:first-child {
  text-align: left;
  font-weight: 500;
  color: var(--text);
}

.habits-table .check-yes { color: var(--type-health); font-size: 0.9rem; }
.habits-table .check-no  { color: var(--text-muted); font-size: 0.75rem; }

/* Reflection fields */
.reflection-fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.reflection-field label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  display: block;
  margin-bottom: var(--space-2);
}

.reflection-textarea {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--text);
  resize: none;
  min-height: 80px;
  line-height: 1.5;
  transition: border-color var(--duration-fast) var(--ease);
  font-family: var(--font);
}

.reflection-textarea:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-finalize {
  width: 100%;
  padding: var(--space-4);
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  font-size: var(--text-base);
  font-weight: 600;
  margin-top: var(--space-4);
  transition: background var(--duration-fast) var(--ease),
              transform var(--duration-fast) var(--ease);
}

.btn-finalize:hover { background: var(--accent-hover); }
.btn-finalize:active { transform: scale(0.97); }

/* ── Settings Screen ────────────────────────────────────── */
.settings-screen {
  padding: var(--space-5);
}

.settings-title {
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-6);
}

.settings-group {
  margin-bottom: var(--space-6);
}

.settings-group-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-2);
  padding-left: var(--space-1);
}

.settings-list {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease);
}

.settings-row:last-child { border-bottom: none; }
.settings-row:hover { background: var(--surface-raised); }

.settings-row-info { flex: 1; }
.settings-row-label {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text);
}

.settings-row-desc {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

/* Toggle switch */
.toggle {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease);
}

.toggle input:checked + .toggle-track { background: var(--accent); }

.toggle-track::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-fast) var(--ease);
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(18px);
}

/* Habits management in settings */
.habit-manage-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.habit-manage-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
}

.habit-manage-name {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
}

.habit-manage-delete {
  color: var(--text-muted);
  font-size: 1rem;
  padding: var(--space-1);
  border-radius: var(--radius-full);
  transition: color var(--duration-fast) var(--ease),
              background var(--duration-fast) var(--ease);
}

.habit-manage-delete:hover {
  color: #c0392b;
  background: rgba(192, 57, 43, 0.1);
}

.habit-add-row {
  display: flex;
  gap: var(--space-2);
}

.habit-add-input {
  flex: 1;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--text);
  transition: border-color var(--duration-fast) var(--ease);
}

.habit-add-input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-add-habit {
  padding: var(--space-3) var(--space-4);
  background: var(--accent-subtle);
  color: var(--accent);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 600;
  border: 1.5px solid var(--accent);
  transition: background var(--duration-fast) var(--ease);
  white-space: nowrap;
}

.btn-add-habit:hover { background: var(--accent); color: #fff; }

/* Danger zone */
.btn-danger {
  width: 100%;
  padding: var(--space-4);
  background: transparent;
  color: #c0392b;
  border-radius: var(--radius);
  border: 1.5px solid #c0392b;
  font-size: var(--text-sm);
  font-weight: 600;
  transition: background var(--duration-fast) var(--ease),
              color var(--duration-fast) var(--ease);
}

.btn-danger:hover { background: #c0392b; color: #fff; }

/* ── Toast Notification ─────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--space-4));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-raised);
  color: var(--text);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-fast) var(--ease),
              transform var(--duration-fast) var(--ease);
  white-space: nowrap;
  border: 1px solid var(--border);
}

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

.toast.success { border-color: var(--type-health); }
.toast.error   { border-color: #c0392b; }

/* ── Edit modal overlay ─────────────────────────────────── */
.edit-overlay-title {
  margin-bottom: var(--space-4);
}

/* ── Confirm Dialog ─────────────────────────────────────── */
.confirm-dialog {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration) var(--ease);
}

.confirm-dialog.visible {
  opacity: 1;
  pointer-events: all;
}

.confirm-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  max-width: 320px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  transform: scale(0.92);
  transition: transform var(--duration) var(--ease);
  border: 1px solid var(--border);
}

.confirm-dialog.visible .confirm-box {
  transform: scale(1);
}

.confirm-title {
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--space-2);
  color: var(--text);
}

.confirm-message {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-5);
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  gap: var(--space-3);
}

.btn-confirm-cancel,
.btn-confirm-ok {
  flex: 1;
  padding: var(--space-3);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 600;
  transition: background var(--duration-fast) var(--ease),
              transform var(--duration-fast) var(--ease);
}

.btn-confirm-cancel {
  background: var(--surface-raised);
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}

.btn-confirm-cancel:hover { background: var(--border); }

.btn-confirm-ok {
  background: #c0392b;
  color: #fff;
  border: 1.5px solid transparent;
}

.btn-confirm-ok:hover { background: #a93226; }
.btn-confirm-ok:active { transform: scale(0.96); }

/* ── Scrollbar styling ──────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Utilities ──────────────────────────────────────────── */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-4) 0;
}

/* ── Responsive tweaks ──────────────────────────────────── */
@media (min-width: 430px) {
  body { border-left: 1px solid var(--border-subtle); border-right: 1px solid var(--border-subtle); }
  .bottom-nav { border-left: 1px solid var(--border-subtle); border-right: 1px solid var(--border-subtle); }
}
