/* Noted on the web: Pulse's Quiet look. */
@font-face { font-family: Geist; src: url(fonts/geist_light.ttf); font-weight: 300; font-display: swap; }
@font-face { font-family: Geist; src: url(fonts/geist_regular.ttf); font-weight: 400; font-display: swap; }
@font-face { font-family: Geist; src: url(fonts/geist_medium.ttf); font-weight: 500; font-display: swap; }
@font-face { font-family: Geist; src: url(fonts/geist_semibold.ttf); font-weight: 600; font-display: swap; }

:root {
  --bg: #F4F3EF; --card: #FFFFFF; --ink: #1E1E1C; --grey: #8C8B86; --faint: #C6C4BE;
  --hair: rgba(30, 30, 28, .07); --field: #ECEBE6; --up: #4F6F5E; --down: #9E6F5B;
  --s1: #4F6F5E; --s2: #9E6F5B; --s3: #5B6B8F; --s4: #A88A4F; --s5: #7D5B8F;
  --fill: .10; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 28px rgba(0,0,0,.06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121211; --card: #1C1C1A; --ink: #ECEAE3; --grey: #8A877F; --faint: #45433F;
    --hair: rgba(255, 255, 255, .08); --field: #262624; --up: #A3C7B1; --down: #D4A08B;
    --s1: #A3C7B1; --s2: #D4A08B; --s3: #A3B1D4; --s4: #D9C08B; --s5: #C3A3D4; --fill: .18;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121211; --card: #1C1C1A; --ink: #ECEAE3; --grey: #8A877F; --faint: #45433F;
  --hair: rgba(255, 255, 255, .08); --field: #262624; --up: #A3C7B1; --down: #D4A08B;
  --s1: #A3C7B1; --s2: #D4A08B; --s3: #A3B1D4; --s4: #D9C08B; --s5: #C3A3D4; --fill: .18;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body { font-family: Geist, ui-sans-serif, system-ui, -apple-system, sans-serif; font-size: 15px; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
.num { font-variant-numeric: tabular-nums; }
.grey { color: var(--grey); }
.hidden { display: none !important; }
svg.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.press { transition: transform .18s cubic-bezier(.3,1.6,.5,1); }
.press:active { transform: scale(.96); }

/* ------------------------------------------------------------------ layout */
.shell { display: grid; grid-template-columns: minmax(320px, 420px) 1fr; height: 100vh; height: 100dvh; }
.list-pane { overflow-y: auto; padding: 22px 16px 0; border-right: 1px solid var(--hair); position: relative; display: flex; flex-direction: column; }
.list-pane > * { flex: none; }
.note-pane { overflow-y: auto; position: relative; }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .shell.open .list-pane { display: none; }
  .shell:not(.open) .note-pane { display: none; }
  .list-pane { border-right: 0; }
}

.head { display: flex; align-items: flex-start; gap: 10px; padding: 0 4px; }
.head h1 { margin: 0; font-size: 32px; line-height: 1.1; font-weight: 600; letter-spacing: -.5px; flex: 1; }
.head h1 span { color: var(--grey); display: block; }
.sub { color: var(--grey); padding: 6px 4px 16px; }
.round { width: 36px; height: 36px; border-radius: 50%; background: var(--card); display: inline-grid; place-items: center; flex: none; }
.round svg.i { width: 17px; height: 17px; }

.seg { display: flex; background: var(--field); border-radius: 12px; padding: 3px; position: relative; }
.seg button { flex: 1; height: 30px; border-radius: 9px; color: var(--grey); font-weight: 500; font-size: 13px; position: relative; z-index: 1; transition: color .2s; white-space: nowrap; }
.seg button.on { color: var(--ink); background: var(--card); box-shadow: 0 0 0 1px var(--hair); }

.label { color: var(--grey); font-weight: 500; font-size: 13.5px; padding: 22px 4px 8px; display: flex; justify-content: space-between; }
.card { background: var(--card); border-radius: 20px; padding: 0 16px; }
.card > * + * { border-top: 1px solid var(--hair); }

.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; min-height: 60px; cursor: pointer; }
.row.sel .r-title { color: var(--up); }
.r-main { flex: 1; min-width: 0; }
.r-title { font-size: 16px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-title.done { color: var(--grey); text-decoration: line-through; }
.r-snip { color: var(--grey); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.meta { display: flex; gap: 10px; margin-top: 5px; font-size: 12.5px; color: var(--grey); align-items: center; flex-wrap: wrap; }
.meta span { display: inline-flex; align-items: center; gap: 3px; }
.meta svg.i { width: 12.5px; height: 12.5px; }
.meta .hot { color: var(--down); } .meta .today { color: var(--ink); } .meta .ok { color: var(--up); }
.thumb { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; background: var(--field); flex: none; }
.spark { width: 64px; height: 30px; flex: none; }

.check { width: 24px; height: 24px; border-radius: 50%; border: 1.6px solid var(--faint); display: grid; place-items: center; flex: none; transition: background .2s, border-color .2s, transform .2s cubic-bezier(.3,1.6,.5,1); }
.check.high { border-color: var(--down); }
.check.doing { background: conic-gradient(var(--up) 0 50%, transparent 50% 100%); background-clip: content-box; padding: 3px; }
.check.on { background: var(--ink); border-color: var(--ink); }
.check.on svg { stroke: var(--card); width: 14px; height: 14px; }
.check:not(.on) svg { display: none; }
.check:active { transform: scale(.85); }

.empty { text-align: center; padding: 56px 24px; }
.empty h3 { margin: 14px 0 4px; font-size: 19px; font-weight: 600; }
.empty p { margin: 0; color: var(--grey); }
.dots { display: inline-flex; gap: 4px; align-items: center; }
.dots i { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); }
.dots b { width: 7px; height: 7px; border-radius: 50%; background: var(--ink); margin-left: 3px; }

.bottom { position: sticky; bottom: 0; display: flex; gap: 12px; padding: 22px 0 14px; background: linear-gradient(to bottom, transparent, var(--bg) 35%); margin-top: auto; padding-top: 60px; z-index: 2; }
.search { flex: 1; height: 52px; border-radius: 26px; background: var(--card); display: flex; align-items: center; gap: 10px; padding: 0 16px; }
.search input { border: 0; outline: 0; background: none; flex: 1; font-size: 17px; }
.search input::placeholder { color: var(--grey); }
.plus { width: 52px; height: 52px; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; flex: none; }
.plus svg.i { width: 24px; height: 24px; }

/* ------------------------------------------------------------------ note */
.note { max-width: 760px; margin: 0 auto; padding: 14px 28px 160px; }
.bar { display: flex; align-items: center; gap: 10px; padding: 0 0 8px; position: sticky; top: 0; background: var(--bg); z-index: 3; padding-top: 10px; }
.back { color: var(--up); font-weight: 500; font-size: 16px; display: inline-flex; align-items: center; gap: 2px; }
.back svg.i { width: 20px; height: 20px; }
.grow { flex: 1; }
.title-row { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; }
.title { font-size: 28px; font-weight: 600; line-height: 1.2; border: 0; outline: 0; background: none; width: 100%; padding: 0; }
.title::placeholder { color: var(--faint); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border-radius: 10px; color: var(--grey); border: 1px solid var(--hair); font-weight: 500; font-size: 13.5px; position: relative; }
.chip.set { background: var(--field); border-color: transparent; color: var(--ink); }
.chip.hot { color: var(--down); }
.chip svg.i { width: 15px; height: 15px; }
.chip select, .chip input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.body { width: 100%; border: 0; outline: 0; background: none; resize: none; font-size: 17px; line-height: 26px; min-height: 180px; padding: 0; margin-top: 16px; overflow: hidden; }
.body::placeholder { color: var(--grey); }
.checklist { margin-top: 10px; }
.checklist label { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; cursor: pointer; font-size: 15.5px; }
.checklist label.done span { color: var(--grey); text-decoration: line-through; }
.checklist input { width: 18px; height: 18px; accent-color: var(--up); margin-top: 3px; }
.photos { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.photos img, .photos .add { width: 112px; height: 112px; border-radius: 16px; object-fit: cover; background: var(--field); cursor: pointer; }
.photos .add { display: grid; place-items: center; color: var(--grey); }
.chart-card { margin-top: 16px; padding: 14px 16px; cursor: pointer; }
.footer { color: var(--faint); font-size: 12.5px; margin-top: 22px; }
.tools { position: fixed; bottom: 0; right: 0; left: var(--list-w, 0); display: flex; align-items: center; gap: 4px; padding: 8px 18px 10px; background: var(--bg); border-top: 1px solid var(--hair); z-index: 4; }
.tools .tb { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; }
.tools .tb:hover { background: var(--field); }
.soft { display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 14px; border-radius: 12px; background: var(--field); font-weight: 500; font-size: 14.5px; white-space: nowrap; }
.btn-ink { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 50px; border-radius: 16px; background: var(--ink); color: var(--bg); font-weight: 600; font-size: 16px; }
.btn-ink:disabled { background: var(--faint); }

/* ------------------------------------------------------------------ charts */
.chart-head { min-height: 40px; }
.chart-title { font-weight: 600; font-size: 15px; }
.chart-sum { color: var(--grey); font-size: 12px; }
.chart svg { width: 100%; display: block; overflow: visible; }
.chart text { fill: var(--grey); font-size: 10.5px; font-family: Geist, system-ui; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; color: var(--grey); font-size: 12.5px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.pie-legend { margin-top: 12px; }
.pie-legend div { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 14px; }
.pie-legend div span:nth-child(2) { flex: 1; }
.draw { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 1.1s cubic-bezier(.4,0,.2,1) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.fadein { opacity: 0; animation: fade .9s .3s forwards; }
@keyframes fade { to { opacity: 1; } }
.grow-bar { transform-box: fill-box; transform-origin: bottom; animation: growbar .7s cubic-bezier(.2,.8,.2,1) both; }
@keyframes growbar { from { transform: scaleY(0); } }

/* ------------------------------------------------------------------ sheets */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.28); z-index: 20; animation: fade .2s forwards; opacity: 0; }
:root[data-theme="dark"] .scrim { background: rgba(0,0,0,.55); }
.sheet { position: fixed; z-index: 21; left: 50%; bottom: 0; transform: translateX(-50%); width: min(560px, 100%); max-height: 90vh; overflow-y: auto; background: var(--card); border-radius: 28px 28px 0 0; padding: 10px 22px 22px; animation: up .32s cubic-bezier(.2,.9,.3,1.05); }
@media (min-width: 821px) { .sheet { bottom: auto; top: 50%; transform: translate(-50%, -50%); border-radius: 24px; animation: pop .25s cubic-bezier(.2,.9,.3,1.05); box-shadow: var(--shadow); } }
@keyframes up { from { transform: translate(-50%, 100%); } }
@keyframes pop { from { transform: translate(-50%, -46%); opacity: 0; } }
.grab { width: 36px; height: 4px; border-radius: 2px; background: var(--faint); margin: 0 auto 6px; }
.sheet h2 { font-size: 17px; font-weight: 600; margin: 12px 0 8px; display: flex; align-items: center; justify-content: space-between; }
.sheet h2 button { font-size: 14px; font-weight: 500; color: var(--down); background: var(--field); padding: 6px 12px; border-radius: 10px; }
.sheet .hint { color: var(--grey); font-size: 13.5px; margin: 0 0 10px; }
.field { width: 100%; border: 0; outline: 0; background: var(--field); border-radius: 12px; padding: 13px 14px; font-size: 15.5px; margin: 6px 0; }
.opt { display: flex; align-items: center; justify-content: space-between; width: 100%; text-align: left; padding: 13px 0; font-size: 15.5px; border-bottom: 1px solid var(--hair); }
.opt small { color: var(--grey); font-size: 13px; }
.qchips { display: flex; flex-wrap: wrap; gap: 8px; }
.qchip { background: var(--field); border-radius: 12px; padding: 9px 12px; font-weight: 500; font-size: 14px; }
.answer { background: var(--bg); border-radius: 16px; padding: 14px; font-size: 15.5px; line-height: 23px; white-space: pre-wrap; margin-top: 6px; min-height: 48px; }
.answer.err { color: var(--down); }
.asked { color: var(--grey); font-weight: 500; font-size: 13.5px; margin-top: 10px; }
.caret { animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .15; } }
.qbox { display: flex; gap: 6px; align-items: flex-end; background: var(--field); border-radius: 22px; padding: 5px 5px 5px 16px; margin-top: 14px; }
.qbox textarea { flex: 1; border: 0; outline: 0; background: none; resize: none; font-size: 16px; padding: 8px 0; max-height: 120px; }
.send { width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; }
.send:disabled { background: var(--faint); }
.actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.rows .r { display: grid; grid-template-columns: 1.3fr 1fr 28px; gap: 8px; align-items: center; }
.add-row { color: var(--up); font-weight: 500; padding: 12px 0; display: inline-flex; gap: 6px; align-items: center; }
.qr { background: #fff; border-radius: 16px; padding: 12px; width: 240px; margin: 8px auto; display: block; }
.claude { background: var(--bg); border-radius: 16px; padding: 12px; margin-bottom: 8px; }

/* ------------------------------------------------------------------ misc */
#toast { position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: all .25s; z-index: 30; background: var(--ink); color: var(--bg); border-radius: 14px; padding: 4px 6px 4px 16px; display: flex; align-items: center; gap: 4px; min-height: 44px; max-width: min(520px, calc(100% - 32px)); }
#toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast button { color: var(--bg); font-weight: 600; padding: 10px 12px; }
.lightbox { position: fixed; inset: 0; background: #000; z-index: 40; display: grid; place-items: center; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox .lb-bar { position: absolute; top: 16px; right: 16px; display: flex; gap: 10px; }
.lightbox .round { background: rgba(255,255,255,.16); color: #fff; }
.pair { max-width: 440px; margin: 12vh auto; padding: 0 20px; }
.pair h1 { font-size: 34px; letter-spacing: -.5px; margin: 0 0 10px; }
.pair p { color: var(--grey); line-height: 1.5; }
.offline { background: var(--field); color: var(--grey); font-size: 13px; border-radius: 10px; padding: 8px 12px; margin: 0 4px 12px; }
