/* Layout: hero (greeting, clock, quick stats) → sticky section tabs → one view of stacked glass cards. */

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --bg: #f5f3fc;
  --surface: #ffffff;
  --surface-2: #f6f4fd;
  --card: rgba(255, 255, 255, .8);
  --fg: #1b1930;
  --muted: #6e6a87;
  --line: #e7e3f4;
  --accent: #5b4ee8;
  --accent-2: #8b7cf6;
  --accent-3: #d9539a;
  --accent-soft: #eeebfe;
  --accent-fg: #ffffff;
  --done: #a9a5bf;
  --ok: #1f9d6b;
  --warn: #c2700f;
  --blob-1: #cbbfff; --blob-2: #ffc4dd; --blob-3: #bdeee3;
  --highlight: inset 0 1px 0 rgba(255, 255, 255, .7);
  --shadow: 0 1px 2px rgba(27, 25, 48, .04), 0 18px 40px -16px rgba(60, 48, 140, .22);
  /* 16 tag colors, spread around the wheel plus brown, slate, ink and olive so no two look alike */
  --tag0: #4f46e5; --tag1: #db2777; --tag2: #0d9488; --tag3: #ca8a04;
  --tag4: #2563eb; --tag5: #16a34a; --tag6: #ea580c; --tag7: #9333ea;
  --tag8: #dc2626; --tag9: #65a30d; --tag10: #0891b2; --tag11: #c026d3;
  --tag12: #92400e; --tag13: #64748b; --tag14: #27272a; --tag15: #857a12;
  --st-done: #16a34a; --st-todo: #ea8a0c; --st-late: #e0393e; --st-low: #3b82f6; /* task states and priorities, the same in every theme */
  --radius: 24px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Bricolage Grotesque", var(--font);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #0d0c16; --surface: #191830; --surface-2: #201e38; --card: rgba(25, 24, 46, .72);
    --fg: #eeedf8; --muted: #9a96b6; --line: #2c2a48; --accent: #8b7cf6; --accent-2: #a99cfa; --accent-3: #f07ab5;
    --accent-soft: #2a2550; --accent-fg: #0f0e17; --done: #5f5b7c; --ok: #4cc79a; --warn: #f0a24a;
    --blob-1: #3b2f9a; --blob-2: #6a2257; --blob-3: #124a44;
    --highlight: inset 0 1px 0 rgba(255, 255, 255, .05);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 20px 48px -16px rgba(0, 0, 0, .7);
    --tag0: #818cf8; --tag1: #f472b6; --tag2: #2dd4bf; --tag3: #facc15;
    --tag4: #60a5fa; --tag5: #4ade80; --tag6: #fb923c; --tag7: #c084fc;
    --tag8: #f87171; --tag9: #a3e635; --tag10: #22d3ee; --tag11: #e879f9;
    --tag12: #d6a06b; --tag13: #94a3b8; --tag14: #e4e4e7; --tag15: #d4c95a;
  }
}
/* Dark mode: Lavender's dark colors, plus the shared dark shadows and tag colors the other themes build on */
:root[data-mode="dark"] {
  color-scheme: dark;
  --st-done: #4ade80; --st-todo: #fb9b3c; --st-late: #f87171; --st-low: #60a5fa;
  --bg: #0d0c16; --surface: #191830; --surface-2: #201e38; --card: rgba(25, 24, 46, .72);
  --fg: #eeedf8; --muted: #9a96b6; --line: #2c2a48; --accent: #8b7cf6; --accent-2: #a99cfa; --accent-3: #f07ab5;
  --accent-soft: #2a2550; --accent-fg: #0f0e17; --done: #5f5b7c; --ok: #4cc79a; --warn: #f0a24a;
  --blob-1: #3b2f9a; --blob-2: #6a2257; --blob-3: #124a44;
  --highlight: inset 0 1px 0 rgba(255, 255, 255, .05);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 20px 48px -16px rgba(0, 0, 0, .7);
  --tag0: #818cf8; --tag1: #f472b6; --tag2: #2dd4bf; --tag3: #facc15;
  --tag4: #60a5fa; --tag5: #4ade80; --tag6: #fb923c; --tag7: #c084fc;
  --tag8: #f87171; --tag9: #a3e635; --tag10: #22d3ee; --tag11: #e879f9;
  --tag12: #d6a06b; --tag13: #94a3b8; --tag14: #e4e4e7; --tag15: #d4c95a;
}

/* Extra themes, picked from the palette menu. Each has a dark mode further down. */
:root[data-theme="sunset"] {
  --bg: #fff5ee; --surface: #ffffff; --surface-2: #fff0e5; --card: rgba(255, 255, 255, .72);
  --fg: #2b1810; --muted: #8b6a5b; --line: #f4dccd;
  --accent: #d9481f; --accent-2: #f2763a; --accent-3: #e0386f; --accent-soft: #ffe6d8; --accent-fg: #fff;
  --done: #c3a99c; --ok: #2f9e6a; --warn: #c2620f;
  --blob-1: #ffbb8f; --blob-2: #ffb0c6; --blob-3: #ffe08a;
  --shadow: 0 1px 2px rgba(60, 20, 0, .05), 0 18px 40px -16px rgba(200, 80, 30, .3);
  --font: "DM Sans", ui-sans-serif, system-ui, sans-serif; --display: "Fraunces", Georgia, serif;
}
:root[data-theme="aurora"] {
  --bg: #eef6f6; --surface: #ffffff; --surface-2: #e7f2f2; --card: rgba(255, 255, 255, .72);
  --fg: #0c1e2a; --muted: #5d7380; --line: #d3e5e6;
  --accent: #0f9384; --accent-2: #22c3b0; --accent-3: #8b5cf6; --accent-soft: #d7f1ed; --accent-fg: #fff;
  --done: #a2b5ba; --ok: #12946a; --warn: #c27a0a;
  --blob-1: #9fe8dc; --blob-2: #cdbbff; --blob-3: #a8d8f5;
  --shadow: 0 1px 2px rgba(10, 40, 50, .05), 0 18px 40px -16px rgba(15, 130, 120, .28);
  --display: "Space Grotesk", var(--font);
}
:root[data-theme="matcha"] {
  --bg: #f3f1e7; --surface: #fffdf6; --surface-2: #f1eee1; --card: rgba(255, 253, 246, .78);
  --fg: #1f291f; --muted: #6c7464; --line: #e2ddcb;
  --accent: #3f7350; --accent-2: #6a9d6c; --accent-3: #c0843f; --accent-soft: #e3ecd9; --accent-fg: #fff;
  --done: #aab2a2; --ok: #3f7350; --warn: #b8692a;
  --blob-1: #cfe3bd; --blob-2: #f1d9b0; --blob-3: #d2e7d6;
  --shadow: 0 1px 2px rgba(30, 40, 20, .05), 0 18px 40px -18px rgba(50, 80, 40, .25);
  --radius: 18px;
  --font: "DM Sans", ui-sans-serif, system-ui, sans-serif; --display: "Fraunces", Georgia, serif;
}
:root[data-theme="matcha"] .clock { background: none; color: var(--fg); }
:root[data-theme="neon"] {
  --bg: #fbf6ff; --surface: #ffffff; --surface-2: #f6effc; --card: rgba(255, 255, 255, .75);
  --fg: #1a1030; --muted: #76688f; --line: #ecdff6;
  --accent: #e8177a; --accent-2: #ff4fa3; --accent-3: #00a9c4; --accent-soft: #ffe0ef; --accent-fg: #fff;
  --done: #b9aec9; --ok: #00a77a; --warn: #d97a00;
  --blob-1: #ffb3d9; --blob-2: #9feeff; --blob-3: #d4bbff;
  --shadow: 0 1px 2px rgba(40, 10, 60, .05), 0 18px 40px -16px rgba(232, 23, 122, .3);
  --font: "Sora", ui-sans-serif, system-ui, sans-serif; --display: "Sora", var(--font);
}
:root[data-theme="neon"][data-mode="dark"] .bg i { opacity: .35; }
:root[data-theme="neon"][data-mode="dark"] .clock { filter: drop-shadow(0 0 18px rgba(255, 46, 136, .45)); }
:root[data-theme="neon"] :is(.tabs button[aria-selected="true"], button.add, .btn.primary) { box-shadow: 0 0 22px -2px var(--accent); }
:root[data-theme="neon"] .bar span { box-shadow: 0 0 12px var(--accent); }
:root[data-theme="neon"] .card { border-color: color-mix(in srgb, var(--accent) 25%, var(--line)); }
:root[data-theme="bubblegum"] {
  --bg: #fff4fa; --surface: #ffffff; --surface-2: #ffeef7; --card: rgba(255, 255, 255, .75);
  --fg: #3b1c3e; --muted: #8f6c90; --line: #f6d9ea;
  --accent: #e43f8b; --accent-2: #ff7ab8; --accent-3: #7c6cff; --accent-soft: #ffe1f0; --accent-fg: #fff;
  --done: #c9aac6; --ok: #19a77b; --warn: #d9711a;
  --blob-1: #ffbfe0; --blob-2: #bff0e1; --blob-3: #d6ccff;
  --shadow: 0 1px 2px rgba(60, 20, 60, .05), 0 18px 40px -16px rgba(228, 63, 139, .28);
  --radius: 30px;
  --font: "Nunito", ui-sans-serif, system-ui, sans-serif; --display: "Fredoka", var(--font);
}
:root[data-theme="bubblegum"] li input[type="checkbox"] { border-radius: 8px; }
:root[data-theme="ocean"] {
  --bg: #eef5fc; --surface: #ffffff; --surface-2: #e8f1fb; --card: rgba(255, 255, 255, .75);
  --fg: #0d1b2e; --muted: #5f7088; --line: #d8e5f3;
  --accent: #1d6fd8; --accent-2: #3b9cf0; --accent-3: #14b8a6; --accent-soft: #dcebfd; --accent-fg: #fff;
  --done: #a3b2c4; --ok: #12946a; --warn: #c2700f;
  --blob-1: #a8cff8; --blob-2: #a5ece0; --blob-3: #c7d4ff;
  --shadow: 0 1px 2px rgba(10, 30, 60, .05), 0 18px 40px -16px rgba(30, 90, 180, .28);
  --display: "Sora", var(--font);
}
:root[data-theme="mocha"] {
  --bg: #f7f1ea; --surface: #fffcf8; --surface-2: #f2e9df; --card: rgba(255, 252, 248, .78);
  --fg: #2a1e16; --muted: #846f60; --line: #e8dacb;
  --accent: #8b5a3c; --accent-2: #b07a52; --accent-3: #c8553d; --accent-soft: #f0e2d4; --accent-fg: #fff;
  --done: #bcab9c; --ok: #4f8a4a; --warn: #c0661c;
  --blob-1: #e8c9a8; --blob-2: #f2d0c0; --blob-3: #d8d0b8;
  --shadow: 0 1px 2px rgba(50, 30, 10, .05), 0 18px 40px -18px rgba(110, 70, 40, .3);
  --radius: 20px;
  --font: "DM Sans", ui-sans-serif, system-ui, sans-serif; --display: "Fraunces", Georgia, serif;
}
:root[data-theme="graphite"] {
  --bg: #f5f5f3; --surface: #ffffff; --surface-2: #efefec; --card: rgba(255, 255, 255, .8);
  --fg: #111111; --muted: #6b6b6b; --line: #e2e2df;
  --accent: #1a1a1a; --accent-2: #4a4a4a; --accent-3: #ff5a36; --accent-soft: #e9e9e6; --accent-fg: #fff;
  --done: #b0b0ad; --ok: #1f9d6b; --warn: #d4570f;
  --blob-1: #dcdcd8; --blob-2: #f0ddd3; --blob-3: #d6dbe0;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 18px 40px -18px rgba(0, 0, 0, .22);
  --radius: 16px;
  --display: "Space Grotesk", var(--font);
}
:root[data-theme="nordic"] {
  --bg: #eceff4; --surface: #ffffff; --surface-2: #e5e9f0; --card: rgba(255, 255, 255, .75);
  --fg: #2e3440; --muted: #6b7487; --line: #d8dee9;
  --accent: #5e81ac; --accent-2: #81a1c1; --accent-3: #bf616a; --accent-soft: #dde5f0; --accent-fg: #fff;
  --done: #a7b0c0; --ok: #5c8a52; --warn: #c0703a;
  --blob-1: #c6d4e6; --blob-2: #e6d0d6; --blob-3: #cfe3dd;
  --shadow: 0 1px 2px rgba(30, 40, 60, .05), 0 18px 40px -16px rgba(60, 80, 120, .25);
}

/* Dark modes of the light themes (shadow tint and tag colors come from :root[data-mode="dark"]) */
:root[data-theme="sunset"][data-mode="dark"] {
  --bg: #140b08; --surface: #22140f; --surface-2: #2a1913; --card: rgba(34, 20, 15, .7);
  --fg: #fbeee6; --muted: #b8978a; --line: #3a251c;
  --accent: #ff7a45; --accent-2: #ff9a66; --accent-3: #ff5c8f; --accent-soft: #3d1f14; --accent-fg: #1a0c06;
  --done: #6e554b; --ok: #4cc79a; --warn: #ffb04a;
  --blob-1: #8a3510; --blob-2: #7a1f45; --blob-3: #6e5010;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 20px 48px -16px rgba(0, 0, 0, .7);
}
:root[data-theme="matcha"][data-mode="dark"] {
  --bg: #0f140f; --surface: #182019; --surface-2: #1d261e; --card: rgba(24, 32, 25, .72);
  --fg: #e8eee2; --muted: #9aa592; --line: #2a352b;
  --accent: #8cc48f; --accent-2: #a8d6a2; --accent-3: #e0a965; --accent-soft: #213324; --accent-fg: #0d160e;
  --done: #59644f; --ok: #8cc48f; --warn: #e0a965;
  --blob-1: #2d5a35; --blob-2: #5a4220; --blob-3: #1f4a3c;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 20px 48px -16px rgba(0, 0, 0, .7);
}
:root[data-theme="aurora"][data-mode="dark"] {
  --bg: #060a13; --surface: #0f1626; --surface-2: #131c30; --card: rgba(15, 22, 38, .62);
  --fg: #e6efff; --muted: #8796b4; --line: #1e2942;
  --accent: #2dd4bf; --accent-2: #67e8f9; --accent-3: #a78bfa; --accent-soft: #0e2c33; --accent-fg: #04121a;
  --done: #4a5773; --ok: #34d399; --warn: #fbbf24;
  --blob-1: #0f8a7c; --blob-2: #5131b3; --blob-3: #0b5f94;
  --highlight: inset 0 1px 0 rgba(255, 255, 255, .06);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 20px 48px -16px rgba(0, 0, 0, .8);
}
:root[data-theme="neon"][data-mode="dark"] {
  --bg: #09090e; --surface: #14141d; --surface-2: #191925; --card: rgba(20, 20, 30, .7);
  --fg: #f6f5ff; --muted: #908fab; --line: #2a2a3c;
  --accent: #ff2e88; --accent-2: #ff6ec4; --accent-3: #00e5ff; --accent-soft: #3a0f2c; --accent-fg: #fff;
  --done: #55546c; --ok: #00e5a0; --warn: #ffb020;
  --blob-1: #c4166a; --blob-2: #0090b0; --blob-3: #6b2fd6;
  --highlight: inset 0 1px 0 rgba(255, 255, 255, .06);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 20px 48px -16px rgba(0, 0, 0, .85);
  --tag0: #a99bff; --tag1: #ff6ec4; --tag2: #00e5c8; --tag3: #ffd84d;
  --tag4: #5cb8ff; --tag5: #5dff8a; --tag6: #ff9a5c; --tag7: #d08cff;
  --tag8: #ff5c6c; --tag9: #c4ff4d; --tag10: #3ff0ff; --tag11: #ff7cf5;
  --tag12: #e0a878; --tag13: #a3b1c6; --tag14: #f4f4f8; --tag15: #e6dc6a;
}
:root[data-theme="ocean"][data-mode="dark"] {
  --bg: #07111d; --surface: #0f1c2e; --surface-2: #13233a; --card: rgba(15, 28, 46, .7);
  --fg: #e5f0ff; --muted: #8ba0bd; --line: #1d2f48;
  --accent: #4ea8ff; --accent-2: #7cc0ff; --accent-3: #2dd4bf; --accent-soft: #11284a; --accent-fg: #04101e;
  --done: #4c5f78; --ok: #34d399; --warn: #fbbf24;
  --blob-1: #0c4a8a; --blob-2: #0b5e57; --blob-3: #33357f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 20px 48px -16px rgba(0, 0, 0, .75);
}
:root[data-theme="mocha"][data-mode="dark"] {
  --bg: #14100c; --surface: #211a14; --surface-2: #281f18; --card: rgba(33, 26, 20, .72);
  --fg: #f4ebe1; --muted: #b19d8b; --line: #3a2e24;
  --accent: #d9a273; --accent-2: #e8bb92; --accent-3: #e2795f; --accent-soft: #3a2a1d; --accent-fg: #1a120b;
  --done: #6d5d50; --ok: #8cc48f; --warn: #f0a24a;
  --blob-1: #6b4220; --blob-2: #5e2a1f; --blob-3: #4a4024;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 20px 48px -16px rgba(0, 0, 0, .7);
}
:root[data-theme="graphite"][data-mode="dark"] {
  --bg: #0c0c0d; --surface: #18181a; --surface-2: #1e1e21; --card: rgba(24, 24, 26, .75);
  --fg: #f2f2f0; --muted: #9a9a98; --line: #2b2b2e;
  --accent: #f2f2f0; --accent-2: #cfcfcc; --accent-3: #ff6a45; --accent-soft: #2a2a2d; --accent-fg: #0c0c0d;
  --done: #5a5a5c; --ok: #4cc79a; --warn: #f0a24a;
  --blob-1: #333336; --blob-2: #3a2a24; --blob-3: #242a30;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 20px 48px -16px rgba(0, 0, 0, .8);
}
/* Graphite's dark accent is near white, so the white check mark sits on the orange instead */
:root[data-theme="graphite"][data-mode="dark"] li input[type="checkbox"]:checked { background-color: var(--accent-3); }
:root[data-theme="nordic"][data-mode="dark"] {
  --bg: #20242c; --surface: #2b303b; --surface-2: #303644; --card: rgba(43, 48, 59, .75);
  --fg: #eceff4; --muted: #a0a8b8; --line: #3b4252;
  --accent: #88c0d0; --accent-2: #8fbcbb; --accent-3: #b48ead; --accent-soft: #2f3e4d; --accent-fg: #1e222a;
  --done: #5d6577; --ok: #a3be8c; --warn: #ebcb8b;
  --blob-1: #3b4f6b; --blob-2: #4d3b52; --blob-3: #2e5250;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 20px 48px -16px rgba(0, 0, 0, .6);
}
:root[data-theme="bubblegum"][data-mode="dark"] {
  --bg: #170b17; --surface: #241226; --surface-2: #2c172e; --card: rgba(36, 18, 38, .7);
  --fg: #fdeaf6; --muted: #bf98bd; --line: #3d2240;
  --accent: #ff6fb0; --accent-2: #ff9ccb; --accent-3: #9d90ff; --accent-soft: #40173a; --accent-fg: #1d0a19;
  --done: #6f5370; --ok: #4fd8a8; --warn: #ffb04a;
  --blob-1: #8a1f5c; --blob-2: #1d6b58; --blob-3: #4b3aa8;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 20px 48px -16px rgba(0, 0, 0, .7);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--fg);
  font-family: var(--font); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased;
  padding: max(28px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(48px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  transition: background-color .3s;
}
main { max-width: 680px; margin: 0 auto; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Soft drifting color blobs behind everything */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg i { position: absolute; width: 560px; height: 560px; border-radius: 50%; filter: blur(90px); opacity: .55; animation: drift 26s ease-in-out infinite alternate; }
.bg i:nth-child(1) { background: var(--blob-1); top: -220px; left: -120px; }
.bg i:nth-child(2) { background: var(--blob-2); top: 10%; right: -260px; animation-duration: 32s; animation-delay: -8s; }
.bg i:nth-child(3) { background: var(--blob-3); bottom: -280px; left: 20%; animation-duration: 38s; animation-delay: -16s; opacity: .4; }
@keyframes drift { to { transform: translate(80px, 60px) scale(1.12); } }

/* ---------- Hero ---------- */
.hero { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: start; padding: 4px 4px 18px; }
.greet { color: var(--muted); font-size: 15px; font-weight: 500; }
.clock {
  font-family: var(--display); font-size: clamp(48px, 13vw, 68px); font-weight: 700; line-height: 1; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums; margin-top: 4px;
  background: linear-gradient(120deg, var(--fg) 30%, var(--accent) 75%, var(--accent-3));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-date { color: var(--muted); font-size: 14px; font-weight: 500; margin-top: 8px; }
.hero-tools { display: flex; gap: 8px; }
.hero-chips { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.hchip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 10px; border-radius: 99px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--highlight);
  font-size: 13px; font-weight: 500; color: var(--fg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.hchip svg { width: 15px; height: 15px; color: var(--accent); flex: none; }
.hchip.warn svg { color: var(--warn); }
.hchip.fire svg { color: var(--accent-3); }
.goal-chip { cursor: pointer; font-family: inherit; transition: border-color .15s, transform .15s; }
.goal-chip:hover { border-color: var(--accent-2); }
.goal-chip:active { transform: scale(.97); }
.goal-chip svg { width: 16px; height: 16px; transform: rotate(-90deg); }
.goal-chip circle { fill: none; stroke-width: 3; }
.goal-chip .t { stroke: var(--accent-soft); }
.goal-chip .a { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .6s; }
.goal-chip.done .a { stroke: var(--ok); }
.goal-chip.done { color: var(--ok); }

.icon-btn {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--card); color: var(--fg); cursor: pointer; box-shadow: var(--highlight), var(--shadow);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); transition: color .15s, transform .15s;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { color: var(--accent); }
.icon-btn:active { transform: scale(.94); }
.icon-btn[aria-expanded="true"] { color: var(--accent); }
@media (hover: none) and (pointer: coarse) { #keys-btn, .kbd-only { display: none; } } /* no keyboard on phones: hide the shortcut button and key hints */
.mode-btn .sun, :root[data-mode="dark"] .mode-btn .moon { display: none; }
:root[data-mode="dark"] .mode-btn .sun { display: block; }

/* Theme picker */
.hero-tools { position: relative; }
.theme-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 40; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; width: 300px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  animation: enter .2s cubic-bezier(.2, .8, .2, 1);
}
.theme-menu-title { grid-column: 1 / -1; padding: 6px 10px 4px; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.theme-menu button {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 10px;
  background: none; color: var(--fg); font-size: 14px; font-weight: 500; text-align: left; cursor: pointer; transition: background .15s;
}
.theme-menu button:hover { background: var(--surface-2); }
.theme-menu button[aria-checked="true"] { background: var(--accent-soft); }
.theme-menu button[aria-checked="true"]::after { content: ""; width: 8px; height: 8px; margin-left: auto; border-radius: 50%; background: var(--accent); }
.theme-menu i {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, var(--s2), var(--s3)); box-shadow: inset 0 0 0 3px var(--s1), 0 0 0 1px var(--line);
}

/* ---------- Tabs ---------- */
.tabs {
  position: sticky; top: 10px; z-index: 20; display: flex; gap: 2px; padding: 5px; margin-bottom: 16px; overflow-x: auto; scrollbar-width: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--highlight), var(--shadow);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 13px; font-weight: 500; padding: 9px 10px; border: 0; border-radius: 13px;
  background: none; color: var(--muted); cursor: pointer; white-space: nowrap; transition: background .2s, color .2s;
}
.tabs button svg { width: 18px; height: 18px; flex: none; }
.tabs button:hover { color: var(--fg); }
.tabs button[aria-selected="true"] {
  color: var(--accent-fg); background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 6px 14px -6px var(--accent);
}
@media (max-width: 600px) { .tabs button .label { display: none; } .tabs button { padding: 10px 0; } }

/* ---------- Cards ---------- */
.view { display: flex; flex-direction: column; gap: 16px; animation: enter .35s cubic-bezier(.2, .8, .2, 1); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--highlight), var(--shadow); padding: 26px 24px;
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
}
.card.tasks-card { padding-bottom: 8px; }
@media (max-width: 480px) { .card { padding: 22px 16px; border-radius: 20px; } .card.tasks-card { padding-bottom: 6px; } }
.eyebrow { color: var(--accent); font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
h1 { margin: 4px 0 0; font-family: var(--display); font-size: 32px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.card-title { margin: 0; font-family: var(--display); font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-sub { color: var(--muted); font-size: 13px; margin: 4px 0 0; }

/* ---------- Shared controls ---------- */
.field {
  font-size: 14px; padding: 9px 11px; min-width: 0; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); color: var(--fg); transition: border-color .15s, box-shadow .15s, background .15s;
}
.field::placeholder { color: var(--muted); }
.field:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft); }
textarea.field { resize: vertical; line-height: 1.5; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 14px; font-weight: 600; padding: 11px 18px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--fg); cursor: pointer; transition: border-color .15s, background .15s, filter .15s, transform .12s;
}
.btn:hover { border-color: var(--accent-2); background: var(--accent-soft); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn.primary, .btn.primary:hover {
  min-width: 120px; border-color: transparent; color: var(--accent-fg);
  background: linear-gradient(135deg, var(--accent-2), var(--accent)); box-shadow: 0 8px 18px -8px var(--accent);
}
.btn.primary:hover { filter: brightness(1.06); }
button.add {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px;
  font-weight: 600; padding: 0 20px; border: 0; border-radius: 14px; cursor: pointer;
  background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: var(--accent-fg);
  box-shadow: 0 8px 18px -8px var(--accent); transition: transform .12s, filter .15s;
}
button.add svg { width: 18px; height: 18px; }
button.add:hover { filter: brightness(1.06); }
button.add:active { transform: translateY(1px) scale(.98); }
@media (max-width: 380px) { button.add .label { display: none; } button.add { padding: 0 14px; } }
.controls { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.hint { color: var(--muted); font-size: 13px; text-align: center; margin: 18px 0 0; }
.link-btn { padding: 0; border: 0; background: none; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.big { font-family: var(--display); font-size: 56px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; font-variant-numeric: tabular-nums; }
:is(button, summary, select, input[type="checkbox"], input[type="range"], [tabindex]):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Segmented control */
.filters { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; }
.filters button {
  font-size: 13px; font-weight: 500; padding: 6px 12px; border: 0; border-radius: 8px;
  background: none; color: var(--muted); cursor: pointer; transition: background .15s, color .15s; white-space: nowrap;
}
.filters button:hover { color: var(--fg); }
.filters button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgba(27, 25, 48, .1); }

/* Tags */
.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px 1px 6px; border-radius: 99px;
  background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--fg); font-size: 12px; font-weight: 500;
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.tagbar { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 99px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer; transition: all .15s;
}
.chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.chip:hover { color: var(--fg); border-color: var(--accent-2); }
.chip[aria-pressed="true"] { color: var(--fg); border-color: var(--c, var(--accent)); background: color-mix(in srgb, var(--c, var(--accent)) 14%, var(--surface)); }

/* ---------- Tasks ---------- */
.progress-row { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.bar { flex: 1; height: 8px; border-radius: 99px; background: var(--accent-soft); overflow: hidden; }
.bar span {
  display: block; height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  transition: width .5s cubic-bezier(.2, .8, .2, 1);
}
.count { color: var(--muted); font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }

.top-box {
  margin-top: 20px; padding: 14px 14px 6px; border-radius: 16px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 9%, transparent), color-mix(in srgb, var(--accent-3) 7%, transparent));
  border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
}
.top-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.top-head span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); }
.top-head svg { width: 15px; height: 15px; fill: currentColor; }
.top-head .n { color: var(--muted); font-weight: 500; }
.top-hint { color: var(--muted); font-size: 13px; margin: 6px 0 8px; }
.top-box ul { margin-top: 4px; }
.top-box li:hover { background: color-mix(in srgb, var(--surface) 60%, transparent); }

/* Up next: the task due soonest */
.up-next {
  margin-top: 20px; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 70%, transparent); box-shadow: var(--highlight);
  border-left: 4px solid var(--accent);
}
.up-next.late { border-left-color: var(--warn); }
.un-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.un-label { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); }
.un-label svg { width: 15px; height: 15px; }
.un-soon { padding: 2px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 12px; }
.up-next.late .un-soon { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.un-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 8px; }
.un-main { flex: 1 1 220px; min-width: 0; }
.un-text { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.up-next .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 4px; font-size: 12px; font-weight: 500; color: var(--muted); }
.up-next .due.overdue { color: var(--warn); }
.un-btns { display: flex; gap: 6px; }
.un-btns .btn { display: inline-flex; align-items: center; gap: 5px; }
.un-btns svg { width: 14px; height: 14px; }

#add-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
#new-task {
  flex: 1; min-width: 0; padding: 14px 16px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); color: var(--fg);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
#new-task::placeholder { color: var(--muted); }
#new-task:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft); }
.due-row { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.due-row label { display: inline-flex; align-items: center; gap: 8px; }
.due-row .field { padding: 7px 10px; font-size: 13px; }
/* Saved tags under the add form: tap one to tag the new task, × deletes it from the list */
.tag-pick { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.tag-pick .lbl { margin-right: 2px; }
.pick { display: inline-flex; align-items: center; }
.pick .chip { padding-right: 26px; }
.pick .x {
  margin-left: -24px; width: 20px; height: 20px; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: none; color: var(--muted); font-size: 15px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .15s, background .15s;
}
.pick:hover .x, .pick .x:focus-visible { opacity: 1; }
.pick .x:hover { background: color-mix(in srgb, var(--st-late) 16%, transparent); color: var(--st-late); }
@media (hover: none) { .pick .x { opacity: .7; } }
.chip.new { border-style: dashed; }
.pick .chip { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
/* Rename / recolor panel, opened by holding or right-clicking a saved tag */
.tag-menu {
  flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 4px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); animation: menu-in .18s ease-out;
}
.tm-name { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 600; }
.tag-menu .tm-name .field { width: 140px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; max-width: 232px; }
.swatch {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--surface); background: var(--c); cursor: pointer;
  box-shadow: 0 0 0 1px var(--line); transition: transform .12s, box-shadow .12s;
}
.swatch:hover { transform: scale(1.12); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--c); transform: scale(1.12); }
.tag-menu .edit-btns { margin-left: auto; }
.tm-move { display: flex; gap: 4px; }
.tm-move .icon-btn { width: 32px; height: 32px; border-radius: 10px; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.tm-move .icon-btn svg { width: 16px; height: 16px; }
.tm-move .icon-btn:disabled { opacity: .35; cursor: default; }
.chip.dragging { position: relative; z-index: 5; opacity: .85; cursor: grabbing; box-shadow: var(--shadow); transition: none; }
.chip.lifted { transform: scale(1.08); box-shadow: var(--shadow); }
.pick.drop-before .chip, .tagbar .chip.drop-before { box-shadow: -3px 0 0 var(--accent); }
.pick.drop-after .chip, .tagbar .chip.drop-after { box-shadow: 3px 0 0 var(--accent); }
.tagbar .chip[data-tag] { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } }
/* Tags row in the task edit form */
.edit-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.edit-tags .chip { padding: 4px 10px; font-size: 12px; }
.tag-pick .field { padding: 5px 11px; font-size: 13px; width: 130px; border-radius: 99px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.clear { font-size: 13px; font-weight: 500; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 6px 4px; border-radius: 6px; }
.clear:hover { color: var(--accent); }

ul { list-style: none; margin: 12px 0 0; padding: 0; }
li {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 4px 4px 4px 0; margin: 0 -8px;
  border-radius: 14px; transition: background .15s;
}
li + li { border-top: 1px solid var(--line); }
li:hover { background: var(--surface-2); }
li:hover + li, li:has(+ li:hover) { border-color: transparent; }
li.enter { animation: enter .3s cubic-bezier(.2, .8, .2, 1); }
@keyframes enter { from { opacity: 0; transform: translateY(-6px); } }
li > label { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; cursor: pointer; padding: 12px 8px; }

li input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; margin: 0; flex: none; cursor: pointer;
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line);
  background: var(--surface) center / 12px no-repeat;
  transition: border-color .15s, background-color .2s, transform .15s;
}
li label:hover input[type="checkbox"]:not(:checked) { border-color: var(--accent-2); }
li input[type="checkbox"]:checked {
  border-color: transparent; background-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.3l2.3 2.3 4.7-5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  animation: pop .25s ease;
}
@keyframes pop { 50% { transform: scale(1.18); } }

li .body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
li .text { overflow-wrap: anywhere; transition: color .2s; }
li.done .text { color: var(--done); text-decoration: line-through; text-decoration-thickness: 1.5px; }
li .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12px; font-weight: 500; color: var(--muted); }
li .due.today { color: var(--accent); }
li .meta :is(.prio, .repeat) { display: inline-flex; align-items: center; gap: 3px; }
li .meta :is(.prio, .repeat) svg { width: 12px; height: 12px; }
.focus-time { display: inline-flex; align-items: center; gap: 3px; color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; }
.focus-time svg { width: 12px; height: 12px; }
.task-time { margin: 8px 0 0; text-align: center; color: var(--muted); font-size: 13px; }
li .meta .prio.high { color: var(--st-late); }
li .meta .prio.med { color: var(--st-todo); }
li .meta .prio.low { color: var(--st-low); }
/* Priority tints the checkbox ring */
li.prio-high { --p: var(--st-late); }
li.prio-med { --p: var(--st-todo); }
li.prio-low { --p: var(--st-low); }
li[class*="prio-"] > label input[type="checkbox"]:not(:checked) { border-color: var(--p); background-color: color-mix(in srgb, var(--p) 10%, var(--surface)); }

/* Drag to reorder */
li.has-grip > label { padding-left: 2px; }
.grip {
  flex: none; display: grid; place-items: center; width: 22px; height: 36px; margin-left: 4px; padding: 0; border: 0; border-radius: 7px;
  background: none; color: var(--muted); cursor: grab; touch-action: none; opacity: 0; transition: opacity .15s, background .15s;
}
.grip svg { width: 16px; height: 16px; }
li:hover .grip, .grip:focus-visible { opacity: .8; }
.grip:hover { background: var(--accent-soft); color: var(--fg); }
@media (hover: none) { .grip { opacity: .45; } }
li.dragging { position: relative; z-index: 30; background: var(--surface); box-shadow: var(--shadow); opacity: .92; }
li.dragging .grip { cursor: grabbing; opacity: 1; }
li.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
li.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
.cal-day.drop-day { box-shadow: 0 0 0 2px var(--accent-3); transform: scale(1.06); }

/* Search & sort */
.find { display: flex; gap: 8px; margin-top: 18px; }
.search { position: relative; flex: 1; min-width: 0; }
.search svg { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .field { width: 100%; padding-left: 34px; }
.find select { flex: none; }
.find + .toolbar { margin-top: 12px; }
li .due.overdue { color: var(--warn); }
li.done .meta { opacity: .6; }

.actions { display: flex; align-items: center; margin-right: 4px; }
.act {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px; border: 0; background: none;
  color: var(--muted); cursor: pointer; border-radius: 9px; opacity: 0; transition: opacity .15s, background .15s, color .15s;
}
.act svg { width: 16px; height: 16px; }
li:hover .act, .act:focus-visible, .act[aria-pressed="true"], .act[aria-expanded="true"] { opacity: 1; }
.act:hover { background: var(--accent-soft); color: var(--fg); }
.act.star[aria-pressed="true"] { color: #f2a516; }
.act.star[aria-pressed="true"] svg { fill: currentColor; }
.act[aria-expanded="true"] { color: var(--accent); }
@media (hover: none) { .act { opacity: .7; } }

/* Subtasks */
.subs { flex-basis: 100%; margin: -4px 0 8px 44px; padding-left: 12px; border-left: 2px solid var(--accent-soft); }
.sub { display: flex; align-items: center; border-radius: 9px; }
.sub:hover { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.sub label { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 6px; cursor: pointer; font-size: 14px; }
.sub label span { overflow-wrap: anywhere; }
li .sub input[type="checkbox"] { width: 17px; height: 17px; background-size: 9px; }
.sub.done span { color: var(--done); text-decoration: line-through; }
.sub .act { width: 28px; height: 28px; }
.sub:hover .act { opacity: 1; }
.sub-add { margin: 4px 0 2px; }
.sub-add .field { width: 100%; padding: 7px 10px; font-size: 13px; }

/* Editing a task in place */
li.editing { background: var(--surface-2); padding: 10px 12px; }
li.editing:hover { background: var(--surface-2); }
.edit { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.edit > .field { width: 100%; font-size: 15px; padding: 10px 12px; }
.edit .due-row .field[type="text"] { width: 110px; }
.edit-btns { display: flex; gap: 6px; margin-left: auto; }
.edit-btns .btn.primary { min-width: 0; }

.empty { text-align: center; padding: 32px 16px 28px; color: var(--muted); }
.empty svg { width: 56px; height: 56px; color: var(--accent-2); opacity: .7; }
/* Quokka mascot: rounded tiles that bob in gently */
.bear { display: block; border-radius: 22%; box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .35); }
.empty .bear { width: 96px; height: 96px; margin: 0 auto; animation: bear-in .5s cubic-bezier(.3, 1.4, .5, 1) both; }
.bear-note { display: flex; align-items: center; gap: 12px; }
.bear-note .bear { flex: none; width: 52px; height: 52px; }
.overlay-card .ring-bear { width: 104px; height: 104px; margin: 0 auto; animation: bear-in .5s cubic-bezier(.3, 1.4, .5, 1) both, bear-bob 2.4s ease-in-out .5s infinite; }
.toast .bear { flex: none; width: 34px; height: 34px; border-radius: 9px; margin: -4px 0 -4px -8px; box-shadow: none; }
@keyframes bear-in { from { opacity: 0; transform: translateY(8px) scale(.85); } }
@keyframes bear-bob { 50% { transform: translateY(-5px) rotate(-2deg); } }
@media (prefers-reduced-motion: reduce) { .bear { animation: none !important; } }
.empty p { margin: 8px 0 0; font-size: 14px; }
.empty strong { display: block; color: var(--fg); font-weight: 600; margin-top: 10px; }

.sync {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 12px;
  margin: 16px -24px 0; padding: 14px 24px 6px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px;
}
@media (max-width: 480px) { .sync { margin-inline: -16px; padding-inline: 16px; } }
.status { display: inline-flex; align-items: center; gap: 8px; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.status[data-state="ok"]::before { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
.status[data-state="busy"]::before { background: var(--accent); animation: pulse 1s ease-in-out infinite; }
.status[data-state="off"]::before { background: var(--warn); }
@keyframes pulse { 50% { opacity: .35; } }
.sync input { flex: 1 1 100%; min-width: 0; font-size: 12px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--fg); }
footer.note { text-align: center; color: var(--muted); font-size: 12px; opacity: .8; }

/* ---------- Agenda ---------- */
.cd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 16px; }
.countdown {
  position: relative; padding: 14px 14px 12px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface-2);
  overflow: hidden;
}
.countdown::after { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.countdown.soon::after { background: linear-gradient(90deg, var(--warn), var(--accent-3)); }
.countdown.past { opacity: .6; }
.cd-num { font-family: var(--display); font-size: 34px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.cd-unit { color: var(--muted); font-size: 12px; font-weight: 500; margin-top: 2px; min-height: 1em; }
.cd-title { font-weight: 600; margin-top: 10px; overflow-wrap: anywhere; }
.cd-date { color: var(--muted); font-size: 12px; }
.countdown .act { position: absolute; top: 8px; right: 6px; }
.countdown:hover .act { opacity: 1; }
.cd-prog { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; font-size: 12px; font-weight: 500; color: var(--muted); }
.cd-bar { height: 6px; border-radius: 99px; background: var(--accent-soft); overflow: hidden; }
.cd-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.cd-prog.full { color: var(--ok); font-weight: 600; }
.cd-prog.full .cd-bar span { background: var(--ok); }
.cd-plan-btn {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 10px; padding: 4px 10px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: color .15s, border-color .15s;
}
.cd-plan-btn svg { width: 13px; height: 13px; }
.cd-plan-btn:hover, .cd-plan-btn.on { color: var(--accent); border-color: var(--accent); }
.cd-plan {
  display: flex; flex-direction: column; gap: 12px; margin-top: 12px; padding: 14px; border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 8%, var(--surface-2)), var(--surface-2));
  animation: menu-in .18s ease-out;
}
.cdp-head { display: flex; align-items: center; gap: 12px; }
.cdp-head b { display: block; font-size: 15px; }
.cdp-head span { color: var(--muted); font-size: 13px; }
.cdp-days { display: flex; flex-wrap: wrap; gap: 6px; }
.cdp-day { padding: 3px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; }
.cdp-day.final { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.cd-plan .edit-btns { margin-left: auto; }
.bear.sm { width: 48px; height: 48px; flex: none; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.inline-form .grow { flex: 1 1 160px; }
.inline-form .field { padding: 10px 12px; font-size: 15px; }
.inline-form .add { min-height: 44px; }

.agenda-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 16px; }
.week button {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 7px; min-width: 0;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); color: var(--fg); cursor: pointer;
  transition: border-color .15s, background .15s, color .15s, transform .15s;
}
.week button:hover { border-color: var(--accent-2); transform: translateY(-1px); }
.week button.today { border-color: var(--accent-2); }
.week button[aria-pressed="true"] { background: linear-gradient(160deg, var(--accent-2), var(--accent)); border-color: transparent; color: var(--accent-fg); }
.week .dow { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; opacity: .7; }
.week .num { font-family: var(--display); font-size: 18px; font-weight: 700; }
.week .dots { display: flex; gap: 2px; height: 5px; }
.week .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent-2); }
.week button[aria-pressed="true"] .dots i { background: currentColor; }
.group h2 {
  display: flex; justify-content: space-between; margin: 22px 0 0; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
}
.group h2.overdue { color: var(--warn); }
.group ul { margin-top: 4px; }

/* Repeating tab: group headings inside the task list, and tasks resting until their next date */
li.list-head {
  display: flex; justify-content: space-between; padding: 18px 4px 6px; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: none; pointer-events: none;
}
li.list-head:first-child { padding-top: 6px; }
li.list-head + li, li + li.list-head { border-top-color: transparent; }
li.list-head.later { color: var(--accent); }
li.later { opacity: .6; }
li.later:hover { opacity: 1; }

.plan-day { margin: 22px 0 0; font-family: var(--display); font-size: 18px; font-weight: 700; }
.timeline { margin-top: 12px; }
.slot { position: relative; display: grid; grid-template-columns: 64px 1fr; min-height: 46px; border-top: 1px dashed var(--line); }
.slot-time { padding-top: 6px; color: var(--muted); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
.slot.past .slot-time { opacity: .55; }
.slot.now { border-top: 2px solid var(--accent-3); }
.slot.now .slot-time { color: var(--accent-3); font-weight: 600; }
.slot-body { display: flex; flex-direction: column; gap: 4px; padding: 5px 38px 5px 0; }
.block {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 10px; font-size: 14px;
  background: color-mix(in srgb, var(--c, var(--accent)) 14%, var(--surface)); border-left: 3px solid var(--c, var(--accent));
}
.block input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; flex: none; cursor: pointer; }
.block-time { color: var(--muted); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
.block-text { overflow-wrap: anywhere; }
.block.done .block-text { color: var(--done); text-decoration: line-through; }
.slot-plus {
  position: absolute; top: 7px; right: 0; display: grid; place-items: center; width: 30px; height: 30px; border: 1px dashed transparent; border-radius: 9px;
  background: none; color: var(--muted); cursor: pointer; opacity: 0; transition: opacity .15s, border-color .15s, color .15s;
}
.slot-plus svg { width: 16px; height: 16px; }
.slot:hover .slot-plus, .slot-plus:focus-visible { opacity: 1; border-color: var(--line); }
.slot-plus:hover { color: var(--accent); border-color: var(--accent-2); }
@media (hover: none) { .slot-plus { opacity: .6; } }
.slot-add .field { width: 100%; }

/* Month calendar */
.cal-head { display: flex; align-items: center; gap: 4px; margin-top: 18px; }
.cal-head .act { opacity: 1; width: 36px; height: 36px; }
.cal-title { flex: 1; order: -1; margin: 0; font-family: var(--display); font-size: 18px; font-weight: 700; }
.cal-head .btn { margin-left: 6px; }
.cal-title::first-letter { text-transform: uppercase; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 12px; }
.cal-dow { text-align: center; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; padding-bottom: 2px; }
.cal-day {
  --c: var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 3px; min-width: 0; min-height: 54px; padding: 7px 2px 6px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--fg); cursor: pointer;
  font-variant-numeric: tabular-nums; transition: border-color .15s, transform .15s, box-shadow .15s;
}
.cal-day:hover { transform: translateY(-1px); border-color: var(--accent-2); }
.cal-day.done { --c: var(--st-done); }
.cal-day.todo { --c: var(--st-todo); }
.cal-day.late { --c: var(--st-late); }
.cal-day:is(.done, .todo, .late) { background: color-mix(in srgb, var(--c) 15%, var(--surface)); border-color: color-mix(in srgb, var(--c) 45%, transparent); }
.cal-day.today .cal-num { color: var(--accent-fg); background: var(--accent); }
.cal-day[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--accent); border-color: transparent; }
.cal-num { display: grid; place-items: center; min-width: 24px; height: 24px; padding: 0 4px; border-radius: 99px; font-size: 13px; font-weight: 600; }
.cal-dots { display: flex; align-items: center; gap: 2px; height: 8px; }
.cal-dots i, .cal-legend i { width: 6px; height: 6px; border-radius: 50%; background: var(--st-todo); }
.cal-dots i.done, .cal-legend .done i { background: var(--st-done); }
.cal-dots i.late, .cal-legend .late i { background: var(--st-late); }
.cal-dots b { font-size: 9px; font-weight: 700; color: var(--muted); line-height: 1; }
.cal-legend { display: flex; justify-content: center; gap: 16px; margin-top: 12px; color: var(--muted); font-size: 12px; font-weight: 500; }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 480px) { .cal { gap: 3px; } .cal-day { min-height: 48px; border-radius: 10px; } }

/* ---------- Focus ---------- */
.modes { display: flex; width: fit-content; max-width: 100%; margin: 18px auto 0; }
.dial { position: relative; width: min(260px, 72vw); aspect-ratio: 1; margin: 24px auto 0; }
.dial::before {
  content: ""; position: absolute; inset: 12%; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%); filter: blur(10px);
}
.dial[data-mode="short"]::before, .dial[data-mode="long"]::before { background: radial-gradient(circle, color-mix(in srgb, var(--ok) 16%, transparent), transparent 70%); }
.dial svg { position: relative; width: 100%; height: 100%; transform: rotate(-90deg); }
.dial .track { stroke: var(--accent-soft); }
.dial .arc { stroke: url(#arc-grad); stroke-linecap: round; transition: stroke-dashoffset .3s linear; }
.dial[data-mode="short"] .arc, .dial[data-mode="long"] .arc { stroke: var(--ok); }
.dial .readout { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.dial .phase { color: var(--muted); font-size: 13px; font-weight: 500; margin-top: 8px; }
.working { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; color: var(--muted); font-size: 13px; }
.working select { max-width: 230px; }
.settings { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14px; }
.settings summary { cursor: pointer; color: var(--muted); font-weight: 500; }
.settings summary:hover { color: var(--fg); }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-top: 12px; }
.settings-grid label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; }
/* Alert sound settings: volume, repeat, and buttons to hear each timer sound */
.alert-set { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 12px; color: var(--muted); }
.alert-set > label:first-child { display: flex; align-items: center; gap: 10px; flex: 1 1 200px; }
.alert-set input[type="range"] { flex: 1; accent-color: var(--accent); }
.alert-set .check { margin: 0; }
.tune-test { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 14px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }

.sounds { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 8px; margin-top: 14px; }
.sound {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px 10px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all .15s;
}
.sound svg { width: 24px; height: 24px; }
.sound:hover { color: var(--fg); border-color: var(--accent-2); }
.sound[aria-pressed="true"] { color: var(--accent-fg); border-color: transparent; background: linear-gradient(150deg, var(--accent-2), var(--accent)); box-shadow: 0 8px 18px -10px var(--accent); }
.sound[aria-pressed="true"] svg { animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.12); } }
.sound-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 18px; margin-top: 14px; font-size: 14px; color: var(--muted); }
.sound-row label:first-child { display: flex; align-items: center; gap: 10px; flex: 1 1 200px; }
.sound-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.sound-row .check { margin: 0; }

/* Daily focus goal ring */
.goal { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 16px; padding: 12px 14px; border-radius: 16px;
  background: var(--surface-2); border: 1px solid var(--line); }
.goal-ring { position: relative; width: 64px; height: 64px; flex: none; }
.goal-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.goal-ring .track { stroke: var(--accent-soft); }
.goal-ring .arc { stroke: url(#arc-grad); stroke-linecap: round; transition: stroke-dashoffset .6s cubic-bezier(.2, .8, .2, 1); }
.goal.done .goal-ring .arc { stroke: var(--ok); }
.goal-ring span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.goal-text { flex: 1 1 140px; min-width: 0; }
.goal-text b { display: block; font-family: var(--display); font-size: 20px; line-height: 1.2; }
.goal-text span { color: var(--muted); font-size: 13px; }
.goal.done .goal-text span { color: var(--ok); font-weight: 600; }
.goal-set { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.goal-set .field { padding: 7px 10px; font-size: 13px; }
.goal-custom { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex-basis: 100%; color: var(--muted); font-size: 13px; animation: enter .2s ease; }
.goal-custom .field { width: 64px; padding: 7px 8px; font-size: 13px; text-align: center; }
.goal-custom span { margin-right: 6px; }
.goal-custom .btn.small:first-of-type { margin-left: auto; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.stat b { display: block; font-family: var(--display); font-size: 24px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat span { color: var(--muted); font-size: 12px; }
.chart { position: relative; display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 18px; }
.chart .col { display: flex; flex-direction: column; align-items: center; gap: 6px; border-radius: 10px; padding-top: 4px; cursor: default; outline-offset: 0; }
.chart .col:hover, .chart .col:focus-visible { background: var(--surface-2); }
.chart .barwrap { position: relative; width: 100%; height: 120px; display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid var(--line); }
.chart .bar-v { width: min(28px, 60%); min-height: 2px; border-radius: 4px 4px 0 0; background: var(--accent); transition: height .4s cubic-bezier(.2, .8, .2, 1); }
.chart .bar-v.zero { background: var(--line); }
.chart .col-label { color: var(--muted); font-size: 12px; padding-bottom: 4px; }
.chart .col { cursor: pointer; }
.chart .col.picked { background: var(--accent-soft); }
.chart .col.picked .col-label { color: var(--accent); font-weight: 600; }
/* Details for the day picked in the chart */
.day-detail { margin-top: 12px; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface-2); animation: menu-in .18s ease-out; }
.dd-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dd-head b { font-size: 15px; }
.day-detail .act { opacity: 1; }
.dd-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.dd-pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; }
.dd-pill svg { width: 13px; height: 13px; }
.dd-pill.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.dd-list { margin-top: 8px; }
.dd-list li { margin: 0; padding: 5px 0; gap: 8px; flex-wrap: nowrap; border-top: 1px solid var(--line); font-size: 14px; }
.dd-list li:first-child { border-top: 0; }
.dd-list li:hover { background: none; }
.dd-time { flex: none; width: 64px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.dd-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.chart .col.is-today .col-label { color: var(--fg); font-weight: 600; }
.chart .tip {
  position: absolute; z-index: 2; transform: translate(-50%, -100%); pointer-events: none; white-space: nowrap;
  padding: 6px 10px; border-radius: 8px; background: var(--fg); color: var(--bg); font-size: 12px; font-weight: 500;
  box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .4);
}
.chart .tip b { font-weight: 700; }

.notes { width: 100%; min-height: 180px; margin-top: 14px; font-size: 15px; padding: 12px 14px; border-radius: 14px; }
.notes-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 10px; color: var(--muted); font-size: 12px; }
.notes-foot div { display: flex; gap: 6px; }

/* ---------- Stopwatch ---------- */
.watch { text-align: center; margin: 28px 0 4px; }
.watch .big { font-size: clamp(52px, 16vw, 84px); }
.watch .cs { font-size: .45em; color: var(--muted); }
.laps { margin-top: 18px; }
.laps li { display: grid; grid-template-columns: 1fr auto auto; gap: 18px; padding: 11px 8px; font-variant-numeric: tabular-nums; }
.laps .lap-n, .laps .lap-total { color: var(--muted); }
.laps li.best .lap-t { color: var(--ok); }
.laps li.worst .lap-t { color: var(--warn); }

/* ---------- Alarms & breaks ---------- */
li.alarm { padding-right: 4px; gap: 10px; flex-wrap: nowrap; }
.alarm-info { flex: 1; min-width: 0; padding: 10px 8px; }
.alarm-time { font-family: var(--display); font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.alarm-meta { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
li.alarm.off .alarm-time { color: var(--done); }
.switch { position: relative; flex: none; width: 44px; height: 26px; }
.switch input[type="checkbox"] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; animation: none; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line); pointer-events: none; transition: background .2s; }
.switch span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s cubic-bezier(.2, .8, .2, 1);
}
.switch input:checked + span { background: linear-gradient(135deg, var(--accent-2), var(--accent)); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.breaks { margin-top: 12px; }
.break-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.break-row + .break-row { border-top: 1px solid var(--line); }
.break-ico { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.break-ico svg { width: 20px; height: 20px; }
.break-info { flex: 1; min-width: 0; }
.break-info b { display: block; font-weight: 600; }
.break-info span { color: var(--muted); font-size: 13px; }
.break-every { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.break-every input { width: 62px; padding: 6px 8px; }
.break-every input[type="time"] { width: auto; }
#ring-text { white-space: pre-line; }
.export-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.sx-summary .btn { flex: none; }
@media (max-width: 420px) { .break-every .unit { display: none; } }

/* ---------- Flashcards ---------- */
.study-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.study-progress { color: var(--muted); font-size: 13px; font-weight: 500; }
.flash { margin-top: 18px; perspective: 1200px; cursor: pointer; }
.flash-inner { display: grid; transition: transform .55s cubic-bezier(.3, .7, .2, 1); transform-style: preserve-3d; }
.flash.flipped .flash-inner { transform: rotateY(180deg); }
.face {
  grid-area: 1 / 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  min-height: 210px; padding: 28px 22px; border-radius: 20px; text-align: center; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow);
  font-size: 20px; font-weight: 500; white-space: pre-wrap; overflow-wrap: anywhere;
}
.face small { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.face-back { transform: rotateY(180deg); background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 10%, var(--surface)), var(--surface)); }
.grades { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.grades .btn { flex-direction: column; gap: 1px; padding: 10px 6px; }
.grades .btn small { color: var(--muted); font-size: 11px; font-weight: 500; }
.grades .again { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.grades .easy { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.card-form { display: grid; gap: 8px; margin-top: 14px; }
.card-form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 520px) { .card-form .row { grid-template-columns: 1fr; } }
.card-form .add { justify-self: start; }
.card-form textarea { min-height: 72px; }
details.more { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
details.more summary { cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 500; }
details.more summary:hover { color: var(--fg); }
.card-list li { flex-wrap: nowrap; padding: 10px 4px 10px 8px; gap: 10px; }
.cl-main { flex: 1; min-width: 0; }
.cl-front { font-weight: 500; overflow-wrap: anywhere; }
.cl-back { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.cl-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 3px; color: var(--muted); font-size: 12px; }

/* ---------- Overlays & toast ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: color-mix(in srgb, var(--bg) 65%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } }
.overlay-card {
  width: min(400px, 100%); text-align: center; padding: 28px 22px 22px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow);
  animation: enter .3s cubic-bezier(.2, .8, .2, 1);
}
.overlay-card .bell { width: 52px; height: 52px; padding: 12px; border-radius: 16px; color: var(--accent-fg); background: linear-gradient(135deg, var(--accent-2), var(--accent)); animation: shake .7s ease-in-out infinite; }
@keyframes shake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }
.overlay-card h2 { margin: 14px 0 4px; font-family: var(--display); font-size: 26px; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.overlay-card p { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.keys-card { text-align: left; }
.keys-card h2 { margin-top: 0; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 9px 14px; margin: 16px 0 4px; font-size: 14px; align-items: center; }
kbd {
  display: inline-block; min-width: 26px; padding: 3px 7px; border-radius: 7px; text-align: center;
  border: 1px solid var(--line); border-bottom-width: 2px; background: var(--surface-2); font: 600 12px var(--font);
}
.toast {
  display: flex; align-items: center; gap: 14px;
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom, 0px)); z-index: 60; transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px; background: var(--fg); color: var(--bg);
  font-size: 14px; font-weight: 500; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .5); animation: enter .25s ease;
}

.toast-btn {
  flex: none; padding: 4px 10px; margin: -4px -6px -4px 0; border: 0; border-radius: 8px; cursor: pointer;
  background: color-mix(in srgb, var(--bg) 18%, transparent); color: var(--bg); font-weight: 700; font-size: 14px;
}
.toast-btn:hover { background: color-mix(in srgb, var(--bg) 30%, transparent); }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 70; pointer-events: none; }

/* ---------- Stats & grades ---------- */
.sx-summary {
  display: flex; align-items: center; gap: 14px; margin-top: 16px; padding: 12px 16px; border-radius: 16px; border: 1px solid var(--line);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 9%, transparent), color-mix(in srgb, var(--accent-3) 6%, transparent));
}
.sx-summary > div { flex: 1; min-width: 0; }
.sx-summary b { display: block; font-family: var(--display); font-size: 18px; line-height: 1.25; }
.sx-summary span { color: var(--muted); font-size: 13px; }
.sx-summary .sx-trend { flex: none; padding: 4px 10px; border-radius: 99px; font-size: 13px; font-weight: 700; }
.sx-summary.up .sx-trend { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.sx-summary.down .sx-trend { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.sx-h { margin: 24px 0 0; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.chart.weeks { grid-template-columns: repeat(8, 1fr); }
.chart.weeks .barwrap { flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; }
.chart .val { color: var(--muted); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart.weeks .col-label { font-size: 11px; white-space: nowrap; }
.hbars { display: grid; gap: 10px; margin-top: 14px; }
.hbar { display: grid; grid-template-columns: minmax(70px, 30%) 1fr auto; align-items: center; gap: 10px; font-size: 13px; }
.hbar-label { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-val { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hbar-track { display: block; height: 10px; border-radius: 99px; background: var(--accent-soft); overflow: hidden; }
.hbar-track i { display: block; height: 100%; border-radius: inherit; background: var(--c, var(--accent)); transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.hbar.best .hbar-label { color: var(--accent); font-weight: 700; }
.hbar.best .hbar-label::after { content: " ★"; }
.gr-scale { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.gr-scale .field { padding: 6px 8px; font-size: 13px; }
.gr-overall { display: flex; align-items: baseline; gap: 10px; margin-top: 14px; }
.gr-overall b { font-family: var(--display); font-size: 40px; line-height: 1; font-variant-numeric: tabular-nums; }
.gr-overall span { color: var(--muted); font-size: 13px; }
.gr-subject { padding: 14px 0; border-bottom: 1px solid var(--line); }
.gr-subject:first-child { margin-top: 6px; }
.gr-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.gr-head b { font-weight: 600; overflow-wrap: anywhere; }
.gr-avg { font-family: var(--display); font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gr-marks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.gr-mark {
  display: inline-flex; align-items: center; gap: 2px; padding: 2px 2px 2px 10px; border-radius: 99px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums;
}
.gr-mark .act { width: 22px; height: 22px; opacity: .55; }
.gr-mark .act svg { width: 12px; height: 12px; }
.gr-mark:hover .act { opacity: 1; }
.gr-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.gr-form > .field { flex: 1 1 140px; }
.gr-score { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.gr-score .field { width: 76px; }
.gr-weight { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.gr-weight .field { width: 64px; }
.gr-form .add { min-height: 42px; }

/* Sound mixer */
.mixer { display: grid; gap: 8px; margin-top: 12px; }
.mixer:empty { display: none; }
.mix-row { display: flex; align-items: center; gap: 10px; padding: 6px 4px 6px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; }
.mix-name { display: inline-flex; align-items: center; gap: 8px; width: 120px; flex: none; font-weight: 500; }
.mix-name svg { width: 18px; height: 18px; color: var(--accent); }
.mix-row input[type="range"] { flex: 1; min-width: 0; accent-color: var(--accent); }
.mix-row .act { opacity: .6; }
.mix-row .act:hover { opacity: 1; }

/* ---------- Desktop ---------- */
/* Phones keep the single column (.side is invisible to layout). On wide screens the hero and tabs become a sticky
   sidebar on the left, and sections with several cards lay them out side by side. */
.side { display: contents; }
@media (min-width: 1000px) {
  body { padding: 40px 40px 56px; }
  main { max-width: 1280px; display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 40px; align-items: start; }
  .side { position: sticky; top: 40px; display: flex; flex-direction: column; gap: 20px; }
  .hero { grid-template-columns: 1fr; padding: 4px 4px 0; }
  .hero-chips { grid-row: 2; margin-top: 8px; }
  .hero-tools { grid-row: 3; margin-top: 10px; }
  .clock { font-size: 64px; }

  .tabs { position: static; flex-direction: column; gap: 4px; padding: 8px; margin: 0; overflow: visible; }
  .tabs button { justify-content: flex-start; gap: 12px; padding: 11px 14px; font-size: 14px; }
  .tabs button .label { display: inline; }
  .tabs button:hover:not([aria-selected="true"]) { background: var(--surface-2); }

  .view { gap: 20px; }
  .card { padding: 30px 32px; }
  .card.tasks-card { padding-bottom: 10px; }
  .sync { margin-inline: -32px; padding-inline: 32px; }
  .watch { margin: 48px 0 12px; }
  .watch .big { font-size: 112px; }
  .dial { width: 300px; }
}
@media (min-width: 1280px) {
  .view[data-view="focus"], .view[data-view="cards"], .view[data-view="alarms"], .view[data-view="stats"] {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch;
  }
  .view[data-view="focus"] > .card:first-child { grid-row: span 2; }
  .view[data-view="focus"] > .card:last-child { grid-column: 1 / -1; }
}

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