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

:root {
  --bg:         #1a1a1a;
  --surface:    #262626;
  --surface2:   #2f2f2f;
  --border:     #3a3a3a;
  --text:       #ffffff;
  --text-2:     #aaaaaa;
  --text-3:     #666666;
  --safe-top:   env(safe-area-inset-top, 0px);
  --safe-bot:   env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  text-transform: uppercase;
}

/* inputs don't inherit text-transform by default in all browsers — force it */
input, textarea, button, select {
  text-transform: uppercase;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.hidden { display: none !important; }

/* ── HEADER ───────────────────────────────────────── */
#app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 14px) 20px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  min-height: calc(var(--safe-top) + 64px);
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.header-right {
  display: flex;
  align-items: center;
  align-self: center;
  gap: 10px;
}

.app-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1;
  color: var(--text);
}

.app-date {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 400;
}

/* ── TASK SECTION HEADER ──────────────────────────── */
#task-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px 6px;
}

.task-section-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-2);
  text-transform: uppercase;
}

.task-section-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── ADD TASK BUTTON ──────────────────────────────── */
.add-task-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  text-transform: uppercase;
}

.add-task-btn:active { background: var(--border); }

/* ── SETTINGS BUTTON ──────────────────────────────── */
.settings-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  text-transform: uppercase;
}

.settings-btn:active { background: var(--border); }

/* ── DISPLAY TOGGLE (inside settings) ────────────── */
.display-toggle-btns {
  display: flex;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.display-btn {
  padding: 6px 10px;
  font-size: 10px;
  font-weight: 700;
  background: var(--surface2);
  color: var(--text-3);
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.display-btn + .display-btn {
  border-left: 1px solid var(--border);
}

.display-btn.selected {
  background: var(--text);
  color: var(--bg);
}

/* On small screens collapse buttons to icon-only */
@media (max-width: 560px) {
  .add-task-btn-text, .settings-btn-text, .add-todo-btn-text { display: none; }
  .add-task-btn, .settings-btn { padding: 8px 10px; border-radius: 50%; }
}

.header-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
  font-size: 15px;
}

.header-btn:active { background: var(--border); }

/* ── PROGRESS CIRCLES ─────────────────────────────── */
#progress-bar-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 20px 4px;
}

#progress-circles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.progress-circle {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid #30d158;
  background: transparent;
  flex-shrink: 0;
  transition: background 0.35s ease, transform 0.2s ease;
}

.progress-circle.filled {
  background: #30d158;
  transform: scale(1.1);
}

#progress-label {
  font-size: 11px;
  color: var(--text-2);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: color 0.4s ease, font-weight 0.4s ease;
}

/* all-done celebration state */
#progress-bar-wrap.all-done #progress-label {
  color: #30d158;
  font-weight: 700;
  white-space: normal;
  animation: label-slide-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

#progress-bar-wrap.all-done .progress-circle.filled {
  animation: circle-wave 0.55s ease both;
}

@keyframes label-slide-in {
  0%   { opacity: 0; transform: translateY(6px); letter-spacing: 0px; }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: translateY(0);   letter-spacing: inherit; }
}

@keyframes circle-wave {
  0%   { transform: scale(1.1)  translateY(0);    }
  30%  { transform: scale(1.25) translateY(-5px); }
  55%  { transform: scale(1.0)  translateY(1px);  }
  75%  { transform: scale(1.15) translateY(-2px); }
  100% { transform: scale(1.1)  translateY(0);    }
}

/* ── TASK LIST ────────────────────────────────────── */
#task-list {
  display: grid;
  grid-template-columns: max-content;
  padding: 16px 16px calc(16px + var(--safe-bot));
  gap: 10px;
  align-content: start;
}

/* ── TASK ROW ─────────────────────────────────────── */
.task-row {
  display: flex;
  align-items: center;
  gap: 36px;
  background: var(--surface);
  border-radius: 16px;
  padding: 14px 20px;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}

.task-toggle {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2.5px solid var(--border);
  background: var(--surface2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: border-color 0.25s, background 0.25s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}

.task-toggle:active {
  transform: scale(0.93);
}

.task-toggle i {
  color: var(--text);
  font-size: 16px;
  pointer-events: none;
}

.task-row.completed .task-toggle i {
  color: #ffffff;
}

.task-row.completed .task-toggle {
  border-color: transparent;
}

.task-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 24px;
  min-width: 0;
  flex-wrap: nowrap;
  overflow: hidden;
}

.task-row-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
  min-width: 0;
}

.task-row.completed .task-row-name {
  opacity: 0.7;
}

.task-meta-divider {
  color: var(--text-3);
  font-size: 17px;
  flex-shrink: 0;
  line-height: 1;
}

.streak-icon {
  font-size: 17px;
  color: var(--text-3);
  flex-shrink: 0;
}

.streak-count {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.meta-btn {
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  font-size: 17px;
  opacity: 0.6;
  transition: opacity 0.15s;
  line-height: 1;
  flex-shrink: 0;
}

.meta-btn:active {
  opacity: 1;
}

/* ── TO-DO LIST ───────────────────────────────────── */
#todo-section {
  padding: 0 16px calc(24px + var(--safe-bot));
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 22px;
}

.todo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
}

.todo-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.todo-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-2);
  text-transform: uppercase;
}

#todo-list {
  display: grid;
  grid-template-columns: max-content;
  gap: 10px;
  align-content: start;
}

/* ── TODO TILE (matches task-row style) ───────────── */
.todo-item {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--surface);
  border-radius: 16px;
  padding: 14px 20px;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}

.todo-checkbox {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 2.5px solid var(--border);
  background: var(--surface2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.25s, background 0.25s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}

.todo-checkbox:active { transform: scale(0.93); }

.todo-checkbox i {
  font-size: 14px;
  color: #fff;
  opacity: 0;
  transition: opacity 0.15s;
}

.todo-item.done .todo-checkbox {
  background: var(--border);
  border-color: var(--border);
}

.todo-item.done .todo-checkbox i { opacity: 1; }

.todo-item-text {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: none;
  min-width: 0;
}

.todo-item.done .todo-item-text {
  opacity: 0.5;
  text-decoration: line-through;
}

/* ── TODO INLINE ADD ──────────────────────────────── */
.todo-inline-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
  font-family: inherit;
  text-transform: none;
  padding: 0;
}

.todo-inline-input::placeholder { color: var(--text-3); font-weight: 400; }

.todo-new-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.todo-new-group .todo-inline-input {
  flex: 0 0 auto;
  width: 150px;
}

.todo-inline-add {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 10px;
  border: none;
  background: #30d158;
  color: #000;
  font-size: 11px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s;
}

.todo-inline-add:active { opacity: 0.7; }

/* ── TODO PER-ITEM EDIT MODE ──────────────────────── */
.todo-drag-handle {
  flex-shrink: 0;
  padding: 4px 2px;
  color: var(--text-3);
  font-size: 15px;
  cursor: grab;
  touch-action: none;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

.todo-drag-handle:active { cursor: grabbing; }

.todo-rename-input {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 1.5px solid var(--text-3);
  outline: none;
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
  font-family: inherit;
  text-transform: none;
  padding: 2px 0;
  min-width: 160px;
}

.todo-item-delete-btn {
  flex-shrink: 0;
  background: rgba(255, 69, 58, 0.12);
  border: none;
  color: #ff453a;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.todo-item-delete-btn:active { opacity: 0.5; }

.todo-item-save-btn {
  flex-shrink: 0;
  background: rgba(48, 209, 88, 0.15);
  border: none;
  color: #30d158;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.todo-item-save-btn:active { opacity: 0.5; }

.todo-item.dragging {
  opacity: 0;
  pointer-events: none;
}

/* ── EMPTY STATE ──────────────────────────────────── */
#empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 1;
  padding: 60px 32px;
  text-align: center;
}

.empty-icon {
  font-size: 48px;
  opacity: 0.2;
}

.empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-2);
}

.empty-sub {
  font-size: 14px;
  color: var(--text-3);
}

/* ── MODAL ────────────────────────────────────────── */
#modal-overlay, #reset-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding-bottom: var(--safe-bot);
}

#modal, #reset-dialog {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 24px 20px calc(24px + var(--safe-bot));
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: slide-up 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 90dvh;
  overflow-y: auto;
}

@keyframes slide-up {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}

#modal-title {
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  color: var(--text);
}

.modal-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.modal-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  color: var(--text-2);
  text-transform: inherit;
}

.char-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.char-count.near-limit { color: #ff9f0a; }
.char-count.at-limit   { color: #ff453a; font-weight: 700; }

.modal-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 16px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.modal-input:focus { border-color: #555; }

/* ── EMOJI SELECTOR ───────────────────────────────── */
.emoji-selector {
  display: flex;
  align-items: center;
  gap: 10px;
}

.emoji-selected-wrap {
  flex-shrink: 0;
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-selected-display {
  font-size: 24px;
  color: #ffffff;
}

.emoji-search-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.emoji-search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-3);
  font-size: 13px;
  pointer-events: none;
}

.emoji-search-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 15px;
  padding: 12px 14px 12px 36px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}

.emoji-search-input:focus { border-color: #555; }
.emoji-search-input::placeholder { color: var(--text-3); }

.emoji-results {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  background: var(--surface2);
  border-radius: 14px;
  padding: 10px;
}

.emoji-results-hint {
  grid-column: 1 / -1;
  font-size: 10px;
  color: var(--text-3);
  text-align: center;
  padding: 4px 0 2px;
  letter-spacing: 0.5px;
}

.emoji-opt {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 8px 4px;
  border-radius: 8px;
  border: none;
  background: none;
  line-height: 1;
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
  color: #ffffff;
  font-size: 16px;
}

.emoji-opt:active, .emoji-opt.selected {
  background: var(--border);
}

/* color row */
.color-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}

.color-swatches {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* custom color section */
.color-custom-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-left: 14px;
  border-left: 1px solid var(--border);
}

.color-custom-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--text-3);
  text-transform: uppercase;
}

.color-custom-inputs {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.color-input-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.color-input-sublabel {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-3);
  text-transform: uppercase;
}

/* color picker circle */
.color-picker-input {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid var(--border);
  cursor: pointer;
  padding: 0;
  background: none;
  flex-shrink: 0;
  transition: border-color 0.15s;
}

.color-picker-input::-webkit-color-swatch-wrapper { padding: 0; border-radius: 50%; }
.color-picker-input::-webkit-color-swatch { border: none; border-radius: 50%; }
.color-picker-input:hover { border-color: #888; }

/* hex input */
.hex-input {
  width: 84px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 12px;
  padding: 6px 8px;
  outline: none;
  font-family: monospace;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  text-transform: uppercase;
}

.hex-input:focus { border-color: #555; }

.color-swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: border-color 0.15s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.color-swatch.selected {
  border-color: var(--text);
  transform: scale(1.15);
}

/* modal actions */
.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-cancel, .modal-save {
  flex: 1;
  padding: 14px;
  border-radius: 14px;
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.modal-cancel {
  background: var(--surface2);
  color: var(--text);
}

.modal-save {
  background: #30d158;
  color: #000;
}

.modal-cancel:active, .modal-save:active { opacity: 0.7; }

.modal-reset {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: none;
  background: rgba(255, 159, 10, 0.15);
  color: #ff9f0a;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.modal-reset:active { opacity: 0.7; }

.modal-delete {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: none;
  background: rgba(255, 69, 58, 0.15);
  color: #ff453a;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.modal-delete:active { opacity: 0.7; }

/* ── CALENDAR MODAL ───────────────────────────────── */
#cal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 20px;
}

#cal-modal {
  background: var(--surface);
  border-radius: 20px;
  padding: 20px;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: slide-up 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.cal-task-name {
  font-size: 15px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
  color: var(--text);
}

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cal-nav-btn {
  background: var(--surface2);
  border: none;
  color: #ffffff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}

.cal-nav-btn:active { background: var(--border); }

.cal-month-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

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

.cal-dow {
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  padding-bottom: 4px;
  text-transform: inherit;
}

.cal-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 500;
  border-radius: 50%;
  color: var(--text);
  position: relative;
}

.cal-cell.cal-empty    { visibility: hidden; }
.cal-cell.cal-inactive { color: var(--text-3); opacity: 0.4; }

.cal-cell.cal-today {
  border: 1.5px solid var(--text-2);
  color: var(--text);
}

.cal-cell.cal-missed {
  background: rgba(255, 69, 58, 0.2);
  color: #ff6b63;
}

/* completed must come after missed so it wins if both classes are present */
.cal-cell.cal-completed {
  background: var(--task-color, #30d158) !important;
  color: #000 !important;
  font-weight: 700;
  border: none;
}

.cal-cell.cal-clickable {
  cursor: pointer;
  transition: opacity 0.15s;
}

.cal-cell.cal-clickable:active { opacity: 0.6; }

/* legend */
.cal-legend {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-2);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-completed { background: #30d158; }
.legend-missed    { background: rgba(255, 69, 58, 0.5); }
.legend-neutral   { background: var(--surface2); border: 1px solid var(--border); }

/* ── RESET DIALOG ─────────────────────────────────── */
#reset-overlay {
  align-items: center;
}

#reset-dialog {
  border-radius: 20px;
  max-width: 320px;
  text-align: center;
  padding: 28px 24px;
}

#reset-dialog p {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

/* ── CATEGORY SELECTOR (modal) ───────────────────── */
.modal-label-optional {
  font-weight: 400;
  color: var(--text-3);
  font-size: 10px;
  letter-spacing: 0;
}

.category-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.category-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 4px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: var(--surface2);
  color: var(--text-2);
  cursor: pointer;
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  transition: border-color 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.category-btn i { font-size: 16px; }

.category-btn.selected {
  border-color: #30d158;
  color: #30d158;
}


/* ── CATEGORY HEADERS (list view) ────────────────── */
.category-header {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--text-3);
  padding: 14px 4px 6px;
  text-transform: uppercase;
}

.category-header:first-child {
  padding-top: 2px;
}

/* ── SOUND OPTIONS ────────────────────────────────── */
.sound-options {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.sound-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 4px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: var(--surface2);
  color: var(--text-2);
  cursor: pointer;
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  transition: border-color 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.sound-btn i { font-size: 18px; }

.sound-btn.selected {
  border-color: #30d158;
  color: #30d158;
}

/* ── FREQUENCY OPTIONS ────────────────────────────── */
.freq-type-wrap {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.freq-type-btn {
  padding: 10px 4px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: var(--surface2);
  color: var(--text-2);
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  transition: border-color 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.freq-type-btn.selected {
  border-color: #30d158;
  color: #30d158;
}

.freq-count-row {
  display: flex;
  gap: 6px;
}

.freq-count-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--surface2);
  color: var(--text-2);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.freq-count-btn.selected {
  border-color: #30d158;
  color: #30d158;
}

.freq-days-row {
  display: flex;
  gap: 5px;
  justify-content: space-between;
}

.freq-day-btn {
  flex: 1;
  height: 38px;
  border-radius: 10px;
  border: 2px solid transparent;
  background: var(--surface2);
  color: var(--text-2);
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.freq-day-btn.selected {
  border-color: #30d158;
  color: #30d158;
}

/* ── GRAYED OUT TASK ──────────────────────────────── */
.task-row.grayed-out {
  opacity: 0.35;
}

.task-row.grayed-out .task-toggle {
  pointer-events: none;
  cursor: default;
}

/* ── DESKTOP MODAL CENTERING ──────────────────────── */
@media (min-width: 600px) {
  #modal-overlay, #reset-overlay {
    align-items: center;
    padding-bottom: 0;
  }

  #modal, #reset-dialog {
    border-radius: 20px;
    padding-bottom: 24px;
  }
}

/* ── SETTINGS MODAL ───────────────────────────────── */
#settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 20px;
}

#settings-modal {
  background: var(--surface);
  border-radius: 20px;
  padding: 24px 20px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: slide-up 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.settings-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--text-2);
  text-transform: uppercase;
}

.theme-toggle-btns {
  display: flex;
  gap: 10px;
}

.theme-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 10px;
  border-radius: 14px;
  border: 2px solid transparent;
  background: var(--surface2);
  color: var(--text-2);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  transition: border-color 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.theme-btn i { font-size: 22px; }

.theme-btn.selected {
  border-color: #30d158;
  color: var(--text);
}

/* ── LIGHT MODE ────────────────────────────────────── */
body.light {
  --bg:       #ffffff;
  --surface:  #efefef;
  --surface2: #e3e3e3;
  --border:   #d0d0d0;
  --text:     #1a1a1a;
  --text-2:   #555555;
  --text-3:   #999999;
}

/* ── PULSE ANIMATION ──────────────────────────────── */
@keyframes pulse-ring {
  0%   { transform: scale(1);   opacity: 0.6; }
  100% { transform: scale(1.5); opacity: 0; }
}

.pulse-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  pointer-events: none;
  animation: pulse-ring 0.5s ease-out forwards;
}

/* ── CONFETTI ─────────────────────────────────────── */
#confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 10px;
  opacity: 1;
  animation: confetti-fall linear forwards;
}

.confetti-piece.rect  { border-radius: 2px; }
.confetti-piece.circle { border-radius: 50%; }
.confetti-piece.ribbon { width: 4px; height: 14px; border-radius: 2px; }

@keyframes confetti-fall {
  0%   { transform: translateY(0) rotate(0deg)   translateX(0);    opacity: 1; }
  20%  { opacity: 1; }
  80%  { opacity: 0.8; }
  100% { transform: translateY(110vh) rotate(720deg) translateX(var(--drift)); opacity: 0; }
}
