/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  padding: 16px;
}
.card--clickable { cursor: pointer; transition: opacity var(--duration); }
.card--clickable:active { opacity: 0.75; }

/* ===== Habit Card ===== */
.habit-card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  cursor: pointer;
  transition: box-shadow var(--duration), transform var(--duration);
  margin-bottom: 8px;
  position: relative;
  overflow: hidden;
}
.habit-card:hover  { box-shadow: 0 3px 10px rgba(0,0,0,0.1); }
.habit-card:active { transform: scale(0.99); opacity: 0.85; }

.habit-card__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.habit-card__icon svg { width: 22px; height: 22px; }

.habit-card__body { flex: 1; min-width: 0; }
.habit-card__name {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.habit-card__name.done { text-decoration: line-through; color: var(--text-secondary); }
.habit-card__sub { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }
.habit-card__category { display: inline-block; margin-left: 7px; padding: 2px 5px; border-radius: 5px; background: var(--bg-input); color: var(--text-muted); font-size: 8px; font-weight: 700; vertical-align: 2px; text-decoration: none; }
.habit-card--success::before { content: ''; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 4px 4px 0; background: var(--color-primary); }
@keyframes habitStatePulse { 0% { transform: scale(.94); } 70% { transform: scale(1.015); } 100% { transform: scale(1); } }
.habit-card--pulse { animation: habitStatePulse 320ms var(--ease); }
.habit-card__streak {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  color: #f97316;
  margin-top: 2px;
}
.habit-card__streak svg { width: 13px; height: 13px; }

.habit-card__check {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
  font-weight: 700;
  transition: background var(--duration), border-color var(--duration), transform var(--duration);
  color: var(--text-muted);
}
.habit-card__check:hover { border-color: var(--color-primary); }
.habit-card__check svg { width: 20px; height: 20px; }
.habit-card__check.checked { border-color: transparent; color: white; }
.habit-card__check.multi { font-size: 16px; font-weight: 700; }

/* ===== Annual Goal Card ===== */
.goal-card-list { display:grid; gap:9px; }
.goal-card {
  --goal-color:#6366f1;
  width:100%; min-width:0; display:grid; grid-template-columns:48px minmax(0,1fr) auto;
  align-items:center; gap:13px; padding:14px 15px; border:1px solid transparent;
  border-radius:var(--r-lg); background:var(--bg-card); box-shadow:var(--shadow-card);
  text-align:left; overflow:hidden; opacity:0; transform:translateY(7px);
  animation:goalCardIn 360ms cubic-bezier(.22,1,.36,1) var(--goal-delay,0ms) forwards;
  transition:transform var(--duration) var(--ease),box-shadow var(--duration) var(--ease),border-color var(--duration) var(--ease);
}
.goal-card:hover { transform:translateY(-2px); box-shadow:0 6px 20px rgba(15,23,42,.08); border-color:rgba(99,102,241,.12); }
.goal-card:active { transform:scale(.99); }
.goal-card:focus-visible { outline:3px solid rgba(99,102,241,.22); outline-offset:2px; }
.goal-card--achieved { border-color:color-mix(in srgb,var(--goal-color) 24%,transparent); }
.goal-card--archived { opacity:.72; }
.goal-card__icon { width:48px;height:48px;display:grid;place-items:center;border-radius:14px;font-size:23px; }
.goal-card__content { min-width:0; display:grid; gap:7px; }
.goal-card__heading { min-width:0;display:flex;align-items:center;gap:8px; }
.goal-card__heading strong { min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:750; }
.goal-card__heading small { flex:none;padding:2px 6px;border-radius:99px;background:var(--bg-input);color:var(--text-muted);font-size:7px;font-weight:850;text-transform:uppercase;letter-spacing:.04em; }
.goal-card--achieved .goal-card__heading small { background:color-mix(in srgb,var(--goal-color) 13%,white);color:var(--goal-color); }
.goal-card__progress { height:6px;overflow:hidden;border-radius:99px;background:#e5e7eb; }
.goal-card__progress>span { display:block;height:100%;border-radius:inherit;background:var(--goal-color);transition:width 480ms cubic-bezier(.22,1,.36,1); }
.goal-card__meta { color:var(--text-muted);font-size:9px; }
.goal-card__percent { min-width:44px;display:grid;justify-items:end;gap:1px; }
.goal-card__percent strong { color:var(--goal-color);font-size:18px;line-height:1;font-variant-numeric:tabular-nums; }
.goal-card__percent small { color:var(--text-muted);font-size:8px; }
@keyframes goalCardIn { to { opacity:1;transform:none; } }

.goal-empty-state { min-height:138px;display:grid;grid-template-columns:46px 1fr;align-items:center;gap:12px;padding:18px;border:1px dashed #d7dce4;border-radius:var(--r-lg);background:rgba(255,255,255,.55); }
.goal-empty-state__icon { width:46px;height:46px;display:grid;place-items:center;border-radius:14px;background:#eef2ff;color:#6366f1; }
.goal-empty-state strong { display:block;font-size:13px; }
.goal-empty-state p { margin-top:3px;color:var(--text-muted);font-size:10px; }
.goal-empty-state button { grid-column:1/-1;min-height:42px;border-radius:12px;background:#111827;color:white;font-size:11px;font-weight:800; }
.goal-home-loading { min-height:100px;display:grid;place-items:center;color:var(--text-muted);font-size:11px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: var(--r-full);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--duration), transform var(--duration), box-shadow var(--duration);
  border: none;
  width: 100%;
}
.btn:hover  { opacity: 0.9; }
.btn:active { opacity: 0.8; transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn--primary { background: var(--color-primary); color: white; }
.btn--primary:hover { box-shadow: 0 4px 14px rgba(34,197,94,0.35); }
.btn--secondary { background: var(--bg-input); color: var(--text-primary); }
.btn--danger  { background: #fee2e2; color: #dc2626; }
.btn--accent  { background: var(--color-accent); color: white; }
.btn--outline { background: transparent; border: 1.5px solid var(--border); color: var(--text-primary); }

.btn--sm { padding: 8px 18px; font-size: 13px; border-radius: var(--r-md); width: auto; }

/* ===== Pill Tabs ===== */
.pill-group { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  padding: 8px 16px;
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 500;
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background var(--duration), color var(--duration);
  white-space: nowrap;
}
.pill.active { background: var(--color-accent); color: white; }
.pill:hover:not(.active) { background: var(--border); }

/* ===== Day Selector ===== */
.day-selector { display: flex; gap: 6px; justify-content: space-between; }
.day-btn {
  width: 38px; height: 38px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--duration), color var(--duration);
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
}
.day-btn.active { background: var(--color-accent); color: white; }
.day-btn:hover:not(.active) { background: var(--border); }

/* ===== Times per week ===== */
.times-selector { display: flex; gap: 6px; flex-wrap: wrap; }
.times-btn {
  width: 36px; height: 36px;
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 600;
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--duration), color var(--duration);
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
}
.times-btn.active { background: var(--color-accent); color: white; }

/* ===== Form fields ===== */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.form-input {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid transparent;
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-size: 15px;
  transition: border-color var(--duration);
}
.form-input:focus { border-color: var(--color-primary); }
.form-input::placeholder { color: var(--text-muted); }
.form-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid transparent;
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-size: 15px;
  resize: none;
  min-height: 80px;
  transition: border-color var(--duration);
}
.form-textarea:focus { border-color: var(--color-primary); }
.form-textarea::placeholder { color: var(--text-muted); }

/* ===== Toggle ===== */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}
.toggle-label { font-size: 15px; font-weight: 500; }
.toggle-sub { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }

.toggle { position: relative; width: 48px; height: 28px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: var(--r-full);
  background: var(--border);
  cursor: pointer;
  transition: background var(--duration);
}
.toggle input:checked + .toggle-track { background: var(--color-primary); }
.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 22px; height: 22px;
  border-radius: var(--r-full);
  background: white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  transition: transform var(--duration);
}
.toggle input:checked + .toggle-track::after { transform: translateX(20px); }

/* ===== Icon picker button ===== */
.icon-btn {
  width: 56px; height: 56px;
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity var(--duration), transform var(--duration);
  border: none;
}
.icon-btn:hover  { opacity: 0.8; }
.icon-btn:active { opacity: 0.65; transform: scale(0.95); }
.icon-btn svg { width: 26px; height: 26px; }

/* ===== Bottom Sheet ===== */
.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: 1000;
  animation: overlayIn var(--duration) var(--ease);
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  z-index: 1001;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  animation: sheetIn 0.28s var(--ease);
}
@keyframes sheetIn {
  from { transform: translateX(-50%) translateY(100%); }
  to   { transform: translateX(-50%) translateY(0); }
}
.bottom-sheet__handle {
  width: 36px; height: 4px;
  border-radius: var(--r-full);
  background: var(--border);
  margin: 12px auto 8px;
  flex-shrink: 0;
}
.bottom-sheet__content {
  overflow-y: auto;
  flex: 1;
  padding: 0 16px 32px;
}
.modal-open { overflow: hidden; }
.icon-picker-sheet { height: min(88dvh, calc(var(--picker-vh, 100dvh) - 12px)); padding-bottom: var(--safe-bottom); overflow: hidden; }
.icon-picker-content {
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
  padding: 0 16px 18px; overscroll-behavior: contain;
}
.picker-heading { display: flex; align-items: flex-start; justify-content: space-between; padding: 2px 0 14px; }
.picker-heading span { color: var(--color-primary-dark); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.picker-heading h2 { margin-top: 2px; font-size: 21px; letter-spacing: -.03em; }
.picker-close { width: 36px; height: 36px; border-radius: 50%; background: var(--bg-input); display: grid; place-items: center; }
.picker-close svg { transform: rotate(45deg); }

/* Desktop: dialog-style sheet */
@media (min-width: 768px) {
  .bottom-sheet {
    max-width: 560px;
    bottom: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: var(--r-xl);
    max-height: 80dvh;
    animation: dialogIn 0.22s var(--ease);
    box-shadow: 0 24px 48px rgba(0,0,0,0.18);
  }
  @keyframes dialogIn {
    from { opacity: 0; transform: translate(-50%, -48%); }
    to   { opacity: 1; transform: translate(-50%, -50%); }
  }
  .bottom-sheet__handle { display: none; }
  .icon-picker-sheet {
    width: min(620px, calc(100vw - 48px)); height: min(720px, calc(100dvh - 48px)); max-height: none;
  }
  .icon-picker-content { padding: 24px 24px 20px; }
  .picker-heading { padding-bottom: 16px; }
}

/* ===== Icon picker tabs ===== */
.picker-controls { flex: 0 0 auto; }
.picker-tabs {
  display: flex;
  border-radius: var(--r-md);
  background: var(--bg-input);
  padding: 3px;
  margin-bottom: 10px;
}
.picker-tab {
  flex: 1; padding: 8px;
  border-radius: var(--r-sm);
  font-size: 14px; font-weight: 600;
  text-align: center; cursor: pointer;
  color: var(--text-secondary);
  transition: background var(--duration), color var(--duration);
  border: 0; background: transparent;
}
.picker-tab.active { background: white; color: var(--text-primary); }

.picker-search-wrap {
  min-height: 44px; display: flex; align-items: center; gap: 9px; padding: 0 12px;
  border: 1.5px solid var(--border); border-radius: var(--r-md); background: var(--bg-card);
  color: var(--text-muted); transition: border-color var(--duration), box-shadow var(--duration);
}
.picker-search-wrap:focus-within { border-color: var(--color-accent); box-shadow: 0 0 0 3px rgba(99,102,241,.12); color: var(--color-accent); }
.picker-search-wrap[hidden] { display: none; }
.picker-search {
  min-width: 0; flex: 1; height: 42px; padding: 0; background: transparent; font-size: 14px; border: 0;
}
.picker-search:focus { outline: none; }
.picker-search::placeholder { color: var(--text-muted); }
.picker-result-meta { min-height: 29px; padding: 8px 2px 6px; color: var(--text-muted); font-size: 10px; font-weight: 700; }
.picker-result-meta[hidden] { display: none; }
.picker-results {
  min-height: 0; flex: 1; overflow-y: auto; overflow-x: hidden; padding-right: 4px;
  overscroll-behavior: contain; scrollbar-gutter: stable;
}
.picker-panel[hidden] { display: none; }
.picker-group:first-child .picker-category { margin-top: 4px; }

.picker-category {
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.06em; color: var(--text-muted);
  text-transform: uppercase; margin: 18px 0 8px;
}
.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 8px;
}
.picker-icon-btn {
  aspect-ratio: 1;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  border: 1px solid transparent;
  background: var(--bg-card);
  transition: background var(--duration), border-color var(--duration), transform var(--duration);
  color: var(--color-primary);
}
.picker-icon-btn svg { width: 24px; height: 24px; }
.picker-icon-btn:hover { background: var(--color-primary-light); transform: translateY(-1px); }
.picker-icon-btn.selected { background: var(--color-primary-light); border-color: currentColor; }
.picker-icon-btn:focus-visible, .emoji-btn:focus-visible { outline: 3px solid rgba(99,102,241,.24); outline-offset: 1px; }
.picker-empty { min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; }
.picker-empty strong { font-size: 15px; }
.picker-empty span { max-width: 280px; margin-top: 5px; color: var(--text-muted); font-size: 11px; }

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 4px; padding-top: 4px;
}
.emoji-btn {
  aspect-ratio: 1;
  border-radius: var(--r-sm);
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  background: none;
  transition: background var(--duration);
}
.emoji-btn:hover, .emoji-btn.selected { background: var(--color-primary-light); }

/* ===== Stats Row ===== */
.stats-row { display: flex; gap: 8px; }
.stat-card {
  flex: 1;
  background: var(--bg-input);
  border-radius: var(--r-md);
  padding: 12px;
  text-align: center;
}
.stat-card__value { font-size: 22px; font-weight: 700; line-height: 1; margin-bottom: 3px; }
.stat-card__label { font-size: 11px; color: var(--text-secondary); font-weight: 500; }

/* ===== Check button (detail) ===== */
.check-btn {
  width: 100%; padding: 14px;
  border-radius: var(--r-full);
  font-size: 16px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer;
  border: none;
  transition: opacity var(--duration), transform var(--duration);
}
.check-btn:hover  { opacity: 0.9; }
.check-btn:active { opacity: 0.8; transform: scale(0.98); }
.check-btn--done  { background: var(--color-primary-light); color: var(--color-primary-dark); }
.check-btn--again { background: var(--color-primary); color: white; }

/* ===== Weekly grid ===== */
.weekly-habit-row {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-card);
}
.weekly-habit-name {
  font-size: 14px; font-weight: 600;
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.weekly-streak {
  margin-left: auto;
  font-size: 12px;
  color: #f97316;
  font-weight: 500;
}
.weekly-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.weekly-day-cell { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.weekly-day-label {
  font-size: 10px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase;
}
.weekly-day-check {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--duration), border-color var(--duration);
  font-size: 12px; font-weight: 700; color: transparent;
}
.weekly-day-check:hover:not(.disabled):not(.checked) { border-color: var(--color-primary); }
.weekly-day-check.checked { color: white; border-color: transparent; }
.weekly-day-check svg { width: 14px; height: 14px; }
.weekly-day-check.today-marker { border-color: var(--color-primary); }
.weekly-day-check.disabled { opacity: 0.3; cursor: not-allowed; }

/* ===== Yearly graph ===== */
.yearly-habit {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 14px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-card);
}
.yearly-habit__header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.yearly-habit__name {
  font-size: 14px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.yearly-habit__stats { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; }
.yearly-graph-wrap { overflow-x: auto; padding-bottom: 2px; }
.yearly-graph {
  display: grid;
  grid-template-rows: repeat(7, 11px);
  grid-auto-columns: 11px;
  grid-auto-flow: column;
  gap: 2px;
}
.yearly-cell {
  width: 11px; height: 11px;
  border-radius: 2px;
  background: var(--bg-input);
  cursor: pointer;
  transition: opacity 0.1s;
}
.yearly-cell:hover { opacity: 0.75; }
.yearly-months {
  display: flex; gap: 2px;
  margin-bottom: 4px;
  font-size: 10px; color: var(--text-muted);
  overflow-x: auto; white-space: nowrap;
}

/* ===== Mini calendar ===== */
.mini-calendar { background: var(--bg-card); border-radius: var(--r-lg); padding: 16px; }
.mini-calendar__header {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 16px;
}
.mini-calendar__title { font-size: 16px; font-weight: 700; }
.mini-calendar__nav {
  width: 32px; height: 32px;
  border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-secondary);
  transition: background var(--duration);
  border: none; background: none;
}
.mini-calendar__nav:hover { background: var(--bg-input); }
.mini-calendar__nav svg { width: 18px; height: 18px; }
.mini-calendar__weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr);
  text-align: center; font-size: 11px; font-weight: 600;
  color: var(--text-muted); margin-bottom: 8px;
}
.mini-calendar__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-day {
  aspect-ratio: 1; border-radius: var(--r-full);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 13px; font-weight: 500; position: relative; cursor: pointer;
}
.cal-day.empty { cursor: default; }
.cal-day.completed { color: white; font-weight: 700; }
.cal-day.today { outline: 2px solid var(--color-primary); outline-offset: -1px; border-radius: var(--r-full); }
.cal-day.other-month { color: var(--text-muted); }
.cal-day__count { font-size: 8px; line-height: 1; margin-top: -1px; font-weight: 600; }

/* ===== Section header ===== */
.section-header {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 12px;
}
.section-title {
  font-size: 17px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.section-count {
  font-size: 13px; font-weight: 600;
  background: var(--bg-input); color: var(--text-secondary);
  padding: 2px 8px; border-radius: var(--r-full);
}
.section-link { font-size: 13px; font-weight: 600; color: var(--color-accent); cursor: pointer; }
.section-link:hover { text-decoration: underline; }

/* ===== Empty state ===== */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px; padding: 40px 24px;
  background: var(--bg-card);
  border-radius: var(--r-lg);
  color: var(--text-muted);
}
.empty-state svg { width: 40px; height: 40px; opacity: 0.4; }
.empty-state p { font-size: 14px; text-align: center; }

/* ===== Divider ===== */
.divider { height: 1px; background: var(--border); margin: 8px 0; }

/* ===== Manage list ===== */
.manage-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 0; cursor: pointer;
  font-size: 15px; font-weight: 500;
  border: none; background: none; width: 100%; text-align: left;
  transition: opacity var(--duration);
}
.manage-row:hover { opacity: 0.7; }
.manage-row svg { width: 20px; height: 20px; }
.manage-row--danger { color: #dc2626; }

/* ===== Accordion ===== */
.accordion-header {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 14px 0; cursor: pointer;
  font-size: 15px; font-weight: 500;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.accordion-header svg { width: 18px; height: 18px; color: var(--text-secondary); transition: transform var(--duration); }
.accordion-header.open svg { transform: rotate(180deg); }
.accordion-body { display: none; padding-bottom: 8px; }
.accordion-body.open { display: block; }

/* ===== Toast ===== */
.toast-container {
  position: fixed; top: 16px;
  left: 50%; transform: translateX(-50%);
  z-index: 9999;
  width: calc(100% - 32px); max-width: 440px;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: #1f2937; color: white;
  padding: 12px 16px; border-radius: var(--r-md);
  font-size: 14px; font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  animation: toastIn 0.25s var(--ease);
  pointer-events: all;
}
.toast--success { background: #166534; }
.toast--error   { background: #991b1b; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

@media (min-width: 768px) {
  /* Center toast over the content area, accounting for sidebar */
  .toast-container { left: calc(36px + 50%); }
}
@media (min-width: 1024px) {
  .toast-container { left: calc(130px + 50%); }
}

/* ===== Weekly row desktop sizing ===== */
@media (min-width: 768px) {
  .weekly-day-check { width: 36px; height: 36px; border-radius: 10px; }
  .weekly-day-label { font-size: 11px; }
}
@media (min-width: 1024px) {
  .weekly-day-check { width: 40px; height: 40px; }
  .weekly-day-label { font-size: 12px; }
}

/* ===== Archived collapse ===== */
.archived-toggle {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-input); border-radius: var(--r-md);
  cursor: pointer; font-size: 14px; font-weight: 500;
  color: var(--text-secondary); margin-top: 16px;
  border: none; width: 100%;
  transition: background var(--duration);
}
.archived-toggle:hover { background: var(--border); }
.archived-toggle svg { width: 16px; height: 16px; transition: transform var(--duration); }
.archived-toggle.open svg { transform: rotate(180deg); }

/* ===== View tabs ===== */
.view-tabs { display: flex; gap: 6px; }
.view-tab {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: var(--r-full);
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
  cursor: pointer; border: 1.5px solid transparent;
  transition: background var(--duration), color var(--duration), border-color var(--duration);
  background: none;
}
.view-tab svg { width: 14px; height: 14px; }
.view-tab:hover { background: var(--bg-input); }
.view-tab.active {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  border-color: #86efac;
}

/* ===== Weekly nav header ===== */
.week-nav { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 10px 0 14px; }
.week-nav__label { font-size: 14px; font-weight: 600; }
.week-nav__btn {
  width: 30px; height: 30px; border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); cursor: pointer; border: none; background: none;
  transition: background var(--duration);
}
.week-nav__btn:hover { background: var(--bg-input); }
.week-nav__btn svg { width: 18px; height: 18px; }

/* ===== Calendar day dot (single-check indicator) ===== */
.cal-day__dot {
  width: 4px; height: 4px;
  border-radius: var(--r-full);
  background: white;
  position: absolute;
  bottom: 3px;
}

/* Calendar clickable days */
.cal-day.clickable { cursor: pointer; }
.cal-day.clickable:hover { opacity: 0.8; }
.cal-day:not(.clickable) { cursor: default; }

/* ===== Day Detail Sheet (bottom sheet for check logs) ===== */
.day-detail__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 0 16px; gap: 12px;
}
.day-detail__nav {
  width: 32px; height: 32px; border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-secondary); border: none; background: none;
  transition: background var(--duration);
  flex-shrink: 0;
}
.day-detail__nav:hover { background: var(--bg-input); }
.day-detail__nav:disabled { opacity: 0.25; cursor: not-allowed; }
.day-detail__nav svg { width: 18px; height: 18px; }
.day-detail__date {
  font-size: 16px; font-weight: 700; text-align: center; flex: 1;
}

.day-detail__habit-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.day-detail__habit-icon {
  width: 40px; height: 40px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.day-detail__habit-icon svg { width: 20px; height: 20px; }
.day-detail__habit-name { font-size: 15px; font-weight: 600; flex: 1; }

.day-detail__status {
  display: flex; align-items: center; gap: 6px;
  padding: 12px 0; font-size: 14px; font-weight: 600;
}
.day-detail__status svg { width: 18px; height: 18px; }

.day-detail__check-list {
  display: flex; flex-direction: column; gap: 0;
}
.day-detail__check-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.day-detail__check-item:last-child { border-bottom: none; }
.day-detail__check-info {
  display: flex; align-items: center; gap: 8px;
}
.day-detail__check-num {
  width: 24px; height: 24px; border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.day-detail__check-time { font-size: 13px; color: var(--text-secondary); }
.day-detail__delete-btn {
  width: 32px; height: 32px; border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); cursor: pointer; border: none; background: none;
  transition: background var(--duration), color var(--duration);
}
.day-detail__delete-btn:hover { background: #fee2e2; color: #dc2626; }
.day-detail__delete-btn svg { width: 16px; height: 16px; }

.day-detail__actions {
  display: flex; flex-direction: column; gap: 8px;
  padding: 16px 0 0;
}
.day-detail__mark-btn {
  width: 100%; padding: 12px;
  border-radius: var(--r-full);
  font-size: 15px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; border: none; color: white;
  transition: opacity var(--duration);
}
.day-detail__mark-btn:hover { opacity: 0.9; }

/* ===== Color palette grid ===== */
.color-grid { display: flex; flex-wrap: wrap; gap: 10px; }
