/* Weekly Todo web app. Colours, sizes and type follow the phone app
   (mobile/src/constants/theme.ts). Light and dark follow the system unless a
   Pro user picks one (html[data-theme]); html[data-accent] sets the accent. */

:root {
  --text: #1A1A1A; --bg: #FAFAF8; --el: #FFFFFF; --sel: #E4E4DF; --text-2: #5E5E59; --faint: #ABABA5;
  --border: #E3E3DF; --accent: #2F5BEA; --accent-soft: #EAF0FE; --on-accent: #FFFFFF;
  --danger: #B42318; --danger-soft: #FEE4E2; --warning: #A1460A; --warning-soft: #FEF0C7;
  --muted: #F2F2EF; --scrim: rgba(28, 28, 26, .45); --toast: #1C1C1A; --on-toast: #FFFFFF;
  --input-border: #DADAD5; --hairline: #ECECE8; --locked-bg: #ECECE8; --locked-text: #8A8A84;
  --future-border: #D6D6D1; --past-day: #C2C2BC; --plain: #3D3D39; --disabled: #C9C9C4; --grip: #BDBDB7;
  --selected-soft: #F5F8FF; --danger-tint: #FDECEA; --fine: #6B6B66;
  --shadow: 0 10px 30px rgba(20, 20, 18, .14), 0 2px 6px rgba(20, 20, 18, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --text: #F2F2EF; --bg: #121211; --el: #1C1C1A; --sel: #272725; --text-2: #A3A29C; --faint: #5E5D58;
    --border: #2F2F2C; --accent: #7B93F2; --accent-soft: #1F2747;
    --danger: #F2867E; --danger-soft: #3A1D1B; --warning: #F0B160; --warning-soft: #3A2A12;
    --muted: #1A1A18; --scrim: rgba(0, 0, 0, .6); --toast: #F2F2EF; --on-toast: #121211;
    --input-border: #3A3A37; --hairline: #2A2A27; --locked-bg: #232321; --locked-text: #7C7C76;
    --future-border: #3A3A37; --past-day: #55554F; --plain: #D0D0CB; --disabled: #4A4A46; --grip: #5E5E59;
    --selected-soft: #1E2438; --danger-tint: #3A1D1B; --fine: #A3A29C;
    --shadow: 0 10px 30px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --text: #F2F2EF; --bg: #121211; --el: #1C1C1A; --sel: #272725; --text-2: #A3A29C; --faint: #5E5D58;
  --border: #2F2F2C; --accent: #7B93F2; --accent-soft: #1F2747;
  --danger: #F2867E; --danger-soft: #3A1D1B; --warning: #F0B160; --warning-soft: #3A2A12;
  --muted: #1A1A18; --scrim: rgba(0, 0, 0, .6); --toast: #F2F2EF; --on-toast: #121211;
  --input-border: #3A3A37; --hairline: #2A2A27; --locked-bg: #232321; --locked-text: #7C7C76;
  --future-border: #3A3A37; --past-day: #55554F; --plain: #D0D0CB; --disabled: #4A4A46; --grip: #5E5E59;
  --selected-soft: #1E2438; --danger-tint: #3A1D1B; --fine: #A3A29C;
  --shadow: 0 10px 30px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .3);
  color-scheme: dark;
}
/* Pro accents (light, then dark). */
:root[data-accent="violet"] { --accent: #6E56CF; --accent-soft: #EFEBFC; }
:root[data-accent="green"] { --accent: #2B8A5E; --accent-soft: #E3F3EA; }
:root[data-accent="orange"] { --accent: #C9531E; --accent-soft: #FDEDE4; }
:root[data-accent="pink"] { --accent: #C53B8C; --accent-soft: #FBE8F2; }
:root[data-theme="dark"][data-accent="violet"] { --accent: #A08CF0; --accent-soft: #2A2347; }
:root[data-theme="dark"][data-accent="green"] { --accent: #4CC38A; --accent-soft: #143223; }
:root[data-theme="dark"][data-accent="orange"] { --accent: #F0905E; --accent-soft: #3A2216; }
:root[data-theme="dark"][data-accent="pink"] { --accent: #EC7CB8; --accent-soft: #3A1A2C; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"][data-accent="violet"] { --accent: #A08CF0; --accent-soft: #2A2347; }
  :root[data-theme="system"][data-accent="green"] { --accent: #4CC38A; --accent-soft: #143223; }
  :root[data-theme="system"][data-accent="orange"] { --accent: #F0905E; --accent-soft: #3A2216; }
  :root[data-theme="system"][data-accent="pink"] { --accent: #EC7CB8; --accent-soft: #3A1A2C; }
}
.swatch-blue { background: #2F5BEA; } .swatch-violet { background: #6E56CF; } .swatch-green { background: #2B8A5E; }
.swatch-orange { background: #C9531E; } .swatch-pink { background: #C53B8C; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon .fill, .icon-fill { fill: currentColor; stroke: none; }
.noscript { padding: 40px; text-align: center; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 32px; text-align: center; min-height: 60vh; }
.spacer { flex: 1; }
.err-title { font-size: 19px; font-weight: 700; margin: 0; }
.err-text { color: var(--text-2); margin: 0 0 8px; max-width: 340px; line-height: 1.45; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--sel); border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.busy { display: flex; justify-content: center; align-items: center; min-height: 52px; }

/* ------------------------------------------------------------ buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 16px; border-radius: 12px; font-size: 15px; font-weight: 600; transition: opacity .15s, background .15s, border-color .15s; white-space: nowrap; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-danger { background: var(--danger); color: var(--on-accent); }
.btn-secondary { background: var(--el); border: 1px solid var(--input-border); color: var(--text); }
.btn-secondary:hover:not(:disabled) { border-color: var(--accent); }
.btn-plain { background: transparent; color: var(--plain); }
.btn-primary:hover:not(:disabled), .btn-danger:hover:not(:disabled) { opacity: .9; }
.btn:active:not(:disabled) { opacity: .65; }
.btn:disabled { opacity: .45; }
.btn-large { min-height: 52px; border-radius: 14px; font-size: 16px; font-weight: 700; width: 100%; }
.icon-btn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; color: var(--text); text-decoration: none; transition: background .15s; }
.icon-btn:hover:not(:disabled) { background: var(--sel); }
.icon-btn:disabled { color: var(--disabled); }
.icon-btn .icon { width: 20px; height: 20px; }
.icon-btn.small { width: 30px; height: 30px; } .icon-btn.small .icon { width: 15px; height: 15px; }
.close-btn { width: 40px; height: 40px; background: var(--muted); border-radius: 12px; flex-shrink: 0; }
.close-btn .icon { width: 15px; height: 15px; }
.link { color: var(--accent); font-weight: 600; font-size: 14px; }
.link:hover { text-decoration: underline; }
.row-actions { display: flex; gap: 10px; }
.flex { flex: 1; min-width: 0; } .grow { flex: 1.6; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.fine { font-size: 12.5px; color: var(--fine); text-align: center; margin: 12px 0 0; line-height: 1.45; }
.fine.left { text-align: left; }

/* ------------------------------------------------------------ login */
.login { min-height: 100dvh; max-width: 440px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; }
.login-hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; animation: rise .5s ease both; }
.login-logo { width: 84px; height: 84px; margin-bottom: 24px; }
.login-title { font-size: 34px; font-weight: 800; letter-spacing: -.7px; margin: 0 0 16px; }
.light { font-weight: 500; }
.login-sub { font-size: 17px; line-height: 1.47; color: var(--text-2); max-width: 300px; margin: 0; }
.login-actions { display: flex; flex-direction: column; gap: 14px; padding-bottom: 16px; animation: rise .5s .1s ease both; }
.google-slot { display: flex; justify-content: center; min-height: 44px; }
.btn-auth { width: 100%; height: 56px; border-radius: 16px; display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 17px; font-weight: 600; }
.btn-google { background: var(--el); border: 1px solid var(--border); }
.btn-google:hover { border-color: var(--text-2); }
.btn-apple { background: #000; color: #fff; }
:root[data-theme="dark"] .btn-apple { background: #fff; color: #000; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-apple { background: #fff; color: #000; } }
.apple-mark { width: 22px; height: 22px; margin-top: -3px; }
.skip { align-self: center; padding: 6px 10px; }
.legal { font-size: 13px; line-height: 1.4; color: var(--text-2); text-align: center; margin: 0; }
.legal a { text-decoration: underline; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* ------------------------------------------------------------ app shell */
.app { height: 100dvh; }
.screen { height: 100dvh; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 4px; height: 56px; padding: 0 10px 0 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; background: var(--bg); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; flex: 1; min-width: 0; }
.brand img { width: 30px; height: 30px; }
.wordmark { font-size: 21px; font-weight: 800; letter-spacing: -.4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 2px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--sel); color: var(--text); font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; margin-left: 6px; }
.avatar .icon { width: 15px; height: 15px; color: var(--text-2); }
.avatar:hover { box-shadow: 0 0 0 3px var(--accent-soft); }
.install-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; margin-right: 6px; border-radius: 10px; border: 1px solid var(--input-border); background: var(--el); font-size: 13.5px; font-weight: 600; }
.install-btn:hover { border-color: var(--accent); color: var(--accent); }
.install-btn .icon { width: 15px; height: 15px; }
.is-refreshing .refresh-btn .icon { animation: spin .8s linear infinite; }
.topbar-sub { padding-left: 4px; gap: 4px; }
.screen-title { font-size: 20px; font-weight: 700; letter-spacing: -.2px; margin: 0; }

.quote { display: block; width: 100%; text-align: left; padding: 10px 16px; border-bottom: 1px solid var(--hairline); flex-shrink: 0; }
.quote-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 14px; line-height: 20px; font-style: italic; color: var(--plain); }
.quote.expanded .quote-text { display: block; }
.quote-author { display: block; font-size: 12.5px; color: var(--text-2); margin-top: 3px; }

/* ------------------------------------------------------------ split view */
.split { flex: 1; display: flex; min-height: 0; width: 100%; }
.pane-left { display: flex; flex-direction: column; min-width: 0; padding: 12px 8px 0 12px; }
.pane-right { min-width: 0; background: var(--muted); display: flex; flex-direction: column; }
.divider { width: 10px; flex-shrink: 0; position: relative; display: flex; align-items: center; justify-content: center; cursor: col-resize; touch-action: none; }
.divider-line { position: absolute; top: 0; bottom: 0; left: 4.5px; width: 1px; background: var(--border); }
.grip { position: relative; width: 6px; height: 40px; border-radius: 3px; background: var(--grip); transition: background .15s, height .15s; }
.divider.wide .grip, .divider:hover .grip, .resizing .grip { background: var(--accent); }
.divider:hover .grip { height: 56px; }
.resizing, .resizing * { cursor: col-resize !important; user-select: none; }

/* add bar */
.add-bar { display: flex; align-items: center; gap: 4px; height: 46px; border: 1px solid var(--border); border-radius: 12px; background: var(--el); padding: 0 6px 0 14px; flex-shrink: 0; transition: border-color .15s; }
.add-bar:focus-within { border-color: var(--accent); }
.add-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 15px; padding: 8px 0; }
.add-input::placeholder { color: var(--faint); }
.add-plus { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: var(--on-accent); display: inline-flex; align-items: center; justify-content: center; }
.add-plus:hover { opacity: .9; }
.add-plus .icon { width: 18px; height: 18px; stroke-width: 2.4; }

.tree-scroll { flex: 1; overflow-y: auto; padding: 8px 0 120px; min-height: 0; scrollbar-width: thin; }

/* do first */
.dofirst { border: 1px solid var(--border); border-radius: 14px; background: var(--el); padding: 4px 4px 8px; margin-bottom: 8px; }
.dofirst-head { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px; width: 100%; color: var(--text-2); }
.dofirst-title { font-size: 12px; font-weight: 700; letter-spacing: .7px; color: var(--text); }
.count { min-width: 20px; height: 20px; border-radius: 10px; background: var(--text); color: var(--bg); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }
.dofirst-head .icon { width: 14px; height: 14px; }
.df-entry { display: flex; align-items: center; gap: 8px; padding: 6px 2px 6px 6px; border-radius: 10px; cursor: grab; touch-action: pan-y; user-select: none; }
.df-entry:hover { background: var(--muted); }
.df-entry.is-dragging { opacity: .3; }
.df-grip { width: 18px; display: flex; justify-content: center; color: var(--locked-text); }
.df-grip .icon { width: 13px; height: 13px; }
.df-text { flex: 1; min-width: 0; }
.df-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tone-late .df-title { color: var(--danger); } .tone-soon .df-title { color: var(--warning); }
.path { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.df-chip { border-radius: 999px; padding: 3px 8px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.tone-late .df-chip { background: var(--danger-soft); color: var(--danger); }
.tone-soon .df-chip { background: var(--warning-soft); color: var(--warning); }
.df-entry .icon-btn, .row-btn { width: 34px; height: 40px; color: var(--text-2); }
.df-entry .icon-btn .icon { width: 18px; height: 18px; stroke-width: 1.8; }

/* tree */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.dragging .tree { opacity: .55; }
.row { display: flex; align-items: center; min-height: 44px; border-radius: 8px; cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; transition: background .12s; }
.row:hover { background: var(--muted); }
.row.is-dragging { opacity: .35; outline: 1.5px dashed var(--faint); outline-offset: -2px; border-radius: 12px; }
.lead { width: 24px; height: 44px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); }
.lead .icon { width: 13px; height: 13px; stroke-width: 2.4; }
.bullet { width: 5px; height: 5px; border-radius: 50%; background: var(--faint); }
.title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 12px 4px 12px 0; text-align: left; cursor: text; }
.title-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.title.strong .title-text, .title-input.strong { font-weight: 600; }
.title .icon { width: 14px; height: 14px; }
.title .icon.faint { color: var(--faint); }
.tone-late, .tone-late .title-text { color: var(--danger); }
.tone-soon, .tone-soon .title-text { color: var(--warning); }
.title-input { flex: 1; min-width: 0; font-size: 15px; padding: 7px 8px; margin: 3px 4px 3px -8px; border: 1px solid var(--accent); border-radius: 8px; outline: 0; background: var(--el); }
.title-input::placeholder { color: var(--faint); }
.row-btn .icon { width: 17px; height: 17px; stroke-width: 1.8; }
.row-btn:hover { color: var(--text); }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 40px 16px 0; }
.empty-icon { width: 44px; height: 44px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.empty-title { font-size: 17px; font-weight: 700; margin: 0; }
.empty-text { font-size: 14px; line-height: 20px; color: var(--text-2); margin: 0; max-width: 300px; }

/* week strip */
.strip { flex: 1; display: flex; flex-direction: column; padding: 0 4px 8px; min-height: 0; }
.strip-head { height: 40px; display: flex; align-items: center; justify-content: center; gap: 2px; flex-shrink: 0; }
.strip-label { font-size: 10px; font-weight: 600; letter-spacing: .4px; color: var(--text-2); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.strip.wide .strip-head { justify-content: flex-start; padding-left: 2px; }
.strip.wide .strip-label { font-size: 12.5px; margin-right: auto; padding-left: 4px; }
.strip-head.narrow { height: auto; flex-direction: column; gap: 0; padding: 2px 0 6px; }
.strip-head.narrow .strip-label { white-space: normal; line-height: 1.25; max-width: 60px; }
.strip-foot { display: flex; justify-content: center; padding-top: 4px; flex-shrink: 0; }
.strip-days { flex: 1; display: grid; grid-template-rows: repeat(7, minmax(0, 1fr)); gap: 6px; min-height: 0; }
.this-week { align-self: center; margin-top: 6px; font-size: 12.5px; }
.day { position: relative; border: 1px solid var(--border); border-radius: 12px; background: var(--el); overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 0; transition: transform .12s, border-color .12s, opacity .12s; }
.day:hover { border-color: var(--text-2); }
.day:active { opacity: .6; }
.day.today { background: var(--accent-soft); border: 1.5px solid var(--accent); }
.day.future { background: transparent; border: 1px dashed var(--future-border); }
.day.locked { background: var(--locked-bg); border-color: transparent; }
.dragging .day:not(.future):not(.locked) { border: 1.5px dashed var(--accent); }
.day-week { font-size: 10px; font-weight: 600; letter-spacing: .5px; }
.day-num { font-size: 18px; font-weight: 700; line-height: 20px; }
.day.today .day-week, .day.today .day-num, .day.today .day-name { color: var(--accent); }
.day.future .day-week, .day.future .day-num, .day.future .day-name { color: var(--faint); }
.day.locked .day-week, .day.locked .day-num, .day.locked .day-name, .day .lock { color: var(--locked-text); }
.day .lock { width: 12px; height: 12px; }
.badge { min-width: 20px; height: 20px; border-radius: 10px; padding: 0 5px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.day.wide { align-items: stretch; justify-content: flex-start; gap: 3px; padding: 9px 12px 0; text-align: left; }
.day-head { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.day-name { font-size: 14px; font-weight: 800; }
.day-line { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-line.muted { color: var(--text-2); } .day-line.faint { color: var(--faint); }
.day-more { font-size: 13.5px; font-weight: 700; color: var(--accent); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-corner { position: absolute; top: 5px; right: 5px; }
.dot-late { background: var(--danger); } .dot-soon { background: var(--warning); } .dot-later { background: var(--text-2); } .dot-inverted { background: var(--on-accent); }

/* drag & drop */
.ghost { position: fixed; left: 0; top: 0; z-index: 80; width: 210px; padding: 10px 14px; border-radius: 12px; background: var(--el); border: 1px solid var(--border); box-shadow: var(--shadow); pointer-events: none; }
.ghost-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ghost-sub { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dragging, .dragging * { cursor: grabbing !important; user-select: none; }
.drop-target { position: fixed; z-index: 70; border-radius: 14px; background: var(--accent); color: var(--on-accent); display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; box-shadow: var(--shadow); animation: pop .12s ease; }
.dt-day { font-size: 11px; font-weight: 700; letter-spacing: .6px; } .dt-date { font-size: 20px; font-weight: 800; line-height: 1.1; } .dt-hint { font-size: 11px; font-weight: 600; opacity: .9; }
@keyframes pop { from { transform: scale(.92); opacity: 0; } }
.toast { position: fixed; z-index: 90; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: min(440px, calc(100vw - 32px)); padding: 12px 18px; border-radius: 14px; background: var(--toast); color: var(--on-toast); font-size: 14px; font-weight: 600; text-align: center; box-shadow: var(--shadow); pointer-events: none; animation: fadeup .15s ease; }
.undo-bar { position: fixed; z-index: 60; left: 50%; bottom: 20px; transform: translateX(-50%); width: min(480px, calc(100vw - 32px)); min-height: 48px; display: flex; align-items: center; gap: 16px; padding: 0 8px 0 18px; border-radius: 14px; background: var(--text); color: var(--bg); font-size: 15px; font-weight: 600; box-shadow: var(--shadow); animation: fadeup .18s ease; }
.undo-bar span { flex: 1; }
.undo-btn { color: var(--bg); font-weight: 800; padding: 10px 12px; border-radius: 10px; }
.undo-btn:hover { background: color-mix(in srgb, var(--bg) 14%, transparent); }
@keyframes fadeup { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ------------------------------------------------------------ overlays */
.layer { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.layer-alert { z-index: 100; }
.scrim { position: absolute; inset: 0; background: var(--scrim); }
.scrim.enter { animation: fade .16s ease; }
@keyframes fade { from { opacity: 0; } }
.dialog, .sheet { position: relative; background: var(--el); box-shadow: var(--shadow); max-height: calc(100dvh - 32px); overflow-y: auto; display: flex; flex-direction: column; }
.dialog { width: min(400px, 100%); border-radius: 20px; padding: 24px 20px 20px; }
.dialog.enter { animation: zoom .18s ease; }
.sheet { width: min(520px, 100%); border-radius: 22px; padding: 20px 20px 20px; }
.sheet.enter { animation: zoom .2s ease; }
@keyframes zoom { from { opacity: 0; transform: scale(.96); } }
.modal-open { overflow: hidden; }
@media (max-width: 640px) {
  .layer-sheet { align-items: flex-end; padding: 0; }
  .sheet { width: 100%; border-radius: 22px 22px 0 0; max-height: 88dvh; padding: 10px 16px max(16px, env(safe-area-inset-bottom)); }
  .sheet::before { content: ""; align-self: center; width: 40px; height: 5px; border-radius: 3px; background: var(--future-border); margin-bottom: 14px; flex-shrink: 0; }
  .sheet.enter { animation: slideup .26s ease; }
}
@keyframes slideup { from { transform: translateY(100%); } }
.alert { gap: 10px; }
.alert-title { font-size: 18px; font-weight: 700; margin: 0; }
.alert-text { color: var(--text-2); margin: 0; line-height: 1.45; }
.alert .row-actions { margin-top: 8px; }
.sheet-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.sheet-head-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sheet-title { font-size: 21px; font-weight: 700; letter-spacing: -.2px; margin: 0; }
.sheet-sub { font-size: 14px; color: var(--text-2); margin: 0; }
.sheet-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; padding-bottom: 6px; min-height: 0; }
.t-center { text-align: center; }
.hint { font-size: 13px; text-align: center; color: var(--text-2); margin: 14px 0 0; }
.empty-note { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 24px 20px; color: var(--faint); text-align: center; }
.empty-note p { color: var(--text-2); margin: 0; font-size: 14.5px; line-height: 1.45; }
.section-label, .group-label { font-size: 12px; font-weight: 700; letter-spacing: .6px; color: var(--text-2); margin: 10px 0 2px; }

/* completed card + menu */
.ccard-wrap { position: relative; }
.ccard-wrap.raised { z-index: 2; }
.ccard { display: flex; align-items: center; gap: 12px; border: 1px solid var(--border); background: var(--el); border-radius: 14px; padding: 8px 6px 8px 14px; cursor: pointer; transition: border-color .12s; }
.ccard:hover { border-color: var(--text-2); }
.ccard.selected { border: 1.5px solid var(--accent); background: var(--selected-soft); }
.ccard.dense { border-radius: 12px; padding: 4px 4px 4px 12px; }
.check { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.check .icon { width: 12px; height: 12px; stroke-width: 3; }
.ccard-text, .due-text { flex: 1; min-width: 0; }
.ccard-title { font-size: 15px; font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ccard .icon-btn { color: var(--text-2); }
.menu { margin: -6px 52px 4px auto; width: 220px; border: 1px solid var(--border); border-radius: 14px; background: var(--el); padding: 6px; box-shadow: var(--shadow); animation: fade .12s ease; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 42px; padding: 0 12px; border-radius: 10px; font-size: 15px; font-weight: 500; }
.menu-item .icon { width: 16px; height: 16px; }
.menu-item.highlighted, .menu-item:hover { background: var(--sel); }
.menu-item.danger { color: var(--danger); }
.due { display: flex; flex-direction: column; gap: 8px; }
.due-row { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); background: var(--el); border-radius: 12px; padding: 10px 12px; text-align: left; width: 100%; }
.due-row:hover { border-color: var(--text-2); }
.due-row .icon { width: 16px; height: 16px; }
.due-row .ccard-title { color: var(--text); }
.due-chip { font-size: 12px; font-weight: 700; white-space: nowrap; }
.due-row.tone-later { color: var(--text-2); }

/* info */
.pill { align-self: flex-start; border-radius: 10px; padding: 4px 10px; font-size: 13px; font-weight: 700; }
.pill-accent { background: var(--accent-soft); color: var(--accent); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-muted { background: var(--sel); color: var(--text-2); }
.info-title { font-size: 21px; font-weight: 800; margin: 6px 0 0; overflow-wrap: anywhere; }
.info-rows { margin: 0 0 18px; border-top: 1px solid var(--border); }
.info-row { display: flex; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--border); font-size: 14.5px; }
.info-row dt { color: var(--text-2); }
.info-row dd { margin: 0; font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.tone-danger { color: var(--danger); } .tone-warning { color: var(--warning); }

/* new todo / deadline */
.field { display: block; margin-bottom: 16px; }
.label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 7px; }
.input { width: 100%; height: 46px; border: 1px solid var(--input-border); border-radius: 12px; padding: 0 14px; font-size: 15px; background: var(--el); outline: 0; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--faint); }
.todo-name { font-size: 15px; color: var(--text-2); margin: -8px 0 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deadline-head { display: flex; align-items: baseline; justify-content: space-between; }
.selected { font-size: 13px; font-weight: 600; color: var(--accent); }
.tip { font-size: 13px; line-height: 18px; color: var(--text-2); margin: 0 0 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip { height: 36px; border-radius: 999px; padding: 0 14px; font-size: 13px; font-weight: 600; border: 1px solid var(--input-border); background: var(--el); }
.chip:hover { border-color: var(--accent); }
.chip.on { border: 1.5px solid var(--accent); background: var(--accent-soft); color: var(--accent); }
.picker { border: 1px solid var(--hairline); border-radius: 14px; padding: 8px; margin-bottom: 16px; }
.month-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 6px; }
.month-title { flex: 1; text-align: center; font-size: 17px; font-weight: 700; }
.month.compact .month-title { font-size: 15px; }
.month-row { display: flex; }
.month-row > * { flex: 1; min-width: 0; }
.weekdays div { text-align: center; font-size: 12px; font-weight: 600; line-height: 28px; color: var(--text-2); }
.month.compact .weekdays div { font-size: 11px; line-height: 24px; }
.month-cell { padding: 2px; height: 58px; }
.month.compact .month-cell { padding: 1px; height: 40px; }
.pick-day { width: 100%; height: 100%; border-radius: 10px; font-size: 14px; font-weight: 600; border: 1.5px solid transparent; }
.pick-day:hover:not(:disabled) { background: var(--muted); }
.pick-day:disabled { color: var(--past-day); }
.pick-day.today { border-color: var(--accent); color: var(--accent); }
.pick-day.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* delete */
.danger-icon { width: 48px; height: 48px; border-radius: 14px; background: var(--danger-tint); color: var(--danger); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.danger-icon .icon { width: 22px; height: 22px; }
.dialog-title { font-size: 19px; font-weight: 700; margin: 0 0 8px; overflow-wrap: anywhere; }
.dialog-text { color: var(--text-2); margin: 0 0 18px; line-height: 1.45; }
.list-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.hint-left { font-size: 13.5px; color: var(--text-2); }
.check-list { border: 1px solid var(--border); border-radius: 14px; max-height: 260px; overflow-y: auto; padding: 4px 0; margin-bottom: 16px; }
.check-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding-right: 10px; text-align: left; }
.check-row:hover:not(:disabled) { background: var(--muted); }
.box { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--input-border); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--on-accent); }
.box .icon { width: 12px; height: 12px; stroke-width: 3; }
.check-row.checked .box { background: var(--danger); border-color: var(--danger); }
.check-row.locked .box { background: var(--faint); border-color: var(--faint); }
.check-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.check-row.checked .check-title { color: var(--text); }
.check-row.locked .check-title { font-weight: 600; }
.check-day { font-size: 12px; color: var(--text-2); white-space: nowrap; }

/* locked */
.locked { display: flex; flex-direction: column; gap: 12px; align-items: stretch; padding-top: 6px; }
.soft-icon { width: 52px; height: 52px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; align-self: center; }
.soft-icon .icon { width: 24px; height: 24px; }
.locked p { margin: 0; line-height: 1.45; }
.stats { display: flex; gap: 12px; padding: 14px; border-radius: 14px; background: var(--sel); margin: 4px 0; }
.stat { flex: 1; display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--text-2); }
.stat strong { font-size: 15px; color: var(--text); }

/* account */
.group { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.acc-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 0 14px; text-align: left; font-size: 15px; }
.acc-row + .acc-row { border-top: 1px solid var(--border); }
.acc-row:hover:not(:disabled) { background: var(--muted); }
.acc-row .icon { width: 18px; height: 18px; }
.acc-label { flex: 1; }
.acc-detail { color: var(--accent); font-weight: 600; font-size: 14px; }
.acc-row.danger { color: var(--danger); }
.acc-busy { display: flex; justify-content: center; padding: 14px; }

/* themes */
.segment { display: flex; background: var(--sel); border-radius: 12px; padding: 3px; margin-bottom: 18px; }
.segment-item { flex: 1; height: 38px; border-radius: 10px; font-weight: 600; color: var(--text-2); }
.segment-item.on { background: var(--el); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.swatches { display: flex; gap: 14px; flex-wrap: wrap; }
.swatch-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.swatch { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; border: 3px solid transparent; }
.swatch.on { border-color: var(--text); }
.swatch .icon { width: 18px; height: 18px; stroke-width: 3; }
.swatch-name { font-size: 12px; color: var(--text-2); }

/* ------------------------------------------------------------ pages (calendar, insights, Pro) */
.page { flex: 1; overflow-y: auto; width: 100%; max-width: 760px; margin: 0 auto; padding: 12px 16px 48px; }
.cal-grid { padding: 0 0 6px; }
.cal-day { width: 100%; height: 100%; border-radius: 12px; border: 1px solid var(--border); background: var(--el); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; position: relative; }
.cal-day:hover:not(:disabled) { border-color: var(--text-2); }
.cal-day.future { background: transparent; border-color: transparent; color: var(--faint); }
.cal-day.future.on { border: 1.5px solid var(--accent); }
.cal-day.locked { background: var(--muted); border-color: transparent; color: var(--faint); }
.cal-day.today { border: 1.5px solid var(--accent); background: var(--accent-soft); color: var(--accent); }
.cal-day.on:not(.future) { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.cal-num { font-size: 15px; font-weight: 600; line-height: 17px; }
.cal-day .lock { width: 11px; height: 11px; }
.cal-badge { min-width: 18px; height: 16px; border-radius: 8px; padding: 0 4px; background: var(--accent); color: var(--on-accent); font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.cal-day.on .cal-badge { background: var(--on-accent); color: var(--accent); }
.cal-list { margin-top: 14px; border-top: 1px solid var(--hairline); padding-top: 16px; }
.cal-list-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.cal-list-head h2 { flex: 1; font-size: 16px; font-weight: 700; margin: 0; }
.cal-list .muted { font-size: 14px; }
.tiles { display: flex; gap: 10px; margin-bottom: 14px; }
.tile { flex: 1; border: 1px solid var(--border); background: var(--el); border-radius: 16px; padding: 14px; }
.tile-value { display: flex; align-items: center; gap: 6px; font-size: 26px; font-weight: 800; }
.tile-value .icon { width: 18px; height: 18px; color: var(--accent); }
.tile-label { font-size: 13px; color: var(--text-2); }
.card { border: 1px solid var(--border); background: var(--el); border-radius: 16px; padding: 16px; margin-bottom: 14px; }
.card h2 { font-size: 16px; font-weight: 700; margin: 0 0 12px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.card-head .muted { font-size: 13px; }
.chart { height: 150px; display: flex; align-items: flex-end; gap: 6px; border-bottom: 1px solid var(--hairline); padding-top: 10px; }
.bar-slot { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bar { width: 100%; max-width: 34px; border-radius: 6px 6px 2px 2px; background: var(--accent); opacity: .45; transition: opacity .15s; }
.bar.on, .bar-slot:hover .bar { opacity: 1; }
.bar.zero { background: var(--hairline); opacity: 1; }
.axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); margin-top: 6px; }
.project { margin-bottom: 12px; }
.project-head { display: flex; justify-content: space-between; gap: 8px; font-size: 14.5px; margin-bottom: 6px; }
.project-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track { height: 8px; border-radius: 4px; background: var(--sel); overflow: hidden; }
.fill { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.pro { max-width: 520px; display: flex; flex-direction: column; gap: 12px; }
.tag { align-self: flex-start; background: var(--accent-soft); color: var(--accent); border-radius: 8px; padding: 5px 10px; font-size: 12px; font-weight: 800; letter-spacing: .6px; }
.pro-title { font-size: 28px; font-weight: 800; letter-spacing: -.5px; margin: 0; line-height: 1.15; }
.pro > .muted { margin: 0; font-size: 16px; }
.features { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.feature { display: flex; gap: 12px; }
.tick { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; }
.tick.soon { background: var(--disabled); }
.tick .icon { width: 12px; height: 12px; stroke-width: 3; }
.feature-name { font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.soon-tag { font-size: 11px; font-weight: 600; color: var(--text-2); background: var(--sel); border-radius: 6px; padding: 2px 6px; }
.plans { display: flex; flex-direction: column; gap: 12px; margin: 8px 0 4px; }
.plan { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 16px; border-radius: 16px; border: 1px solid var(--input-border); background: var(--el); text-align: left; }
.plan.on { border: 2px solid var(--accent); background: var(--selected-soft); padding: 15px; }
.radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--input-border); flex-shrink: 0; }
.plan.on .radio { border: 6px solid var(--accent); }
.plan-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.plan-name { font-weight: 700; font-size: 16px; }
.plan-detail { font-size: 13px; color: var(--text-2); }
.plan-price { font-weight: 800; font-size: 17px; }
.plan-badge { position: absolute; top: -11px; right: 14px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 800; border-radius: 999px; padding: 4px 8px; }

/* ------------------------------------------------------------ wider screens */
@media (min-width: 900px) {
  .topbar { padding: 0 20px 0 24px; }
  .pane-left { padding: 16px 12px 0 20px; }
  .strip { padding: 0 10px 12px; }
  .tree-scroll { padding-bottom: 80px; }
}
@media (max-width: 420px) {
  .wordmark { font-size: 19px; }
  .row-btn { width: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------------------ export as PDF (print) */
.print-root { display: none; }
@media print {
  body { overflow: visible; background: #fff; color: #1A1A1A; }
  .app, #overlay-root, .undo-bar, .toast, .layer { display: none !important; }
  .print-root { display: block; font: 12px/1.4 -apple-system, Helvetica, Arial, sans-serif; margin: 24px; }
  .print-root h1 { font-size: 20px; margin: 0 0 4px; }
  .print-root p { color: #5E5E59; margin: 0 0 18px; }
  .print-root table { width: 100%; border-collapse: collapse; font-size: 11px; }
  .print-root th { text-align: left; color: #5E5E59; font-weight: 600; border-bottom: 1px solid #DADAD5; padding: 6px 8px; }
  .print-root td { border-bottom: 1px solid #ECECE8; padding: 6px 8px; vertical-align: top; }
  .print-root .n { text-align: right; }
}
