/* Smart Notes: "Bright bento" design system
   Soft warm canvas, white rounded tiles, a few saturated feature tiles (indigo, amber, mint, coral, lilac),
   big friendly numbers, one rounded geometric sans (Plus Jakarta Sans). */

:root {
  --bg: #f3f2ee;
  --sidebar: #f3f2ee;
  --panel: #ffffff;
  --paper: #ffffff;
  --hover: #f1f0ec;
  --text: #1c1b22;
  --muted: #5d5b66;
  --faint: #76747f;
  --line: #e8e6e0;
  --line-strong: #d7d4cc;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eeedfe;
  --on-accent: #ffffff;
  --danger: #c0352f;
  --danger-soft: #fdecea;
  --ok: #157347;
  --ok-soft: #e3f5ec;
  --warn: #8a5300;
  --warn-soft: #fdf0d8;
  /* feature tiles: fill + ink */
  --tile-indigo: #26215c; --ink-indigo: #eeedfe; --sub-indigo: #afa9ec;
  --tile-amber: #fac775;  --ink-amber: #412402;  --sub-amber: #854f0b;
  --tile-mint: #9fe1cb;   --ink-mint: #04342c;   --sub-mint: #0f6e56;
  --tile-coral: #f5c4b3;  --ink-coral: #4a1b0c;  --sub-coral: #993c1d;
  --tile-lilac: #cecbf6;  --ink-lilac: #26215c;  --sub-lilac: #534ab7;
  --shadow-sm: 0 1px 2px rgba(28, 27, 34, .04);
  --shadow: 0 1px 2px rgba(28, 27, 34, .04), 0 8px 24px rgba(28, 27, 34, .06);
  --shadow-pop: 0 8px 20px rgba(28, 27, 34, .10), 0 24px 56px rgba(28, 27, 34, .14);
  --radius: 18px;
  --radius-sm: 12px;
  --t-meeting: #2a78d6; --t-mom: #eb6834; --t-followup: #1baf7a;
  --t-one_on_one: #eda100; --t-daily: #e87ba4; --t-note: #008300;
  --seq-0: #e9e7e0; --seq-1: #b7d3f6; --seq-2: #6da7ec; --seq-3: #2a78d6; --seq-4: #184f95;
  --sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: var(--sans);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    --bg: #0f0f13; --sidebar: #0f0f13; --panel: #18181e; --paper: #18181e; --hover: #22222a;
    --text: #eeedf3; --muted: #a9a7b4; --faint: #8b8996; --line: #2a2a33; --line-strong: #3a3a45;
    --accent: #8f88f5; --accent-hover: #a9a3f8; --accent-soft: #24214a; --on-accent: #120f33;
    --danger: #f27a74; --danger-soft: #3a1b1a; --ok: #5ccf8f; --ok-soft: #13301f; --warn: #f0b04a; --warn-soft: #33270f;
    --tile-indigo: #3c3489; --ink-indigo: #eeedfe; --sub-indigo: #cecbf6;
    --tile-amber: #633806;  --ink-amber: #fae3b8;  --sub-amber: #fac775;
    --tile-mint: #085041;   --ink-mint: #d6f3e8;   --sub-mint: #9fe1cb;
    --tile-coral: #712b13;  --ink-coral: #fbe1d6;  --sub-coral: #f5c4b3;
    --tile-lilac: #26215c;  --ink-lilac: #eeedfe;  --sub-lilac: #afa9ec;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
    --shadow-pop: 0 8px 20px rgba(0,0,0,.45), 0 24px 56px rgba(0,0,0,.5);
    --t-meeting: #3987e5; --t-mom: #d95926; --t-followup: #199e70; --t-one_on_one: #c98500; --t-daily: #d55181; --t-note: #008300;
    --seq-0: #24242b; --seq-1: #184f95; --seq-2: #256abf; --seq-3: #3987e5; --seq-4: #86b6ef;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f0f13; --sidebar: #0f0f13; --panel: #18181e; --paper: #18181e; --hover: #22222a;
  --text: #eeedf3; --muted: #a9a7b4; --faint: #8b8996; --line: #2a2a33; --line-strong: #3a3a45;
  --accent: #8f88f5; --accent-hover: #a9a3f8; --accent-soft: #24214a; --on-accent: #120f33;
  --danger: #f27a74; --danger-soft: #3a1b1a; --ok: #5ccf8f; --ok-soft: #13301f; --warn: #f0b04a; --warn-soft: #33270f;
  --tile-indigo: #3c3489; --ink-indigo: #eeedfe; --sub-indigo: #cecbf6;
  --tile-amber: #633806;  --ink-amber: #fae3b8;  --sub-amber: #fac775;
  --tile-mint: #085041;   --ink-mint: #d6f3e8;   --sub-mint: #9fe1cb;
  --tile-coral: #712b13;  --ink-coral: #fbe1d6;  --sub-coral: #f5c4b3;
  --tile-lilac: #26215c;  --ink-lilac: #eeedfe;  --sub-lilac: #afa9ec;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  --shadow-pop: 0 8px 20px rgba(0,0,0,.45), 0 24px 56px rgba(0,0,0,.5);
  --t-meeting: #3987e5; --t-mom: #d95926; --t-followup: #199e70; --t-one_on_one: #c98500; --t-daily: #d55181; --t-note: #008300;
  --seq-0: #24242b; --seq-1: #184f95; --seq-2: #256abf; --seq-3: #3987e5; --seq-4: #86b6ef;
  color-scheme: dark;
}

/* ---------- base & browser surfaces ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.55 var(--sans); font-feature-settings: "cv11", "ss03"; -webkit-font-smoothing: antialiased; caret-color: var(--accent); }
::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
.ti { font-size: 1.15em; line-height: 1; vertical-align: -.14em; flex: none; }
.num, .tl-time, .count, .stat b { font-variant-numeric: tabular-nums; }
.serif { font-family: var(--serif); font-weight: 500; letter-spacing: -.015em; }
kbd { font: 500 11px var(--sans); padding: 1px 5px; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--faint); margin-left: auto; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; }
.row { display: flex; align-items: center; gap: 8px; } .row.wrap { flex-wrap: wrap; } .spacer { flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.empty { color: var(--muted); padding: 22px 6px; font-size: 13.5px; }
.empty b { color: var(--text); display: block; margin-bottom: 2px; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 244px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 16px 12px; background: var(--sidebar); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.brand { display: flex; gap: 10px; align-items: center; padding: 2px 8px 12px; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: var(--text); color: var(--bg); display: grid; place-items: center; font-size: 16px; }
.brand-name { font: 600 15px var(--sans); letter-spacing: -.01em; }
.brand-sub { font-size: 12px; color: var(--muted); }
.search-trigger { display: flex; align-items: center; gap: 8px; width: 100%; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius-sm); padding: 7px 10px; color: var(--muted); text-align: left; transition: border-color .16s var(--ease); }
.search-trigger:hover { border-color: var(--line-strong); }
.nav { display: flex; flex-direction: column; gap: 1px; margin-top: 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text); font-weight: 450; transition: background .16s var(--ease); }
.nav a:hover { background: var(--hover); text-decoration: none; }
.nav a .ti { color: var(--muted); font-size: 17px; }
.nav a.active { background: var(--panel); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line); font-weight: 600; }
.nav a.active .ti { color: var(--accent); }
.nav.small a { font-size: 13px; padding: 5px 10px; color: var(--muted); }
.nav .count { margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.nav .count:empty { display: none; }
.nav-section { font-size: 12px; font-weight: 600; color: var(--faint); padding: 14px 10px 2px; }
.sidebar-foot { margin-top: auto; display: flex; justify-content: space-between; padding: 10px 4px 0; border-top: 1px solid var(--line); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.t-meeting { background: var(--t-meeting); } .t-mom { background: var(--t-mom); } .t-followup { background: var(--t-followup); }
.t-one_on_one { background: var(--t-one_on_one); } .t-daily { background: var(--t-daily); } .t-note { background: var(--t-note); }

.main { padding: 32px 40px 96px; min-width: 0; }
.page { max-width: 1100px; margin: 0 auto; animation: enter .28s var(--ease); }
.page.narrow { max-width: 860px; }
@keyframes enter { from { opacity: .001; transform: translateY(4px); } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font: 500 30px/1.15 var(--serif); letter-spacing: -.02em; display: flex; align-items: center; gap: 10px; }
.page-head h1 .ti { color: var(--muted); font-size: 24px; }
.page-head p { margin: 6px 0 0; color: var(--muted); }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--panel); border-radius: var(--radius-sm); padding: 7px 12px; white-space: nowrap; font-weight: 500; transition: background .16s var(--ease), border-color .16s var(--ease), transform .1s; }
.btn:hover { background: var(--hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 4px 9px; font-size: 13px; }
.btn.block { width: 100%; justify-content: flex-start; }
.btn.primary kbd { color: inherit; opacity: .75; border-color: currentColor; }
.icon-btn { width: 32px; height: 32px; padding: 0; justify-content: center; }
.link { background: none; border: 0; color: var(--muted); padding: 4px 6px; font-size: 13px; border-radius: 6px; display: inline-flex; gap: 6px; align-items: center; }
.link:hover { color: var(--text); background: var(--hover); }
.input, .select, textarea.input { border: 1px solid var(--line-strong); background: var(--panel); border-radius: var(--radius-sm); padding: 7px 10px; outline: none; min-width: 0; transition: border-color .16s, box-shadow .16s; }
.input::placeholder, textarea::placeholder { color: var(--faint); }
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.check { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; flex: none; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card-pad { padding: 18px 20px; }
.card h3, .section-h { font: 600 15px var(--sans); color: var(--text); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.card h3 .badge, .section-h .badge { font-weight: 500; }
.card h3 a, .section-h a { margin-left: auto; font-weight: 500; font-size: 13px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 1px 8px; border-radius: 999px; background: var(--hover); color: var(--muted); white-space: nowrap; line-height: 1.6; }
.badge.overdue { color: var(--danger); background: var(--danger-soft); }
.badge.soon { color: var(--warn); background: var(--warn-soft); }
.badge.ok { color: var(--ok); background: var(--ok-soft); }

.avatar { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-size: 10.5px; font-weight: 600; flex: none; box-shadow: 0 0 0 2px var(--panel); letter-spacing: .02em; }
.avatar.lg { width: 52px; height: 52px; font-size: 18px; }
.avatars { display: inline-flex; }
.avatars .avatar + .avatar { margin-left: -7px; }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 12px; align-items: flex-start; padding: 9px 8px; border-bottom: 1px solid var(--line); color: var(--text); border-radius: 0; }
.list-item:last-child { border-bottom: 0; }
a.list-item { transition: background .16s var(--ease); }
a.list-item:hover { background: var(--hover); border-radius: var(--radius-sm); text-decoration: none; }
.list-item .grow { flex: 1; min-width: 0; }
.title-line { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.chip { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 4px 12px; display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); transition: all .16s var(--ease); }
.chip:hover { border-color: var(--line-strong); color: var(--text); }
.chip.on { background: var(--text); border-color: var(--text); color: var(--bg); }
.chip b { font-weight: 600; opacity: .7; }

/* ---------- skeleton ---------- */
.skel { display: grid; gap: 12px; }
.skel i { display: block; height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--line) 0%, var(--hover) 50%, var(--line) 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.skel i.h { height: 30px; width: 40%; margin-bottom: 12px; } .skel i.w6 { width: 60%; } .skel i.w8 { width: 80%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Today ---------- */
.today-head h1 { font: 500 34px/1.1 var(--serif); letter-spacing: -.02em; }
.today-head p { margin: 8px 0 0; color: var(--muted); font-size: 14.5px; }
.capture { margin: 22px 0 18px; background: var(--paper); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: var(--shadow-sm); transition: box-shadow .2s var(--ease), border-color .2s; position: relative; }
.capture:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent), var(--shadow); }
.capture-row { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 16px; }
.capture-row > .ti { color: var(--muted); font-size: 18px; }
.capture input { flex: 1; border: 0; outline: none; background: transparent; font: 16px var(--serif); padding: 6px 0; min-width: 0; }
.capture-types { display: flex; gap: 4px; padding: 0 10px 10px 12px; flex-wrap: wrap; }
.seg { border: 0; background: transparent; padding: 4px 10px; border-radius: 999px; font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; transition: background .16s var(--ease), color .16s; }
.seg:hover { background: var(--hover); color: var(--text); }
.seg.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 26px; }
.day { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 8px 10px 10px; text-align: left; color: var(--text); transition: border-color .16s, transform .16s var(--ease); }
.day:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.day.is-today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.day .dn { font-size: 12px; color: var(--muted); }
.day .dd { font: 500 20px var(--serif); line-height: 1.2; }
.day .marks { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 6px; min-height: 8px; }
.day .marks .dot { width: 7px; height: 7px; }
.today-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 34px; }
.today-grid section + section { margin-top: 28px; }
.people-strip { display: grid; gap: 2px; }

/* action rows with completion moment */
.action-line { display: flex; align-items: flex-start; gap: 10px; padding: 10px 6px; border-bottom: 1px solid var(--line); transition: background .16s var(--ease); }
.action-line:hover { background: var(--hover); }
.action-line:last-child { border-bottom: 0; }
.action-line .check { margin-top: 2px; }
.action-line .txt { flex: 1; min-width: 0; transition: color .25s; }
.action-line.done .txt > span:first-child { text-decoration: line-through; text-decoration-color: var(--faint); color: var(--faint); }
.action-line.just-done { animation: done-flash .6s var(--ease); }
@keyframes done-flash { 0% { background: var(--ok-soft); } 100% { background: transparent; } }
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.status.overdue { color: var(--danger); } .status.today { color: var(--warn); } .status.upcoming { color: var(--accent); } .status.none { color: var(--muted); } .status.done { color: var(--ok); }

/* ---------- notes list ---------- */
.day-label { font: 500 15px var(--serif); color: var(--muted); margin: 22px 0 6px; }
.notes-list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.note-card { display: block; padding: 13px 16px; color: var(--text); border-bottom: 1px solid var(--line); transition: background .16s var(--ease); }
.note-card:last-child { border-bottom: 0; }
.note-card:hover { background: var(--hover); text-decoration: none; }
.note-card .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.note-card .excerpt { color: var(--muted); font: 14px/1.5 var(--serif); margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.type-tag { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-weight: 500; }

/* ---------- editor ---------- */
.editor { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.editor-top { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; position: sticky; top: 0; background: var(--paper); z-index: 6; border-radius: 14px 14px 0 0; }
.save-state { font-size: 12.5px; color: var(--faint); display: inline-flex; align-items: center; gap: 5px; }
.save-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.save-state.dirty { color: var(--warn); }
.save-state.dirty::before { background: var(--warn); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.editor-body { padding: 26px 40px 32px; }
.title-input { width: 100%; border: 0; background: transparent; font: 500 30px/1.2 var(--serif); letter-spacing: -.02em; outline: none; padding: 0; }
.title-input::placeholder { color: var(--faint); }
.meta-grid { display: grid; grid-template-columns: 96px 1fr; gap: 8px 12px; margin: 18px 0 20px; align-items: center; font-size: 13.5px; }
.meta-grid > label { color: var(--muted); display: flex; align-items: center; gap: 6px; }
.meta-grid .input { padding: 5px 9px; }
.type-pills { display: flex; gap: 4px; flex-wrap: wrap; }
.type-pill { border: 1px solid transparent; background: transparent; border-radius: 999px; padding: 3px 10px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); transition: all .16s var(--ease); }
.type-pill:hover { background: var(--hover); color: var(--text); }
.type-pill.on { border-color: var(--line-strong); background: var(--panel); color: var(--text) !important; font-weight: 600; box-shadow: var(--shadow-sm); }
.people-field { position: relative; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 4px 6px; background: var(--panel); }
.people-field:focus-within { border-color: var(--accent); }
.people-field input { border: 0; outline: none; flex: 1; min-width: 140px; padding: 3px; background: transparent; }
.person-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 2px; border-radius: 999px; background: var(--hover); font-size: 13px; }
.person-chip .avatar { width: 22px; height: 22px; font-size: 9.5px; box-shadow: none; }
.person-chip a { color: var(--text); }
.person-chip button { border: 0; background: none; color: var(--faint); padding: 0 4px; border-radius: 50%; }
.person-chip button:hover { color: var(--danger); }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow-pop); z-index: 30; max-height: 280px; overflow-y: auto; padding: 4px; animation: pop .14s var(--ease); }
.suggest div { padding: 7px 9px; border-radius: 6px; cursor: pointer; display: flex; gap: 9px; align-items: center; }
.suggest div.hl, .suggest div:hover { background: var(--accent-soft); }
.suggest .sub { margin-left: auto; text-align: right; color: var(--muted); font-size: 12px; }
@keyframes pop { from { opacity: 0; transform: translateY(-3px) scale(.98); } }
.body-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.body-tabs button { border: 0; background: none; padding: 7px 10px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 6px; align-items: center; }
.body-tabs button.on { color: var(--text); border-color: var(--text); font-weight: 600; }
.body-wrap { position: relative; }
.body-input { width: 100%; min-height: 340px; border: 0; outline: none; resize: none; background: transparent; font: 17px/1.75 var(--serif); padding: 0; overflow: hidden; }
.md { font: 17px/1.7 var(--serif); }
.md h1, .md h2, .md h3 { font-family: var(--sans); margin: 1.1em 0 .35em; font-weight: 650; }
.md h2 { font-size: 17px; } .md h3 { font-size: 15px; }
.md p { margin: .45em 0; } .md ul, .md ol { padding-left: 1.3em; margin: .4em 0; }
.md li.task { list-style: none; margin-left: -1.3em; display: flex; gap: 8px; align-items: baseline; }
.md li.task .ti { color: var(--muted); }
.md code { background: var(--hover); padding: 1px 5px; border-radius: 4px; font-size: .88em; }
.md blockquote { border-left: 2px solid var(--line-strong); margin: .5em 0; padding-left: 12px; color: var(--muted); }
.md .mention { color: var(--accent); font: 600 .9em var(--sans); background: var(--accent-soft); padding: 0 4px; border-radius: 4px; }
.hint { font-size: 12.5px; color: var(--faint); margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.hint kbd { margin: 0 2px; }
.actions-box { margin-top: 26px; border-top: 1px solid var(--line); padding-top: 16px; }
.actions-box h4 { margin: 0 0 8px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.action-row { display: grid; grid-template-columns: 22px 1fr 160px 142px 30px; gap: 8px; align-items: center; padding: 3px 0; }
.action-row .input, .action-row .select { padding: 5px 8px; font-size: 13.5px; }
.action-row.done .text { text-decoration: line-through; color: var(--faint); }
.thread { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 0 0 14px; font-size: 13px; }
.thread a { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.thread a.cur { border-color: var(--text); color: var(--text); font-weight: 600; }
.editor-foot { display: flex; gap: 16px; flex-wrap: wrap; padding: 10px 18px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--faint); }
.focus-mode .sidebar, .focus-mode .menu-btn { display: none; }
.focus-mode .app { grid-template-columns: 1fr; }

/* ---------- diary ---------- */
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 12px); gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.heat i { width: 12px; height: 12px; border-radius: 3px; background: var(--seq-0); cursor: pointer; transition: transform .12s; }
.heat i:hover { transform: scale(1.25); }
.heat i[data-l="1"] { background: var(--seq-1); } .heat i[data-l="2"] { background: var(--seq-2); }
.heat i[data-l="3"] { background: var(--seq-3); } .heat i[data-l="4"] { background: var(--seq-4); }
.heat i.sel { outline: 2px solid var(--text); outline-offset: 1px; }
.heat-legend { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.heat-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.diary-day { margin-top: 28px; }
.diary-day-head { display: flex; align-items: baseline; gap: 10px; position: sticky; top: 0; background: var(--bg); padding: 8px 0; z-index: 5; }
.diary-day-head h2 { font: 500 22px var(--serif); letter-spacing: -.015em; }
.timeline { position: relative; margin-left: 66px; border-left: 1px solid var(--line-strong); }
.tl-item { position: relative; padding: 6px 0 6px 22px; cursor: pointer; }
.tl-item:hover .tl-card { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.tl-time { position: absolute; left: -72px; width: 58px; text-align: right; top: 13px; font-size: 12px; color: var(--muted); }
.tl-dot { position: absolute; left: -5px; top: 16px; width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 0 3px var(--bg); background: var(--faint); }
.tl-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 13px; transition: all .16s var(--ease); display: flex; gap: 10px; align-items: flex-start; }
.tl-card > .ti { color: var(--muted); margin-top: 2px; }
.tl-card b { font-weight: 600; }

/* ---------- people ---------- */
.person-card { padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; color: var(--text); transition: border-color .16s, box-shadow .16s; }
.person-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); text-decoration: none; }
.person-card.inactive { opacity: .62; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px 28px; }
.fields .fv { font-size: 15.5px; margin-top: 2px; overflow-wrap: anywhere; }
.hovercard { position: fixed; z-index: 150; width: 290px; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 14px; animation: pop .14s var(--ease); pointer-events: none; }
.hovercard .hc-top { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.hovercard .hc-row { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); padding: 2px 0; }

/* ---------- insights (charts) ---------- */
.insight-summary { font: 19px/1.5 var(--serif); max-width: 62ch; margin: 0 0 24px; color: var(--text); }
.insight-summary b { font-weight: 600; }
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.chart-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 12px; position: relative; }
.chart-card h3 { font: 600 14.5px var(--sans); margin: 0; }
.chart-card .sub { font-size: 12.5px; color: var(--muted); margin: 2px 0 10px; }
.chart-card.wide { grid-column: 1 / -1; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font: 11.5px var(--sans); fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .lbl { fill: var(--text); font-weight: 500; }
.chart .grid-l { stroke: var(--line); stroke-width: 1; }
.chart .base { stroke: var(--line-strong); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: default; }
.chart .mark { transition: opacity .16s; }
.chart:hover .mark.dim { opacity: .35; }
.hbars { display: grid; gap: 4px; padding: 4px 0 6px; }
.hb { display: grid; grid-template-columns: minmax(90px, 38%) 1fr 34px; gap: 10px; align-items: center; padding: 3px 4px; border-radius: 6px; font-size: 13px; }
.hb[data-href] { cursor: pointer; }
.hb:hover { background: var(--hover); }
.hb-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 500; }
.hb-t { height: 14px; display: flex; align-items: center; }
.hb-b { display: block; height: 14px; border-radius: 0 4px 4px 0; background: var(--t-meeting); transition: width .5s var(--ease); }
.hb-v { color: var(--muted); font-size: 12.5px; }
.tip { position: fixed; z-index: 160; pointer-events: none; background: var(--text); color: var(--bg); font-size: 12.5px; padding: 7px 10px; border-radius: 8px; box-shadow: var(--shadow-pop); max-width: 240px; line-height: 1.45; }
.tip b { font-weight: 600; }
.tip .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.table-view { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.table-view th, .table-view td { text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--line); }
.table-view th { color: var(--muted); font-weight: 500; }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; background: rgba(18, 18, 17, .42); display: grid; place-items: start center; padding: 9vh 16px; z-index: 100; animation: fade .16s var(--ease); }
.modal { width: min(640px, 100%); max-height: 82vh; overflow: auto; background: var(--panel); border-radius: 14px; border: 1px solid var(--line); box-shadow: var(--shadow-pop); animation: rise .22s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.99); } }
@keyframes fade { from { opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 1; }
.modal-head b { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; }
.modal-body { padding: 18px; }
.modal-body h4 { margin: 18px 0 8px; font-size: 14px; }
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.popover { position: fixed; z-index: 120; min-width: 260px; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 6px; animation: pop .14s var(--ease); }
.popover a, .popover button.item { display: flex; gap: 10px; align-items: center; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 8px; color: var(--text); text-align: left; }
.popover a:hover, .popover button.item:hover, .popover .hl { background: var(--hover); text-decoration: none; }
.popover .it-sub { font-size: 12px; color: var(--muted); }
.palette input { width: 100%; border: 0; outline: none; padding: 16px 18px; font-size: 16px; background: transparent; border-bottom: 1px solid var(--line); }
.palette .results { max-height: 52vh; overflow: auto; padding: 6px; }
.palette .res { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 8px; color: var(--text); }
.palette .res:hover { text-decoration: none; }
.palette .res.hl { background: var(--accent-soft); }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(16px); background: var(--text); color: var(--bg); padding: 9px 10px 9px 16px; border-radius: 12px; opacity: 0; pointer-events: none; transition: opacity .2s var(--ease), transform .25s var(--ease); z-index: 200; font-size: 14px; display: flex; gap: 12px; align-items: center; box-shadow: var(--shadow-pop); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.toast button { border: 0; background: color-mix(in srgb, var(--bg) 16%, transparent); color: var(--bg); font-weight: 600; padding: 4px 10px; border-radius: 7px; }
.toast:not(:has(button)) { padding-right: 16px; }
.snapshot { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.snapshot h2 { font: 500 22px var(--serif); }

/* ---------- sign in ---------- */
body.signed-out .app, body.signed-out .menu-btn { display: none; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth { width: min(380px, 100%); padding: 28px; display: grid; gap: 12px; box-shadow: var(--shadow); }
.auth label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }

.menu-btn { display: none; }
@media (max-width: 960px) {
  .today-grid, .grid.two, .charts { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 90; width: 270px; transform: translateX(-100%); transition: transform .22s var(--ease); box-shadow: var(--shadow-pop); }
  .sidebar.open { transform: none; }
  .menu-btn { display: grid; place-items: center; position: fixed; top: 12px; left: 12px; z-index: 95; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font-size: 18px; }
  .main { padding: 64px 16px 64px; }
  .editor-body { padding: 18px 16px 24px; }
  .meta-grid { grid-template-columns: 1fr; gap: 4px; }
  .meta-grid > label { margin-top: 8px; }
  .action-row { grid-template-columns: 22px 1fr 30px; }
  .action-row .owner, .action-row .due { grid-column: 2; }
  .week { grid-template-columns: repeat(7, minmax(40px, 1fr)); overflow-x: auto; }
  .day { padding: 6px; } .day .dd { font-size: 16px; }
  .timeline { margin-left: 56px; } .tl-time { left: -62px; width: 50px; }
  .form .two { grid-template-columns: 1fr; }
  kbd { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media (forced-colors: active) { .dot, .legend i { forced-color-adjust: none; } }

/* =================== Bright bento layer =================== */
body { font-size: 14px; letter-spacing: -.003em; }
.sidebar { border-right: 0; padding: 18px 14px; }
.logo { background: var(--tile-indigo); color: var(--ink-indigo); border-radius: 11px; width: 34px; height: 34px; }
.brand-name { font-weight: 800; letter-spacing: -.02em; }
.nav a { border-radius: 12px; padding: 8px 12px; font-weight: 500; }
.nav a.active { background: var(--panel); box-shadow: var(--shadow); font-weight: 700; }
.nav-section { font-weight: 700; }
.btn { border-radius: 12px; font-weight: 600; }
.btn.primary { box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 30%, transparent); }
.search-trigger { border-radius: 12px; }
.page-head h1, .today-head h1 { font: 800 32px/1.1 var(--sans); letter-spacing: -.03em; }
.page-head h1 .ti { color: var(--accent); }
.card, .notes-list, .chart-card, .editor, .tl-card { border-radius: var(--radius); border-color: transparent; box-shadow: var(--shadow); }
.card h3, .section-h { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.chip { font-weight: 600; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.badge { font-weight: 600; }
.day-label, .diary-day-head h2 { font: 800 18px var(--sans); letter-spacing: -.02em; color: var(--text); }
.title-input { font: 800 30px/1.2 var(--sans); letter-spacing: -.03em; }
.body-input, .md { font: 16px/1.75 var(--sans); }
.note-card .excerpt { font: 13.5px/1.5 var(--sans); }
.insight-summary { font: 500 19px/1.55 var(--sans); letter-spacing: -.01em; }
.insight-summary b { font-weight: 800; color: var(--accent); }
.snapshot h2 { font: 800 22px var(--sans); }
.day .dd { font: 800 20px var(--sans); }
.capture { border-radius: 22px; border-color: transparent; box-shadow: var(--shadow); }
.capture input { font: 500 16px var(--sans); }
.editor-top { border-radius: var(--radius) var(--radius) 0 0; }

/* bento grid (Today) */
.bento { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: minmax(118px, auto); gap: 14px; }
.tile { background: var(--panel); border-radius: 22px; padding: 18px 20px; box-shadow: var(--shadow); position: relative; overflow: hidden; min-width: 0;
  transition: transform .35s var(--spring), box-shadow .3s var(--ease); }
a.tile, button.tile { color: inherit; text-align: left; border: 0; font: inherit; cursor: pointer; display: block; }
a.tile:hover, button.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-pop); text-decoration: none; }
.tile .t-label { font-size: 13px; font-weight: 600; opacity: .85; display: flex; gap: 6px; align-items: center; }
.tile .t-num { font-size: 44px; font-weight: 800; letter-spacing: -.04em; line-height: 1.05; margin-top: 6px; font-variant-numeric: proportional-nums; }
.tile .t-sub { font-size: 13px; margin-top: 4px; }
.tile.span2 { grid-column: span 2; } .tile.span3 { grid-column: span 3; } .tile.span4 { grid-column: 1 / -1; }
.tile.row2 { grid-row: span 2; }
.tile.indigo { background: var(--tile-indigo); color: var(--ink-indigo); } .tile.indigo .t-sub, .tile.indigo .t-label { color: var(--sub-indigo); }
.tile.amber { background: var(--tile-amber); color: var(--ink-amber); } .tile.amber .t-sub, .tile.amber .t-label { color: var(--sub-amber); }
.tile.mint { background: var(--tile-mint); color: var(--ink-mint); } .tile.mint .t-sub, .tile.mint .t-label { color: var(--sub-mint); }
.tile.coral { background: var(--tile-coral); color: var(--ink-coral); } .tile.coral .t-sub, .tile.coral .t-label { color: var(--sub-coral); }
.tile.lilac { background: var(--tile-lilac); color: var(--ink-lilac); } .tile.lilac .t-sub, .tile.lilac .t-label { color: var(--sub-lilac); }
.hero-greet { font-size: 30px; font-weight: 800; letter-spacing: -.035em; line-height: 1.1; }
.hero-bars { position: absolute; right: 18px; bottom: 16px; left: 50%; height: 64px; }
.hero-bars svg { width: 100%; height: 100%; overflow: visible; }
.tile .tile-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; margin-bottom: 8px; }
.tile .tile-head a { margin-left: auto; font-size: 13px; font-weight: 600; }
.tile .capture { margin: 0; box-shadow: none; background: var(--hover); }
.tile .capture:focus-within { background: var(--panel); }
.tile .week { margin: 0; }
.tile .day { border-radius: 14px; border-color: transparent; background: var(--hover); }
.tile .day.is-today { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.tile .day.is-today .dn { color: var(--on-accent); opacity: .8; }
.mini-net { position: absolute; inset: 44px 0 0 0; }

/* stagger-in (micro-interaction) */
.stagger > * { animation: rise-in .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes rise-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }

/* animated checkbox */
.check { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; border: 2px solid var(--line-strong); border-radius: 7px; background: var(--panel);
  display: inline-grid; place-items: center; transition: background .2s var(--ease), border-color .2s, transform .25s var(--spring); margin: 0; }
.check:hover { border-color: var(--accent); }
.check:active { transform: scale(.88); }
.check::after { content: ""; width: 11px; height: 6px; border: 2.5px solid var(--on-accent); border-top: 0; border-right: 0; transform: rotate(-45deg) scale(0); margin-top: -3px; transition: transform .28s var(--spring); }
.check:checked { background: var(--ok); border-color: var(--ok); }
.check:checked::after { transform: rotate(-45deg) scale(1); }
.action-line .txt > span:first-child { background: linear-gradient(currentColor, currentColor) 0 55% / 0 1.5px no-repeat; transition: background-size .45s var(--ease), color .3s; }
.action-line.done .txt > span:first-child { text-decoration: none; background-size: 100% 1.5px; color: var(--faint); }
@keyframes pop-ring { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 50%, transparent); } 100% { box-shadow: 0 0 0 12px transparent; } }
.action-line.just-done .check { animation: pop-ring .6s var(--ease); }

/* heat-map ripple */
.heat i { animation: ink .6s var(--ease) both; animation-delay: calc(var(--d, 0) * 1ms); }
@keyframes ink { from { opacity: 0; transform: scale(.3); } }

/* page cross-fade (View Transitions) */
::view-transition-old(main-area) { animation: vt-out .18s var(--ease) both; }
::view-transition-new(main-area) { animation: vt-in .32s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(8px); } }
.main { view-transition-name: main-area; }

/* d3 charts */
.chart .axis text { fill: var(--muted); font: 11.5px var(--sans); }
.chart .axis path, .chart .axis line { stroke: var(--line); }
.chart .axis .domain { stroke: var(--line-strong); }
.chart .crosshair { stroke: var(--line-strong); stroke-width: 1; pointer-events: none; }
.net svg { width: 100%; display: block; cursor: grab; }
.net .node-label { font: 600 11px var(--sans); fill: var(--text); pointer-events: none; paint-order: stroke; stroke: var(--panel); stroke-width: 3px; }
.net .link { stroke: var(--line-strong); }
.sunburst svg { width: 100%; display: block; }
.sunburst path { cursor: pointer; transition: opacity .2s; }
.sunburst text { font: 600 11px var(--sans); fill: #fff; pointer-events: none; }
.sunburst .center-label { font: 800 14px var(--sans); fill: var(--text); }

/* team & sharing */
.user-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 12px; align-items: center; padding: 10px 6px; border-bottom: 1px solid var(--line); }
.user-row:last-child { border-bottom: 0; }
.role { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.role.super_admin { background: var(--tile-indigo); color: var(--ink-indigo); }
.role.admin { background: var(--accent-soft); color: var(--accent); }
.link-box { display: flex; gap: 8px; align-items: center; background: var(--hover); border-radius: 12px; padding: 8px 8px 8px 12px; font: 12.5px ui-monospace, Consolas, monospace; overflow: hidden; }
.link-box span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shared-banner { display: flex; gap: 8px; align-items: center; padding: 8px 14px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 13px; border-radius: var(--radius) var(--radius) 0 0; }
.share-row { display: flex; gap: 10px; align-items: center; padding: 6px 4px; }
.share-row select { padding: 3px 6px; border-radius: 8px; }

@media (max-width: 1100px) { .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tile.span3 { grid-column: 1 / -1; } }
@media (max-width: 640px) { .bento { grid-template-columns: 1fr; } .tile.span2, .tile.span3 { grid-column: auto; } .tile.row2 { grid-row: auto; } .hero-bars { position: static; height: 56px; margin-top: 12px; } }
@media (prefers-reduced-motion: reduce) { ::view-transition-old(main-area), ::view-transition-new(main-area) { animation: none; } }
