:root {
  color-scheme: light;
  --bg: #f7f5f1;
  --card: #ffffff;
  --ink: #171b25;
  --muted: #8b8b8e;
  --line: #e8e6e2;
  --accent: #6254f5;
  --accent-soft: #eeebff;
  --danger: #c94a4a;
  --danger-soft: #faeaea;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-width: 320px; min-height: 100%; margin: 0; background: var(--bg); color: var(--ink); }
body { -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button { border: 0; cursor: pointer; }
button:disabled { opacity: .48; cursor: default; }
.icon { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.app { min-height: 100svh; }
.launch { min-height: 100svh; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--accent); font-size: 22px; }
.launch-mark { display: grid; width: 72px; height: 72px; place-items: center; border-radius: 24px; background: var(--accent); color: white; font-size: 40px; box-shadow: 0 18px 45px rgba(98,84,245,.25); }

.shell { width: min(100%, 720px); min-height: 100svh; margin: 0 auto; padding: calc(var(--safe-top) + 24px) 20px calc(var(--safe-bottom) + 110px); }
.topline, .date-nav, .section-head, .group-head, .task-main, .modal-actions { display: flex; align-items: center; }
.topline { justify-content: space-between; gap: 16px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 14px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(48px, 14vw, 68px); line-height: .96; letter-spacing: -.055em; }
.subtitle { margin: 14px 0 0; color: var(--muted); font-size: 20px; }
.date-nav { gap: 10px; }
.account-nav { justify-content: flex-end; margin-top: 12px; }
.circle-button, .account-button, .edit-button { display: grid; place-items: center; border-radius: 999px; background: white; color: var(--accent); box-shadow: 0 8px 28px rgba(25,25,40,.05); }
.circle-button { width: 52px; height: 52px; font-size: 24px; }
.account-button { width: 48px; height: 48px; color: var(--ink); font-size: 21px; }
.account-avatar { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.controls { margin-top: 34px; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); padding: 5px; border-radius: 999px; background: #e9e7e3; }
.segmented button { min-height: 52px; border-radius: 999px; background: transparent; color: var(--muted); font-weight: 750; }
.segmented button.active { background: white; color: var(--ink); box-shadow: 0 3px 10px rgba(0,0,0,.05); }
.toolbar { display: flex; justify-content: flex-end; gap: 10px; margin: 16px 0 12px; }
.sort-button { display: inline-flex; align-items: center; gap: 7px; padding: 12px 18px; border-radius: 999px; background: white; color: var(--ink); font-weight: 700; }
.search-field { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 14px; border-radius: 999px; background: white; color: var(--muted); }
.search-field span { display: grid; place-items: center; font-size: 16px; }
.search-field input { min-width: 0; width: 100%; border: 0; outline: none; background: transparent; color: var(--ink); }

.section-head { min-height: 30px; justify-content: space-between; margin: 20px 0 10px; }
.section-label { color: var(--muted); font-size: 14px; font-weight: 850; letter-spacing: .18em; text-transform: uppercase; }
.complete-all { display: inline-flex; align-items: center; gap: 4px; background: transparent; color: var(--accent); font-weight: 750; }
.group { margin: 15px 0 24px; }
.group-head { min-height: 38px; justify-content: space-between; gap: 12px; padding: 0 6px; }
.group-title { display: flex; min-width: 0; align-items: center; gap: 7px; font-size: 16px; font-weight: 800; }
.group-title span { color: var(--muted); font-size: 13px; font-weight: 650; }
.group-actions { display: flex; align-items: center; gap: 7px; }
.group-action { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 999px; background: white; color: var(--muted); box-shadow: 0 6px 18px rgba(25,25,40,.04); font-size: 14px; font-weight: 800; }
.group-title-action { flex: 0 0 auto; }
.group-action.danger { color: #b5362f; }
.empty-group { padding: 13px 14px; border-radius: 16px; background: var(--soft); color: var(--muted); font-size: 13px; font-weight: 650; text-align: center; }
.task-list { display: grid; gap: 12px; }
.task { position: relative; display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: start; min-height: 82px; padding: 16px 14px 14px 18px; border-radius: 24px; background: var(--card); box-shadow: 0 8px 28px rgba(25,25,40,.025); }
.task.skipped { background: #fbfaf8; }
.check { width: 42px; height: 42px; margin-top: 2px; border: 3px solid #d5d5d6; border-radius: 50%; background: white; color: white; font-size: 25px; line-height: 1; }
.task.complete .check { border-color: var(--accent); background: var(--accent); }
.task-copy { min-width: 0; padding-top: 1px; }
.task-title { font-size: 20px; font-weight: 760; line-height: 1.18; }
.task.complete .task-title { color: var(--muted); text-decoration: line-through; }
.task-meta { display: flex; flex-wrap: wrap; gap: 5px 12px; margin-top: 7px; color: var(--muted); font-size: 14px; font-weight: 550; }
.task-meta span { display: inline-flex; align-items: center; gap: 4px; }
.meta-icon { font-size: 13px; }
.notes { margin: 9px 0 0; color: #66666a; font-size: 15px; line-height: 1.35; white-space: pre-wrap; }
.edit-button { width: 32px; height: 32px; background: #f7f7f6; font-size: 15px; box-shadow: none; }
.task-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; white-space: nowrap; }
.mini-button { min-height: 30px; padding: 0 10px; border-radius: 999px; background: #eeece8; color: var(--muted); font-size: 12px; font-weight: 800; }
.mini-button.accent { background: var(--accent-soft); color: var(--accent); }
.mini-button.danger { background: var(--danger-soft); color: var(--danger); }
.empty { padding: 48px 18px; color: var(--muted); text-align: center; }
.fab { position: fixed; right: max(24px, calc((100vw - 720px) / 2 + 24px)); bottom: calc(var(--safe-bottom) + 24px); display: grid; width: 70px; height: 70px; place-items: center; border-radius: 50%; background: var(--accent); color: white; font-size: 42px; box-shadow: 0 18px 45px rgba(98,84,245,.32); }
.status { position: fixed; bottom: calc(var(--safe-bottom) + 32px); left: max(20px, calc((100vw - 720px) / 2 + 20px)); color: var(--muted); font-size: 12px; }

.auth-shell { display: grid; width: min(100%, 520px); min-height: 100svh; margin: 0 auto; place-content: center; padding: calc(var(--safe-top) + 28px) 24px calc(var(--safe-bottom) + 28px); text-align: center; }
.auth-mark { display: grid; width: 84px; height: 84px; margin: 0 auto 24px; place-items: center; border-radius: 28px; background: var(--accent); color: white; font-size: 45px; box-shadow: 0 20px 50px rgba(98,84,245,.26); }
.auth-shell h1 { font-size: 44px; }
.auth-shell p { margin: 18px auto 30px; color: var(--muted); font-size: 18px; line-height: 1.45; }
.auth-options { --auth-button-width: min(100%, 400px); display: grid; justify-items: center; gap: 12px; }
.google-provider { display: grid; width: var(--auth-button-width); min-height: 42px; place-items: center; overflow: hidden; }
.provider, .dev-button { display: grid; width: var(--auth-button-width); min-height: 42px; place-items: center; border-radius: 4px; background: white; color: var(--ink); font-size: 14px; font-weight: 600; overflow: hidden; }
.provider.apple { background: black; color: white; }
.auth-note { min-height: 22px; margin-top: 16px; color: var(--danger); font-size: 14px; }

.scrim { position: fixed; inset: 0; z-index: 50; display: grid; align-items: end; background: rgba(22,22,28,.34); backdrop-filter: blur(4px); }
.modal { width: min(100%, 720px); max-height: min(92svh, 820px); margin: 0 auto; overflow: auto; padding: 22px 22px calc(var(--safe-bottom) + 24px); border-radius: 30px 30px 0 0; background: #fbfaf8; box-shadow: 0 -18px 60px rgba(0,0,0,.16); }
.modal h2 { margin: 0 0 18px; font-size: 28px; letter-spacing: -.03em; }
.field { display: grid; gap: 7px; margin: 14px 0; color: #54545a; font-size: 13px; font-weight: 750; }
.field input, .field textarea, .field select { width: 100%; min-height: 48px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 13px; outline: none; background: white; color: var(--ink); }
.field textarea { min-height: 86px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.weekday { aspect-ratio: 1; border-radius: 50%; background: #ebe9e5; color: var(--muted); font-size: 12px; font-weight: 800; }
.weekday.active { background: var(--accent); color: white; }
.modal-actions { justify-content: space-between; gap: 12px; margin-top: 22px; }
.modal-actions div { display: flex; gap: 10px; }
.secondary, .primary, .modal-actions .danger { min-height: 48px; padding: 0 18px; border-radius: 14px; font-weight: 780; }
.secondary { background: #e9e7e3; color: var(--ink); }
.primary { background: var(--accent); color: white; }
.danger { background: var(--danger-soft); color: var(--danger); }
.account-card { display: grid; gap: 16px; padding: 8px 0; }
.account-profile { display: grid; justify-items: center; gap: 6px; padding: 8px 0 4px; text-align: center; }
.account-profile strong { font-size: 22px; }
.account-photo { display: grid; width: 78px; height: 78px; place-items: center; border-radius: 50%; background: white; color: var(--accent); font-size: 28px; font-weight: 800; box-shadow: 0 12px 32px rgba(25,25,40,.08); overflow: hidden; }
.account-photo img { width: 100%; height: 100%; object-fit: cover; }
.account-panel { display: grid; gap: 1px; overflow: hidden; border-radius: 16px; background: var(--line); }
.account-card p { margin: 0; color: var(--muted); }
.account-card button { display: grid; gap: 3px; min-height: 54px; background: white; color: var(--ink); font-weight: 760; text-align: left; padding: 10px 16px; }
.account-card button small { color: var(--muted); font-size: 12px; font-weight: 650; }
.account-card button.danger { background: var(--danger-soft); color: var(--danger); }
.account-card button.danger small { color: var(--danger); opacity: .72; }
.template-list { display: grid; gap: 10px; }
.template-option { display: grid; gap: 5px; min-height: 74px; padding: 14px 16px; border-radius: 14px; background: white; color: var(--ink); text-align: left; }
.template-option span { color: var(--muted); font-size: 13px; line-height: 1.35; }
.history-list { display: grid; gap: 8px; }
.history-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 46px; padding: 0 14px; border-radius: 14px; background: white; color: var(--ink); }
.history-row strong { padding: 5px 9px; border-radius: 999px; color: var(--muted); background: #eeece8; font-size: 12px; }
.history-row strong.done { color: var(--accent); background: var(--accent-soft); }
.history-row strong.missed { color: var(--danger); background: var(--danger-soft); }
.history-row strong.open { color: #237a57; background: #e8f5ef; }
.toast { position: fixed; z-index: 80; left: 50%; bottom: calc(var(--safe-bottom) + 110px); transform: translateX(-50%); padding: 12px 18px; border-radius: 999px; background: #26262b; color: white; font-size: 14px; box-shadow: 0 12px 35px rgba(0,0,0,.24); }
.legal-page { max-width: 760px; padding-bottom: calc(var(--safe-bottom) + 48px); }
.legal-page h1 { margin-bottom: 28px; }
.legal-section { margin: 0 0 24px; padding: 20px; border-radius: 18px; background: white; box-shadow: 0 8px 28px rgba(25,25,40,.025); }
.legal-section h2 { margin: 0 0 10px; font-size: 20px; }
.legal-section p { margin: 0; color: #555960; font-size: 16px; line-height: 1.5; }

@media (min-width: 760px) {
  .shell { padding-top: 56px; }
  .modal { margin-bottom: 24px; border-radius: 30px; }
  .scrim { align-items: center; padding: 24px; }
}

@media (max-width: 460px) {
  .task { grid-template-columns: auto 1fr; }
  .task-actions { grid-column: 2; justify-content: flex-start; margin-top: 2px; }
}
