/* Second Brain AI — Liquid Glass Design System (offline, no CDN) */
:root {
  --font: -apple-system, "Segoe UI", Roboto, "Noto Sans", Inter, system-ui, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --r-sm: 10px; --r: 16px; --r-lg: 22px; --r-xl: 28px;
  --nav-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --ease: cubic-bezier(.2,.8,.2,1);
  --spring: cubic-bezier(.34,1.56,.64,1);
  --dur: .28s;
}
/* Theme: Dark Liquid Glass (default) */
[data-theme="dark"] {
  --bg: #070a14; --bg2: #0d1224;
  --orb1: #5b5bf7; --orb2: #c026d3; --orb3: #06b6d4;
  --glass: rgba(255,255,255,.07); --glass-2: rgba(255,255,255,.11); --glass-solid: #151a2e;
  --stroke: rgba(255,255,255,.12); --stroke-2: rgba(255,255,255,.22);
  --text: #f1f3fb; --text-2: #b6bdd6; --text-3: #8a91ad;
  --accent: #8b8cff; --accent-2: #c084fc; --accent-ink: #0b0d1a;
  --ok: #34d399; --warn: #fbbf24; --bad: #f87171; --info: #38bdf8;
  --shadow: 0 10px 40px rgba(0,0,0,.45);
  --blur: 22px;
  color-scheme: dark;
}
/* Theme: Light Frosted Glass */
[data-theme="light"] {
  --bg: #eef1f8; --bg2: #e4e8f4;
  --orb1: #a5b4fc; --orb2: #f9a8d4; --orb3: #67e8f9;
  --glass: rgba(255,255,255,.62); --glass-2: rgba(255,255,255,.8); --glass-solid: #ffffff;
  --stroke: rgba(20,30,70,.10); --stroke-2: rgba(20,30,70,.2);
  --text: #121628; --text-2: #3e4562; --text-3: #5d6585;
  --accent: #4f46e5; --accent-2: #9333ea; --accent-ink: #ffffff;
  --ok: #047857; --warn: #b45309; --bad: #dc2626; --info: #0369a1;
  --shadow: 0 10px 30px rgba(40,50,100,.14);
  --blur: 20px;
  color-scheme: light;
}
/* Theme: AI Glass Workspace */
[data-theme="ai"] {
  --bg: #02060c; --bg2: #061321;
  --orb1: #0ea5e9; --orb2: #10b981; --orb3: #6366f1;
  --glass: rgba(56,189,248,.07); --glass-2: rgba(56,189,248,.12); --glass-solid: #0a1a2a;
  --stroke: rgba(125,211,252,.16); --stroke-2: rgba(125,211,252,.3);
  --text: #e6f6ff; --text-2: #a7c7da; --text-3: #7f9fb3;
  --accent: #22d3ee; --accent-2: #34d399; --accent-ink: #00141c;
  --ok: #34d399; --warn: #facc15; --bad: #fb7185; --info: #7dd3fc;
  --shadow: 0 10px 40px rgba(0,20,40,.6);
  --blur: 24px;
  color-scheme: dark;
}
/* Theme: Minimal Glass */
[data-theme="minimal"] {
  --bg: #111113; --bg2: #161618;
  --orb1: #3f3f46; --orb2: #27272a; --orb3: #52525b;
  --glass: rgba(255,255,255,.045); --glass-2: rgba(255,255,255,.08); --glass-solid: #1c1c1f;
  --stroke: rgba(255,255,255,.09); --stroke-2: rgba(255,255,255,.18);
  --text: #f4f4f5; --text-2: #b4b4bb; --text-3: #8e8e96;
  --accent: #e4e4e7; --accent-2: #a1a1aa; --accent-ink: #111113;
  --ok: #4ade80; --warn: #facc15; --bad: #f87171; --info: #93c5fd;
  --shadow: 0 6px 20px rgba(0,0,0,.4);
  --blur: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.45; overscroll-behavior: none; }
body { overflow: hidden; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--accent); }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Ambient background orbs */
#bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; background: radial-gradient(120% 80% at 50% 0%, var(--bg2), var(--bg)); }
#bg i { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; animation: drift 22s var(--ease) infinite alternate; }
#bg i:nth-child(1) { width: 60vw; height: 60vw; background: var(--orb1); top: -15vw; left: -10vw; }
#bg i:nth-child(2) { width: 55vw; height: 55vw; background: var(--orb2); top: 40vh; right: -20vw; animation-delay: -7s; opacity: .35; }
#bg i:nth-child(3) { width: 45vw; height: 45vw; background: var(--orb3); bottom: -10vw; left: 10vw; animation-delay: -13s; opacity: .3; }
@keyframes drift { 0% { transform: translate(0,0) scale(1); } 100% { transform: translate(6vw, 4vh) scale(1.15); } }

/* App shell */
#app { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; }
#view { flex: 1; overflow-y: auto; overflow-x: hidden; padding: calc(var(--safe-t) + 8px) 16px calc(var(--nav-h) + var(--safe-b) + 90px); scroll-behavior: smooth; -webkit-overflow-scrolling: touch; }
#view.no-nav { padding-bottom: 40px; }
.screen { animation: screenIn var(--dur) var(--ease); max-width: 760px; margin: 0 auto; }
.screen.back { animation-name: screenBack; }
@keyframes screenIn { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes screenBack { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }

/* Glass primitives */
.glass { background: var(--glass); border: 1px solid var(--stroke); border-radius: var(--r-lg); backdrop-filter: blur(var(--blur)) saturate(160%); -webkit-backdrop-filter: blur(var(--blur)) saturate(160%); box-shadow: var(--shadow); }
.card { background: var(--glass); border: 1px solid var(--stroke); border-radius: var(--r-lg); padding: 16px; margin-bottom: 12px; backdrop-filter: blur(var(--blur)) saturate(150%); -webkit-backdrop-filter: blur(var(--blur)) saturate(150%); position: relative; overflow: hidden; }
.card::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: linear-gradient(135deg, rgba(255,255,255,.10), transparent 40%); }
[data-theme="light"] .card::before { background: linear-gradient(135deg, rgba(255,255,255,.7), transparent 45%); }
.card.tap { transition: transform .15s var(--ease), background .2s; cursor: pointer; }
.card.tap:active { transform: scale(.98); background: var(--glass-2); }
.card h3 { margin: 0 0 10px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card h3 .more { margin-left: auto; font-size: 13px; color: var(--accent); font-weight: 500; }

/* Reduced transparency */
.reduce-transparency .card, .reduce-transparency .glass, .reduce-transparency #nav, .reduce-transparency .sheet, .reduce-transparency .topbar.stuck { background: var(--glass-solid) !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
.reduce-transparency #bg i { display: none; }
/* Reduced motion */
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; scroll-behavior: auto !important; }
@media (prefers-reduced-motion: reduce) { #bg i { animation: none; } }

/* Top bar */
.topbar { display: flex; align-items: center; gap: 10px; min-height: 52px; margin-bottom: 8px; }
.topbar h1 { font-size: 24px; margin: 0; font-weight: 750; letter-spacing: -.02em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar h1 small { display: block; font-size: 13px; font-weight: 500; color: var(--text-3); letter-spacing: 0; }
.icon-btn { width: 44px; height: 44px; border-radius: 14px; display: inline-grid; place-items: center; background: var(--glass); border: 1px solid var(--stroke); flex: none; transition: transform .15s, background .2s; position: relative; }
.icon-btn:active { transform: scale(.9); background: var(--glass-2); }
.icon-btn svg { width: 21px; height: 21px; }
.icon-btn .dot { position: absolute; top: 8px; right: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--bad); border: 2px solid var(--bg); }
.icon-btn.plain { background: none; border-color: transparent; }
svg.i { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i.sm { width: 16px; height: 16px; }
svg.i.lg { width: 28px; height: 28px; }

/* Bottom navigation */
#nav { position: fixed; left: 12px; right: 12px; bottom: calc(10px + var(--safe-b)); height: var(--nav-h); z-index: 40; display: flex; align-items: center; justify-content: space-around; border-radius: 24px; background: var(--glass-2); border: 1px solid var(--stroke); backdrop-filter: blur(28px) saturate(180%); -webkit-backdrop-filter: blur(28px) saturate(180%); box-shadow: var(--shadow); max-width: 640px; margin: 0 auto; transition: transform .3s var(--ease); }
#nav.hide { transform: translateY(140%); }
#nav button { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: var(--text-3); font-weight: 600; position: relative; transition: color .2s; }
#nav button svg { width: 23px; height: 23px; transition: transform .3s var(--spring); }
#nav button.on { color: var(--accent); }
#nav button.on svg { transform: translateY(-2px) scale(1.08); }
#nav button.on::after { content: ""; position: absolute; bottom: 7px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
#nav .fab-slot { flex: 1.1; }
#fab { width: 58px; height: 58px; border-radius: 20px; margin-top: -26px; display: grid; place-items: center; color: var(--accent-ink); background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 50%, transparent), inset 0 1px 0 rgba(255,255,255,.35); transition: transform .25s var(--spring); }
#fab:active { transform: scale(.88) rotate(45deg); }
#fab svg { width: 28px; height: 28px; stroke-width: 2.4; }
#fab.open { transform: rotate(45deg); }

/* Typography helpers */
.muted { color: var(--text-2); } .dim { color: var(--text-3); } .small { font-size: 13px; } .xs { font-size: 11.5px; }
.row { display: flex; align-items: center; gap: 10px; } .row.wrap { flex-wrap: wrap; } .row.between { justify-content: space-between; } .col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; min-width: 0; } .center { text-align: center; } .mt { margin-top: 12px; } .mb { margin-bottom: 12px; } .gap4 { gap: 4px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp4 { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); font-weight: 700; margin: 20px 4px 10px; display: flex; align-items: center; gap: 8px; }
.section-title .more { margin-left: auto; text-transform: none; letter-spacing: 0; color: var(--accent); font-weight: 600; }
.grad-text { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Buttons */
.btn { min-height: 46px; padding: 0 18px; border-radius: 14px; font-weight: 650; display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--glass-2); border: 1px solid var(--stroke); transition: transform .15s, filter .2s, background .2s; white-space: nowrap; }
.btn:active { transform: scale(.96); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); border: 0; box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn.danger { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.btn.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 11px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* Chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 36px; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; background: var(--glass); border: 1px solid var(--stroke); color: var(--text-2); transition: all .2s; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.chip .n { font-size: 11px; opacity: .75; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 2px 9px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font-weight: 600; }
.tag.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.tag.bad { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.tag.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.tag.info { background: color-mix(in srgb, var(--info) 16%, transparent); color: var(--info); }
.tag.gray { background: var(--glass-2); color: var(--text-2); }

/* Inputs */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.input, textarea.input, select.input { width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 14px; background: var(--glass); border: 1px solid var(--stroke); outline: none; transition: border .2s, box-shadow .2s; }
textarea.input { resize: vertical; min-height: 110px; line-height: 1.5; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.input::placeholder { color: var(--text-3); }
select.input option { background: var(--glass-solid); color: var(--text); }
.searchbar { display: flex; align-items: center; gap: 10px; padding: 0 14px; min-height: 50px; border-radius: 16px; background: var(--glass); border: 1px solid var(--stroke); }
.searchbar input { flex: 1; background: none; border: 0; outline: none; min-height: 48px; }
.searchbar:focus-within { border-color: var(--accent); }

/* Toggle */
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--glass-2); border: 1px solid var(--stroke-2); transition: background .25s; }
.switch span::after { content: ""; position: absolute; width: 24px; height: 24px; top: 2px; left: 2px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.3); transition: transform .3s var(--spring); }
.switch input:checked + span { background: var(--accent); border-color: transparent; }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Lists */
.list-item { display: flex; align-items: center; gap: 12px; padding: 13px 4px; border-bottom: 1px solid var(--stroke); min-height: 52px; }
.list-item:last-child { border-bottom: 0; }
.list-item.tap { cursor: pointer; border-radius: 12px; }
.list-item.tap:active { background: var(--glass-2); }
.list-item .ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--glass-2); flex: none; color: var(--accent); }
.list-item .t { font-weight: 600; }
.list-item .s { font-size: 13px; color: var(--text-3); }

/* Hero / greeting */
.hero { padding: 6px 2px 4px; }
.hero .date { color: var(--text-3); font-size: 13px; font-weight: 600; text-transform: capitalize; }
.hero h1 { margin: 2px 0 0; font-size: 28px; letter-spacing: -.02em; line-height: 1.15; }

/* Quick capture */
.qc { display: flex; align-items: flex-end; gap: 8px; padding: 8px 8px 8px 14px; border-radius: 20px; }
.qc textarea { flex: 1; background: none; border: 0; outline: none; resize: none; min-height: 44px; max-height: 160px; padding: 11px 0; line-height: 1.4; }
.qc .acts { display: flex; gap: 4px; }
.qc-preview { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 6px 6px; }
.qc-preview:empty { display: none; }

/* Stats tiles */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tile { padding: 12px 8px; border-radius: 16px; text-align: center; background: var(--glass); border: 1px solid var(--stroke); cursor: pointer; transition: transform .15s; }
.tile:active { transform: scale(.94); }
.tile b { display: block; font-size: 22px; font-weight: 750; letter-spacing: -.02em; }
.tile span { font-size: 11px; color: var(--text-3); font-weight: 600; }

/* Feature grid (home shortcuts) */
.fgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.fbtn { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--text-2); text-align: center; }
.fbtn .ico { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: var(--glass); border: 1px solid var(--stroke); color: var(--c, var(--accent)); transition: transform .2s var(--spring); }
.fbtn:active .ico { transform: scale(.88); }
.fbtn .ico svg { width: 26px; height: 26px; }

/* Task row */
.task { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--glass); border: 1px solid var(--stroke); margin-bottom: 8px; position: relative; touch-action: pan-y; transition: transform .25s var(--ease), opacity .25s; will-change: transform; }
.task-wrap { position: relative; border-radius: 16px; margin-bottom: 8px; overflow: hidden; }
.task-wrap .task { margin-bottom: 0; z-index: 1; background: var(--glass-solid); }
[data-theme="light"] .task-wrap .task { background: #fff; }
.task-wrap .swipe-bg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; border-radius: 16px; font-weight: 700; }
.swipe-bg.r { background: var(--ok); color: #fff; }
.swipe-bg.l { background: var(--bad); color: #fff; justify-content: flex-end; }
.check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--pc, var(--text-3)); flex: none; display: grid; place-items: center; margin-top: 1px; transition: all .25s var(--spring); }
.check svg { width: 15px; height: 15px; stroke: var(--accent-ink); stroke-width: 3; opacity: 0; transform: scale(.4); transition: all .25s var(--spring); }
.task.done .check { background: var(--ok); border-color: var(--ok); }
.task.done .check svg { opacity: 1; transform: none; stroke: #fff; }
.task.done .ttl { text-decoration: line-through; color: var(--text-3); }
.task .ttl { font-weight: 600; word-break: break-word; }
.task .meta { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 4px; font-size: 12px; color: var(--text-3); align-items: center; }
.task .meta span { display: inline-flex; align-items: center; gap: 3px; }
.task .meta svg { width: 13px; height: 13px; }
.task .meta .overdue { color: var(--bad); font-weight: 700; }
.p1 { --pc: #ef4444; } .p2 { --pc: #f59e0b; } .p3 { --pc: #3b82f6; } .p4 { --pc: var(--text-3); }
.pop { animation: pop .45s var(--spring); }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* Week strip */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 12px; }
.week button { padding: 8px 0; border-radius: 14px; display: flex; flex-direction: column; align-items: center; gap: 2px; background: var(--glass); border: 1px solid var(--stroke); font-size: 11px; color: var(--text-3); font-weight: 600; position: relative; }
.week button b { font-size: 17px; color: var(--text); }
.week button.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.week button.on b { color: var(--accent-ink); }
.week button.today:not(.on) { border-color: var(--accent); }
.week button i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent-2); position: absolute; bottom: 4px; }
.week button.on i { background: var(--accent-ink); }

/* Memory cards */
.masonry { columns: 2; column-gap: 10px; }
.masonry .mem { break-inside: avoid; }
.mem { padding: 14px; border-radius: 18px; background: var(--glass); border: 1px solid var(--stroke); margin-bottom: 10px; cursor: pointer; position: relative; transition: transform .15s; overflow: hidden; display: block; width: 100%; text-align: left; }
.mem:active { transform: scale(.97); }
.mem .mt { font-weight: 700; margin-bottom: 4px; word-break: break-word; }
.mem .mb { font-size: 13.5px; color: var(--text-2); word-break: break-word; white-space: pre-line; }
.mem .mf { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 11.5px; color: var(--text-3); flex-wrap: wrap; }
.mem img { width: calc(100% + 28px); margin: -14px -14px 10px; display: block; max-height: 220px; object-fit: cover; }
.mem .pin { position: absolute; top: 10px; right: 10px; color: var(--warn); }
.mem.c-1 { border-left: 3px solid #f472b6; } .mem.c-2 { border-left: 3px solid #60a5fa; } .mem.c-3 { border-left: 3px solid #34d399; } .mem.c-4 { border-left: 3px solid #fbbf24; } .mem.c-5 { border-left: 3px solid #a78bfa; }
.type-ic { width: 26px; height: 26px; border-radius: 9px; display: inline-grid; place-items: center; background: var(--glass-2); color: var(--accent); }
.type-ic svg { width: 15px; height: 15px; }
.list-mode .masonry { columns: 1; }
mark { background: color-mix(in srgb, var(--warn) 35%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }

/* Memory detail */
.md { font-size: 15.5px; line-height: 1.6; word-break: break-word; }
.md h1, .md h2, .md h3 { margin: 14px 0 6px; line-height: 1.25; }
.md p { margin: 0 0 10px; }
.md ul { padding-left: 20px; margin: 0 0 10px; }
.md code { font-family: var(--mono); background: var(--glass-2); padding: 1px 5px; border-radius: 6px; font-size: 13.5px; }
.md blockquote { margin: 0 0 10px; padding: 4px 12px; border-left: 3px solid var(--accent); color: var(--text-2); }
.md .cb { display: flex; gap: 10px; align-items: flex-start; padding: 4px 0; cursor: pointer; }
.md .cb .box { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--text-3); flex: none; margin-top: 3px; display: grid; place-items: center; }
.md .cb.on .box { background: var(--ok); border-color: var(--ok); }
.md .cb.on .box::after { content: "✓"; color: #fff; font-size: 13px; font-weight: 800; }
.md .cb.on span { text-decoration: line-through; color: var(--text-3); }
.md .wl { color: var(--accent); font-weight: 600; text-decoration: underline dotted; cursor: pointer; }
.md hr { border: 0; border-top: 1px solid var(--stroke); }

/* Audio player */
.player { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; background: var(--glass-2); }
.player .pbtn { width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.wave { flex: 1; height: 40px; display: flex; align-items: center; gap: 2px; cursor: pointer; }
.wave i { flex: 1; background: var(--text-3); border-radius: 2px; min-height: 3px; transition: background .2s; }
.wave i.on { background: var(--accent); }

/* Recorder */
.rec-circle { width: 140px; height: 140px; border-radius: 50%; margin: 20px auto; display: grid; place-items: center; background: radial-gradient(circle, var(--bad), color-mix(in srgb, var(--bad) 60%, black)); color: #fff; position: relative; box-shadow: 0 0 0 0 color-mix(in srgb, var(--bad) 50%, transparent); }
.rec-circle.live { animation: pulse 1.4s infinite; }
.rec-circle svg { width: 48px; height: 48px; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--bad) 55%, transparent); } 100% { box-shadow: 0 0 0 36px transparent; } }
.rec-time { font-size: 34px; font-weight: 750; text-align: center; font-variant-numeric: tabular-nums; }
canvas.viz { width: 100%; height: 70px; display: block; }

/* Sheets & modals */
#overlay { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: opacity .25s; }
#overlay.on { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; max-height: 92vh; display: flex; flex-direction: column; border-radius: 28px 28px 0 0; background: var(--glass-2); border: 1px solid var(--stroke); border-bottom: 0; backdrop-filter: blur(30px) saturate(180%); -webkit-backdrop-filter: blur(30px) saturate(180%); transform: translateY(105%); transition: transform .35s var(--ease); max-width: 760px; margin: 0 auto; padding-bottom: var(--safe-b); }
[data-theme="dark"] .sheet, [data-theme="ai"] .sheet, [data-theme="minimal"] .sheet { background: color-mix(in srgb, var(--glass-solid) 88%, transparent); }
[data-theme="light"] .sheet { background: rgba(250,251,255,.92); }
.sheet.on { transform: none; }
.sheet .grab { width: 44px; height: 5px; border-radius: 9px; background: var(--stroke-2); margin: 10px auto 4px; flex: none; }
.sheet .sh-head { display: flex; align-items: center; gap: 10px; padding: 6px 18px 10px; flex: none; }
.sheet .sh-head h2 { margin: 0; font-size: 19px; flex: 1; }
.sheet .sh-body { overflow-y: auto; padding: 4px 18px 22px; flex: 1; }
.sheet .sh-foot { padding: 10px 18px 16px; display: flex; gap: 10px; flex: none; border-top: 1px solid var(--stroke); }
.menu-item { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 6px; min-height: 52px; font-weight: 600; text-align: left; border-radius: 12px; }
.menu-item:active { background: var(--glass); }
.menu-item.danger { color: var(--bad); }
.menu-item small { display: block; font-weight: 400; color: var(--text-3); font-size: 12.5px; }

/* Capture grid in sheet */
.cgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cbtn { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 6px; border-radius: 18px; background: var(--glass); border: 1px solid var(--stroke); font-size: 13px; font-weight: 650; transition: transform .2s var(--spring); }
.cbtn:active { transform: scale(.92); }
.cbtn .ico { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; color: #fff; background: var(--c); }
.cbtn .ico svg { width: 24px; height: 24px; }

/* Toast */
#toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b) + 24px); z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 16px; border-radius: 16px; background: color-mix(in srgb, var(--glass-solid) 94%, transparent); border: 1px solid var(--stroke-2); box-shadow: var(--shadow); font-weight: 600; font-size: 14px; max-width: 520px; width: 100%; animation: toastIn .35s var(--spring); }
.toast.out { animation: toastOut .25s var(--ease) forwards; }
.toast button { color: var(--accent); font-weight: 750; padding: 6px 8px; }
.toast .ti { color: var(--ok); } .toast.err .ti { color: var(--bad); }
@keyframes toastIn { from { transform: translateY(30px) scale(.95); opacity: 0; } }
@keyframes toastOut { to { transform: translateY(20px); opacity: 0; } }

/* Empty state */
.empty { text-align: center; padding: 36px 20px; color: var(--text-3); }
.empty .eic { width: 76px; height: 76px; border-radius: 26px; display: grid; place-items: center; margin: 0 auto 14px; background: var(--glass); border: 1px solid var(--stroke); color: var(--accent); }
.empty .eic svg { width: 36px; height: 36px; }
.empty h4 { margin: 0 0 6px; color: var(--text); font-size: 17px; }
.empty p { margin: 0 0 16px; font-size: 14px; }

/* Answer card (search) */
.answer { border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, transparent), color-mix(in srgb, var(--accent-2) 8%, transparent)); }
.answer .src { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 5px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 800; cursor: pointer; vertical-align: 1px; margin: 0 2px; }
.answer li { margin-bottom: 8px; }
.conf { height: 6px; border-radius: 9px; background: var(--glass-2); overflow: hidden; flex: 1; }
.conf i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 9px; }

/* Heatmap */
.heat { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; gap: 3px; overflow-x: auto; }
.heat i { width: 12px; height: 12px; border-radius: 3px; background: var(--glass-2); }
.heat i.l1 { background: color-mix(in srgb, var(--accent) 30%, transparent); } .heat i.l2 { background: color-mix(in srgb, var(--accent) 55%, transparent); } .heat i.l3 { background: color-mix(in srgb, var(--accent) 80%, transparent); } .heat i.l4 { background: var(--accent); }

/* Bars chart */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 130px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; font-size: 11px; color: var(--text-3); }
.bars .b i { width: 100%; max-width: 30px; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, var(--accent), var(--accent-2)); min-height: 4px; transition: height .6s var(--spring); }
.bars .b b { font-size: 11px; color: var(--text-2); }

/* Ring */
.ring { position: relative; display: grid; place-items: center; }
.ring svg { transform: rotate(-90deg); }
.ring .rl { position: absolute; text-align: center; }
.ring circle { fill: none; stroke-linecap: round; transition: stroke-dashoffset .6s var(--ease); }

/* Graph */
#graph-wrap { position: relative; height: calc(100vh - 210px); min-height: 360px; border-radius: var(--r-xl); overflow: hidden; touch-action: none; }
#graph-wrap canvas { width: 100%; height: 100%; display: block; }
.graph-legend { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 10px; font-size: 12px; padding: 8px 12px; border-radius: 12px; }
.graph-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; }

/* Onboarding */
.onb { min-height: 100%; display: flex; flex-direction: column; justify-content: center; padding: 30px 6px; max-width: 520px; margin: 0 auto; }
.onb .logo { width: 104px; height: 104px; margin: 0 auto 22px; perspective: 600px; }
.onb .logo .cube { width: 100%; height: 100%; border-radius: 32px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); box-shadow: 0 20px 60px color-mix(in srgb, var(--accent) 50%, transparent), inset 0 2px 0 rgba(255,255,255,.4); animation: float3d 6s ease-in-out infinite; transform-style: preserve-3d; }
.onb .logo svg { width: 56px; height: 56px; }
@keyframes float3d { 0%,100% { transform: rotateX(10deg) rotateY(-14deg) translateY(0); } 50% { transform: rotateX(-8deg) rotateY(14deg) translateY(-8px); } }
.onb h1 { font-size: 30px; text-align: center; margin: 0 0 8px; letter-spacing: -.02em; }
.onb p.lead { text-align: center; color: var(--text-2); margin: 0 0 24px; }
.dots { display: flex; justify-content: center; gap: 6px; margin: 18px 0; }
.dots i { width: 7px; height: 7px; border-radius: 9px; background: var(--stroke-2); transition: width .3s; }
.dots i.on { width: 22px; background: var(--accent); }
.feature-list { display: grid; gap: 10px; margin-bottom: 20px; }
.feature-list .f { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 16px; background: var(--glass); border: 1px solid var(--stroke); }
.feature-list .f .ic { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); flex: none; }

/* Theme preview */
.themes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.theme-card { border-radius: 18px; padding: 12px; border: 2px solid var(--stroke); text-align: left; position: relative; overflow: hidden; min-height: 96px; }
.theme-card.on { border-color: var(--accent); }
.theme-card .sw { height: 46px; border-radius: 12px; margin-bottom: 8px; position: relative; overflow: hidden; }
.theme-card .sw::after { content: ""; position: absolute; left: 10px; top: 10px; width: 50%; height: 26px; border-radius: 8px; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3); }
.theme-card b { font-size: 13px; }

/* Focus timer */
.focus-big { font-size: 58px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }

/* Segmented */
.seg { display: flex; padding: 4px; border-radius: 14px; background: var(--glass); border: 1px solid var(--stroke); gap: 4px; }
.seg button { flex: 1; min-height: 38px; border-radius: 10px; font-size: 13px; font-weight: 650; color: var(--text-2); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }

/* Vault */
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 20px 0; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--text-3); transition: all .2s; }
.pin-dots i.on { background: var(--accent); border-color: var(--accent); transform: scale(1.15); }
.pin-dots.shake { animation: shake .4s; }
@keyframes shake { 20%,60% { transform: translateX(-10px); } 40%,80% { transform: translateX(10px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 300px; margin: 0 auto; }
.keypad button { height: 64px; border-radius: 20px; font-size: 24px; font-weight: 650; background: var(--glass); border: 1px solid var(--stroke); }
.keypad button:active { background: var(--glass-2); transform: scale(.94); }

/* Progress */
.progress { height: 8px; border-radius: 9px; background: var(--glass-2); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 9px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .5s var(--ease); }

/* Sync badge */
.sync-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; padding: 4px 10px; border-radius: 999px; background: var(--glass); border: 1px solid var(--stroke); }
.sync-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.sync-pill.ok i { background: var(--ok); } .sync-pill.pend i { background: var(--warn); } .sync-pill.err i { background: var(--bad); }

/* Code / dev */
pre.code { font-family: var(--mono); font-size: 12px; background: var(--glass-2); border-radius: 12px; padding: 12px; overflow: auto; max-height: 340px; white-space: pre-wrap; word-break: break-all; }

/* Command palette results */
.cmd-res .menu-item { padding: 12px 6px; }

/* Shimmer for skeleton */
.skel { background: linear-gradient(90deg, var(--glass) 0%, var(--glass-2) 50%, var(--glass) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 10px; height: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Confetti */
.confetti { position: fixed; top: 50%; left: 50%; width: 8px; height: 12px; z-index: 100; pointer-events: none; border-radius: 2px; }

/* Tilt 3D cards */
.tilt { transform-style: preserve-3d; transition: transform .2s; }

@media (min-width: 640px) {
  .masonry { columns: 3; }
  .tiles { gap: 12px; }
}
@media (max-width: 360px) {
  .fgrid { gap: 6px; } .fbtn .ico { width: 50px; height: 50px; }
  .tiles b { font-size: 19px; }
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
