/* notekpr — browser client styles. Hand-written, no build step. */

:root {
  --bg: #ffffff;
  --bg-2: #f7f7f5;
  --bg-3: #efefec;
  --sb-bg: #f7f7f5;
  --fg: #2a2a28;
  --fg-2: #4a4a46;
  --muted: #8e8e88;
  --border: #e6e6e1;
  --border-strong: #d4d4cd;
  --accent: #5b5bd6;
  --accent-fg: #ffffff;
  --accent-bg: #ececfb;
  --link: #3e63dd;
  --broken: #c2410c;
  --danger: #d03b3b;
  --danger-bg: #fdecec;
  --danger-fg: #ffffff;
  --ok: #2f9e5a;
  --warn: #c27c0e;
  --warn-bg: #fff6e0;
  --star: #c28a00;
  --code-bg: #f3f2ef;
  --hl-bg: #fff1a8;
  --shadow: 0 8px 28px rgba(20, 20, 30, 0.14), 0 1px 3px rgba(20, 20, 30, 0.08);
  --radius: 8px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --kw: #8250df;
  --st: #0a7f3f;
  --cm: #8e8e88;
  --nu: #b35900;
  --fn: #8a5a00;
  --ty: #0969da;
  --co: #b35900;
  --va: #0a7b83;
  --pr: #4f46e5;
  --op: #c0365f;
  --me: #8a6d3b;
  --code-hl: rgba(91, 91, 214, 0.1);
  --code-head: 34px;
  --guide: rgba(20, 20, 30, 0.13);
  /* Colors in notes (crates/editor/src/color.rs). */
  --fg-gray: #6b6b66; --fg-red: #c93135; --fg-orange: #b85c0a; --fg-yellow: #8f6c00;
  --fg-green: #1f7a4c; --fg-blue: #2459b8; --fg-purple: #7344b5; --fg-pink: #b02a7f;
  --bg-gray: #ececea; --bg-red: #fde4e4; --bg-orange: #fdebd8; --bg-yellow: #fdf3c4;
  --bg-green: #e1f4e8; --bg-blue: #e1ecfc; --bg-purple: #efe6fb; --bg-pink: #fbe3f1;
  --callout-cyan: #0b7f86;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1c1f; --bg-2: #232327; --bg-3: #2c2c31; --sb-bg: #19191c;
    --fg: #e6e6e3; --fg-2: #c8c8c3; --muted: #8b8b92; --border: #2f2f35; --border-strong: #3d3d45;
    --accent: #8b8cf4; --accent-fg: #15151a; --accent-bg: #2c2c4a; --link: #8fa8ff; --broken: #ff9a5c;
    --danger: #ff6b6b; --danger-bg: #3a2020; --danger-fg: #1c1c1f; --ok: #4cc27a; --warn: #f0b44c; --warn-bg: #3a3020; --star: #f5b83d;
    --code-bg: #26262b; --hl-bg: #5a4f14; --shadow: 0 8px 28px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);
    --kw: #c39cff; --st: #7ad59b; --cm: #7d7d86; --nu: #ffb068;
    --fn: #f0d27a; --ty: #6cc6f5; --co: #ffb068; --va: #6fe0d0; --pr: #a5b4fc; --op: #ff7b9c; --me: #c9a26b;
    --code-hl: rgba(139, 140, 244, 0.16); --guide: rgba(255, 255, 255, 0.12);
    --fg-gray: #a3a3a0; --fg-red: #ff7b78; --fg-orange: #f9a25a; --fg-yellow: #e8c34a;
    --fg-green: #5fcf8f; --fg-blue: #7aaaf7; --fg-purple: #c3a0f5; --fg-pink: #f27cc4;
    --bg-gray: #36363a; --bg-red: #4a2526; --bg-orange: #4a3220; --bg-yellow: #4a4018;
    --bg-green: #1f3d2b; --bg-blue: #1e3150; --bg-purple: #352a4d; --bg-pink: #48233b;
    --callout-cyan: #4fd0d6;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1c1c1f; --bg-2: #232327; --bg-3: #2c2c31; --sb-bg: #19191c;
  --fg: #e6e6e3; --fg-2: #c8c8c3; --muted: #8b8b92; --border: #2f2f35; --border-strong: #3d3d45;
  --accent: #8b8cf4; --accent-fg: #15151a; --accent-bg: #2c2c4a; --link: #8fa8ff; --broken: #ff9a5c;
  --danger: #ff6b6b; --danger-bg: #3a2020; --danger-fg: #1c1c1f; --ok: #4cc27a; --warn: #f0b44c; --warn-bg: #3a3020; --star: #f5b83d;
  --code-bg: #26262b; --hl-bg: #5a4f14; --shadow: 0 8px 28px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);
  --kw: #c39cff; --st: #7ad59b; --cm: #7d7d86; --nu: #ffb068;
  --fn: #f0d27a; --ty: #6cc6f5; --co: #ffb068; --va: #6fe0d0; --pr: #a5b4fc; --op: #ff7b9c; --me: #c9a26b;
  --code-hl: rgba(139, 140, 244, 0.16); --guide: rgba(255, 255, 255, 0.12);
  --fg-gray: #a3a3a0; --fg-red: #ff7b78; --fg-orange: #f9a25a; --fg-yellow: #e8c34a;
  --fg-green: #5fcf8f; --fg-blue: #7aaaf7; --fg-purple: #c3a0f5; --fg-pink: #f27cc4;
  --bg-gray: #36363a; --bg-red: #4a2526; --bg-orange: #4a3220; --bg-yellow: #4a4018;
  --bg-green: #1f3d2b; --bg-blue: #1e3150; --bg-purple: #352a4d; --bg-pink: #48233b;
  --callout-cyan: #4fd0d6;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; }
a { color: var(--link); }
code, kbd, pre, .mono { font-family: var(--mono); }
kbd { font-size: 11px; padding: 1px 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--bg); color: var(--muted); }
.hidden { display: none !important; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.warn { color: var(--warn); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.center-fill { display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center; height: 100%; min-height: 200px; }

.ic { width: 18px; height: 18px; flex: none; vertical-align: middle; }
.ic.ok { color: var(--ok); }
.ic.warn { color: var(--warn); }
.ic.spin { animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
.spinner.inline { display: inline-block; width: 14px; height: 14px; border-width: 2px; vertical-align: -2px; }

/* ---------------------------------------------------------- controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: var(--bg); cursor: pointer; font-weight: 500; white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--bg-2); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--fg-2); }
.btn.ghost:hover { background: var(--bg-3); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn.danger:hover { background: var(--danger-bg); }
/* The button that deletes or takes away, when it is the one to press. */
.btn.danger.strong { background: var(--danger); border-color: var(--danger); color: var(--danger-fg); }
.btn.danger.strong:hover { background: var(--danger); filter: brightness(1.08); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.tiny { padding: 1px 7px; font-size: 12px; }
.btn.big { width: 100%; padding: 11px 16px; font-size: 15px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 6px; border: none; background: transparent; color: var(--fg-2); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--bg-3); }
.icon-btn.on { color: var(--accent); }
/* A favorite's star is filled and gold, so it reads as on at a glance. */
.icon-btn.fav.on { color: var(--star); }
.icon-btn.fav.on .ic { fill: currentColor; }
.icon-btn.tiny { width: 22px; height: 22px; }
.icon-btn.tiny .ic { width: 14px; height: 14px; }
.input {
  font: inherit; color: inherit; padding: 8px 10px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--bg); min-width: 0;
}
.input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
.input.small { padding: 3px 7px; font-size: 13px; }
textarea.input { resize: vertical; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-2); cursor: pointer; font-size: 13px; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip .count { color: var(--muted); font-size: 11px; }
.badge { display: inline-flex; color: var(--muted); }
.badge .ic { width: 14px; height: 14px; }
.pill { display: inline-block; margin-left: 8px; padding: 0 8px; border-radius: 999px; background: var(--accent-bg); color: var(--accent); font-size: 11px; font-weight: 600; vertical-align: 1px; }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.tag-agent { margin-left: 6px; padding: 0 6px; border-radius: 4px; background: var(--bg-3); color: var(--fg-2); font-size: 11px; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--c); color: #fff; font-size: 11px; font-weight: 700; flex: none; letter-spacing: 0.02em; }
.check { display: flex; gap: 8px; align-items: center; margin: 10px 0; cursor: pointer; }
/* An option of the one above it, which it needs on. */
.check.sub-check { margin-left: 24px; }
.check.disabled { opacity: 0.55; cursor: default; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; flex: none; }
.seg button { border: none; background: transparent; padding: 4px 9px; cursor: pointer; color: var(--muted); display: inline-flex; align-items: center; }
.seg button.on { background: var(--bg-3); color: var(--fg); }
.alert { padding: 10px 12px; border-radius: var(--radius); background: var(--bg-2); border: 1px solid var(--border); margin: 10px 0; }
.alert.error { background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.alert pre { white-space: pre-wrap; word-break: break-all; background: var(--bg); padding: 8px; border-radius: 6px; }
.fp { font-family: var(--mono); font-size: 11.5px; color: var(--muted); letter-spacing: 0.02em; }
.fp.big { font-size: 15px; color: var(--fg); }

.menu {
  position: absolute; z-index: 40; min-width: 210px; padding: 5px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--border); box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.menu button { display: flex; align-items: center; gap: 8px; text-align: left; padding: 6px 9px; border: none; border-radius: 6px; background: none; cursor: pointer; font-size: 14px; }
.menu button:hover { background: var(--bg-2); }
.menu button.danger { color: var(--danger); }
.menu button.archived { opacity: 0.6; }
.menu .menu-sep { height: 1px; background: var(--border); margin: 4px 2px; }
.menu .menu-label { padding: 4px 9px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.menu.right { right: 0; top: 36px; }
.menu.up { bottom: 44px; left: 8px; right: 8px; }
.tb-drop { position: relative; display: inline-flex; }
.tb-drop .menu { top: 34px; left: 0; }
.tb-drop .menu.right { left: auto; right: 0; }
.menu.colors { min-width: 0; }
.menu.callouts { display: grid; grid-template-columns: 1fr 1fr; min-width: 0; }
.swatches { display: grid; grid-template-columns: repeat(5, 30px); gap: 4px; padding: 2px 6px 6px; }
.menu .swatches button { width: 30px; height: 30px; padding: 0; justify-content: center; border: 1px solid var(--border); }
.swatches .sw { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 4px; font-weight: 600; }

/* note width: Settings → Editor, a note's ⋯ menu */
.width-slider { display: flex; align-items: center; gap: 8px; }
.width-slider input { flex: 1; min-width: 80px; accent-color: var(--accent); }
.width-slider .width-end { border: none; background: none; padding: 2px 0; cursor: pointer; color: var(--muted); font-size: 12.5px; }
.width-slider .width-end:hover { color: var(--fg); background: none; }
.width-slider .width-end.on { color: var(--accent); }
.width-slider .width-value { min-width: 3.6em; text-align: right; font-size: 12.5px; color: var(--fg-2); font-variant-numeric: tabular-nums; }
.width-prefs { max-width: 420px; }
.menu-width { display: flex; flex-direction: column; gap: 2px; padding: 0 9px 4px; }
.menu .menu-width .width-end { padding: 2px 0; }
.menu .menu-width .width-default { padding: 4px 0; color: var(--accent); font-size: 13px; }
.menu .menu-width .width-default:hover { background: none; text-decoration: underline; }

/* ---------------------------------------------------------- auth */
.auth { height: 100%; overflow: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 50% -10%, var(--accent-bg), transparent), var(--bg); }
.auth-card { width: min(440px, 100%); background: var(--bg); border: 1px solid var(--border); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.auth-card h1 { margin: 6px 0 0; font-size: 22px; }
.auth-card p { margin: 0; color: var(--fg-2); }
.auth-foot { color: var(--muted); font-size: 12px; margin-top: 16px; }
.brand { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 6px; }
.logo { color: var(--accent); font-size: 20px; }
.bullets { list-style: none; padding: 0; margin: 4px 0; display: flex; flex-direction: column; gap: 8px; }
.bullets li { display: flex; gap: 10px; align-items: flex-start; color: var(--fg-2); }
.bullets li .ic { color: var(--accent); margin-top: 2px; }
.dev-box { border: 1px dashed var(--warn); background: var(--warn-bg); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.dev-title { display: flex; gap: 6px; align-items: center; font-weight: 600; color: var(--warn); }
.dev-box form { display: flex; gap: 8px; }
.dev-box form .input { flex: 1; }
.dev-quick { display: flex; gap: 6px; }
.recovery-key { font-family: var(--mono); font-size: 16px; line-height: 1.7; padding: 14px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--border-strong); word-spacing: 6px; text-align: center; user-select: all; overflow-wrap: anywhere; }
.verify-code { font-family: var(--mono); font-size: 26px; font-weight: 700; letter-spacing: 0.08em; text-align: center; padding: 14px; border-radius: 10px; background: var(--accent-bg); color: var(--accent); }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------------------------------------------------------- shell */
.app { display: grid; grid-template-columns: 268px 1fr; height: 100dvh; }
.sidebar { background: var(--sb-bg); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; position: relative; }
.main { min-width: 0; min-height: 0; overflow: auto; position: relative; display: flex; flex-direction: column; }
.scrim { display: none; }
.mobile-only { display: none !important; }
.devstrip { position: fixed; z-index: 100; right: 10px; bottom: 10px; padding: 2px 8px; border-radius: 6px; background: var(--warn); color: #111; font-size: 11px; font-weight: 800; letter-spacing: 0.06em; opacity: 0.85; pointer-events: auto; }

.sb-top { padding: 10px 10px 6px; display: flex; flex-direction: column; gap: 6px; }
.vault-switch { position: relative; }
.vault-btn { width: 100%; display: flex; align-items: center; gap: 8px; padding: 7px 8px; border: none; border-radius: 8px; background: transparent; cursor: pointer; font-weight: 600; }
.vault-btn:hover { background: var(--bg-3); }
.vault-btn .vname { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vault-btn .caret { width: 14px; color: var(--muted); }
.vault-menu { top: 40px; left: 0; right: 0; }
.vault-menu .grow { text-align: left; }
.sb-search { display: flex; align-items: center; gap: 8px; padding: 6px 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--muted); cursor: pointer; }
.sb-search span { flex: 1; text-align: left; }
.sb-search:hover { border-color: var(--border-strong); }
.sb-actions { display: flex; gap: 4px; align-items: center; }
.sb-scroll { flex: 1; overflow: auto; padding: 4px 6px 10px; }
.sb-section { margin-top: 10px; }
.sb-label { display: flex; align-items: center; justify-content: space-between; padding: 2px 8px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.sb-link { width: 100%; display: flex; align-items: center; gap: 8px; padding: 5px 8px; border: none; border-radius: 6px; background: transparent; cursor: pointer; text-align: left; font-size: 14px; color: var(--fg-2); }
.sb-link:hover { background: var(--bg-3); }
.sb-link.active { background: var(--accent-bg); color: var(--accent); }
.sb-link .ic { width: 16px; height: 16px; color: var(--muted); }
.sb-bottom { border-top: 1px solid var(--border); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.sb-user { display: flex; align-items: center; gap: 6px; position: relative; }
.user-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 5px 6px; border: none; background: none; border-radius: 6px; cursor: pointer; text-align: left; }
.user-btn:hover { background: var(--bg-3); }
.sync { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); padding: 0 6px; white-space: nowrap; }
.sync .ic { width: 15px; height: 15px; }

/* tree */
.tree { display: flex; flex-direction: column; gap: 1px; padding-bottom: 8px; border-radius: 6px; }
.tree.drop { outline: 2px dashed var(--accent); }
.tree-row { position: relative; display: flex; align-items: center; border-radius: 6px; padding-right: 2px; }
.tree-row:hover { background: var(--bg-3); }
.tree-row.active { background: var(--accent-bg); }
.tree-row.active .tree-item { color: var(--accent); }
.tree-row.holds-open .tree-item, .tree-row.holds-open .tree-item .ic { color: var(--accent); }
.tree-row.drop { outline: 2px solid var(--accent); }
/* Where a dragged entry goes between two others. */
.tree-row.drop-before::before, .tree-row.drop-after::after { content: ""; position: absolute; left: var(--indent, 8px); right: 4px; height: 2px; border-radius: 1px; background: var(--accent); pointer-events: none; }
.tree-row.drop-before::before { top: -1.5px; }
.tree-row.drop-after::after { bottom: -1.5px; }
.tree-item { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 4px 4px; border: none; background: none; cursor: pointer; text-align: left; font-size: 14px; color: var(--fg-2); }
.tree-item .ic { width: 16px; height: 16px; color: var(--muted); }
.tree-item .caret { width: 13px; height: 13px; margin-left: -2px; }
.tree-item .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-item .shared-mark { display: inline-flex; margin-left: auto; flex: none; }
.tree-item .shared-mark .ic { width: 13px; height: 13px; color: var(--accent); opacity: .75; }
.tree-more { opacity: 0; border: none; background: none; cursor: pointer; padding: 2px; border-radius: 4px; color: var(--muted); display: inline-flex; }
.tree-row:hover .tree-more, .tree-more:focus { opacity: 1; }
.tree-more:hover { background: var(--border); }
.tree-row .menu { top: 26px; right: 0; }
.tree-rename { flex: 1; padding: 2px 4px; }
.tree-rename .input { width: 100%; }
.tree-empty { padding: 6px 10px; }
.tree-add { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border: none; background: none; color: var(--muted); cursor: pointer; font-size: 13.5px; border-radius: 6px; }
.tree-add:hover { background: var(--bg-3); color: var(--fg); }
.tree-add .ic { width: 15px; height: 15px; }

/* banners & toasts */
.banner { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--accent-bg); border-bottom: 1px solid var(--border); font-size: 14px; }
.banner span { flex: 1; }
.banner.warn { background: var(--warn-bg); }
.toasts { position: fixed; z-index: 200; left: 50%; transform: translateX(-50%); bottom: 18px; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(560px, calc(100vw - 32px)); }
.toast { pointer-events: auto; padding: 9px 14px; border-radius: 10px; background: var(--fg); color: var(--bg); box-shadow: var(--shadow); font-size: 14px; animation: toast-in 0.18s ease-out; max-width: 100%; }
.toast.error { background: var(--danger); color: #fff; }
.toast.success { background: var(--ok); color: #fff; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* pages */
.page { display: flex; flex-direction: column; min-height: 100%; flex: none; }
.page-head, .note-head { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px; padding: 8px 16px; min-height: 52px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid transparent; }
.page-head h1 { font-size: 18px; margin: 0; }
.page-body { padding: 8px 32px 64px; max-width: 1080px; width: 100%; }
.page-body.narrow { max-width: 560px; }
.page-body h2 { font-size: 15px; margin: 28px 0 10px; color: var(--fg-2); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 12px; }
.card { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; text-align: left; padding: 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); cursor: pointer; min-height: 130px; transition: border-color 0.12s, transform 0.12s; }
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card.archived { opacity: 0.6; }
.card.add { border-style: dashed; color: var(--muted); }
/* A vault's card with its settings button (⚙) in the corner. */
.card-wrap { position: relative; display: flex; }
.card-wrap > .card { flex: 1; }
.card-wrap:hover > .card { border-color: var(--accent); }
.card-cog { position: absolute; top: 10px; right: 10px; color: var(--muted); opacity: 0; transition: opacity 0.12s; }
.card-cog:hover { color: var(--fg); }
.card-wrap:hover .card-cog, .card-cog:focus-visible { opacity: 1; }
@media (hover: none) { .card-cog { opacity: 1; } }
.card-icon { width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; background: var(--accent-bg); color: var(--accent); }
.card-title { font-weight: 600; font-size: 16px; }
.card-meta { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--fg-2); }
.card-meta .ic { width: 14px; height: 14px; }
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.qa { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-2); cursor: pointer; }
/* A vault others use with one owner: suggest another (views/home.rs). */
.owner-hint { display: flex; gap: 12px; align-items: flex-start; margin-top: 16px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-2); }
.owner-hint > svg { flex: none; margin-top: 2px; color: var(--accent); }
.owner-hint p { margin: 0 0 8px; }
.owner-hint .check { align-items: flex-start; margin: 8px 0; }
.owner-hint .row { gap: 8px; flex-wrap: wrap; }
.qa:hover { border-color: var(--accent); }
.note-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.note-card { text-align: left; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); cursor: pointer; display: flex; flex-direction: column; gap: 4px; min-height: 96px; }
.note-card:hover { border-color: var(--border-strong); background: var(--bg-2); }
.nc-title { font-weight: 600; }
.nc-snip { color: var(--fg-2); font-size: 13px; flex: 1; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.nc-meta { color: var(--muted); font-size: 12px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin: 10px 0; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: none; border-bottom: 1px solid var(--border); background: var(--bg); text-align: left; width: 100%; }
.list-row:last-child { border-bottom: none; }
button.list-row { cursor: pointer; }
button.list-row:hover:not(:disabled) { background: var(--bg-2); }
.list-row.col { flex-direction: column; align-items: stretch; }
.list-row.dim { opacity: 0.6; }
/* A list that grows with the instance (accounts, vaults): about five rows,
   the rest scrolls inside it. */
.list.scroll { overflow-y: auto; max-height: 26rem; }
/* A row scrolled into sight (`reveal_row`) stops clear of the toasts. */
.list.scroll > .list-row { scroll-margin-bottom: 5rem; }
.cred { display: flex; gap: 10px; align-items: center; padding-left: 28px; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 80px 20px; color: var(--fg-2); }
.field { display: flex; flex-direction: column; gap: 4px; }
/* A text field with suggestions under it (views/suggest.rs): opens like the
   other menus, as wide as the field, under its ▾. */
.suggest { position: relative; display: flex; }
.suggest .input { flex: 1; padding-right: 32px; }
.suggest-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: inline-flex;
  padding: 4px; border: none; border-radius: 6px; background: none; color: var(--muted); cursor: pointer;
}
.suggest-toggle:hover { color: var(--fg); background: var(--bg-3); }
.suggest-toggle .ic { width: 16px; height: 16px; }
.suggest .menu { top: calc(100% + 4px); left: 0; right: 0; min-width: 0; max-height: min(220px, 40vh); overflow-y: auto; }
.suggest .menu button { flex: none; }
.suggest .menu button.active { background: var(--bg-2); }
.suggest .menu button.current { color: var(--accent); }
.settings-body .field { max-width: 420px; }

/* quick notes */
.sb-quick, .sb-drawings { display: flex; align-items: center; gap: 2px; }
:is(.sb-quick, .sb-drawings) .sb-link { flex: 1; min-width: 0; }
.quick-capture { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.quick-capture textarea { width: 100%; min-height: 96px; font-size: 16px; }
.qc-bar { display: flex; align-items: center; gap: 10px; }
.qn-novault, .qn-full { border-radius: 10px; border: none; margin: 8px 0; }
.qn-count { white-space: nowrap; }
.qn-storage { display: flex; flex-direction: column; gap: 6px; max-width: 360px; margin: 0 0 8px; }
.qn-storage p { margin: 0; }
.qn-count.near { color: var(--warn); }
.qn-count.full { color: var(--danger); }
.qn-explain { margin: -4px 0 10px; }
/* A quick note's card is a vault's note card (.note-card), with its buttons
   over the corner while it is pointed at (always on touch screens). */
.qn-card { position: relative; display: flex; min-width: 0; }
.qn-card > .note-card { flex: 1; min-width: 0; }
.qn-card:hover > .note-card { border-color: var(--border-strong); background: var(--bg-2); }
.qn-actions { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 2px; border-radius: 6px; background: var(--bg); opacity: 0; transition: opacity 0.12s; }
.qn-card:hover .qn-actions, .qn-card:focus-within .qn-actions { opacity: 1; background: var(--bg-2); }
.qn-actions .icon-btn { color: var(--muted); }
.qn-actions .icon-btn:hover { color: var(--fg); }
.qn-actions .qn-delete:hover { color: var(--danger); }
.nc-meta .pill { margin-left: 6px; }

/* note page */
/* Pages are as tall as what's on them, not squeezed to the window by
   .main's flex column: a sticky header or toolbar sticks only within its
   page, so it would leave once the page scrolls past one window. */
.note-page { display: flex; flex-direction: column; min-height: 100%; flex: none; }
.crumbs { flex: 1; font-size: 13.5px; color: var(--muted); }
/* A drawing's name in its header: text until hovered or edited. */
.drawing-name-field { font: inherit; color: var(--fg); background: transparent; border: 1px solid transparent; border-radius: var(--radius); padding: 1px 4px; margin-left: -5px; max-width: 60%; field-sizing: content; min-width: 4ch; }
.drawing-name-field:not([readonly]):hover { border-color: var(--border); }
.drawing-name-field:focus { outline: none; border-color: var(--accent); background: var(--bg); }
.presence { display: flex; gap: 2px; }
.presence .avatar { width: 24px; height: 24px; border: 2px solid var(--bg); box-shadow: 0 0 0 1.5px var(--c); }
.note-body { flex: 1; display: flex; min-height: 0; --aside: 0px; }
/* The side panel beside the note, when it takes room (not as an overlay). */
.note-body.with-panel { --aside: 290px; }
.note-main { flex: 1; min-width: 0; max-width: 820px; margin: 0 auto; padding: 18px 48px 40vh; }
/* A note wider than narrow (crate::width): --wide goes from 0 (narrow, as
   above) to 1 (all the room beside the sidebar and the side panel). */
.note-main.wider { max-width: calc(820px + (100% - var(--aside) - 820px) * var(--wide)); }
.note-title { width: 100%; font: inherit; font-size: 34px; font-weight: 700; line-height: 1.2; border: none; outline: none; background: transparent; color: var(--fg); padding: 8px 0 6px; }
.note-title::placeholder { color: var(--muted); }
.note-title.static { margin: 0; overflow-wrap: anywhere; }
.readonly-note { display: flex; gap: 8px; align-items: center; padding: 6px 10px; border-radius: 8px; background: var(--bg-2); color: var(--fg-2); font-size: 13px; margin-bottom: 8px; }
.toolbar-wrap { position: sticky; top: 52px; z-index: 5; margin: 0 -4px 12px; border-radius: 10px; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(6px); border: 1px solid var(--border); }
/* An open menu goes over the comment button and popups (z-index 30, 35). */
.toolbar-wrap:has(.menu) { z-index: 36; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 1px; padding: 4px; }
.tb { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 30px; border: none; border-radius: 6px; background: transparent; cursor: pointer; color: var(--fg-2); }
.tb:hover { background: var(--bg-3); color: var(--fg); }
.tb .ic { width: 17px; height: 17px; }
.tb-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.h1s { font-size: 20px; font-weight: 700; }
.h2s { font-size: 17px; font-weight: 700; }
.h3s { font-size: 15px; font-weight: 700; }
.panel { width: 290px; flex: none; border-left: 1px solid var(--border); padding: 14px 14px 40px; overflow: auto; position: sticky; top: 52px; height: calc(100dvh - 52px); }
.panel section { margin-bottom: 18px; }
.panel h3 { display: flex; align-items: center; gap: 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 0 0 6px; }
.panel h3 .ic { width: 14px; height: 14px; }
.panel h3.warn { color: var(--warn); }
.panel .count { font-weight: 400; }
.panel-item { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; padding: 6px 8px; border: none; border-radius: 6px; background: none; cursor: pointer; }
.panel-item:hover { background: var(--bg-2); }
.pi-title { font-size: 14px; }
.pi-title.broken { color: var(--broken); }
.pi-snip { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-item.outline { font-size: 13.5px; color: var(--fg-2); }

/* ---------------------------------------------------------- editor */
/* A table wider than the editor scrolls sideways, with the rest of the text
   (the other lines still wrap at the editor's width): the text and what is
   drawn over it (cursors, comment highlights) scroll together. */
.ed-wrap { position: relative; overflow-x: auto; scrollbar-width: thin; }
.ed {
  outline: none; white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal;
  font-size: 16px; line-height: 1.7; min-height: 50vh; caret-color: var(--accent); tab-size: 4;
  padding-bottom: 2em;
}
.ed.readonly { caret-color: transparent; }
.ed .ln { min-height: 1.7em; }
.ed .ln.h1 { font-size: 1.85em; font-weight: 700; line-height: 1.3; margin-top: 0.55em; }
.ed .ln.h2 { font-size: 1.45em; font-weight: 700; line-height: 1.35; margin-top: 0.5em; }
.ed .ln.h3 { font-size: 1.2em; font-weight: 650; margin-top: 0.4em; }
.ed .ln.h4, .ed .ln.h5, .ed .ln.h6 { font-weight: 650; }
.ed .mk { color: var(--muted); font-weight: 400; font-style: normal; text-decoration: none; }
.ed.live .ln:not(.active) .mk { display: none; }
.ed .b { font-weight: 700; }
.ed .i { font-style: italic; }
.ed .s { text-decoration: line-through; }
.ed .hl { background: var(--hl-bg); border-radius: 2px; }
.ed .c { font-family: var(--mono); font-size: 0.88em; background: var(--code-bg); border-radius: 4px; padding: 0.1em 0.25em; }
/* The looks of inline HTML (<u>, <kbd>, <sub>, <sup>; the others share Markdown's). */
.ed .un { text-decoration: underline; text-underline-offset: 2px; }
.ed .kbd { font-family: var(--mono); font-size: 0.82em; padding: 1px 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--bg); }
.ed .sub, .ed .sup { font-size: 0.75em; }
.ed .sub { vertical-align: sub; }
.ed .sup { vertical-align: super; }
.ed .a, .ed .u { color: var(--link); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.ed .wl { color: var(--link); cursor: pointer; }
.ed .wl:hover { text-decoration: underline; }
.ed .wlb { color: var(--broken); text-decoration: underline dashed; text-underline-offset: 3px; }
.ed .tg { color: var(--accent); background: var(--accent-bg); border-radius: 4px; padding: 0 2px; }
/* Dates (@2026-10-23): away from the caret the source hides behind its
   label (Today, Tomorrow, … or the date). */
.ed .dt { color: var(--accent); }
.ed .w.dw { display: none; }
.ed.live .ln:not(.active) .dt { display: none; }
.ed.live .ln:not(.active) .w.dw { display: inline; }
.ed .dw, .reading time.date {
  color: var(--accent); background: var(--accent-bg); border-radius: 4px; padding: 0 4px;
  white-space: nowrap; font-weight: 500;
}
.ed-menu {
  position: absolute; z-index: 40; min-width: 230px; display: flex; flex-direction: column;
  padding: 4px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.ed-menu[hidden] { display: none; }
.ed-menu button {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 5px 8px;
  border: none; border-radius: 6px; background: none; color: var(--fg); text-align: left;
  cursor: pointer; font: inherit; font-size: 14px;
}
.ed-menu button.sel, .ed-menu button:hover { background: var(--bg-3); }
.ed-menu .dm-date { color: var(--muted); font-size: 12.5px; }
.ed .on { color: var(--muted); }
.ed .tp { color: var(--muted); }
.ed .ln.quote { border-left: 3px solid var(--border-strong); padding-left: 14px; color: var(--fg-2); }
/* A line that continues the list item above it (Markdown's lazy
   continuation): under the item's text. Quotes continue as quotes. */
.ed.live .ln.lazy:not(.quote) { padding-left: 1.3em; }
.ed .ln.code, .ed .ln.fence { font-family: var(--mono); font-size: 14px; line-height: 1.6; background: var(--code-bg); padding: 0 14px; }
.ed .ln.fence { color: var(--muted); }
.ed .ln.fence .lg { color: var(--fg-2); }
/* Live preview: the opening fence is the block's header (a widget with the
   title, language and copy button); the fences' source shows while the caret
   is in the block. Lines are numbered with a CSS counter, so the numbers are
   never part of the text. */
.ed.live .ln.fence.fo { position: relative; border-radius: 8px 8px 0 0; margin-top: 4px; counter-reset: code-line; }
.ed.live .ln.fence.fc { border-radius: 0 0 8px 8px; margin-bottom: 4px; }
.ed.live .ln.fence.fc:not(.active) { min-height: 10px; }
/* A hidden fence's source shrinks to nothing rather than going away, so the
   caret can still land on the line (Ctrl+Home, arrow keys) and show it. */
.ed.live .ln.fence:not(.active) { line-height: 0; }
.ed.live .ln.fence:not(.active) .mk { display: inline; font-size: 0; }
.ed.live .ln.fence.fo.head { padding-top: var(--code-head); }
.ed.live .ln.fence.fo.head:not(.active) { padding-top: 0; min-height: var(--code-head); }
.ed.live .code-head { display: flex; position: absolute; top: 0; left: 0; right: 0; height: var(--code-head); padding: 0 6px 0 14px; }
.ed.live .ln.fence.fo.head .code-head { border-bottom: 1px solid var(--border); }
.ed.live .ln.fence.fo:not(.head) .code-head { left: auto; bottom: 0; height: auto; }
.ed.live .ln.code { --code-pad: calc(3ch + 26px); display: flex; position: relative; counter-increment: code-line; padding-left: var(--code-pad); }
/* A line of code (.lx) is its indentation and its text: wrapped rows start
   under the text, clear of the indentation guides. */
.ed.live .ln.code > .lx { display: flex; flex: 1 1 auto; min-width: 0; position: relative; }
.ed.live .ln.code > .lx > .ind { flex: none; white-space: pre; }
.ed.live .ln.code > .lx > .lc { flex: 1 1 auto; min-width: 0; }
/* Not wrapping: the lines of a block scroll sideways, together (the editor
   keeps them in step). Each is as wide as the block's longest line
   (--code-w, measured by the editor), so all scroll as far; the last one
   (also of a block nothing closes) shows the scrollbar. */
.ed.live .ln.code.nowrap > .lx, .no-code-wrap .ed.live .ln.code:not(.wrap) > .lx { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.ed.live .ln.code.nowrap > .lx::-webkit-scrollbar, .no-code-wrap .ed.live .ln.code:not(.wrap) > .lx::-webkit-scrollbar { display: none; }
.ed.live .ln.code.nowrap > .lx > .lc, .no-code-wrap .ed.live .ln.code:not(.wrap) > .lx > .lc { flex: none; white-space: pre; }
.ed.live .ln.code.nowrap > .lx::after, .no-code-wrap .ed.live .ln.code:not(.wrap) > .lx::after {
  content: ""; position: absolute; top: 0; left: 0; width: calc(var(--code-w, 0px) + 14px); height: 1px; pointer-events: none;
}
.ed.live .ln.code.nowrap:is(:has(+ .ln.fence.fc), :last-child) > .lx,
.no-code-wrap .ed.live .ln.code:not(.wrap):is(:has(+ .ln.fence.fc), :last-child) > .lx { scrollbar-width: thin; }
.ed.live .ln.code.nowrap:is(:has(+ .ln.fence.fc), :last-child) > .lx::-webkit-scrollbar,
.no-code-wrap .ed.live .ln.code:not(.wrap):is(:has(+ .ln.fence.fc), :last-child) > .lx::-webkit-scrollbar { display: block; height: 8px; }
.ed.live .ln.code::before { content: counter(code-line); position: absolute; left: 8px; width: 3ch; text-align: right; color: var(--muted); opacity: 0.75; pointer-events: none; }
.ed.live .ln.code.nonum, .no-code-numbers .ed.live .ln.code { --code-pad: 14px; }
.ed.live .ln.code.nonum::before, .no-code-numbers .ed.live .ln.code::before { content: none; }
.ed.live .ln.code.chl { background: linear-gradient(var(--code-hl), var(--code-hl)), var(--code-bg); box-shadow: inset 3px 0 var(--accent); }
.ed .ln.table, .ed .ln.pipes { font-family: var(--mono); font-size: 14px; }
/* Live preview: table rows are laid out as a real table (consecutive rows share
   an anonymous table box, so columns line up); pipes show on the caret's row,
   the delimiter row only while the caret is on it. */
.ed.live .ln.table { display: table-row; font-family: inherit; font-size: inherit; }
.ed.live .ln.table > .td { display: table-cell; padding: 4px 12px; vertical-align: top; border-right: 1px solid var(--border-strong); border-bottom: 1px solid var(--border-strong); }
.ed.live .ln.table > .td:first-child { border-left: 1px solid var(--border-strong); }
.ed.live .ln.table.th > .td { border-top: 1px solid var(--border-strong); font-weight: 650; background: var(--bg-2); }
.ed.live .ln.table > .td.ac { text-align: center; }
.ed.live .ln.table > .td.ar { text-align: right; }
.ed.live .ln.table.tdl:not(.active) { display: none; }
.ed.live .ln.table.tdl > .td { color: var(--muted); }
/* A cell's text (.tc) is a block that never breaks inside a word: a table
   that doesn't fit scrolls sideways instead (.ed-wrap). */
.ed.live .ln.table > .td { overflow-wrap: normal; }
.ed.live .ln.table > .td > .tc { display: block; }
/* A scroll container (.ed-wrap) keeps the first line's top margin inside
   rather than letting it merge with the toolbar's: the toolbar's is the gap. */
.ed-wrap > .ed > .ln:first-child { margin-top: 0; }
.ed .ln.fm { font-family: var(--mono); font-size: 13px; color: var(--muted); background: var(--bg-2); padding: 0 12px; }
.ed .kw, .reading .kw { color: var(--kw); }
.ed .st, .reading .st { color: var(--st); }
.ed .cm, .reading .cm { color: var(--cm); font-style: italic; }
.ed .nu, .reading .nu { color: var(--nu); }
.ed .fn, .reading .fn { color: var(--fn); }
.ed .ty, .reading .ty { color: var(--ty); }
.ed .co, .reading .co { color: var(--co); }
.ed .va, .reading .va { color: var(--va); }
.ed .pr, .reading .pr { color: var(--pr); }
.ed .op, .reading .op { color: var(--op); }
.ed .me, .reading .me { color: var(--me); }
.ed .ins, .reading .ins { color: var(--st); }
.ed .del, .reading .del { color: var(--danger); }
/* A code block's header: title, language, copy button (editor and reading view). */
.code-head { display: flex; align-items: center; gap: 10px; font-family: var(--sans); font-size: 12px; line-height: 1; color: var(--muted); white-space: nowrap; }
.code-head .code-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-family: var(--mono); font-size: 13px; font-style: italic; color: var(--fg-2); }
.code-head .code-lang, .code-head .code-copy { margin-left: auto; }
.code-head .code-lang + .code-copy { margin-left: 0; }
.code-copy { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; padding: 0; border: none; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.code-copy:hover { background: var(--bg-3); color: var(--fg); }
.code-copy .ic { width: 15px; height: 15px; }
.code-copy .i-ok, .code-copy.copied .i-copy { display: none; }
.code-copy.copied { color: var(--ok); }
.code-copy.copied .i-ok { display: inline; }
/* live preview widgets drawn with CSS only; the source text stays in the DOM */
.ed.live .ln:not(.active) .bl { font-size: 0; }
/* A bullet, drawn (fonts draw • ◦ ▪ at different sizes and heights) and
   centred on the text's lower case letters. Nested ones as the reading
   view (and browsers) draw them: a dot, a ring (lv1), then a square (lv2)
   further in. */
.ed.live .ln:not(.active) .bl::before {
  content: ""; display: inline-block; font-size: 16px; width: 1.3em; height: 1em; vertical-align: -0.23em;
  background: radial-gradient(circle, var(--fg-2) 2.8px, transparent 3.3px);
}
.ed.live .ln.lv1:not(.active) .bl::before { background: radial-gradient(circle, transparent 2.1px, var(--fg-2) 2.6px, var(--fg-2) 3.3px, transparent 3.8px); }
.ed.live .ln.lv2:not(.active) .bl::before { background: linear-gradient(var(--fg-2), var(--fg-2)) center / 6px 6px no-repeat; }
.ed.live .ln:not(.active) .hx { display: none; }
.ed .tk { cursor: pointer; }
.ed.live .ln:not(.active) .tk { font-size: 0; }
.ed.live .ln:not(.active) .tk::before {
  content: ""; display: inline-block; width: 15px; height: 15px; margin-right: 8px; vertical-align: -2px;
  border: 2px solid var(--muted); border-radius: 4px; font-size: 16px;
}
.ed.live .ln.done:not(.active) .tk::before {
  background: var(--accent) no-repeat center/11px url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'><path d='m5 12 5 5L20 7'/></svg>");
  border-color: var(--accent);
}
.ed.live .ln.done:not(.active) { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--border-strong); }
.ed.live .ln.hr:not(.active) { background: linear-gradient(var(--border-strong), var(--border-strong)) center / 100% 1px no-repeat; }
.ed .w { display: block; }
.ed .w img { display: block; max-width: 100%; max-height: 520px; border-radius: 8px; margin: 6px 0; }
.ed .w video { display: block; max-width: 100%; max-height: 520px; border-radius: 8px; margin: 6px 0; background: #000; }
.ed .w audio { display: block; width: min(100%, 480px); margin: 6px 0; }
.ed.source { font-family: var(--mono); font-size: 14.5px; line-height: 1.65; }
.ed.source .ln.h1, .ed.source .ln.h2, .ed.source .ln.h3 { font-size: 1em; margin-top: 0; }
.ed.source .ln.code, .ed.source .ln.fence, .ed.source .ln.fm, .ed.source .ln.table, .ed.source .ln.pipes { font-size: 1em; }
.ed.source .w { display: none; }
/* Raw HTML in the editor: tags, and the lines of an HTML block. In live
   preview a block away from the selection shows only its preview (on its
   last line; its source lines fold away, as code fences do), and with the
   selection in it only its source. */
.ed .ht { font-family: var(--mono); font-size: 0.88em; color: var(--muted); }
.ed .ln.html { font-family: var(--mono); font-size: 14px; color: var(--fg-2); }
.ed .ln.html .ht { font-size: inherit; }
.ed .hw { font-family: var(--sans); font-size: 16px; line-height: 1.7; color: var(--fg); white-space: normal; overflow-wrap: anywhere; padding: 2px 0 6px; }
.ed .hw img { display: inline; max-height: none; border-radius: 8px; margin: 0; max-width: 100%; }
.ed .hw a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.ed.live .ln.html:not(.active) { font-size: 0; line-height: 0; }
.ed.live .ln.active .hw { display: none; }
/* Line numbers (Settings → Editor): one for each line of the Markdown —
   each is one .ln — counted with a CSS counter, so nothing is added to the
   text. They sit in the margin, which the text's box takes in (it clips:
   it scrolls sideways). A table's delimiter row, hidden, still counts;
   lines folded away (a code block's fences, an HTML block's source) show
   no number. --ln-h is a line's own height, for the number to sit level
   with its first row. */
@property --ln-h { syntax: '<length>'; inherits: true; initial-value: 0px; }
.line-numbers .ed { counter-reset: ln; }
.line-numbers .ed .ln { position: relative; counter-increment: ln; --ln-h: 1lh; }
.line-numbers .ed.live .ln.code { counter-increment: code-line ln; }
.line-numbers .ed.live .ln.table.tdl:not(.active) + .ln { counter-increment: ln 2; }
.line-numbers .ed .ln::after {
  content: counter(ln); position: absolute; top: 0; right: calc(100% + 10px); height: var(--ln-h);
  font: 400 12px/var(--ln-h) var(--mono); color: var(--muted); opacity: 0.7; text-decoration: none;
  white-space: nowrap; pointer-events: none; user-select: none;
}
.line-numbers .ed.live .ln.fence:not(.active)::after, .line-numbers .ed.live .ln.html:not(.active)::after { content: none; }
/* Relative: the caret's line (.cur; --ln-cur, its number, set by the
   editor) keeps its own number; above it, a counter (up) counts down to
   it, below it another (down) counts on from it. Code lines and a table's
   hidden delimiter row count as above. */
.relative-numbers .ed { counter-reset: ln up var(--ln-cur, 1); }
.relative-numbers .ed .ln { counter-increment: ln up -1; }
.relative-numbers .ed .ln.cur { counter-reset: down; counter-increment: ln; }
.relative-numbers .ed .ln.cur ~ .ln { counter-increment: ln down; }
.relative-numbers .ed.live .ln.code { counter-increment: code-line ln up -1; }
.relative-numbers .ed.live .ln.code.cur { counter-increment: code-line ln; }
.relative-numbers .ed.live .ln.cur ~ .ln.code { counter-increment: code-line ln down; }
.relative-numbers .ed.live .ln.fence.fo.cur { counter-reset: code-line down; }
.relative-numbers .ed.live .ln.table.tdl:not(.active) + .ln { counter-increment: ln 2 up -2; }
.relative-numbers .ed.live .ln.table.tdl:not(.active) + .ln.cur { counter-increment: ln 2; }
.relative-numbers .ed.live .ln.cur ~ .ln.table.tdl:not(.active) + .ln { counter-increment: ln 2 down 2; }
.relative-numbers .ed .ln::after { content: counter(up); }
.relative-numbers .ed .ln.cur::after { content: counter(ln); color: var(--fg); opacity: 1; }
.relative-numbers .ed .ln.cur ~ .ln::after { content: counter(down); }
.line-numbers .ed-wrap { margin-left: -40px; padding-left: 40px; }
@media (max-width: 760px) { .line-numbers .ed-wrap { margin-left: -10px; padding-left: 32px; } }
/* Vim outside insert mode: a block over the character under the cursor
   (drawn by the editor) instead of the browser's line. */
.ed.vim-normal { caret-color: transparent; }
.ed-cursors { position: absolute; inset: 0; pointer-events: none; }
.vim-cursor { position: absolute; background: color-mix(in srgb, var(--warn) 50%, transparent); border-radius: 2px; }
.rc { position: absolute; width: 2px; background: var(--c); border-radius: 1px; }
.rc span { position: absolute; bottom: 100%; left: -1px; background: var(--c); color: #fff; font-size: 11px; line-height: 1.5; padding: 0 5px; border-radius: 4px 4px 4px 0; white-space: nowrap; font-family: var(--sans); }
/* The name goes under the cursor on the first line, and left of it at the
   end of the text: the editor's text box clips (it scrolls sideways). */
.rc.below span { bottom: auto; top: 100%; border-radius: 0 4px 4px 4px; }
.rc.end span { left: auto; right: -1px; border-radius: 4px 4px 0 4px; }
.rc.below.end span { border-radius: 4px 0 4px 4px; }

/* ---------------------------------------------------------- reading view */
.reading { font-size: 16px; line-height: 1.7; overflow-wrap: anywhere; }
:is(.reading, .ed .hw) :is(h1, h2, h3, h4) { line-height: 1.3; margin: 1.2em 0 0.4em; }
:is(.reading, .ed .hw) h1 { font-size: 1.85em; }
:is(.reading, .ed .hw) h2 { font-size: 1.45em; }
:is(.reading, .ed .hw) h3 { font-size: 1.2em; }
:is(.reading, .ed .hw) p { margin: 0.5em 0; }
:is(.reading, .ed .hw) :is(ul, ol) { padding-left: 1.6em; margin: 0.4em 0; }
.reading li:has(> input.task) { list-style: none; margin-left: -1.4em; }
.reading input.task { width: 16px; height: 16px; vertical-align: -2px; margin-right: 6px; accent-color: var(--accent); cursor: pointer; }
:is(.reading, .ed .hw) blockquote { margin: 0.6em 0; padding: 0.1em 1em; border-left: 3px solid var(--border-strong); color: var(--fg-2); }
:is(.reading, .ed .hw) code { font-size: 0.88em; background: var(--code-bg); border-radius: 4px; padding: 0.1em 0.3em; }
.reading .codeblock { position: relative; margin: 0.8em 0; background: var(--code-bg); border-radius: 8px; overflow: hidden; }
.reading .code-head { height: var(--code-head); padding: 0 6px 0 14px; border-bottom: 1px solid var(--border); }
.reading .codeblock.bare .code-head { position: absolute; top: 4px; right: 4px; z-index: 1; height: auto; padding: 0; border: none; opacity: 0; transition: opacity 0.12s; }
.reading .codeblock.bare:hover .code-head, .reading .codeblock.bare .code-head:focus-within { opacity: 1; }
.reading pre.code { margin: 0; padding: 10px 0; overflow: auto; font-size: 14px; line-height: 1.55; tab-size: 4; }
.reading pre.code code { display: block; counter-reset: code-line; background: none; padding: 0; font-size: inherit; }
.reading .cl { --code-pad: calc(3ch + 26px); display: flex; position: relative; min-height: 1.55em; padding: 0 14px 0 var(--code-pad); counter-increment: code-line; }
.reading .cl > .ind { flex: none; white-space: pre; }
.reading .cl > .lc { flex: 1 1 auto; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.reading .cl > .nl { display: none; }
/* Not wrapping: the block scrolls sideways. */
.reading .codeblock.nowrap code, .no-code-wrap .reading .codeblock:not(.wrap) code { min-width: max-content; }
.reading .codeblock.nowrap .lc, .no-code-wrap .reading .codeblock:not(.wrap) .lc { flex: none; white-space: pre; overflow-wrap: normal; }
.reading .cl::before { content: counter(code-line); position: absolute; left: 8px; width: 3ch; text-align: right; color: var(--muted); opacity: 0.75; }
.reading .codeblock.nonum .cl, .no-code-numbers .reading .cl { --code-pad: 14px; }
.reading .codeblock.nonum .cl::before, .no-code-numbers .reading .cl::before { content: none; }
.reading .cl.chl { background: var(--code-hl); box-shadow: inset 3px 0 var(--accent); }
/* Indentation guides: an empty element per line of code (no text), a line
   half a column into each indentation level (--ig levels, --iu columns
   each), ending where the indentation does. */
.ed.live .ln.code > .igs, .ed.live .ln.code > .lx > .igs, .reading .cl > .igs {
  display: block; position: absolute; top: 0; bottom: 0; left: calc(var(--code-pad) + 0.5ch); width: calc(var(--ig) * var(--iu) - 0.5ch);
  background: repeating-linear-gradient(to right, var(--guide) 0 1px, transparent 1px var(--iu)); pointer-events: none;
}
.ed.live .ln.code > .lx > .igs { left: 0.5ch; }
.igs.ig1 { --ig: 1; } .igs.ig2 { --ig: 2; } .igs.ig3 { --ig: 3; } .igs.ig4 { --ig: 4; }
.igs.ig5 { --ig: 5; } .igs.ig6 { --ig: 6; } .igs.ig7 { --ig: 7; } .igs.ig8 { --ig: 8; }
.igs.ig9 { --ig: 9; } .igs.ig10 { --ig: 10; } .igs.ig11 { --ig: 11; } .igs.ig12 { --ig: 12; }
.igs.ig13 { --ig: 13; } .igs.ig14 { --ig: 14; } .igs.ig15 { --ig: 15; } .igs.ig16 { --ig: 16; }
.igs.iu2 { --iu: 2ch; } .igs.iu3 { --iu: 3ch; } .igs.iu4 { --iu: 4ch; } .igs.iu5 { --iu: 5ch; }
.igs.iu6 { --iu: 6ch; } .igs.iu7 { --iu: 7ch; } .igs.iu8 { --iu: 8ch; }
.no-code-guides .ed .igs, .no-code-guides .reading .igs { display: none; }
.reading .mk { color: var(--muted); }
:is(.reading, .ed .hw) table { border-collapse: collapse; margin: 0.8em 0; display: block; overflow: auto; }
:is(.reading, .ed .hw) :is(th, td) { border: 1px solid var(--border); padding: 6px 10px; text-align: left; overflow-wrap: normal; }
:is(.reading, .ed .hw) th { background: var(--bg-2); }
:is(.reading, .ed .hw) hr { border: none; border-top: 1px solid var(--border-strong); margin: 1.6em 0; }
.reading img.att { max-width: 100%; border-radius: 8px; }
.reading video.att { display: block; max-width: 100%; max-height: 520px; border-radius: 8px; background: #000; }
.reading audio.att { display: block; width: min(100%, 480px); }
.reading a.wl { color: var(--link); text-decoration: none; }
.reading a.wl:hover { text-decoration: underline; }
.reading a.wlb { color: var(--broken); text-decoration: underline dashed; }
.reading a.tg { color: var(--accent); background: var(--accent-bg); border-radius: 4px; padding: 0 3px; text-decoration: none; cursor: pointer; }
.reading .missing { color: var(--broken); font-size: 13px; }
:is(.reading, .ed .hw) .extimg { font-size: 14px; }
:where(.reading, .ed .hw) mark { background: var(--hl-bg); color: inherit; }
/* Colors in notes (crates/editor/src/color.rs): classes the editor and the
   sanitizer write, never a note's own CSS. Syntax near the caret stays
   gray; links, tags and code spans keep their look. */
:is(.ed, .reading, .swatches) .fg-gray:not(.mk, .a, .u, .wl, .wlb, .tg) { color: var(--fg-gray); }
:is(.ed, .reading, .swatches) .fg-red:not(.mk, .a, .u, .wl, .wlb, .tg) { color: var(--fg-red); }
:is(.ed, .reading, .swatches) .fg-orange:not(.mk, .a, .u, .wl, .wlb, .tg) { color: var(--fg-orange); }
:is(.ed, .reading, .swatches) .fg-yellow:not(.mk, .a, .u, .wl, .wlb, .tg) { color: var(--fg-yellow); }
:is(.ed, .reading, .swatches) .fg-green:not(.mk, .a, .u, .wl, .wlb, .tg) { color: var(--fg-green); }
:is(.ed, .reading, .swatches) .fg-blue:not(.mk, .a, .u, .wl, .wlb, .tg) { color: var(--fg-blue); }
:is(.ed, .reading, .swatches) .fg-purple:not(.mk, .a, .u, .wl, .wlb, .tg) { color: var(--fg-purple); }
:is(.ed, .reading, .swatches) .fg-pink:not(.mk, .a, .u, .wl, .wlb, .tg) { color: var(--fg-pink); }
:is(.ed, .reading, .swatches) .bg-gray:not(.c, .tg) { background: var(--bg-gray); }
:is(.ed, .reading, .swatches) .bg-red:not(.c, .tg) { background: var(--bg-red); }
:is(.ed, .reading, .swatches) .bg-orange:not(.c, .tg) { background: var(--bg-orange); }
:is(.ed, .reading, .swatches) .bg-yellow:not(.c, .tg) { background: var(--bg-yellow); }
:is(.ed, .reading, .swatches) .bg-green:not(.c, .tg) { background: var(--bg-green); }
:is(.ed, .reading, .swatches) .bg-blue:not(.c, .tg) { background: var(--bg-blue); }
:is(.ed, .reading, .swatches) .bg-purple:not(.c, .tg) { background: var(--bg-purple); }
:is(.ed, .reading, .swatches) .bg-pink:not(.c, .tg) { background: var(--bg-pink); }
/* HTML in notes: what crates/editor/src/html.rs keeps of it. */
:is(.reading, .ed .hw) :is(td, th)[align="center" i] { text-align: center; }
:is(.reading, .ed .hw) :is(td, th)[align="right" i] { text-align: right; }
:is(.reading, .ed .hw) :is(td, th)[align="justify" i] { text-align: justify; }
:is(.reading, .ed .hw) img[width] { height: auto; }
:is(.reading, .ed .hw) details { margin: 0.5em 0; }
:is(.reading, .ed .hw) summary { cursor: pointer; }
:is(.reading, .ed .hw) dt { font-weight: 600; }
:is(.reading, .ed .hw) dd { margin: 0 0 0.4em 1.4em; }
:is(.reading, .ed .hw) figure { margin: 0.8em 0; }
:is(.reading, .ed .hw) figcaption { color: var(--muted); font-size: 14px; }

/* ---------------------------------------------------------- callouts */
/* Callouts (crates/editor/src/callout.rs): each kind's color (--cc) and
   icon (--ci, a mask in the color); the box is tinted with the color. The
   same classes color the toolbar's menu. */
.callout-note, .callout-info, .callout-todo { --cc: var(--fg-blue); }
.callout-abstract, .callout-tip { --cc: var(--callout-cyan); }
.callout-important, .callout-example { --cc: var(--fg-purple); }
.callout-success { --cc: var(--fg-green); }
.callout-question { --cc: var(--fg-yellow); }
.callout-warning { --cc: var(--fg-orange); }
.callout-caution, .callout-failure, .callout-danger, .callout-bug { --cc: var(--fg-red); }
.callout-quote { --cc: var(--fg-gray); }
.callout-note { --ci: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 20h9'/><path d='M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4z'/></svg>"); }
.callout-abstract { --ci: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='8' y='2' width='8' height='4' rx='1'/><path d='M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2M9 12h6M9 16h6'/></svg>"); }
.callout-info { --ci: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='9'/><path d='M12 16v-4M12 8h.01'/></svg>"); }
.callout-todo { --ci: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='9'/><path d='m8.5 12 2.5 2.5 4.5-5'/></svg>"); }
.callout-tip { --ci: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 3c.5 3 2.5 4.5 4 6.5a6 6 0 1 1-10 1.5c.8 1.2 1.8 1.8 3 2-1-3 0-6.5 3-10z'/></svg>"); }
.callout-important { --ci: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M21 15a2 2 0 0 1-2 2H8l-5 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/><path d='M12 7v4M12 14h.01'/></svg>"); }
.callout-success { --ci: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M20 6 9 17l-5-5'/></svg>"); }
.callout-question { --ci: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='9'/><path d='M9.2 9a3 3 0 0 1 5.8 1c0 2-3 2.5-3 4M12 17h.01'/></svg>"); }
.callout-warning { --ci: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M10.3 3.9 2.4 17.5A2 2 0 0 0 4.1 20.5h15.8a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z'/><path d='M12 9v4M12 17h.01'/></svg>"); }
.callout-caution { --ci: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M7.9 2.5h8.2l5.4 5.4v8.2l-5.4 5.4H7.9l-5.4-5.4V7.9z'/><path d='M12 8v4M12 16h.01'/></svg>"); }
.callout-failure { --ci: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M18 6 6 18M6 6l12 12'/></svg>"); }
.callout-danger { --ci: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M13 2 3 14h9l-1 8 10-12h-9z'/></svg>"); }
.callout-bug { --ci: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='7' y='7' width='10' height='14' rx='5'/><path d='M12 11v10M9.5 4.5 11 7M14.5 4.5 13 7M3 13h4M17 13h4M4 8.5l3 1.5M20 8.5l-3 1.5M4 19l3-2M20 19l-3-2'/></svg>"); }
.callout-example { --ci: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M9 6h12M9 12h12M9 18h12M4 6h.01M4 12h.01M4 18h.01'/></svg>"); }
.callout-quote { --ci: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 17h3l2-4V7H5v6h3zM15 17h3l2-4V7h-6v6h3z'/></svg>"); }
.callout, .ed .ln.callout { --cbg: color-mix(in srgb, var(--cc) 10%, var(--bg)); }
/* The box's spacing, the same in the reading view and the editor: inside
   it, between its title and its text, and around a callout in a callout. */
.reading, .ed { --co-py: 0.55em; --co-px: 1em; --co-gap: 0.3em; --co-around: 0.8em; }
.co-icon { display: inline-block; flex: none; width: 1.05em; height: 1.05em; background: var(--cc); -webkit-mask: var(--ci) center / contain no-repeat; mask: var(--ci) center / contain no-repeat; }
/* Reading view: a box with the icon and title, the text below; one that
   folds is a details element, its marker a chevron on the right. */
.reading :is(div, details).callout { margin: var(--co-around) 0; padding: var(--co-py) var(--co-px); border-left: 3px solid var(--cc); border-radius: 0 8px 8px 0; background: var(--cbg); }
.reading .co-title { display: flex; align-items: center; gap: 0.45em; font-weight: 600; color: var(--cc); }
.reading .co-name { min-width: 0; }
.reading summary.co-title { list-style: none; cursor: pointer; }
.reading summary.co-title::-webkit-details-marker { display: none; }
.reading summary.co-title::after { content: ""; flex: none; width: 0.45em; height: 0.45em; margin: 0 0.2em 0 auto; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(-45deg); transition: transform 0.12s; }
.reading details.callout[open] > summary.co-title::after { transform: rotate(45deg); }
.reading .co-body { margin-top: var(--co-gap); }
.reading .co-body:empty { display: none; }
.reading .co-body > :first-child { margin-top: 0; }
.reading .co-body > :last-child { margin-bottom: 0; }
/* Editor: every line of a callout is a line of its box, padded at the top
   and bottom as the reading view's box is. The first holds the icon and the
   title (or, without one, the type: a widget), the last rounds the box off.
   A callout in a callout is a box in the outer one: its lines are tinted
   with the outer one's color (--cco) and paint the inner box over it, with
   room around it where the reading view has the outer one's padding and the
   inner one's margins. */
.in-note, .in-info, .in-todo { --cco: var(--fg-blue); }
.in-abstract, .in-tip { --cco: var(--callout-cyan); }
.in-important, .in-example { --cco: var(--fg-purple); }
.in-success { --cco: var(--fg-green); }
.in-question { --cco: var(--fg-yellow); }
.in-warning { --cco: var(--fg-orange); }
.in-caution, .in-failure, .in-danger, .in-bug { --cco: var(--fg-red); }
.in-quote { --cco: var(--fg-gray); }
.ed .ln.callout { color: var(--fg); background: var(--cbg); border-left-color: var(--cc); padding: 0 var(--co-px); }
.ed .ln.callout.cot { margin-top: 6px; padding-top: var(--co-py); border-top-right-radius: 8px; font-weight: 600; color: var(--cc); }
.ed .ln.callout.cot:not(.cob) { padding-bottom: var(--co-gap); }
.ed .ln.callout.cob { margin-bottom: 6px; padding-bottom: var(--co-py); border-bottom-right-radius: 8px; }
.ed.live .ln.callout.cot::before { content: ""; display: inline-block; width: 1.05em; height: 1.05em; margin-right: 0.45em; vertical-align: -0.2em; background: var(--cc); -webkit-mask: var(--ci) center / contain no-repeat; mask: var(--ci) center / contain no-repeat; }
.ed .cot-d { display: inline; }
.ed.live .ln.active .cot-d { display: none; }
.ed .ln.callout.nest {
  --top: 0px; --bottom: 0px;
  margin: 0; border-radius: 0; border-left-color: var(--cco);
  padding-left: calc(2 * var(--co-px) + 3px); padding-right: calc(2 * var(--co-px));
  background: linear-gradient(var(--cc), var(--cc)) var(--co-px) var(--top) / 3px calc(100% - var(--top) - var(--bottom)) no-repeat,
    linear-gradient(var(--cbg), var(--cbg)) calc(var(--co-px) + 3px) var(--top) / calc(100% - 2 * var(--co-px) - 3px) calc(100% - var(--top) - var(--bottom)) no-repeat,
    color-mix(in srgb, var(--cco) 10%, var(--bg));
}
/* After the outer one's text (not right under its title), and before more
   of it or at its end. */
.ed .ln.callout:not(.cot) + .ln.callout.nest.cot { --top: var(--co-around); padding-top: calc(var(--co-around) + var(--co-py)); }
.ed .ln.callout.nest.cob:has(+ .ln.callout) { --bottom: var(--co-around); padding-bottom: calc(var(--co-around) + var(--co-py)); }
.ed .ln.callout.nest.cob:not(:has(+ .ln.callout)) { --bottom: var(--co-py); margin-bottom: 6px; padding-bottom: calc(2 * var(--co-py)); border-bottom-right-radius: 8px; }

/* ---------------------------------------------------------- modals */
.modal-back { position: fixed; inset: 0; z-index: 90; background: rgba(15, 15, 20, 0.35); display: flex; align-items: flex-start; justify-content: center; padding: 10vh 16px 16px; animation: fade 0.12s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(520px, 100%); max-height: 80vh; display: flex; flex-direction: column; background: var(--bg); border-radius: 14px; border: 1px solid var(--border); box-shadow: var(--shadow); overflow: hidden; }
.modal.wide { width: min(820px, 100%); }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 4px 18px; }
.modal header h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 8px 18px 18px; overflow: auto; }
.modal-body h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 18px 0 6px; }
/* A question (views/ask.rs): over the modals and menus. */
.ask-back { z-index: 150; padding-top: 16vh; }
.modal.ask { width: min(440px, 100%); }
.ask-form { display: flex; flex-direction: column; gap: 10px; padding: 18px 18px 16px; overflow: auto; }
.ask-form h2 { margin: 0; font-size: 17px; overflow-wrap: anywhere; }
.ask-text { display: flex; flex-direction: column; gap: 8px; }
.ask-text p { margin: 0; color: var(--fg-2); overflow-wrap: anywhere; }
.ask-buttons { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.palette { width: min(640px, 100%); }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.palette-input input { flex: 1; border: none; outline: none; background: transparent; font: inherit; font-size: 17px; color: inherit; }
.palette-list { overflow: auto; padding: 6px; max-height: 55vh; }
.palette-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: none; border-radius: 8px; background: none; cursor: pointer; text-align: left; }
.palette-item.sel { background: var(--accent-bg); }
.palette-item .ic { color: var(--muted); width: 16px; height: 16px; }
.palette-item .muted { max-width: 45%; }
.palette-empty { padding: 18px; text-align: center; }
.search-bar { display: flex; gap: 8px; }
.search-bar .input:first-child { flex: 1; }
.results { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.result { text-align: left; padding: 8px 10px; border: none; border-radius: 8px; background: none; cursor: pointer; }
.result:hover { background: var(--bg-2); }
.r-title { font-weight: 600; }
.r-snip { color: var(--fg-2); font-size: 13.5px; }
.r-snip mark { background: var(--hl-bg); color: inherit; border-radius: 2px; }
.share-add { display: flex; gap: 8px; }
.found, .people { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.share-vault-hint { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin: 14px 0 6px; padding-top: 10px; border-top: 1px solid var(--border); }
.person { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; }
.person:hover { background: var(--bg-2); }
.person.big .avatar { width: 52px; height: 52px; font-size: 18px; }
.person.big .h { font-size: 18px; font-weight: 600; }
.vault-storage { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.vault-storage p { margin: 0; }
.vault-id-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vault-id { font-size: 12.5px; user-select: all; overflow-wrap: anywhere; }
.meter { height: 6px; border-radius: 3px; background: var(--bg-2); overflow: hidden; }
.meter-fill { height: 100%; background: var(--accent); }
.meter.full .meter-fill { background: var(--warn); }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin: 12px 0; }
.settings-grid .btn { justify-content: flex-start; min-width: 0; }
.danger-zone { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 14px; }
.audit { max-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; padding: 6px; }
.audit-row { display: flex; gap: 10px; align-items: baseline; padding: 3px 4px; font-size: 13px; }
.history { display: grid; grid-template-columns: 220px 1fr; gap: 14px; min-height: 340px; }
.h-list { display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--border); padding-right: 10px; overflow: auto; max-height: 60vh; }
.h-item { text-align: left; padding: 7px 9px; border: none; border-radius: 7px; background: none; cursor: pointer; }
.h-item:hover { background: var(--bg-2); }
.h-item.sel { background: var(--accent-bg); }
.h-preview { overflow: auto; max-height: 60vh; }
.h-preview .h-drawing { display: block; max-width: 100%; height: auto; margin-top: 8px; border: 1px solid var(--border); border-radius: var(--radius); }
.h-actions { display: flex; gap: 8px; position: sticky; top: 0; background: var(--bg); padding-bottom: 8px; }
table.keys { border-collapse: collapse; width: 100%; }
table.keys td { padding: 5px 4px; border-bottom: 1px solid var(--border); font-size: 14px; }
table.keys td:first-child { white-space: nowrap; width: 1%; padding-right: 16px; }

/* settings */
.settings { display: grid; grid-template-columns: 220px 1fr; gap: 24px; padding: 8px 32px 64px; max-width: 1080px; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; }
.settings-nav button { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: none; border-radius: 7px; background: none; cursor: pointer; text-align: left; color: var(--fg-2); }
.settings-nav button:hover { background: var(--bg-2); }
.settings-nav button.active { background: var(--accent-bg); color: var(--accent); }
.settings-body { min-width: 0; }
.settings-body h3 { margin: 22px 0 8px; font-size: 15px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin: 12px 0; }
.vault-search { margin: 8px 0; }
.vaults-of { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.admin-vaults .vault-id { margin-right: 6px; }
.stats div { display: flex; flex-direction: column; padding: 12px; border: 1px solid var(--border); border-radius: 10px; }
.stats b { font-size: 20px; }
.stats span { color: var(--muted); font-size: 12px; }

/* ---------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .panel { display: none; }
  .note-body.with-panel { --aside: 0px; }
  .note-body.overlay .panel { display: block; position: fixed; right: 0; top: 52px; bottom: 0; height: auto; z-index: 30; background: var(--bg); box-shadow: var(--shadow); }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; top: 0; bottom: 0; left: 0; width: min(310px, 86vw); transform: translateX(-102%); transition: transform 0.2s ease; box-shadow: var(--shadow); }
  .app.drawer .sidebar { transform: none; }
  .app.drawer .scrim { display: block; position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.3); }
  .mobile-only { display: inline-flex !important; }
  .desktop-only { display: none !important; }
  .note-main { padding: 10px 16px 40vh; }
  .note-title { font-size: 27px; }
  .page-body, .settings { padding: 8px 16px 64px; }
  .settings { grid-template-columns: 1fr; }
  .settings-nav { flex-direction: row; overflow: auto; }
  .note-head { padding: 6px 8px; gap: 2px; }
  .crumbs { display: none; }
  .toolbar-wrap { top: 48px; }
  .toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; border-radius: inherit; }
  .toolbar::-webkit-scrollbar { display: none; }
  /* The toolbar scrolls sideways, which would cut its menus off: they open
     below the whole toolbar instead (positioned by .toolbar-wrap). */
  .toolbar .tb-drop { position: static; }
  .toolbar .tb-drop .menu { top: calc(100% + 4px); left: 4px; }
  .history { grid-template-columns: 1fr; }
  .h-list { border-right: none; max-height: 30vh; }
  .modal-back { padding-top: 5vh; }
  .note-body.overlay .panel { width: 86vw; }
  .tree-more { opacity: 1; }
  .ed { font-size: 17px; }
  /* A table column is as wide as its text up to 12em, where longer text
     wraps, instead of being squeezed to fit the screen: the table scrolls. */
  .ed.live .ln.table > .td > .tc, .reading .tc { width: max-content; max-width: 12em; min-width: min-content; }
  .ed.live .ln.table > .td.ac > .tc, .reading .tc.ac { margin-inline: auto; }
  .ed.live .ln.table > .td.ar > .tc, .reading .tc.ar { margin-left: auto; }
  .qc-bar .btn { flex: 1; padding: 10px 14px; }
}
.note-title:focus-visible { box-shadow: 0 2px 0 0 var(--accent); }

/* Vault icons: a picture, an emoji or the generic icon. */
.vault-pic { width: 18px; height: 18px; border-radius: 4px; object-fit: cover; flex: none; }
.vault-emoji { display: inline-flex; justify-content: center; width: 18px; font-size: 15px; line-height: 1; flex: none; }
.card-icon .vault-pic { width: 36px; height: 36px; border-radius: 9px; }
.card-icon .vault-emoji { width: auto; font-size: 22px; }
.icon-pick { display: flex; gap: 14px; align-items: flex-start; margin: 14px 0 4px; }
.icon-now { width: 56px; height: 56px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 12px; background: var(--accent-bg); color: var(--accent); }
.icon-now .vault-pic { width: 56px; height: 56px; border-radius: 12px; }
.icon-now .vault-emoji, .icon-now .entry-icon { width: auto; font-size: 32px; }
.icon-now .ic { width: 26px; height: 26px; }
/* The icon picker: search, pictures, groups to jump to, every emoji. */
.emoji-picker { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.emoji-top { gap: 6px; }
.emoji-search { min-width: 0; }
.emoji-groups { display: flex; flex-wrap: wrap; gap: 2px; }
.emoji-group-btn { width: 30px; height: 30px; padding: 0; border: none; border-radius: 6px; background: none; cursor: pointer; font-size: 17px; line-height: 1; opacity: .7; }
.emoji-group-btn:hover, .emoji-group-btn:focus-visible { background: var(--bg-3); opacity: 1; }
.emoji-scroll { position: relative; height: 260px; overflow-y: auto; overscroll-behavior: contain; }
.emoji-group-name { position: sticky; top: 0; z-index: 1; padding: 4px 2px; background: var(--bg); color: var(--muted); font-size: 12px; font-weight: 600; }
.emoji-grid { display: flex; flex-wrap: wrap; gap: 2px; margin-bottom: 8px; }
.emoji-btn { width: 34px; height: 34px; border: 1px solid transparent; border-radius: 8px; background: none; cursor: pointer; font-size: 19px; line-height: 1; }
.emoji-btn:hover, .emoji-btn:focus-visible { background: var(--bg-3); }
.emoji-use { margin: 2px 0 8px; gap: 6px; }
.emoji-use-icon { font-size: 20px; line-height: 1; }
.emoji-none { margin: 8px 2px; }
label.btn { position: relative; }
label.btn.disabled { opacity: .6; pointer-events: none; }
.picture-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
.picture-choice { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; }
.picture-choice label.btn { margin-left: 4px; }
.pic-btn { padding: 4px; }
.pic-btn img { width: 100%; height: 100%; border-radius: 4px; object-fit: cover; display: block; }
.pic-btn:disabled { opacity: .6; cursor: default; }
.entry-icon { display: inline-flex; justify-content: center; width: 16px; font-size: 14px; line-height: 1; flex: none; }
/* A note's or folder's picture, where its emoji would be. */
img.entry-pic { width: 16px; height: 16px; border-radius: 3px; object-fit: cover; flex: none; }
.icon-now img.entry-pic { width: 56px; height: 56px; border-radius: 12px; }
.note-icon img.entry-pic { width: 36px; height: 36px; border-radius: 8px; }
.card-icon img.entry-pic { width: 36px; height: 36px; border-radius: 9px; }
.nc-title img.entry-pic { width: 1em; height: 1em; margin-right: 6px; vertical-align: -0.125em; }
.note-title-row { display: flex; align-items: center; gap: 8px; }
.note-title-row .note-title { flex: 1; min-width: 0; }
.note-icon { flex: none; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; font-size: 32px; line-height: 1; padding: 0; border: none; border-radius: 8px; background: none; cursor: pointer; }
.note-icon.add { color: var(--muted); opacity: .35; }
.note-icon.add .ic { width: 26px; height: 26px; }
.note-title-row:hover .note-icon.add, .note-icon.add:focus-visible { opacity: 1; }
@media (hover: none) { .note-icon.add { opacity: .6; } .qn-actions { opacity: 1; } .qn-actions .icon-btn.tiny { width: 32px; height: 32px; } }
.note-icon:hover:not(:disabled) { background: var(--bg-3); }
.note-icon:disabled { cursor: default; }
.nc-title .entry-icon { width: auto; margin-right: 6px; font-size: 1em; }
.card-icon .entry-icon { width: auto; font-size: 22px; }

/* A file's page: what it shows, and the notes using it. */
.attachment-page .note-title { font-size: 26px; }
.att-meta { margin: 0 0 14px; }
.att-preview { margin-bottom: 28px; }
.att-preview .att-view { display: block; max-width: 100%; max-height: 70vh; border-radius: 8px; }
.att-preview video.att-view { background: #000; }
.att-preview .att-audio { display: block; width: min(100%, 480px); }
.att-card { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; }
.att-card > .ic { width: 28px; height: 28px; color: var(--muted); flex: none; }
.att-card .grow { display: flex; flex-direction: column; gap: 2px; min-width: 10rem; }
.att-used h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 0 0 6px; }
.att-used .list-row .grow { display: flex; flex-direction: column; gap: 2px; }
.att-used .list-row > .ic { flex: none; color: var(--muted); }
.att-used .list-row > .muted { max-width: 40%; }

/* Graph view: the vault's notes and links on a canvas. */
.graph-page { height: 100%; }
.graph-page .page-head { flex-wrap: wrap; }
.graph-filter { width: 190px; }
.graph-orphans { margin: 0; font-size: 13px; white-space: nowrap; }
.graph-body { flex: 1; min-height: 360px; position: relative; }
.graph-wrap { position: absolute; inset: 0; overflow: hidden; }
.graph-wrap canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.graph-wrap canvas.on-node { cursor: pointer; }
.graph-tools { position: absolute; right: 10px; top: 10px; display: flex; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.graph-wrap.compact .graph-tools { top: auto; right: 6px; bottom: 6px; }
.graph-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; margin: 0; pointer-events: none; }
.local-graph { position: relative; height: 220px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.local-graph-section h3 .icon-btn { margin-left: auto; }
.sb-label .grow { flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (max-width: 720px) { .graph-filter { width: 140px; } }

/* ---------------------------------------------------------- comments */
.editor-area { position: relative; }
/* Above the comment highlights, which are drawn behind the text. */
.ed { position: relative; }
.ed-marks { position: absolute; inset: 0; pointer-events: none; }
.ed-marks .hl { position: absolute; border-radius: 2px; }
.ed-marks .hl.cm {
  background: color-mix(in srgb, var(--warn) 22%, transparent);
  box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--warn) 70%, transparent);
}
.ed-marks .hl.cm-open { background: color-mix(in srgb, var(--warn) 45%, transparent); }
.cm-offer {
  position: absolute; z-index: 30; transform: translate(-50%, calc(-100% - 6px));
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg); box-shadow: var(--shadow);
  font-size: 13px; color: var(--fg); cursor: pointer; white-space: nowrap;
}
.cm-offer .ic { width: 15px; height: 15px; }
.cm-offer:hover { background: var(--bg-3); }
.cm-pop {
  position: absolute; z-index: 35; width: min(360px, 100%); padding: 10px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--border); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 8px; font-size: 14px;
}
.cm-pop textarea { width: 100%; resize: vertical; min-height: 2.4em; font: inherit; }
.cm-actions { display: flex; align-items: center; gap: 6px; }
.cm-head { display: flex; align-items: center; gap: 4px; }
.cm-quote { font-size: 13px; color: var(--muted); font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-list { display: flex; flex-direction: column; gap: 10px; max-height: 50vh; overflow-y: auto; }
.cm-item { display: flex; gap: 8px; align-items: flex-start; }
.cm-item .avatar { flex: none; }
.cm-meta { font-size: 13px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 4px; }
.cm-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.cm-tools { margin-left: auto; display: inline-flex; gap: 8px; opacity: 0; }
.cm-item:hover .cm-tools, .cm-tools:focus-within { opacity: 1; }
.cm-unverified { color: var(--warn); }
.cm-confirm { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.cm-reply { display: flex; gap: 6px; align-items: flex-end; }
.cm-reply .mention-box { flex: 1; }
.cm-gone { font-style: italic; }
.linkish { border: none; background: none; padding: 0; color: var(--link); cursor: pointer; font: inherit; }
.linkish.danger { color: var(--danger); }
.cm-count { position: relative; }
.cm-count .badge {
  position: absolute; top: -2px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--accent); color: var(--accent-fg);
  font-size: 10.5px; font-weight: 700; line-height: 16px; text-align: center;
}
.cm-menu { width: min(340px, calc(100vw - 32px)); max-height: 60vh; overflow-y: auto; padding: 8px; }
.cm-entries { display: flex; flex-direction: column; }
.cm-entry { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; }
.cm-entry.resolved { opacity: .65; }
.cm-entry .cm-quote, .cm-entry .pi-snip { max-width: 100%; }
.share-comments, .viewers-comment { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0; }
/* The editor and the reading view: comment popups are placed in it. */
.note-content { position: relative; }
.reading .cmt {
  background: color-mix(in srgb, var(--warn) 22%, transparent);
  box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--warn) 70%, transparent);
  border-radius: 2px; cursor: pointer;
}
.reading .cmt.cmt-open { background: color-mix(in srgb, var(--warn) 45%, transparent); }
/* Mentions: in comments, the box that offers people, the inbox. */
.mention { color: var(--link); font-weight: 600; }
.mention.me { background: var(--accent-bg); border-radius: 3px; padding: 0 2px; }
.mention-box { position: relative; flex: 1; min-width: 0; }
.mention-box textarea { width: 100%; }
.mention-menu {
  position: absolute; left: 0; top: calc(100% + 2px); z-index: 40; min-width: 200px; max-width: 100%;
  display: flex; flex-direction: column; padding: 4px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.mention-menu button {
  display: flex; align-items: center; gap: 8px; padding: 5px 8px; border: none; border-radius: 6px;
  background: none; color: var(--fg); text-align: left; cursor: pointer; font-size: 14px;
}
.mention-menu button.on, .mention-menu button:hover { background: var(--bg-3); }
.mention-menu .avatar { flex: none; }
.sb-search-row { position: relative; display: flex; gap: 6px; align-items: center; }
.sb-search-row .sb-search { flex: 1; min-width: 0; }
/* The inbox opens below the row, as wide as the sidebar. */
.sb-search-row .tb-drop { position: static; }
.sb-search-row .tb-drop .menu.mentions-menu { left: 0; right: 0; top: calc(100% + 4px); max-height: 70vh; overflow-y: auto; padding: 8px; }
.mentions-head { display: flex; align-items: center; gap: 8px; padding: 2px 6px 8px; }
.menu .mention-item { align-items: flex-start; width: 100%; }
.mention-item.unread { background: var(--accent-bg); }
.mention-item .avatar { flex: none; }
.mention-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.mention-title, .mention-snip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mention-snip { font-size: 13px; }
.mention-item .dot { flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--accent); }
.mentions-none { padding: 4px 6px; margin: 0; }
@media (pointer: coarse) { .cm-tools { opacity: 1; } }

.instance-settings .limits { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 16px; margin: 10px 0; }
.limit-field { display: flex; align-items: center; gap: 8px; }
.limit-field .limit-label { flex: 1; min-width: 0; }
.limit-field .num { width: 90px; }
.admin-users .list-row.col > .row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
/* The details keep a readable width: without room beside them, the buttons
   go under them, together. */
.admin-users .list-row.col > .row > .grow { flex: 1 1 16rem; min-width: 0; }
.admin-users .row-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.allowances { display: flex; flex-direction: column; gap: 8px; padding: 10px 0 2px 42px; }
.allowances .limit-field { max-width: 460px; }
.nowrap { white-space: nowrap; flex: none; }
.admin-client-new .scopes { display: flex; flex-direction: column; margin: 4px 0 10px; }
.admin-client-new .scopes .check { margin: 3px 0; }
.export-choice { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin: 8px 0 12px; }
.export-choice .check { margin: 0; min-width: 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.export-choice .check:has(input:checked) { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background: var(--accent-bg); }
.export-choice .check:has(input:disabled) { opacity: 0.55; cursor: default; }
.export-choice .check .grow { min-width: 0; }
.export-choice .check .pill { margin-left: 0; flex: none; }
.notion-items { grid-template-columns: 1fr; max-height: 50vh; overflow-y: auto; }
.notion-items .notion-icon { flex: none; }
.notion-items .muted { flex: none; }

/* Drawings: the page of one, and previews where notes embed them. */
.drawing-page { height: 100%; }
.drawing-page .note-head .menu button { white-space: nowrap; }
.drawing-stage { flex: 1; position: relative; min-height: 0; overflow: hidden; }
.drawing-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; cursor: grab; }
.drawing-zoom { position: absolute; left: 12px; bottom: 12px; display: flex; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); overflow: hidden; }
.drawing-zoom button { border: 0; background: none; color: var(--text); padding: 6px 10px; min-width: 34px; cursor: pointer; font: inherit; }
.drawing-zoom button:hover { background: var(--hover, var(--accent-bg)); }
.drawing-zoom .zoom-value { min-width: 64px; font-variant-numeric: tabular-nums; }
.drawing-page:focus { outline: none; }
.drawing-tools { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 2px; padding: 4px; border: 1px solid var(--border); border-radius: calc(var(--radius) + 2px); background: var(--bg); box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08); z-index: 2; max-width: calc(100% - 24px); overflow-x: auto; }
.drawing-tools .dt { border: 0; background: none; color: var(--text); width: 34px; height: 34px; border-radius: var(--radius); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.drawing-tools .dt:hover { background: var(--accent-bg); }
.drawing-tools .dt.on { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); }
.drawing-tools .dt-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; flex: none; }
.drawing-props { position: absolute; top: 64px; left: 12px; width: 212px; max-height: calc(100% - 128px); overflow-y: auto; padding: 10px; border: 1px solid var(--border); border-radius: calc(var(--radius) + 2px); background: var(--bg); box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08); z-index: 2; display: flex; flex-direction: column; gap: 10px; }
.drawing-props .prop { display: flex; flex-direction: column; gap: 4px; }
.drawing-props .prop-name { font-size: 12px; color: var(--muted, var(--text)); opacity: 0.8; }
.drawing-props .picks { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.drawing-props .pick { border: 1px solid var(--border); background: var(--bg); color: var(--text); min-width: 28px; height: 28px; padding: 0 6px; border-radius: var(--radius); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font: inherit; font-size: 12px; }
.drawing-props .pick.on { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }
.drawing-props .pick .swatch { width: 16px; height: 16px; border-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.12); }
.drawing-props .pick-hex { width: 72px; height: 28px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text); padding: 0 6px; font: inherit; font-size: 12px; }
.drawing-props input[type=range] { width: 100%; }
.drawing-props .color-more { display: contents; }
.drawing-props .color-grid { flex-basis: 100%; display: grid; grid-template-columns: repeat(5, 28px); gap: 4px; padding: 6px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-2, var(--bg)); }
.drawing-props .pick-font { flex-basis: 100%; height: 28px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text); font: inherit; font-size: 12px; }
.drawing-history { position: absolute; left: 196px; bottom: 12px; display: flex; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); overflow: hidden; }
.drawing-history button { border: 0; background: none; color: var(--text); padding: 6px 8px; cursor: pointer; display: inline-flex; }
.drawing-history button:hover { background: var(--accent-bg); }
.drawing-snap { position: absolute; left: 274px; bottom: 12px; display: flex; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); overflow: hidden; }
.drawing-snap button { border: 0; background: none; color: var(--text); padding: 6px 8px; cursor: pointer; display: inline-flex; }
.drawing-snap button:hover { background: var(--accent-bg); }
.drawing-snap button.on { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); }
.drawing-text { position: absolute; z-index: 3; margin: 0; padding: 0; border: 0; outline: none; resize: none; overflow: hidden; background: transparent; white-space: pre; field-sizing: content; }
.drawing-text.drawing-frame-name { padding: 6px; border-radius: 4px; box-shadow: inset 0 0 0 1px var(--accent); }
/* The library panel (Excalidraw's library sidebar). */
.library-panel { position: absolute; top: 64px; right: 12px; bottom: 12px; width: 264px; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: calc(var(--radius) + 2px); background: var(--bg); box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08); z-index: 3; overflow: hidden; }
.library-head { display: flex; align-items: center; gap: 2px; padding: 6px 6px 6px 12px; border-bottom: 1px solid var(--border); }
.library-title { font-weight: 600; }
.library-items { flex: 1; overflow-y: auto; padding: 10px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; align-content: start; }
.library-count { font-variant-numeric: tabular-nums; }
.library-unit { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: 6px 6px 4px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text); cursor: pointer; overflow: hidden; font: inherit; min-width: 0; }
.library-unit:hover, .library-unit:focus-visible { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.library-unit.picked { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--bg)); }
.library-pic { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; min-width: 0; }
.library-unit img { max-width: 100%; max-height: 100%; pointer-events: none; }
/* The name under the picture (a line kept for shapes without one). */
.library-name { display: block; min-height: 1.35em; font-size: 11px; line-height: 1.35; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--fg-2); }
.library-rename { display: block; min-width: 0; }
.library-rename .input { width: 100%; padding: 1px 4px; font-size: 11px; }
.library-pending { border-style: dashed; }
.library-adder { position: absolute; right: 4px; bottom: 4px; display: inline-flex; width: 20px; height: 20px; align-items: center; justify-content: center; border-radius: 50%; background: var(--accent); color: #fff; }
.library-adder .ic { width: 14px; height: 14px; }
/* Excalidraw's checkbox (on hover, or while picked), and the shape's own actions. */
.library-check { position: absolute; top: 2px; left: 2px; display: none; background: var(--bg); border: 1px solid var(--border); }
.library-unit.picked .library-check { display: inline-flex; background: var(--accent); border-color: var(--accent); color: #fff; }
.library-actions { position: absolute; top: 2px; right: 2px; display: none; gap: 1px; }
.library-actions .icon-btn { background: var(--bg); }
.library-unit:hover .library-check, .library-unit:focus-within .library-check,
.library-unit:hover .library-actions, .library-unit:focus-within .library-actions { display: inline-flex; }
.library-empty { grid-column: 1 / -1; margin: 4px 2px; font-size: 13px; }
@media (hover: none) {
  .library-check, .library-actions { display: inline-flex; }
}
@media (max-width: 700px) {
  .drawing-props { top: auto; bottom: 60px; width: auto; right: 12px; max-height: 40%; }
  .drawing-tools { top: 8px; }
  .library-panel { left: 12px; width: auto; bottom: auto; max-height: 55%; }
}
.drawings-page .page-head { display: flex; align-items: center; gap: 12px; }
.drawings-page .page-head h1 { flex: 1; }
.drawing-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; padding: 4px 16px 24px; }
.drawings-page .empty { padding: 0 16px; }
.drawing-card { display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid var(--border); border-radius: calc(var(--radius) + 2px); background: var(--bg); color: var(--text); cursor: pointer; text-align: left; font: inherit; }
.drawing-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.drawing-thumb { display: flex; align-items: center; justify-content: center; height: 140px; overflow: hidden; border-radius: var(--radius); background: var(--bg-soft, transparent); }
.drawing-thumb img { max-width: 100%; max-height: 100%; }
.drawing-name { font-weight: 500; }
.drawing-folder { margin-top: -4px; }
