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

:root {
  --bg: #f7f7f7;
  --card: #ffffff;
  --text: #1a1a2e;
  --text-light: #6b7280;
  --accent: #1a1a2e;
  --green: #22c55e;
  --green-bg: rgba(34, 197, 94, 0.15);
  --blue: #3b82f6;
  --blue-bg: rgba(59, 130, 246, 0.15);
  --border: #e5e7eb;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --radius: 16px;
  --pill-bg: #f3f4f6;
  --pill-active: #1a1a2e;
  --score-low: #ef4444;
  --score-mid: #f59e0b;
  --score-high: #22c55e;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: Georgia, 'Times New Roman', serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 80px;
  -webkit-font-smoothing: antialiased;
}

/* === HEADER === */
header {
  background: var(--accent);
  color: #fff;
  padding: 20px 16px 16px;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-content {
  position: relative;
}
.header-content h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.header-sub {
  font-size: 0.8rem;
  opacity: 0.7;
  margin-top: 2px;
  font-style: italic;
}

/* Settings button — left side */
.settings-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}
.settings-btn-left { left: 0; right: auto; }
.settings-btn:active {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

/* Header avatar — right side */
.header-avatar {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.2);
}
.header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.avatar-fallback {
  display: none;
  width: 100%;
  height: 100%;
  background: rgba(60,60,60,1);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  font-family: -apple-system, sans-serif;
  align-items: center;
  justify-content: center;
}

/* === SETTINGS SLIDE-IN PANEL === */
.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 400;
  transition: opacity 0.3s;
}
.settings-overlay.hidden { display: none; }
.settings-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 320px;
  max-width: 85vw;
  background: #fff;
  z-index: 401;
  box-shadow: -4px 0 20px rgba(0,0,0,0.12);
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform 0.3s ease;
  overflow-y: auto;
}
.settings-panel.hidden {
  transform: translateX(100%);
  pointer-events: none;
}
.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 14px;
  border-bottom: 1px solid #eee;
}
.settings-title {
  font-family: Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}
.settings-close-btn {
  background: none;
  border: none;
  font-size: 1.6rem;
  color: #999;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.settings-body {
  padding: 20px;
  flex: 1;
}
.settings-section {
  margin-bottom: 20px;
}
.settings-label {
  display: block;
  font-family: Georgia, serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.settings-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: Georgia, serif;
  font-size: 0.88rem;
  color: var(--text);
  background: #fafafa;
}
.settings-input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
}
.settings-hint {
  font-size: 0.7rem;
  color: #999;
  margin-top: 4px;
  font-family: -apple-system, sans-serif;
}
/* API Key locked display */
.settings-apikey-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #f9fafb;
  border: 1px solid #eee;
  border-radius: 8px;
}
.settings-apikey-lock { display: flex; flex-shrink: 0; }
.settings-apikey-masked {
  flex: 1;
  font-family: -apple-system, monospace;
  font-size: 0.78rem;
  color: #666;
  letter-spacing: 0.5px;
}
.settings-apikey-edit {
  background: none;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 4px 12px;
  font-family: Georgia, serif;
  font-size: 0.72rem;
  color: var(--text-light);
  cursor: pointer;
  flex-shrink: 0;
}
.settings-apikey-edit:active { background: #f3f4f6; }
.settings-apikey-editor.hidden { display: none; }
.settings-apikey-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.settings-apikey-cancel, .settings-apikey-save {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  font-family: Georgia, serif;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
}
.settings-apikey-cancel { background: #f3f4f6; color: var(--text); }
.settings-apikey-save { background: var(--accent); color: #fff; }
.settings-photo-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.settings-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--border);
  flex-shrink: 0;
}
.settings-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.settings-change-photo-btn {
  padding: 8px 16px;
  background: var(--pill-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: Georgia, serif;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s;
}
.settings-change-photo-btn:active { background: #e5e7eb; }
.settings-notion-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.settings-notion-status {
  font-size: 0.82rem;
  color: #999;
  font-family: Georgia, serif;
}
.settings-save-btn {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: Georgia, serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
  transition: transform 0.15s;
}
.settings-save-btn:active { transform: scale(0.98); }
.settings-signout-btn {
  width: 100%;
  padding: 12px;
  background: none;
  border: 1px solid #eee;
  border-radius: 10px;
  font-family: Georgia, serif;
  font-size: 0.85rem;
  color: #dc2626;
  cursor: pointer;
  margin-top: 10px;
  transition: background 0.15s;
}
.settings-signout-btn:active { background: #fef2f2; }

/* Profile dropdown */
.prof-dropdown {
  position: fixed;
  top: 56px;
  right: 12px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  z-index: 300;
  width: 220px;
  overflow: hidden;
  animation: prof-dd-in 0.15s ease;
}
.prof-dropdown.hidden { display: none; }
@keyframes prof-dd-in { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }
.prof-dd-info {
  padding: 14px 16px 10px;
  border-bottom: 1px solid #f0f0f0;
}
.prof-dd-name {
  font-family: Georgia, serif;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}
.prof-dd-email {
  font-family: -apple-system, sans-serif;
  font-size: 0.72rem;
  color: #999;
  margin-top: 2px;
}
.prof-dd-signout {
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  text-align: left;
  font-family: Georgia, serif;
  font-size: 0.82rem;
  color: #dc2626;
  cursor: pointer;
  transition: background 0.12s;
}
.prof-dd-signout:active { background: #fef2f2; }

/* === BIBLE VERSE === */
.verse-label-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  margin-bottom: 8px;
}
.verse-info-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
}
.verse-info-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(55,138,221,0.12);
  color: #378add;
  font-size: 10px;
  font-weight: 700;
  font-family: Georgia, serif;
  font-style: italic;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.verse-tooltip {
  font-family: Georgia, serif;
  font-size: 0.72rem;
  font-style: italic;
  color: #6b7280;
  line-height: 1.5;
  padding: 8px 10px;
  background: #f9fafb;
  border: 1px solid #f0f0f0;
  border-radius: 8px;
  margin-bottom: 8px;
  transition: opacity 0.2s ease, max-height 0.2s ease;
  opacity: 1;
  max-height: 80px;
  overflow: hidden;
}
.verse-tooltip.hidden {
  opacity: 0;
  max-height: 0;
  padding: 0 10px;
  margin-bottom: 0;
  border-color: transparent;
}
.verse-share-btn {
  display: inline-block;
  margin-top: 6px;
  padding: 6px 14px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-family: Georgia, serif;
  font-size: 0.72rem;
  color: #6b7280;
  cursor: pointer;
  transition: background 0.15s;
}
.verse-share-btn:active { background: #e5e7eb; }

/* Section gear slide-in panel */
.sg-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.25);
  z-index: 500;
  animation: sg-fade-in 0.15s ease;
}
@keyframes sg-fade-in { from { opacity: 0; } to { opacity: 1; } }
.sg-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 260px;
  background: #fff;
  border-radius: 16px 0 0 16px;
  box-shadow: -4px 0 20px rgba(0,0,0,0.1);
  z-index: 501;
  display: flex;
  flex-direction: column;
  animation: sg-slide-in 0.2s ease;
}
@keyframes sg-slide-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
.sg-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px 12px;
  border-bottom: 1px solid #f0f0f0;
}
.sg-panel-title {
  font-family: Georgia, serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}
.sg-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  color: #999;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.sg-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid #f6f6f6;
  cursor: pointer;
  font-family: Georgia, serif;
  font-size: 0.85rem;
  color: var(--text);
  transition: background 0.12s;
}
.sg-option:last-child { border-bottom: none; }
.sg-option:active { background: #f9fafb; }
.sg-option-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sg-option-icon.edit { background: rgba(59,130,246,0.1); color: #3b82f6; }
.sg-option-icon.customize { background: rgba(99,153,34,0.1); color: #639922; }
.sg-option-icon.remove { background: rgba(220,38,38,0.08); color: #dc2626; }
.sg-option-text { flex: 1; }
.sg-option-sub {
  font-size: 0.68rem;
  color: #999;
  margin-top: 1px;
  font-family: -apple-system, sans-serif;
}

/* Section fade out */
@keyframes sg-section-fade {
  to { opacity: 0; height: 0; margin: 0; padding: 0; overflow: hidden; }
}
.section-removing {
  animation: sg-section-fade 0.3s ease forwards;
}

/* API Key Modal */
.apikey-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 600;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.apikey-modal {
  background: #fff;
  border-radius: 20px;
  padding: 28px 24px 24px;
  max-width: 340px;
  width: 100%;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18);
  animation: slideUp 0.25s ease;
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.apikey-modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
  color: var(--text);
}
.apikey-modal-desc {
  font-size: 0.78rem;
  color: var(--text-light);
  text-align: center;
  line-height: 1.5;
  margin-bottom: 18px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.apikey-modal-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', monospace;
  font-size: 0.85rem;
  background: #fafafa;
  color: var(--text);
  transition: border-color 0.15s;
  margin-bottom: 14px;
}
.apikey-modal-input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
}
.apikey-modal-input.error {
  border-color: #ef4444;
}
.apikey-modal-error {
  font-size: 0.72rem;
  color: #ef4444;
  margin-top: -10px;
  margin-bottom: 10px;
  display: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.apikey-modal-error.visible {
  display: block;
}
.apikey-modal-btns {
  display: flex;
  gap: 10px;
}
.apikey-modal-btns button {
  flex: 1;
  padding: 13px;
  border-radius: 10px;
  border: none;
  font-family: Georgia, serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s;
}
.apikey-modal-btns button:active { transform: scale(0.97); }
.apikey-btn-cancel {
  background: var(--pill-bg);
  color: var(--text);
}
.apikey-btn-save {
  background: var(--accent);
  color: #fff;
}
.apikey-current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: var(--green-bg);
  border-radius: 8px;
  font-size: 0.78rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', monospace;
  color: var(--text);
}
.apikey-current-label {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 600;
  font-size: 0.72rem;
  color: #16a34a;
  margin-bottom: 4px;
}
.apikey-remove-btn {
  background: none;
  border: none;
  color: #ef4444;
  font-size: 0.72rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}
.apikey-remove-btn:active { background: #fef2f2; }

/* === DARK BAND (day strip + status) === */
.ds-dark-band {
  background: var(--accent);
  padding-bottom: 10px;
}

/* === DAY STRIP === */
.day-strip-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px 8px 6px;
  scrollbar-width: none;
}
.day-strip-wrap::-webkit-scrollbar { display: none; }
.day-strip {
  display: flex;
  gap: 5px;
  width: max-content;
}
.day-strip-item {
  width: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 7px 4px 6px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  flex-shrink: 0;
  /* default: future style */
  background: rgba(99,153,34,0.06);
  border: 1.5px solid rgba(99,153,34,0.15);
  opacity: 0.5;
}
.day-strip-item:active { transform: scale(0.94); }

/* Day number + date stacked */
.day-strip-num {
  font-family: Georgia, serif;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.1;
  color: rgba(160,210,100,0.9);
}
.day-strip-date {
  font-family: -apple-system, sans-serif;
  font-size: 0.55rem;
  line-height: 1;
  margin-top: 1px;
  color: rgba(120,180,80,0.5);
}

/* Status dot (top right corner) */
.ds-status-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ds-status-dot svg { width: 8px; height: 8px; }
.ds-dot-check { background: #639922; }
.ds-dot-x { background: rgba(220,38,38,0.85); }

/* --- Warm-up days --- */
.day-strip-item.warmup {
  background: rgba(55,138,221,0.12);
  border: 1.5px solid rgba(55,138,221,0.3);
  opacity: 1;
}
.day-strip-item.warmup .day-strip-num {
  font-size: 10px;
  font-weight: 500;
  color: rgba(100,170,240,0.9);
  font-family: -apple-system, sans-serif;
}
.day-strip-item.warmup .day-strip-date { display: none; }

/* --- Past incomplete --- */
.day-strip-item.past-incomplete {
  background: rgba(30,60,114,0.15);
  border: 1.5px solid rgba(30,60,114,0.35);
  opacity: 1;
}
.day-strip-item.past-incomplete .day-strip-num { color: rgba(160,190,255,1); }
.day-strip-item.past-incomplete .day-strip-date { color: rgba(120,150,220,0.7); }

/* --- Past complete --- */
.day-strip-item.past-complete {
  background: rgba(99,153,34,0.25);
  border: 1.5px solid rgba(99,153,34,0.6);
  opacity: 1;
}
.day-strip-item.past-complete .day-strip-num { color: rgba(180,235,120,1); }
.day-strip-item.past-complete .day-strip-date { color: rgba(140,210,90,0.8); }

/* --- Current day (today) --- */
.day-strip-item.today {
  background: rgba(255,255,255,0.1);
  border: 2px solid #fff;
  opacity: 1;
}
.day-strip-item.today .day-strip-num { color: #fff; }
.day-strip-item.today .day-strip-date {
  color: rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.15);
  padding: 1px 5px;
  border-radius: 99px;
}

/* --- Selected day (tapped, overrides all) --- */
.day-strip-item.selected {
  border: 2px solid #fff !important;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.3);
  opacity: 1 !important;
}

/* --- Future days (already default) --- */
.day-strip-item.future { /* uses default styles above */ }

/* === DAY DETAIL CARD === */
.ds-detail-card {
  margin: 8px 12px 4px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.2s ease;
}
.ds-detail-card.hidden { display: none; }
.ds-detail-header {
  padding: 12px 16px 8px;
}
.ds-detail-title {
  font-family: Georgia, serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}
.ds-detail-status {
  font-family: -apple-system, sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  margin-top: 2px;
}
.ds-detail-status.green { color: #639922; }
.ds-detail-status.red { color: #dc2626; }
.ds-detail-status.blue { color: #378add; }
.ds-detail-status.gray { color: #999; }
.ds-detail-sections { padding: 0 16px 12px; }
.ds-detail-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid #f3f4f6;
}
.ds-detail-row:last-child { border-bottom: none; }
.ds-detail-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ds-detail-dot.done { background: #639922; }
.ds-detail-dot.missed { background: rgba(220,38,38,0.85); }
.ds-detail-dot.pending { border: 2px solid #ddd; background: transparent; }
.ds-detail-dot svg { width: 10px; height: 10px; }
.ds-detail-name {
  font-family: Georgia, serif;
  font-size: 0.82rem;
  color: var(--text);
}
.ds-detail-name.done { color: #999; text-decoration: line-through; }
.ds-detail-name.missed { color: #999; }

/* === STATUS BAR === */
.ds-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 16px 2px;
}
.ds-day-label {
  font-family: Georgia, serif;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}
.ds-badge {
  font-family: -apple-system, sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
  letter-spacing: 0.3px;
}
.ds-badge-ontrack {
  background: rgba(99,153,34,0.2);
  color: #a3d977;
  border: 1px solid rgba(99,153,34,0.4);
}
.ds-badge-behind {
  background: rgba(245,158,11,0.15);
  color: #fbbf24;
  border: 1px solid rgba(245,158,11,0.35);
}
.ds-badge-starting {
  background: rgba(59,130,246,0.15);
  color: #93bbfd;
  border: 1px solid rgba(59,130,246,0.3);
}

/* === TODAY'S PROGRESS CHECKLIST === */
.ds-checklist-card {
  margin: 12px 12px 12px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.ds-checklist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ds-checklist-header:active { opacity: 0.7; }
.ds-checklist-right {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ds-checklist-chevron {
  color: var(--text-light);
  transition: transform 0.2s ease;
}
.ds-checklist-chevron.open {
  transform: rotate(180deg);
}
.ds-checklist-title {
  font-family: -apple-system, sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-light);
  margin: 0;
}
.ds-checklist-count {
  font-family: -apple-system, sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  color: #639922;
}
.ds-checklist {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  transition: max-height 0.2s ease, opacity 0.2s ease, margin-top 0.2s ease;
  max-height: 500px;
  opacity: 1;
  margin-top: 10px;
}
.ds-checklist.ds-checklist-collapsed {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
}
.ds-cl-row {
  display: flex;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  transition: background 0.15s;
  margin: 0 -18px;
  padding-left: 18px;
  padding-right: 18px;
  border-radius: 0;
}
.ds-cl-row:last-child { border-bottom: none; }
.ds-cl-row:active { background: #f9fafb; }

/* Flash highlight when scrolled to */
@keyframes ds-flash {
  0% { box-shadow: 0 0 0 0 rgba(99,153,34,0.3); }
  50% { box-shadow: 0 0 0 4px rgba(99,153,34,0.15); }
  100% { box-shadow: 0 0 0 0 rgba(99,153,34,0); }
}
.ds-cl-flash {
  animation: ds-flash 0.8s ease;
}

.ds-cl-circle {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #ddd;
  margin-right: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.ds-cl-circle.done {
  background: #34c759;
  border-color: #34c759;
}
.ds-cl-circle svg { width: 12px; height: 12px; }
.ds-cl-name {
  flex: 1;
  font-family: Georgia, serif;
  font-size: 0.88rem;
  color: var(--text);
  transition: color 0.15s;
}
.ds-cl-name.done { color: #bbb; text-decoration: line-through; }
.ds-cl-action {
  font-family: Georgia, serif;
  font-size: 0.72rem;
  font-style: italic;
  color: #bbb;
  flex-shrink: 0;
  margin-left: 8px;
}

/* === SECTION CARDS === */
.section-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  margin-top: 12px;
  margin-bottom: 6px;
}
.section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-light);
  text-transform: uppercase;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  display: flex;
  align-items: center;
  gap: 4px;
}
.sl-lock {
  color: #ccc;
  flex-shrink: 0;
}
.section-gear-ext {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(150,150,150,0.6);
  display: flex;
  align-items: center;
  padding: 2px;
  border-radius: 50%;
  transition: color 0.15s;
}
.section-gear-ext:active { color: #999; }

.card {
  margin: 0 12px 12px;
}
.card-inner {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

/* === FIELD LABELS === */
.field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  margin-top: 16px;
}
.field-label:first-child { margin-top: 0; }
.field-label-sm {
  display: block;
  font-size: 0.75rem;
  color: var(--text-light);
  margin-bottom: 4px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* === PILLS === */
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pill {
  background: var(--pill-bg);
  border: 1.5px solid transparent;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 0.82rem;
  font-family: Georgia, serif;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text);
}
.pill.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.pill:active { transform: scale(0.96); }

/* === CHECKBOXES === */
.checklist, .habit-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.check-item, .habit-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  cursor: pointer;
}
.check-item input, .habit-item input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.habit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* === TEXTAREA & INPUT === */
textarea, input[type="text"], input[type="number"], select {
  width: 100%;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: Georgia, serif;
  font-size: 0.9rem;
  background: #fafafa;
  color: var(--text);
  resize: vertical;
  transition: border-color 0.15s;
}
textarea:focus, input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
}
input[type="number"] { width: 100%; }
select { appearance: auto; }

/* === I AM BADGES === */
.iam-fields { display: flex; flex-direction: column; gap: 12px; }
.iam-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.iam-badge {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.iam-badge.green {
  background: var(--green-bg);
  color: #16a34a;
}
.iam-badge.blue {
  background: var(--blue-bg);
  color: #2563eb;
}
.iam-row input { flex: 1; }

/* === TASK CARDS (new) === */
.tc-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  padding: 16px;
  margin: 0 12px 12px;
}
/* Header row with label + legend */
.tc-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.tc-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.tc-label-mit { color: #2e5a09; }
.tc-label-sec { color: #666; font-weight: 400; }

/* Source legend */
.tc-source-legend { display: flex; gap: 8px; align-items: center; }
.tc-legend-item { display: flex; align-items: center; gap: 5px; }
.tc-src-icon { width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; }
.tc-legend-text { font-size: 10px; color: #999; font-family: -apple-system, sans-serif; }

/* Dropdown button */
.tc-dropdown-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  margin-bottom: 10px;
  transition: background 0.15s;
}
.tc-dropdown-mit {
  background: rgba(99,153,34,0.08);
  border: 1px solid rgba(99,153,34,0.25);
}
.tc-dropdown-mit:active { background: rgba(99,153,34,0.14); }
.tc-dropdown-mit .tc-dropdown-text { color: #2e5a09; }
.tc-dropdown-mit .tc-chevron { color: #2e5a09; }
.tc-dropdown-sec {
  background: var(--pill-bg);
  border: 1px solid #ddd;
}
.tc-dropdown-sec:active { background: #eee; }
.tc-dropdown-sec .tc-dropdown-text { color: #666; }
.tc-dropdown-sec .tc-chevron { color: #999; }
.tc-dropdown-text {
  font-family: Georgia, serif;
  font-size: 13px;
  text-align: left;
  flex: 1;
}
.tc-chevron {
  transition: transform 0.25s ease;
  flex-shrink: 0;
}
.tc-chevron.open { transform: rotate(180deg); }

/* Dropdown list container */
.tc-dropdown-list {
  background: var(--pill-bg);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
  padding: 4px;
}
.tc-dropdown-list.hidden { display: none; }

/* Task item card inside dropdown */
.tc-dropdown-item {
  display: flex;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 8px;
  margin: 6px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  overflow: hidden;
}
.tc-dropdown-item:hover {
  background: rgba(99,153,34,0.06);
  border-color: rgba(99,153,34,0.3);
}
.tc-dropdown-item:active { background: rgba(99,153,34,0.1); }

/* Source icon column */
.tc-item-src {
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-right: 1px solid #f0f0f0;
}
.tc-src-box {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tc-src-notion { background: rgba(0,0,0,0.07); }
.tc-src-reminders { background: rgba(255,59,48,0.1); }
.tc-src-calendar { background: rgba(52,120,246,0.1); }

/* Right content area */
.tc-item-content { flex: 1; padding: 9px 10px; min-width: 0; }
.tc-item-row1 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.tc-item-name {
  font-family: Georgia, serif;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tc-item-time {
  font-family: Georgia, serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}
.tc-item-row2 { margin-top: 2px; }
.tc-item-sub {
  font-family: Georgia, serif;
  font-size: 10px;
  font-style: italic;
  color: #999;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tc-item-row3 {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 5px;
}
.tc-preview-dots { display: flex; gap: 3px; align-items: center; }
.tc-preview-dot { width: 13px; height: 13px; border-radius: 50%; }
.tc-row3-spacer { flex: 1; }
.tc-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 9px;
  font-weight: 700;
  font-family: -apple-system, sans-serif;
  line-height: 1.4;
}
.tc-badge-high { background: rgba(220,38,38,0.1); color: #991b1b; }
.tc-badge-medium { background: rgba(234,88,12,0.1); color: #7c2d12; }
.tc-badge-low { background: rgba(22,163,74,0.1); color: #14532d; }
.tc-badge-rec {
  background: rgba(99,153,34,0.15);
  color: #2e5a09;
  border: 1px solid rgba(99,153,34,0.3);
}

/* Task input */
.tc-task-input {
  width: 100%;
  border: none;
  border-bottom: 1px solid #ddd;
  border-radius: 0;
  padding: 10px 0;
  font-family: Georgia, serif;
  font-size: 14px;
  color: var(--text);
  background: transparent;
  outline: none;
}
.tc-task-input::placeholder { color: #bbb; }
.tc-task-input:focus { border-bottom-color: #639922; }

/* Divider */
.tc-divider {
  border: none;
  border-top: 1px solid #f0f0f0;
  margin: 12px 0;
}

/* Action row */
.tc-action-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tc-start-btn {
  flex: 1;
  padding: 12px;
  background: #639922;
  color: #fff;
  border: none;
  border-radius: 99px;
  font-family: Georgia, serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  text-align: center;
}
.tc-start-btn:active { transform: scale(0.97); }
.tc-start-btn.running { background: #dc2626; }
.tc-start-btn.paused { background: #639922; }

.tc-bubbles {
  display: flex;
  gap: 9px;
  align-items: center;
}
.tc-bubble {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid #ccc;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s;
  padding: 0;
}
.tc-bubble:active { transform: scale(0.88); }
.tc-bubble.filled { border-color: transparent; }

.tc-done-btn {
  padding: 12px 18px;
  background: var(--pill-bg);
  border: 1px solid #ddd;
  border-radius: 99px;
  font-family: Georgia, serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text);
  transition: transform 0.1s;
  white-space: nowrap;
}
.tc-done-btn:active { transform: scale(0.97); }

/* Stopwatch block */
.tc-stopwatch {
  background: var(--pill-bg);
  border-radius: 8px;
  padding: 10px 16px;
  margin-top: 12px;
  text-align: center;
}
.tc-time-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
}
.tc-time-main {
  font-size: 22px;
  font-weight: 500;
  font-family: Georgia, serif;
  letter-spacing: 2px;
  color: var(--text);
}
.tc-time-ms {
  font-size: 13px;
  color: #999;
  font-family: Georgia, serif;
}
.tc-overtime {
  font-size: 12px;
  font-weight: 700;
  color: #dc2626;
  margin-top: 2px;
}
.tc-overtime.hidden { display: none; }
.tc-progress-track {
  width: 100%;
  height: 6px;
  background: #e5e7eb;
  border-radius: 99px;
  margin-top: 8px;
  overflow: hidden;
}
.tc-progress-fill {
  height: 100%;
  width: 0%;
  background: #639922;
  border-radius: 99px;
  transition: width 0.3s linear;
}
.tc-progress-fill.complete { width: 100% !important; }

/* Completed line */
.tc-completed {
  text-align: center;
  font-size: 13px;
  font-style: italic;
  color: #999;
  margin-top: 10px;
  font-family: Georgia, serif;
}
.tc-completed.hidden { display: none; }
.tc-completed .tc-over { color: #dc2626; font-weight: 700; font-style: normal; }

/* === TARGET / ACTUAL === */
.target-actual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 10px;
}

/* === PSA SELECT === */
.psa-select {
  display: flex;
  gap: 12px;
  align-items: center;
}
.psa-select select { flex: 1; }
.psa-check { margin-top: 0 !important; }
.orders-check { margin-top: 14px; }

/* === ALIGNMENT SCORE === */
.score-circles {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.score-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text-light);
  font-family: -apple-system, sans-serif;
}
.score-circle.active {
  color: #fff;
  border-color: transparent;
}
.score-circle.active[data-value="1"],
.score-circle.active[data-value="2"],
.score-circle.active[data-value="3"] { background: var(--score-low); }
.score-circle.active[data-value="4"],
.score-circle.active[data-value="5"],
.score-circle.active[data-value="6"] { background: var(--score-mid); }
.score-circle.active[data-value="7"],
.score-circle.active[data-value="8"],
.score-circle.active[data-value="9"],
.score-circle.active[data-value="10"] { background: var(--score-high); }

/* === AUDIO RECORDER (compact) === */
.audio-compact {
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  background: #fafafa;
}
.rec-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.rec-btn-sm {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: #ef4444;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
  box-shadow: 0 1px 6px rgba(239,68,68,0.3);
}
.rec-btn-sm:active { transform: scale(0.93); }
.rec-btn-sm.recording {
  box-shadow: 0 1px 10px rgba(239,68,68,0.5);
  animation: pulse-rec 1.5s ease-in-out infinite;
}
@keyframes pulse-rec {
  0%, 100% { box-shadow: 0 1px 6px rgba(239,68,68,0.35); }
  50% { box-shadow: 0 1px 16px rgba(239,68,68,0.65); }
}
.mic-icon { pointer-events: none; }
.rec-compact-label {
  flex: 1;
  font-family: Georgia, serif;
  font-size: 0.72rem;
  font-style: italic;
  color: var(--text-light);
  line-height: 1.3;
  min-width: 0;
}
.rec-timer-sm {
  font-size: 0.85rem;
  font-weight: 700;
  font-family: -apple-system, sans-serif;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  flex-shrink: 0;
}

/* Waveform Canvas */
.waveform-canvas {
  width: 100%;
  height: 60px;
  margin-top: 8px;
  border-radius: 8px;
  display: block;
  transition: opacity 0.5s ease;
}
.waveform-canvas.hidden { display: none; }
.waveform-canvas.fade-out { opacity: 0; }

/* Stacked recordings container */
.rec-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}
.rec-stack:empty { margin-bottom: 0; }

/* Individual recording bar */
.rec-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #f3f4f6;
  border-radius: 8px;
}
.rec-bar-play {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s;
}
.rec-bar-play:active { transform: scale(0.92); }
.rec-bar-play.playing { background: var(--green); }
.rec-bar-time {
  font-family: Georgia, serif;
  font-size: 0.65rem;
  font-style: italic;
  color: #999;
  flex-shrink: 0;
  white-space: nowrap;
}
.rec-bar-wave {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5px;
  height: 28px;
  min-width: 0;
}
.rec-wave-bar {
  width: 2.5px;
  border-radius: 1.5px;
  background: rgba(99,153,34,0.45);
  flex-shrink: 0;
}
.rec-bar-dur {
  font-family: -apple-system, sans-serif;
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-light);
  flex-shrink: 0;
  min-width: 28px;
  text-align: right;
}
.rec-bar-del {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: #fef2f2;
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.rec-bar-del:active { transform: scale(0.9); }

/* Completion label (outside card) */
.rec-complete-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 20px 8px;
  font-family: Georgia, serif;
  font-size: 11px;
  color: #639922;
}
.rec-complete-label.hidden { display: none; }
.rec-complete-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #639922;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Re-record dialog */
.rerecord-dialog {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
}
.rerecord-box {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  max-width: 320px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}
.rerecord-box p {
  font-size: 0.92rem;
  margin-bottom: 18px;
  line-height: 1.5;
}
.rerecord-btns {
  display: flex;
  gap: 10px;
}
.rerecord-btns button {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  border: none;
  font-family: Georgia, serif;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s;
}
.rerecord-btns button:active { transform: scale(0.97); }
.rerecord-keep {
  background: var(--pill-bg);
  color: var(--text);
}
.rerecord-new {
  background: var(--accent);
  color: #fff;
}

/* Dashboard play buttons */
.day-audio-btns {
  display: inline-flex;
  gap: 6px;
  margin-left: 8px;
  vertical-align: middle;
}
.day-play-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.6rem;
  transition: all 0.15s;
  font-family: -apple-system, sans-serif;
  position: relative;
}
.day-play-btn:active { transform: scale(0.9); }
.day-play-btn.playing {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.day-play-btn svg { pointer-events: none; }
.day-play-label {
  font-size: 0.6rem;
  color: var(--text-light);
  font-family: -apple-system, sans-serif;
}

/* === ADD TASK === */
.at-add-row {
  display: flex;
  justify-content: center;
  padding: 4px 12px 8px;
}
.at-add-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: #fff;
  border: 1.5px dashed #ccc;
  border-radius: 99px;
  font-family: Georgia, serif;
  font-size: 12px;
  color: #888;
  cursor: pointer;
  transition: all 0.15s;
}
.at-add-btn:active { background: #f9fafb; border-color: #aaa; }
.at-extra-tasks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 12px;
}
.at-extra-card {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.at-extra-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #ccc; flex-shrink: 0;
}
.at-extra-input {
  flex: 1;
  border: none;
  font-family: Georgia, serif;
  font-size: 13px;
  color: var(--text);
  background: transparent;
  outline: none;
}
.at-extra-input::placeholder { color: #ccc; }
.at-extra-del {
  background: none; border: none; color: #ccc; cursor: pointer; padding: 2px;
  font-size: 16px; line-height: 1;
}
.at-extra-del:active { color: #ef4444; }

/* Top slide notification */
.at-notify {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #1a1a2e;
  color: #fff;
  text-align: center;
  padding: 14px 20px 12px;
  z-index: 700;
  transform: translateY(-100%);
  transition: transform 0.3s ease;
  font-family: Georgia, serif;
}
.at-notify.show { transform: translateY(0); }
.at-notify-main { font-size: 12px; font-weight: 500; line-height: 1.4; }
.at-notify-sub { font-size: 10px; color: rgba(255,255,255,0.5); margin-top: 4px; }

/* === ACTION BUTTONS === */
.action-buttons {
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
.btn {
  width: 100%;
  border: none;
  font-family: Georgia, serif;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.btn:active { transform: scale(0.98); }
.btn-save-progress {
  padding: 13px;
  background: #111;
  color: #fff;
  font-size: 13px;
  border-radius: 8px;
}
.btn-complete-day {
  padding: 13px;
  background: #639922;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
}

/* Top toast (for Save Progress) */
.top-toast {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #639922;
  color: #fff;
  text-align: center;
  padding: 10px 16px;
  font-family: Georgia, serif;
  font-size: 0.82rem;
  font-weight: 500;
  z-index: 600;
  transform: translateY(-100%);
  transition: transform 0.25s ease;
}
.top-toast.show { transform: translateY(0); }

/* Complete Day confirmation */
.cd-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 12px 20px;
}
.cd-confirm-overlay.hidden { display: none; }
.cd-confirm-card {
  background: #fff;
  border-radius: 16px;
  padding: 28px 24px 20px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
  animation: cd-slide-up 0.3s ease;
}
@keyframes cd-slide-up {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.cd-confirm-text {
  font-family: Georgia, serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 14px;
  line-height: 1.4;
}
.cd-confirm-sub {
  font-family: Georgia, serif;
  font-size: 0.78rem;
  color: #6b7280;
  margin-top: 6px;
  line-height: 1.4;
}
.cd-confirm-dismiss {
  margin-top: 18px;
  padding: 12px 32px;
  background: #111;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: Georgia, serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 0.15s;
}
.cd-confirm-dismiss:active { transform: scale(0.97); }

/* === FOOTER === */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--accent);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.footer-nav {
  display: flex;
  justify-content: space-around;
  padding: 10px 0 8px;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  color: rgba(255,255,255,0.5);
  font-size: 0.7rem;
  font-family: -apple-system, sans-serif;
  transition: color 0.15s;
}
.nav-item.active { color: #fff; }
.nav-icon { font-size: 1.2rem; }

/* === TOAST === */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--accent);
  color: #fff;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s;
  z-index: 200;
  font-family: -apple-system, sans-serif;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* === DASHBOARD STYLES === */
.dash-card {
  margin: 0 12px 16px;
}
.dash-card-inner {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.dash-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 14px;
}

/* Streak Chart */
.streak-grid {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  gap: 3px;
}
.streak-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: #f3f4f6;
}
.streak-cell.done { background: var(--green); }
.streak-cell.partial { background: #fbbf24; }
.streak-cell.today { border: 2px solid var(--accent); }

/* PSA Tracker */
.psa-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.psa-cell {
  aspect-ratio: 1;
  border-radius: 8px;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-light);
  font-family: -apple-system, sans-serif;
}
.psa-cell.done {
  background: var(--green);
  color: #fff;
}

/* Score Trend */
.chart-container {
  width: 100%;
  height: 180px;
  position: relative;
}
.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* Habit % Bar */
.habit-bars { display: flex; flex-direction: column; gap: 8px; }
.habit-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
}
.habit-bar-label {
  width: 80px;
  text-align: right;
  flex-shrink: 0;
  font-family: -apple-system, sans-serif;
}
.habit-bar-track {
  flex: 1;
  height: 12px;
  background: #f3f4f6;
  border-radius: 6px;
  overflow: hidden;
}
.habit-bar-fill {
  height: 100%;
  border-radius: 6px;
  background: var(--green);
  transition: width 0.5s;
}
.habit-bar-pct {
  width: 36px;
  font-size: 0.72rem;
  color: var(--text-light);
  font-family: -apple-system, sans-serif;
}

/* Day summary */
.day-summary {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-light);
}
.day-summary strong { color: var(--text); }

/* === INSTALL BANNER === */
.install-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--green);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 300;
  font-size: 0.85rem;
  font-family: -apple-system, sans-serif;
  transform: translateY(-100%);
  transition: transform 0.3s;
}
.install-banner.show { transform: translateY(0); }
.install-banner button {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  padding: 6px 16px;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
}

/* === LOGIN SCREEN === */
.login-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--card);
  border-radius: 20px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.1);
  padding: 36px 28px;
  max-width: 380px;
  width: 100%;
  text-align: center;
}
.login-title {
  font-family: Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.login-subtitle {
  font-family: Georgia, serif;
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 28px;
  line-height: 1.5;
}
.login-label {
  display: block;
  text-align: left;
  font-family: Georgia, serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.login-input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-family: Georgia, serif;
  font-size: 0.95rem;
  color: var(--text);
  background: #fafafa;
  margin-bottom: 14px;
}
.login-input:focus { outline: none; border-color: #639922; background: #fff; }
/* Google OAuth button */
.login-google {
  width: 100%;
  padding: 13px 16px;
  background: #fff;
  border: 1.5px solid #ddd;
  border-radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  color: #333;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.15s, border-color 0.15s;
}
.login-google:active { background: #f9fafb; border-color: #bbb; }
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: #bbb;
  font-size: 0.75rem;
  font-family: -apple-system, sans-serif;
}
.login-divider::before, .login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}
.login-btn {
  width: 100%;
  padding: 15px;
  background: #639922;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-family: Georgia, serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}
.login-btn:active { transform: scale(0.98); }
.login-btn:disabled { opacity: 0.5; cursor: default; }
.login-hint {
  font-size: 0.72rem;
  color: var(--text-light);
  margin-top: 10px;
  font-family: -apple-system, sans-serif;
}
.login-error {
  font-size: 0.75rem;
  color: #dc2626;
  margin: -8px 0 10px;
  text-align: left;
  font-family: -apple-system, sans-serif;
}
.login-sent {
  padding: 10px 0;
}
.login-sent-icon {
  margin-bottom: 6px;
}
.login-sent-text {
  font-family: Georgia, serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 8px;
  margin-bottom: 4px;
}
.login-sent-sub {
  font-family: Georgia, serif;
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 6px;
  line-height: 1.5;
}
.login-sent-sub strong {
  color: var(--text);
  font-weight: 600;
}
.login-resend {
  display: inline-block;
  margin-top: 18px;
  background: none;
  border: none;
  font-family: Georgia, serif;
  font-size: 0.8rem;
  color: #639922;
  cursor: pointer;
  text-decoration: underline;
  padding: 6px;
}
.login-resend:disabled { opacity: 0.4; text-decoration: none; }
.login-device-note {
  font-size: 0.68rem;
  color: #999;
  margin-top: 14px;
  font-family: -apple-system, sans-serif;
  line-height: 1.5;
  padding: 8px 12px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #f0f0f0;
}
.login-skip {
  display: block;
  margin: 16px auto 0;
  background: none;
  border: none;
  font-family: Georgia, serif;
  font-size: 0.8rem;
  color: var(--text-light);
  cursor: pointer;
  text-decoration: underline;
  padding: 8px;
}
/* Sync indicator */
.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  margin-left: 6px;
  vertical-align: middle;
}
.sync-dot.online { background: #34c759; }
.sync-dot.offline { background: #ff9500; }

/* === WELCOME RESUME BANNER === */
.wb-banner {
  margin: 0 12px 0;
  background: var(--card);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
  max-height: 400px;
  opacity: 1;
}
.wb-banner.hidden {
  max-height: 0;
  opacity: 0;
  margin: 0 12px;
  pointer-events: none;
}
.wb-banner.slide-up {
  max-height: 0;
  opacity: 0;
  margin: 0 12px;
}
.wb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--accent);
  color: #fff;
}
.wb-title {
  font-family: Georgia, serif;
  font-size: 0.8rem;
  font-weight: 600;
}
.wb-dismiss {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-family: Georgia, serif;
  font-size: 0.72rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 2px 4px;
}
.wb-list { padding: 6px 0; }
.wb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.12s;
}
.wb-row:active { background: #f9fafb; }
.wb-circle {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}
.wb-circle.done {
  background: #34c759;
  border-color: #34c759;
}
.wb-circle svg { width: 10px; height: 10px; }
.wb-name {
  font-family: Georgia, serif;
  font-size: 0.82rem;
  color: var(--text);
  flex: 1;
}
.wb-name.done {
  color: #bbb;
  text-decoration: line-through;
}
.wb-arrow {
  color: #ccc;
  flex-shrink: 0;
}

/* === RESPONSIVE === */
@media (min-width: 480px) {
  main { max-width: 480px; margin: 0 auto; }
  .action-buttons { max-width: 480px; margin: 0 auto 20px; }
}
