/* LEVEL UP — mobile-first stylesheet */

:root {
  --bg: #0b0d14;
  --bg-grad: radial-gradient(1200px 600px at 80% -10%, rgba(139, 92, 246, .10), transparent 60%);
  --surface: #131722;
  --surface-2: #1a1f2d;
  --surface-3: #232a3b;
  --border: rgba(148, 163, 184, .13);
  --text: #e8eaf2;
  --muted: #9ba3b9;
  --accent: #8b5cf6;
  --accent-2: #3b82f6;
  --accent-text: #c4b5fd;
  --accent-soft: rgba(139, 92, 246, .16);
  --on-accent: #ffffff;
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, .14);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, .13);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, .14);
  --track: rgba(148, 163, 184, .16);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --radius: 16px;
  --radius-sm: 10px;
  --sab: env(safe-area-inset-bottom, 0px);
  --sat: env(safe-area-inset-top, 0px);
  --nav-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f5f6fb;
  --bg-grad: radial-gradient(1200px 600px at 80% -10%, rgba(124, 58, 237, .07), transparent 60%);
  --surface: #ffffff;
  --surface-2: #f2f3f9;
  --surface-3: #e7e9f2;
  --border: rgba(15, 23, 42, .1);
  --text: #12162a;
  --muted: #535b73;
  --accent: #7c3aed;
  --accent-2: #2563eb;
  --accent-text: #6d28d9;
  --accent-soft: rgba(124, 58, 237, .1);
  --ok: #047857;
  --ok-soft: rgba(5, 150, 105, .1);
  --warn: #a16207;
  --warn-soft: rgba(217, 119, 6, .1);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, .08);
  --track: rgba(15, 23, 42, .09);
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 6px 20px rgba(15, 23, 42, .06);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text);
  background: var(--bg); background-image: var(--bg-grad); background-attachment: fixed;
  -webkit-font-smoothing: antialiased; overflow-x: hidden; min-height: 100dvh;
}
body.modal-open { overflow: hidden; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0 0 .5em; }
a { color: var(--accent-text); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg.icon { flex-shrink: 0; vertical-align: middle; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 8px; }
.skip-link:focus { top: calc(8px + var(--sat)); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.strike { text-decoration: line-through; }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }
.danger-text { color: var(--danger) !important; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.row-end { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.row-end.wrap, .row-wrap { flex-wrap: wrap; }
.row-wrap { display: flex; gap: 8px; margin: 8px 0; }
.stack { display: grid; gap: 16px; align-content: start; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-text); margin: 0 0 6px; display: flex; align-items: center; gap: 6px; }
.hide-mobile { display: none !important; }
.show-mobile { display: inline; }
em { font-style: normal; color: var(--muted); font-weight: 400; }

/* ---------- Boot & spinner ---------- */
.boot { display: flex; gap: 12px; align-items: center; justify-content: center; min-height: 100dvh; color: var(--muted); }
.spinner { width: 20px; height: 20px; border: 2px solid var(--track); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Shell ---------- */
.sidebar { display: none; }
.main-col { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: calc(10px + var(--sat)) 16px 10px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--border);
}
.tb-char { position: relative; display: inline-flex; text-decoration: none; }
.tb-level { position: absolute; right: -4px; bottom: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); }
.tb-xp { flex: 1; min-width: 0; display: grid; gap: 6px; }
main { padding: 16px 16px calc(var(--nav-h) + 32px + var(--sab)); outline: none; max-width: 1240px; margin: 0 auto; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  height: calc(var(--nav-h) + var(--sab)); padding-bottom: var(--sab);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}
.bn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 100%; min-height: 48px; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 500; background: none; border: 0; }
.bn.active { color: var(--accent-text); }
.bn.active svg { stroke-width: 2.4; }
.fab {
  justify-self: center; width: 56px; height: 56px; margin-top: -26px; border-radius: 18px; border: 0; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 8px 22px rgba(124, 58, 237, .45);
  display: grid; place-items: center; transition: transform .15s;
}
.fab:active { transform: scale(.94); }

/* ---------- Typography / page ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin: 4px 0 16px; }
.page-title { font-size: 24px; font-weight: 700; }
.card-title { font-size: 16px; font-weight: 650; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.section-head h2 { font-size: 16px; font-weight: 650; }
.list-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 20px 0 10px; }
.sub-h { font-size: 14px; font-weight: 650; margin: 16px 0 8px; }
.link, .link-btn { color: var(--accent-text); text-decoration: none; font-weight: 500; background: none; border: 0; padding: 0; text-align: left; }
.link:hover, .link-btn:hover { text-decoration: underline; }
.field-label { font-weight: 600; font-size: 13px; margin: 18px 0 8px; }

/* ---------- Cards & grids ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card.flush { padding: 6px; }
.card.mini { padding: 12px 14px; display: grid; gap: 4px; }
.card.mini strong { font-size: 20px; }
.cards { gap: 16px; margin-bottom: 16px; }
.grid-2, .grid-3, .grid-4 { display: grid; gap: 12px; grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: repeat(2, 1fr); }
.dash-grid, .dash-cols { display: grid; gap: 16px; margin-bottom: 16px; }
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px; }
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px; min-width: 0; }
.stat > div { min-width: 0; display: grid; }
.stat-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex-shrink: 0; }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.stat-sub { font-size: 12px; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 12px;
  border: 1px solid transparent; font-weight: 600; font-size: 14px; text-decoration: none; transition: background .15s, transform .1s, border-color .15s; white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--accent-2))); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn.ghost:hover { background: var(--surface-3); }
.btn.ghost.fav { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.btn.ghost.fav svg { fill: currentColor; }
.btn.danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); flex-shrink: 0; }
.icon-btn:hover { background: var(--surface-3); }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.icon-btn.subtle { border-color: transparent; background: transparent; color: var(--muted); }
.icon-btn.subtle:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.sm { width: 36px; height: 36px; border-radius: 10px; }
.file-btn { cursor: pointer; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field > span, .field > legend { font-size: 13px; font-weight: 600; padding: 0; }
.field legend { margin-bottom: 6px; }
.hint { color: var(--muted); font-size: 12px; }
.err { color: var(--danger); font-size: 12px; min-height: 0; }
.err:empty { display: none; }
.input {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2);
  font-size: 16px; /* prevents iOS zoom */ transition: border-color .15s, box-shadow .15s; min-width: 0;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input.lg { font-size: 17px; min-height: 50px; }
.input.sm { min-height: 38px; padding: 6px 10px; font-size: 15px; }
select.input { appearance: none; -webkit-appearance: none; 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; }
textarea.input { resize: vertical; min-height: 72px; }
input[type="date"].input, input[type="time"].input, input[type="month"].input { min-height: 44px; }

.segmented { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; }
.segmented.two { grid-template-columns: 1fr 1fr; }
.segmented.three { grid-template-columns: repeat(3, 1fr); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented span { display: grid; place-items: center; text-align: center; min-height: 40px; padding: 4px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--muted); line-height: 1.2; }
.segmented span small { font-weight: 500; font-size: 11px; opacity: .85; }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check { position: relative; }
.chip-check input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip-check span { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); font-size: 14px; font-weight: 500; }
.chip-check input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.chip-check input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.toggle { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; min-height: 44px; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { width: 44px; height: 26px; border-radius: 13px; background: var(--surface-3); position: relative; flex-shrink: 0; transition: background .2s; margin-top: 2px; }
.switch::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, .3); }
.toggle input:checked + .switch { background: var(--accent); }
.toggle input:checked + .switch::after { transform: translateX(18px); }
.toggle input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle-text { display: grid; font-weight: 500; }

details.more { border-top: 1px solid var(--border); padding-top: 10px; }
details.more > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; color: var(--accent-text); min-height: 36px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] > summary svg { transform: rotate(180deg); }
details.more > *:not(summary) { margin-top: 12px; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form .input { flex: 1; }

/* ---------- Chips, badges, progress ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--accent)); display: inline-block; flex-shrink: 0; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.badge.pri-high { background: var(--warn-soft); color: var(--warn); }
.badge.pri-critical { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: rgba(59, 130, 246, .15); color: #93c5fd; }
[data-theme="light"] .badge.info { color: #1d4ed8; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.sample { background: var(--accent-soft); color: var(--accent-text); }
.progress { height: 8px; border-radius: 999px; background: var(--track); overflow: hidden; }
.progress > div { height: 100%; border-radius: inherit; background: var(--accent); transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.progress.xp > div { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.progress.ok > div { background: var(--ok); }
.progress.sm { height: 6px; }
.progress.xs { height: 4px; }
.xp-pill { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; color: var(--accent-text); background: var(--accent-soft); padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.xp-pill.earned { color: var(--ok); background: var(--ok-soft); }
.count { margin-left: 6px; font-size: 11px; padding: 0 6px; border-radius: 999px; background: var(--surface-3); color: var(--muted); }
.count.warn { background: var(--warn-soft); color: var(--warn); }

.chip-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chip-tabs.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: -16px; margin-right: -16px; padding: 0 16px 2px; }
.chip-tabs.scroll::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.tab.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.tab.on .count { background: color-mix(in srgb, var(--bg) 20%, transparent); color: inherit; }

/* ---------- Banners & empty states ---------- */
.banner { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 14px; border-radius: 14px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); margin-bottom: 16px; font-size: 13px; }
.banner > span { flex: 1 1 200px; }
.banner.soft { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.empty { text-align: center; padding: 28px 16px; display: grid; justify-items: center; gap: 6px; color: var(--muted); }
.empty h3 { color: var(--text); font-size: 16px; }
.empty p { max-width: 340px; margin: 0 auto 8px; font-size: 14px; }
.empty.small { padding: 16px; }
.empty-icon { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); margin-bottom: 4px; }
.success-note { display: flex; gap: 8px; align-items: center; color: var(--ok); font-weight: 600; font-size: 14px; margin: 12px 4px 0; }
.overdue-note { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--warn); text-decoration: none; padding: 10px 12px; background: var(--warn-soft); border-radius: 12px; margin-bottom: 10px; }

/* ---------- Character & dashboard ---------- */
.avatar { display: inline-grid; place-items: center; border-radius: 30%; background: linear-gradient(135deg, var(--av), color-mix(in srgb, var(--av) 50%, #1e1b4b)); color: #fff; font-weight: 700; flex-shrink: 0; letter-spacing: .02em; }
.character { background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 14%, var(--surface)), var(--surface) 60%); }
.char-top { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.char-avatar { position: relative; text-decoration: none; }
.level-badge { position: absolute; right: -6px; bottom: -6px; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px; display: grid; place-items: center; font-size: 13px; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: 3px solid var(--surface); }
.level-badge.big { position: static; width: 84px; height: 84px; border-radius: 28px; font-size: 36px; margin: 0 auto 12px; border: 0; box-shadow: 0 10px 30px rgba(124, 58, 237, .45); }
.char-name { font-size: 20px; font-weight: 700; overflow-wrap: anywhere; }
.char-id { min-width: 0; }
.char-id .eyebrow { margin-bottom: 2px; }
.char-xp { display: grid; gap: 6px; margin-bottom: 14px; }
.char-xp .progress { height: 10px; }
.char-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.char-stats > div { background: var(--surface-2); border-radius: 12px; padding: 8px 10px; display: grid; }
.char-stats strong { font-size: 15px; display: flex; align-items: center; gap: 4px; }
.flame { color: #fb923c; }

.daily-body { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; }
.daily-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; flex: 1; min-width: 0; }
.daily-list li { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.daily-list li span { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.ring { position: relative; flex-shrink: 0; }
.ring-bar { transition: stroke-dashoffset .7s cubic-bezier(.2, .8, .2, 1); }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-label strong { font-size: 22px; line-height: 1.1; }
.ring-label span { font-size: 11px; color: var(--muted); }

.quote-card blockquote { margin: 6px 0 10px; }
.quote-text { font-size: 18px; line-height: 1.45; font-weight: 600; margin-bottom: 4px; }
.quote-why { font-size: 14px; color: var(--muted); }
.quote-action { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; padding: 10px 12px; background: var(--surface-2); border-radius: 12px; margin: 10px 0; }
.quote-action svg { color: var(--accent-text); margin-top: 2px; }
.quote-q { display: flex; gap: 6px; align-items: flex-start; }
.quote-btns { display: flex; gap: 8px; flex-wrap: wrap; }

.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.quick-btn { display: grid; justify-items: center; gap: 6px; padding: 12px 6px; min-height: 76px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 12px; font-weight: 600; text-decoration: none; text-align: center; }
.quick-btn svg { color: var(--accent-text); }
.quick-btn:hover { background: var(--surface-3); }

.priorities { background: var(--surface-2); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; }
.priorities ol { margin: 0; padding-left: 20px; font-size: 14px; }

/* ---------- Tasks ---------- */
.task-list { list-style: none; margin: 0; padding: 0; }
.task-group + .task-group { margin-top: 12px; }
.group-title { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; margin: 4px 4px 4px; }
.task { display: flex; align-items: center; gap: 10px; padding: 10px 6px; border-radius: 12px; transition: background .15s; }
.task + .task { border-top: 1px solid var(--border); }
.task:hover { background: var(--surface-2); }
.task-main { flex: 1; min-width: 0; }
.task-title { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 2px 0; font-weight: 600; font-size: 15px; overflow-wrap: anywhere; color: var(--text); }
.task.done .task-title { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.task.skipped .task-title { color: var(--muted); }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: 2px; }
.meta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.meta.warn { color: var(--warn); }

.check {
  width: 44px; height: 44px; flex-shrink: 0; display: grid; place-items: center; border-radius: 14px; border: 2px solid color-mix(in srgb, var(--muted) 55%, transparent);
  background: transparent; color: transparent; transition: background .15s, border-color .15s, transform .15s;
}
.check svg { transition: transform .2s; transform: scale(.6); }
.check:hover { border-color: var(--accent); color: color-mix(in srgb, var(--accent) 50%, transparent); }
.check.on { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; }
.check.on svg { transform: scale(1); }
.check:disabled { opacity: .4; }
.check.lg { width: 52px; height: 52px; border-radius: 16px; }
.check.sm { width: 32px; height: 32px; border-radius: 10px; }
.just-done .check { animation: pop .45s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop { 0% { transform: scale(.8); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }

.toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.search { grid-column: 1 / -1; position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .input { padding-left: 40px; }

.upcoming { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.upcoming li { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: 14px; }
.upcoming .link-btn { flex: 1; min-width: 0; color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.up-date { font-size: 12px; color: var(--muted); width: 72px; flex-shrink: 0; }

/* ---------- Habits ---------- */
.habit-mini, .habit-quick { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.habit-mini li, .habit-quick li { display: flex; align-items: center; gap: 10px; min-height: 52px; }
.hm-name, .hq-name { display: grid; flex: 1; min-width: 0; font-weight: 600; font-size: 14px; }
.hm-name small, .hq-name small { font-weight: 400; display: flex; align-items: center; gap: 4px; }
.habit-mini li.met .hm-name > :first-child { color: var(--muted); }
.habit-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.habit { display: grid; gap: 12px; }
.habit.met { border-color: color-mix(in srgb, var(--ok) 35%, var(--border)); }
.habit-top { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.habit-info { min-width: 0; flex: 1 1 180px; }
.habit-info h3 { font-size: 16px; margin-bottom: 4px; overflow-wrap: anywhere; }
.habit-ctrl { display: flex; align-items: center; gap: 8px; }
.habit-count { display: grid; text-align: center; min-width: 44px; line-height: 1.1; font-size: 13px; color: var(--muted); }
.habit-count strong { font-size: 18px; color: var(--text); }
.habit-count small { font-size: 11px; }
.habit-bottom { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.streaks { display: flex; gap: 12px; font-size: 13px; align-items: center; flex-wrap: wrap; }
.week-dots { display: flex; gap: 4px; }
.wd { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 600; display: grid; place-items: center; padding: 0; }
.wd.on { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 50%, transparent); color: var(--ok); }
.wd.rest { opacity: .45; border-style: dashed; }
.wd.today { box-shadow: inset 0 0 0 2px var(--accent); }

/* ---------- Goals ---------- */
.goal-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.goal { display: grid; gap: 10px; }
.goal.completed { border-color: color-mix(in srgb, var(--ok) 35%, var(--border)); }
.goal.paused, .goal.abandoned { opacity: .75; }
.goal-title { font-size: 18px; overflow-wrap: anywhere; }
.goal-reason { font-size: 14px; color: var(--muted); display: flex; gap: 6px; align-items: flex-start; margin: 0; }
.goal-reason svg { color: #f472b6; margin-top: 3px; }
.goal-facts { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); }
.goal-facts span { display: inline-flex; gap: 4px; align-items: center; }
.timeline { position: relative; display: grid; gap: 2px; padding-left: 4px; }
.tl-item { display: flex; align-items: center; gap: 10px; min-height: 44px; position: relative; }
.tl-item:not(:last-of-type)::after { content: ""; position: absolute; left: 15px; top: 38px; bottom: -8px; width: 2px; background: var(--track); }
.tl-item.done::after { background: color-mix(in srgb, var(--accent) 50%, transparent) !important; }
.tl-title { flex: 1; min-width: 0; display: grid; font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.tl-item.done .tl-title { color: var(--muted); }
.goal-mini { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.plain { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }

/* ---------- Sales ---------- */
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.month-nav h2 { font-size: 17px; }
.sales-hero { display: grid; gap: 8px; margin-bottom: 16px; }
.big-num { font-size: 32px; font-weight: 800; letter-spacing: -.02em; margin: 0; overflow-wrap: anywhere; }
.sales-msg { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); margin: 4px 0 0; }
.sales-msg.ok { background: var(--ok-soft); }
.sales-msg.soft { background: var(--warn-soft); }
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px 6px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: 12px; color: var(--muted); font-weight: 600; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.actions { text-align: right; white-space: nowrap; width: 1%; }

/* ---------- Charts ---------- */
.bars, .line { margin: 0; }
.bars-plot { position: relative; display: flex; align-items: flex-end; gap: 3px; border-bottom: 1px solid var(--border); }
.bar-col { flex: 1; height: 100%; display: flex; align-items: flex-end; min-width: 0; }
.bar { width: 100%; border-radius: 5px 5px 2px 2px; background: color-mix(in srgb, var(--accent) 55%, transparent); transition: height .5s; min-height: 0; }
.bar.bar-hi { background: linear-gradient(180deg, var(--accent), var(--accent-2)); }
.bar-target { position: absolute; left: 0; right: 0; border-top: 1px dashed color-mix(in srgb, var(--ok) 70%, transparent); pointer-events: none; }
.bar-target span { position: absolute; right: 0; top: -18px; font-size: 11px; color: var(--ok); background: var(--surface); padding: 0 4px; }
.bars-labels { display: flex; justify-content: space-between; gap: 3px; font-size: 11px; color: var(--muted); margin-top: 6px; }
.bars .bars-labels span { flex: 1; text-align: center; white-space: nowrap; overflow: visible; min-width: 0; }
.line-plot { position: relative; border-bottom: 1px solid var(--border); }
.line-plot svg { width: 100%; height: 100%; display: block; overflow: visible; }
.line-main { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.line-pace { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 5 5; }
.line-max { position: absolute; left: 0; top: -2px; font-size: 11px; color: var(--muted); }
.legend { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); margin-top: 8px; }
.lgd { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.lgd-main { background: var(--accent); }
.lgd-pace { background: repeating-linear-gradient(90deg, var(--muted) 0 4px, transparent 4px 7px); margin-left: 8px; }
.hbars { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.hbar-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.hbar-head span { display: flex; align-items: center; gap: 6px; }
.heatmap { display: flex; gap: 6px; }
.hm-days { display: grid; grid-template-rows: repeat(7, 1fr); font-size: 10px; color: var(--muted); gap: 3px; }
.hm-days span { line-height: 1; display: flex; align-items: center; }
.hm-grid { flex: 1; display: grid; grid-template-rows: repeat(7, auto); grid-auto-flow: column; gap: 3px; }
.hm-cell { aspect-ratio: 1; border-radius: 3px; background: var(--track); display: block; min-width: 0; }
.hm-1 { background: color-mix(in srgb, var(--accent) 30%, var(--track)); }
.hm-2 { background: color-mix(in srgb, var(--accent) 55%, var(--track)); }
.hm-3 { background: color-mix(in srgb, var(--accent) 80%, var(--track)); }
.hm-4 { background: var(--accent-2); }
.hm-future { background: transparent; }
.hm-legend { display: flex; align-items: center; gap: 3px; justify-content: flex-end; font-size: 11px; color: var(--muted); margin-top: 8px; }
.hm-legend .hm-cell { width: 11px; height: 11px; }
.kv { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.kv li { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.kv li span { color: var(--muted); }
.kv li strong { text-align: right; }
.bullets { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; }
.review .grid-3 > div { min-width: 0; }

/* ---------- Achievements ---------- */
.ach-grid { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 12px; }
.ach { display: flex; gap: 14px; align-items: flex-start; }
.ach-body { flex: 1; min-width: 0; display: grid; gap: 4px; }
.ach-body h3 { font-size: 15px; }
.ach-body p { margin: 0; }
.ach-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); flex-shrink: 0; }
.ach.on .ach-icon { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 6px 18px rgba(124, 58, 237, .35); }
.ach:not(.on) { opacity: .85; }

/* ---------- Plan & review ---------- */
.pri-input { display: flex; align-items: center; gap: 10px; }
.pri-num { width: 28px; height: 28px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.scheduled { background: var(--surface-2); border-radius: 12px; padding: 12px; }
.review-sum { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.review-sum strong { color: var(--text); font-size: 18px; }
.done-list li { display: flex; gap: 6px; align-items: center; color: var(--ok); }
.done-list li span, .done-list { color: var(--text); }
.done-list { margin-bottom: 12px; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; margin: 12px 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.past-reviews { display: grid; gap: 4px; }

/* ---------- Settings ---------- */
.settings { display: grid; gap: 16px; }
.profile-row { display: flex; gap: 14px; align-items: flex-end; }
.grow { flex: 1; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { position: relative; width: 40px; height: 40px; }
.swatch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.swatch::before { content: ""; position: absolute; inset: 0; border-radius: 12px; background: var(--sw); }
.swatch:has(input:checked)::after { content: ""; position: absolute; inset: -4px; border-radius: 15px; border: 2px solid var(--text); }
.swatch:has(input:focus-visible)::after { content: ""; position: absolute; inset: -4px; border-radius: 15px; border: 2px solid var(--accent); }
.quote-list { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 8px; }
.quote-list li { display: flex; gap: 8px; justify-content: space-between; align-items: flex-start; font-size: 14px; background: var(--surface-2); padding: 10px 12px; border-radius: 12px; }
.quote-list li span { display: grid; gap: 2px; min-width: 0; }
.cat-list li { display: flex; justify-content: space-between; align-items: center; }

/* ---------- Overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.backdrop { position: absolute; inset: 0; background: rgba(5, 6, 12, .6); backdrop-filter: blur(3px); animation: fade .18s ease-out; }
.sheet {
  position: relative; width: 100%; max-height: 92dvh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
  border-radius: 22px 22px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .35); animation: sheetUp .26s cubic-bezier(.2, .9, .3, 1); outline: none;
  padding-bottom: var(--sab);
}
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 8px auto 0; flex-shrink: 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px 6px 20px; flex-shrink: 0; }
.sheet-head h2 { font-size: 18px; overflow-wrap: anywhere; }
.sheet-body { padding: 8px 20px 20px; overflow-y: auto; overscroll-behavior: contain; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.sheet-actions .btn { flex: 1; }
.sheet-actions.center { justify-content: center; flex-wrap: wrap; }
.sheet-actions.sticky { position: sticky; bottom: -20px; background: var(--surface); padding: 12px 0 0; margin-bottom: -4px; }
.overlay.closing .sheet { animation: sheetDown .16s ease-in forwards; }
.overlay.closing .backdrop { animation: fade .16s reverse forwards; }
@keyframes fade { from { opacity: 0; } }
@keyframes sheetUp { from { transform: translateY(100%); } }
@keyframes sheetDown { to { transform: translateY(100%); } }
.detail { display: grid; gap: 4px; }
.detail-actions { display: grid; gap: 8px; margin-top: 12px; }
.subtasks { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 2px; }
.sub-check { display: flex; gap: 10px; align-items: center; min-height: 44px; cursor: pointer; font-size: 14px; }
.sub-check input { width: 20px; height: 20px; accent-color: var(--accent); }
.sub-check input:checked + span { text-decoration: line-through; color: var(--muted); }
.more-menu { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.more-link { display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 0 12px; border-radius: 12px; color: var(--text); text-decoration: none; font-weight: 600; }
.more-link span { flex: 1; }
.more-link:hover { background: var(--surface-2); }
.more-link svg:first-child { color: var(--accent-text); }
.more-quick { display: grid; gap: 8px; margin-top: 12px; }
.focus-body { text-align: center; }
.focus-time { font-size: 56px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; margin: 8px 0; }

/* celebrate */
.celebrate .sheet-body { padding-top: 24px; }
.celebrate-body { text-align: center; position: relative; padding: 8px 0 4px; }
.celebrate-body h2 { font-size: 24px; margin-bottom: 8px; }
.celebrate-body .eyebrow { justify-content: center; }
.celebrate-body .btn { margin-top: 12px; }
.burst { position: absolute; left: 50%; top: 50px; width: 0; height: 0; pointer-events: none; }
.burst i { position: absolute; width: 8px; height: 8px; border-radius: 2px; background: var(--accent); transform: rotate(calc(var(--i) * 30deg)) translateY(0); animation: burst 1s cubic-bezier(.1, .8, .3, 1) forwards; opacity: 0; }
.burst i:nth-child(3n) { background: var(--accent-2); }
.burst i:nth-child(4n) { background: #fbbf24; }
@keyframes burst { 0% { opacity: 1; transform: rotate(calc(var(--i) * 30deg)) translateY(0); } 100% { opacity: 0; transform: rotate(calc(var(--i) * 30deg)) translateY(-110px); } }

/* toasts & XP */
.toasts { position: fixed; left: 12px; right: 12px; bottom: calc(var(--nav-h) + 14px + var(--sab)); z-index: 80; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 460px; width: 100%; padding: 10px 12px 10px 14px; border-radius: 14px; background: var(--surface-3); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow); font-size: 14px; animation: toastIn .22s ease-out; }
.toast > span:not(.ach-icon) { flex: 1; }
.toast-success svg { color: var(--ok); }
.toast-error { border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.toast-error svg { color: var(--danger); }
.toast-info svg { color: var(--accent-text); }
.toast.out { opacity: 0; transform: translateY(8px); transition: .2s; }
.toast-action { background: none; border: 0; color: var(--accent-text); font-weight: 700; padding: 8px; min-height: 36px; }
.toast-achievement { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 30%, var(--surface-3)), var(--surface-3)); }
.toast-achievement .ach-icon { width: 36px; height: 36px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }
.xp-float { white-space: nowrap; position: fixed; z-index: 90; transform: translate(-50%, -50%); font-weight: 800; font-size: 18px; color: var(--accent-text); text-shadow: 0 2px 10px rgba(124, 58, 237, .5); pointer-events: none; animation: xpUp 1.1s ease-out forwards; }
.xp-float.neg { color: var(--muted); text-shadow: none; }
@keyframes xpUp { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.8); } 20% { opacity: 1; transform: translate(-50%, -80%) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -260%) scale(1); } }

.focus-pill { position: fixed; right: 16px; bottom: calc(var(--nav-h) + 16px + var(--sab)); z-index: 40; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 0; background: var(--text); color: var(--bg); font-weight: 700; font-variant-numeric: tabular-nums; box-shadow: var(--shadow); }
.focus-pill[hidden] { display: none; }

/* ---------- Onboarding ---------- */
.onboarding { position: fixed; inset: 0; z-index: 70; background: var(--bg); background-image: var(--bg-grad); overflow-y: auto; display: flex; justify-content: center; padding: calc(16px + var(--sat)) 16px calc(16px + var(--sab)); }
.ob-card { width: 100%; max-width: 560px; display: flex; flex-direction: column; gap: 16px; min-height: 100%; }
.ob-progress { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding-top: 8px; }
.ob-progress span { height: 4px; border-radius: 2px; background: var(--track); }
.ob-progress span.on { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.ob-body { flex: 1; display: grid; gap: 14px; align-content: start; padding-top: 12px; }
.ob-body h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; outline: none; }
.ob-actions { display: flex; gap: 8px; position: sticky; bottom: 0; padding: 12px 0; background: var(--bg); }
.ob-actions .btn { flex: 1; min-height: 50px; }
.ob-skip { align-self: center; padding: 8px; }

/* ---------- Tablet ---------- */
@media (min-width: 640px) {
  .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .toolbar { grid-template-columns: 1fr 200px 180px; }
  .search { grid-column: auto; }
  .quick-grid { grid-template-columns: repeat(6, 1fr); }
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .goal-grid, .ach-grid { grid-template-columns: 1fr 1fr; }
  .hide-mobile { display: revert !important; }
  .show-mobile { display: none; }
  .overlay { align-items: center; padding: 24px; }
  .sheet { max-width: 560px; border-radius: 22px; max-height: 88dvh; animation: dialogIn .2s ease-out; padding-bottom: 0; }
  .sheet.small { max-width: 440px; }
  .sheet-grip { display: none; }
  .sheet-head { padding-top: 16px; }
  .overlay.closing .sheet { animation: fade .16s reverse forwards; }
  .sheet-actions .btn { flex: 0 0 auto; }
  .toasts { left: auto; right: 24px; justify-items: end; }
  .chip-tabs.scroll { margin: 0 0 14px; padding: 0; flex-wrap: wrap; }
  @keyframes dialogIn { from { opacity: 0; transform: translateY(12px) scale(.98); } }
}

/* ---------- Desktop ---------- */
@media (min-width: 1024px) {
  body { font-size: 15px; }
  .app { display: grid; grid-template-columns: 252px 1fr; }
  .sidebar { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; height: 100dvh; overflow-y: auto; padding: 20px 14px; border-right: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 60%, transparent); }
  .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .08em; font-size: 15px; color: var(--text); text-decoration: none; padding: 4px 10px; }
  .brand svg { color: var(--accent); fill: var(--accent); }
  .side-char { display: grid; gap: 8px; padding: 12px; border-radius: 14px; background: var(--surface-2); }
  .side-char-in { display: flex; gap: 10px; align-items: center; text-decoration: none; color: var(--text); }
  .side-char-in span { display: grid; min-width: 0; }
  .side-char-in strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side-char-in small { color: var(--muted); font-size: 12px; }
  .sidebar nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
  .nav-link { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 550; font-size: 14px; background: none; border: 0; width: 100%; }
  .nav-link:hover { background: var(--surface-2); color: var(--text); }
  .nav-link.active { background: var(--accent-soft); color: var(--accent-text); }
  .theme-btn { margin-top: auto; }
  .topbar, .bottom-nav, .fab { display: none; }
  main { padding: 28px 32px 48px; }
  .page-title { font-size: 28px; }
  .dash-grid { grid-template-columns: 1.05fr 1fr 1.25fr; }
  .dash-grid .quick { grid-column: 1 / -1; }
  .dash-cols { grid-template-columns: 1.6fr 1fr; align-items: start; }
  .goal-grid { grid-template-columns: repeat(2, 1fr); }
  .ach-grid { grid-template-columns: repeat(3, 1fr); }
  .toasts { bottom: 24px; }
  .focus-pill { bottom: 24px; right: 24px; }
  .settings { grid-template-columns: 1fr 1fr; align-items: start; }
  .task-meta .chip, .task .xp-pill { font-size: 12px; }
}
@media (min-width: 1280px) {
  .goal-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }

/* Keep compact stat values on one line */
.daily-list li span, .daily-list li strong, .char-stats strong { white-space: nowrap; }
@media (min-width: 1024px) and (max-width: 1279px) {
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .dash-grid .quote-card { grid-column: 1 / -1; }
}
@media (min-width: 1024px) {
  .daily-body { gap: 12px; }
  .char-stats > div { padding: 8px; }
  .char-stats strong { font-size: 14px; }
}

/* =====================================================================
   Simplified UI layer: calmer surfaces, fewer elements per screen,
   details one tap away.
   ===================================================================== */
.card { box-shadow: none; padding: 18px; }
[data-theme="light"] .card { box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.card.flush { padding: 4px 6px; }
.page-head { margin-bottom: 18px; align-items: center; }
.page-title { font-size: 26px; }
.card-title { font-size: 16px; }
.stat { border: 0; background: var(--surface); padding: 14px; }
.stat-grid { gap: 10px; }
.stat-value { font-size: 20px; }

/* Today layout */
.today-layout { display: grid; gap: 14px; grid-template-areas: "hero" "main" "quote"; }
.today-hero { grid-area: hero; } .today-main { grid-area: main; } .today-quote { grid-area: quote; }
.today-side, .today-main { display: grid; gap: 14px; align-content: start; min-width: 0; }
.hero { display: grid; gap: 14px; }
.hero-top { display: flex; align-items: center; gap: 14px; }
.hero-id { flex: 1; min-width: 0; }
.hero-name { font-size: 18px; font-weight: 700; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-id .muted { margin: 0; }
.hero-streak { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 16px; }
.hero-streak.on { color: #fb923c; background: rgba(251, 146, 60, .12); }
.hero-streak strong { color: var(--text); }
.meter { display: grid; gap: 6px; }
.meter-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.progress.thin { height: 4px; }

.quote-card { display: grid; gap: 8px; }
.quote-text { font-size: 17px; line-height: 1.45; font-weight: 600; margin: 0; }
.quote-src { font-size: 12px; color: var(--muted); margin: 0; }
.quote-why { font-size: 14px; color: var(--muted); margin: 0; }
.quote-action { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; margin: 2px 0 0; padding: 0; background: none; }
.quote-action svg { color: var(--accent-text); margin-top: 3px; }
.quote-btns { display: flex; gap: 16px; margin-top: 2px; }
.text-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0; border: 0; background: none; color: var(--accent-text); font-weight: 600; font-size: 13px; }
.text-btn:hover { text-decoration: underline; }
.text-btn.fav { color: var(--warn); }
.text-btn.fav svg { fill: currentColor; }

.note { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); padding: 6px 6px 6px 12px; border-radius: 12px; background: var(--surface); margin: 0 0 14px; }
.note > span { flex: 1; }
.note em { color: var(--accent-text); font-style: normal; font-weight: 600; }

.today-card .section-head { margin-bottom: 4px; }
.count-text { font-size: 13px; font-weight: 500; margin-left: 6px; }
.mini-select { position: relative; display: inline-flex; align-items: center; }
.mini-select select { appearance: none; -webkit-appearance: none; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 999px; padding: 6px 28px 6px 12px; font-size: 13px; min-height: 34px; }
.mini-select svg { position: absolute; right: 10px; pointer-events: none; color: var(--muted); }
.focus-line { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; margin: 8px 0 0; color: var(--text); }
.focus-line svg { color: var(--accent-text); margin-top: 3px; }
.list-label { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: 18px 0 4px; }
.list-empty { margin: 6px 0; }
.list-note { margin: 8px 10px 0; }
.add-row { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 0 8px; border: 0; background: none; color: var(--muted); font-size: 14px; font-weight: 500; border-radius: 10px; }
.add-row:hover { background: var(--surface-2); color: var(--text); }
.success-note { margin: 6px 4px 0; font-size: 13px; }

/* Rows */
.task { gap: 12px; padding: 8px 4px; }
.task + .task { border-top: 1px solid color-mix(in srgb, var(--border) 70%, transparent); }
.task:hover { background: transparent; }
.task-main { flex: 1; min-width: 0; display: grid; gap: 2px; text-align: left; background: none; border: 0; padding: 4px 0; color: inherit; border-radius: 8px; }
.task-main:hover .task-title { color: var(--accent-text); }
.task .task-title { display: block; width: auto; padding: 0; font-weight: 550; font-size: 15px; }
.task-meta { display: flex; flex-wrap: wrap; gap: 2px 6px; align-items: center; margin: 0; }
.meta { font-size: 12px; }
.meta .dot { width: 7px; height: 7px; margin-right: 2px; }
.meta.example { color: var(--accent-text); }
.meta.accent { color: #93c5fd; }
[data-theme="light"] .meta.accent { color: #1d4ed8; }
.sep { color: var(--muted); opacity: .6; font-size: 12px; }
.task .badge { font-size: 10px; padding: 1px 6px; }
.xp-pill { background: transparent; padding: 0; font-weight: 600; color: var(--muted); font-size: 12px; }
.xp-pill.earned { background: transparent; color: var(--ok); }
.check { border-width: 2px; border-radius: 12px; width: 40px; height: 40px; }
.check.round { border-radius: 50%; }
.check.sm { width: 32px; height: 32px; border-radius: 10px; }
.streak-pill { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 600; color: var(--muted); min-width: 32px; justify-content: flex-end; }
.streak-pill.on { color: #fb923c; }

/* Quick add */
.quick-form { display: flex; gap: 8px; }
.quick-form .input { flex: 1; }
.qa-hint { margin: 8px 2px 16px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.qa-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.qa-btn { display: grid; justify-items: center; gap: 6px; padding: 14px 6px; border-radius: 14px; border: 0; background: var(--surface-2); color: var(--text); font-size: 12px; font-weight: 600; text-decoration: none; text-align: center; }
.qa-btn svg { color: var(--accent-text); }
.qa-btn:hover { background: var(--surface-3); }

/* Detail sheets */
.habit-today { display: flex; align-items: center; gap: 10px; margin: 4px 0 12px; }
.habit-today .grow { flex: 1; }
.kv-row { display: flex; gap: 10px; }
.kv-row > div { flex: 1; display: grid; gap: 2px; padding: 10px 12px; background: var(--surface-2); border-radius: 12px; }
.kv-row strong { display: flex; align-items: center; gap: 4px; font-size: 15px; }
.detail .list-label { margin-top: 16px; }
.detail .grid-2 { margin-top: 12px; }
.detail .inline-form { flex-wrap: wrap; margin-top: 10px; }
.detail .inline-form label.small { flex-basis: 100%; }

/* Goals */
.goal { gap: 12px; }
.goal-open { display: grid; gap: 4px; text-align: left; background: none; border: 0; padding: 0; color: inherit; }
.goal-open:hover .goal-title { color: var(--accent-text); }
.goal-title { font-size: 17px; font-weight: 650; }
.goal .meter-head svg { color: var(--muted); }
.next-ms { display: flex; align-items: center; gap: 10px; font-size: 14px; }

/* Segmented buttons (filters) */
.segmented.compact { display: inline-grid; grid-auto-flow: column; grid-template-columns: none; padding: 3px; margin-bottom: 14px; }
.section-head .segmented.compact { margin: 0; }
.seg { border: 0; background: none; color: var(--muted); font-weight: 600; font-size: 13px; min-height: 34px; padding: 0 12px; border-radius: 9px; }
.seg.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* Missions toolbar */
.toolbar { display: flex; gap: 8px; align-items: center; grid-template-columns: none; }
.toolbar .search { flex: 1; }
.icon-btn.active { color: var(--accent-text); border-color: var(--accent); }
.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.chip-tabs { margin-bottom: 12px; }
.tab { border: 0; background: var(--surface); }

/* Disclosures */
.disclosure { padding: 0; margin-bottom: 12px; }
.disclosure > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 0 18px; cursor: pointer; font-weight: 650; font-size: 15px; }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary svg { color: var(--muted); transition: transform .2s; flex-shrink: 0; }
.disclosure[open] > summary svg { transform: rotate(180deg); }
.disclosure-body { padding: 0 18px 18px; }
.settings { display: block; }
.settings .disclosure-body .form { gap: 14px; }
.review { margin-bottom: 14px; }
.reflect { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); margin: 0; }
.reflect svg { color: var(--accent-text); margin-top: 3px; }
.page-hint { margin-top: 14px; }

/* Sidebar groups */
.nav-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 18px 12px 6px; }
.nav-secondary .nav-link { min-height: 38px; font-size: 13px; }

@media (min-width: 640px) {
  .qa-grid { grid-template-columns: repeat(6, 1fr); }
}
@media (min-width: 1024px) {
  .today-layout { grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "main hero" "main quote"; align-items: start; }
  .today-main { grid-area: main; }
  .today-hero { grid-area: hero; }
  .today-quote { grid-area: quote; }
  .settings { max-width: 760px; }
  .sidebar { gap: 10px; }
  .sidebar .btn.block { margin: 6px 0 8px; }
}
.check.plus { color: var(--muted); }
.check.plus svg { transform: scale(1); }
.tb-brand { font-size: 13px; letter-spacing: .1em; }

/* =====================================================================
   Touch & phone polish
   ===================================================================== */
/* No 300 ms delay or double-tap zoom on controls; no grey tap flash. */
a, button, input, select, textarea, label, summary { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

/* Press feedback for touch. */
.task-main:active, .qa-btn:active, .add-row:active, .more-link:active, .goal-open:active, .disclosure > summary:active { opacity: .7; }
.check:active, .icon-btn:active, .fab:active, .bn:active, .seg:active, .tab:active { transform: scale(.94); }
.btn, .check, .icon-btn, .bn, .tab, .seg { transition: transform .1s ease, background .15s, border-color .15s, color .15s; }

/* On touch screens, hover styles would "stick" after a tap — neutralise them. */
@media (hover: none) {
  .task-main:hover .task-title, .goal-open:hover .goal-title { color: inherit; }
  .check:not(.on):not(.plus):hover { border-color: color-mix(in srgb, var(--muted) 55%, transparent); color: transparent; }
  .btn.ghost:hover { background: var(--surface-2); }
  .icon-btn:hover { background: var(--surface-2); }
  .icon-btn.subtle:hover { background: transparent; color: var(--muted); }
  .add-row:hover { background: none; color: var(--muted); }
  .qa-btn:hover { background: var(--surface-2); }
  .more-link:hover { background: none; }
  .text-btn:hover, .link:hover, .link-btn:hover { text-decoration: none; }
  .btn.primary:hover { filter: none; }
}

/* Landscape phones: keep content clear of the notch / rounded corners. */
main { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.topbar { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.bottom-nav { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }

/* Sheets: a bigger grab handle area for swipe-to-close; respect the on-screen keyboard. */
.sheet-grip { width: 44px; height: 5px; margin: 10px auto 2px; }
@media (max-width: 639px) {
  .sheet { max-height: calc(100dvh - 24px - var(--sat)); }
  .sheet-head { cursor: grab; }
  .page-head .btn.sm { min-height: 40px; }
  .stat-value { font-size: 18px; }
  .qa-grid { gap: 6px; }
}

/* Short landscape screens: shrink the bottom bar a little. */
@media (max-height: 480px) and (orientation: landscape) {
  :root { --nav-h: 54px; }
  .fab { width: 48px; height: 48px; margin-top: -16px; border-radius: 16px; }
  .bn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* Sync */
.restore-box { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--border); }
.sync-line { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 4px 0 8px; }
.sync-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.sync-dot.synced { background: var(--ok); }
.sync-dot.syncing, .sync-dot.connecting { background: var(--accent-2); animation: pulse 1.2s ease-in-out infinite; }
.sync-dot.offline { background: var(--warn); }
.sync-dot.error, .sync-dot.signed-out { background: var(--danger); }
@keyframes pulse { 50% { opacity: .35; } }
.copy-card { display: grid; gap: 2px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); margin: 10px 0; }
