/* Life Tracker — editorial, grown-up theme with a playful pulse.
   Fraunces (serif) for display, Inter for UI. Warm ivory ground, plum ink,
   raspberry accent; category colours are muted and sophisticated. */

:root {
  --bg: #FAF6F1;
  --ink: #2B2233;
  --muted: #8A7D91;
  --card: #FFFFFF;
  --line: #EAE1DA;
  --accent: #A83E68;
  --accent-soft: #F6E7EE;
  --gold: #9C7A22;
  --gold-soft: #F5EDDA;
  --sage: #6F9B84;
  --shadow: 0 1px 2px rgba(43, 34, 51, 0.05), 0 8px 24px rgba(43, 34, 51, 0.06);
  --radius: 14px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 400;
  font-size: 15px;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}

.hidden { display: none !important; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }

button { font-family: inherit; font-weight: 500; color: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-weight: 400; color: inherit; }

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

/* ---------- sign-in screen ---------- */

.auth-screen {
  min-height: 88vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 56px 40px 44px;
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.auth-mark {
  width: 44px;
  height: 44px;
  margin: 0 auto 18px;
  border-radius: 13px;
  background: var(--accent);
  position: relative;
}
.auth-mark::after {
  content: '';
  position: absolute;
  left: 12px;
  top: 13px;
  width: 18px;
  height: 10px;
  border-left: 3px solid var(--bg);
  border-bottom: 3px solid var(--bg);
  transform: rotate(-45deg);
}

.brand-title {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 38px;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
}

.auth-tagline {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 500;
  font-size: 17px;
  color: var(--muted);
  margin: 0 0 32px;
  line-height: 1.55;
}

.google-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 13px 26px;
  font-size: 15px;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.google-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(43, 34, 51, 0.3); }
.google-btn svg { background: #fff; border-radius: 50%; padding: 2px; }

.auth-hint { font-size: 13px; color: var(--muted); margin: 20px 6px 10px; line-height: 1.55; }

.demo-link { font-size: 14px; font-weight: 500; }

/* ---------- app chrome ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 22px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(250, 246, 241, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.brand-name {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 600;
  font-size: 20px;
}

.top-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.user-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.user-photo { width: 26px; height: 26px; border-radius: 50%; }

.link-btn { background: none; border: none; color: var(--accent); font-size: 13px; padding: 2px; }
.link-btn:hover { text-decoration: underline; }

.wrap { max-width: 760px; margin: 0 auto; padding: 30px 20px 120px; }

.greeting-block { margin: 4px 2px 22px; }
.greeting {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 34px;
  letter-spacing: -0.01em;
  margin: 6px 0 6px;
}
.summary { color: var(--muted); font-size: 15px; margin: 0; }
.summary strong { color: var(--accent); font-weight: 600; }

.demo-banner {
  background: var(--gold-soft);
  border: 1px solid #E3D5AE;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13.5px;
  margin-bottom: 18px;
}

/* ---------- view switcher ---------- */

.view-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  padding: 3px;
  margin-bottom: 22px;
}
.view-btn {
  border: none;
  background: none;
  border-radius: 999px;
  padding: 7px 18px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
}
.view-btn[aria-pressed="true"] { background: var(--ink); color: #fff; font-weight: 600; }

/* ---------- spotlight ---------- */

.spot-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px 8px;
  margin-bottom: 16px;
}
.spot-card.spot-due { border-left-color: var(--gold); }
.spot-head { display: flex; align-items: baseline; gap: 10px; margin: 0 0 4px; }
.spot-head h2 {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 19px;
  margin: 0;
}
.spot-count { font-size: 12px; font-weight: 600; color: var(--muted); }

.all-clear {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--sage);
  border-radius: var(--radius);
  padding: 15px 18px;
  margin-bottom: 16px;
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 16.5px;
  color: #4E7460;
}

/* ---------- category sections ---------- */

.cat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 18px 8px;
  margin-bottom: 16px;
}

.cat-head { display: flex; align-items: center; gap: 10px; padding: 2px 0 8px; }
.cat-dot-mark { width: 9px; height: 9px; border-radius: 50%; background: var(--cat, var(--muted)); flex: none; }
.cat-emoji { font-size: 17px; line-height: 1; }
.cat-head h2 {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 19px;
  margin: 0;
  flex: 1;
}

.badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 999px;
  padding: 3px 9px;
}
.badge-overdue { background: var(--accent-soft); color: var(--accent); }
.badge-due { background: var(--gold-soft); color: var(--gold); }

.cat-add-people {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  padding: 4px 6px;
}
.cat-add-people:hover { text-decoration: underline; }

.cat-empty { color: var(--muted); font-size: 13.5px; padding: 4px 2px 12px; margin: 0; }

/* ---------- task rows ---------- */

.task {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 11px 0;
  border-top: 1px solid #F3EDE7;
}
.task:first-of-type { border-top: none; }

.tick {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--cat, var(--muted));
  background: transparent;
  font-size: 16px;
  color: transparent;
  display: grid;
  place-items: center;
  transition: transform 0.12s ease, background 0.15s ease, color 0.15s ease;
}
.tick:hover { transform: scale(1.1); background: rgba(43, 34, 51, 0.03); }
.tick:active { transform: scale(0.92); }
.task.is-done-today .tick {
  background: var(--cat, var(--ink));
  border-color: var(--cat, var(--ink));
  color: #fff;
  animation: pop 0.35s ease;
}

.task-body { flex: 1; min-width: 0; }
.task-name { font-weight: 500; font-size: 15px; overflow-wrap: anywhere; }
.task.is-done-today .task-name { color: var(--muted); }
.task-meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.task-meta .due-overdue { color: var(--accent); font-weight: 600; }
.task-meta .due-today { color: var(--gold); font-weight: 600; }
.task-meta .streak { color: var(--gold); font-weight: 600; }

.task-edit {
  flex: none;
  background: none;
  border: none;
  font-size: 14px;
  color: #C4B8CB;
  padding: 8px;
  border-radius: 8px;
}
.task-edit:hover { color: var(--ink); background: #F5F0EA; }

.task-cat-tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cat, var(--muted));
  margin-right: 8px;
  white-space: nowrap;
}

/* ---------- calendar (month) ---------- */

.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.cal-head h2 {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 22px;
  margin: 0;
  flex: 1;
}
.cal-nav {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  font-size: 16px;
  line-height: 1;
}
.cal-nav:hover { border-color: var(--ink); }
.cal-today-btn {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
}
.cal-today-btn:hover { border-color: var(--ink); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.cal-dow {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  padding: 9px 4px;
  border-bottom: 1px solid var(--line);
}
.cal-cell {
  min-height: 92px;
  padding: 6px;
  border-top: 1px solid #F3EDE7;
  border-left: 1px solid #F3EDE7;
  overflow: hidden;
}
.cal-cell:nth-child(7n + 8) { border-left: none; }
.cal-cell.is-out { background: #FBF8F4; }
.cal-cell.is-out .cal-daynum { color: #D4CBC2; }
.cal-daynum { font-size: 12px; font-weight: 600; color: var(--muted); display: inline-block; padding: 2px 5px; }
.cal-cell.is-today .cal-daynum {
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
}

.cal-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  border: none;
  background: none;
  text-align: left;
  font-size: 11.5px;
  padding: 2px 4px;
  border-radius: 6px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-chip:hover { background: #F5F0EA; }
.cal-chip .chip-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--cat, var(--muted)); }
.cal-chip.is-done { color: var(--muted); text-decoration: line-through; text-decoration-color: #C4B8CB; }
.cal-chip.is-overdue { color: var(--accent); font-weight: 600; }
.cal-chip-name { overflow: hidden; text-overflow: ellipsis; }
.cal-more { font-size: 10.5px; color: var(--muted); padding: 1px 4px; }

/* ---------- calendar (year) ---------- */

.year-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.year-month {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  text-align: left;
  transition: border-color 0.12s ease, transform 0.12s ease;
}
.year-month:hover { border-color: var(--ink); transform: translateY(-1px); }
.year-month.is-current { border-color: var(--accent); }
.year-month h3 { font-family: 'Fraunces', serif; font-weight: 600; font-size: 16px; margin: 0 0 4px; }
.year-month .ym-count { font-size: 12.5px; color: var(--muted); }
.year-month .ym-dots { display: flex; gap: 4px; margin-top: 9px; min-height: 8px; flex-wrap: wrap; }
.year-month .ym-dots span { width: 8px; height: 8px; border-radius: 50%; }

/* ---------- empty state ---------- */

.empty-state { text-align: center; padding: 52px 20px; }
.empty-state h2 { font-family: 'Fraunces', serif; font-weight: 600; font-size: 26px; margin: 0 0 8px; }
.empty-state p { color: var(--muted); max-width: 400px; margin: 0 auto 24px; line-height: 1.6; }

/* ---------- buttons, fab ---------- */

.primary-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 11px 24px;
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.primary-btn:hover { background: #93325A; transform: translateY(-1px); box-shadow: 0 8px 18px rgba(168, 62, 104, 0.3); }

.ghost-btn {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 500;
}
.ghost-btn:hover { border-color: var(--ink); }

.danger-btn {
  background: none;
  border: 1px solid #E4C2CF;
  color: var(--accent);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 500;
}
.danger-btn:hover { background: var(--accent-soft); }

.fab {
  position: fixed;
  right: 24px;
  bottom: 32px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  font-size: 26px;
  font-weight: 400;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 10px 26px rgba(43, 34, 51, 0.35);
  transition: transform 0.15s ease, background 0.15s ease;
  z-index: 30;
}
.fab:hover { transform: scale(1.06); background: var(--accent); }

/* ---------- modals ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(43, 34, 51, 0.4);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-card {
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(43, 34, 51, 0.3);
  width: 100%;
  max-width: 440px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 26px 26px 22px;
  animation: rise 0.22s ease;
}
.modal-card h2 { font-family: 'Fraunces', serif; font-weight: 600; font-size: 23px; margin: 0 0 16px; }
.modal-hint { font-size: 13px; color: var(--muted); margin: -8px 0 16px; line-height: 1.55; }

.field { display: block; font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin-bottom: 16px; }
.field input:not([type=radio]), .field select, .field textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #FDFBF9;
  padding: 11px 13px;
  font-size: 15px;
  letter-spacing: normal;
  text-transform: none;
  color: var(--ink);
}
.field textarea { resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--ink); outline-offset: -1px; border-color: transparent; }

.sched-field { border: none; padding: 0; margin: 0 0 16px; }
.sched-field legend { padding: 0; margin-bottom: 8px; }

.sched-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.12s ease;
}
.chip input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); }

.custom-sched {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
  color: var(--ink);
}
.field .custom-sched input { display: inline-block; width: 72px; margin-top: 0; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font-size: 15px; background: #FDFBF9; }
.field .custom-sched select { display: inline-block; width: auto; margin-top: 0; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font-size: 15px; background: #FDFBF9; }

.form-error { color: var(--accent); font-size: 13.5px; font-weight: 500; }

.modal-actions { display: flex; align-items: center; gap: 10px; margin-top: 20px; }
.spacer { flex: 1; }

/* sections editor rows */
.cat-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.cat-dot {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid var(--card);
  box-shadow: 0 0 0 1px var(--line);
  background: var(--cat, var(--muted));
}
.cat-dot:hover { transform: scale(1.1); }
.cat-row .cat-emoji-input { width: 50px; text-align: center; border: 1px solid var(--line); border-radius: 10px; padding: 9px 4px; font-size: 16px; background: #FDFBF9; }
.cat-row .cat-name-input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: 15px; background: #FDFBF9; }
.cat-del { flex: none; background: none; border: none; color: #C4B8CB; font-size: 16px; padding: 6px 8px; border-radius: 8px; }
.cat-del:hover:not(:disabled) { color: var(--accent); background: var(--accent-soft); }
.cat-del:disabled { opacity: 0.35; cursor: not-allowed; }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  padding: 11px 20px;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 12px 30px rgba(43, 34, 51, 0.4);
  z-index: 50;
  animation: toast-rise 0.2s ease;
  max-width: min(92vw, 480px);
}
@keyframes toast-rise { from { transform: translate(-50%, 10px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.toast-undo { background: none; border: none; color: #E8B4CB; font-weight: 600; font-size: 13.5px; }
.toast-undo:hover { text-decoration: underline; }

/* ---------- confetti ---------- */

#confettiLayer { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti-bit {
  position: fixed;
  left: 0;
  top: 0;
  width: 7px;
  height: 11px;
  border-radius: 2px;
  animation: burst var(--dur, 0.9s) cubic-bezier(0.2, 0.7, 0.4, 1) forwards;
}
.confetti-bit.is-dot { width: 7px; height: 7px; border-radius: 50%; }

@keyframes burst {
  0% { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(0.7); opacity: 0; }
}

/* ---------- footer & keyframes ---------- */

.site-foot {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 14px 16px 26px;
}

@keyframes pop { 0% { transform: scale(0.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 560px) {
  .greeting { font-size: 27px; }
  .topbar { padding: 12px 14px; }
  .user-chip span#userName { display: none; }
  .cal-cell { min-height: 64px; padding: 4px; }
  .cal-chip-name, .cal-more { display: none; }
  .cal-chip { width: auto; padding: 2px; }
  .cal-cell .cal-chips { display: flex; flex-wrap: wrap; gap: 2px; }
}
