:root {
  --bg: #FBF7EF; --surface: #FFFFFF; --side: #F4EDE1; --text: #2A2118; --muted: #7A6A58;
  --line: #EADFCF; --accent: #8A5A2B; --accent-soft: #F1E2CC; --error: #B3261E; --flash: #FFF3DC;
  --radius: 12px; color-scheme: light;
}
/* Dark: chosen (data-theme), or following the system when nothing is chosen. */
:root[data-theme=dark], :root[data-theme=black] {
  --bg: #15120F; --surface: #1E1A16; --side: #1A1613; --text: #EFE7DB; --muted: #A99A88;
  --line: #2E2721; --accent: #D9A86C; --accent-soft: #3A2C1E; --error: #F2B8B5; --flash: #33291C;
  color-scheme: dark;
}
:root[data-theme=black] { --bg: #000000; --surface: #0D0C0B; --side: #080706; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]), :root[data-theme=system] {
    --bg: #15120F; --surface: #1E1A16; --side: #1A1613; --text: #EFE7DB; --muted: #A99A88;
    --line: #2E2721; --accent: #D9A86C; --accent-soft: #3A2C1E; --error: #F2B8B5; --flash: #33291C;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 Inter, system-ui, sans-serif; }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.error { color: var(--error); }
.link { background: none; border: 0; color: var(--accent); padding: 4px 0; }
.primary { background: var(--accent); color: var(--bg); border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 600; }
.ghost { background: none; color: var(--accent); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; font-weight: 600; }
.upgrade { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 6px; }
.upgrade .primary span { font-weight: 400; opacity: 0.8; margin-left: 4px; }
.fine { color: var(--muted); font-size: 12.5px; line-height: 1.45; margin: 4px 0 10px; }

/* Sign in */
.signin { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.signin-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 28px; text-align: center; }
.signin-card h1 { font-family: Newsreader, serif; font-size: 2rem; margin: 10px 0 4px; }
.signin-card form { display: grid; gap: 10px; margin-top: 12px; text-align: left; }
.signin-card input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }

/* Layout */
.app { display: grid; grid-template-columns: 288px 1fr; height: 100vh; height: 100dvh; overflow: hidden; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 1.15rem; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar input { width: min(260px, 40vw); padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.icon { background: none; border: 0; font-size: 20px; padding: 4px 8px; color: inherit; }
.menu { display: none; }
.notice { margin: 10px 20px 0; padding: 10px 14px; border-radius: 10px; background: var(--accent-soft); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 20px 0; }
.tags button { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 2px 9px; font-size: 13px; }
.tags button.on { outline: 2px solid currentColor; }

/* Timeline */
.timeline { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 0 12px; }
.day { color: var(--accent); font-weight: 600; font-size: 13px; padding: 16px 20px 4px; }
.entry { display: grid; grid-template-columns: 84px 1fr auto; gap: 12px; padding: 5px 20px; align-items: start; }
.entry:hover { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.entry.flash { background: var(--flash); }
.entry .time { color: var(--muted); font-size: 13px; padding-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.entry .text { white-space: pre-wrap; word-break: break-word; }
.entry .text.blank { color: var(--muted); font-style: italic; cursor: text; }
.entry .by { display: block; font-size: 12px; color: var(--muted); }
.entry .side { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.entry .actions { display: none; gap: 2px; }
.entry:hover .actions, .entry.editing .actions { display: flex; }
.entry .actions button { background: none; border: 0; color: var(--muted); padding: 0 4px; font-size: 14px; }
.entry img { display: block; margin-top: 6px; max-width: 220px; max-height: 160px; border-radius: 8px; object-fit: cover; background: var(--line); }
.entry textarea { width: 100%; resize: none; border: 1px solid var(--accent); border-radius: 8px; padding: 4px 8px; background: var(--surface); }
.tag { border-radius: 4px; padding: 0 3px; cursor: pointer; }
.heading { color: var(--accent); font-weight: 600; }
.empty { color: var(--muted); padding: 40px 20px; text-align: center; }

/* Composer */
.composer { display: grid; grid-template-columns: 84px 1fr auto; gap: 12px; align-items: end; padding: 12px 20px 16px; border-top: 1px solid var(--line); background: var(--bg); }
.now-time { color: var(--muted); font-size: 13px; padding-bottom: 8px; font-variant-numeric: tabular-nums; }
.composer textarea { resize: none; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: var(--surface); max-height: 200px; }
.composer textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.send { background: var(--accent); color: var(--bg); border: 0; border-radius: 10px; padding: 8px 14px; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--text); color: var(--bg); border-radius: 10px; padding: 10px 16px; display: flex; gap: 16px; align-items: center; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast .link { color: var(--accent-soft); font-weight: 600; }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(288px, 85vw); z-index: 10; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .menu { display: block; }
  .topbar input { width: 38vw; }
  .entry, .composer { grid-template-columns: 64px 1fr auto; gap: 8px; padding-left: 14px; padding-right: 14px; }
}

/* ---- More: spaces, folders, pictures, time, Ask, dialogs ---- */
.icon.small { font-size: 16px; padding: 4px 6px; border-radius: 8px; }
.icon.small:hover { background: var(--accent-soft); }
.pill { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }
.ask-button { background: none; border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 6px 10px; display: flex; gap: 6px; align-items: center; }
.ask-button:hover { background: var(--accent-soft); }
.composer { grid-template-columns: 84px 1fr auto; }
.readonly { display: flex; gap: 12px; align-items: center; padding: 12px 20px 16px; border-top: 1px solid var(--line); background: var(--accent-soft); font-size: 14px; line-height: 1.45; }
.readonly[hidden] { display: none; }
.hint { display: flex; gap: 14px; align-items: center; margin: 0 20px 8px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 14px; line-height: 1.45; }
.hint[hidden] { display: none; }
.hint .grow { flex: 1; min-width: 0; }
.hint .link { white-space: nowrap; font-weight: 600; text-decoration: none; }
.hint [data-hint-close] { color: var(--muted); font-weight: 400; }
@media (max-width: 600px) { .hint { flex-wrap: wrap; margin: 0 12px 8px; } .hint .grow { flex-basis: 100%; } }
.readonly .grow { flex: 1; min-width: 0; }
.readonly #readonly-move { white-space: nowrap; font-weight: 600; }
.readonly #readonly-move:disabled { font-weight: 400; color: var(--muted); }
@media (max-width: 600px) { .readonly { flex-direction: column; align-items: flex-start; } }
.readonly-pro { display: block; color: var(--muted); margin-top: 2px; }
.composer-tools { display: flex; gap: 6px; align-items: center; }
.now-time { background: none; border: 0; text-align: left; padding: 0 0 8px; }
.now-time.set { color: var(--accent); font-weight: 600; }
.attachment { display: flex; align-items: center; gap: 12px; padding: 8px 20px 0 116px; }
.attachment img { max-height: 90px; max-width: 160px; border-radius: 8px; }
.entry .time { cursor: default; }

.app.asking { grid-template-columns: 288px 1fr 380px; }
.ask { border-left: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-height: 0; height: 100%; }
.ask header { display: flex; justify-content: space-between; align-items: flex-start; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.ask-scope { display: flex; gap: 12px; font-size: 13px; color: var(--muted); margin-top: 4px; }
.ask-turns { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 16px; }
.turn { padding: 10px 0; border-bottom: 1px solid var(--line); }
.turn .q { font-weight: 600; margin-bottom: 4px; }
.turn .a { white-space: pre-wrap; }
.turn .err { color: var(--error); }
.turn .cites { margin-top: 8px; display: grid; gap: 2px; }
.turn .cites button { text-align: left; background: var(--bg); border: 0; border-radius: 6px; padding: 5px 8px; color: var(--text); font-size: 13px; display: flex; gap: 8px; }
.turn .cites button:hover { background: var(--accent-soft); }
.turn .cites .when { color: var(--muted); white-space: nowrap; }
.turn .actions { margin-top: 6px; display: flex; gap: 12px; }
.ask-summary { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 16px; border-top: 1px solid var(--line); font-size: 13px; }
.ask-summary select, .ask-form input, dialog input, dialog select { border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; background: var(--bg); }
.ask-form { display: flex; gap: 8px; padding: 8px 16px; }
.ask-form input { flex: 1; }
.small { font-size: 12px; padding: 0 16px 12px; margin: 0; }
.thinking { color: var(--muted); font-style: italic; }

dialog { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text); padding: 0; width: min(440px, 92vw); }
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog form { padding: 20px; display: grid; gap: 12px; }
dialog h2 { margin: 0; font-size: 1.15rem; }
dialog .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
dialog .buttons { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
dialog .list { display: grid; gap: 4px; max-height: 280px; overflow: auto; }
dialog code { background: var(--bg); padding: 6px 8px; border-radius: 8px; word-break: break-all; }
dialog .danger { color: var(--error); }

@media (max-width: 1100px) {
  .app.asking { grid-template-columns: 288px 1fr; }
  .ask { position: fixed; inset: 0 0 0 auto; width: min(420px, 100vw); z-index: 20; box-shadow: -10px 0 40px rgba(0,0,0,.25); }
}
@media (max-width: 760px) {
  .app.asking { grid-template-columns: 1fr; }
  .attachment { padding-left: 14px; }
  .ask-button { padding: 6px 8px; }
}

.tally { padding: 6px 20px 0; font-size: 13px; color: var(--muted); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tally strong { color: var(--text); }
.tally .running { color: var(--accent); font-weight: 600; }

/* ---- Settings page ---- */
.settings { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 20px 40px; }
.settings .inner { max-width: 680px; margin: 0 auto; }
.settings h2 { font-size: 13px; font-weight: 600; color: var(--muted); margin: 26px 12px 8px; }
.group { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.srow { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-top: 1px solid var(--line); }
.srow:first-child { border-top: 0; }
.srow .grow { flex: 1; min-width: 0; }
.srow .sub { color: var(--muted); font-size: 13px; }
.srow input[type=text], .srow select { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; background: var(--bg); }
.srow .value { color: var(--muted); }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.foot { color: var(--muted); font-size: 12px; margin: 8px 12px 0; }
.switch { appearance: none; width: 40px; height: 24px; border-radius: 12px; background: var(--line); position: relative; cursor: pointer; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.switch:checked { background: var(--accent); }
.switch:checked::after { left: 19px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 2px 4px 2px 9px; background: var(--bg); }
.chip button { background: none; border: 0; color: var(--muted); padding: 0 4px; }
.tagcolors { display: grid; gap: 6px; padding: 14px 16px; max-height: 320px; overflow: auto; }
.tagcolor { display: flex; align-items: center; gap: 10px; }
.tagcolor .name { min-width: 120px; font-weight: 500; }
.swatches { display: flex; flex-wrap: wrap; gap: 4px; }
.swatch { width: 20px; height: 20px; border-radius: 50%; border: 2px solid transparent; padding: 0; }
.swatch.on { border-color: var(--text); }
.danger-text { color: var(--error); }

/* Behind the sliding sidebar on narrow screens: a click anywhere outside closes it. */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 9; }
@media (min-width: 761px) { .scrim { display: none !important; } }

/* ---- Drawer: the phone's LogDrawer, row for row ---- */
:root { --side-high: color-mix(in srgb, var(--text) 7%, var(--side)); --sel: color-mix(in srgb, var(--accent) 10%, transparent); }
.sidebar { background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.sidebar svg { width: 18px; height: 18px; flex: none; fill: currentColor; }
.sidebar svg.i20 { width: 20px; height: 20px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 0; font-size: 16px; font-weight: 500; }
.brand-tile { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: var(--bg); display: grid; place-items: center; }
.brand-tile svg { width: 22px; height: 22px; }
.search-all { display: flex; align-items: center; gap: 10px; margin: 12px 12px 0; height: 40px; padding: 0 12px; border: 0; border-radius: 8px; background: var(--side-high); color: var(--muted); font-size: 14px; text-align: left; }
.search-all:hover, .search-all.current { color: var(--text); }
.section-head { display: flex; align-items: center; padding: 4px 8px 0 20px; }
.section-label { flex: 1; font-size: 11px; font-weight: 500; letter-spacing: 1.5px; color: var(--muted); text-align: left; }
.row-icon { width: 36px; height: 36px; display: grid; place-items: center; flex: none; background: none; border: 0; border-radius: 50%; color: var(--muted); padding: 0; }
.row-icon:hover { background: var(--side-high); }
.logs { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.drawer-row { display: flex; align-items: center; width: 100%; color: var(--muted); text-decoration: none; position: relative; cursor: pointer; user-select: none; }
.drawer-row:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.drawer-row.menu-open, .drawer-action.menu-open { background: var(--side-high); }
.drawer-row .name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.drawer-row .more { color: color-mix(in srgb, var(--muted) 55%, transparent); margin-right: 8px; }
.drawer-row .more svg { width: 18px; height: 18px; }
.log-row { height: 44px; }
.log-row .lead { margin-left: calc(20px + var(--depth) * 16px); }
.log-row .name { margin-left: 12px; }
.log-row .count { font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; color: color-mix(in srgb, var(--muted) 70%, transparent); padding: 0 4px; }
.log-row.selected { background: var(--sel); }
.log-row.selected::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; background: var(--accent); }
.log-row.selected .lead { color: var(--accent); }
.log-row.selected .name { color: var(--text); font-weight: 600; }
.log-row.archived .lead { opacity: .6; }
.log-row.archived .name { opacity: .7; }
.folder-row { height: 40px; }
.folder-row .chevron { width: 16px; height: 16px; margin-left: calc(11px + var(--depth) * 16px); opacity: .7; transition: transform .15s; }
.folder-row.open .chevron { transform: rotate(90deg); }
.folder-row .folder-icon { margin-left: 4px; }
.folder-row .name { margin-left: 12px; margin-right: 4px; font-weight: 500; }
.empty-folder { margin: 0; padding: 6px 0 10px calc(39px + var(--depth) * 16px); font-size: 13px; color: color-mix(in srgb, var(--muted) 60%, transparent); }
.name-row { height: 44px; background: var(--side-high); cursor: default; }
.name-row .lead { margin-left: calc(17px + var(--depth) * 16px); }
.name-row input { flex: 1; min-width: 0; margin-left: 12px; border: 0; outline: 0; background: none; color: var(--text); font-size: 15px; }
.name-row .row-icon { color: var(--accent); margin-right: 8px; }
.confirm-row { min-height: 44px; cursor: default; padding-right: 4px; }
.confirm-row > div { flex: 1; min-width: 0; padding: 6px 0 6px calc(17px + var(--depth) * 16px); }
.confirm-title { color: var(--error); font-size: 14px; }
.confirm-detail { font-size: 12px; color: var(--muted); }
.text-button { background: none; border: 0; color: var(--accent); font-weight: 500; font-size: 14px; padding: 8px; border-radius: 18px; }
.text-button.danger { color: var(--error); }
.drawer-action { display: flex; align-items: center; gap: 12px; width: 100%; height: 44px; padding: 0 20px; flex: none; background: none; border: 0; color: var(--muted); font-size: 14px; text-align: left; }
.drawer-action:hover, .drawer-action.current { background: color-mix(in srgb, var(--text) 4%, transparent); }
.drawer-action .label { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-action .label.strong { flex: 1; color: var(--text); }
.drawer-action .badge, .pop .badge { font-size: 11px; font-weight: 500; padding: 1px 6px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); margin-left: -4px; }
.archive { flex: none; }
.archive-head { display: flex; align-items: center; width: 100%; height: 40px; padding: 0 20px; background: none; border: 0; color: var(--muted); }
.archive-head .chevron { transition: transform .15s; }
.archive-head.open .chevron { transform: rotate(180deg); }
.archive-list { max-height: 220px; overflow-y: auto; }
.drawer-bottom { flex: none; border-top: 1px solid color-mix(in srgb, var(--line) 80%, transparent); padding-bottom: 8px; }
.drawer-bottom #space-switch { color: var(--muted); }

/* Row menus (CompactMenu.kt) */
.pop { position: fixed; z-index: 30; min-width: 180px; padding: 4px 0; background: var(--side-high); border: .5px solid var(--line); border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.pop button { display: flex; align-items: center; gap: 12px; width: 100%; height: 36px; padding: 0 20px 0 12px; background: none; border: 0; color: var(--text); font-size: 14px; text-align: left; white-space: nowrap; }
.pop button:hover, .pop button:focus-visible { background: color-mix(in srgb, var(--text) 6%, transparent); outline: 0; }
.pop button span:first-of-type { flex: 1; }
.pop svg { width: 16px; height: 16px; fill: currentColor; color: var(--muted); flex: none; }
.pop svg.check { color: var(--accent); }
.pop .danger, .pop .danger svg { color: var(--error); }
.pop hr { border: 0; border-top: 1px solid color-mix(in srgb, var(--muted) 25%, transparent); margin: 4px 0; }

/* Icon picker, Move to…, Properties */
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 4px; }
.icon-grid button { height: 44px; display: grid; place-items: center; background: none; border: 0; border-radius: 10px; color: var(--muted); }
.icon-grid button:hover { background: var(--accent-soft); }
.icon-grid button.on { background: var(--accent-soft); color: var(--accent); outline: 2px solid var(--accent); }
.icon-grid svg, .move-list svg, .result-log svg { width: 22px; height: 22px; fill: currentColor; }
.move-list { display: grid; max-height: 400px; overflow: auto; margin: 0 -20px; }
.move-list button { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 20px 0 calc(20px + var(--depth) * 16px); background: none; border: 0; color: var(--text); text-align: left; }
.move-list button span:first-of-type { flex: 1; }
.move-list button:hover:not(:disabled) { background: var(--accent-soft); }
.move-list button:disabled { color: var(--muted); cursor: default; }
.move-list svg { width: 18px; height: 18px; color: var(--muted); }
.props { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
.props dt { color: var(--muted); }
.props dd { margin: 0; user-select: text; word-break: break-word; }
.props dd.mono { font-family: ui-monospace, monospace; font-size: 12px; }
.danger-fill { background: var(--error); }

/* Search all logs */
.result-log { display: flex; align-items: center; gap: 10px; padding: 16px 20px 4px; font-weight: 600; font-size: 14px; }
.result-log svg { width: 18px; height: 18px; color: var(--accent); }
.result-log.archived { opacity: .7; }
.result { display: grid; gap: 2px; width: 100%; padding: 6px 20px 6px 48px; background: none; border: 0; color: var(--text); text-align: left; }
.result:hover { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.result .when { color: var(--muted); font-size: 12px; }
.result .text { white-space: pre-wrap; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---- Colour palettes, from the app (Palettes.kt). Paper is the default above. ---- */
:root[data-palette=classic] { --bg: #FEF7FF; --surface: #FFFFFF; --side: #F6EFF7; --text: #1D1B20; --muted: #49454F; --line: #D9D2DB; --accent: #6750A4; --accent-soft: #EADDFF; --flash: #F4EAFF; }
:root[data-palette=classic][data-theme=dark], :root[data-palette=classic][data-theme=black] { --bg: #141218; --surface: #211F26; --side: #1C1A21; --text: #E6E0E9; --muted: #CAC4D0; --line: #38353C; --accent: #D0BCFF; --accent-soft: #402E6E; --flash: #322452; }
:root[data-palette=classic][data-theme=black] { --bg: #000000; --side: #0E0D10; --surface: #141317; }
@media (prefers-color-scheme: dark) { :root[data-palette=classic]:not([data-theme]), :root[data-palette=classic][data-theme=system] { --bg: #141218; --surface: #211F26; --side: #1C1A21; --text: #E6E0E9; --muted: #CAC4D0; --line: #38353C; --accent: #D0BCFF; --accent-soft: #402E6E; --flash: #322452; } }
:root[data-palette=ocean] { --bg: #F7FAFC; --surface: #FFFFFF; --side: #EEF2F4; --text: #171C20; --muted: #41484D; --line: #D1D6D9; --accent: #00658E; --accent-soft: #C7E7FF; --flash: #DFF0FE; }
:root[data-palette=ocean][data-theme=dark], :root[data-palette=ocean][data-theme=black] { --bg: #0F1417; --surface: #1B2125; --side: #161C1F; --text: #DEE3E7; --muted: #C1C7CE; --line: #32373B; --accent: #85CFFF; --accent-soft: #043E57; --flash: #083042; }
:root[data-palette=ocean][data-theme=black] { --bg: #000000; --side: #0B0E10; --surface: #101416; }
@media (prefers-color-scheme: dark) { :root[data-palette=ocean]:not([data-theme]), :root[data-palette=ocean][data-theme=system] { --bg: #0F1417; --surface: #1B2125; --side: #161C1F; --text: #DEE3E7; --muted: #C1C7CE; --line: #32373B; --accent: #85CFFF; --accent-soft: #043E57; --flash: #083042; } }
:root[data-palette=forest] { --bg: #F8FAF3; --surface: #FFFFFF; --side: #F0F2EB; --text: #1A1C18; --muted: #424940; --line: #D2D6CE; --accent: #3B6939; --accent-soft: #BCF0B4; --flash: #DAF5D4; }
:root[data-palette=forest][data-theme=dark], :root[data-palette=forest][data-theme=black] { --bg: #11140F; --surface: #1E211B; --side: #191C16; --text: #E1E4DB; --muted: #C2C9BD; --line: #333831; --accent: #A1D39A; --accent-soft: #1E411F; --flash: #1A321A; }
:root[data-palette=forest][data-theme=black] { --bg: #000000; --side: #0C0E0B; --surface: #121410; }
@media (prefers-color-scheme: dark) { :root[data-palette=forest]:not([data-theme]), :root[data-palette=forest][data-theme=system] { --bg: #11140F; --surface: #1E211B; --side: #191C16; --text: #E1E4DB; --muted: #C2C9BD; --line: #333831; --accent: #A1D39A; --accent-soft: #1E411F; --flash: #1A321A; } }
:root[data-palette=rose] { --bg: #FFF8F7; --surface: #FFFFFF; --side: #F7F0EF; --text: #231918; --muted: #524343; --line: #DDD3D2; --accent: #9C4146; --accent-soft: #FFDADA; --flash: #FFE9E8; }
:root[data-palette=rose][data-theme=dark], :root[data-palette=rose][data-theme=black] { --bg: #1A1111; --surface: #281E1E; --side: #231919; --text: #F0DEDD; --muted: #D7C1C1; --line: #403333; --accent: #FFB3B4; --accent-soft: #652429; --flash: #4C1E21; }
:root[data-palette=rose][data-theme=black] { --bg: #000000; --side: #120C0C; --surface: #181212; }
@media (prefers-color-scheme: dark) { :root[data-palette=rose]:not([data-theme]), :root[data-palette=rose][data-theme=system] { --bg: #1A1111; --surface: #281E1E; --side: #231919; --text: #F0DEDD; --muted: #D7C1C1; --line: #403333; --accent: #FFB3B4; --accent-soft: #652429; --flash: #4C1E21; } }

/* Dictation, tag suggestions, sharing, pictures */
.mic svg, .share-button svg { width: 20px; height: 20px; fill: currentColor; display: block; }
.mic { color: var(--muted); border-radius: 50%; }
.mic.listening { color: var(--bg); background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 25%, transparent); } }
#draft.tidying { color: var(--muted); }
.share-button { color: var(--muted); }
.suggest { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 20px 0 116px; background: var(--bg); }
.suggest button { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 2px 9px; font-size: 13px; }
.suggest button.first { border-color: currentColor; }
.suggest .hint { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
@media (max-width: 760px) { .suggest { padding-left: 86px; } }
.entry img[data-full] { cursor: zoom-in; }
.lightbox { padding: 0; border: 0; background: transparent; max-width: 96vw; max-height: 96vh; width: auto; }
.lightbox::backdrop { background: rgba(0,0,0,.8); }
.lightbox img { display: block; max-width: 96vw; max-height: calc(96vh - 40px); margin: 0 auto; border-radius: 8px; cursor: zoom-out; }
.lightbox-bar { display: flex; justify-content: space-between; gap: 16px; color: #fff; font-size: 13px; padding: 10px 2px 0; }
.lightbox-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox-bar a { color: #fff; }
dialog label.radio { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
dialog label.radio input[type=date] { border: 1px solid var(--line); border-radius: 8px; padding: 3px 6px; background: var(--bg); }
.search-tags { padding: 16px 20px 0; }
.search-tags .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.search-tags button { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 2px 9px; font-size: 13px; }

/* History: a timeline of changes, with the words each one removed and added */
#dialog:has(.history) { width: min(560px, 94vw); }
.history-head { display: flex; justify-content: space-between; align-items: flex-start; }
.history-head h2 { margin: 0; }
.history-head .muted { font-size: 13px; }
.history-now { background: var(--bg); border-radius: 14px; padding: 12px 16px; }
.history-now .label { font-size: 11px; font-weight: 600; letter-spacing: .06em; color: var(--accent); margin-bottom: 4px; }
.history { list-style: none; margin: 0; padding: 0 0 0 6px; max-height: 420px; overflow: auto; }
.history li { position: relative; padding: 0 0 14px 22px; border-left: 1px solid var(--line); }
.history li:last-child { border-left-color: transparent; }
.history li::before { content: ""; position: absolute; left: -4px; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.change-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 13px; }
.change-head .link { padding: 0; font-weight: 600; }
.change-time { font-size: 14px; margin: 2px 0 4px; }
.history .vtext, .history-now .vtext { white-space: pre-wrap; word-break: break-word; }
.history .vtext.muted { color: var(--muted); }
.history del { color: #B3261E; background: rgba(179, 38, 30, .12); text-decoration: line-through; border-radius: 3px; }
.history ins { color: #1B7F3B; background: rgba(27, 127, 59, .14); text-decoration: none; font-weight: 500; border-radius: 3px; }
:root[data-theme=dark] .history del, :root[data-theme=black] .history del { color: #FF8A80; background: rgba(255, 138, 128, .14); }
:root[data-theme=dark] .history ins, :root[data-theme=black] .history ins { color: #81C995; background: rgba(129, 201, 149, .16); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .history del, :root[data-theme=system] .history del { color: #FF8A80; background: rgba(255, 138, 128, .14); }
  :root:not([data-theme]) .history ins, :root[data-theme=system] .history ins { color: #81C995; background: rgba(129, 201, 149, .16); }
}
.history-note { font-size: 12px; margin: 0; }
.history del + ins { margin-left: 3px; }
.settings .section-note { margin: 8px 12px 0; font-size: 12px; color: var(--muted); }
