/* Tokens from the design (§02). Tag colours come per element as --c. */
:root {
  --bg: #FCFBF8;
  --surface: #FFFFFF;
  --sub: #F4F2ED;
  --ink: #222A31;
  --ink-2: #5D6570;
  --ink-3: #959BA3;
  --line: #E9E6DF;
  --line-2: #D7D3CA;
  --yellow: #FDC41B;
  --yellow-soft: #FEE7A0;
  --on-yellow: #222A31;
  --focus: #E5A800;
  --ring: rgba(253, 196, 27, .30);
  --cream: #FDFAEC;
  --cream-line: #F3E7B8;
  --err: #C2410C;
  --err-bg: #FDEDE4;
  --toast-bg: #222A31;
  --toast-ink: #FCFBF8;
  --scrim: rgba(34, 42, 49, .42);
  --tab-on: #FFFFFF;
  --tab-sh: 0 1px 3px rgba(20, 24, 30, .10);
  --word-accent: #F2B100;
  --menu-sh: 0 16px 40px rgba(20, 24, 30, .16), 0 2px 6px rgba(20, 24, 30, .06);
  --font: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --foot-h: 52px;
  color-scheme: light;
}

/* data-theme is set in index.html before this file applies: saved choice or the system setting */
:root[data-theme="dark"] {
  --bg: #161B20;
  --surface: #1E242A;
  --sub: #272E35;
  --ink: #F1EFE9;
  --ink-2: #A6ADB5;
  --ink-3: #6D747C;
  --line: #2B3239;
  --line-2: #3A424A;
  --yellow-soft: #5A4A1C;
  --focus: #FDC41B;
  --ring: rgba(253, 196, 27, .22);
  --cream: #2A2A22;
  --cream-line: #3D3A28;
  --err: #F08B6F;
  --err-bg: #3A1E16;
  --toast-bg: #F1EFE9;
  --toast-ink: #222A31;
  --scrim: rgba(0, 0, 0, .6);
  --tab-on: #323A42;
  --tab-sh: none;
  --word-accent: #FDC41B;
  --menu-sh: 0 16px 40px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* any display: rule would override the attribute */

html, body { margin: 0; }
html { background: var(--bg); } /* the strip under the gesture bar and the overscroll area take the theme colour */
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }
html { scrollbar-gutter: stable; } /* the scrollbar appearing must not shift the page */
/* The transition overlay must keep the theme's canvas while both page snapshots fade.
   Without this opaque backplate desktop Chromium can expose a white compositor layer. */
::view-transition { background: var(--bg); }
::view-transition-group(root), ::view-transition-image-pair(root) { background: var(--bg); isolation: isolate; }
::view-transition-old(root), ::view-transition-new(root) { background: var(--bg); }
body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 400 15.5px/1.48 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.mono { font-family: var(--mono); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

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

/* ---------- tag colour helpers ---------- */

.dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--ink-3)); }
.dot.sm { width: 8px; height: 8px; }
.dot.empty { background: transparent; border: 1.5px dashed var(--ink-3); }
.tchip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0;
  height: 24px; padding: 0 10px 0 8px; border-radius: 999px;
  background: color-mix(in oklab, var(--c) 14%, var(--surface));
  border: 1px solid color-mix(in oklab, var(--c) 38%, var(--surface));
  font-size: 12.5px; font-weight: 500; color: var(--ink);
}
button.tchip { cursor: pointer; }
.tchip[aria-pressed="true"] { border-color: var(--c); background: color-mix(in oklab, var(--c) 24%, var(--surface)); }
.ellipsis { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 22px; border: 0; border-radius: 999px;
  font-weight: 600; font-size: 15px; white-space: nowrap;
}
.btn-yellow { background: var(--yellow); color: var(--on-yellow); }
@media (hover: hover) { .btn-yellow:hover { filter: brightness(.96); } }
.btn-yellow.pale { background: var(--yellow-soft); }
.btn-yellow:focus-visible { outline-color: var(--ink); }
.btn-line { height: 40px; padding: 0 18px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 500; font-size: 14.5px; }
.btn-danger { height: 40px; padding: 0 18px; background: var(--err); color: #FFFFFF; font-size: 14.5px; }
.btn-text { border: 0; background: none; padding: 0; color: var(--ink-2); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
@media (hover: hover) { .btn-text:hover { color: var(--ink); } }
.xbtn {
  flex: none; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); padding: 0;
}
@media (hover: hover) { .xbtn:hover { background: var(--sub); color: var(--err); } }

/* segmented control: header tabs, Дневник/История, sorting */
.seg { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--sub); }
.seg > a, .seg > button {
  height: 34px; padding: 0 16px; display: flex; align-items: center; gap: 7px;
  border: 0; border-radius: 999px; background: transparent; color: var(--ink-2);
  font-weight: 500; font-size: 14px; text-decoration: none; white-space: nowrap;
}
.seg > [aria-selected="true"], .seg > [aria-checked="true"] { background: var(--tab-on); box-shadow: var(--tab-sh); color: var(--ink); }

/* text inputs */
.field-in {
  width: 100%; height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); font-size: 14.5px; outline: none;
}
.field-in:focus { border-color: var(--focus); box-shadow: 0 0 0 3px var(--ring); }
.search { position: relative; display: block; }
.search > svg { position: absolute; left: 13px; top: 50%; margin-top: -7.5px; color: var(--ink-3); pointer-events: none; }
.search > input { padding-left: 36px; }
.pill-in { border-radius: 999px; }

/* ---------- header ---------- */

.top { background: var(--bg); }
.top-in { max-width: 1120px; margin: 0 auto; padding: 16px 28px; display: flex; align-items: center; gap: 24px; }
.brand { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; }
.brand-icon { width: 34px; height: 34px; display: block; }
.brand-word { font-weight: 700; font-size: 22px; letter-spacing: -0.035em; }
.brand-word span { color: var(--word-accent); }
.tabs { flex: none; padding: 4px; gap: 4px; }
.tabs > a { height: 36px; font-size: 14.5px; }
.top-end { flex: 1; display: flex; justify-content: flex-end; min-width: 0; }
.top-end { gap: 8px; align-items: center; }
.theme-btn {
  flex: none; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; padding: 0;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2);
}
@media (hover: hover) { .theme-btn:hover { border-color: var(--line-2); color: var(--ink); } }
.user {
  display: flex; align-items: center; gap: 8px; max-width: 200px; min-height: 36px;
  padding: 3px 12px 3px 3px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); font-weight: 500; font-size: 14px;
}
@media (hover: hover) { .user:hover { border-color: var(--line-2); } }
.avatar {
  flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--yellow); color: var(--on-yellow);
  display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700;
}
.user-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- views ---------- */

.view { padding: 20px 24px calc(var(--foot-h) + 40px); }
.view-write { min-height: calc(100dvh - 68px); display: flex; flex-direction: column; justify-content: center; align-items: center; padding-top: 24px; }
.write-in { width: 100%; max-width: 780px; display: flex; flex-direction: column; gap: 28px; }
.view-notes { width: 100%; max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
/* the page keeps one width in both modes, so the Дневник / История switch never moves;
   only the history column is narrower */
#history { width: 100%; max-width: 760px; margin: 0 auto; }
.view-topics { width: 100%; max-width: 760px; margin: 0 auto; }
.notes-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.notes-head .seg { grid-column: 2; }
.hint-esc { grid-column: 3; justify-self: end; font-size: 12.5px; color: var(--ink-3); }

/* ---------- composer ---------- */

.composer { position: relative; }
.card {
  position: relative; display: flex; flex-direction: column; min-height: 300px;
  padding: 30px 28px 22px 32px; border-radius: 28px; background: var(--surface);
  border: 1.5px solid var(--card-bd, var(--line));
  box-shadow: 0 24px 60px rgba(20, 24, 30, .06);
  transition: border-color .15s, box-shadow .15s; cursor: text;
}
.card.has-tag { --card-bd: var(--c); }
.card:focus-within {
  --card-bd: var(--focus);
  box-shadow: 0 0 0 5px var(--ring), 0 24px 60px rgba(20, 24, 30, .08);
}
.card.has-tag:focus-within { --card-bd: var(--c); box-shadow: 0 0 0 5px color-mix(in oklab, var(--c) 22%, transparent), 0 24px 60px rgba(20, 24, 30, .08); }
.card.shake { animation: shake .32s ease-out; }
@keyframes shake { 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(2px); } }

.chain {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; margin: -6px 0 18px; padding-bottom: 14px;
  border-bottom: 1px dashed var(--line); cursor: default;
}
.chain-name { display: flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 600; }
.step {
  height: 28px; padding: 0 11px 0 6px; display: flex; align-items: center; gap: 6px; border-radius: 999px;
  border: 1.5px solid var(--line); font-size: 13px; font-weight: 500;
}
.step .badge {
  width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--sub); color: var(--ink-2); font: 600 11px var(--mono);
}
.step.done { border-color: color-mix(in oklab, var(--c) 40%, var(--surface)); }
.step.cur { border-color: var(--c); background: color-mix(in oklab, var(--c) 16%, var(--surface)); font-weight: 600; }
.step.done .badge, .step.cur .badge { background: var(--c); color: #FFFFFF; }
.step.skipped { color: var(--ink-3); }
.arrow { font-size: 12px; color: var(--ink-3); }
.chain .grow { flex: 1; }
.chain-btn { height: 30px; padding: 0 10px; border: 0; border-radius: 999px; background: transparent; color: var(--ink-2); font-size: 13px; font-weight: 500; }
@media (hover: hover) { .chain-btn:hover { background: var(--sub); } }
.chain-btn.line { border: 1px solid var(--line); color: var(--ink); padding: 0 12px; }
/* chain on phones: one row and a progress bar; shown instead of .chain under 640px */
.chain-m { display: none; flex-direction: column; gap: 12px; margin: -2px 0 22px; cursor: default; }
.chain-m-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chain-m-name { font-size: 15px; font-weight: 600; }
.chain-m-step { flex: none; font-size: 13.5px; color: var(--ink-3); }
.chain-m .grow { flex: 1; }
.chain-m .chain-btn { flex: none; height: 40px; padding: 0 12px; font-size: 14px; }
.chain-x {
  flex: none; width: 40px; height: 40px; margin-right: -8px; display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; background: transparent; color: var(--ink-2); padding: 0;
}
.chain-m-bars { display: flex; gap: 4px; }
.chain-m-bars span { flex: 1; height: 3px; border-radius: 2px; background: var(--line); }
.chain-m-bars span.on { background: var(--c); }
.done-msg { margin: -6px 0 16px; padding: 10px 14px; border-radius: 12px; background: var(--cream); border: 1px solid var(--cream-line); font-size: 14px; font-weight: 500; cursor: default; }

.c-row { display: flex; align-items: flex-start; gap: 16px; flex: 1; }
.c-field { position: relative; flex: 1; min-width: 0; }
.c-text {
  display: block; width: 100%; min-height: 96px; border: 0; outline: none; resize: none; background: transparent;
  padding: 0; margin: 0; font-size: 23px; line-height: 1.45; overflow: hidden;
}
.c-text::placeholder { color: var(--ink-3); }
.c-text:focus-visible { outline: none; }
.c-bottom { display: flex; align-items: center; gap: 10px; margin-top: 16px; cursor: default; }
.c-bottom .grow { flex: 1; }

.tagpill {
  display: flex; align-items: center; gap: 6px; max-width: 220px; height: 36px; padding: 0 10px 0 12px;
  border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--ink-2);
  font-size: 14px; font-weight: 500;
}
@media (hover: hover) { .tagpill:hover { border-color: var(--line-2); } }
.tagpill.on {
  background: color-mix(in oklab, var(--c) 16%, var(--surface));
  border-color: color-mix(in oklab, var(--c) 45%, var(--surface)); color: var(--ink);
}
.tagpill svg { flex: none; opacity: .7; }
.c-side { position: relative; flex: none; cursor: default; }

.datechip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 3px 0 10px; border-radius: 999px;
  background: var(--cream); border: 1px solid var(--cream-line); font-size: 14px; font-weight: 500;
}
.datechip > svg { color: var(--ink-2); }
.datechip .x { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 999px; background: transparent; color: var(--ink-2); padding: 0; }
@media (hover: hover) { .datechip .x:hover { background: var(--sub); } }

/* menus: # and / suggestions, tag panel, history tag panel */
.menu {
  position: absolute; z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--menu-sh); padding: 5px; cursor: default;
}
.menu.pop { left: -8px; top: calc(100% + 4px); width: 300px; max-width: calc(100% + 8px); }
.menu.panel { right: 0; top: calc(100% + 6px); width: 290px; padding: 6px; }
.menu-title { padding: 7px 10px 5px; font-size: 11.5px; font-weight: 500; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.menu-sep { margin-top: 4px; border-top: 1px solid var(--line); }
.opt {
  display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 10px; border-radius: 9px;
  cursor: pointer; font-size: 15px;
}
.opt.active { background: var(--sub); }
@media (hover: hover) { .opt:hover { background: var(--sub); } }
.opt.active { font-weight: 500; }
.opt .check { flex: none; width: 16px; display: flex; justify-content: center; }
.opt .help { margin-left: auto; flex: none; font: 12px var(--mono); color: var(--ink-3); }
.opt .help.strong { color: var(--ink); }
.opt.muted { color: var(--ink-2); }
.panel .opt { font-size: 14.5px; }
.panel-search { position: relative; padding: 2px 2px 6px; }
.panel-search svg { position: absolute; left: 12px; top: 12px; color: var(--ink-3); }
.panel-search input {
  width: 100%; height: 36px; padding: 0 10px 0 32px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--bg); font-size: 14px; outline: none;
}
.panel-search input:focus { border-color: var(--focus); box-shadow: 0 0 0 3px var(--ring); }
.panel-list { max-height: 244px; overflow-y: auto; }
.panel-empty { padding: 18px 12px; font-size: 14px; line-height: 1.45; color: var(--ink-2); text-align: center; }
.panel-back { padding: 6px 10px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.create { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; padding: 12px 10px 6px; border-top: 1px solid var(--line); }
.create-label { font-size: 12.5px; color: var(--ink-2); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: var(--c); }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); }
.swatch:focus-visible { outline-color: var(--ink); }
.create-btn {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; min-width: 0;
  border: 1.5px solid var(--c); border-radius: 999px; background: color-mix(in oklab, var(--c) 14%, var(--surface));
  font-size: 14px; font-weight: 500;
}
.create-btn .help { margin-left: auto; font: 12px var(--mono); color: var(--ink-3); }

/* calendar (composer date picker and diary) */
.cal-pop { left: -8px; top: calc(100% + 4px); width: 280px; padding: 12px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 10px; }
.cal-head b { font-size: 14.5px; font-weight: 600; }
.cal-nav { display: flex; gap: 2px; }
.cal-nav button { width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-2); }
@media (hover: hover) { .cal-nav button:hover:not(:disabled) { background: var(--sub); } }
.cal-nav button:disabled { opacity: .35; cursor: default; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal-wd { font-size: 11.5px; color: var(--ink-3); padding: 2px 0 6px; }
.cal-day {
  height: 32px; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 8px;
  background: transparent; font-size: 13.5px; font-variant-numeric: tabular-nums; padding: 0;
}
@media (hover: hover) { .cal-day:hover:not(:disabled) { box-shadow: inset 0 0 0 1.5px var(--line-2); } }
.cal-day.today { box-shadow: inset 0 0 0 1.5px var(--line-2); }
.cal-day.sel { background: var(--yellow); color: var(--on-yellow); font-weight: 600; box-shadow: none; }
.cal-day:disabled { opacity: .3; cursor: default; }
.cal-note { padding: 10px 4px 0; font-size: 12px; color: var(--ink-3); }

/* ---------- last note on the Write tab ---------- */

.last { display: flex; flex-direction: column; gap: 8px; }
.last-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 6px; }
.last-title { font-size: 13px; font-weight: 500; color: var(--ink-3); }
.link-more { display: flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 4px; color: var(--ink-2); font-size: 13.5px; font-weight: 500; text-decoration: none; }
@media (hover: hover) { .link-more:hover { color: var(--ink); } }
.last-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; padding: 14px 18px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--bd, var(--line));
}
.last-card .time { font: 12.5px/22px var(--mono); color: var(--ink-3); }
.last-card .body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.clamp { white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.last-card .text { font-size: 15.5px; line-height: 22px; -webkit-line-clamp: 3; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.meta-note { font-size: 12.5px; color: var(--ink-2); }
.pending-mark { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.ring-dot { width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--ink-3); }
.last-empty { padding: 16px 18px; border-radius: 18px; border: 1px dashed var(--line-2); font-size: 14.5px; color: var(--ink-2); }
.is-pending .text, .is-pending .n-text { color: var(--ink-2); }

/* ---------- diary ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fchip {
  height: 32px; padding: 0 12px 0 10px; display: flex; align-items: center; gap: 7px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 13.5px; font-weight: 500;
}
.fchip[aria-pressed="true"] { border-color: var(--c, var(--ink)); background: color-mix(in oklab, var(--c, var(--ink)) 18%, var(--surface)); color: var(--ink); }
.fchip.plain[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.diary { display: flex; flex-direction: column; gap: 18px; outline: none; }
.diary-grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 28px; align-items: start; }
.month { padding: 18px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.month-head { display: flex; align-items: center; justify-content: space-between; }
.month-head b { font-size: 16px; font-weight: 600; }
.month-head .cal-nav button { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px; }
.month .cal-grid { gap: 4px; }
.mday {
  height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 0; border-radius: 10px; background: transparent; font-size: 13.5px; font-variant-numeric: tabular-nums; padding: 0;
}
@media (hover: hover) { .mday:hover:not(:disabled) { box-shadow: inset 0 0 0 1.5px var(--line-2); } }
.mday.today { box-shadow: inset 0 0 0 1.5px var(--line-2); }
.mday.sel { background: var(--yellow); color: var(--on-yellow); font-weight: 700; box-shadow: none; }
.mday:disabled { opacity: .3; cursor: default; }
.daydots { display: flex; gap: 2px; height: 5px; }
.daydots span { width: 5px; height: 5px; border-radius: 50%; background: var(--c); }
.month-foot { display: flex; justify-content: space-between; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); }
.month-foot button { padding: 0; border: 0; background: none; font-size: 12.5px; font-weight: 500; color: var(--ink); text-decoration: underline; text-decoration-color: var(--yellow); text-underline-offset: 3px; }
.week { display: none; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.wday {
  height: 66px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 0; border-radius: 14px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); padding: 0;
}
.wday small { font-size: 11.5px; color: var(--ink-2); }
.wday b { font-size: 16px; font-weight: 600; }
.wday.today { box-shadow: inset 0 0 0 1.5px var(--line-2); }
.wday.sel { background: var(--yellow); color: var(--on-yellow); box-shadow: none; }
.wday.sel small { color: inherit; }
.wday:disabled { opacity: .35; cursor: default; }
.day-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.day-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.day-rel { font-size: 13px; color: var(--ink-3); }
.head-date { display: none; }
.day-title { font-size: 26px; font-weight: 700; letter-spacing: -0.025em; }
.day-tools { display: flex; align-items: center; gap: 6px; }
.day-theme { height: 26px; padding: 0 9px 0 7px; display: flex; align-items: center; gap: 5px; border-radius: 999px; background: color-mix(in oklab, var(--c) 14%, var(--surface)); font-size: 12.5px; font-weight: 500; }
.round { width: 34px; height: 34px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); }
.round:disabled { opacity: .35; cursor: default; }
.timeline { position: relative; display: flex; flex-direction: column; gap: 10px; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 12px; bottom: 12px; width: 2px; border-radius: 1px; background: var(--line); }
.tl-item {
  position: relative; display: grid; grid-template-columns: 50px minmax(0, 1fr); gap: 12px; padding: 13px 16px;
  border-radius: 16px; background: var(--surface); border: 1px solid color-mix(in oklab, var(--c, var(--line-2)) 35%, var(--surface));
}
.tl-item.untagged { border-color: var(--line); }
.tl-item::before {
  content: ""; position: absolute; left: -22px; top: 18px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--c, var(--line-2)); border: 2px solid var(--bg);
}
.tl-item .time { font: 12.5px/22px var(--mono); color: var(--ink-3); }
.tl-item .body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tl-item .n-text { font-size: 15.5px; line-height: 22px; -webkit-line-clamp: 6; }
.day-empty { padding: 32px 20px; border-radius: 18px; border: 1.5px dashed var(--line-2); display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; color: var(--ink-2); }
.day-empty .btn { height: 40px; font-size: 14.5px; padding: 0 20px; }

/* ---------- history ---------- */

.hist { display: flex; flex-direction: column; gap: 6px; }
.hfilters { display: flex; flex-direction: column; gap: 10px; padding-bottom: 6px; }
.hrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hrow .search { flex: 1 1 240px; min-width: 0; }
.select { position: relative; flex: 0 0 190px; }
.select select {
  appearance: none; -webkit-appearance: none; width: 100%; height: 40px; padding: 0 34px 0 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 14.5px; font-weight: 500; outline: none;
}
.select select:focus { border-color: var(--focus); box-shadow: 0 0 0 3px var(--ring); }
.select svg { position: absolute; right: 12px; top: 50%; margin-top: -6px; pointer-events: none; color: var(--ink-2); }
.range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.range label { display: flex; align-items: center; gap: 8px; flex: 1 1 150px; font-size: 13.5px; color: var(--ink-2); }
.range input { flex: 1; min-width: 0; padding: 0 10px; }
.toggles { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.toggle {
  display: flex; align-items: center; gap: 6px; max-width: 220px; height: 32px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink-2); font-size: 13.5px; font-weight: 500;
}
.toggle[aria-pressed="true"] { border-color: var(--c); background: color-mix(in oklab, var(--c) 20%, var(--surface)); color: var(--ink); }
.toggle.all { border-style: dashed; border-color: var(--line-2); background: transparent; padding: 0 10px 0 12px; }
@media (hover: hover) { .toggle.all:hover { color: var(--ink); } }
.theme-filter {
  display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 0 3px 0 12px; border-radius: 999px; min-width: 0;
  background: color-mix(in oklab, var(--c) 14%, var(--surface)); border: 1px solid color-mix(in oklab, var(--c) 40%, var(--surface));
  font-size: 14px; font-weight: 600;
}
.theme-filter .sub { font-size: 12.5px; font-weight: 400; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-filter .x { width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 999px; background: transparent; color: var(--ink-2); padding: 0; }
@media (hover: hover) { .theme-filter .x:hover { background: var(--sub); } }
.menu.hpanel { left: 0; top: calc(100% + 6px); width: 320px; max-width: 100%; padding: 6px; }
.box { flex: none; width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--line-2); display: flex; align-items: center; justify-content: center; color: var(--bg); }
.box.on { border-color: var(--ink); background: var(--ink); }
.hpanel-foot { display: flex; justify-content: space-between; padding: 8px 10px 4px; margin-top: 4px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); }
.group-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 10px 2px; }
.group-head b { font-size: 15px; font-weight: 600; }
.group-head .sub { font-size: 13px; color: var(--ink-3); margin-left: 8px; }
.group-head .cnt { flex: none; font-size: 12.5px; color: var(--ink-3); }
.hnote {
  display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 10px; padding: 9px 6px 9px 10px; margin-top: 8px;
  border-radius: 16px; background: var(--surface); border: 1px solid color-mix(in oklab, var(--c, var(--line)) 38%, var(--surface));
}
.hnote.untagged { border-color: var(--line); }
@media (hover: hover) { .hnote:hover { border-color: color-mix(in oklab, var(--c, var(--line-2)) 75%, var(--surface)); box-shadow: 0 6px 18px rgba(20, 24, 30, .06); } }
@media (hover: hover) { .hnote.untagged:hover { border-color: var(--line-2); } }
.hnote .time { font: 12.5px/23px var(--mono); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.hnote .body { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.hnote .n-text { font-size: 15.5px; line-height: 23px; white-space: pre-wrap; overflow-wrap: anywhere; }
.hnote .n-text.folded { max-height: 138px; overflow: hidden; mask-image: linear-gradient(#000 55%, transparent); -webkit-mask-image: linear-gradient(#000 55%, transparent); }
.hnote .xbtn { opacity: 0; }
.hnote .xbtn:focus-visible { opacity: 1; }
@media (hover: hover) { .hnote:hover .xbtn { opacity: 1; } }
.forchip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border-radius: 6px; background: var(--sub); font-size: 12.5px; color: var(--ink-2); }
.rejected { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 12.5px; }
.rejected .why { display: flex; align-items: center; gap: 6px; color: var(--err); }
.rejected .why::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--err); }
.rejected button { padding: 0; border: 0; background: none; font-weight: 500; font-size: 12.5px; text-decoration: underline; text-underline-offset: 3px; }
.notice { display: flex; align-items: center; gap: 12px; margin-top: 8px; padding: 14px 16px; border-radius: 12px; background: var(--sub); font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.notice::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--ink-2); }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 22px 0 8px; font-size: 13px; color: var(--ink-2); }
.loading i { width: 6px; height: 6px; border-radius: 50%; background: var(--yellow); }
.loading i:nth-child(2) { opacity: .6; }
.loading i:nth-child(3) { opacity: .3; }
.empty-all { padding: 48px 20px 40px; display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; }
.empty-all img { width: 56px; height: 56px; opacity: .9; }
.empty-all p { margin: 0; }
.empty-all .t { font-size: 16px; font-weight: 500; }
.empty-all .h { font-size: 14px; line-height: 1.45; color: var(--ink-2); max-width: 340px; }
.empty-filtered { padding: 44px 20px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; color: var(--ink-2); }

/* ---------- topics ---------- */

.topics { display: flex; flex-direction: column; gap: 14px; }
.sec { display: flex; flex-direction: column; gap: 12px; }
.sec + .sec { margin-top: 18px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sec-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sec-title b { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.sec-title span { font-size: 13px; color: var(--ink-3); }
.set-new { min-height: 36px; padding: 0 14px; border: 1px dashed var(--line-2); border-radius: 999px; background: transparent; color: var(--ink-2); font-size: 14px; font-weight: 500; }
@media (hover: hover) { .set-new:hover { color: var(--ink); border-color: var(--ink-3); } }
.hint-box { padding: 16px 18px; border-radius: 18px; border: 1px dashed var(--line-2); font-size: 14.5px; line-height: 1.5; color: var(--ink-2); }
.ttools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ttools .search { flex: 1 1 220px; min-width: 0; }
.tgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tcard {
  display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 18px 18px 16px; border-radius: 20px; text-align: left;
  border: 1px solid color-mix(in oklab, var(--c) 40%, var(--surface)); background: color-mix(in oklab, var(--c) 5%, var(--surface));
}
.tcard { cursor: pointer; }
@media (hover: hover) { .tcard:hover { box-shadow: 0 8px 24px rgba(20, 24, 30, .08); } }
.theme-card { border-width: 1.5px; background: color-mix(in oklab, var(--c) 8%, var(--surface)); }
.theme-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.when > span + span::before { content: " · "; }
.card-actions button.edit svg { display: none; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; }
.card-actions { display: flex; gap: 4px; flex: none; }
.card-actions button { height: 32px; padding: 0 10px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-2); font-size: 13px; font-weight: 500; }
@media (hover: hover) { .card-actions button:hover { background: var(--sub); color: var(--ink); } }
.card-actions button.play { background: var(--yellow); color: var(--on-yellow); font-weight: 600; }
.tcard .row { display: flex; align-items: center; gap: 10px; width: 100%; }
.tcard .dot { width: 12px; height: 12px; }
.tcard .name { flex: 1; font-size: 16.5px; font-weight: 600; letter-spacing: -0.01em; }
.tcard .fresh { flex: none; height: 22px; padding: 0 8px; display: flex; align-items: center; border-radius: 999px; background: var(--sub); font-size: 12px; font-weight: 600; }
.tcard .count { flex: none; font: 12.5px var(--mono); color: var(--ink-3); }
.tcard .lastt { font-size: 14px; line-height: 1.45; color: var(--ink-2); -webkit-line-clamp: 2; min-height: 40px; }
.tcard .when { font-size: 12.5px; color: var(--ink-3); }
.more { align-self: center; height: 40px; padding: 0 18px; border: 1px solid var(--line-2); border-radius: 999px; background: transparent; font-size: 14px; font-weight: 500; }
@media (hover: hover) { .more:hover { background: var(--sub); } }
.topics-empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 48px 24px; text-align: center; }
.topics-empty .fake { height: 32px; padding: 0 14px; display: flex; align-items: center; gap: 7px; border-radius: 999px; border: 1px solid var(--line); font-size: 14px; color: var(--ink-2); }
.topics-empty p { margin: 0; }
.topics-empty .t { font-size: 16px; font-weight: 500; }
.topics-empty .h { max-width: 380px; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.offline-box { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 48px 24px; border: 1px dashed var(--line-2); border-radius: 20px; text-align: center; color: var(--ink-2); }

/* ---------- footer, mobile nav, queue ---------- */

.foot {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: var(--foot-h); padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border-top: 1px solid var(--line); background: var(--bg); font-size: 12.5px; color: var(--ink-2);
}
.keys { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; }
.keys > span { display: flex; align-items: center; gap: 6px; }
kbd { font: 11.5px var(--mono); padding: 1px 6px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; color: var(--ink); background: var(--surface); }
.queue {
  display: flex; align-items: center; gap: 7px; height: 28px; padding: 0 12px; border-radius: 999px;
  background: var(--sub); color: var(--ink-2); font-size: 13px; font-weight: 500; white-space: nowrap;
}
.queue::before, .queue-strip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid currentColor; }
.queue.failed, .queue-strip.failed { background: var(--err-bg); color: var(--err); }
.queue.failed::before, .queue-strip.failed::before { background: currentColor; }
.mnav { display: none; }

/* ---------- toast and modals ---------- */

.toast {
  position: fixed; left: 50%; bottom: calc(var(--foot-h) + 16px); transform: translateX(-50%); z-index: 40;
  width: 400px; max-width: calc(100% - 24px); display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px;
  border-radius: 16px; background: var(--toast-bg); color: var(--toast-ink); box-shadow: 0 14px 36px rgba(0, 0, 0, .22); overflow: hidden;
  animation: toast-in .18s ease-out;
}
@keyframes toast-in { from { opacity: 0; translate: 0 12px; } }
.toast .tdot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--yellow); }
.toast.err .tdot { background: #E0664A; }
.toast .ttext { flex: 1; min-width: 0; font-size: 14.5px; line-height: 1.35; }
.toast button { flex: none; height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--yellow); color: var(--on-yellow); font-weight: 600; font-size: 14px; }
.toast button:focus-visible { outline-color: var(--yellow); }
.toast .tbar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--yellow); transform-origin: left; animation: tbar 5s linear forwards; }
@keyframes tbar { to { transform: scaleX(0); } }

.scrim { position: fixed; inset: 0; z-index: 50; background: var(--scrim); display: flex; align-items: center; justify-content: center; padding: 24px; }
.dialog {
  width: 420px; max-width: 100%; max-height: calc(100dvh - 48px); overflow: auto; background: var(--surface); border-radius: 24px;
  padding: 30px; box-shadow: 0 24px 64px rgba(0, 0, 0, .24); display: flex; flex-direction: column; gap: 18px;
}
.dialog.sm { width: 400px; gap: 16px; }
.dialog h2 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.025em; }
.dialog.sm h2 { font-size: 20px; letter-spacing: -0.02em; }
.dialog p { margin: 0; font-size: 14.5px; line-height: 1.5; color: var(--ink-2); }
.dialog .icon { width: 52px; height: 52px; }
.dialog .big-in { height: 48px; padding: 0 16px; border: 1.5px solid var(--line-2); border-radius: 14px; background: var(--surface); font-size: 17px; outline: none; width: 100%; }
.dialog .big-in:focus { border-color: var(--focus); box-shadow: 0 0 0 4px var(--ring); }
.dialog .btn-yellow { height: 48px; font-size: 15.5px; }
.dialog .btn-yellow:disabled { background: var(--sub); color: var(--ink-3); cursor: not-allowed; }
.dialog .hint { text-align: center; font-size: 12.5px; color: var(--ink-3); }
.dialog .hint.right { text-align: right; }
/* account screens */
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form .err-line:empty { display: none; }
.auth-switch { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.link-btn { min-height: 32px; padding: 0; border: 0; background: transparent; color: var(--ink-2); font-size: 14px; font-weight: 500; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
@media (hover: hover) { .link-btn:hover { color: var(--ink); } }
.acct-email { font-weight: 500; color: var(--ink) !important; }
.acct-list { display: flex; flex-direction: column; gap: 8px; }
.acct-list .btn { width: 100%; height: 44px; justify-content: center; text-decoration: none; color: var(--ink); }
.acct-list .btn.danger { color: var(--err); }
.quote { padding: 12px 14px; border-radius: 14px; background: var(--sub); font-size: 14px; line-height: 1.5; color: var(--ink-2); -webkit-line-clamp: 3; }
.actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.actions .grow { flex: 1; }
.dialog .err-line { font-size: 13.5px; color: var(--err); }
.flabel { display: flex; flex-direction: column; gap: 8px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.ed-tags { display: flex; flex-direction: column; gap: 6px; }
.ed-tag { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 4px 0 10px; border: 1px solid var(--line); border-radius: 12px; font-size: 14.5px; }
.ed-tag .num { font: 12px var(--mono); color: var(--ink-3); width: 16px; }
.ed-tag .grow { flex: 1; min-width: 0; }
.ed-tag button { width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); padding: 0; }
@media (hover: hover) { .ed-tag button:hover:not(:disabled) { background: var(--sub); color: var(--ink); } }
.ed-tag button:disabled { opacity: .3; cursor: default; }
.ed-add { position: relative; }
.ed-add .menu { left: 0; right: 0; top: calc(100% + 4px); max-height: 220px; overflow-y: auto; }
.theme-note { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: color-mix(in oklab, var(--c) 12%, var(--surface)); color: var(--ink); font-size: 14px; font-weight: 500; }
.moves { flex: none; font-size: 12px; color: var(--ink-3); }
.confirm-text { flex: 1 1 100%; margin: 0; font-size: 14px; color: var(--ink-2); }
.switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; font-size: 14.5px; }
.switch input { appearance: none; -webkit-appearance: none; flex: none; width: 40px; height: 24px; margin: 0; border-radius: 999px; background: var(--line-2); position: relative; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #FFFFFF; transition: transform .15s; }
.switch input:checked { background: var(--yellow); }
.switch input:checked::after { transform: translateX(16px); }
.switch small { display: block; font-size: 13px; color: var(--ink-2); margin-top: 2px; }

/* ---------- mobile (390) ---------- */

@media (max-width: 640px) {
  /* bottom nav: 8 + 50 + 8, plus the home indicator */
  :root { --foot-h: calc(66px + env(safe-area-inset-bottom, 0px)); }
  body { font-size: 15px; }

  /* header: icon, word, theme and the avatar alone */
  .top-in { padding: 20px 20px 8px; }
  .brand-icon { width: 30px; height: 30px; }
  .brand-word { font-size: 20px; }
  .tabs { display: none; }
  .theme-btn { width: 44px; height: 44px; border-color: transparent; background: transparent; }
  .user { min-height: 44px; padding: 0; border-color: transparent; background: transparent; }
  .user .avatar { width: 40px; height: 40px; font-size: 15px; }
  .user-name { display: none; }

  .view { padding: 20px 20px calc(var(--foot-h) + var(--q-h, 0px) + 32px); }
  .view-write { min-height: calc(100dvh - 72px); padding-top: 24px; }
  .write-in { gap: 40px; }
  .view-notes { gap: 28px; }

  /* composer */
  .card { min-height: 300px; padding: 24px 20px 20px 22px; border-radius: 22px; box-shadow: 0 12px 32px rgba(20, 24, 30, .05); }
  .c-text { font-size: 19px; }
  .tagpill { max-width: 130px; height: 40px; }
  .datechip { height: 36px; }
  .datechip .x { width: 30px; height: 30px; }
  .c-bottom .btn { height: 48px; }
  .opt { min-height: 44px; }
  .swatch { width: 32px; height: 32px; }
  .menu.panel { position: fixed; left: 12px; right: 12px; top: auto; bottom: calc(var(--foot-h) + 12px); width: auto; }
  .chain { display: none; }
  .chain-m { display: flex; }

  /* last note: no card, just the row */
  .last-head { padding: 0 4px; }
  .link-more { min-height: 44px; }
  .last-card { padding: 2px 4px; background: transparent; border: 0; }

  .seg > a, .seg > button { height: 40px; }

  /* bottom nav */
  .foot { display: none; }
  .mnav { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--bg) }
  .queue-strip { display: flex; justify-content: center; align-items: center; gap: 7px; width: 100%; height: 30px; border: 0; background: var(--sub); color: var(--ink-2); font-size: 12.5px; font-weight: 500; }
  .mnav-tabs { display: grid; grid-template-columns: repeat(3, 1fr); padding: 8px 24px calc(8px + env(safe-area-inset-bottom, 0px)); }
  .mnav-tabs a { height: 50px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; color: var(--ink-3); font-size: 13px; font-weight: 600; text-decoration: none; border-radius: 10px; }
  .mnav-tabs a:focus-visible { outline-offset: -2px; }
  .mnav-tabs a .bar { width: 6px; height: 6px; border-radius: 50%; }
  .mnav-tabs a[aria-selected="true"] { color: var(--ink); }
  .mnav-tabs a[aria-selected="true"] .bar { background: var(--yellow); }

  .toast { left: 20px; right: 20px; width: auto; max-width: none; transform: none; bottom: calc(var(--foot-h) + var(--q-h, 0px) + 16px); }
  .toast button { height: 40px; }

  /* dialogs become bottom sheets */
  .scrim { align-items: flex-end; padding: 12px; }
  .dialog { padding: 24px 20px 20px; }
  .dialog .big-in, .dialog .btn-yellow { height: 52px; }
  .actions > button { flex: 1 1 0; height: 52px; }
  .dialog .hint { display: none; }

  /* diary: theme chips in one scrolling row, week strip, timeline without cards */
  .diary { gap: 26px; }
  .diary > .chips { flex-wrap: nowrap; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -20px; padding: 0 20px; }
  .diary > .chips::-webkit-scrollbar { display: none; }
  .fchip { flex: none; height: 40px; padding: 0 14px 0 12px; }
  .diary-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .month { display: none; }
  .week { display: grid; gap: 2px; }
  .wday { height: 68px; background: transparent; box-shadow: none; }
  .wday small { font-size: 12px; color: var(--ink-3); }
  .wday.today { box-shadow: inset 0 0 0 1.5px var(--line-2); }
  .wday.sel { background: var(--yellow); box-shadow: none; }
  .wday.sel small { color: var(--on-yellow); }
  .day-title { font-size: 24px; }
  .day-theme { display: none; }
  .hint-esc { display: none !important; }
  .day-tools .round { display: none; }
  .timeline { gap: 6px; }
  .tl-item { grid-template-columns: 42px minmax(0, 1fr); padding: 2px 0 18px; background: transparent; border: 0; border-radius: 0; }
  .tl-item::before { top: 7px; }
  .day-empty .btn { height: 46px; }

  /* history */
  .fchip, .toggle { height: 40px; }
  .select { flex: 1 1 100%; }
  .field-in, .select select { height: 44px; }
  .hnote { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .hnote .xbtn { opacity: 1; width: 40px; height: 40px; }
  .tchip.big { height: 30px; }

  /* topics: one column of plain cards, no counters */
  .topics { gap: 24px; }
  .tgrid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .tcard, .theme-card { padding: 20px 20px 18px; border: 1px solid var(--line); background: var(--surface); }
  .tcard .count, .tcard .fresh { display: none; }
  .tcard .lastt { min-height: 0; }
  .ttools .field-in { height: 46px; }
  .set-new { min-height: 44px; }
  .card-foot { flex-wrap: wrap; }
  .card-actions button { height: 40px; }
}

/* ---------- touch and motion: the feel of the app (springs, no tap flash) ---------- */

* { -webkit-tap-highlight-color: transparent; }
button, a, .opt, .tcard, .wday, .tagpill, .datechip, .mnav-tabs, .seg, .avatar, .queue-strip { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }

:root {
  /* a spring with a small overshoot, sampled (the same feel as Reanimated damping 18 / stiffness 420) */
  --spring: linear(0, .17 4%, .5 9%, .8 15%, .98 21%, 1.06 28%, 1.07 33%, 1.04 41%, 1.01 52%, .995 66%, 1);
}

.btn, .tchip, .fchip, .toggle, .tagpill, .datechip, .opt, .wday, .round, .xbtn, .swatch, .link-more, .tcard, .hnote, .seg > a, .seg > button, .mnav-tabs a, .avatar, .queue-strip, .card-actions button {
  transition: transform .45s var(--spring), background-color .15s, border-color .15s, box-shadow .15s, filter .15s, color .15s;
}
.btn:active, .fchip:active, .toggle:active, .tagpill:active, .datechip:active, .round:active, .swatch:active, .link-more:active, .seg > a:active, .seg > button:active, .avatar:active, .queue-strip:active, .card-actions button:active {
  transform: scale(.96); transition-duration: .08s;
}
button.tchip:active, .opt:active, .wday:active, .xbtn:active, .mnav-tabs a:active { transform: scale(.95); transition-duration: .08s; }
.tcard:active, .hnote:active { transform: scale(.985); transition-duration: .08s; }

.mnav-tabs a .bar { transition: background-color .2s, transform .45s var(--spring); transform: scale(0); background: var(--yellow); }
.mnav-tabs a[aria-selected="true"] .bar { transform: scale(1); }

@keyframes view-in { from { opacity: 0; translate: 0 8px; } }
@keyframes menu-in { from { opacity: 0; scale: .96; translate: 0 -4px; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes sheet-in { from { translate: 0 40px; opacity: 0; } }
@keyframes pop-in { from { opacity: 0; scale: .94; } }
@keyframes item-in { from { opacity: 0; translate: 0 6px; } }

/* browsers with View Transitions slide the tabs themselves (see the end of this file) */
@supports not (view-transition-name: none) {
  #view-write:not([hidden]), #view-notes:not([hidden]), #view-topics:not([hidden]) { animation: view-in .22s ease-out; }
  #diary:not([hidden]), #history:not([hidden]) { animation: view-in .2s ease-out; }
}
.menu.panel, .menu.hpanel { animation: menu-in .14s ease-out; transform-origin: top right; } /* not .pop: the # and / lists re-render on every key */
.scrim { animation: fade-in .18s ease-out; }
.dialog { animation: pop-in .35s var(--spring); }
.hnote, .tcard { animation: item-in .2s ease-out backwards; } /* not the diary: it re-renders after every load */
.hnote:nth-child(2), .tcard:nth-child(2) { animation-delay: 30ms; }
.hnote:nth-child(3), .tcard:nth-child(3) { animation-delay: 60ms; }
.hnote:nth-child(n+4), .tcard:nth-child(n+4) { animation-delay: 90ms; }
.toast { animation-timing-function: var(--spring); animation-duration: .4s; }

@media (max-width: 640px) {
  .menu.panel { transform-origin: bottom center; animation: sheet-in .35s var(--spring); }
  .dialog { animation: sheet-in .4s var(--spring); }
}

/* ---------- native feel on a phone ---------- */

html { overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
body { -webkit-user-select: none; user-select: none; }
.n-text, .c-text, input, textarea, [contenteditable] { -webkit-user-select: text; user-select: text; }
a, button, input, select, textarea, label, [role="tab"], .opt, .tcard, .hnote, .wday { touch-action: manipulation; }

@media (pointer: coarse) {
  /* iOS zooms the page when a focused field has text under 16px */
  input, select, textarea { font-size: 16px !important; } /* any field, whatever rule sets its size */
}

/* a touch screen scrolls by a finger: no scrollbar and no gutter for it (Android Chrome shows one on the document) */
@media (pointer: coarse) {
  html { scrollbar-width: none; scrollbar-gutter: auto; }
  html::-webkit-scrollbar { display: none; }
}

/* iOS PWA on a phone: the page scrolls inside the body, not the document. The rubber band of the document carries the fixed
   bottom bar with it and opens a gap under it; the body's own bounce moves only the content. (No scrollbar either.) */
@media (display-mode: standalone) and (max-width: 640px) {
  @supports (-webkit-touch-callout: none) {
    html { height: 100%; overflow: hidden; scrollbar-gutter: auto; }
    body { height: 100%; min-height: 0; overflow-y: auto; overscroll-behavior: none; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    body::-webkit-scrollbar { display: none; }
  }
}

/* ---------- tab switch (View Transitions) and swipes ---------- */

.top { view-transition-name: top; }
.foot { view-transition-name: foot; }
.mnav { view-transition-name: mnav; }
.toast { view-transition-name: toast; }
.scrim { view-transition-name: scrim; }

::view-transition-old(root), ::view-transition-new(root) { animation-duration: .32s; animation-timing-function: var(--spring); mix-blend-mode: normal; }
::view-transition-old(root) { animation-name: vt-out-left; }
::view-transition-new(root) { animation-name: vt-in-right; }
[data-dir="back"]::view-transition-old(root) { animation-name: vt-out-right; }
[data-dir="back"]::view-transition-new(root) { animation-name: vt-in-left; }
@keyframes vt-out-left { to { opacity: 0; transform: translateX(-28px); } }
@keyframes vt-in-right { from { opacity: 0; transform: translateX(28px); } }
@keyframes vt-out-right { to { opacity: 0; transform: translateX(28px); } }
@keyframes vt-in-left { from { opacity: 0; transform: translateX(-28px); } }

/* iOS opens the keyboard only for focus() inside a tap. This invisible field takes the tap; the note field gets the focus after the tab switch. */
.kb-proxy { position: fixed; left: 0; top: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; font-size: 16px; pointer-events: none; }

/* the logo has a light body on the dark theme (the dark one would vanish into the background) */
:root[data-theme="dark"] .brand-icon, :root[data-theme="dark"] .dialog .icon, :root[data-theme="dark"] .empty-all img {
  content: url(assets/dayleak-icon-dark.png);
}

/* ---------- groups of notes (one theme in a row): flat unless the theme draws them as a sheet ---------- */

.hgroup, .tgroup { display: contents; counter-reset: grp; }
.hgroup > .hnote, .tgroup > .tl-item { counter-increment: grp; }
.ghead { display: none; }
.ghead::after { content: " · " counter(grp); }

/* ---------- theme picker ---------- */

.theme-list { display: flex; flex-direction: column; gap: 8px; }
.theme-opt {
  display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 0 16px 0 12px; border: 1.5px solid var(--line); border-radius: 16px;
  background: var(--surface); font-size: 15.5px; font-weight: 500; text-align: left;
}
.theme-opt .ellipsis { flex: 1; }
.theme-opt[aria-pressed="true"] { border-color: var(--ink); }
@media (hover: hover) { .theme-opt:hover { border-color: var(--line-2); } .theme-opt[aria-pressed="true"]:hover { border-color: var(--ink); } }
.theme-sw { flex: none; display: flex; width: 56px; height: 28px; border-radius: 9px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(128, 128, 128, .28); }
.theme-sw i { flex: 1; }

/* ---------- «Стопка листов»: sheets coloured by tag, a second sheet underneath, a leaf in the corner ---------- */

:root[data-theme="sheets"] {
  --bg: #F3F0EA;
  --surface: #FBFAF7;
  --sub: #E8E4DB;
  --ink: #1C1F26;
  --ink-2: #6B7079;
  --ink-3: #9A9488;
  --line: #E0DACE;
  --line-2: #CFC8B8;
  --yellow: #FDB52F;
  --yellow-soft: #FDDFA0;
  --on-yellow: #1C1F26;
  --focus: #E5A21A;
  --ring: rgba(253, 181, 47, .30);
  --cream: #F8F4E6;
  --cream-line: #EADFB8;
  --toast-bg: #1C1F26;
  --toast-ink: #F3F0EA;
  --scrim: rgba(28, 31, 38, .42);
  --tab-on: #FBFAF7;
  --tab-sh: 0 1px 3px rgba(28, 31, 38, .10);
  --word-accent: #F2A91B;
  --menu-sh: 0 16px 40px rgba(28, 31, 38, .16), 0 2px 6px rgba(28, 31, 38, .06);
  --thin: 0 1px 0 rgba(28, 31, 38, .04), 0 12px 24px -14px rgba(28, 31, 38, .25);
  --leaf: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 179 151' preserveAspectRatio='none'%3E%3Cpath d='M0 0L6 3L9 6L12 9L14 12L15 15L17 18L18 21L19 24L20 27L20 30L21 33L21 36L22 39L22 42L22 45L23 48L23 51L24 54L24 57L25 60L26 63L27 66L28 69L29 72L30 75L32 78L33 81L34 84L36 87L38 90L40 93L42 96L45 101L48 104L51 107L54 110L57 113L60 115L63 118L66 120L69 121L72 123L75 125L78 126L81 128L84 129L87 130L90 131L93 132L96 133L99 133L102 134L105 135L108 135L111 136L114 136L117 137L120 137L123 137L126 138L129 138L132 138L135 138L138 139L141 139L144 139L147 140L150 140L153 140L156 141L159 141L162 142L165 143L168 144L171 146L174 148L177 150L179 150L179 0Z'/%3E%3C/svg%3E"); /* the corner of the logo */
}
html[data-theme="sheets"] { color-scheme: light; }

/* a sheet: pastel of the tag colour; ink and the second sheet come from the same colour (--c on the element) */
:root[data-theme="sheets"] :is(.card.has-tag, .last-card.tagged, .tl-item:not(.untagged), .hnote:not(.untagged), .tcard, .hgroup, .tgroup) {
  --sheet: color-mix(in srgb, var(--c) 10%, #F3F0EA);
  --under: color-mix(in srgb, var(--c) 22%, #F3F0EA);
  --ink-s: color-mix(in srgb, var(--c) 28%, #1A1D22);
  --ink-s2: color-mix(in srgb, var(--c) 45%, #6A665C);
  position: relative;
  background: var(--sheet);
  border-color: transparent;
  box-shadow: var(--thin);
  color: var(--ink-s);
}
/* the stack (a second sheet under the card): the composer and a theme; a tag and a note have only the thin shadow */
:root[data-theme="sheets"] :is(.card.has-tag, .tcard.theme-card, :is(.hgroup, .tgroup):has(> :is(.hnote, .tl-item):nth-child(2))) { box-shadow: var(--thin), 0 20px 0 -12px var(--under); }
:root[data-theme="sheets"] .card.has-tag { --card-bd: transparent; }
:root[data-theme="sheets"] .card.has-tag:focus-within { --card-bd: transparent; box-shadow: var(--thin), 0 20px 0 -12px var(--under); }
@media (hover: hover) {
  :root[data-theme="sheets"] :is(.hnote:not(.untagged), .tcard):hover { box-shadow: var(--thin), 0 16px 28px -14px rgba(28, 31, 38, .32); }
  :root[data-theme="sheets"] .tcard.theme-card:hover { box-shadow: var(--thin), 0 20px 0 -12px var(--under); }
}

/* the leaf: the corner of the logo in the tag colour, cut by the radius of the sheet */
:root[data-theme="sheets"] :is(.card, .last-card, .tl-item, .hnote, .tcard, .hgroup, .tgroup)::after {
  content: ""; position: absolute; top: calc(-1 * var(--bw, 1px)); right: calc(-1 * var(--bw, 1px));
  width: calc(var(--leaf-w, 32px) + var(--bw, 1px)); height: calc(var(--leaf-h, 27px) + var(--bw, 1px)); pointer-events: none;
  border-top-right-radius: var(--leaf-r, 24px); background: var(--c, #FEB62E); /* no tag: the yellow of the logo */
  -webkit-mask: var(--leaf) 0 0 / 100% 100% no-repeat; mask: var(--leaf) 0 0 / 100% 100% no-repeat;
}
:root[data-theme="sheets"] .card { --bw: 1.5px; --leaf-w: 52px; --leaf-h: 44px; --leaf-r: 30px; border-radius: 30px; }
:root[data-theme="sheets"] .tcard { --leaf-w: 40px; --leaf-h: 34px; --leaf-r: 26px; border-radius: 26px; }
:root[data-theme="sheets"] :is(.last-card, .tl-item, .hnote) { --leaf-r: 24px; border-radius: 24px; }

:root[data-theme="sheets"] :is(.hgroup, .tgroup) { --leaf-r: 24px; --bw: 0px; border-radius: 24px; }

/* a group of notes is one sheet with a head; the notes lie flat on it */
:root[data-theme="sheets"] :is(.hgroup, .tgroup) { display: flex; flex-direction: column; gap: 12px; padding: 16px 20px 18px; margin-top: 12px; }
:root[data-theme="sheets"] .ghead { display: block; order: -1; font-size: 13px; font-weight: 700; color: var(--ink-s); }
:root[data-theme="sheets"] :is(.hgroup, .tgroup):has(> :is(.hnote, .tl-item):first-child:nth-last-child(2)) .ghead { display: none; }
:root[data-theme="sheets"] :is(.hgroup, .tgroup) > :is(.hnote, .tl-item) {
  margin: 0; padding: 0; border-radius: 0; background: none; box-shadow: none; border: 0; animation: none;
}
:root[data-theme="sheets"] :is(.hgroup, .tgroup) > :is(.hnote, .tl-item)::after { display: none; }
@media (hover: hover) { :root[data-theme="sheets"] :is(.hgroup, .tgroup) > .hnote:hover { box-shadow: none; } }

/* text on a sheet */
:root[data-theme="sheets"] .card.has-tag .c-text { color: var(--ink-s); }
:root[data-theme="sheets"] .card.has-tag .c-text::placeholder { color: var(--ink-s2); opacity: 1; }
:root[data-theme="sheets"] :is(.last-card, .tl-item, .hnote) :is(.time, .meta-note, .tchip) { color: var(--ink-s2); }
:root[data-theme="sheets"] :is(.last-card, .tl-item, .hnote) :is(.text, .n-text) { color: var(--ink-s); }
:root[data-theme="sheets"] .tcard .name { color: var(--ink-s); }
:root[data-theme="sheets"] .tcard :is(.count, .when, .lastt) { color: var(--ink-s2); }
:root[data-theme="sheets"] :is(.last-card, .tl-item, .hnote).is-pending { opacity: .85; }

/* chips on a sheet: the colour of the page, no frame; in a note the tag is plain text */
:root[data-theme="sheets"] :is(.card, .tcard) :is(.tchip, .tagpill) {
  background: #F3F0EA; border-color: transparent; color: var(--ink-s); font-weight: 600;
}
:root[data-theme="sheets"] :is(.last-card, .tl-item, .hnote) .tchip { height: auto; padding: 0; background: transparent; border: 0; font-weight: 500; }
:root[data-theme="sheets"] :is(.last-card, .tl-item, .hnote) .tchip .dot { display: none; }
:root[data-theme="sheets"] .tcard .tchip { height: 30px; padding: 0 12px; font-size: 13px; font-weight: 500; }
:root[data-theme="sheets"] .tcard .tchip .dot { display: none; }

/* the last note: the time and the tag in a row, then the text */
:root[data-theme="sheets"] .last-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 10px; padding: 16px 20px 18px; }
:root[data-theme="sheets"] .last-card .body { display: contents; }
:root[data-theme="sheets"] .last-card .time { grid-area: 1 / 1; line-height: 18px; font-size: 12px; }
:root[data-theme="sheets"] .last-card .meta { grid-area: 1 / 2; font-size: 12.5px; }
:root[data-theme="sheets"] .last-card .text { grid-area: 2 / 1 / 3 / 3; line-height: 1.45; }
:root[data-theme="sheets"] .last-card:not(.tagged) { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--thin); }
:root[data-theme="sheets"] .last-head { padding: 0 12px; }
:root[data-theme="sheets"] .last-title {
  flex: 1; display: flex; align-items: center; gap: 12px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3);
}
:root[data-theme="sheets"] .last-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
:root[data-theme="sheets"] .last-head .link-more { margin-left: 12px; }

/* the diary and the history: a stack of sheets, no timeline */
:root[data-theme="sheets"] .timeline { padding-left: 0; gap: 14px; }
:root[data-theme="sheets"] .timeline::before, :root[data-theme="sheets"] .tl-item::before { display: none; }
:root[data-theme="sheets"] .tl-item { grid-template-columns: 46px minmax(0, 1fr); padding: 16px 20px 18px; background-clip: padding-box; }
:root[data-theme="sheets"] .hnote { margin-top: 12px; padding: 14px 16px 16px 20px; }
:root[data-theme="sheets"] .tl-item.untagged, :root[data-theme="sheets"] .hnote.untagged { background: var(--surface); border: 1px solid var(--line); box-shadow: 0 1px 0 rgba(28, 31, 38, .04), 0 12px 24px -14px rgba(28, 31, 38, .25); }
:root[data-theme="sheets"] .group-head { padding: 20px 12px 2px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
:root[data-theme="sheets"] .group-head b { font-size: 12px; font-weight: 600; }

/* header, filters, buttons, navigation */
:root[data-theme="sheets"] .avatar { background: var(--ink); color: var(--bg); }
:root[data-theme="sheets"] .fchip { height: 38px; font-weight: 600; }
:root[data-theme="sheets"] .fchip:not(.plain) { border-color: transparent; background: color-mix(in srgb, var(--c, #1C1F26) 14%, #F3F0EA); color: var(--ink); }
:root[data-theme="sheets"] .fchip:not(.plain)[aria-pressed="true"] { background: color-mix(in srgb, var(--c, #1C1F26) 32%, #F3F0EA); }
:root[data-theme="sheets"] .set-new { border: 0; background: var(--ink); color: var(--bg); font-weight: 600; }
@media (hover: hover) { :root[data-theme="sheets"] .set-new:hover { color: var(--bg); filter: brightness(1.2); } }
:root[data-theme="sheets"] .btn-yellow { font-weight: 700; }
:root[data-theme="sheets"] .search > input, :root[data-theme="sheets"] .pill-in { border-color: transparent; background: var(--surface); box-shadow: 0 1px 0 rgba(28, 31, 38, .04), 0 12px 24px -14px rgba(28, 31, 38, .25); }
:root[data-theme="sheets"] .mday.sel, :root[data-theme="sheets"] .wday.sel { box-shadow: 0 6px 14px -6px rgba(253, 181, 47, .8); }
:root[data-theme="sheets"] .mnav-tabs a .bar { width: 18px; height: 5px; border-radius: 3px; }
:root[data-theme="sheets"] .mnav-tabs a { gap: 7px; font-size: 14px; font-weight: 500; color: #A39C8C; }
:root[data-theme="sheets"] .mnav-tabs a[aria-selected="true"] { font-weight: 700; color: var(--ink); }

/* themes screen: a large title, a theme sheet shows a chain and «Начать», not the last note */
:root[data-theme="sheets"] .tcard { padding: 18px 20px; gap: 14px; }
:root[data-theme="sheets"] .tcard .lastt { display: none; }
:root[data-theme="sheets"] .tcard .name { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
:root[data-theme="sheets"] .tcard .dot { display: none; }
:root[data-theme="sheets"] .tcard .fresh { background: #F3F0EA; color: var(--ink-s2); }
:root[data-theme="sheets"] .card-actions button { color: var(--ink-s2); font-weight: 500; }
:root[data-theme="sheets"] .card-actions button.play { height: 40px; padding: 0 18px; border-radius: 999px; background: var(--yellow); color: var(--on-yellow); font-weight: 700; }
:root[data-theme="sheets"] .sec-title b { font-size: 30px; font-weight: 700; letter-spacing: -0.035em; }
:root[data-theme="sheets"] .set-new { height: 40px; padding: 0 16px; font-size: 14px; }
:root[data-theme="sheets"] .tgrid { gap: 20px; }

/* chain mode: a bar of steps in the colour of the theme */
:root[data-theme="sheets"] .chain-m-bars { gap: 5px; }
:root[data-theme="sheets"] .chain-m-bars span { height: 5px; border-radius: 3px; background: #DCD5C8; }
:root[data-theme="sheets"] .chain-m-bars span.on { background: var(--c); }
:root[data-theme="sheets"] .chain-m-name { font-size: 16px; font-weight: 700; }
:root[data-theme="sheets"] .chain-m-step { font-size: 14px; color: var(--ink-3); }
:root[data-theme="sheets"] .chain-m .chain-btn { color: #6E6759; font-weight: 500; }
:root[data-theme="sheets"] .step.cur { background: color-mix(in srgb, var(--c) 18%, #F3F0EA); }

@media (max-width: 640px) {
  /* the header: the logo and the avatar, as in the design */
  :root[data-theme="sheets"] .top-in { padding: 24px 26px 0; }
  :root[data-theme="sheets"] .brand-word { display: none; }
  :root[data-theme="sheets"] .user .avatar { width: 36px; height: 36px; font-size: 13px; }
  :root[data-theme="sheets"] .theme-btn { width: 40px; height: 40px; }
  :root[data-theme="sheets"] .mnav { background: linear-gradient(rgba(243, 240, 234, 0), #F3F0EA 40%); }
  :root[data-theme="sheets"] .mnav-tabs { padding: 14px 40px calc(14px + env(safe-area-inset-bottom, 0px)); }

  /* write: the card at the top, the last note under its label */
  :root[data-theme="sheets"] .view-write { justify-content: flex-start; padding-top: 22px; }
  :root[data-theme="sheets"] .write-in { gap: 36px; }
  :root[data-theme="sheets"] .card { min-height: 0; padding: 24px 22px 16px; margin-bottom: 8px; box-shadow: var(--thin); }
  :root[data-theme="sheets"] .card.has-tag { box-shadow: var(--thin), 0 20px 0 -12px var(--under); }
  :root[data-theme="sheets"] .c-text { font-size: 18px; font-weight: 500; min-height: 74px; padding-right: 44px; }
  :root[data-theme="sheets"] .c-bottom { margin-top: 0; }
  :root[data-theme="sheets"] .c-bottom .btn { height: 46px; padding: 0 22px; font-weight: 700; }
  :root[data-theme="sheets"] .tagpill { height: 38px; font-weight: 600; }
  :root[data-theme="sheets"] .last-card { padding: 16px 20px 18px; }
  :root[data-theme="sheets"] .tl-item { padding: 16px 20px 18px; }
  :root[data-theme="sheets"] .timeline { gap: 14px; }

  /* the diary: a large date on the left of the header, the switch on the right, no title */
  :root[data-theme="sheets"] .day-rel, :root[data-theme="sheets"] .day-title { display: none; }
  :root[data-theme="sheets"] .notes-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; padding: 0 2px 0 12px; }
  :root[data-theme="sheets"] .notes-head .seg > a svg { display: none; }
  :root[data-theme="sheets"] .notes-head .seg { grid-column: auto; margin-left: auto; }
  :root[data-theme="sheets"] .notes-head:has([data-mode="history"][aria-selected="true"]) .head-date { display: none; }
  :root[data-theme="sheets"] .head-date { display: flex; align-items: flex-end; gap: 10px; min-width: 0; white-space: nowrap; }
  :root[data-theme="sheets"] .notes-head .seg > a { padding: 0 12px; font-size: 13.5px; }
  :root[data-theme="sheets"] .head-date b { font-size: 72px; font-weight: 300; letter-spacing: -0.06em; line-height: .8; }
  :root[data-theme="sheets"] .head-date > span { display: flex; flex-direction: column; gap: 2px; padding-bottom: 2px; font-size: 15px; line-height: 1.25; }
  :root[data-theme="sheets"] .head-date > span > span:first-child { font-weight: 600; }
  :root[data-theme="sheets"] .head-date > span > span:last-child { color: var(--ink-3); }
  :root[data-theme="sheets"] .day-tools .round { display: none; }
  :root[data-theme="sheets"] .wday { height: 62px; border-radius: 20px; }
  :root[data-theme="sheets"] .wday b { font-weight: 700; }
}

/* the composer: no frame (not even on focus); the tag button sits at the bottom, left of the date and «Добавить» */
:root[data-theme="sheets"] .card, :root[data-theme="sheets"] .card:focus-within { --card-bd: transparent; border-color: transparent; }
:root[data-theme="sheets"] .card:focus-within:not(.has-tag) { box-shadow: var(--thin); }
:root[data-theme="sheets"] .card {
  display: grid; grid-template-columns: auto auto 1fr auto; grid-template-rows: auto auto minmax(0, 1fr) auto; align-items: center;
}
:root[data-theme="sheets"] .card > :is(.c-row, .c-bottom) { display: contents; }
:root[data-theme="sheets"] .card > :not(.c-row):not(.c-bottom) { grid-column: 1 / -1; }
:root[data-theme="sheets"] .card > :first-child { grid-row: 1; }
:root[data-theme="sheets"] .card > :nth-child(2) { grid-row: 2; }
:root[data-theme="sheets"] .c-field { grid-column: 1 / -1; grid-row: 3; align-self: stretch; }
:root[data-theme="sheets"] .c-side { grid-column: 1; grid-row: 4; margin-top: 16px; }
:root[data-theme="sheets"] .c-bottom > :first-child { grid-column: 2; grid-row: 4; margin: 16px 0 0 10px; }
:root[data-theme="sheets"] .c-bottom > :first-child:empty { display: none; }
:root[data-theme="sheets"] .c-bottom > .grow { grid-column: 3; grid-row: 4; }
:root[data-theme="sheets"] .c-bottom > .btn { grid-column: 4; grid-row: 4; margin-top: 16px; }
@media (min-width: 641px) {
  :root[data-theme="sheets"] .card { min-height: 240px; }
  :root[data-theme="sheets"] .menu.panel { right: auto; left: 0; top: auto; bottom: calc(100% + 6px); transform-origin: bottom left; }
}

/* the diary: no «Все» chip (a second tap on the chosen theme shows everything again) */
:root[data-theme="sheets"] .fchip.plain { display: none; }

/* every sheet is the anchor of its leaf (an untagged one has no other rule that sets it) */
:root[data-theme="sheets"] :is(.card, .last-card, .tl-item, .hnote, .tcard, .hgroup, .tgroup) { position: relative; }
:root[data-theme="sheets"] .tcard.theme-card { --bw: 1.5px; }
@media (max-width: 640px) { :root[data-theme="sheets"] .tl-item { --bw: 0px; } }

/* the themes screen as in the design: «Спорт 78 заметок», the tags, «Цепочка · 3 шага» and «Начать» */
:root[data-theme="sheets"] .sec-head { padding: 0 12px; }
:root[data-theme="sheets"] .tcard .row { align-items: baseline; gap: 10px; }
:root[data-theme="sheets"] .tcard .name { flex: none; max-width: 70%; }
:root[data-theme="sheets"] .tcard .count { display: inline; order: 2; font: 500 13px var(--font); color: var(--ink-s2); }
:root[data-theme="sheets"] .tcard .count::after { content: " " attr(data-w); }
:root[data-theme="sheets"] .tcard .fresh { order: 3; margin-left: auto; align-self: center; }
:root[data-theme="sheets"] .tcard.theme-card .when > span:not(.w-chain) { display: none; }
:root[data-theme="sheets"] .tcard.theme-card .when > .w-chain { display: inline-block; font-size: 13px; font-weight: 500; }
:root[data-theme="sheets"] .tcard.theme-card .when > .w-chain::before { content: none; }
:root[data-theme="sheets"] .tcard.theme-card .when > .w-chain::first-letter { text-transform: uppercase; }
:root[data-theme="sheets"] .tcard .card-foot { min-height: 40px; }
:root[data-theme="sheets"] .tcard:not(.theme-card) .when { display: none; }
:root[data-theme="sheets"] .tcard:not(.theme-card) .card-foot { justify-content: flex-end; min-height: 32px; }

/* «Изменить» is a small pencil */
:root[data-theme="sheets"] .card-actions button.edit { width: 36px; height: 36px; padding: 0; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
:root[data-theme="sheets"] .card-actions button.edit .lbl { display: none; }
:root[data-theme="sheets"] .card-actions button.edit svg { display: block; }

/* the diary: no theme filter; a note shows the time and the tag on top, the text below */
:root[data-theme="sheets"] .diary > .chips { display: none; }
:root[data-theme="sheets"] .tl-item { grid-template-columns: auto minmax(0, 1fr); gap: 6px 10px; }
:root[data-theme="sheets"] .tl-item .body { display: contents; }
:root[data-theme="sheets"] .tl-item .time { grid-area: 1 / 1; line-height: 18px; font-size: 12px; }
:root[data-theme="sheets"] .tl-item .meta { grid-area: 1 / 2; font-size: 12.5px; }
:root[data-theme="sheets"] .tl-item .n-text { grid-area: 2 / 1 / 3 / 3; line-height: 1.45; }
:root[data-theme="sheets"] .timeline { gap: 18px; }

/* a card of a theme or a tag: the pencil sits in the first row, left of the leaf, not on a row of its own */
:root[data-theme="sheets"] .tcard { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px 0; align-items: center; }
:root[data-theme="sheets"] .tcard :is(.card-foot, .card-actions) { display: contents; }
:root[data-theme="sheets"] .tcard .row { grid-column: 1; grid-row: 1; }
:root[data-theme="sheets"] .tcard .theme-tags { grid-column: 1 / -1; grid-row: 2; }
:root[data-theme="sheets"] .tcard .when { grid-column: 1; grid-row: 3; }
:root[data-theme="sheets"] .tcard .card-actions button.play { grid-column: 2; grid-row: 3; justify-self: end; }
:root[data-theme="sheets"] .tcard .card-actions button.edit { grid-column: 2; grid-row: 1; justify-self: end; margin-right: 34px; }
:root[data-theme="sheets"] .tcard.theme-card .card-foot { min-height: 0; }
