/* ============ Tokens ============ */
:root {
  --bg-top: #f1e6f0;
  --bg: #f4ebef;
  --bg-bottom: #f3e7e4;
  --surface: #fbf7f9;
  --card: #ffffff;
  --glass: rgba(255, 255, 255, .55);
  --card-border: rgba(150, 120, 135, .10);
  --line: rgba(120, 95, 105, .12);
  --text: #4b4446;
  --muted: #998f93;
  --faint: #cfc4c9;
  --accent: #a89f7d;
  --accent-strong: #8b8261;
  --accent-soft: #ebe5d6;
  --on-accent: #ffffff;
  --danger: #c47a7a;
  --on-pastel: #3a3134;
  --tabbar: rgba(250, 245, 248, .82);
  --shadow: 0 1px 2px rgba(120, 85, 100, .05), 0 6px 18px rgba(120, 85, 100, .06);
  --radius: 14px;
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans: 'Jost', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-top: #221d21;
    --bg: #1f1b1d;
    --bg-bottom: #1d1a1a;
    --surface: #2a2528;
    --card: #302a2e;
    --glass: rgba(48, 42, 46, .6);
    --card-border: rgba(255, 255, 255, .05);
    --line: rgba(255, 255, 255, .08);
    --text: #efe7ea;
    --muted: #a99fa4;
    --faint: #5c5357;
    --accent: #b9af8c;
    --accent-strong: #d3c9a2;
    --accent-soft: #3b382e;
    --on-accent: #1f1b1d;
    --danger: #e09a9a;
    --tabbar: rgba(34, 29, 32, .85);
    --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 6px 18px rgba(0, 0, 0, .18);
    color-scheme: dark;
  }
}

/* ============ Base ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  background-image: linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 45%, var(--bg-bottom) 100%);
  background-attachment: fixed;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
input, select, textarea { font: inherit; color: inherit; }
svg { display: block; }

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 16px) 18px calc(env(safe-area-inset-bottom) + 104px);
}

/* ============ Header ============ */
.top { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.title {
  flex: 1;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 36px;
  line-height: 1.05;
  letter-spacing: .2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.top-actions { display: flex; gap: 8px; }
.round {
  width: 38px; height: 38px; flex: none;
  border-radius: 50%;
  background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center;
  box-shadow: var(--shadow);
  transition: transform .15s ease, background .2s;
}
.round:active { transform: scale(.9); }
.round.sm { width: 30px; height: 30px; }
.round.sm svg { width: 16px; height: 16px; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; color: var(--muted); border-radius: 50%; margin-left: -8px; }
.subline { color: var(--muted); font-size: 13.5px; margin: 4px 0 12px; }
.subline b { color: var(--text); font-weight: 500; }

/* ============ Week strip ============ */
.week { display: flex; align-items: center; margin: 4px -10px 18px; }
.wk-nav { width: 26px; height: 56px; color: var(--faint); display: grid; place-items: center; flex: none; }
.wk-nav:active { color: var(--muted); }
.days { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.day {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 11px 0 13px; border-radius: 999px;
  font-size: 11px; color: var(--muted);
  transition: background .2s, color .2s;
}
.day .num { font-size: 17px; color: var(--text); font-variant-numeric: tabular-nums; }
.day.is-today .num { font-weight: 600; color: var(--accent-strong); }
.day.sel { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow); }
.day.sel .num { color: var(--on-accent); }
.dots { display: flex; gap: 2px; height: 5px; justify-content: center; }
.dots i { width: 5px; height: 5px; border-radius: 50%; }
.day.sel .dots i, .mcell.sel .dots i { box-shadow: 0 0 0 1.5px var(--on-accent); }

.today-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12.5px; color: var(--accent-strong);
  background: var(--accent-soft); padding: 4px 10px; border-radius: 999px; margin-left: 6px;
}

/* ============ Cards & blocks ============ */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--card-border); }
.panel { background: var(--glass); border-radius: 18px; padding: 4px 14px; border: 1px solid var(--card-border); }
.block { margin-bottom: 26px; }
.block-head { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 10px; gap: 10px; }
.block-head h2 { font-family: var(--serif); font-weight: 500; font-size: 23px; }
.block-head .link { font-size: 13.5px; }
.count { font-family: var(--sans); font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 6px; }

/* Summary */
.summary { display: flex; flex-direction: column; padding: 16px; margin-bottom: 24px; }
.summary[style] { background: color-mix(in srgb, var(--c) 16%, var(--card)); }
.sum-top { display: flex; gap: 16px; align-items: center; }
.sum-area { font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.dist { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.distbar { display: flex; gap: 3px; height: 10px; }
.distbar i { border-radius: 4px; min-width: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 9px; }
.legend button { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); }
.legend button i { width: 8px; height: 8px; border-radius: 50%; }
.legend button b { color: var(--text); font-weight: 500; }
.ring {
  --p: 0;
  width: 64px; height: 64px; flex: none; border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--accent-soft) 0);
  display: grid; place-items: center;
}
.ring span { width: 52px; height: 52px; border-radius: 50%; background: var(--card); display: grid; place-items: center; font-size: 14px; font-weight: 500; }
.sum-body { flex: 1; min-width: 0; }
.stats { display: flex; gap: 18px; }
.stat b { font-size: 21px; font-weight: 500; display: block; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat small { font-size: 11.5px; color: var(--muted); }
.next { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: baseline; }
.next b { color: var(--text); font-weight: 500; }
.next .tag { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-strong); background: var(--accent-soft); padding: 2px 7px; border-radius: 6px; flex: none; }
.next .txt { min-width: 0; line-height: 1.35; }

/* Agenda list */
.ag-list { display: flex; flex-direction: column; gap: 8px; }
.ag-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left; padding: 13px 14px;
  background: color-mix(in srgb, var(--c, var(--card)) 14%, var(--card));
  border-radius: 12px; box-shadow: var(--shadow); border: 1px solid color-mix(in srgb, var(--c, transparent) 22%, transparent);
  position: relative; overflow: hidden; padding-left: 17px;
  transition: transform .12s, opacity .2s;
}
.ag-item::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c); }
.badge {
  width: 32px; height: 32px; flex: none; border-radius: 10px;
  display: grid; place-items: center; font-size: 16px; line-height: 1;
  background: color-mix(in srgb, var(--c) 38%, var(--card));
}
.ag-item:active { transform: scale(.985); }
.dot-c { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; margin: 0 6px 0 4px; }
.ag-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ag-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-sub { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; }
.ag-sub > span { display: inline-flex; align-items: center; gap: 3px; overflow: hidden; text-overflow: ellipsis; }
.ag-time { font-size: 13px; color: var(--muted); text-align: right; display: flex; flex-direction: column; font-variant-numeric: tabular-nums; flex: none; }
.ag-time small { font-size: 11px; color: var(--faint); }
.ag-item.past { opacity: .5; }
.ag-item.now { border-color: var(--c); box-shadow: 0 0 0 1.5px var(--c), var(--shadow); }
.ag-item.missed .ag-time { color: var(--danger); }
.ag-item.done .ag-title { text-decoration: line-through; color: var(--muted); }

/* Check */
.check {
  width: 24px; height: 24px; flex: none; border-radius: 50%;
  border: 2px solid var(--c, var(--faint)); color: transparent;
  display: grid; place-items: center; transition: background .15s, border-color .15s, transform .15s;
}
.check:active { transform: scale(.85); }
.check.on { background: var(--c, var(--accent)); border-color: var(--c, var(--accent)); color: var(--on-pastel); }
.check.sm { width: 21px; height: 21px; }

/* Task rows */
.task { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; position: relative; }
.task::before { content: ''; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--c, transparent); }
.panel > .task:last-child, .panel > .quick:last-child { border-bottom: 0; }
.task-main { flex: 1; min-width: 0; }
.task-title { overflow-wrap: anywhere; }
.task.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-meta { display: flex; flex-wrap: wrap; gap: 3px 10px; font-size: 12px; color: var(--muted); margin-top: 2px; }
.task-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.task-meta i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.late { color: var(--danger) !important; }
.prio { color: var(--danger); }
.go { width: 21px; height: 21px; flex: none; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; opacity: .85; }
.pill {
  flex: none; font-size: 12px; padding: 5px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-strong); display: inline-flex; gap: 4px; align-items: center;
}

/* Quick add */
.quick { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.quick .plus-ic { width: 24px; height: 24px; flex: none; border-radius: 50%; border: 1.5px dashed var(--faint); display: grid; place-items: center; color: var(--muted); }
.quick input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; padding: 4px 0; font-size: 16px; }
.quick input::placeholder { color: var(--muted); }

/* Projects */
.hscroll { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -18px; padding: 2px 18px 8px; scroll-padding-inline: 18px; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.pcard { flex: 0 0 74%; scroll-snap-align: start; padding: 15px; text-align: left; display: flex; flex-direction: column; gap: 10px; }
.pcard.add { flex-basis: 40%; align-items: center; justify-content: center; color: var(--muted); border: 1.5px dashed var(--faint); background: transparent; box-shadow: none; }
.p-name { font-weight: 500; display: flex; align-items: center; gap: 8px; }
.p-name i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.p-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-meta { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.p-next { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-next b { color: var(--text); font-weight: 400; }
.bar { height: 6px; background: var(--accent-soft); border-radius: 9px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--c, var(--accent)); border-radius: 9px; transition: width .4s ease; }

.plist { display: flex; flex-direction: column; gap: 10px; }
.prow { width: 100%; text-align: left; padding: 15px 16px; display: flex; flex-direction: column; gap: 9px; position: relative; overflow: hidden; }
.prow::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.prow .p-desc { font-size: 13px; color: var(--muted); }

.p-hero { padding: 18px; margin: 8px 0 22px; display: flex; flex-direction: column; gap: 10px; }
.p-hero h2 { font-family: var(--serif); font-size: 30px; font-weight: 500; line-height: 1.1; display: flex; align-items: center; gap: 10px; }
.p-hero h2 i { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.p-hero .p-desc { color: var(--muted); font-size: 14px; }
.p-facts { display: flex; gap: 8px; flex-wrap: wrap; }
.p-facts span { font-size: 12px; background: var(--accent-soft); color: var(--accent-strong); padding: 4px 10px; border-radius: 999px; display: inline-flex; align-items: center; gap: 5px; }

/* Month */
.month-head { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 10px; }
.month-head h2 { font-family: var(--serif); font-size: 26px; font-weight: 400; text-transform: capitalize; }
.month-head .nav { display: flex; gap: 4px; }
.month-head .nav button { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.mgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; padding: 12px 10px; margin-bottom: 22px; }
.mdow { text-align: center; font-size: 11px; color: var(--muted); padding-bottom: 6px; }
.mcell { aspect-ratio: 1; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.mcell.out { color: var(--faint); }
.mcell.today .n { font-weight: 600; color: var(--accent-strong); }
.mcell.sel { background: var(--accent); color: var(--on-accent); }
.mcell.sel .n { color: var(--on-accent); }

/* Segmented / filters */
.seg { display: flex; background: var(--accent-soft); border-radius: 999px; padding: 3px; margin: 10px 0 12px; }
.seg button { flex: 1; padding: 8px 0; border-radius: 999px; font-size: 13.5px; color: var(--muted); transition: background .2s; }
.seg button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.filters { display: flex; gap: 6px; overflow-x: auto; margin: 0 -18px 6px; padding: 2px 18px 6px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.fchip { flex: none; font-size: 13px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--glass); color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.fchip i { width: 7px; height: 7px; border-radius: 50%; }
.fchip.on { background: var(--text); color: var(--bg); border-color: var(--text); }

.group-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin: 18px 2px 6px; display: flex; justify-content: space-between; }
.group-label.late { color: var(--danger); }

.empty { text-align: center; color: var(--muted); padding: 22px 12px; font-size: 14px; }
.empty .big { font-family: var(--serif); font-size: 20px; color: var(--text); display: block; margin-bottom: 2px; }

.banner { display: flex; gap: 12px; align-items: center; background: var(--accent-soft); color: var(--accent-strong); border-radius: 14px; padding: 12px 14px; font-size: 13px; margin-bottom: 18px; }
.banner p { flex: 1; }
.banner button { font-weight: 500; text-decoration: underline; text-underline-offset: 3px; flex: none; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 13px; border-radius: 12px;
  background: var(--accent); color: var(--on-accent); font-weight: 500; box-shadow: var(--shadow);
}
.btn.ghost { background: var(--card); color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.btn + .btn { margin-top: 8px; }

/* Settings */
.list-row { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); width: 100%; text-align: left; }
.panel > .list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row small { display: block; color: var(--muted); font-size: 12px; }
.list-row.danger { color: var(--danger); }
.swatch-dot { width: 22px; height: 22px; border-radius: 50%; flex: none; border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--line); }
.inline-input { width: 100%; border: 0; background: transparent; outline: none; font-size: 16px; padding: 2px 0; }
.note { font-size: 12.5px; color: var(--muted); margin: 10px 2px 0; line-height: 1.5; }

/* ============ Tab bar ============ */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center;
  background: var(--tabbar);
  backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar nav { width: 100%; max-width: 480px; display: grid; grid-template-columns: repeat(5, 1fr); }
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 0 9px; color: var(--muted); font-size: 10.5px; letter-spacing: .02em; }
.tab svg { width: 23px; height: 23px; }
.tab.active { color: var(--accent-strong); }

/* ============ Sheet ============ */
#sheet-root { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
#sheet-root:empty { display: none; }
.scrim { position: absolute; inset: 0; background: rgba(45, 28, 36, .32); opacity: 0; transition: opacity .22s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto;
  max-width: 480px; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border-radius: 22px 22px 0 0;
  padding: 8px 18px calc(env(safe-area-inset-bottom) + 24px);
  transform: translateY(100%); transition: transform .28s cubic-bezier(.2, .8, .2, 1);
  box-shadow: 0 -10px 40px rgba(60, 30, 45, .12);
}
#sheet-root.open { pointer-events: auto; }
#sheet-root.open .scrim { opacity: 1; }
#sheet-root.open .sheet { transform: none; }
.sheet::before { content: ''; display: block; width: 38px; height: 4px; border-radius: 4px; background: var(--faint); margin: 0 auto 6px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 0 12px; gap: 8px; }
.sheet-head h3 { font-family: var(--serif); font-weight: 500; font-size: 22px; text-align: center; flex: 1; }
.link { color: var(--muted); font-size: 15px; padding: 6px 2px; }
.link.strong { color: var(--accent-strong); font-weight: 600; }
.big-input { width: 100%; font-size: 21px; border: 0; background: transparent; outline: none; padding: 8px 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.big-input::placeholder { color: var(--faint); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 12.5px; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 46px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 12px; font-size: 16px; color: var(--text); outline: none;
  -webkit-appearance: none; appearance: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.field textarea { resize: vertical; min-height: 80px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.two .field { min-width: 0; }
.hint { font-size: 12px; color: var(--muted); margin: -4px 2px 16px; display: flex; gap: 6px; align-items: flex-start; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 14px; color: var(--text); cursor: pointer; transition: background .15s; }
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip i { width: 8px; height: 8px; border-radius: 50%; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { position: relative; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch span { display: block; width: 34px; height: 34px; border-radius: 50%; background: var(--c); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--text); }
.danger-btn { width: 100%; padding: 13px; border-radius: 12px; color: var(--danger); background: var(--card); border: 1px solid var(--line); margin-top: 8px; }

.choices { display: flex; flex-direction: column; gap: 10px; padding: 4px 0 6px; }
.choice { display: flex; align-items: center; gap: 14px; padding: 15px; text-align: left; width: 100%; }
.choice .ic { width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; flex: none; }
.choice b { font-weight: 500; display: block; }
.choice small { color: var(--muted); font-size: 12.5px; }

.search-box { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; margin-bottom: 8px; color: var(--muted); }
.search-box input { flex: 1; border: 0; background: transparent; outline: none; padding: 12px 0; font-size: 16px; color: var(--text); }
.search-results { min-height: 200px; }
.sr-item { display: flex; gap: 12px; align-items: center; padding: 11px 2px; border-bottom: 1px solid var(--line); width: 100%; text-align: left; }
.sr-item small { display: block; color: var(--muted); font-size: 12px; }

/* ============ Toast ============ */
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 84px); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px;
  display: flex; gap: 14px; align-items: center; transition: opacity .2s, transform .2s; white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .15);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { color: var(--accent); font-weight: 600; }

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

/* ============ Áreas da vida ============ */
.areabar { display: flex; gap: 6px; overflow-x: auto; margin: 0 -18px 16px; padding: 2px 18px 4px; scroll-padding-inline: 18px; scrollbar-width: none; }
.areabar::-webkit-scrollbar { display: none; }
.achip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px 7px 9px; border-radius: 999px; font-size: 13.5px;
  background: color-mix(in srgb, var(--c, var(--card)) 18%, var(--card));
  border: 1px solid color-mix(in srgb, var(--c, var(--line)) 40%, transparent);
  color: var(--text); transition: background .15s;
}
.achip.all { padding-left: 13px; background: var(--glass); border-color: var(--line); }
.achip .em { font-size: 14px; line-height: 1; }
.achip.on { background: var(--c); border-color: var(--c); color: var(--on-pastel); font-weight: 500; }
.achip.all.on { background: var(--text); border-color: var(--text); color: var(--bg); }

.head-tools { display: flex; align-items: center; gap: 8px; }
.mini-seg { display: flex; background: var(--accent-soft); border-radius: 999px; padding: 2px; }
.mini-seg button { font-size: 12px; padding: 5px 10px; border-radius: 999px; color: var(--muted); }
.mini-seg button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

.area-group {
  border-radius: 18px; padding: 10px; margin-bottom: 12px;
  background: color-mix(in srgb, var(--c) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 32%, transparent);
}
.area-group-head { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; font-weight: 500; padding: 2px 4px 10px; color: var(--text); }
.area-group-head svg { color: var(--muted); }
.area-group .ag-item { background: var(--card); }

.p-area { font-size: 12px; color: var(--muted); display: inline-flex; gap: 5px; align-items: center; align-self: flex-start; padding: 3px 9px; border-radius: 999px; background: color-mix(in srgb, var(--c) 22%, transparent); }
.prow::before { background: var(--c); }

.agrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.acard {
  text-align: left; padding: 15px; border-radius: 20px; min-height: 132px;
  display: flex; flex-direction: column; gap: 6px;
  background: color-mix(in srgb, var(--c) 24%, var(--card));
  border: 1px solid color-mix(in srgb, var(--c) 40%, transparent);
  box-shadow: var(--shadow); transition: transform .12s;
}
.acard:active { transform: scale(.97); }
.acard .em { font-size: 28px; line-height: 1; margin-bottom: 4px; }
.acard b { font-weight: 500; font-size: 16px; }
.acard small { font-size: 12px; color: var(--muted); line-height: 1.45; }
.acard small strong { color: var(--text); font-weight: 500; }
.acard.add { align-items: center; justify-content: center; color: var(--muted); background: transparent; border: 1.5px dashed var(--faint); box-shadow: none; }

.a-hero {
  margin: 4px 0 24px; padding: 20px; border-radius: 22px;
  background: color-mix(in srgb, var(--c) 30%, var(--card));
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  display: flex; flex-direction: column; gap: 8px;
}
.a-hero .em { font-size: 40px; line-height: 1; }
.a-hero h2 { font-family: var(--serif); font-size: 34px; font-weight: 500; line-height: 1.05; }
.a-stats { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.a-stats b { color: var(--text); font-weight: 500; font-size: 15px; }
.a-actions { display: flex; gap: 8px; margin-top: 6px; }
.a-actions button { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 999px; background: var(--card); font-size: 14px; box-shadow: var(--shadow); }
.a-actions button:last-child { margin-left: auto; padding: 9px 11px; }

.chip.area span { background: color-mix(in srgb, var(--c) 14%, var(--card)); border-color: color-mix(in srgb, var(--c) 40%, transparent); }
.chip.area input:checked + span { background: var(--c); border-color: var(--c); color: var(--on-pastel); font-weight: 500; }
.chip .em { font-weight: 400; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.emo { position: relative; }
.emo input { position: absolute; opacity: 0; pointer-events: none; }
.emo span { display: grid; place-items: center; aspect-ratio: 1; border-radius: 10px; font-size: 20px; background: var(--card); border: 1px solid var(--line); cursor: pointer; }
.emo input:checked + span { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.swatch.used span { position: relative; }
.swatch.used span::after { content: ''; position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--on-pastel); opacity: .45; left: 50%; top: 50%; transform: translate(-50%, -50%); }

.toggle-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.toggle-row input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-row .sw { width: 42px; height: 26px; border-radius: 999px; background: var(--faint); position: relative; flex: none; transition: background .2s; }
.toggle-row .sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle-row input:checked + .sw { background: var(--accent); }
.toggle-row input:checked + .sw::after { transform: translateX(16px); }
.toggle-row .grow { flex: 1; font-size: 15px; }
.toggle-row small { display: block; font-size: 12px; color: var(--muted); }
.sr-item .badge { width: 30px; height: 30px; font-size: 15px; }
.sr-item .grow { flex: 1; min-width: 0; }
.area-group-head .grow { flex: 1; min-width: 0; }

/* ============ Login ============ */
#login-root:empty { display: none; }
.login {
  position: fixed; inset: 0; z-index: 80; overflow-y: auto;
  background: var(--bg); background-image: linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 45%, var(--bg-bottom) 100%);
  display: flex; align-items: center; justify-content: center;
  padding: calc(env(safe-area-inset-top) + 24px) 22px calc(env(safe-area-inset-bottom) + 24px);
}
.login-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; text-align: center; }
.login-icon { width: 72px; height: 72px; border-radius: 18px; margin: 0 auto 14px; box-shadow: var(--shadow); }
.login-card h1 { font-family: var(--serif); font-weight: 400; font-size: 40px; line-height: 1.1; margin-bottom: 8px; }
.login-card > p { color: var(--muted); font-size: 14px; margin-bottom: 22px; line-height: 1.5; }
.login-card > p b { color: var(--text); font-weight: 500; }
.login-card .field { text-align: left; }
.login-card .btn { margin-top: 4px; padding: 14px; font-size: 16px; }
.login-card .btn:disabled { opacity: .6; }
.login-card .link { margin-top: 12px; }
.login-card .note { text-align: center; }
.login-err { color: var(--danger); font-size: 13.5px; min-height: 18px; margin: -4px 0 8px; }
.list-row > svg { flex: none; color: var(--muted); }
