/*
  ChoreBoy at choreboy.app: DressBoy's web look (its tokens and components, from
  web/public/dressboy/dressboy.css) with ChoreBoy's green accent. Light or dark follows the device
  (prefers-color-scheme); there's no switch. Responsive from 320 px. schedule.css (the Schedule),
  places.css (🏠 Places and ✈️ Trips) and stats.js's markup use these tokens and components too.
*/

:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --sunken: #eef0f4;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-2: #475467;
  --text-3: #667085;
  --accent: #15803d;
  --accent-hover: #166534;
  --accent-soft: #ecfdf3;
  --accent-contrast: #ffffff;
  --accent-text: #15803d;
  --good: #067647;
  --good-soft: #ecfdf3;
  --warn: #b54708;
  --warn-soft: #fffaeb;
  --bad: #c01048;
  --bad-soft: #fff1f3;
  --info: #026aa2;
  --info-soft: #f0f9ff;
  --gold: #b54708;
  --purple: #6941c6;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
  --radius-sm: 8px;
  --radius: 10px;
  --radius-lg: 14px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0f1115;
    --surface: #16181d;
    --surface-2: #1c1f26;
    --sunken: #121418;
    --border: #262a33;
    --border-strong: #343a46;
    --text: #f2f4f7;
    --text-2: #b4bcc8;
    --text-3: #8b93a1;
    --accent: #4ade80;
    --accent-hover: #86efac;
    --accent-soft: rgba(74, 222, 128, .14);
    --accent-contrast: #0f1115;
    --accent-text: #86efac;
    --good: #47cd89;
    --good-soft: rgba(71, 205, 137, .12);
    --warn: #fdb022;
    --warn-soft: rgba(253, 176, 34, .12);
    --bad: #fd6f8e;
    --bad-soft: rgba(253, 111, 142, .12);
    --info: #7cd4fd;
    --info-soft: rgba(124, 212, 253, .12);
    --gold: #fdb022;
    --purple: #b692f6;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, .35);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body.modal-open { overflow: hidden; }
::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
.hidden, [hidden] { display: none !important; }
.muted { color: var(--text-2); font-size: .9rem; margin: .25rem 0 .75rem; }
.small, .small-muted { color: var(--text-3); font-size: .8125rem; }
.center { text-align: center; }

/* ---------- top bar ---------- */

.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 1rem; padding: .6rem max(1rem, env(safe-area-inset-left)); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: .55rem; flex-shrink: 0; }
.brand-logo { width: 30px; height: 30px; image-rendering: pixelated; }
.screen-title { margin: 0; font-size: 1.15rem; font-weight: 750; letter-spacing: -.01em; }
.nav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.nav-btn { font: 600 .875rem var(--font); color: var(--text-2); background: none; border: 0; padding: .45rem .7rem; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.nav-btn:hover { background: var(--surface-2); color: var(--text); }
.nav-btn.active { background: var(--accent-soft); color: var(--accent-text); }
.top-tools { display: flex; gap: .4rem; align-items: center; flex-shrink: 0; min-width: 0; }
body.logged-out .nav, body.logged-out .top-tools { display: none; }
#wx-chip b { color: var(--text); font-weight: 650; }
.wx-low, .wx-pop { color: var(--text-3); }
/* The ⭐ chip: "Lv 32 · Household hero", the star inside a thin ring that fills toward the next level. */
#level-chip { gap: .4rem; padding-left: .3rem; }
#level-chip b { color: var(--gold); font-weight: 700; }
.lv-title { color: var(--text-2); max-width: 11rem; overflow: hidden; text-overflow: ellipsis; }
.lv-ring { position: relative; width: 1.55rem; height: 1.55rem; flex-shrink: 0; display: grid; place-items: center; }
.lv-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.lv-ring circle { fill: none; stroke-width: 2.2; }
.lv-ring-bg { stroke: var(--border); }
.lv-ring-fg { stroke: var(--gold); stroke-linecap: round; transition: stroke-dasharray .6s ease; }
.lv-star { font-size: .78rem; line-height: 1; }
.acct-name { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; }

.view { padding: 1.25rem max(1rem, env(safe-area-inset-left)) 3rem; max-width: 1280px; margin: 0 auto; }

/* ---------- cards & controls ---------- */

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 1.1rem 1.15rem; min-width: 0; }
.panel-title { margin: 0 0 .8rem; font-size: 1.02rem; font-weight: 700; letter-spacing: -.01em; color: var(--text); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .9rem; flex-wrap: wrap; }
.panel-head .panel-title { margin: 0; }

.btn { font: 600 .9rem var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: .55rem .95rem; cursor: pointer; box-shadow: var(--shadow-sm); white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.ghost.on { color: var(--accent-text); border-color: var(--accent); }
.btn.small { font-size: .82rem; padding: .4rem .7rem; }
.btn.tiny { font-size: .76rem; padding: .28rem .55rem; box-shadow: none; }
.btn.danger-text { color: var(--bad); }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.btn-row.right { justify-content: flex-end; }
.link-btn { background: none; border: 0; color: var(--accent-text); cursor: pointer; font: inherit; padding: 0; }
.link-btn:hover { text-decoration: underline; }

.input { width: 100%; font: 400 .95rem var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: .55rem .7rem; outline: none; min-width: 0; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
textarea.input { resize: vertical; min-height: 2.6rem; line-height: 1.4; }
select.input { cursor: pointer; }
.input.narrow { width: 7rem; }
.field-label { display: block; font-size: .78rem; font-weight: 650; color: var(--text-2); margin: .9rem 0 .35rem; text-transform: uppercase; letter-spacing: .03em; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.field-row.three { grid-template-columns: repeat(3, 1fr); }
.check { display: inline-flex; align-items: center; gap: .45rem; font-size: .9rem; cursor: pointer; margin-right: .9rem; }
.check.block { display: flex; margin: .9rem 0 .3rem; }

.chip { font: 500 .82rem var(--font); padding: .3rem .65rem; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); border-radius: 999px; white-space: nowrap; display: inline-flex; align-items: center; gap: .35rem; text-decoration: none; }
.chip.ok { color: var(--good); background: var(--good-soft); border-color: transparent; }
.chip.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.chip.bad { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.chip.info { color: var(--info); background: var(--info-soft); border-color: transparent; }
.chip-btn { cursor: pointer; }
.chip-btn:hover { color: var(--text); border-color: var(--border-strong); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip.tiny { font-size: .74rem; padding: .08rem .5rem; gap: .25rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.chip.faint { color: var(--text-3); background: transparent; }
.chip.xp { color: var(--gold); font-weight: 650; font-variant-numeric: tabular-nums; }
.chip.xp.earned { background: var(--warn-soft); border-color: transparent; }
/* ⚡ Quickie: 10 minutes or less (the warm color, first among a row's chips). */
.chip.quickie { color: var(--warn); background: var(--warn-soft); border-color: transparent; font-weight: 650; }
.chip-link { color: var(--accent-text); }
.chip-link:hover { border-color: var(--accent); }
/* A task's place, and whether it moves on trips (✈️ Moves on trips / 📌 Stays put). */
.chip.place-chip { color: var(--text); font-weight: 600; }
.chip.move-tag.moves { color: var(--info); background: var(--info-soft); border-color: transparent; }
.chip.move-tag.stays { color: var(--text-3); background: transparent; }
.chip.place-chip.anywhere { color: var(--info); background: var(--info-soft); border-color: transparent; }

/* An on / off switch (a button with role="switch"): the editor's "✈️ Move on trips", setup's places. */
.switch-row { display: inline-flex; align-items: center; gap: .6rem; padding: .3rem 0; background: none; border: 0; border-radius: var(--radius-sm); font: 550 .92rem var(--font); color: var(--text); text-align: left; cursor: pointer; }
.switch-row:disabled { opacity: .5; cursor: not-allowed; }
.switch { position: relative; flex-shrink: 0; width: 2.5rem; height: 1.45rem; border-radius: 999px; background: var(--border-strong); transition: background .15s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: calc(1.45rem - 6px); height: calc(1.45rem - 6px); border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(16, 24, 40, .25); transition: transform .15s; }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(1.05rem); }
.switch-row:hover:not(:disabled) .switch:not(.on) { background: color-mix(in srgb, var(--accent) 30%, var(--border-strong)); }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 2px; flex-wrap: wrap; gap: 1px; }
.seg button { font: 650 .8rem var(--font); padding: .35rem .75rem; background: none; color: var(--text-2); border: 0; border-radius: 999px; cursor: pointer; }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg.small-seg button { padding: .25rem .6rem; font-size: .76rem; }

.empty-state { color: var(--text-3); padding: 1.5rem 1rem; text-align: center; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); margin: .4rem 0; }
.empty-state.small { padding: .8rem; font-size: .9rem; text-align: left; }

/* ---------- banners (the notice bar) ---------- */

.banner { display: flex; align-items: center; gap: .8rem; padding: .6rem max(1rem, env(safe-area-inset-left)); font-size: .9rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.banner .grow { flex: 1; min-width: 14rem; }
.banner.remap { background: var(--warn-soft); color: var(--warn); }
.banner.trip { background: var(--info-soft); color: var(--info); }
.banner.log { background: var(--good-soft); color: var(--good); }

/* While a trip is on: "🏖️ Osoyoos vacation until Sun Nov 22 · 18 tasks moved to after you're back". */
.trip-banner { display: flex; align-items: center; gap: .5rem .8rem; flex-wrap: wrap; margin: 0 0 1rem; padding: .65rem .9rem; border-radius: var(--radius-lg); background: var(--info-soft); color: var(--info); font-size: .92rem; }
.trip-banner b { font-weight: 700; }
.trip-banner-ico { font-size: 1.35rem; line-height: 1; }
.trip-banner .grow { flex: 1; min-width: min(100%, 14rem); overflow-wrap: anywhere; }
.trip-banner .btn { color: var(--info); border-color: color-mix(in srgb, var(--info) 40%, transparent); }
.trip-banner .btn:hover { background: color-mix(in srgb, var(--info) 10%, transparent); }

/* ---------- sign up / log in, account (app-api.js) ---------- */

.login-wrap { padding: 2rem 1rem 4rem; }
.login-error { color: var(--bad); min-height: 1.2em; font-size: .9rem; margin: .4rem 0; }
.auth { max-width: 1040px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(1.5rem, 5vw, 4rem); align-items: center; min-height: calc(100vh - 9rem); }
.auth-brand { display: none; } /* the top bar already says ChoreBoy */
.auth-logo { width: 44px; height: 44px; image-rendering: pixelated; }
.auth-hero h1 { font-size: clamp(1.85rem, 4.2vw, 2.9rem); line-height: 1.08; letter-spacing: -.035em; margin: 1.1rem 0 .8rem; }
.auth-lede { font-size: 1.05rem; color: var(--text-2); margin: 0 0 1.3rem; max-width: 34rem; }
.auth-points { list-style: none; padding: 0; margin: 0; display: grid; gap: .7rem; }
.auth-points li { display: flex; gap: .7rem; align-items: flex-start; color: var(--text-2); }
.auth-points b { color: var(--text); }
.auth-ico { flex-shrink: 0; width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: var(--radius-sm); background: var(--accent-soft); }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: 1.5rem; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem; padding: .25rem; background: var(--sunken); border-radius: var(--radius); margin-bottom: .4rem; }
.auth-tabs button { font: 650 .92rem var(--font); color: var(--text-2); background: transparent; border: 0; border-radius: var(--radius-sm); padding: .55rem; cursor: pointer; }
.auth-tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.auth-h { font-size: 1.2rem; margin: .2rem 0 .3rem; letter-spacing: -.01em; }
.auth-flash { border-radius: var(--radius-sm); padding: .55rem .75rem; font-size: .9rem; margin: 0 0 .8rem; }
.auth-flash.ok { background: var(--good-soft); color: var(--good); }
.auth-flash.bad { background: var(--bad-soft); color: var(--bad); }
.auth-card .small-muted { margin: .4rem 0 0; }
.btn.wide { width: 100%; padding: .7rem; font-size: .95rem; }
.auth-card p.center { margin: .8rem 0 0; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 4rem; }
.pw-show { position: absolute; right: .7rem; top: 50%; transform: translateY(-50%); font-size: .82rem; }
@media (max-width: 760px) {
  .auth { grid-template-columns: 1fr; min-height: 0; }
  .auth-card { order: -1; }
  .auth-hero h1 { margin-top: .6rem; }
}
.acct-who { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; }
.acct-who .muted { margin: 0; }
.acct-menu { position: fixed; z-index: 330; min-width: 230px; max-width: calc(100vw - 16px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .35rem; display: flex; flex-direction: column; }
.acct-menu-who { display: flex; flex-direction: column; gap: .1rem; padding: .45rem .65rem .6rem; margin-bottom: .3rem; border-bottom: 1px solid var(--border); font-size: .9rem; min-width: 0; }
.acct-menu-who span { color: var(--text-3); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-menu button { text-align: left; background: none; border: 0; border-radius: var(--radius-sm); padding: .55rem .65rem; font: 500 .92rem var(--font); color: var(--text); cursor: pointer; }
.acct-menu button:hover, .acct-menu button:focus-visible { background: var(--surface-2); }
.acct-menu hr { border: 0; border-top: 1px solid var(--border); margin: .3rem 0; }
.danger-zone { margin-top: 1.2rem; padding-top: .4rem; border-top: 1px solid var(--border); }

/* ---------- ☀️ Tasks: the lists ---------- */

.tasks { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 1.4rem; align-items: start; }
.lists { position: sticky; top: 4.6rem; max-height: calc(100vh - 5.5rem); overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.list-btn { display: flex; align-items: center; gap: .55rem; padding: .48rem .65rem; border-radius: var(--radius-sm); background: none; border: 0; font: 550 .92rem var(--font); color: var(--text-2); cursor: pointer; text-align: left; }
.list-btn:hover { background: var(--surface-2); color: var(--text); }
.list-btn.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 650; }
.list-ico { width: 1.3rem; text-align: center; flex-shrink: 0; }
.list-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-count { margin-left: auto; font-size: .78rem; font-weight: 650; color: var(--text-3); font-variant-numeric: tabular-nums; }
.list-btn.active .list-count { color: inherit; }
.list-btn.alert .list-count { color: #fff; background: var(--bad); padding: 0 .45rem; border-radius: 999px; }

.list-main { min-width: 0; }
.list-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .8rem; margin-bottom: .8rem; flex-wrap: wrap; }
.list-head-text { min-width: 0; }
.list-title { margin: 0; font-size: 1.45rem; font-weight: 750; letter-spacing: -.02em; }
.list-sum { margin: .15rem 0 0; color: var(--text-2); font-size: .9rem; }
.list-tools { display: flex; gap: .5rem; align-items: center; margin-bottom: .8rem; }
.list-tools .search { flex: 1; }
.filters { display: flex; gap: .45rem; align-items: center; flex-wrap: wrap; margin: -.3rem 0 .9rem; padding: .6rem; background: var(--surface-2); border-radius: var(--radius); }
.input.sel { width: auto; max-width: 100%; font-size: .85rem; padding: .35rem .5rem; }
.filters .check { margin-right: .2rem; font-size: .85rem; }

.group-head { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; margin: 1.1rem .2rem .4rem; font-size: .8rem; font-weight: 700; color: var(--text-2); letter-spacing: .03em; text-transform: uppercase; }
.group-head:first-of-type { margin-top: .3rem; }
.group-sum { font-weight: 600; color: var(--text-3); text-transform: none; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.group-head.overdue { color: var(--bad); }

/* "✅ Completed (6)": finished tasks under the list, folded until it's opened. */
.completed { margin-top: 1.1rem; }
.completed > summary { cursor: pointer; list-style: none; margin: 0 .2rem .4rem; padding: .3rem 0; border-radius: var(--radius-sm); }
.completed > summary::-webkit-details-marker { display: none; }
.completed > summary > span:first-child::before { content: '▸'; display: inline-block; margin-right: .45rem; color: var(--text-3); transition: transform .15s; }
.completed[open] > summary > span:first-child::before { transform: rotate(90deg); }
.completed > summary:hover { color: var(--text); }
.completed .task-list { box-shadow: none; }
.completed-n { display: inline-block; font-variant-numeric: tabular-nums; }
.completed-n.bump { animation: cb-bump .35s ease; }
@keyframes cb-bump { 40% { transform: scale(1.35); color: var(--accent-text); } }
.task-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.more-btn { display: block; margin: .9rem auto 0; }

.task { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .2rem .7rem; align-items: start; padding: .6rem .75rem; border-top: 1px solid var(--border); }
.task:first-child { border-top: 0; }
.task:hover { background: var(--surface-2); }
.tick { width: 22px; height: 22px; margin-top: 1px; padding: 0; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface); color: transparent; display: grid; place-items: center; font: 700 .72rem var(--font); cursor: pointer; flex-shrink: 0; }
.tick:hover { border-color: var(--accent); color: var(--accent); }
.tick:not(.on):hover::after { content: '✓'; }
.tick.on { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.task.is-overdue { box-shadow: inset 3px 0 0 var(--bad); }
.task.is-overdue .tick { border-color: color-mix(in srgb, var(--bad) 60%, var(--border-strong)); }
.task.is-waiting .tick { border-style: dashed; }
/* Ticking one off: the circle fills with a check (a short pop) and the title strikes through, then
   the row folds up and slides away (.slide + .gone; app.js waits SLIDE_MS for it). A task brought
   back slides in the same way. With reduced motion nothing moves (see the end of this file). */
.task.checking { pointer-events: none; }
.task.checking .tick { animation: cb-pop .2s ease-out; }
.task.checking .task-title { color: var(--text-3); text-decoration: line-through; }
@keyframes cb-pop { 0% { transform: scale(.8); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
.task.slide { overflow: hidden; transition: height .38s ease, padding .38s ease, opacity .3s ease, transform .38s ease, border-color .38s ease; }
.task.gone { height: 0; padding-top: 0; padding-bottom: 0; opacity: 0; transform: translateX(1.5rem); border-top-color: transparent; }
/* "+25 XP" rising from the circle that was ticked. */
.xp-pop { position: fixed; z-index: 450; transform: translate(-50%, -60%); font: 800 .9rem var(--font); color: var(--gold); text-shadow: 0 1px 0 var(--surface); pointer-events: none; animation: cb-rise .95s ease-out forwards; white-space: nowrap; }
@keyframes cb-rise { 0% { opacity: 0; transform: translate(-50%, -40%) scale(.8); } 15% { opacity: 1; transform: translate(-50%, -90%) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -260%) scale(1); } }
.task-main { min-width: 0; cursor: pointer; display: flex; flex-direction: column; gap: .3rem; border-radius: 6px; }
.task-title { font-weight: 550; overflow-wrap: anywhere; line-height: 1.35; }
.task.is-done .task-title { text-decoration: line-through; color: var(--text-3); }
.task-chips { display: flex; flex-wrap: wrap; gap: .25rem; }
.task-why { font-size: .8rem; color: var(--info); }
.task-acts { display: flex; gap: .15rem; align-items: center; visibility: hidden; }
.task:hover .task-acts, .task:focus-within .task-acts, .task.show-acts .task-acts, .task.is-done .task-acts { visibility: visible; }
.task-more { display: none; }
.date-pick { position: relative; display: inline-flex; }
.date-input { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; pointer-events: none; }
@media (hover: none) {
  .task-main { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  .task-more { display: inline-flex; }
  .task-acts { display: none; visibility: visible; }
  .task.show-acts .task-acts { display: flex; flex-wrap: wrap; grid-column: 2 / -1; padding-top: .2rem; }
  .task.is-done .task-acts { display: flex; grid-column: 2 / -1; }
  .task.is-done .task-more { display: none; }
}

/* ---------- 🔁 Routines ---------- */

.page { max-width: 1000px; margin: 0 auto; }
.routine-group { margin-bottom: 1.4rem; }
.group-title { font-size: .85rem; font-weight: 700; color: var(--text-2); letter-spacing: .03em; text-transform: uppercase; margin: .6rem .2rem .5rem; }
.routines { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: .6rem; }
.routine { display: flex; flex-direction: column; gap: .25rem; text-align: left; padding: .8rem .9rem; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); cursor: pointer; font: inherit; min-width: 0; }
.routine:hover { border-color: var(--accent); }
.r-title { font-weight: 650; overflow-wrap: anywhere; }
.r-rule { font-size: .86rem; color: var(--accent-text); }
.r-next { font-size: .84rem; color: var(--text-2); }
.r-next.bad { color: var(--bad); }
.r-meta { font-size: .8rem; color: var(--text-3); }

/* ---------- ⚙️ Settings ---------- */

.set-list { display: flex; flex-direction: column; gap: .6rem; }
.set-sec { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); min-width: 0; }
.set-sec > summary { display: flex; align-items: baseline; gap: .5rem .8rem; flex-wrap: wrap; padding: .9rem 1.1rem; cursor: pointer; list-style: none; border-radius: var(--radius-lg); }
.set-sec > summary::-webkit-details-marker { display: none; }
.set-sec > summary::before { content: '▸'; color: var(--text-3); display: inline-block; transition: transform .15s; }
.set-sec[open] > summary::before { transform: rotate(90deg); }
.set-sec > summary:hover { background: var(--surface-2); }
.set-sec[open] > summary { border-bottom: 1px solid var(--border); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.set-title { font-weight: 700; font-size: 1rem; }
.set-body { padding: .3rem 1.1rem 1.1rem; min-width: 0; }
.place-search { margin-top: .6rem; flex-wrap: nowrap; }
.place-search .input { flex: 1; }
.place-results { display: flex; flex-direction: column; gap: .3rem; margin-top: .5rem; }
.place-btn { text-align: left; padding: .55rem .7rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); cursor: pointer; font: inherit; }
.place-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.input.time-in { width: 9rem; }
.bulk-row { margin-top: .9rem; }
/* 👤 Account: who you are, then change password, then delete account (app-api.js accountHtml). */
.acct-h { font-size: .98rem; margin: 1.3rem 0 .1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.acct-note { margin: 0; }
.danger-zone .acct-h { color: var(--bad); border-top: 0; padding-top: 0; margin-top: .6rem; }

/* ---------- the task editor ---------- */

.modal { position: fixed; inset: 0; z-index: 300; background: rgba(16, 24, 40, .45); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal-box { width: min(760px, 100%); max-height: 92vh; overflow: auto; box-shadow: var(--shadow-lg); overscroll-behavior: contain; }
.modal-box.editor { width: min(720px, 100%); padding: 1.2rem 1.3rem 1.1rem; }
.modal-foot { display: flex; justify-content: space-between; gap: .6rem; margin-top: 1rem; flex-wrap: wrap; position: sticky; bottom: -1.1rem; padding: .8rem 0 1.1rem; background: var(--surface); border-top: 1px solid var(--border); }
/* (A sticky footer stops at the box's padding: the negative bottom, as big as the padding, puts it flush.) */
.ed-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.ed-head .panel-title { margin: 0; font-size: 1.2rem; }
.ed-x { margin-left: auto; }
.ed-head .chip { font-size: .78rem; padding: .15rem .55rem; }
.ed-title { font-size: 1.05rem; font-weight: 550; }
/* The task's emoji: a button left of the title, with a little panel to type, paste, pick or ask Claude. */
.ed-title-row { display: flex; gap: .5rem; align-items: stretch; }
.ed-title-row .ed-title { flex: 1; }
.emoji-btn { position: relative; flex-shrink: 0; min-width: 2.75rem; min-height: 2.6rem; display: flex; align-items: center; justify-content: center; font-size: 1.35rem; line-height: 1; white-space: nowrap; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; padding: 0 .35rem; color: var(--text); }
.emoji-btn:hover, .emoji-btn.open { border-color: var(--accent); }
.emoji-btn.empty .emoji-face { opacity: .4; filter: grayscale(1); font-size: 1.1rem; }
.emoji-plus { position: absolute; right: .2rem; bottom: .1rem; font: 800 .72rem var(--font); color: var(--accent-text); }
.emoji-pop { margin-top: .45rem; padding: .65rem .7rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.emoji-pop-row { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
.input.emoji-in { width: 8.5rem; font-size: 1.1rem; padding: .35rem .5rem; }
.emoji-x { font-size: 1rem; line-height: 1; }
.emoji-ideas { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .5rem; }
.emoji-idea { width: 2.3rem; height: 2.3rem; display: grid; place-items: center; font-size: 1.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; padding: 0; }
.emoji-idea:hover { border-color: var(--accent); }
.emoji-idea.on { border-color: var(--accent); background: var(--accent-soft); }
.emoji-msg { margin: .4rem 0 0; }
.emoji-msg:empty { display: none; }
/* "(Claude)" next to a suggested category or emoji, like the time's. */
.ai-note { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--text-3); margin-left: .25rem; }
.ed-xp { margin: .4rem 0 0; }
.anywhere-note { margin: .45rem 0 0; font-weight: 600; color: var(--info); }
.su-anywhere { margin: .8rem 0 0; }
.date-row { display: flex; gap: .4rem; }
.date-row .input[type=date] { flex: 1; }
.date-row .input[type=time] { width: 8.5rem; flex-shrink: 0; }
.quick-dates { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .4rem; }
.ed-when .small-muted { margin: .35rem 0 0; }
.ed-where .switch-row { min-height: 2.45rem; }
.ed-where .small-muted { margin: .35rem 0 0; }
.seg.diff button { font-size: .78rem; }
.ed-sec { font-size: .98rem; margin: 1.3rem 0 .3rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.ed-est { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: .5rem; }
.ed-my-row { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.input.ed-my { width: 9rem; }
.ed-history { margin: .6rem 0 0; }
.ed-history:empty { display: none; }
.rep-tabs { margin: .5rem 0 .2rem; }
.rep-tabs button { font-size: .85rem; padding: .45rem .9rem; }
.rule-words { margin: .6rem 0 .2rem; padding: .55rem .8rem; border-radius: var(--radius); background: var(--accent-soft); color: var(--accent-text); font-weight: 600; font-size: .92rem; }
.rule-words.plain { background: var(--surface-2); color: var(--text-2); font-weight: 500; }
.rule-words.bad { background: var(--warn-soft); color: var(--warn); }
.rep-body { margin-top: .3rem; }
.rep-line { display: flex; align-items: center; gap: .45rem .55rem; flex-wrap: wrap; margin: .75rem 0; font-size: .92rem; }
.rep-k { font-size: .78rem; font-weight: 650; color: var(--text-2); text-transform: uppercase; letter-spacing: .03em; }
.rep-line .check { margin-right: .4rem; }
.rep-note { margin: -.3rem 0 .6rem; }
.input.num { width: 4.8rem; }
.input.unit { width: auto; }
.wd-pick { display: flex; gap: .25rem; flex-wrap: wrap; }
.wd { min-width: 2.7rem; padding: .35rem .4rem; font: 650 .8rem var(--font); color: var(--text-2); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; }
.wd:hover { border-color: var(--accent); }
.wd.on { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.rep-preview { margin: .5rem 0 0; font-size: .9rem; color: var(--text-2); }
.rep-preview:empty { display: none; }
.presets .btn { border-style: dashed; }
.conds { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .5rem; }
.cond { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) 5.2rem 2.2rem auto; gap: .4rem; align-items: center; }
.cond .input { padding: .45rem .55rem; font-size: .9rem; }
.cond .input.num { width: 100%; }
.cond-unit { font-size: .85rem; color: var(--text-2); }
.wx-check { margin: .8rem 0 .2rem; padding: .6rem .8rem; border-radius: var(--radius); font-size: .9rem; line-height: 1.5; }
.wx-check.ok { background: var(--good-soft); color: var(--text); }
.wx-check.ok b { color: var(--good); }
.wx-check.wait { background: var(--info-soft); color: var(--info); }
.wx-check.none, .wx-check:empty { display: none; }
.ok-mark { color: var(--good); font-weight: 700; }
.no-mark { color: var(--bad); font-weight: 700; }
.del-box { margin: .8rem 0 0; padding: .8rem .9rem; border-radius: var(--radius); background: var(--bad-soft); }
.del-box p { margin: 0 0 .6rem; }
.del-box .small-muted { margin: .6rem 0 0; color: var(--text-2); }
#ed-err:empty { min-height: 0; margin: 0; }

/* ---------- 🧭 setup (setup.js, in #setup instead of the app until it's done) ---------- */

/* The sections aren't there yet: only the account chip stays in the top bar. */
body.in-setup .nav, body.in-setup #wx-chip, body.in-setup #level-chip { display: none; }
body.in-setup .top-tools { margin-left: auto; }
.setup-wrap { padding: 1.5rem max(1rem, env(safe-area-inset-left)) 3rem; }
.setup { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 1rem; }
.setup-top-row { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; margin-bottom: .55rem; }
.setup-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .4rem; }
.setup-steps li { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.setup-bar { height: 6px; border-radius: 999px; background: var(--border); transition: background .2s; }
.setup-steps li.done .setup-bar, .setup-steps li.now .setup-bar { background: var(--accent); }
.setup-step-name { font-size: .74rem; font-weight: 600; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.setup-steps li.done .setup-step-name { color: var(--accent-text); }
.setup-steps li.now .setup-step-name { color: var(--text); }
.panel.setup-card { padding: 1.5rem 1.5rem 1.4rem; box-shadow: var(--shadow-md); }
.setup-h { margin: 0 0 .4rem; font-size: 1.5rem; font-weight: 750; letter-spacing: -.02em; line-height: 1.2; }
.setup-lede { margin: 0 0 1.1rem; color: var(--text-2); font-size: 1rem; }
.setup-points { list-style: none; margin: 0 0 1.1rem; padding: 0; display: grid; gap: .75rem; }
.setup-points li { display: flex; gap: .7rem; align-items: flex-start; color: var(--text-2); }
.setup-points b { color: var(--text); }
.setup-ico { flex-shrink: 0; width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: var(--radius-sm); background: var(--accent-soft); }
.setup-loc { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; margin: 0; padding: .7rem .9rem; border-radius: var(--radius); background: var(--surface-2); border: 1px dashed var(--border-strong); overflow-wrap: anywhere; }
.setup-loc.set { background: var(--accent-soft); border: 1px solid transparent; color: var(--text); }
p.setup-loc { margin-top: .6rem; }
.setup-here { margin-top: .8rem; }
.setup-here + .small-muted { margin: .45rem 0 0; }
.setup-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 0 1.2rem; margin-top: 1rem; padding-top: .2rem; border-top: 1px solid var(--border); }
.setup-foot { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; }
.setup-next { display: flex; align-items: center; justify-content: flex-end; gap: .5rem .8rem; flex-wrap: wrap; margin-left: auto; }
.setup-next .small-muted { text-align: right; }
.setup-next .btn, .setup-foot > .btn { padding: .6rem 1.1rem; }
.su-places { list-style: none; margin: 0 0 .4rem; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.su-place { display: flex; flex-direction: column; gap: .35rem; padding: .75rem .85rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.su-place.editing { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.su-place-head { display: flex; align-items: flex-start; gap: .4rem .75rem; flex-wrap: wrap; }
.su-place-ico { flex-shrink: 0; width: 2.4rem; height: 2.4rem; display: grid; place-items: center; font-size: 1.3rem; line-height: 1; border-radius: var(--radius); background: var(--accent-soft); }
.su-place-main { flex: 1; min-width: min(100%, 12rem); overflow-wrap: anywhere; line-height: 1.35; }
.su-place-main .small-muted { display: block; margin-top: .1rem; }
.su-place-acts { gap: .2rem; }
.su-place > .switch-row { margin-left: 3.15rem; font-size: .88rem; }
.su-form .field-label:first-child { margin-top: 0; }
.su-form-row { display: flex; gap: .7rem; align-items: flex-end; }
.su-icon-cell { flex: 0 0 4.6rem; }
.su-name-cell { flex: 1; min-width: 0; }
.input.su-icon { text-align: center; font-size: 1.2rem; padding: .38rem .3rem; }
.su-form .check.block { margin: .8rem 0 .15rem; }
.su-hint { margin: .1rem 0 .3rem 1.65rem; }
.su-form-btns { margin-top: .8rem; }
.setup-summary { list-style: none; margin: 0 0 1.3rem; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.setup-summary li { display: flex; gap: .65rem; align-items: flex-start; padding: .65rem .85rem; border-radius: var(--radius); background: var(--surface-2); overflow-wrap: anywhere; }
.setup-finish .btn { padding: .65rem 1.2rem; }

/* ---------- celebrations: an achievement tier, a new level (over the toast) ---------- */

.cheers { position: fixed; left: 50%; bottom: calc(max(1rem, env(safe-area-inset-bottom)) + 3.4rem); transform: translateX(-50%); z-index: 410; display: flex; flex-direction: column-reverse; align-items: center; gap: .45rem; width: max-content; max-width: calc(100% - 2rem); pointer-events: none; }
.cheers:empty { display: none; }
.cheer { pointer-events: auto; cursor: pointer; display: flex; align-items: center; gap: .6rem; max-width: 100%; padding: .55rem 1rem .55rem .65rem; background: var(--surface); color: var(--text); border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--border)); border-radius: 999px; box-shadow: var(--shadow-lg); font-size: .92rem; animation: cb-cheer .45s cubic-bezier(.2, 1.4, .4, 1); transition: opacity .25s, transform .25s; }
.cheer.out { opacity: 0; transform: translateY(.5rem); }
.cheer b { font-weight: 700; }
.cheer-ico { flex-shrink: 0; width: 1.9rem; height: 1.9rem; display: grid; place-items: center; border-radius: 50%; background: var(--warn-soft); font-size: 1.05rem; }
.cheer.tier-silver .cheer-ico { background: color-mix(in srgb, #98a2b3 24%, transparent); }
.cheer.tier-gold .cheer-ico { background: color-mix(in srgb, #fdb022 32%, transparent); }
.cheer.tier-platinum .cheer-ico { background: color-mix(in srgb, var(--purple) 22%, transparent); }
.cheer.level { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.cheer.level .cheer-ico { background: var(--accent-soft); }
@keyframes cb-cheer { 0% { opacity: 0; transform: translateY(.8rem) scale(.9); } 100% { opacity: 1; transform: none; } }

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

.toast { position: fixed; bottom: max(1rem, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 400; display: flex; align-items: center; gap: .8rem; font-size: .9rem; padding: .6rem 1rem; background: var(--text); color: var(--bg); border-radius: 999px; box-shadow: var(--shadow-lg); max-width: calc(100% - 2rem); width: max-content; }
/* The toast is dark on a light page and light on a dark one: its Undo needs the other green. */
.toast-btn { flex-shrink: 0; background: none; border: 0; color: #86efac; font: 700 .88rem var(--font); cursor: pointer; padding: .1rem .2rem; }
@media (prefers-color-scheme: dark) { .toast-btn { color: #15803d; } }

/* ---------- small screens ---------- */

@media (max-width: 1100px) {
  .topbar { flex-wrap: wrap; }
  .nav { order: 3; flex-basis: 100%; }
  .top-tools { margin-left: auto; }
  .lists { top: 7.4rem; max-height: calc(100vh - 8.2rem); }
}
/* Phones: the lists become a row of chips that scrolls sideways. */
@media (max-width: 760px) {
  .tasks { grid-template-columns: minmax(0, 1fr); gap: .8rem; }
  .lists { position: static; max-height: none; overflow-y: hidden; flex-direction: row; overflow-x: auto; gap: .35rem; margin: 0 -1rem; padding: 0 1rem .35rem; scrollbar-width: none; }
  .lists::-webkit-scrollbar { display: none; }
  .list-btn { flex-shrink: 0; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); padding: .35rem .7rem; font-size: .84rem; gap: .35rem; }
  .list-btn.active { border-color: transparent; }
  .list-name { overflow: visible; }
  .list-count { margin-left: .15rem; }
}
@media (max-width: 600px) {
  body { font-size: 14px; }
  .topbar { position: static; padding-top: .5rem; padding-bottom: .5rem; gap: .5rem .6rem; }
  .nav { display: grid; grid-template-columns: repeat(3, 1fr); gap: .15rem; }
  .nav-btn { font-size: .74rem; padding: .4rem .2rem; text-align: center; white-space: normal; }
  .top-tools { gap: .3rem; }
  .top-tools .chip { font-size: .76rem; padding: .25rem .5rem; }
  .wx-city, .wx-low, .lv-title, .acct-name { display: none; }
  .field-row, .field-row.three { grid-template-columns: minmax(0, 1fr); }
  .banner { font-size: .8rem; padding: .45rem 1rem; gap: .5rem; }
  .banner .grow { min-width: 0; flex-basis: calc(100% - 2rem); }
  .banner .btn { font-size: .75rem; padding: .3rem .6rem; }
  .list-title { font-size: 1.25rem; }
  .task { padding: .6rem .6rem; gap: .2rem .55rem; }
  .group-head { margin-left: .1rem; margin-right: .1rem; }
  /* The editor is the whole screen on a phone. */
  .modal.editor-open { padding: 0; align-items: stretch; }
  .modal-box.editor { width: 100%; max-height: none; height: 100%; border-radius: 0; border: 0; padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom)); }
  .modal-box.editor .modal-foot { bottom: calc(-1rem - env(safe-area-inset-bottom)); padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
  .modal { align-items: flex-start; padding: .6rem; }
  .modal-box { max-height: calc(100vh - 1.2rem); }
  .cond { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .cond select:first-child { grid-column: 1 / -1; }
  .cond .cond-unit { justify-self: start; }
  .seg.diff, .rep-tabs { display: flex; width: 100%; }
  .seg.diff button, .rep-tabs button { flex: 1 1 auto; padding-left: .4rem; padding-right: .4rem; }
  .trip-banner { font-size: .85rem; padding: .55rem .75rem; }
  /* Setup: the step names are in the line above the bar already. */
  .setup-wrap { padding-top: 1rem; }
  .setup-step-name { display: none; }
  .panel.setup-card { padding: 1.1rem 1rem 1.1rem; }
  .setup-h { font-size: 1.3rem; }
  .setup-lede { font-size: .95rem; }
  .setup .seg { display: flex; width: 100%; }
  .setup .seg button { flex: 1 1 auto; padding-left: .4rem; padding-right: .4rem; }
  .setup-next { width: 100%; }
  .setup-next .btn { flex: 1 1 auto; }
  .setup-next .small-muted { flex-basis: 100%; }
  .su-place > .switch-row { margin-left: 0; }
  .setup-finish .btn { flex: 1 1 auto; }
}
@media (max-width: 380px) {
  .brand .screen-title { font-size: 1rem; }
  .date-row { flex-wrap: wrap; }
  .date-row .input[type=time] { width: 100%; }
  .ed-head .chip { display: none; }
}
@media (max-width: 1100px) and (min-width: 601px) {
  .lv-title { max-width: 7rem; }
}
@media (prefers-reduced-motion: reduce) {
  .set-sec > summary::before, .switch, .switch::after, .setup-bar, .completed > summary > span:first-child::before, .lv-ring-fg, .cheer { transition: none; }
  /* No movement: a ticked task simply shows done, and the "+25 XP" fades where it is. */
  .task.checking .tick, .completed-n.bump, .cheer { animation: none; }
  .task.slide { transition: none; }
  .xp-pop { animation: cb-fade .9s ease-out forwards; transform: translate(-50%, -110%); }
}
@keyframes cb-fade { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }
