/* GetOrizon — a local notebook with a bright "work desk" look: pale-blue ground, white rounded sheets,
   navy ink, a small saturated palette. Figtree is self-hosted (see /fonts); no remote assets. */
:root {
  --font: 'Figtree', ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, "Apple Color Emoji", Arial, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
  --serif: Lyon-Text, Georgia, ui-serif, serif;
  --mono: "SFMono-Regular", Menlo, Consolas, "PT Mono", "Liberation Mono", Courier, monospace;
  --bg: #ffffff;
  --bg-sidebar: #eef3fc;
  --bg-hover: rgba(91, 63, 214, 0.07);
  --bg-active: rgba(91, 63, 214, 0.12);
  --bg-subtle: #f4f7fe;
  --bg-elevated: #ffffff;
  --bg-code: #f4f7fe;
  --bg-inline-code: rgba(91, 63, 214, 0.08);
  --text: #1b0f4d;
  --text-2: #4a4470;
  --text-3: #6b6790;
  --border-input: #8a85ad;
  --accent-strong: #c2268d;
  --text-sidebar: #4a4470;
  --border: #e2e7f4;
  --border-strong: #cdd5ea;
  --accent: #265fd0;
  --accent-soft: rgba(38, 95, 208, 0.16);
  --accent-text: #fff;
  --danger: #d3304e;
  --select: rgba(60, 198, 239, 0.22);
  --shadow: 0 0 0 1px rgba(27, 15, 77, 0.05), 0 4px 10px rgba(27, 15, 77, 0.08), 0 18px 40px -12px rgba(27, 15, 77, 0.25);
  --shadow-sm: 0 0 0 1px rgba(27, 15, 77, 0.05), 0 2px 6px rgba(27, 15, 77, 0.07);
  --sidebar-w: 248px;
  --radius: 10px;
  --c-gray: rgb(120, 119, 116); --c-brown: rgb(159, 107, 83); --c-orange: rgb(217, 115, 13); --c-yellow: rgb(203, 145, 47); --c-green: rgb(68, 131, 97); --c-blue: rgb(51, 126, 169); --c-purple: rgb(144, 101, 176); --c-pink: rgb(193, 76, 138); --c-red: rgb(212, 76, 71);
  --bg-gray: rgb(241, 241, 239); --bg-brown: rgb(244, 238, 238); --bg-orange: rgb(251, 236, 221); --bg-yellow: rgb(251, 243, 219); --bg-green: rgb(237, 243, 236); --bg-blue: rgb(231, 243, 248); --bg-purple: rgba(244, 240, 247, 0.8); --bg-pink: rgba(249, 238, 243, 0.8); --bg-red: rgb(253, 235, 236);
  --tag-default: rgba(227, 226, 224, 0.5); --tag-gray: rgb(227, 226, 224); --tag-brown: rgb(238, 224, 218); --tag-orange: rgb(250, 222, 201); --tag-yellow: rgb(253, 236, 200); --tag-green: rgb(219, 237, 219); --tag-blue: rgb(211, 229, 239); --tag-purple: rgb(232, 222, 238); --tag-pink: rgb(245, 224, 233); --tag-red: rgb(255, 226, 221);
  --tag-text: rgb(50, 48, 44);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1340; --bg-sidebar: #0f0a26; --bg-hover: rgba(173, 156, 255, 0.1); --bg-active: rgba(173, 156, 255, 0.17); --bg-subtle: #221a4d; --bg-elevated: #221a4d; --bg-code: #221a4d; --bg-inline-code: rgba(173, 156, 255, 0.14);
    --text: #f4f2ff; --text-2: #c7c2ea; --text-3: #a29dcb; --border-input: #7d76b0; --accent-text: #86adff; --text-sidebar: #c7c2ea; --border: #2d2560; --border-strong: #3d3478;
    --accent: #3a6fdc; --select: rgba(106, 217, 248, 0.24);
    --shadow: 0 0 0 1px rgba(0, 0, 0, 0.25), 0 4px 10px rgba(0, 0, 0, 0.3), 0 18px 40px -12px rgba(0, 0, 0, 0.6); --shadow-sm: 0 0 0 1px rgba(0, 0, 0, 0.25), 0 2px 6px rgba(0, 0, 0, 0.3);
    --c-gray: rgb(155, 155, 155); --c-brown: rgb(186, 133, 111); --c-orange: rgb(199, 125, 72); --c-yellow: rgb(202, 152, 73); --c-green: rgb(82, 158, 114); --c-blue: rgb(94, 135, 201); --c-purple: rgb(157, 104, 211); --c-pink: rgb(209, 87, 150); --c-red: rgb(223, 84, 82);
    --bg-gray: rgb(47, 47, 47); --bg-brown: rgb(74, 50, 40); --bg-orange: rgb(92, 59, 35); --bg-yellow: rgb(86, 67, 40); --bg-green: rgb(36, 61, 48); --bg-blue: rgb(20, 58, 78); --bg-purple: rgb(60, 45, 73); --bg-pink: rgb(78, 44, 60); --bg-red: rgb(82, 46, 42);
    --tag-default: rgba(255, 255, 255, 0.094); --tag-gray: rgb(71, 71, 71); --tag-brown: rgb(92, 71, 61); --tag-orange: rgb(136, 84, 44); --tag-yellow: rgb(146, 118, 63); --tag-green: rgb(50, 82, 65); --tag-blue: rgb(42, 78, 107); --tag-purple: rgb(83, 68, 116); --tag-pink: rgb(106, 59, 99); --tag-red: rgb(110, 54, 48);
    --tag-text: rgba(255, 255, 255, 0.88);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1a1340; --bg-sidebar: #0f0a26; --bg-hover: rgba(173, 156, 255, 0.1); --bg-active: rgba(173, 156, 255, 0.17); --bg-subtle: #221a4d; --bg-elevated: #221a4d; --bg-code: #221a4d; --bg-inline-code: rgba(173, 156, 255, 0.14);
  --text: #f4f2ff; --text-2: #c7c2ea; --text-3: #a29dcb; --border-input: #7d76b0; --accent-text: #86adff; --text-sidebar: #c7c2ea; --border: #2d2560; --border-strong: #3d3478;
  --accent: #3a6fdc; --select: rgba(106, 217, 248, 0.24);
  --shadow: 0 0 0 1px rgba(0, 0, 0, 0.25), 0 4px 10px rgba(0, 0, 0, 0.3), 0 18px 40px -12px rgba(0, 0, 0, 0.6); --shadow-sm: 0 0 0 1px rgba(0, 0, 0, 0.25), 0 2px 6px rgba(0, 0, 0, 0.3);
  --c-gray: rgb(155, 155, 155); --c-brown: rgb(186, 133, 111); --c-orange: rgb(199, 125, 72); --c-yellow: rgb(202, 152, 73); --c-green: rgb(82, 158, 114); --c-blue: rgb(94, 135, 201); --c-purple: rgb(157, 104, 211); --c-pink: rgb(209, 87, 150); --c-red: rgb(223, 84, 82);
  --bg-gray: rgb(47, 47, 47); --bg-brown: rgb(74, 50, 40); --bg-orange: rgb(92, 59, 35); --bg-yellow: rgb(86, 67, 40); --bg-green: rgb(36, 61, 48); --bg-blue: rgb(20, 58, 78); --bg-purple: rgb(60, 45, 73); --bg-pink: rgb(78, 44, 60); --bg-red: rgb(82, 46, 42);
  --tag-default: rgba(255, 255, 255, 0.094); --tag-gray: rgb(71, 71, 71); --tag-brown: rgb(92, 71, 61); --tag-orange: rgb(136, 84, 44); --tag-yellow: rgb(146, 118, 63); --tag-green: rgb(50, 82, 65); --tag-blue: rgb(42, 78, 107); --tag-purple: rgb(83, 68, 116); --tag-pink: rgb(106, 59, 99); --tag-red: rgb(110, 54, 48);
  --tag-text: rgba(255, 255, 255, 0.88);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
a { color: inherit; }
::selection { background: rgba(60, 198, 239, 0.3); }
.grow { flex: 1; }
.muted { color: var(--text-2); }
.hidden { display: none !important; }
.ic { display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ic svg { display: block; }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none; }
body.is-resizing, body.is-resizing * { cursor: col-resize !important; user-select: none; }

/* ---------- Layout ---------- */
#app { display: flex; height: 100vh; }
.sidebar { width: var(--sidebar-w); flex: none; background: var(--bg-sidebar); display: flex; flex-direction: column; position: relative; transition: margin-left 0.2s ease; color: var(--text-sidebar); user-select: none; border-right: 1px solid var(--border); }
body.sidebar-closed .sidebar { margin-left: calc(-1 * var(--sidebar-w)); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.view { flex: 1; overflow-y: auto; overflow-x: hidden; outline: none; }

/* ---------- Buttons ---------- */
.btn-icon { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; border-radius: 5px; color: var(--text-2); transition: background 0.1s; }
.btn-icon:hover { background: var(--bg-hover); color: var(--text); }
.btn-icon:disabled { opacity: 0.35; cursor: default; background: none; }
.btn-icon.accent { color: var(--accent); }
.btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--border-strong); font-size: 14px; color: var(--text); text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--bg-hover); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--accent-strong, #1a6fc4); color: #fff; box-shadow: none; font-weight: 500; }
.btn-primary:hover { background: #155ea8; }
.btn-danger { background: var(--danger); color: #fff; box-shadow: none; font-weight: 500; }
.btn-danger:hover { background: rgb(214, 70, 70); }
.btn-sm { height: 28px; padding: 0 9px; font-size: 13px; }
.btn-ghost { display: inline-flex; align-items: center; gap: 5px; border-radius: 5px; color: var(--text-2); padding: 0 8px; height: 28px; font-size: 13px; }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.input { width: 100%; height: 32px; padding: 0 10px; border-radius: var(--radius); border: 0; box-shadow: inset 0 0 0 1px var(--border-input, var(--border-strong)); background: var(--bg-subtle); outline: none; font-size: 14px; }
.input:focus { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-soft); }

/* ---------- Sidebar ---------- */
.sb-top { display: flex; align-items: center; gap: 2px; padding: 8px 8px 4px 8px; }
.sb-workspace { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 6px; border-radius: 6px; font-weight: 600; color: var(--text); text-align: left; }
.sb-workspace:hover { background: var(--bg-hover); }
.sb-avatar { width: 22px; height: 22px; border-radius: 5px; background: linear-gradient(135deg, #ff9966, #ff5e62); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; flex: none; }
.sb-ws-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.sb-ws-chevron { color: var(--text-3); }
.sb-collapse, .sb-new-top { opacity: 0; }
.sidebar:hover .sb-collapse, .sidebar:hover .sb-new-top { opacity: 1; }
.sb-new-top { opacity: 1; }
.sb-nav { padding: 2px 8px 8px; display: flex; flex-direction: column; gap: 1px; }
.sb-item { display: flex; align-items: center; gap: 8px; width: 100%; height: 30px; padding: 0 8px; border-radius: 6px; font-size: 14px; font-weight: 500; text-align: left; color: var(--text-sidebar); }
.sb-item:hover { background: var(--bg-hover); }
.sb-icon { width: 22px; display: flex; justify-content: center; color: var(--text-sidebar); }
.sb-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-kbd { font-size: 11px; color: var(--text-3); font-weight: 400; }
.sb-scroll { flex: 1; overflow-y: auto; padding: 0 8px 12px; }
.sb-section { margin-top: 12px; }
.sb-section:first-child:empty { display: none; }
.sb-section-head { display: flex; align-items: center; height: 26px; padding: 0 4px 0 8px; border-radius: 6px; }
.sb-section-head:hover { background: var(--bg-hover); }
.sb-section-label { flex: 1; text-align: left; font-size: 12px; font-weight: 500; color: var(--text-3); }
.sb-section-add { opacity: 0; width: 22px; height: 22px; min-width: 22px; }
.sb-section-head:hover .sb-section-add { opacity: 1; }
.sb-section-head.drop-inside { box-shadow: inset 0 0 0 2px var(--accent); }
.sb-row { display: flex; align-items: center; height: 30px; padding: 0 4px 0 6px; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 500; position: relative; }
.sb-row:hover { background: var(--bg-hover); }
.sb-row.active { background: var(--bg-active); color: var(--text); }
.sb-row.dragging { opacity: 0.4; }
.sb-row.drop-inside { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.sb-row.drop-before::before, .sb-row.drop-after::after { content: ''; position: absolute; left: 6px; right: 6px; height: 3px; border-radius: 2px; background: var(--accent); opacity: 0.7; }
.sb-row.drop-before::before { top: -2px; }
.sb-row.drop-after::after { bottom: -2px; }
.sb-indent { flex: none; }
.sb-page-icon { width: 24px; height: 24px; flex: none; display: grid; place-items: center; position: relative; margin-right: 6px; border-radius: 4px; }
.sb-page-icon > * { grid-area: 1 / 1; }
.sb-page-icon .page-emoji { font-size: 16px; line-height: 1; text-align: center; }
.sb-page-icon .page-glyph { color: var(--text-3); }
.sb-chevron { position: relative; z-index: 1; width: 22px; height: 22px; border-radius: 4px; display: grid; place-items: center; opacity: 0; color: var(--text-2); background: var(--bg-sidebar); }
.sb-chevron:hover { background: var(--bg-active); }
.sb-row:hover .sb-chevron { opacity: 1; }
.sb-row:hover .sb-page-icon > :first-child { opacity: 0; pointer-events: none; }
.sb-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-row-actions { display: none; gap: 1px; }
.sb-row:hover .sb-row-actions { display: flex; }
.sb-row-btn { width: 22px; height: 22px; min-width: 22px; }
.sb-row-btn:hover { background: var(--bg-active); }
.sb-empty { font-size: 13px; color: var(--text-3); padding: 4px 8px 4px 36px; height: 28px; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-bottom { padding: 6px 8px 10px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 1px; }
.sb-new { color: var(--text-2); }
.sb-resizer { position: absolute; top: 0; right: -4px; width: 8px; height: 100%; cursor: col-resize; z-index: 5; }
.sb-resizer::after { content: ''; position: absolute; top: 0; bottom: 0; left: 3px; width: 2px; background: transparent; transition: background 0.15s; }
.sb-resizer:hover::after { background: var(--border-strong); }

/* ---------- Topbar ---------- */
.topbar { height: 45px; flex: none; display: flex; align-items: center; gap: 4px; padding: 0 12px; position: relative; z-index: 3; background: var(--bg); }
.crumbs { display: flex; align-items: center; min-width: 0; overflow: hidden; }
.crumb { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 6px; border-radius: 5px; text-decoration: none; color: var(--text); font-size: 14px; white-space: nowrap; min-width: 0; }
.crumb:hover { background: var(--bg-hover); }
.crumb .page-emoji { font-size: 15px; line-height: 1; }
.crumb .page-glyph { color: var(--text-2); }
.crumb-title { overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.crumb-sep { color: var(--text-3); margin: 0 1px; }
.tb-status { font-size: 13px; color: var(--text-3); margin-right: 8px; white-space: nowrap; }
.fav-on { color: rgb(233, 178, 49) !important; }
.tb-open-sidebar { margin-right: 4px; }

/* ---------- Page ---------- */
.page-view { --content: 920px; --pad: clamp(56px, 5vw, 80px); min-height: 100%; position: relative; padding-bottom: 30vh; }
.page-view.full-width { --content: 100%; }
.page-view.in-peek { --pad: 56px; }
.page-view.font-serif .page-inner, .page-view.font-serif .page-title { font-family: var(--serif); }
.page-view.font-mono .page-inner, .page-view.font-mono .page-title { font-family: var(--mono); }
.page-view.small-text .editor { font-size: 14px; }
.page-cover { height: 30vh; max-height: 280px; min-height: 180px; position: relative; background-size: cover; background-position: center 50%; display: none; }
.page-cover.has-cover { display: block; }
.page-cover.repositioning { cursor: ns-resize; }
.cover-actions { position: absolute; right: max(var(--pad), calc((100% - var(--content)) / 2)); bottom: 12px; display: flex; gap: 0; opacity: 0; transition: opacity 0.15s; background: var(--bg-elevated); border-radius: 5px; box-shadow: var(--shadow-sm); overflow: hidden; }
.page-cover:hover .cover-actions, .page-cover.repositioning .cover-actions { opacity: 1; }
.cover-btn { font-size: 12px; padding: 4px 8px; color: var(--text-2); }
.cover-btn:hover { background: var(--bg-hover); }
.cover-btn + .cover-btn { border-left: 1px solid var(--border); }
.page-inner { width: 100%; max-width: calc(var(--content) + 2 * var(--pad)); margin: 0 auto; padding: 0 var(--pad); }
.page-head { position: relative; padding-top: 80px; }
.page-view.with-cover .page-head { padding-top: 0; }
.page-view.with-cover:not(.with-icon) .page-head { padding-top: 24px; }
.page-icon-wrap:empty { display: none; }
.page-icon { font-size: 78px; line-height: 1.1; width: 88px; height: 88px; display: flex; align-items: center; justify-content: center; border-radius: 6px; margin-left: -4px; }
.page-icon:hover { background: var(--bg-hover); }
.page-view.with-cover .page-icon-wrap { margin-top: -44px; position: relative; z-index: 1; }
.page-controls { display: flex; gap: 2px; height: 28px; margin: 8px 0 4px -6px; opacity: 0; transition: opacity 0.15s; }
.page-head:hover .page-controls, .page-controls:focus-within { opacity: 1; }
.page-controls:empty { height: 8px; }
.ctl-btn { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; border-radius: 5px; font-size: 14px; color: var(--text-3); }
.ctl-btn:hover { background: var(--bg-hover); color: var(--text-2); }
.page-title { font-size: 40px; font-weight: 700; line-height: 1.2; outline: none; padding: 3px 2px; margin-bottom: 4px; word-break: break-word; letter-spacing: -0.01em; }
.page-title:empty::before { content: attr(data-ph); color: var(--text-3); opacity: 0.6; }
.page-view.small-text .page-title { font-size: 32px; }
.page-body { position: relative; margin-top: 6px; }
.page-below { min-height: 160px; cursor: text; }
.page-db { width: 100%; padding: 0 var(--pad); max-width: calc(var(--content) + 2 * var(--pad)); margin: 0 auto; }
.page-view.is-database .page-db { max-width: none; padding: 0 var(--pad); }
.page-view.is-database { --content: 1200px; }
.page-missing { max-width: 460px; margin: 18vh auto; text-align: center; padding: 0 24px; }
.page-missing-icon { font-size: 56px; }
.page-missing h2 { font-size: 20px; margin: 12px 0 6px; }
.page-missing p { color: var(--text-2); margin: 0 0 20px; }

/* Properties */
.page-props { margin: 6px 0 10px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.prop-row { display: flex; align-items: flex-start; min-height: 34px; }
.prop-label { width: 160px; flex: none; display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 6px; border-radius: 5px; color: var(--text-2); font-size: 14px; text-align: left; }
.prop-label span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prop-label:hover { background: var(--bg-hover); }
.prop-value { flex: 1; min-width: 0; min-height: 34px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 6px 8px; border-radius: 5px; cursor: pointer; font-size: 14px; }
.prop-value:hover { background: var(--bg-hover); }
.prop-empty { color: var(--text-3); }
.prop-add { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 6px; border-radius: 5px; color: var(--text-3); font-size: 14px; margin-top: 2px; }
.prop-add:hover { background: var(--bg-hover); color: var(--text-2); }

/* Backlinks */
.work-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 2px 0 8px; font-size: 14px; }
.work-links-label { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); margin-right: 2px; }
.work-link { display: inline-flex; align-items: center; gap: 6px; max-width: 320px; padding: 2px 8px; border-radius: 5px; border: 1px solid var(--border-strong); color: var(--text); text-decoration: none; }
.work-link span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-link:hover { background: var(--bg-hover); }
.work-link-key { color: var(--text-2); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.backlinks { margin: 2px 0 8px; }
.backlinks-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text-2); padding: 2px 6px; border-radius: 5px; margin-left: -6px; }
.backlinks-toggle:hover { background: var(--bg-hover); }
.backlinks-toggle .ic { transition: transform 0.15s; }
.backlinks.open .backlinks-toggle .ic { transform: rotate(90deg); }
.backlinks-list { display: none; padding: 4px 0 4px 16px; }
.backlinks.open .backlinks-list { display: block; }
.backlink { display: flex; align-items: center; gap: 6px; padding: 3px 6px; border-radius: 5px; text-decoration: none; font-size: 14px; }
.backlink span:last-child { border-bottom: 1px solid var(--border-strong); }
.backlink:hover { background: var(--bg-hover); }

/* ---------- Editor ---------- */
.editor { font-size: 16px; line-height: 1.5; outline: none; position: relative; caret-color: var(--text); }
.blk { position: relative; margin: 1px 0; padding-left: calc(var(--indent, 0) * 26px); }
.blk-content { position: relative; display: flex; align-items: flex-start; min-height: 30px; border-radius: 4px; }
.blk.selected > .blk-content { background: var(--select); }
.blk.selected .blk-content * { user-select: none; }
.blk-handle { position: absolute; left: calc(var(--indent, 0) * 26px - 46px); top: 3px; display: flex; gap: 0; opacity: 0; transition: opacity 0.12s; z-index: 2; }
.blk:hover > .blk-handle, .blk.selected > .blk-handle { opacity: 1; }
body.is-dragging .blk-handle { opacity: 0 !important; }
.blk-btn { width: 24px; height: 24px; border-radius: 4px; display: grid; place-items: center; color: var(--text-3); }
.blk-btn:hover { background: var(--bg-hover); color: var(--text-2); }
.blk-grip { width: 18px; cursor: grab; }
.blk-text { flex: 1; min-width: 1px; padding: 3px 2px; outline: none; white-space: pre-wrap; word-break: break-word; min-height: 1.5em; }
.blk-text:empty::before { content: attr(data-ph); color: var(--text-3); pointer-events: none; }
.blk-paragraph .blk-text:empty:not(:focus)::before { content: ''; }
.editor.is-empty::before { content: 'Cliquez ici pour commencer à écrire, ou tapez « / » pour les commandes…'; color: var(--text-3); display: block; padding: 3px 2px; pointer-events: none; }
.blk-text b { font-weight: 600; }
.blk-text code, .blk-caption code { font-family: var(--mono); font-size: 85%; background: var(--bg-inline-code); color: #eb5757; border-radius: 4px; padding: 0.2em 0.4em; }
.blk-text a:not(.mention), .blk-caption a:not(.mention) { color: inherit; text-decoration: underline; text-decoration-color: var(--text-3); text-underline-offset: 2px; cursor: pointer; }
.blk-text a:not(.mention):hover { text-decoration-color: var(--text); }
.blk-text s { color: inherit; }
a.mention { text-decoration: none; cursor: pointer; border-radius: 3px; padding: 0 2px; white-space: nowrap; }
a.mention::before { content: attr(data-icon); margin-right: 3px; font-size: 0.95em; }
a.mention:not([data-icon])::before { content: ''; display: inline-block; width: 0.95em; height: 0.95em; margin-right: 4px; vertical-align: -0.12em; background: currentColor; opacity: 0.55; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M6 3h8l4 4v14H6z'/%3E%3Cpath d='M14 3v4h4'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M6 3h8l4 4v14H6z'/%3E%3Cpath d='M14 3v4h4'/%3E%3C/svg%3E") center / contain no-repeat; }
a.mention { background-image: linear-gradient(var(--border-strong), var(--border-strong)); background-size: 100% 1px; background-position: 0 100%; background-repeat: no-repeat; font-weight: 500; }
a.mention:hover { background-color: var(--bg-hover); }
a.mention.mention-missing { color: var(--text-3); text-decoration: line-through; }

.blk-h1 { margin-top: 1.4em; } .blk-h2 { margin-top: 1.1em; } .blk-h3 { margin-top: 0.8em; }
.editor > .blk:first-child { margin-top: 2px; }
.heading { font-weight: 600; line-height: 1.3; }
.blk-h1 .blk-text { font-size: 1.875em; } .blk-h2 .blk-text { font-size: 1.5em; } .blk-h3 .blk-text { font-size: 1.25em; }
.blk-h1 .blk-handle { top: 10px; } .blk-h2 .blk-handle { top: 7px; } .blk-h3 .blk-handle { top: 5px; }
.blk-marker { flex: none; width: 24px; min-height: 30px; display: flex; align-items: flex-start; justify-content: center; user-select: none; }
.bullet { font-size: 1.45em; line-height: 1.05; padding-top: 1px; }
.num { width: auto; min-width: 24px; padding: 3px 4px 0 2px; justify-content: flex-end; font-variant-numeric: tabular-nums; }
.check { padding-top: 6px; cursor: pointer; }
.check .ic { width: 16px; height: 16px; border: 1.5px solid var(--text); border-radius: 3px; color: transparent; }
.check:hover .ic { background: var(--bg-hover); }
.blk-todo.checked .check .ic { background: var(--accent); border-color: var(--accent); color: #fff; }
.blk-todo.checked .blk-text { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--text-3); }
.toggle-row { display: flex; flex: 1; min-width: 0; align-items: flex-start; }
.blk-toggle > .blk-content { flex-direction: column; }
.toggle-arrow { cursor: pointer; padding-top: 5px; }
.toggle-arrow .ic { width: 22px; height: 22px; border-radius: 4px; transition: transform 0.15s; }
.toggle-arrow:hover .ic { background: var(--bg-hover); }
.blk-toggle.open .toggle-arrow .ic { transform: rotate(90deg); }
.toggle-empty { display: none; padding: 3px 2px 3px 26px; color: var(--text-3); cursor: pointer; font-size: 0.95em; }
.blk-toggle.empty-toggle .toggle-empty { display: block; }
.toggle-empty:hover { color: var(--text-2); }
.blk-quote .blk-content::before { content: ''; position: absolute; left: 1px; top: 3px; bottom: 3px; width: 3px; background: currentColor; border-radius: 1px; }
.blk-quote .blk-text { padding-left: 16px; font-size: 1.05em; }
.blk-callout > .blk-content { background: var(--bg-gray); padding: 16px 16px 16px 12px; border-radius: 4px; margin: 4px 0; }
.blk-callout .blk-handle { top: 18px; }
.callout-emoji { font-size: 21px; line-height: 1.2; width: 26px; height: 26px; border-radius: 4px; display: grid; place-items: center; flex: none; margin-right: 8px; }
.callout-emoji:hover { background: var(--bg-hover); }
.blk-callout .blk-text { padding-top: 2px; }
.code-box { flex: 1; min-width: 0; background: var(--bg-code); border-radius: 4px; margin: 4px 0; position: relative; }
.code-bar { display: flex; justify-content: space-between; padding: 6px 8px 0; opacity: 0; transition: opacity 0.12s; height: 30px; }
.blk-code:hover .code-bar, .blk-code:focus-within .code-bar { opacity: 1; }
.code-lang, .code-copy { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); padding: 2px 6px; border-radius: 4px; }
.code-lang:hover, .code-copy:hover { background: var(--bg-hover); }
.code-text { font-family: var(--mono); font-size: 85%; line-height: 1.55; tab-size: 2; padding: 4px 32px 28px 32px; white-space: pre; overflow-x: auto; display: block; }
.blk-code .blk-handle { top: 8px; }
.divider-line { flex: 1; padding: 10px 2px; cursor: pointer; }
.divider-line hr { border: 0; border-top: 1px solid var(--border-strong); margin: 0; }
.page-link { flex: 1; display: flex; align-items: center; gap: 6px; padding: 3px 2px; min-height: 30px; text-decoration: none; border-radius: 4px; cursor: pointer; font-weight: 500; }
.page-link:hover { background: var(--bg-hover); }
.page-link-icon { color: var(--text-2); width: 22px; }
.page-link-icon.emoji { font-size: 1.1em; line-height: 1; text-align: center; }
.page-link-title { border-bottom: 1px solid var(--border-strong); line-height: 1.3; }
.page-link.missing { color: var(--text-3); cursor: default; }
.page-link.missing .page-link-title { border: 0; }
.image { margin: 6px 0; flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.image-frame { position: relative; max-width: 100%; }
.image-frame img { display: block; width: 100%; border-radius: 3px; }
.image-resize { position: absolute; top: 50%; width: 6px; height: 48px; margin-top: -24px; border-radius: 4px; background: rgba(15, 15, 15, 0.6); border: 1px solid rgba(255, 255, 255, 0.9); cursor: col-resize; opacity: 0; transition: opacity 0.12s; }
.image-resize.left { left: 8px; } .image-resize.right { right: 8px; }
.image-frame:hover .image-resize, .image-frame:hover .image-tools { opacity: 1; }
.image-tools { position: absolute; top: 8px; right: 8px; display: flex; gap: 2px; background: rgba(15, 15, 15, 0.6); border-radius: 5px; padding: 2px; opacity: 0; transition: opacity 0.12s; }
.image-tools .btn-icon { color: #fff; }
.image-tools .btn-icon:hover { background: rgba(255, 255, 255, 0.15); }
.blk-caption { width: 100%; font-size: 14px; color: var(--text-2); padding: 6px 2px 2px; outline: none; min-height: 1.4em; }
.blk-caption:empty::before { content: attr(data-ph); color: var(--text-3); opacity: 0; }
.blk:hover .blk-caption:empty::before, .blk-caption:focus:empty::before { opacity: 1; }
.image-empty { flex: 1; display: flex; align-items: center; gap: 10px; padding: 14px 12px; background: var(--bg-hover); border-radius: 4px; color: var(--text-2); cursor: pointer; margin: 4px 0; }
.image-empty:hover { background: var(--bg-active); }
.toc { flex: 1; padding: 4px 0; }
.toc-item { display: block; padding: 3px 2px; text-decoration: none; color: var(--text-2); border-radius: 4px; font-size: 14px; }
.toc-item:hover { background: var(--bg-hover); }
.toc-h2 { padding-left: 24px; } .toc-h3 { padding-left: 48px; }
.toc-empty { color: var(--text-3); font-size: 14px; padding: 3px 2px; }
.db-inline { flex: 1; min-width: 0; margin: 8px 0 12px; }

/* Block colors */
.color-gray .blk-text { color: var(--c-gray); } .color-brown .blk-text { color: var(--c-brown); } .color-orange .blk-text { color: var(--c-orange); } .color-yellow .blk-text { color: var(--c-yellow); } .color-green .blk-text { color: var(--c-green); } .color-blue .blk-text { color: var(--c-blue); } .color-purple .blk-text { color: var(--c-purple); } .color-pink .blk-text { color: var(--c-pink); } .color-red .blk-text { color: var(--c-red); }
.color-gray_bg > .blk-content { background: var(--bg-gray); } .color-brown_bg > .blk-content { background: var(--bg-brown); } .color-orange_bg > .blk-content { background: var(--bg-orange); } .color-yellow_bg > .blk-content { background: var(--bg-yellow); } .color-green_bg > .blk-content { background: var(--bg-green); } .color-blue_bg > .blk-content { background: var(--bg-blue); } .color-purple_bg > .blk-content { background: var(--bg-purple); } .color-pink_bg > .blk-content { background: var(--bg-pink); } .color-red_bg > .blk-content { background: var(--bg-red); }
.blk-callout.color-gray_bg > .blk-content { background: var(--bg-gray); }
.c-gray { color: var(--c-gray); } .c-brown { color: var(--c-brown); } .c-orange { color: var(--c-orange); } .c-yellow { color: var(--c-yellow); } .c-green { color: var(--c-green); } .c-blue { color: var(--c-blue); } .c-purple { color: var(--c-purple); } .c-pink { color: var(--c-pink); } .c-red { color: var(--c-red); }
.bg-gray { background: var(--bg-gray); } .bg-brown { background: var(--bg-brown); } .bg-orange { background: var(--bg-orange); } .bg-yellow { background: var(--bg-yellow); } .bg-green { background: var(--bg-green); } .bg-blue { background: var(--bg-blue); } .bg-purple { background: var(--bg-purple); } .bg-pink { background: var(--bg-pink); } .bg-red { background: var(--bg-red); }
.blk-text span[class^="bg-"] { border-radius: 3px; padding: 0 1px; }
.color-swatch { width: 22px; height: 22px; border-radius: 4px; display: inline-grid; place-items: center; font-weight: 500; font-size: 13px; box-shadow: inset 0 0 0 1px var(--border); flex: none; }
.c-default { color: var(--text); } .bg-default { background: var(--bg); }

/* Drag & selection helpers */
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none; opacity: 0.5; max-width: 420px; background: var(--bg); padding: 2px 6px; border-radius: 4px; box-shadow: var(--shadow-sm); font-size: 15px; }
.drag-ghost .blk-handle { display: none; }
.drop-line { position: fixed; height: 4px; background: var(--accent); opacity: 0.55; border-radius: 2px; z-index: 999; pointer-events: none; display: none; }
.rubber { position: fixed; z-index: 998; background: rgba(35, 131, 226, 0.08); border: 1px solid rgba(35, 131, 226, 0.4); pointer-events: none; }

/* Floating text toolbar */
.toolbar { position: fixed; z-index: 900; display: none; align-items: center; background: var(--bg-elevated); border-radius: 6px; box-shadow: var(--shadow); height: 34px; padding: 0 3px; }
.tb-btn { height: 28px; min-width: 28px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; gap: 3px; border-radius: 4px; color: var(--text); }
.tb-btn:hover { background: var(--bg-hover); }
.tb-btn.on { color: var(--accent); }
.tb-type { font-size: 14px; padding: 0 8px; color: var(--text-2); }
.tb-a { font-weight: 600; text-decoration: underline; font-size: 15px; }
.tb-sep { width: 1px; height: 20px; background: var(--border); margin: 0 3px; }

/* ---------- Popovers & menus ---------- */
.layer { position: fixed; inset: 0; pointer-events: none; z-index: 800; }
.layer > * { pointer-events: auto; }
.pop { position: fixed; z-index: 810; background: var(--bg-elevated); border-radius: 8px; box-shadow: var(--shadow); max-height: min(70vh, 560px); overflow: hidden; display: flex; flex-direction: column; animation: pop-in 0.1s ease-out; }
@keyframes pop-in { from { opacity: 0; transform: scale(0.98); } }
.menu { display: flex; flex-direction: column; min-width: 220px; max-height: inherit; outline: none; }
.menu-search-wrap { padding: 8px 8px 4px; }
.menu-search { width: 100%; height: 28px; border: 0; border-radius: 5px; padding: 0 8px; background: var(--bg-subtle); box-shadow: inset 0 0 0 1px var(--border-strong); outline: none; font-size: 14px; }
.menu-search:focus { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 2px var(--accent-soft); }
.menu-list { overflow-y: auto; padding: 4px; flex: 1; }
.menu-item { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 28px; padding: 3px 8px; border-radius: 5px; font-size: 14px; cursor: pointer; text-align: left; color: var(--text); user-select: none; }
.menu-item.active { background: var(--bg-hover); }
.menu-item.danger:hover, .menu-item.danger.active { color: var(--danger); }
.menu-item.danger.active .ic { color: var(--danger); }
.menu-item.disabled { opacity: 0.45; cursor: default; }
.menu-item.muted .menu-label { color: var(--text-3); }
.menu-item > .ic { color: var(--text-2); }
.menu-label { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.menu-label > small { color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-label { white-space: nowrap; text-overflow: ellipsis; }
.menu-hint { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.menu-check { color: var(--text) !important; }
.menu-sub { color: var(--text-3) !important; }
.menu-sep { height: 1px; background: var(--border); margin: 4px 6px; }
.menu-header { font-size: 12px; font-weight: 500; color: var(--text-3); padding: 8px 8px 4px; user-select: none; }
.menu-empty { font-size: 13px; color: var(--text-3); padding: 8px 10px; }
.menu-emoji { width: 20px; text-align: center; font-size: 16px; }
.menu-input { display: flex; align-items: center; gap: 6px; padding: 4px 4px 6px; }
.menu-input-icon { width: 30px; height: 30px; border-radius: 5px; display: grid; place-items: center; box-shadow: inset 0 0 0 1px var(--border-strong); color: var(--text-2); flex: none; }
.menu-foot { font-size: 12px; color: var(--text-3); padding: 4px 8px 6px; line-height: 1.6; }
.slash-menu .menu-item { padding: 4px 8px; }
.slash-tile { width: 46px; height: 46px; border-radius: 5px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--border-strong); display: grid; place-items: center; flex: none; color: var(--text-2); }
.slash-tile.color-swatch { font-size: 18px; }
.slash-menu .menu-label { font-size: 14px; }
.page-picker .menu-item .page-emoji, .page-picker .menu-item .page-glyph { width: 20px; }
.switch { width: 28px; height: 16px; border-radius: 10px; background: var(--border-strong); position: relative; flex: none; transition: background 0.15s; order: 3; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(12px); }
.font-picker { display: flex; gap: 4px; padding: 2px 6px 8px; }
.font-opt { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; border-radius: 6px; font-size: 12px; color: var(--text-2); }
.font-opt:hover { background: var(--bg-hover); }
.font-ag { font-size: 24px; color: var(--text); line-height: 1.2; }
.font-opt.on .font-ag { color: var(--accent); }
.font-serif .font-ag { font-family: var(--serif); } .font-mono .font-ag { font-family: var(--mono); }
.prompt { display: flex; gap: 6px; padding: 8px; align-items: center; }
.rename-icon { width: 32px; height: 32px; border-radius: 5px; box-shadow: inset 0 0 0 1px var(--border-strong); display: grid; place-items: center; font-size: 17px; flex: none; }
.rename-icon:hover { background: var(--bg-hover); }
.tooltip { position: fixed; z-index: 2000; background: rgb(15, 15, 15); color: rgba(255, 255, 255, 0.9); font-size: 12px; font-weight: 500; line-height: 1.4; padding: 4px 8px; border-radius: 5px; max-width: 260px; text-align: center; pointer-events: none !important; animation: pop-in 0.1s; }
.tip-key { color: rgba(255, 255, 255, 0.55); }

.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 15, 15, 0.55); display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; z-index: 805; animation: fade 0.12s; }
@keyframes fade { from { opacity: 0; } }
.modal-backdrop > .pop { position: relative; left: auto !important; top: auto !important; max-height: 76vh; }
.modal { display: flex; flex-direction: column; min-height: 0; }
.confirm { width: 380px; padding: 20px; text-align: center; }
.confirm-msg { font-size: 15px; font-weight: 500; }
.confirm-detail { color: var(--text-2); font-size: 13px; margin: 8px 0 0; }
.confirm-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.confirm-actions .btn { justify-content: center; }

/* Emoji picker */
.emoji-picker { width: 408px; display: flex; flex-direction: column; max-height: 420px; }
.emoji-tabs, .cover-picker-head { display: flex; align-items: center; gap: 4px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.emoji-tab { font-size: 14px; padding: 4px 8px; border-radius: 5px; font-weight: 500; }
.emoji-tab.active { box-shadow: inset 0 -2px 0 var(--text); border-radius: 0; }
.emoji-bar { display: flex; gap: 6px; padding: 8px; align-items: center; }
.emoji-bar .btn-icon { width: 32px; height: 32px; font-size: 17px; box-shadow: inset 0 0 0 1px var(--border-strong); }
.emoji-grid { overflow-y: auto; padding: 0 8px 8px; }
.emoji-label { font-size: 12px; font-weight: 500; color: var(--text-3); padding: 8px 4px 4px; }
.emoji-cells { display: grid; grid-template-columns: repeat(12, 1fr); }
.emoji-cell { font-size: 22px; height: 32px; border-radius: 5px; display: grid; place-items: center; }
.emoji-cell:hover { background: var(--bg-hover); }

/* Cover picker */
.cover-picker { display: flex; flex-direction: column; padding-bottom: 10px; }
.cover-picker .btn { margin: 0 12px; }
.cover-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 0 12px 6px; }
.cover-swatch { height: 60px; border-radius: 4px; background-size: cover; }
.cover-swatch:hover { opacity: 0.85; }
.cover-g1 { background: linear-gradient(120deg, #fbc2eb 0%, #a6c1ee 100%); }
.cover-g2 { background: linear-gradient(120deg, #84fab0 0%, #8fd3f4 100%); }
.cover-g3 { background: linear-gradient(135deg, #f6d365 0%, #fda085 100%); }
.cover-g4 { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.cover-g5 { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
.cover-g6 { background: linear-gradient(120deg, #e0c3fc 0%, #8ec5fc 100%); }
.cover-g7 { background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%); }
.cover-g8 { background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%); }
.cover-g9 { background: linear-gradient(135deg, #fddb92 0%, #d1fdff 100%); }
.cover-g10 { background: linear-gradient(160deg, #ee9ca7 0%, #ffdde1 100%); }
.cover-g11 { background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%); }
.cover-g12 { background: radial-gradient(circle at 20% 20%, #ffd89b 0%, #19547b 100%); }
.cover-c-red { background: #e16259; } .cover-c-orange { background: #f5a45b; } .cover-c-yellow { background: #f7d774; } .cover-c-green { background: #4dab9a; } .cover-c-blue { background: #529cca; } .cover-c-purple { background: #9a6dd7; } .cover-c-pink { background: #e255a1; } .cover-c-gray { background: #9b9a97; }

/* Toasts */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; z-index: 3000; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; background: rgb(47, 47, 47); color: rgba(255, 255, 255, 0.92); font-size: 14px; padding: 8px 14px; border-radius: 8px; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); transition: opacity 0.2s, transform 0.2s; max-width: 560px; }
.toast.visible { opacity: 1; transform: none; }
.toast.error { background: rgb(180, 45, 45); }
.toast-action { color: rgb(82, 169, 255); font-weight: 600; white-space: nowrap; }
.sb-backdrop { display: none; }
.net-status { position: fixed; right: 16px; bottom: 16px; z-index: 2900; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--bg-elevated); color: var(--text-2); border: 1px solid var(--border); box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
.net-status.offline { background: #1b0f4d; color: #fff; border-color: transparent; }
.net-status[hidden] { display: none; }
.toast.error .toast-action { color: #fff; text-decoration: underline; }

/* ---------- Tags & values ---------- */
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 3px; font-size: 13px; line-height: 20px; white-space: nowrap; color: var(--tag-text); background: var(--tag-default); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.tag-gray { background: var(--tag-gray); } .tag-brown { background: var(--tag-brown); } .tag-orange { background: var(--tag-orange); } .tag-yellow { background: var(--tag-yellow); } .tag-green { background: var(--tag-green); } .tag-blue { background: var(--tag-blue); } .tag-purple { background: var(--tag-purple); } .tag-pink { background: var(--tag-pink); } .tag-red { background: var(--tag-red); }
.tag-status { border-radius: 10px; padding: 0 8px 0 6px; }
.tag-status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.55; margin-right: 5px; flex: none; }
.tag-none { background: transparent; color: var(--text-2); padding: 0; }
.tag-removable { padding-right: 2px; }
.tag-x { width: 16px; height: 16px; display: grid; place-items: center; border-radius: 3px; margin-left: 2px; opacity: 0.6; }
.tag-x:hover { opacity: 1; background: rgba(0, 0, 0, 0.08); }
.color-dot { width: 18px; height: 18px; border-radius: 4px; box-shadow: inset 0 0 0 1px var(--border); flex: none; }
.v-title { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; min-width: 0; }
.v-title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-bottom: 1px solid var(--border-strong); line-height: 1.3; }
.v-icon { font-size: 15px; line-height: 1; }
.v-tags { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.v-check { width: 16px; height: 16px; border: 1.5px solid var(--text-2); border-radius: 3px; display: inline-grid; place-items: center; color: transparent; cursor: pointer; }
.v-check:hover { background: var(--bg-hover); }
.v-check.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.v-url { color: inherit; text-decoration: underline; text-decoration-color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-number { font-variant-numeric: tabular-nums; }
.v-date { white-space: nowrap; }

/* ---------- Database views ---------- */
.dbv { position: relative; }
.dbv-page { padding-bottom: 40px; }
.dbv-title-row { display: flex; align-items: center; gap: 6px; margin: 4px 0 2px; }
.dbv-title { font-size: 20px; font-weight: 700; outline: none; padding: 2px 2px; min-width: 40px; }
.dbv-title:empty::before { content: attr(data-ph); color: var(--text-3); }
.dbv-title-icon { font-size: 20px; }
.dbv-open { opacity: 0; }
.dbv-title-row:hover .dbv-open { opacity: 1; }
.dbv-toolbar { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); min-height: 40px; }
.dbv-tabs { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; height: 40px; }
.dbv-tab { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; border-radius: 5px; font-size: 14px; color: var(--text-2); white-space: nowrap; position: relative; font-weight: 500; }
.dbv-tab:hover { background: var(--bg-hover); }
.dbv-tab.active { color: var(--text); }
.dbv-tab.active::after { content: ''; position: absolute; left: 6px; right: 6px; bottom: -6px; height: 2px; background: var(--text); border-radius: 1px; }
.dbv-add-view { flex: none; }
.dbv-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.dbv-search { display: flex; align-items: center; }
.dbv-search-input { width: 0; border: 0; outline: none; background: none; font-size: 14px; padding: 0; transition: width 0.18s; }
.dbv-search.open .dbv-search-input { width: 150px; padding: 0 4px; }
.dbv-new { display: flex; margin-left: 6px; border-radius: 5px; overflow: hidden; background: var(--accent); color: #fff; height: 28px; }
.dbv-new button { color: #fff; font-weight: 500; font-size: 14px; }
.dbv-new-main { padding: 0 10px; }
.dbv-new-more { width: 24px; display: grid; place-items: center; box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.25); }
.dbv-new button:hover { background: rgba(0, 0, 0, 0.12); }
.dbv-chips { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 8px; border-radius: 14px; font-size: 13px; color: var(--text-2); box-shadow: inset 0 0 0 1px var(--border-strong); }
.chip:hover { background: var(--bg-hover); }
.chip.set, .chip-sort { color: var(--accent); box-shadow: inset 0 0 0 1px rgba(35, 131, 226, 0.35); background: rgba(35, 131, 226, 0.06); }
.chip-add { box-shadow: none; color: var(--text-3); }
.chips-sep { width: 1px; height: 18px; background: var(--border-strong); }
.db-loading, .db-error, .db-empty { padding: 16px 4px; color: var(--text-3); font-size: 14px; }
.db-setup { padding: 28px 0; color: var(--text-2); }
.db-setup p { margin: 0 0 12px; }
.db-setup-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Table */
.dbt-scroll { overflow-x: auto; margin-left: -34px; padding-left: 34px; padding-bottom: 8px; }
.dbt { display: inline-block; min-width: 100%; font-size: 14px; }
.dbt-head { display: flex; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg); z-index: 1; }
.dbt-th { position: relative; flex: none; display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 8px; color: var(--text-2); cursor: pointer; border-right: 1px solid var(--border); font-size: 14px; user-select: none; }
.dbt-th:hover { background: var(--bg-hover); }
.dbt-th-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dbt-th.drop-left { box-shadow: inset 3px 0 0 var(--accent); }
.dbt-add-col { width: 44px; justify-content: center; border-right: 0; }
.dbt-resize { position: absolute; right: -3px; top: 0; bottom: 0; width: 6px; cursor: col-resize; z-index: 2; }
.dbt-resize:hover { background: var(--accent); opacity: 0.5; }
.dbt-row { display: flex; border-bottom: 1px solid var(--border); position: relative; min-height: 34px; }
.dbt-row:hover { background: var(--bg-subtle); }
.dbt-gutter { position: absolute; left: -32px; top: 0; bottom: 0; width: 30px; display: flex; align-items: center; justify-content: flex-end; opacity: 0; }
.dbt-row:hover .dbt-gutter { opacity: 1; }
.dbt-grip { width: 20px; height: 24px; border-radius: 4px; display: grid; place-items: center; color: var(--text-3); cursor: grab; }
.dbt-grip:hover { background: var(--bg-hover); }
.dbt-td { flex: none; display: flex; align-items: center; gap: 4px; padding: 6px 8px; border-right: 1px solid var(--border); min-height: 34px; overflow: hidden; cursor: default; position: relative; white-space: nowrap; }
.dbt-td:hover { background: var(--bg-hover); }
.dbt-td.wrap { white-space: normal; align-items: flex-start; }
.dbt-td .v-text { overflow: hidden; text-overflow: ellipsis; }
.dbt-td.wrap .v-text { white-space: pre-wrap; word-break: break-word; }
.dbt-td .v-tags { flex-wrap: nowrap; overflow: hidden; }
.dbt-td.wrap .v-tags { flex-wrap: wrap; }
.dbt-cell-number { justify-content: flex-end; }
.dbt-cell-checkbox { justify-content: flex-start; }
.dbt-filler { flex: 1; border-right: 0; min-width: 44px; }
.dbt-filler:hover { background: none; }
.dbt-cell-title { justify-content: space-between; }
.dbt-open { display: none; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; color: var(--text-2); background: var(--bg-elevated); box-shadow: var(--shadow-sm); border-radius: 4px; padding: 0 6px; height: 22px; flex: none; }
.dbt-cell-title:hover .dbt-open { display: inline-flex; }
.dbt-open:hover { background: var(--bg-hover); }
.dbt-new { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 8px; width: 100%; color: var(--text-3); font-size: 14px; border-bottom: 1px solid var(--border); }
.dbt-new:hover { background: var(--bg-hover); color: var(--text-2); }
.dbt-foot { height: 32px; display: flex; align-items: center; padding: 0 8px; font-size: 12px; color: var(--text-2); }
.dbt-foot .muted { font-size: 10px; letter-spacing: 0.04em; color: var(--text-3); }

/* Cell editors */
.pop-cell { border-radius: 4px; }
.cell-editor { display: flex; flex-direction: column; gap: 6px; padding: 6px 8px; }
.cell-input { width: 100%; border: 0; outline: none; background: none; font-size: 14px; resize: none; line-height: 1.5; padding: 2px 0; min-height: 26px; }
.cell-editor .btn { align-self: flex-start; }
.opt-editor { display: flex; flex-direction: column; max-height: 420px; }
.opt-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 6px 8px; background: var(--bg-subtle); border-bottom: 1px solid var(--border); min-height: 36px; }
.opt-tags { display: contents; }
.opt-input { flex: 1; min-width: 80px; border: 0; outline: none; background: none; font-size: 14px; height: 24px; }
.opt-list { overflow-y: auto; padding: 0 4px 6px; }
.opt-row { display: flex; align-items: center; gap: 6px; min-height: 30px; padding: 2px 6px; border-radius: 5px; cursor: pointer; }
.opt-row.active { background: var(--bg-hover); }
.opt-grip { color: var(--text-3); }
.opt-create { font-size: 14px; color: var(--text-2); }
.opt-more { opacity: 0; width: 22px; height: 22px; min-width: 22px; }
.opt-row:hover .opt-more, .opt-row.active .opt-more { opacity: 1; }

/* Date picker */
.datepicker { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.dp-head { display: flex; align-items: center; gap: 2px; padding: 2px 0; }
.dp-month { white-space: nowrap; font-weight: 600; font-size: 14px; text-transform: capitalize; padding-left: 4px; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.dp-dow { font-size: 11px; color: var(--text-3); text-align: center; padding: 4px 0; }
.dp-day { height: 30px; border-radius: 4px; font-size: 13px; }
.dp-day:hover { background: var(--bg-hover); }
.dp-day.other { color: var(--text-3); }
.dp-day.today { color: var(--danger); font-weight: 600; }
.dp-day.selected { background: var(--accent); color: #fff; }
.dp-foot { border-top: 1px solid var(--border); padding-top: 6px; }

/* Filters & sorts */
.filter-editor { padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.filter-head { display: flex; align-items: center; gap: 4px; font-size: 13px; }
.filter-prop { color: var(--text-2); padding-left: 4px; }
.filter-op { color: var(--text); font-weight: 500; }
.filter-options { display: flex; flex-direction: column; gap: 1px; max-height: 260px; overflow-y: auto; }
.filter-opt { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px; border-radius: 5px; }
.filter-opt:hover { background: var(--bg-hover); }
.filter-date { text-align: left; color: var(--text-2); }
.sort-editor { padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.sort-row { display: flex; align-items: center; gap: 4px; padding: 2px; }
.props-vis { padding: 4px; overflow-y: auto; }

/* Board */
.board { display: flex; gap: 14px; overflow-x: auto; padding: 12px 34px 16px 0; align-items: flex-start; min-height: 200px; }
.board-col { width: 260px; flex: none; display: flex; flex-direction: column; border-radius: 6px; padding: 0 6px 6px; }
.board-col-gray { background: color-mix(in srgb, var(--bg-gray) 70%, transparent); } .board-col-brown { background: color-mix(in srgb, var(--bg-brown) 70%, transparent); } .board-col-orange { background: color-mix(in srgb, var(--bg-orange) 70%, transparent); } .board-col-yellow { background: color-mix(in srgb, var(--bg-yellow) 70%, transparent); } .board-col-green { background: color-mix(in srgb, var(--bg-green) 70%, transparent); } .board-col-blue { background: color-mix(in srgb, var(--bg-blue) 70%, transparent); } .board-col-purple { background: color-mix(in srgb, var(--bg-purple) 70%, transparent); } .board-col-pink { background: color-mix(in srgb, var(--bg-pink) 70%, transparent); } .board-col-red { background: color-mix(in srgb, var(--bg-red) 70%, transparent); } .board-col-default { background: var(--bg-subtle); }
.board-col-head { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 2px; }
.board-col-head .tag { cursor: pointer; }
.board-count { color: var(--text-3); font-size: 13px; }
.board-col-head .btn-icon { opacity: 0; }
.board-col:hover .board-col-head .btn-icon { opacity: 1; }
.board-cards { display: flex; flex-direction: column; gap: 6px; min-height: 12px; }
.board-add { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 6px; color: var(--text-3); font-size: 14px; border-radius: 5px; margin-top: 4px; }
.board-add:hover { background: var(--bg-hover); color: var(--text-2); }
.board-add-group { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; color: var(--text-3); font-size: 14px; border-radius: 5px; flex: none; }
.board-add-group:hover { background: var(--bg-hover); color: var(--text-2); }
.card { background: var(--bg-elevated); border-radius: 6px; box-shadow: var(--shadow-sm); cursor: pointer; position: relative; overflow: hidden; user-select: none; }
.card:hover { background: var(--bg-hover); background-color: color-mix(in srgb, var(--bg-elevated) 94%, var(--text)); }
.card-body { padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.card-title { font-weight: 500; font-size: 14px; display: flex; gap: 6px; align-items: flex-start; word-break: break-word; line-height: 1.4; }
.card-prop { font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px; color: var(--text-2); }
.card-prop .tag { font-size: 12px; height: 18px; line-height: 18px; }
.card-more { position: absolute; top: 6px; right: 6px; opacity: 0; background: var(--bg-elevated); box-shadow: var(--shadow-sm); }
.card:hover .card-more { opacity: 1; }
.card-ghost { position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none; box-shadow: var(--shadow); opacity: 0.9; }
.card-placeholder { border-radius: 6px; background: var(--bg-active); }
.card.dragging-src { display: none; }

/* Gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; padding: 14px 0; }
.gallery-small { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.gallery-large { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.gallery .card { display: flex; flex-direction: column; }
.card-cover { height: 140px; background-size: cover; background-position: center; border-bottom: 1px solid var(--border); overflow: hidden; position: relative; background-color: var(--bg-subtle); }
.gallery-small .card-cover { height: 110px; } .gallery-large .card-cover { height: 200px; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-preview { padding: 10px 12px; font-size: 10px; color: var(--text-2); line-height: 1.5; }
.card-preview p { margin: 0 0 4px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-cover-icon { position: absolute; inset: 0; display: grid; place-items: center; font-size: 44px; }
.gallery-new { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 180px; border-radius: 6px; color: var(--text-3); box-shadow: inset 0 0 0 1px var(--border); font-size: 14px; }
.gallery-new:hover { background: var(--bg-hover); color: var(--text-2); }

.wk-scroll { overflow-x: auto; }

/* List */
.dblist { padding: 6px 0; }
.dblist-row { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 6px; border-radius: 5px; cursor: pointer; }
.dblist-row:hover { background: var(--bg-hover); }
.dblist-icon.page-glyph { color: var(--text-2); }
.dblist-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-bottom: 1px solid var(--border-strong); line-height: 1.3; }
.dblist-props { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); overflow: hidden; }
.dblist .dbt-new { border-bottom: 0; border-radius: 5px; }

/* Calendar */
.cal-head { display: flex; align-items: center; gap: 4px; padding: 10px 0; }
.cal-title { font-size: 16px; font-weight: 600; text-transform: capitalize; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-left: 1px solid var(--border); border-top: 1px solid var(--border); }
.cal-dow { font-size: 12px; color: var(--text-3); text-align: center; padding: 6px 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.cal-day { min-height: 110px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 4px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day.other { background: var(--bg-subtle); }
.cal-day.other .cal-num { color: var(--text-3); }
.cal-day.drop-target { background: var(--accent-soft); }
.cal-day-head { display: flex; justify-content: flex-end; align-items: center; gap: 2px; height: 24px; }
.cal-num { font-size: 13px; color: var(--text-2); padding: 0 4px; height: 22px; min-width: 22px; line-height: 22px; text-align: center; border-radius: 11px; text-transform: lowercase; }
.cal-day.today .cal-num { background: var(--danger); color: #fff; font-weight: 600; }
.cal-add { opacity: 0; width: 22px; height: 22px; min-width: 22px; margin-right: auto; }
.cal-day:hover .cal-add { opacity: 1; }
.cal-item { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; background: var(--bg-elevated); box-shadow: var(--shadow-sm); border-radius: 4px; padding: 3px 6px; cursor: pointer; overflow: hidden; }
.cal-item:hover { background: var(--bg-hover); }
.cal-item-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ghost { position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none; opacity: 0.9; width: 140px; }

/* ---------- Peek ---------- */
.peek-backdrop { position: fixed; inset: 0; z-index: 400; background: transparent; }
.peek { position: fixed; top: 0; right: 0; bottom: 0; width: min(960px, 58vw); background: var(--bg); box-shadow: rgba(15, 15, 15, 0.04) 0 0 0 1px, rgba(15, 15, 15, 0.08) -3px 0 6px, rgba(15, 15, 15, 0.12) -9px 0 24px; z-index: 401; display: flex; flex-direction: column; transform: translateX(24px); opacity: 0; transition: transform 0.18s ease, opacity 0.18s ease; }
.peek.open { transform: none; opacity: 1; }
.peek-head { height: 44px; display: flex; align-items: center; gap: 2px; padding: 0 10px; flex: none; }
.peek-body { flex: 1; overflow-y: auto; }
.peek .page-head { padding-top: 24px; }
.peek .page-view.with-cover .page-head { padding-top: 0; }

/* ---------- Home ---------- */
.home { max-width: 900px; margin: 0 auto; padding: 56px 48px 120px; }
.home-title { font-size: 30px; font-weight: 700; text-align: center; margin: 0 0 40px; letter-spacing: -0.01em; }
.home-section { margin-bottom: 36px; }
.home-label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--text-2); margin-bottom: 10px; padding-left: 2px; }
/* Recent pages wrap into full rows: no card is ever cut at the edge. */
.home-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; padding: 2px 2px 8px; }
@media (max-width: 900px) { .home-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } .home-cards > .home-card:nth-child(n+6):not(.home-card-new) { display: none; } }
@media (max-width: 700px) { .home-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } .home-cards > .home-card:nth-child(n+6):not(.home-card-new) { display: none; } }
.home-card { height: 144px; border-radius: 14px; background: var(--bg-elevated); box-shadow: var(--shadow-sm); text-decoration: none; position: relative; overflow: hidden; display: flex; flex-direction: column; text-align: left; }
.home-card:hover { box-shadow: var(--shadow); }
.home-card-cover { height: 44px; background: var(--bg-hover); background-size: cover; background-position: center; flex: none; }
.home-card-icon { position: absolute; top: 26px; left: 14px; }
.home-card-icon .page-emoji { font-size: 26px !important; }
.home-card-icon .page-glyph, .home-card-new .home-card-icon .ic { color: var(--text-2); background: var(--bg-elevated); border-radius: 4px; }
.home-card-title { margin: 30px 14px 0; font-weight: 600; font-size: 14px; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.home-card-meta { margin: auto 14px 12px; font-size: 12px; color: var(--text-3); }
.home-card-new { align-items: stretch; }
.home-card-new .home-card-title { color: var(--text-2); }
.home-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.home-action { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--border); text-align: left; color: var(--text-2); }
.home-action:hover { background: var(--bg-hover); }
.home-action strong { display: block; color: var(--text); font-weight: 500; font-size: 14px; }
.home-action small { display: block; color: var(--text-3); font-size: 12px; }
.home-list { display: flex; flex-direction: column; }
.home-row { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 8px; border-radius: 6px; text-decoration: none; min-width: 0; }
.home-row:hover { background: var(--bg-hover); }
.home-row .page-glyph { color: var(--text-2); }
.home-row-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.home-row-path { color: var(--text-3); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.home-row-time { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.home-empty { color: var(--text-3); }

/* ---------- Search ---------- */
.search-modal { width: min(720px, 92vw); max-height: 70vh; }
.search-bar { display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 52px; border-bottom: 1px solid var(--border); color: var(--text-2); flex: none; }
.search-input { flex: 1; border: 0; outline: none; background: none; font-size: 17px; }
.search-results { overflow-y: auto; padding: 6px; flex: 1; min-height: 80px; }
.search-group { font-size: 12px; font-weight: 500; color: var(--text-3); padding: 10px 10px 4px; }
.search-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: 6px; text-decoration: none; }
.search-row.active { background: var(--bg-hover); }
.search-row > .ic, .search-row > .page-emoji { margin-top: 1px; }
.search-row .page-glyph { color: var(--text-2); }
.search-main { flex: 1; min-width: 0; }
.search-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-path { color: var(--text-3); font-weight: 400; font-size: 13px; }
.search-excerpt { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.search-excerpt mark { background: rgba(255, 212, 0, 0.35); color: inherit; border-radius: 2px; }
.search-time { font-size: 12px; color: var(--text-3); white-space: nowrap; margin-top: 2px; }
.search-empty { color: var(--text-3); padding: 24px; text-align: center; }
.search-foot { display: flex; gap: 16px; padding: 8px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); flex: none; }

/* ---------- Trash ---------- */
.trash { display: flex; flex-direction: column; max-height: 60vh; }
.trash-modal { width: 440px; }
.trash-head { padding: 10px; border-bottom: 1px solid var(--border); }
.trash-list { overflow-y: auto; padding: 4px; min-height: 100px; }
.trash-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 5px; }
.trash-row:hover { background: var(--bg-hover); }
.trash-row .page-glyph { color: var(--text-2); }
.trash-main { flex: 1; min-width: 0; }
.trash-title { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trash-meta { font-size: 12px; color: var(--text-3); }
.trash-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 32px; color: var(--text-3); }
.trash-foot { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); background: var(--bg-subtle); }

/* ---------- Settings ---------- */
.settings-modal { width: min(880px, 94vw); height: min(620px, 80vh); }
.settings { display: flex; height: 100%; min-height: 0; }
.settings-nav { width: 220px; flex: none; background: var(--bg-sidebar); padding: 12px 8px; display: flex; flex-direction: column; gap: 1px; }
.settings-nav-title { font-size: 12px; font-weight: 500; color: var(--text-3); padding: 4px 10px 8px; }
.settings-tab { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 10px; border-radius: 6px; font-size: 14px; color: var(--text-2); text-align: left; }
.settings-tab:hover { background: var(--bg-hover); }
.settings-tab.on { background: var(--bg-active); color: var(--text); font-weight: 500; }
.settings-pane { flex: 1; overflow-y: auto; padding: 28px 40px; }
.settings-pane h2 { font-size: 16px; font-weight: 600; margin: 0 0 4px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.settings-pane h2:not(:first-child) { margin-top: 32px; }
.settings-pane p { font-size: 14px; }
.theme-opts { display: flex; gap: 10px; }
.theme-opt { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 110px; padding: 14px 0; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--border-strong); font-size: 13px; color: var(--text-2); }
.theme-opt:hover { background: var(--bg-hover); }
.theme-opt.on { box-shadow: inset 0 0 0 2px var(--accent); color: var(--text); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; font-size: 14px; margin: 16px 0; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; word-break: break-all; }
.kv code { font-family: var(--mono); font-size: 12px; background: var(--bg-inline-code); padding: 2px 5px; border-radius: 4px; }
.alert { color: var(--danger); font-size: 13px; }
.shortcuts { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 24px; margin-top: 10px; }
.shortcut { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--border); }
kbd { font-family: var(--font); font-size: 12px; background: var(--bg-subtle); box-shadow: inset 0 0 0 1px var(--border-strong); border-radius: 4px; padding: 1px 6px; white-space: nowrap; color: var(--text-2); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .page-view { --pad: 24px; }
  .peek { width: 100vw; }
  .home { padding: 32px 16px 80px; }
  .home-actions { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .sidebar { position: fixed; z-index: 600; height: 100%; box-shadow: var(--shadow); }
  body:not(.sidebar-closed) .sb-backdrop { display: block; position: fixed; inset: 0; z-index: 599; background: rgba(15, 10, 38, 0.32); }
  .blk-comments { right: 0; top: -18px; }
  .tl-names { width: 140px; }
  .page-title { font-size: 32px; }
  .blk-handle { display: none; }
  .settings-nav { width: 150px; }
  .shortcuts { grid-template-columns: 1fr; }
}

/* ================= v3 additions ================= */

/* Code highlighting */
.tok-kw { color: #d73a49; } .tok-str { color: #22863a; } .tok-com { color: #8a8a8a; font-style: italic; } .tok-num { color: #005cc5; } .tok-fn { color: #6f42c1; } .tok-tag { color: #22863a; } .tok-attr { color: #6f42c1; } .tok-var { color: #e36209; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tok-kw { color: #ff7b72; } :root:not([data-theme="light"]) .tok-str { color: #a5d6ff; } :root:not([data-theme="light"]) .tok-num { color: #79c0ff; } :root:not([data-theme="light"]) .tok-fn { color: #d2a8ff; } :root:not([data-theme="light"]) .tok-tag { color: #7ee787; } :root:not([data-theme="light"]) .tok-attr { color: #d2a8ff; } :root:not([data-theme="light"]) .tok-var { color: #ffa657; } }
:root[data-theme="dark"] .tok-kw { color: #ff7b72; } :root[data-theme="dark"] .tok-str { color: #a5d6ff; } :root[data-theme="dark"] .tok-num { color: #79c0ff; } :root[data-theme="dark"] .tok-fn { color: #d2a8ff; } :root[data-theme="dark"] .tok-tag { color: #7ee787; } :root[data-theme="dark"] .tok-attr { color: #d2a8ff; } :root[data-theme="dark"] .tok-var { color: #ffa657; }

/* Toggle headings, flash, locked */
.blk-toggle-heading > .blk-content { flex-direction: column; }
.blk-toggle-heading .toggle-arrow { padding-top: 0.45em; }
.blk-h1.blk-toggle-heading .toggle-arrow { padding-top: 0.6em; }
.blk-toggle-heading.open .toggle-arrow .ic { transform: rotate(90deg); }
.blk-toggle-heading.empty-toggle .toggle-empty { display: block; }
.blk.flash > .blk-content { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 30% { background: rgba(255, 212, 0, 0.35); } 100% { background: transparent; } }
.editor.locked .blk-handle, .editor.locked .toggle-empty, .editor.locked .tbl-add-row, .editor.locked .tbl-add-col { display: none !important; }
.page-view.is-locked .page-title { cursor: default; }
.ctl-btn.locked { color: var(--text-2); }
.tb-lock { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-2); padding: 3px 8px; border-radius: 5px; margin-right: 6px; }
.tb-lock:hover { background: var(--bg-hover); }

/* Simple tables */
.tbl-wrap { flex: 1; min-width: 0; position: relative; padding: 14px 18px 18px 0; margin: 2px 0; }
.tbl-scroll { overflow-x: auto; padding: 14px 0 0 22px; margin-left: -22px; }
.tbl { border-collapse: collapse; min-width: 60%; }
.tbl td { border: 1px solid var(--border-strong); vertical-align: top; min-width: 120px; position: relative; padding: 0; }
.tbl-cell { padding: 7px 9px; outline: none; min-height: 36px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.tbl-cell:focus { box-shadow: inset 0 0 0 2px var(--accent-soft); }
.tbl-head td, .tbl td.tbl-hcol { background: var(--bg-subtle); }
.tbl-head .tbl-cell, .tbl-hcol .tbl-cell { font-weight: 600; }
.tbl-row-handle, .tbl-col-handle { position: absolute; opacity: 0; border-radius: 4px; color: var(--text-3); display: grid; place-items: center; background: var(--bg-elevated); box-shadow: var(--shadow-sm); z-index: 1; }
.tbl-row-handle { left: -21px; top: 8px; width: 16px; height: 22px; }
.tbl-col-handle { top: -12px; left: 50%; margin-left: -12px; width: 24px; height: 14px; }
.tbl tr:hover .tbl-row-handle, .tbl td:hover .tbl-col-handle { opacity: 1; }
.tbl-add-row, .tbl-add-col { position: absolute; display: grid; place-items: center; color: var(--text-3); border-radius: 4px; opacity: 0; background: var(--bg-subtle); }
.tbl-add-row { left: 0; right: 18px; bottom: 0; height: 16px; }
.tbl-add-col { top: 28px; bottom: 18px; right: 0; width: 16px; }
.tbl-wrap:hover .tbl-add-row, .tbl-wrap:hover .tbl-add-col { opacity: 1; }
.tbl-add-row:hover, .tbl-add-col:hover { background: var(--bg-active); color: var(--text-2); }

/* Columns */
.cols { flex: 1; min-width: 0; display: flex; gap: 0; align-items: stretch; }
.col { min-width: 0; padding: 0 2px; position: relative; }
.col .editor { min-height: 30px; }
.col .editor.is-empty::before { content: 'Colonne vide'; }
.col-gutter { width: 22px; flex: none; cursor: col-resize; position: relative; }
.col-gutter::after { content: ''; position: absolute; top: 4px; bottom: 4px; left: 10px; width: 2px; border-radius: 1px; background: transparent; transition: background 0.15s; }
.col-gutter:hover::after { background: var(--border-strong); }
.col .blk-handle { left: calc(var(--indent, 0) * 26px - 40px); }
.editor.locked .col-gutter { display: none; }

/* Embeds: bookmarks, files, media, links, breadcrumbs */
.embed { flex: 1; min-width: 0; margin: 4px 0; }
.embed-empty { flex: 1; display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--bg-hover); border-radius: 4px; color: var(--text-2); margin: 4px 0; }
.embed-empty .input { flex: 1; }
.bookmark { display: flex; border-radius: 4px; box-shadow: inset 0 0 0 1px var(--border-strong); text-decoration: none; overflow: hidden; min-height: 64px; }
.bookmark:hover { background: var(--bg-hover); }
.bookmark-main { flex: 1; min-width: 0; padding: 12px 14px; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.bookmark-title { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bookmark-url { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.bookmark-fav { width: 16px; height: 16px; border-radius: 4px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; flex: none; }
.bookmark-side { width: 64px; display: grid; place-items: center; color: var(--text-3); border-left: 1px solid var(--border); }
.file-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 4px; text-decoration: none; font-size: 14px; }
.file-row:hover { background: var(--bg-hover); }
.file-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.file-dl { color: var(--text-3); }
.media-box { border-radius: 4px; overflow: hidden; }
.media { width: 100%; max-height: 70vh; display: block; background: #000; border-radius: 4px; }
.media-audio { width: 100%; }
.pdf-frame { width: 100%; height: 70vh; border: 1px solid var(--border); border-radius: 4px; background: var(--bg-subtle); }
.link-block .link-icon { position: relative; display: inline-flex; }
.link-arrow { position: absolute; right: -3px; bottom: -4px; font-size: 10px; font-weight: 700; color: var(--text-2); background: var(--bg); border-radius: 3px; line-height: 1; padding: 0 1px; }
.breadcrumb-block { flex: 1; display: flex; align-items: center; flex-wrap: wrap; gap: 2px; padding: 3px 0; font-size: 14px; color: var(--text-2); }
.breadcrumb-block .crumb { color: var(--text-2); }

/* Comments */
.blk-comments { position: absolute; right: -44px; top: 4px; display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--text-2); padding: 2px 5px; border-radius: 5px; }
.blk-comments:hover { background: var(--bg-hover); color: var(--text); }
.blk-comments[hidden] { display: none; }
.cm-pop { padding: 6px; max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.cm-thread { border-radius: 6px; padding: 6px 4px; }
.cm-thread + .cm-thread { border-top: 1px solid var(--border); }
.cm-thread.resolved { opacity: 0.65; }
.cm-thread-head { display: flex; align-items: center; gap: 6px; padding: 0 4px 4px; }
.cm-quote { flex: 1; font-size: 13px; color: var(--text-2); border-left: 3px solid rgba(255, 212, 0, 0.8); padding-left: 8px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cm-resolve { flex: none; }
.cm-item { display: flex; gap: 8px; padding: 6px 4px; position: relative; }
.cm-avatar { width: 24px; height: 24px; border-radius: 50%; background: linear-gradient(135deg, #ff9966, #ff5e62); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; flex: none; }
.cm-main { flex: 1; min-width: 0; }
.cm-meta { display: flex; gap: 6px; align-items: baseline; font-size: 12px; color: var(--text-3); }
.cm-meta strong { color: var(--text); font-size: 13px; font-weight: 600; }
.cm-edited { font-style: italic; }
.cm-text { font-size: 14px; line-height: 1.5; word-break: break-word; margin-top: 2px; }
.cm-more { position: absolute; right: 2px; top: 4px; opacity: 0; }
.cm-item:hover .cm-more { opacity: 1; }
.cm-composer { display: flex; align-items: flex-start; gap: 8px; padding: 6px 4px; }
.cm-input { flex: 1; border: 0; outline: none; background: var(--bg-subtle); box-shadow: inset 0 0 0 1px var(--border-strong); border-radius: 6px; padding: 6px 8px; font-size: 14px; resize: none; line-height: 1.45; min-height: 32px; }
.cm-input:focus { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 2px var(--accent-soft); }
.cm-send { flex: none; }
.cm-new { display: flex; flex-direction: column; gap: 4px; }
.cm-toggle-resolved { align-self: flex-start; }
.page-discussion { margin: 4px 0 12px; padding: 4px 0 8px; border-bottom: 1px solid var(--border); }
.page-discussion[hidden] { display: none; }
.tb-comment span { font-size: 13px; }

/* Templates */
.template-banner { display: flex; align-items: center; gap: 8px; margin: 16px 0 0; padding: 10px 12px; border-radius: 6px; background: var(--bg-yellow); font-size: 13px; color: var(--text); }
.starter { margin: 8px 0 24px; }
.starter-hint { font-size: 14px; color: var(--text-3); margin-bottom: 8px; }
.starter-list { display: flex; flex-direction: column; gap: 1px; max-width: 420px; }
.starter-label { font-size: 12px; font-weight: 500; color: var(--text-3); padding: 12px 6px 4px; }
.starter-item { display: flex; align-items: center; gap: 10px; padding: 5px 6px; border-radius: 5px; color: var(--text-2); font-size: 14px; text-align: left; }
.starter-item:hover { background: var(--bg-hover); color: var(--text); }
.starter-item small { color: var(--text-3); font-size: 12px; margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
.starter-emoji { width: 16px; text-align: center; }

/* Version history */
.hist-modal { width: min(1000px, 94vw); height: min(680px, 84vh); }
.hist { display: flex; height: 100%; min-height: 0; }
.hist-side { width: 240px; flex: none; background: var(--bg-sidebar); padding: 12px 8px; display: flex; flex-direction: column; min-height: 0; }
.hist-list { overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.hist-item { display: flex; flex-direction: column; align-items: flex-start; padding: 6px 10px; border-radius: 6px; text-align: left; }
.hist-item:hover { background: var(--bg-hover); }
.hist-item.on { background: var(--bg-active); }
.hist-when { font-size: 14px; font-weight: 500; }
.hist-date { font-size: 12px; color: var(--text-3); }
.hist-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hist-bar { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.hist-label { font-size: 13px; color: var(--text-2); }
.hist-preview { flex: 1; overflow-y: auto; padding: 24px 48px; }
.hist-empty { text-align: center; color: var(--text-3); padding: 60px 0; }
.static-doc { font-size: 15px; line-height: 1.55; }
.st-title { font-size: 32px; font-weight: 700; margin: 0 0 12px; }
.static-doc .st-h { margin: 18px 0 4px; font-weight: 600; }
.static-doc h1.st-h { font-size: 1.7em; } .static-doc h2.st-h { font-size: 1.4em; } .static-doc h3.st-h { font-size: 1.2em; }
.st-p { margin: 2px 0; min-height: 1.4em; }
.st-li { display: flex; gap: 8px; align-items: flex-start; margin: 2px 0; }
.st-marker { width: 18px; flex: none; text-align: right; color: var(--text-2); }
.st-done .st-text { text-decoration: line-through; color: var(--text-3); }
.st-quote { border-left: 3px solid currentColor; margin: 6px 0; padding-left: 14px; }
.st-callout { display: flex; gap: 8px; background: var(--bg-gray); padding: 12px; border-radius: 4px; margin: 6px 0; }
.st-code { background: var(--bg-code); padding: 12px 16px; border-radius: 4px; font-family: var(--mono); font-size: 13px; overflow-x: auto; }
.st-img { max-width: 100%; border-radius: 4px; }
.st-link { display: flex; align-items: center; gap: 6px; font-weight: 500; margin: 3px 0; }
.st-table { border-collapse: collapse; margin: 6px 0; }
.st-table td { border: 1px solid var(--border-strong); padding: 5px 8px; font-size: 14px; }
.st-cols { display: flex; gap: 24px; } .st-cols > * { flex: 1; min-width: 0; }

/* Property values & editors */
.v-files { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.v-thumb img { width: 26px; height: 26px; object-fit: cover; border-radius: 3px; display: block; box-shadow: inset 0 0 0 1px var(--border); }
.v-file { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; padding: 1px 6px; border-radius: 3px; background: var(--tag-default); text-decoration: none; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-rel { display: inline-flex; flex-wrap: wrap; gap: 2px 8px; }
.v-rel-item { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.v-rel-item span { border-bottom: 1px solid var(--border-strong); line-height: 1.3; }
.v-rel-item .page-glyph { color: var(--text-2); }
.v-error { color: var(--danger); font-size: 12px; }
.v-muted { color: var(--text-3); }
.v-check.readonly { cursor: default; }
.v-id { color: var(--text-2); }
.dbt-td .v-rel, .dbt-td .v-files { flex-wrap: nowrap; overflow: hidden; }
.files-editor { display: flex; flex-direction: column; }
.files-list { padding: 4px; max-height: 260px; overflow-y: auto; }
.files-row { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 5px; }
.files-row:hover { background: var(--bg-hover); }
.files-name { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.files-foot { padding: 6px 8px; border-top: 1px solid var(--border); }
.rel-row .page-glyph, .rel-row .page-emoji { flex: none; }
.rel-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.rel-add { color: var(--text-3); }
.config { padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.config-title { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.config-label { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.config-actions { display: flex; justify-content: flex-end; margin-top: 8px; gap: 6px; }
.rel-pick { display: flex; align-items: center; gap: 6px; text-align: left; color: var(--text); cursor: pointer; }
.rel-pick .ic:last-child { margin-left: auto; color: var(--text-3); }
.check-line { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--text-2); margin-top: 6px; cursor: pointer; }
.check-line input { margin-top: 2px; }
.formula-editor { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.formula-input { width: 100%; min-height: 72px; font-family: var(--mono); font-size: 13px; line-height: 1.5; border: 0; outline: none; border-radius: 6px; padding: 8px 10px; resize: vertical; background: var(--bg-subtle); box-shadow: inset 0 0 0 1px var(--border-strong); }
.formula-input:focus { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 2px var(--accent-soft); }
.formula-status { font-size: 12px; color: var(--text-2); min-height: 18px; }
.formula-status.error { color: var(--danger); }
.formula-body { display: flex; gap: 10px; min-height: 0; }
.formula-cols { display: flex; gap: 8px; flex: 1; min-width: 0; }
.formula-list { flex: 1; min-width: 0; max-height: 220px; overflow-y: auto; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--border); padding: 2px; }
.formula-item { display: flex; align-items: center; gap: 6px; width: 100%; padding: 4px 8px; border-radius: 4px; font-size: 13px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.formula-item:hover { background: var(--bg-hover); }
.formula-item code { font-family: var(--mono); font-size: 12px; }
.formula-help { width: 200px; flex: none; font-size: 12px; color: var(--text-2); padding: 6px; }
.formula-help code { display: block; font-family: var(--mono); font-size: 12px; color: var(--text); margin-bottom: 6px; word-break: break-word; }
.formula-help p { margin: 0; }
.dp-foot { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }

/* Table footer calculations & groups */
.dbt-calcs { display: flex; min-height: 32px; }
.dbt-calc { flex: none; display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding: 0 8px; font-size: 12px; color: var(--text-2); height: 32px; overflow: hidden; }
.dbt-calc:hover { background: var(--bg-hover); }
.dbt-calc.empty .dbt-calc-hint { opacity: 0; display: inline-flex; align-items: center; gap: 3px; color: var(--text-3); }
.dbt-calcs:hover .dbt-calc.empty .dbt-calc-hint { opacity: 1; }
.dbt-calc-label { color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: 0.02em; white-space: nowrap; }
.dbt-calc-value { color: var(--text); font-weight: 500; white-space: nowrap; }
.dbt-group { margin-top: 10px; }
.group-head { display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 4px; cursor: pointer; border-radius: 5px; position: sticky; left: 0; }
.group-head:hover { background: var(--bg-subtle); }
.group-toggle { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 4px; color: var(--text-2); }
.group-toggle .ic { transition: transform 0.15s; }
.group-toggle.open .ic { transform: rotate(90deg); }
.group-add { opacity: 0; }
.group-head:hover .group-add { opacity: 1; }
.group-check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.dblist .group-head { margin-top: 6px; }

/* Timeline */
.tl { display: flex; border-top: 1px solid var(--border); min-height: 200px; }
.tl-names { width: 240px; flex: none; border-right: 1px solid var(--border); }
.tl-names-head { height: 52px; display: flex; align-items: flex-end; padding: 0 8px 8px; font-size: 12px; color: var(--text-3); border-bottom: 1px solid var(--border); }
.tl-name { height: 38px; display: flex; align-items: center; gap: 6px; padding: 0 8px; font-size: 14px; cursor: pointer; border-bottom: 1px solid var(--border); overflow: hidden; white-space: nowrap; }
.tl-name span:last-child { overflow: hidden; text-overflow: ellipsis; }
.tl-name:hover { background: var(--bg-hover); }
.tl-name .page-glyph { color: var(--text-2); }
.tl-scroll { flex: 1; min-width: 0; overflow-x: auto; position: relative; }
.tl-header { position: relative; height: 52px; border-bottom: 1px solid var(--border); }
.tl-months { position: relative; height: 26px; }
.tl-month { position: absolute; top: 6px; font-size: 13px; font-weight: 600; text-transform: capitalize; padding-left: 6px; white-space: nowrap; border-left: 1px solid var(--border); }
.tl-ticks { position: relative; height: 26px; }
.tl-tick { position: absolute; top: 4px; font-size: 11px; color: var(--text-3); padding-left: 4px; }
.tl-tick.today { color: #fff; background: var(--danger); border-radius: 8px; padding: 0 5px; }
.tl-weekend { position: absolute; top: 0; height: 100vh; background: var(--bg-subtle); pointer-events: none; z-index: -1; }
.tl-lanes { position: relative; }
.tl-lane { height: 38px; position: relative; border-bottom: 1px solid var(--border); }
.tl-lane.empty { cursor: copy; }
.tl-empty-hint { position: sticky; left: 12px; top: 10px; font-size: 12px; color: var(--text-3); opacity: 0; display: inline-block; margin-top: 10px; margin-left: 12px; }
.tl-lane.empty:hover .tl-empty-hint { opacity: 1; }
.tl-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger); opacity: 0.6; z-index: 1; pointer-events: none; }
.tl-bar { position: absolute; top: 6px; height: 26px; border-radius: 5px; background: var(--bg-elevated); box-shadow: var(--shadow-sm); display: flex; align-items: center; padding: 0 8px; font-size: 12px; font-weight: 500; cursor: grab; overflow: hidden; white-space: nowrap; margin-left: 2px; }
.tl-bar:hover { box-shadow: var(--shadow); }
.tl-bar-title { overflow: hidden; text-overflow: ellipsis; }
.tl-handle { position: absolute; top: 0; bottom: 0; width: 7px; cursor: ew-resize; }
.tl-handle.left { left: 0; } .tl-handle.right { right: 0; }
.tl-bar:hover .tl-handle { background: var(--accent-soft); }
.tl .dbt-new { border-bottom: 0; }
.btn-ghost.on { background: var(--bg-active); color: var(--text); }

/* Centered peek, search filters, workspace, misc */
.peek-backdrop.dim { background: rgba(15, 15, 15, 0.45); }
.peek.peek-center { top: 5vh; bottom: 5vh; right: auto; left: 50%; width: min(980px, 92vw); margin-left: calc(min(980px, 92vw) / -2); border-radius: 10px; transform: translateY(12px) scale(0.99); box-shadow: var(--shadow); overflow: hidden; }
.peek.peek-center.open { transform: none; }
.search-filters { display: flex; gap: 6px; padding: 8px 14px; border-bottom: 1px solid var(--border); flex: none; }
.search-filter { font-size: 12px; padding: 3px 10px; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--border-strong); color: var(--text-2); }
.search-filter:hover { background: var(--bg-hover); }
.search-filter.on { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(35, 131, 226, 0.35); }
.ws-form { display: flex; gap: 8px; align-items: center; max-width: 380px; margin-top: 12px; }
.ws-icon { font-weight: 700; }
.sb-avatar.emoji { background: none; font-size: 17px; }
.dbv-linked { color: var(--text-3); font-weight: 700; font-size: 16px; }
.emoji-menu .menu-item { min-height: 30px; }
.slash-tile .ic { color: var(--text-2); }

/* Print: just the page content */
@media print {
  body { overflow: visible; background: #fff; color: #000; }
  #app { display: block; height: auto; }
  .sidebar, .topbar, .blk-handle, .page-controls, .cover-actions, .toolbar, .toasts, .layer, .page-below, .starter, .blk-comments, .dbv-toolbar .dbv-actions, .dbt-add-col, .dbt-new, .dbt-gutter, .tbl-add-row, .tbl-add-col, .code-bar, .image-tools, .image-resize { display: none !important; }
  .view { overflow: visible; }
  .page-view { padding-bottom: 0; --pad: 0px; }
  .page-inner, .page-db { max-width: none; }
  .page-head { padding-top: 0; }
  .blk { break-inside: avoid; }
  .peek, .peek-backdrop { display: none !important; }
  body.print-peek #app { display: none; }
  body.print-peek .peek { display: flex !important; position: static; width: auto; box-shadow: none; transform: none; opacity: 1; }
  body.print-peek .peek-head { display: none; }
  a { text-decoration: none; }
}

/* Light / dark switch in the top bar */
.theme-switch { position: relative; width: 40px; height: 22px; border-radius: 11px; background: var(--border-strong); flex: none; margin: 0 8px 0 4px; transition: background 0.2s; }
.theme-switch:hover { background: var(--bg-active); box-shadow: inset 0 0 0 1px var(--border-strong); }
.theme-switch.dark { background: var(--accent); }
.theme-switch-knob { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; color: rgb(217, 145, 13); display: grid; place-items: center; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.2s; }
.theme-switch.dark .theme-switch-knob { transform: translateX(18px); color: var(--accent); }
@media print { .theme-switch { display: none; } }

/* ---------- Import ---------- */
.import-modal { width: min(520px, 94vw); padding: 22px 22px 18px; overflow-y: auto; }
.import-title { margin: 0 0 4px; font-size: 18px; font-weight: 600; }
.import-modal > .muted { margin: 0 0 16px; font-size: 13px; }
.import-sources { display: flex; flex-direction: column; gap: 8px; }
.import-source { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--border); text-align: left; color: var(--text-2); }
.import-source:hover { background: var(--bg-hover); }
.import-source strong { display: block; color: var(--text); font-weight: 500; font-size: 14px; }
.import-source small { display: block; color: var(--text-3); font-size: 12px; line-height: 1.4; }
.import-logo { flex: none; width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; background: var(--text); color: var(--bg); font: 700 17px/1 var(--serif); }
.import-help { margin-top: 16px; font-size: 13px; color: var(--text-2); }
.import-help summary { cursor: pointer; color: var(--text-2); }
.import-help ol { margin: 8px 0 0; padding-left: 20px; line-height: 1.55; }
.import-busy-modal { width: 340px; }
.import-busy { display: flex; align-items: center; gap: 14px; padding: 20px; }
.import-busy strong { display: block; font-weight: 500; font-size: 14px; }
.import-busy small { display: block; color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.spinner { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Recurring templates ---------- */
.repeat-form { display: flex; flex-direction: column; gap: 10px; padding: 12px; font-size: 14px; }
.repeat-head { display: flex; align-items: center; gap: 6px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.repeat-field { display: flex; align-items: center; gap: 8px; }
.repeat-label { width: 72px; flex: none; color: var(--text-2); font-size: 13px; }
.repeat-select { flex: 1; appearance: auto; }
.repeat-num { width: 64px; }
.repeat-time { width: 110px; }
.repeat-days { display: flex; gap: 4px; }
.repeat-day { width: 28px; height: 28px; border-radius: 50%; font-size: 12px; font-weight: 500; color: var(--text-2); box-shadow: inset 0 0 0 1px var(--border-strong); }
.repeat-day:hover { background: var(--bg-hover); }
.repeat-day.on { background: var(--accent); color: #fff; box-shadow: none; }
.repeat-summary { display: flex; gap: 8px; padding: 10px; border-radius: var(--radius); background: var(--bg-subtle); box-shadow: inset 0 0 0 1px var(--border); font-size: 13px; line-height: 1.45; }
.repeat-summary .ic { margin-top: 2px; color: var(--accent); }
.repeat-summary .muted { font-size: 12px; margin-top: 2px; }
.repeat-hint { margin: 0; font-size: 12px; line-height: 1.5; }
.repeat-actions { display: flex; justify-content: flex-end; gap: 6px; }

/* ---------- Buttons ---------- */
.btn-block-row { display: flex; align-items: center; gap: 4px; padding: 3px 0; }
.btn-block { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 30px; padding: 0 10px; border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--border-strong); background: var(--bg); color: var(--text); font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background 0.1s; }
.btn-block:hover { background: var(--bg-hover); }
.btn-block:active { background: var(--bg-active); }
.btn-block .ic { color: var(--text-2); }
.btn-block-emoji { font-size: 15px; line-height: 1; }
.btn-block-edit { opacity: 0; transition: opacity 0.1s; }
.blk:hover .btn-block-edit, .btn-block-edit:focus-visible { opacity: 1; }
.pop-button { max-height: min(80vh, 680px); overflow-y: auto; }
.btn-editor { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.btn-editor-head { display: flex; gap: 6px; align-items: center; }
.btn-editor-emoji { flex: none; width: 32px; height: 32px; border-radius: var(--radius); display: grid; place-items: center; font-size: 17px; box-shadow: inset 0 0 0 1px var(--border-strong); color: var(--text-2); }
.btn-editor-emoji:hover { background: var(--bg-hover); }
.btn-action { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--border); background: var(--bg-subtle); }
.btn-action-head { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text); }
.btn-action-head .ic { color: var(--text-2); }
.btn-action-num { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; background: var(--bg-active); color: var(--text-2); }
.btn-action-editor { min-height: 34px; max-height: 260px; overflow-y: auto; padding: 4px 4px 4px 28px; border-radius: var(--radius); background: var(--bg); box-shadow: inset 0 0 0 1px var(--border); font-size: 14px; }
.act-list { display: flex; flex-direction: column; gap: 4px; }
.act-row { display: flex; align-items: center; gap: 6px; }
.act-prop, .act-value { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 8px; border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--border-strong); font-size: 13px; color: var(--text); max-width: 170px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.act-prop:hover, .act-value:hover { background: var(--bg-hover); }
.act-prop .ic { color: var(--text-2); }
.act-value { flex: 1; justify-content: space-between; max-width: none; }
.act-value > .ic { color: var(--text-3); }
.act-input { flex: 1; height: 28px; font-size: 13px; }
.act-arrow { color: var(--text-3); font-size: 13px; }
.act-add { align-self: flex-start; }
.act-empty { font-size: 12px; color: var(--text-3); line-height: 1.5; }
.v-button { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border-radius: 5px; box-shadow: inset 0 0 0 1px var(--border-strong); background: var(--bg); color: var(--text); font-size: 13px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.v-button:hover { background: var(--bg-hover); }
.v-button:active { background: var(--bg-active); }
.v-button .ic { color: var(--text-2); }
@media print { .btn-block-edit { display: none; } }

/* ---------- Date mentions & reminders ---------- */
.date-mention { color: var(--text-2); border-radius: 3px; padding: 0 2px; white-space: nowrap; cursor: pointer; }
.date-mention::before { content: '@'; opacity: 0.6; }
.date-mention:hover { background: var(--bg-hover); }
.date-mention.has-remind { color: var(--accent); }
.date-mention.has-remind::after { content: ''; display: inline-block; width: 0.85em; height: 0.85em; margin-left: 3px; vertical-align: -0.08em; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M6 16.5V11a6 6 0 0 1 12 0v5.5l1.5 2h-15z'/%3E%3Cpath d='M10 20.5a2 2 0 0 0 4 0'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M6 16.5V11a6 6 0 0 1 12 0v5.5l1.5 2h-15z'/%3E%3Cpath d='M10 20.5a2 2 0 0 0 4 0'/%3E%3C/svg%3E") center / contain no-repeat; }
.v-remind { display: inline-flex; margin-left: 5px; color: var(--accent); vertical-align: -2px; }
.dp-remind { display: flex; align-items: center; gap: 6px; padding: 8px 0 2px; border-top: 1px solid var(--border); margin-top: 6px; color: var(--text-2); font-size: 13px; }
.dp-remind-days { flex: 1; height: 28px; font-size: 13px; appearance: auto; padding: 0 6px; }
.dp-remind-time { width: 92px; height: 28px; font-size: 13px; }
.dp-remind-time:disabled { opacity: 0.45; }
.sb-badge { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 600; display: inline-grid; place-items: center; }
.sb-badge[hidden] { display: none; }
.rem-panel { display: flex; flex-direction: column; max-height: 70vh; }
.rem-head { display: flex; align-items: center; gap: 6px; padding: 12px 14px 6px; font-weight: 600; font-size: 14px; }
.rem-list { overflow-y: auto; padding: 0 6px 6px; }
.rem-row { display: flex; align-items: flex-start; gap: 10px; padding: 7px 8px; border-radius: 6px; color: var(--text); text-decoration: none; }
.rem-row:hover { background: var(--bg-hover); }
.rem-dot { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.rem-dot.past { background: var(--bg-active); color: var(--text-2); }
.rem-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rem-title { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rem-body { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rem-when { flex: none; font-size: 12px; color: var(--text-3); padding-top: 2px; }
.rem-empty { font-size: 13px; color: var(--text-3); padding: 4px 10px 8px; }
.rem-hint { display: flex; gap: 6px; align-items: flex-start; margin: 0 12px 8px; padding: 8px 10px; border-radius: 6px; background: var(--bg-subtle); box-shadow: inset 0 0 0 1px var(--border); font-size: 12px; color: var(--text-2); line-height: 1.45; }
.rem-hint .ic { margin-top: 1px; flex: none; }
.btn-link { color: var(--accent); font-size: inherit; padding: 0; text-decoration: underline; }
.rem-foot { padding: 8px 14px 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); line-height: 1.45; }

/* ---------- Synced blocks ---------- */
.synced { flex: 1; min-width: 0; position: relative; margin: 2px 0; border-radius: 6px; box-shadow: inset 0 0 0 1px transparent; transition: box-shadow 0.12s; }
.blk:hover > .blk-content > .synced, .synced:focus-within { box-shadow: inset 0 0 0 2px rgba(235, 87, 87, 0.55); }
.synced-bar { position: absolute; top: -13px; left: 8px; right: 8px; display: flex; gap: 6px; opacity: 0; pointer-events: none; transition: opacity 0.12s; z-index: 2; }
.blk:hover > .blk-content > .synced .synced-bar, .synced:focus-within .synced-bar { opacity: 1; pointer-events: auto; }
.synced-pages, .synced-copy { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border-radius: 5px; background: var(--bg-elevated); box-shadow: var(--shadow-sm); font-size: 12px; color: rgb(235, 87, 87); font-weight: 500; }
.synced-copy { color: var(--text-2); }
.synced-pages:hover, .synced-copy:hover { background: var(--bg-hover); }
.synced-editor { padding: 6px 8px 6px 28px; min-height: 36px; }
.synced-missing { display: flex; align-items: center; gap: 6px; padding: 8px 10px; color: var(--text-3); font-size: 14px; }
@media print { .synced { box-shadow: none !important; } .synced-bar { display: none; } }

/* ---------- Chart view ---------- */
/* Validated categorical palette (fixed order), stepped separately for the dark surface. */
:root { --viz-1: #2a78d6; --viz-2: #eb6834; --viz-3: #1baf7a; --viz-4: #eda100; --viz-5: #e87ba4; --viz-6: #008300; --viz-7: #4a3aa7; --viz-8: #e34948; --viz-other: #a3a29c; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --viz-1: #3987e5; --viz-2: #d95926; --viz-3: #199e70; --viz-4: #c98500; --viz-5: #d55181; --viz-6: #008300; --viz-7: #9085e9; --viz-8: #e66767; --viz-other: #6f6e69; }
}
:root[data-theme="dark"] { --viz-1: #3987e5; --viz-2: #d95926; --viz-3: #199e70; --viz-4: #c98500; --viz-5: #d55181; --viz-6: #008300; --viz-7: #9085e9; --viz-8: #e66767; --viz-other: #6f6e69; }
.chart { position: relative; padding: 12px 0 8px; }
.chart-title { display: flex; align-items: baseline; gap: 8px; font-size: 14px; font-weight: 500; color: var(--text); margin-bottom: 8px; }
.chart-sub { font-size: 12px; font-weight: 400; color: var(--text-3); }
.chart-plot { width: 100%; min-height: 120px; }
.chart-svg { display: block; overflow: visible; font-family: var(--font); }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-axis { stroke: var(--border-strong); stroke-width: 1; }
.chart-tick { fill: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-label { fill: var(--text-2); font-size: 12px; }
.chart-total { fill: var(--text); font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-bar { fill: var(--viz-1); transition: opacity 0.12s; }
.chart-bar.other { fill: var(--viz-other); }
.chart-line { fill: none; stroke: var(--viz-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { fill: var(--viz-1); stroke: var(--bg); stroke-width: 2; }
.chart-cross, .chart-hover-dot { opacity: 0; pointer-events: none; }
.chart-cross { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-svg.hovering .chart-cross, .chart-svg.hovering .chart-hover-dot { opacity: 1; }
.chart-hit { fill: transparent; cursor: pointer; outline: none; }
.chart-hit:hover, .chart-hit:focus-visible { fill: var(--bg-hover); }
.chart-slice { stroke: var(--bg); stroke-width: 2; cursor: pointer; outline: none; transition: opacity 0.12s; }
.chart-slice.ring { fill: none; stroke-width: 34; }
.chart-svg:has(.chart-slice:hover) .chart-slice:not(:hover) { opacity: 0.55; }
.chart-slice:focus-visible { opacity: 0.8; }
.chart-donut { display: flex; align-items: center; gap: 28px; }
.chart-donut.stacked { flex-direction: column; align-items: stretch; }
.chart-donut.stacked .chart-svg { align-self: center; }
.chart-legend { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.chart-legend-item { display: grid; grid-template-columns: 12px 1fr auto 48px; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 5px; font-size: 13px; color: var(--text); text-align: left; }
.chart-legend-item:hover { background: var(--bg-hover); }
.chart-swatch { width: 10px; height: 10px; border-radius: 3px; }
.chart-legend-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-legend-value { font-variant-numeric: tabular-nums; color: var(--text); }
.chart-legend-pct { font-variant-numeric: tabular-nums; color: var(--text-3); text-align: right; }
.chart-tip { position: absolute; top: 0; left: 0; z-index: 5; pointer-events: none; display: flex; flex-direction: column; gap: 2px; max-width: 260px; padding: 8px 10px; border-radius: 6px; background: var(--bg-elevated); box-shadow: var(--shadow); font-size: 13px; color: var(--text); opacity: 0; transition: opacity 0.08s; }
.chart-tip.on { opacity: 1; }
.chart-tip strong { font-weight: 600; }
.chart-tip small { color: var(--text-3); font-size: 11px; }
.chart-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 40px 0; color: var(--text-3); font-size: 14px; }
.chart-rows { max-height: 360px; overflow-y: auto; padding: 4px; }

/* ---------- Form view ---------- */
.form-bar { display: flex; align-items: center; gap: 4px; padding: 8px 0; }
.form-tab { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: 5px; font-size: 13px; color: var(--text-2); }
.form-tab:hover { background: var(--bg-hover); }
.form-tab.on { background: var(--bg-active); color: var(--text); font-weight: 500; }
.form-card { max-width: 640px; margin: 8px auto 24px; padding: 28px 32px; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--border); background: var(--bg); }
.form-body { display: flex; flex-direction: column; gap: 22px; }
.form-title { font-size: 28px; font-weight: 700; margin: 0; line-height: 1.2; }
.form-desc { margin: -12px 0 0; color: var(--text-2); font-size: 15px; line-height: 1.5; white-space: pre-wrap; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 15px; font-weight: 500; color: var(--text); }
.form-required { color: var(--danger); }
.form-help { font-size: 13px; color: var(--text-3); line-height: 1.45; }
.form-input { height: 36px; font-size: 15px; }
.form-textarea { height: auto; min-height: 76px; padding: 8px 10px; resize: vertical; line-height: 1.5; font-family: inherit; }
.form-check { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; cursor: pointer; }
.form-check input { width: 16px; height: 16px; }
.form-options { display: flex; flex-wrap: wrap; gap: 6px; }
.form-relation { max-height: 220px; overflow-y: auto; margin-top: 6px; }
.form-option { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 3px 10px 3px 6px; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--border-strong); font-size: 14px; color: var(--text); }
.form-option:hover { background: var(--bg-hover); }
.form-option.on { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); }
.form-option-mark { width: 16px; height: 16px; border-radius: 4px; box-shadow: inset 0 0 0 1px var(--border-strong); display: grid; place-items: center; color: #fff; flex: none; }
.form-option.on .form-option-mark { background: var(--accent); box-shadow: none; }
.form-files { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.form-file { display: inline-flex; align-items: center; gap: 4px; padding: 2px 2px 2px 8px; border-radius: 5px; background: var(--bg-subtle); box-shadow: inset 0 0 0 1px var(--border); font-size: 13px; }
.form-error { display: none; font-size: 13px; color: var(--danger); }
.form-field.invalid .form-error { display: block; }
.form-field.invalid .form-input, .form-field.invalid .form-options { box-shadow: inset 0 0 0 1px var(--danger); border-radius: var(--radius); }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.form-submit { height: 38px; padding: 0 20px; font-size: 15px; }
.form-thanks { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 24px 0; }
.form-thanks h2 { margin: 0; font-size: 22px; }
.form-thanks .form-desc { margin: 0 0 8px; }
.form-thanks-icon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; }
.form-builder { display: flex; flex-direction: column; gap: 10px; }
.form-title-input { height: 44px; font-size: 22px; font-weight: 600; }
.form-builder textarea { height: auto; padding: 8px 10px; resize: vertical; font-family: inherit; line-height: 1.5; }
.form-q { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 8px; background: var(--bg-subtle); box-shadow: inset 0 0 0 1px var(--border); }
.form-q-head { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); }
.form-q-prop { font-weight: 500; }
.form-toggle { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); margin-right: 6px; cursor: pointer; }
.form-q-label { font-weight: 500; }
.form-q-help { height: 28px; font-size: 13px; }
.form-builder-foot { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px solid var(--border); }
.form-builder-row { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
body.form-standalone .sidebar, body.form-standalone .topbar { display: none !important; }
.form-page { min-height: 100%; padding: 48px 16px; background: var(--bg-subtle); }
.form-page .form-card { margin-top: 0; box-shadow: var(--shadow-sm); }
@media (max-width: 700px) { .form-card { padding: 20px 16px; } .form-builder-row { grid-template-columns: 1fr; } }
.form-bar a { text-decoration: none; }


/* ---------- Desk charte (whole app) ----------
   The notebook shares the Projets world: the pale-blue ground carries the sidebar, each page is a
   white rounded sheet, headings are heavy navy, the primary action is magenta. */
body { background: var(--bg-sidebar); font-weight: 500; }
.main { background: var(--bg-sidebar); }
.topbar { background: transparent; }
body:not(.in-work) .view { background: var(--bg); margin: 0 12px 12px 0; border-radius: 22px; box-shadow: var(--shadow-sm); scrollbar-color: var(--border-strong) transparent; }
body.sidebar-closed:not(.in-work) .view { margin-left: 12px; }

/* Sidebar on the ground; the open page is a white pill */
.sidebar { background: var(--bg-sidebar); border-right: 0; }
.sb-top { padding: 12px 10px 6px; }
.sb-workspace { height: 36px; border-radius: 12px; font-weight: 800; }
.sb-avatar { width: 26px; height: 26px; border-radius: 8px; background: #c2268d; font-weight: 800; }
.sb-ws-name { font-size: 15px; }
.sb-nav { padding: 2px 10px 10px; gap: 2px; }
.sb-item, .sb-row { height: 34px; border-radius: 10px; font-weight: 600; }
.sb-row.active { background: var(--bg); color: var(--text); font-weight: 700; box-shadow: var(--shadow-sm); }
.sb-scroll { padding: 0 10px 12px; }
.sb-section-head { border-radius: 10px; }
.sb-section-label { font-weight: 700; }
.sb-chevron { background: transparent; }
.sb-bottom { border-top: 0; padding: 8px 10px 12px; }
.crumb { border-radius: 8px; font-weight: 600; }

/* Buttons, inputs, menus */
.btn { height: 36px; padding: 0 14px; border-radius: 12px; font-weight: 700; box-shadow: inset 0 0 0 2px #3cc6ef; background: var(--bg); }
.btn:hover { background: color-mix(in srgb, #3cc6ef 12%, var(--bg)); }
.btn-primary { background: #c2268d; color: #fff; box-shadow: 0 6px 16px -8px rgba(194, 38, 141, 0.7); font-weight: 700; }
.btn-primary:hover { background: #a61f78; }
.btn-danger { box-shadow: none; font-weight: 700; }
.btn-sm { height: 32px; padding: 0 12px; border-radius: 10px; font-size: 13px; }
.btn-ghost { border-radius: 10px; font-weight: 600; height: 32px; }
.btn-icon { border-radius: 8px; }
.input { height: 38px; border-radius: 12px; background: var(--bg); box-shadow: inset 0 0 0 1.5px var(--border-input); padding: 0 12px; }
.input:focus { box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 3px var(--accent-soft); }
.pop { border-radius: 16px; }
.menu-list { padding: 6px; }
.menu-item { border-radius: 8px; min-height: 32px; font-weight: 500; }
.menu-search { height: 34px; border-radius: 10px; background: var(--bg); box-shadow: inset 0 0 0 1.5px var(--border-strong); }
.modal-backdrop { background: rgba(27, 15, 77, 0.45); }
.tooltip { background: #1b0f4d; border-radius: 8px; font-weight: 600; }
/* One keyboard ring for the whole app, as in Projets. */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.blk-text:focus-visible, .page-title:focus-visible, .editor:focus-visible, .view:focus-visible, [contenteditable]:focus-visible, .input:focus-visible, .menu-search:focus-visible, .search-input:focus-visible { outline: none; }
.blk-todo.checked .check .ic, .toast { background: #1b0f4d; border-radius: 14px; font-weight: 600; }
kbd { border-radius: 6px; font-weight: 600; }

/* Pages: heavy navy headings, calm reading text */
.page-title { font-weight: 800; letter-spacing: -0.025em; }
.blk-h1 .blk-text, .blk-h2 .blk-text, .blk-h3 .blk-text { font-weight: 800; letter-spacing: -0.015em; }
.editor { font-weight: 450; line-height: 1.6; }
.blk-text b { font-weight: 800; }
.blk-text code, .blk-caption code { color: #c2268d; border-radius: 6px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) :is(.blk-text, .blk-caption) code { color: #f06bc2; } }
:root[data-theme="dark"] :is(.blk-text, .blk-caption) code { color: #f06bc2; }
.blk-text a:not(.mention), .blk-caption a:not(.mention) { text-decoration-color: #3cc6ef; text-decoration-thickness: 2px; }
.blk-callout > .blk-content { border-radius: 16px; }
.page-cover { border-radius: 22px 22px 0 0; }
.page-icon { border-radius: 14px; }
.ctl-btn, .prop-label, .prop-value, .prop-add { border-radius: 8px; }
.page-props { border-bottom-color: var(--border); }
.work-link { border-radius: 999px; border: 0; background: var(--bg-subtle); padding: 3px 12px; font-weight: 600; }
.work-link:hover { background: var(--accent-soft); }
.work-link-key { color: var(--accent); font-weight: 800; }
.backlinks-toggle, .backlink { border-radius: 8px; }

/* Tags become pills */
.tag { border-radius: 999px; padding: 0 9px; font-weight: 600; height: 22px; line-height: 22px; }
.tag-none { padding: 0; }
.v-check { border-radius: 5px; }
.v-check.on { background: #c2268d; border-color: #c2268d; }

/* Databases */
.dbv-title { font-weight: 800; letter-spacing: -0.015em; }
.dbv-new { background: #c2268d; border-radius: 10px; height: 32px; box-shadow: 0 6px 16px -8px rgba(194, 38, 141, 0.7); }
.dbv-new button { font-weight: 700; }
.dbv-new button:hover { background: rgba(0, 0, 0, 0.14); }
.dbv-toolbar { border-bottom: 0; }
.dbv-tab { border-radius: 10px; font-weight: 700; }
.dbv-tab.active { background: var(--bg-subtle); }
.dbv-tab.active::after { display: none; }
.dbt-th { font-weight: 700; }
.card { border-radius: 14px; }
.board-cards { gap: 8px; }
.form-card { border-radius: 20px; }

/* Peek, home, search, settings */
.peek { border-radius: 22px 0 0 22px; }
.home-title { font-size: 36px; font-weight: 800; letter-spacing: -0.02em; }
.home-label { font-size: 13px; font-weight: 700; }
.home-card { border-radius: 20px; }
.home-card-title { font-weight: 800; }
.home-action { border-radius: 16px; box-shadow: none; background: var(--bg-subtle); }
.home-action strong { font-weight: 800; }
.home-row, .search-row, .trash-row { border-radius: 10px; }
.search-input { font-weight: 600; }
.search-excerpt mark { background: rgba(60, 198, 239, 0.3); }
.settings-nav { background: var(--bg-sidebar); }
.settings-tab { border-radius: 10px; font-weight: 600; }
.settings-tab.on { background: var(--bg); box-shadow: var(--shadow-sm); font-weight: 700; }
.settings-pane h2 { font-weight: 800; font-size: 18px; }
.theme-opt { border-radius: 14px; }
@media (max-width: 900px) { body:not(.in-work) .view { margin-left: 12px; } }
@media (max-width: 700px) { body:not(.in-work) .view, body.sidebar-closed:not(.in-work) .view { margin: 0; border-radius: 0; box-shadow: none; } .page-cover { border-radius: 0; } }

/* ---------- Projects ----------
   A bright work desk: pale-blue ground, rounded white cards, deep navy-violet ink and a small
   saturated palette (magenta, cyan, green, blue, violet). Colour always travels with a word. */
/* Figtree, self-hosted (SIL OFL, see /fonts/Figtree-OFL.txt) */
@font-face { font-family: 'Figtree'; src: url('/fonts/figtree-latin-wght-normal.woff2') format('woff2'); font-weight: 300 900; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Figtree'; src: url('/fonts/figtree-latin-ext-wght-normal.woff2') format('woff2'); font-weight: 300 900; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --w-font: 'Figtree', ui-sans-serif, -apple-system, "Segoe UI", sans-serif;
  --w-ground: #eef3fc; --w-surface: #ffffff; --w-surface-2: #f4f7fe; --w-line: #e2e7f4; --w-line-strong: #cdd5ea;
  --w-ink: #1b0f4d; --w-ink-2: #4a4470; --w-ink-3: #6b6790;
  --w-magenta: #c2268d; --w-magenta-soft: #fcebf5;
  --w-cyan: #3cc6ef; --w-cyan-text: #0a7499; --w-cyan-soft: #e5f7fd;
  --w-green: #34c46a; --w-green-text: #1b7f40; --w-green-soft: #e7f8ed;
  --w-blue: #265fd0; --w-blue-soft: #eaf1fd;
  --w-violet: #5b3fd6; --w-violet-soft: #efebfd;
  --w-inkcard: #1b0f4d; --w-inkcard-2: #c9c3f0;
  --w-accent: var(--w-blue); --w-late: var(--w-magenta);
  --w-shadow: 0 1px 2px rgba(27, 15, 77, 0.04), 0 12px 28px -16px rgba(27, 15, 77, 0.2);
  --w-radius: 20px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --w-ground: #0f0a26; --w-surface: #1a1340; --w-surface-2: #221a4d; --w-line: #2d2560; --w-line-strong: #3d3478;
  --w-ink: #f4f2ff; --w-ink-2: #c7c2ea; --w-ink-3: #a29dcb;
  --w-magenta: #f06bc2; --w-magenta-soft: #3a1845; --w-cyan-text: #6ad9f8; --w-cyan-soft: #10304a; --w-green-text: #62e295; --w-green-soft: #12352c;
  --w-blue: #86adff; --w-blue-soft: #1b2758; --w-violet: #ad9cff; --w-violet-soft: #2a1f5e; --w-inkcard: #2b2170; --w-inkcard-2: #d3cdf6;
  --w-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 30px -18px rgba(0, 0, 0, 0.6);
} }
:root[data-theme="dark"] {
  --w-ground: #0f0a26; --w-surface: #1a1340; --w-surface-2: #221a4d; --w-line: #2d2560; --w-line-strong: #3d3478;
  --w-ink: #f4f2ff; --w-ink-2: #c7c2ea; --w-ink-3: #a29dcb;
  --w-magenta: #f06bc2; --w-magenta-soft: #3a1845; --w-cyan-text: #6ad9f8; --w-cyan-soft: #10304a; --w-green-text: #62e295; --w-green-soft: #12352c;
  --w-blue: #86adff; --w-blue-soft: #1b2758; --w-violet: #ad9cff; --w-violet-soft: #2a1f5e; --w-inkcard: #2b2170; --w-inkcard-2: #d3cdf6;
  --w-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 30px -18px rgba(0, 0, 0, 0.6);
}
body.in-work .view { background: var(--w-ground); }
/* Inside Projects the app's own tokens take the desk palette, so shared inputs, menus and buttons follow. */
.wk, .wk-drawer, body.in-work .pop {
  --bg: var(--w-surface); --bg-subtle: var(--w-surface-2); --bg-sidebar: var(--w-surface-2); --bg-elevated: var(--w-surface);
  --bg-hover: color-mix(in srgb, var(--w-violet) 7%, transparent); --bg-active: color-mix(in srgb, var(--w-violet) 12%, transparent);
  --text: var(--w-ink); --text-2: var(--w-ink-2); --text-3: var(--w-ink-3);
  --border: var(--w-line); --border-strong: var(--w-line-strong); --border-input: var(--w-line-strong);
  --accent: var(--w-blue); --accent-strong: var(--w-blue); --accent-text: var(--w-blue); --accent-soft: color-mix(in srgb, var(--w-blue) 18%, transparent);
  font-family: var(--w-font); color: var(--w-ink); letter-spacing: 0;
}
body.in-work .pop, body.in-work .toast { border-radius: 14px; }
/* Toasts keep their own dark ground and light text; only the face and shape follow the desk. */
body.in-work .toast { font-family: var(--w-font); font-weight: 600; }
.wk { background: var(--w-ground); }

/* State colours for glyphs and dots (≥3:1 on both themes) */
.sc-gray, .sc-default { --sc: #6b6790; } .sc-blue { --sc: #265fd0; } .sc-purple { --sc: #5b3fd6; } .sc-green { --sc: #16703a; } .sc-red { --sc: #d3304e; }
.sc-orange { --sc: #c65a12; } .sc-yellow { --sc: #9a7a00; } .sc-pink { --sc: #c2268d; } .sc-brown { --sc: #8a5a3c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) :is(.sc-gray, .sc-default) { --sc: #a29dcb; } :root:not([data-theme="light"]) .sc-blue { --sc: #86adff; } :root:not([data-theme="light"]) .sc-purple { --sc: #ad9cff; } :root:not([data-theme="light"]) .sc-green { --sc: #62e295; } :root:not([data-theme="light"]) .sc-red { --sc: #ff7a90; } :root:not([data-theme="light"]) .sc-orange { --sc: #ffa05c; } :root:not([data-theme="light"]) .sc-yellow { --sc: #f0c94a; } :root:not([data-theme="light"]) .sc-pink { --sc: #f06bc2; } :root:not([data-theme="light"]) .sc-brown { --sc: #d4a58c; } }
:root[data-theme="dark"] :is(.sc-gray, .sc-default) { --sc: #a29dcb; } :root[data-theme="dark"] .sc-blue { --sc: #86adff; } :root[data-theme="dark"] .sc-purple { --sc: #ad9cff; } :root[data-theme="dark"] .sc-green { --sc: #62e295; } :root[data-theme="dark"] .sc-red { --sc: #ff7a90; } :root[data-theme="dark"] .sc-orange { --sc: #ffa05c; } :root[data-theme="dark"] .sc-yellow { --sc: #f0c94a; } :root[data-theme="dark"] .sc-pink { --sc: #f06bc2; } :root[data-theme="dark"] .sc-brown { --sc: #d4a58c; }
.wk-glyph { display: inline-grid; place-items: center; flex: none; color: var(--sc, var(--text-2)); line-height: 0; }
.wk-glyph svg { display: block; }
.wk-glyph.pr-bars, .wk-glyph.pr-none { color: var(--w-ink-3); }
.wk-glyph.pr-urgent { color: var(--w-magenta); }
.wk-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--sc, var(--text-3)); }
.wk-color { width: 20px; height: 20px; border-radius: 50%; flex: none; background: var(--sc); }
.wk-inline-state { display: inline-flex; align-items: center; gap: 6px; }
/* Status pill: tinted ground, bold uppercase word in the status colour. */
.wk-spill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px 0 8px; border-radius: 999px; background: color-mix(in srgb, var(--sc) 10%, var(--w-surface)); color: color-mix(in srgb, var(--sc) 78%, var(--w-ink)); font-size: 12px; font-weight: 800; letter-spacing: 0.03em; text-transform: uppercase; white-space: nowrap; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .wk-spill { color: var(--sc); background: color-mix(in srgb, var(--sc) 16%, var(--w-surface)); } }
:root[data-theme="dark"] .wk-spill { color: var(--sc); background: color-mix(in srgb, var(--sc) 16%, var(--w-surface)); }
button.wk-spill:hover { background: color-mix(in srgb, var(--sc) 22%, var(--w-surface)); }
.wk-spill .wk-glyph { color: currentColor; }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.wk-skip { position: absolute; left: 16px; top: -60px; z-index: 60; padding: 10px 14px; border-radius: 12px; background: var(--w-ink); color: var(--w-surface); font-weight: 700; text-decoration: none; }
.wk-skip:focus { top: 12px; }
#wk-content:focus { outline: none; }
.wk { min-height: 100%; position: relative; }
.wk :focus-visible, .wk-drawer :focus-visible { outline: 2px solid var(--w-blue); outline-offset: 2px; border-radius: 8px; }
/* The panel itself takes focus on open so screen readers announce it; no ring on the container. */
aside.wk-drawer:focus, aside.wk-drawer:focus-visible { outline: none; }
.wk ::selection, .wk-drawer ::selection { background: color-mix(in srgb, var(--w-cyan) 35%, transparent); }
.wk, .wk-drawer { caret-color: var(--w-magenta); scrollbar-color: var(--w-line-strong) transparent; }
.wk-num { font-variant-numeric: tabular-nums; }
.wk-key, .wk-issue-key { font-size: 12px; font-weight: 700; color: var(--w-ink-3); letter-spacing: 0.02em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.wk-muted { color: var(--text-2); display: inline-flex; align-items: center; gap: 4px; }
.wk-hint { font-size: 13px; color: var(--text-2); margin: 2px 0; }
.wk-label { font-size: 13px; font-weight: 700; color: var(--w-ink-2); margin-top: 6px; }
.wk-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wk-row-top { align-items: flex-end; }
.wk-field { display: flex; flex-direction: column; gap: 4px; }
.wk-center { display: flex; justify-content: center; margin-top: 12px; }
.wk-count { color: var(--w-ink-3); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wk-h2 { font-size: 20px; margin: 0; font-weight: 800; letter-spacing: -0.01em; color: var(--w-ink); }
.wk-h3 { font-size: 13px; color: var(--w-ink-2); font-weight: 800; margin: 22px 0 8px; }
.wk-inactive { opacity: 0.6; }
.wk-banner { background: var(--w-surface); border-radius: 14px; padding: 10px 16px; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; font-size: 14px; box-shadow: var(--w-shadow); }
.wk-alert { color: var(--w-magenta); display: flex; align-items: center; gap: 6px; font-weight: 700; }
.wk-select { width: auto; min-width: 130px; padding-right: 6px; }
.wk-textarea { height: auto; min-height: 80px; padding: 8px 12px; resize: vertical; }
.wk-date { width: 160px; }
.wk-check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text-2); cursor: pointer; min-height: 32px; }
.wk-card { background: var(--w-surface); border-radius: var(--w-radius); padding: 24px 28px; box-shadow: var(--w-shadow); }
.wk-card h2 { margin: 0 0 12px; font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.wk-form { display: flex; flex-direction: column; gap: 8px; }
.wk-form h2 { margin: 0 0 6px; font-size: 18px; font-weight: 800; }
.wk-pad { padding: 14px; }
.wk-section { display: flex; flex-direction: column; gap: 16px; }
.wk .btn, .wk-drawer .btn, body.in-work .pop .btn { height: 36px; padding: 0 14px; border-radius: 12px; font-size: 14px; font-weight: 700; background: var(--w-surface); color: var(--w-ink); box-shadow: inset 0 0 0 2px var(--w-cyan); border: 0; }
.wk .btn:hover, .wk-drawer .btn:hover { background: var(--w-cyan-soft); }
.wk .btn-primary, .wk-drawer .btn-primary, body.in-work .pop .btn-primary { background: var(--w-magenta); color: #fff; box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--w-magenta) 70%, transparent); }
.wk .btn-primary:hover, .wk-drawer .btn-primary:hover, body.in-work .pop .btn-primary:hover { background: color-mix(in srgb, var(--w-magenta) 88%, #000); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) :is(.wk, .wk-drawer, body.in-work .pop) .btn-primary { background: #c2268d; } }
:root[data-theme="dark"] :is(.wk, .wk-drawer, body.in-work .pop) .btn-primary { background: #c2268d; }
.wk .btn-sm, .wk-drawer .btn-sm, body.in-work .pop .btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.wk .btn-ghost, .wk-drawer .btn-ghost { height: 34px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--w-ink-2); }
.wk .btn-icon, .wk-drawer .btn-icon { border-radius: 10px; color: var(--w-ink-2); }
.wk .input, .wk-drawer .input, body.in-work .pop .input { height: 38px; border-radius: 12px; font-size: 14px; background: var(--w-surface); box-shadow: inset 0 0 0 1.5px var(--w-line-strong); padding: 0 12px; color: var(--w-ink); }
.wk .input:focus, .wk-drawer .input:focus, body.in-work .pop .input:focus { box-shadow: inset 0 0 0 2px var(--w-blue); }
.wk .input::placeholder, .wk-drawer .input::placeholder { color: var(--w-ink-3); }
.btn-ghost.on { color: var(--w-blue); background: var(--w-blue-soft); }

/* Page and header */
.wk-page { padding: 0 40px 80px; max-width: 1320px; margin: 0 auto; }
.wk-header { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; padding: 30px 0 18px; }
.wk-heading { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.wk-title { font-size: 28px; line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; margin: 0; display: flex; align-items: center; gap: 10px; min-width: 0; text-wrap: balance; color: var(--w-ink); }
.wk-title.hello { font-size: 36px; }
.wk-project-emoji { font-size: 24px; }
.wk-subtitle { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--w-ink-2); font-size: 14px; font-weight: 500; }
.wk-subtitle > * + *::before { content: '·'; margin-right: 10px; color: var(--w-ink-3); }
.wk-subtitle .wk-key { font-size: 13px; color: var(--w-blue); }
.wk-week { color: var(--w-blue); font-weight: 700; font-size: 15px; }
.wk-desc-line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60ch; }
.wk-header-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.wk a.btn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.wk-header-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.wk-search { width: 230px; }
.wk-search-btn { display: none; }
.wk-header-tools .btn-icon { min-width: 38px; height: 38px; border-radius: 12px; background: var(--w-surface); box-shadow: var(--w-shadow); }
.wk-bell { position: relative; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .wk-badge { background: #c2268d; } }
:root[data-theme="dark"] .wk-badge { background: #c2268d; }
.wk-badge { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--w-magenta); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--w-ground); }
.wk-me { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 5px; border-radius: 12px; font-size: 14px; font-weight: 700; background: var(--w-surface); box-shadow: var(--w-shadow); }
.wk-me:hover { background: var(--w-surface-2); }

/* Tabs: rounded pills on the ground */
.wk-tabs { display: flex; align-items: center; gap: 4px; margin: 22px 0 14px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.wk-tab { position: relative; display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 14px; color: var(--w-ink-2); text-decoration: none; white-space: nowrap; font-size: 14px; font-weight: 700; border-radius: 12px; }
.wk-tab:hover { color: var(--w-ink); background: color-mix(in srgb, var(--w-surface) 60%, transparent); }
.wk-tab.on { color: var(--w-ink); background: var(--w-surface); box-shadow: var(--w-shadow); }
.wk-tab-more { min-width: 26px; height: 26px; margin-left: -4px; }

/* Counters: one card each, big coloured number over a plain label. On a project they are filters. */
.wk-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; margin: 4px 0 0; }
.wk-kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.wk-kpi { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 10px; min-height: 124px; padding: 20px 22px 18px; background: var(--w-surface); border-radius: var(--w-radius); box-shadow: var(--w-shadow); text-decoration: none; color: var(--w-ink-2); font-size: 15px; font-weight: 500; transition: transform 0.16s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.16s; }
a.wk-kpi:hover { transform: translateY(-2px); }
.wk-kpi strong { display: block; font-size: 46px; line-height: 1; font-weight: 800; letter-spacing: -0.03em; color: var(--kc, var(--w-ink)); font-variant-numeric: tabular-nums; }
.wk-kpi strong small { font-size: 22px; font-weight: 800; color: var(--w-ink-3); letter-spacing: 0; }
.wk-kpi .wk-progress { width: 100%; order: 1; margin-top: 2px; }
.wk-kpi > span:not(.wk-kpi-state) { order: 2; margin-top: auto; }
.kpi-done { --kc: var(--w-ink); } .kpi-overdue { --kc: var(--w-magenta); } .kpi-blocked { --kc: var(--w-violet); } .kpi-unassigned { --kc: var(--w-cyan-text); } .kpi-mine { --kc: var(--w-blue); }
.wk-kpi.zero strong { color: var(--w-ink-3); }
.wk-kpi.on { box-shadow: inset 0 0 0 2.5px var(--kc), var(--w-shadow); }
.wk-kpi-state { position: absolute; top: 16px; right: 16px; display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 999px; background: color-mix(in srgb, var(--kc) 12%, var(--w-surface)); color: var(--kc); font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; }
.wk-progress { height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--w-violet) 10%, var(--w-surface-2)); overflow: hidden; width: 140px; }
.wk-progress span { display: block; height: 100%; background: var(--w-green); border-radius: 4px; }

/* Toolbar */
.wk-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 6px 0 14px; }
.wk-toolbar .wk-new { margin-right: 6px; }
.wk-view-search { width: 220px; }
.wk-tool { padding: 0 10px; }
.wk-focus-chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px 0 12px; border-radius: 999px; background: var(--w-ink); color: var(--w-surface); font-size: 13px; font-weight: 700; text-decoration: none; }
.wk-focus-chip:hover { background: color-mix(in srgb, var(--w-ink) 85%, var(--w-surface)); }

/* Glyph buttons */
.wk-gbtn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 28px; height: 28px; border-radius: 8px; color: var(--w-ink); font-size: 14px; }
button.wk-gbtn:hover { background: var(--bg-hover); }
.wk-gbtn.labelled { height: 32px; padding: 0 12px 0 10px; box-shadow: inset 0 0 0 1.5px var(--w-line-strong); border-radius: 10px; justify-content: flex-start; font-weight: 600; }
.wk-gbtn.static { cursor: default; }
.wk-gbtn.wk-spill { height: 28px; min-width: 0; box-shadow: none; padding: 0 12px 0 9px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.wk-glyph-text { white-space: nowrap; }

.wk-scroll { overflow-x: auto; }

/* List: one white card per group, rows separated by hairlines */
.wk-list { display: flex; flex-direction: column; gap: 16px; }
.wk-group { background: var(--w-surface); border-radius: var(--w-radius); box-shadow: var(--w-shadow); padding: 6px 10px 8px; }
.wk-group-head { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 0 4px; background: var(--w-surface); border-radius: var(--w-radius) var(--w-radius) 0 0; font-size: 14px; }
.wk-group-toggle { display: inline-flex; align-items: center; gap: 9px; height: 36px; padding: 0 8px; border-radius: 10px; color: var(--w-ink-3); }
.wk-group-toggle:hover { background: var(--bg-hover); }
.wk-group-title { font-size: 17px; font-weight: 800; margin: 0; color: var(--w-ink); letter-spacing: -0.01em; }
.wk-group-toggle .wk-count { display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--w-surface-2); color: var(--w-ink-2); font-size: 12px; }
.wk-group-add { min-width: 32px; height: 32px; }
.wk-flag { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 800; letter-spacing: 0.02em; text-transform: uppercase; background: var(--w-surface-2); color: var(--w-ink-2); }
.wk-flag.late { background: var(--w-magenta-soft); color: var(--w-magenta); }
.wk-flag.blocked { background: var(--w-violet-soft); color: var(--w-violet); } .wk-flag.unassigned { background: var(--w-cyan-soft); color: var(--w-cyan-text); }
.wk-issues { list-style: none; margin: 0; padding: 0; }
.wk-issue { display: grid; grid-template-columns: 32px 64px 32px minmax(0, 1fr) auto; align-items: center; gap: 4px; min-height: 48px; padding: 0 8px 0 4px; border-top: 1px solid var(--w-line); border-radius: 0; cursor: pointer; }
.wk-issue:hover { background: var(--w-surface-2); border-radius: 12px; }
.wk-issue:hover + .wk-issue { border-top-color: transparent; }
.wk-issue.on { background: var(--w-blue-soft); border-radius: 12px; }
.wk-issue-empty { padding: 12px 44px; color: var(--w-ink-3); font-size: 14px; border-top: 1px solid var(--w-line); }
.wk-issue-main { display: flex; align-items: center; gap: 10px; min-width: 0; padding-left: 4px; }
.wk-title-link { color: var(--w-ink); text-decoration: none; font-size: 15px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-title-link:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; text-decoration-color: var(--w-cyan); }
.wk-issue.is-done .wk-title-link { color: var(--w-ink-3); }
.wk-issue-meta { display: flex; align-items: center; gap: 12px; padding-left: 12px; color: var(--w-ink-2); font-size: 13px; font-weight: 500; }
.wk-label-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--w-ink-2); white-space: nowrap; font-weight: 600; }
.wk-label-chip .wk-dot { width: 8px; height: 8px; }
.wk-labels { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.wk-milestone-chip { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.wk-due { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; font-size: 13px; font-weight: 600; min-width: 56px; justify-content: flex-end; font-variant-numeric: tabular-nums; }
.wk-due.late { color: var(--w-magenta); font-weight: 800; }
.wk-due.today { color: var(--w-blue); font-weight: 800; }
.wk-blocked { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px 0 7px; border-radius: 999px; background: var(--w-violet-soft); color: var(--w-violet); font-size: 12px; font-weight: 800; letter-spacing: 0.02em; text-transform: uppercase; white-space: nowrap; flex: none; }
.wk-blocked-reason { display: none; font-size: 13px; color: var(--w-ink-2); }
.wk-comments { display: inline-flex; align-items: center; gap: 3px; font-size: 13px; color: var(--w-ink-2); font-weight: 600; }
.wk-assignee-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; }
button.wk-assignee-btn:hover { background: var(--bg-hover); }
.wk-mention { color: var(--w-blue); font-weight: 700; }

/* People: initials on the palette's deep tones (white stays above 4.5:1) */
.wk-avatar { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 800; flex: none; letter-spacing: 0; line-height: 1; }
.wk-avatar-empty { background: none; border: 1.5px dashed var(--w-line-strong); }
.wk-avatar-sys { width: 26px; height: 26px; background: var(--w-surface-2); color: var(--w-ink-2); }
.wk-avatar-sys.auto { color: var(--w-magenta); }
.wk-person { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; min-width: 0; font-weight: 600; }
.wk-person-name { overflow: hidden; text-overflow: ellipsis; }
.wk-person.none .wk-person-name { color: var(--w-ink-3); }

/* Kanban */
.wk-board { display: flex; gap: 16px; align-items: flex-start; padding: 4px 2px 20px; min-height: 60vh; scroll-snap-type: x proximity; }
.wk-col { flex: 0 0 304px; background: color-mix(in srgb, var(--w-surface) 55%, transparent); border-radius: var(--w-radius); display: flex; flex-direction: column; gap: 10px; padding: 8px 10px 12px; scroll-snap-align: start; }
.wk-col.drop { box-shadow: inset 0 0 0 2px var(--w-blue); }
.wk-col-head { display: flex; align-items: center; gap: 9px; height: 44px; padding: 0 6px; }
.wk-col-head h2 { font-size: 16px; font-weight: 800; margin: 0; }
.wk-col-head .wk-count { display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--w-surface); font-size: 12px; }
.wk-col-cards { display: flex; flex-direction: column; gap: 10px; min-height: 40px; }
.wk-card-issue { position: relative; background: var(--w-surface); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; cursor: grab; box-shadow: var(--w-shadow); transition: transform 0.16s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.16s; }
.wk-card-issue:hover { transform: translateY(-2px); }
.wk-card-issue.dragging { opacity: 0.4; }
.wk-card-issue.is-done .wk-card-link { color: var(--w-ink-3); }
.wk-card-top, .wk-card-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wk-card-foot { color: var(--w-ink-2); font-size: 13px; }
.wk-card-title { display: flex; align-items: flex-start; gap: 7px; font-size: 15px; font-weight: 700; line-height: 1.35; margin: 0; }
.wk-card-title .wk-glyph { margin-top: 3px; }
.wk-card-link { color: var(--w-ink); text-decoration: none; }
.wk-card-link::after { content: ''; position: absolute; inset: 0; border-radius: 16px; }
.wk-card-link:focus-visible { outline: none; }
.wk-card-link:focus-visible::after { outline: 2px solid var(--w-blue); outline-offset: 2px; }
.wk-card-issue button, .wk-card-issue .wk-gbtn { position: relative; z-index: 1; }
.wk-card-blocked { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin: 0; }
.wk-card-blocked .wk-blocked-reason { display: block; }
.wk-card-move { min-width: 26px; height: 26px; opacity: 0; transition: opacity 0.12s; }
.wk-card-issue:hover .wk-card-move, .wk-card-issue:focus-within .wk-card-move { opacity: 1; }
.wk-drop-line { height: 3px; border-radius: 2px; background: var(--w-blue); margin: -2px 0; }

/* Timeline */
.wk-timeline { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.wk-seg { display: inline-flex; background: var(--w-surface); border-radius: 12px; padding: 3px; box-shadow: var(--w-shadow); }
.wk-seg-btn { height: 30px; padding: 0 12px; border-radius: 9px; font-size: 13px; font-weight: 700; color: var(--w-ink-2); }
.wk-seg-btn.on { background: var(--w-ink); color: var(--w-surface); }
.wk-tl { display: flex; background: var(--w-surface); border-radius: var(--w-radius); box-shadow: var(--w-shadow); overflow: hidden; }
.wk-tl-labels { flex: 0 0 290px; min-width: 0; border-right: 1px solid var(--w-line); background: var(--w-surface); z-index: 1; }
.wk-tl-label { height: 42px; display: flex; align-items: center; gap: 8px; padding: 0 14px; border-bottom: 1px solid var(--w-line); overflow: hidden; }
.wk-tl-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--w-ink); text-decoration: none; font-size: 14px; font-weight: 600; }
.wk-tl-title:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--w-cyan); }
.wk-tl-corner { height: 52px; color: var(--w-ink-2); font-size: 13px; font-weight: 800; }
.wk-tl-label.wk-tl-group { background: var(--w-surface-2); font-size: 14px; font-weight: 800; }
.wk-tl-grid { flex: 1; overflow-x: auto; position: relative; }
.wk-tl-head { position: relative; height: 52px; border-bottom: 1px solid var(--w-line); }
.wk-tl-month { position: absolute; top: 7px; font-size: 13px; font-weight: 800; white-space: nowrap; padding-left: 6px; text-transform: capitalize; color: var(--w-ink); overflow: hidden; text-overflow: ellipsis; box-sizing: border-box; }
.wk-tl-day { position: absolute; top: 29px; font-size: 11.5px; font-weight: 600; color: var(--w-ink-3); text-align: center; font-variant-numeric: tabular-nums; }
.wk-tl-day.today { color: #fff; background: var(--w-magenta); border-radius: 9px; font-weight: 800; }
.wk-tl-body { position: relative; padding-bottom: 28px; background-image: linear-gradient(to right, var(--w-line) 1px, transparent 1px); }
/* The "Aujourd’hui" label sits in that bottom strip, never over a bar. */
.wk-tl-weekend { position: absolute; top: 0; bottom: 0; background: var(--w-surface-2); pointer-events: none; }
.wk-tl-row { height: 42px; position: relative; border-bottom: 1px solid var(--w-line); }
.wk-tl-bar { position: absolute; z-index: 2; top: 8px; height: 26px; border-radius: 999px; margin-left: 2px; font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 6px; padding: 0 10px 0 7px; cursor: grab; user-select: none; touch-action: none; color: var(--w-ink); background: color-mix(in srgb, var(--sc) 18%, var(--w-surface)); }
.wk-tl-bar:hover { background: color-mix(in srgb, var(--sc) 28%, var(--w-surface)); }
.wk-tl-bar.moving { cursor: grabbing; box-shadow: var(--w-shadow); z-index: 3; }
.wk-tl-bar.done { opacity: 0.7; }
.wk-tl-bar.blocked { box-shadow: inset 0 0 0 2px var(--w-violet); }
.wk-tl-bar-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-tl-outside { position: absolute; top: 12px; font-size: 13px; font-weight: 600; color: var(--w-ink-2); white-space: nowrap; pointer-events: none; background: var(--w-surface); padding: 0 4px; z-index: 2; }
.wk-tl-handle { position: absolute; right: 0; top: 0; bottom: 0; width: 10px; cursor: ew-resize; border-radius: 0 999px 999px 0; }
.wk-tl-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--w-magenta); pointer-events: none; z-index: 1; }
.wk-tl-today > span { position: absolute; bottom: 4px; left: 6px; font-size: 11.5px; font-weight: 800; color: var(--w-magenta); white-space: nowrap; background: var(--w-surface); padding: 0 4px; border-radius: 4px; }
.wk-tl-milestone { position: absolute; top: 0; bottom: 0; border-left: 2px dashed var(--w-ink-3); pointer-events: none; z-index: 3; }
.wk-tl-milestone > span { position: absolute; top: 5px; left: 6px; z-index: 3; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; color: #fff; background: var(--w-inkcard); padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.wk-undated { display: flex; flex-wrap: wrap; gap: 8px; }
.wk-undated-item { display: inline-flex; gap: 8px; align-items: center; min-height: 34px; padding: 4px 12px; border-radius: 12px; background: var(--w-surface); box-shadow: var(--w-shadow); font-size: 14px; font-weight: 600; }

/* Issue panel */
.wk-drawer { position: fixed; top: 10px; right: 10px; bottom: 10px; width: min(580px, calc(100vw - 20px)); background: var(--w-surface); border-radius: 24px; box-shadow: 0 24px 60px -20px rgba(27, 15, 77, 0.35), 0 2px 6px rgba(27, 15, 77, 0.06); z-index: 50; transform: translateX(calc(100% + 20px)); transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1); display: flex; flex-direction: column; outline: none; overflow: hidden; }
.wk-drawer.open { transform: none; }
.wk-drawer-body { overflow-y: auto; flex: 1; }
.wk-drawer-head { display: flex; align-items: center; gap: 6px; padding: 12px 18px; border-bottom: 1px solid var(--w-line); position: sticky; top: 0; background: var(--w-surface); z-index: 2; }
.wk-drawer-head .btn-icon { min-width: 34px; height: 34px; border-radius: 10px; }
.wk-drawer-head .wk-key { font-size: 13px; color: var(--w-blue); }
.wk-nav { display: inline-flex; align-items: center; gap: 2px; margin-left: 4px; font-size: 13px; font-weight: 700; color: var(--w-ink-3); font-variant-numeric: tabular-nums; }
.wk-drawer-content { padding: 22px 30px 60px; display: flex; flex-direction: column; gap: 10px; }
.wk-issue-title { font: inherit; font-size: 26px; line-height: 1.2; font-weight: 800; letter-spacing: -0.02em; border: 0; outline: none; background: none; resize: none; padding: 2px 6px; margin: 0 -6px; overflow: hidden; border-radius: 10px; color: var(--w-ink); }
textarea.wk-issue-title:focus-visible { box-shadow: inset 0 0 0 2px var(--w-blue); outline: none; }
.wk-meta { font-size: 13px; color: var(--w-ink-2); margin: 0; }
.wk-block-btn { align-self: flex-start; }
.wk-blocked-box { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 6px 12px; padding: 12px 14px; border-radius: 16px; background: var(--w-violet-soft); }
.wk-blocked-head { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; color: var(--w-violet); flex: none; min-height: 32px; }
.wk-blocked-box .wk-blocked-reason-input { flex: 1 1 220px; min-width: 0; height: auto; min-height: 32px; padding: 6px 8px; resize: none; field-sizing: content; line-height: 1.45; font: inherit; font-size: 14px; font-weight: 600; color: var(--w-ink); background: none; box-shadow: none; border-radius: 10px; }
.wk-blocked-box .wk-blocked-reason-input:hover { background: color-mix(in srgb, var(--w-surface) 60%, transparent); }
.wk-blocked-box .wk-blocked-reason-input:focus { background: var(--w-surface); box-shadow: inset 0 0 0 2px var(--w-blue); }
.wk-blocked-box .btn-ghost { min-height: 32px; color: var(--w-violet); }
.wk-blocked-box p { flex: 1 1 220px; margin: 0; padding: 6px 0; font-size: 14px; font-weight: 600; color: var(--w-ink); }
.wk-props { display: grid; grid-template-columns: 1fr; gap: 0; margin-top: 8px; padding: 6px 14px; border-radius: 16px; background: var(--w-surface-2); }
.wk-prop { display: flex; align-items: center; min-height: 42px; }
.wk-prop + .wk-prop { border-top: 1px solid var(--w-line); }
.wk-prop-label { flex: 0 0 124px; color: var(--w-ink-2); font-size: 13.5px; font-weight: 600; }
.wk-prop-value { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 10px; min-height: 34px; text-align: left; font-size: 14px; font-weight: 600; }
.wk-prop-value.editable:hover { background: var(--bg-hover); }
.wk-prop-value .wk-gbtn.labelled { margin-left: -8px; box-shadow: none; }
.wk-prop-value .wk-gbtn.labelled:hover { box-shadow: inset 0 0 0 1.5px var(--w-line-strong); }
.wk-prop-value .wk-gbtn.wk-spill { margin-left: -2px; }
.wk-inline-input { border: 0; outline: none; background: none; width: 4ch; font: inherit; color: var(--w-ink); padding: 2px 0; -moz-appearance: textfield; appearance: textfield; }
.wk-inline-input::-webkit-outer-spin-button, .wk-inline-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.wk-inline-input.wide { width: 100%; }
.wk-inline-input:focus-visible { box-shadow: inset 0 -2px 0 var(--w-blue); border-radius: 0; outline: none; }
.wk-estimate { gap: 4px; }
@supports (field-sizing: content) { .wk-estimate .wk-inline-input { width: auto; field-sizing: content; min-width: 1ch; } }
.wk-desc { font: inherit; font-size: 15px; width: 100%; min-height: 92px; border: 0; border-radius: 14px; padding: 12px 14px; background: var(--w-surface); box-shadow: inset 0 0 0 1.5px var(--w-line-strong); outline: none; resize: vertical; color: var(--w-ink); line-height: 1.6; }
.wk-desc:focus-visible { box-shadow: inset 0 0 0 2px var(--w-blue); }
.wk-desc.readonly { resize: none; min-height: 0; white-space: pre-wrap; box-shadow: none; padding-left: 0; }
.wk-watchers { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.wk-comments-list { display: flex; flex-direction: column; gap: 16px; }
.wk-comment { display: flex; gap: 10px; }
.wk-comment-head { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.wk-comment-time { color: var(--w-ink-3); font-size: 12.5px; }
.wk-comment-body { word-wrap: break-word; margin-top: 2px; line-height: 1.6; font-size: 15px; }
.wk-composer { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.wk-composer-input { font: inherit; font-size: 15px; min-height: 84px; border-radius: 14px; border: 0; box-shadow: inset 0 0 0 1.5px var(--w-line-strong); padding: 12px 14px; background: var(--w-surface); outline: none; resize: vertical; color: var(--w-ink); }
.wk-composer-input:focus-visible { box-shadow: inset 0 0 0 2px var(--w-blue); }
.wk-history summary { cursor: pointer; color: var(--w-ink-2); font-size: 13.5px; font-weight: 800; margin-top: 18px; min-height: 34px; display: flex; align-items: center; }
.wk-datepop { display: flex; flex-direction: column; gap: 8px; padding: 14px; }

/* Linked notebook pages */
.wk-pages { display: flex; flex-direction: column; gap: 6px; }
.wk-page-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.wk-page-link { display: flex; align-items: center; gap: 6px; }
.wk-page-list .wk-page-link { padding: 4px 6px 4px 4px; border-radius: 12px; background: var(--w-surface-2); }
.wk-page-list .wk-page-link a { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 10px; border-radius: 10px; color: var(--w-ink); font-size: 14.5px; font-weight: 700; text-decoration: none; }
.wk-page-list .wk-page-link a span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-page-list .wk-page-link a:hover span:last-child { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--w-cyan); text-decoration-thickness: 2px; }
.wk-page-list .wk-page-link a .ic { color: var(--w-blue); flex: none; }
.wk-page-emoji { font-size: 16px; line-height: 1; }
.wk-page-unlink { min-width: 30px; height: 30px; }
.wk-pages-empty { margin: 0; font-size: 14px; }
.wk-pages.compact { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; margin: -6px 0 18px; }
.wk-pages-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 800; color: var(--w-ink-2); margin-right: 2px; }
.wk-pages.compact .wk-page-link { height: 32px; padding: 0 4px 0 12px; border-radius: 999px; background: var(--w-surface); box-shadow: var(--w-shadow); gap: 2px; }
.wk-pages.compact .wk-page-link a { display: inline-flex; align-items: center; gap: 6px; color: var(--w-ink); font-size: 13.5px; font-weight: 700; text-decoration: none; max-width: 240px; }
.wk-pages.compact .wk-page-link a span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-pages.compact .wk-page-link a:hover span:last-child { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--w-cyan); }
.wk-pages.compact .wk-page-link:not(:has(.wk-page-unlink)) { padding-right: 12px; }
.wk-pages.compact .wk-page-unlink { display: inline-grid; place-items: center; width: 24px; height: 24px; min-width: 0; border-radius: 50%; color: var(--w-ink-3); }
.wk-pages.compact .wk-page-unlink:hover { background: var(--bg-hover); color: var(--w-ink); }
.wk-page-groups { display: flex; flex-direction: column; gap: 14px; }
.wk-page-group { display: flex; flex-direction: column; gap: 6px; }
.wk-page-cat { display: flex; align-items: center; gap: 8px; min-height: 28px; font-size: 13px; font-weight: 800; color: var(--w-ink); }
.wk-page-cat .wk-count { font-size: 12px; }
.wk-page-cat-add { min-width: 28px; height: 28px; }
.wk-page-cat-tag { display: inline-flex; align-items: center; gap: 6px; margin-left: 6px; font-size: 12.5px; font-weight: 800; color: var(--w-ink-2); }
.wk-page-cat-tag:first-of-type { margin-left: 0; }
.wk-page-add { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--w-blue); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--w-blue) 35%, transparent); }
.wk-page-add:hover { background: var(--w-blue-soft); }

/* Activity & notifications */
.wk-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.wk-filters .input:first-child { flex: 1; min-width: 220px; }
.wk-activity { display: flex; flex-direction: column; background: var(--w-surface); border-radius: var(--w-radius); box-shadow: var(--w-shadow); padding: 6px 22px; }
.wk-act { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--w-line); }
.wk-act:last-child { border-bottom: 0; }
.wk-act-body { flex: 1; min-width: 0; font-size: 14px; line-height: 1.5; }
.wk-act-body a { color: inherit; font-weight: 700; text-underline-offset: 3px; text-decoration-color: var(--w-cyan); }
.wk-act-meta { font-size: 12.5px; color: var(--w-ink-3); }
.wk-activity.compact { background: none; box-shadow: none; padding: 0; }
.wk-activity.compact .wk-act { padding: 7px 0; font-size: 13.5px; }
.wk-more { align-self: center; margin-top: 12px; }
.wk-notifs { display: flex; flex-direction: column; max-height: 62vh; overflow-y: auto; }
.wk-notifs-head { display: flex; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--w-line); font-weight: 800; }
.wk-notif { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px 10px 22px; border-radius: 10px; text-align: left; font-size: 14px; }
.wk-notif:hover { background: var(--bg-hover); }
.wk-notif.unread .wk-notif-subject { font-weight: 800; }
.wk-notif.unread::before { content: ''; position: absolute; left: 8px; top: 16px; width: 7px; height: 7px; border-radius: 50%; background: var(--w-magenta); }
.wk-notif-meta { font-size: 12.5px; color: var(--w-ink-3); }
.wk-warnings { max-height: 50vh; overflow-y: auto; padding-left: 18px; font-size: 14px; }

/* Home: "Ma semaine" */
.wk-desk { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); gap: 20px; margin-top: 20px; align-items: start; }
.wk-desk-side { display: flex; flex-direction: column; gap: 20px; }
.wk-todo { display: flex; flex-direction: column; gap: 12px; list-style: none; margin: 0; padding: 0; }
.wk-todo-row { --tc: var(--w-blue); --ts: var(--w-blue-soft); display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 16px 20px 16px 16px; border-radius: 16px; background: var(--ts); text-decoration: none; color: var(--w-ink); }
.wk-todo-row.late { --tc: var(--w-magenta); --ts: var(--w-magenta-soft); }
.wk-todo-row.blocked { --tc: var(--w-violet); --ts: var(--w-violet-soft); }
.wk-todo-row.soon { --tc: var(--w-green-text); --ts: var(--w-green-soft); }
.wk-todo-row.later { --tc: var(--w-ink-2); --ts: var(--w-surface-2); }
.wk-todo-badge { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--tc); color: #fff; font-weight: 800; font-size: 13px; letter-spacing: 0.02em; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .wk-todo-badge { color: var(--w-ground); } }
:root[data-theme="dark"] .wk-todo-badge { color: var(--w-ground); }
.wk-todo-text { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.wk-todo-title { font-size: 16px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-todo-sub { font-size: 14px; color: var(--w-ink-2); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-todo-go { color: var(--tc); font-weight: 800; font-size: 15px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.wk-todo-row:hover .wk-todo-go .ic { transform: translateX(3px); }
.wk-todo-go .ic { transition: transform 0.16s cubic-bezier(0.16, 1, 0.3, 1); }
.wk-inkcard { background: var(--w-inkcard); color: #fff; border-radius: var(--w-radius); padding: 26px 28px; box-shadow: 0 20px 40px -24px rgba(27, 15, 77, 0.6); }
.wk-inkcard h2 { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -0.01em; color: #fff; }
.wk-inkcard h2 em { font-style: normal; color: var(--w-cyan); }
.wk-inkcard p { margin: 8px 0 0; color: var(--w-inkcard-2); font-size: 15px; }
.wk-inkcard a { color: inherit; text-decoration: none; }
.wk-inkcard a:hover p { text-decoration: underline; text-underline-offset: 3px; }
.wk-stack { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: rgba(255, 255, 255, 0.14); margin: 22px 0 16px; gap: 2px; }
.wk-stack span { display: block; height: 100%; }
.wk-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; list-style: none; margin: 0; padding: 0; font-size: 15px; font-weight: 600; }
.wk-legend li { display: inline-flex; align-items: center; gap: 8px; }
.wk-legend i { width: 10px; height: 10px; border-radius: 50%; }
.st-done { background: var(--w-green); } .st-a1 { background: var(--w-cyan); } .st-a2 { background: #f06bc2; } .st-a3 { background: #ad9cff; } .st-todo { background: rgba(255, 255, 255, 0.35); }
.wk-desk .wk-card h2 { font-size: 21px; margin-bottom: 18px; }
.wk-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.wk-card-head h2 { margin: 0 !important; flex: 1; }

/* Home: project rows with a state pill */
.wk-projects { display: flex; flex-direction: column; }
.wk-project-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.wk-project-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 12px 4px; border-top: 1px solid var(--w-line); text-decoration: none; color: var(--w-ink); }
.wk-project-list li:first-child .wk-project-row { border-top: 0; }
.wk-project-row:hover .wk-project-title { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--w-cyan); text-decoration-thickness: 2px; }
.wk-project-row.archived { opacity: 0.65; }
.wk-project-name { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 16px; }
.wk-project-icon { font-size: 18px; }
.wk-project-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-project-sub { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--w-ink-3); font-weight: 600; padding-left: 28px; }
.wk-project-sub .wk-progress { width: 90px; height: 6px; }
.wk-state { display: inline-flex; align-items: center; height: 26px; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 800; letter-spacing: 0.03em; text-transform: uppercase; white-space: nowrap; }
.wk-state.late { background: var(--w-magenta-soft); color: var(--w-magenta); }
.wk-state.blocked { background: var(--w-violet-soft); color: var(--w-violet); }
.wk-state.doing { background: var(--w-cyan-soft); color: var(--w-cyan-text); }
.wk-state.done { background: var(--w-green-soft); color: var(--w-green-text); }
.wk-state.idle { background: var(--w-surface-2); color: var(--w-ink-2); }
.wk-archived summary { cursor: pointer; color: var(--w-ink-2); margin: 12px 0 4px; min-height: 34px; display: flex; align-items: center; font-size: 14px; font-weight: 700; }
.wk-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.wk-table th { text-align: left; font-weight: 800; color: var(--w-ink-2); font-size: 12.5px; padding: 10px 8px; border-bottom: 1px solid var(--w-line); white-space: nowrap; }
.wk-table td { padding: 10px 8px; border-bottom: 1px solid var(--w-line); vertical-align: middle; }
.wk-td-actions { text-align: right; width: 44px; }
.wk-inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.wk-inline-form .input { flex: 1; min-width: 150px; }
.wk-inline-form .wk-date { flex: none; }

/* States */
.wk-loading { max-width: 1320px; margin: 0 auto; padding: 32px 40px; display: flex; flex-direction: column; gap: 14px; }
.wk-skel { border-radius: 14px; background: linear-gradient(90deg, var(--w-surface) 0%, var(--w-surface-2) 50%, var(--w-surface) 100%); background-size: 200% 100%; animation: wk-shimmer 1.4s ease-in-out infinite; }
.wk-skel-title { height: 32px; width: 280px; max-width: 70%; }
.wk-skel-strip { height: 110px; width: 100%; }
.wk-skel-row { height: 48px; }
@keyframes wk-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.wk-error, .wk-empty { max-width: 480px; margin: 48px auto; text-align: center; padding: 0 16px; }
.wk-error h2, .wk-empty h2 { margin: 0 0 8px; font-size: 20px; font-weight: 800; }
.wk-error p, .wk-empty p { color: var(--w-ink-2); margin: 0 0 16px; font-size: 15px; }
.wk-error .wk-hint { margin-bottom: 18px; }

/* Onboarding */
.wk-onboard { max-width: 520px; margin: 8vh auto; padding: 32px 32px 40px; display: flex; flex-direction: column; gap: 16px; background: var(--w-surface); border-radius: 28px; box-shadow: var(--w-shadow); }
.wk-onboard h1 { margin: 0; font-size: 32px; font-weight: 800; letter-spacing: -0.02em; }
.wk-lead { color: var(--w-ink-2); margin: 0; font-size: 16px; text-wrap: pretty; }
.wk-or { color: var(--w-ink-3); font-size: 13px; font-weight: 700; text-align: center; }
.wk-onboard > .btn { align-self: center; }
.wk-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.wk-person-btn { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; text-align: left; padding: 12px 14px; border-radius: 16px; background: var(--w-surface-2); }
.wk-person-btn .wk-avatar { grid-row: span 2; }
.wk-person-btn:hover { background: var(--w-blue-soft); }
.wk-person-btn strong { font-weight: 800; font-size: 15px; }
.wk-person-btn small { color: var(--w-ink-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }

/* Settings */
.wk-settings { max-width: 860px; }
.wk-settings-card { display: flex; flex-direction: column; gap: 12px; }
.wk-settings .wk-form > .btn, .wk-settings-card > .btn { align-self: flex-start; }
.wk-edit-list { display: flex; flex-direction: column; gap: 8px; }
.wk-edit-row { display: flex; align-items: center; gap: 8px; }
.wk-edit-row.wrap { flex-wrap: wrap; }
.wk-edit-row > .input:not(.wk-select):not(.wk-date) { flex: 1; min-width: 120px; }
.wk-emoji-btn { font-size: 24px; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; color: var(--w-ink-2); background: var(--w-surface-2); }
.wk-emoji-btn:hover { background: var(--w-blue-soft); }
.wk-settings .wk-progress { width: 90px; }
.wk-auto-icon { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; color: var(--w-magenta); background: var(--w-magenta-soft); flex: none; }
.wk-auto-form .wk-select { flex: 1; min-width: 160px; }

/* Touch: every control reaches 44px */
@media (pointer: coarse) {
  .wk button, .wk .btn, .wk .btn-ghost, .wk .btn-icon, .wk .wk-tab, .wk .input, .wk-drawer button, .wk-drawer .input { min-height: 44px; }
  .wk .btn-icon, .wk .wk-gbtn, .wk-drawer .btn-icon, .wk .wk-assignee-btn { min-width: 44px; }
  .wk-card-move { opacity: 1; }
}

/* Laptops: counters wrap before they squeeze */
@media (max-width: 1100px) {
  .wk-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .wk-kpis.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wk-desk { grid-template-columns: 1fr; }
}

/* Phones */
@media (max-width: 700px) {
  .wk-page { padding: 0 14px 60px; }
  .wk-header { padding: 16px 0 8px; gap: 8px; flex-wrap: wrap; }
  .wk-header-actions { order: 3; flex: 1 0 100%; }
  .wk-header-actions > * { flex: 1; justify-content: center; }
  .wk-title { font-size: 22px; }
  .wk-title.hello { font-size: 26px; }
  .wk-desc-line { display: none; }
  .wk-search { display: none; }
  .wk-search-btn { display: inline-flex; }
  .wk-me { padding: 0 4px; }
  .wk-me-name, .wk-me .ic:last-child { display: none; }
  .wk-kpis, .wk-kpis.four { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .wk-kpis:not(.four) .kpi-done { grid-column: 1 / -1; }
  .wk-kpis.four .wk-progress { display: none; } /* 2×2 on home: the fraction says it; the bar returns on wider screens */
  .wk-kpi { flex-direction: row; align-items: center; justify-content: flex-start; gap: 10px; min-height: 60px; padding: 10px 14px; font-size: 14px; line-height: 1.2; border-radius: 16px; }
  .wk-kpi strong { font-size: 28px; flex: none; }
  .wk-kpi strong small { font-size: 15px; }
  .wk-kpi .wk-progress { flex: 1; width: auto; min-width: 60px; order: 3; margin: 0; }
  .wk-kpi > span:not(.wk-kpi-state) { margin: 0; }
  .wk-kpi-state { position: static; margin-left: auto; }
  .wk-tabs { margin: 14px -14px 10px; padding: 2px 28px 2px 14px; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }
  .wk-toolbar .wk-new { order: 5; flex: 1 0 100%; justify-content: center; margin: 4px 0 0; }
  .wk-view-search { flex: 1; width: auto; min-width: 0; }
  .wk-tool-label { display: none; }
  .wk-toolbar .wk-count { display: none; }
  .wk-group { padding: 4px 6px 6px; border-radius: 18px; }
  .wk-group-head .wk-flag { display: none; }
  .wk-issue { grid-template-columns: auto auto minmax(0, 1fr); grid-template-areas: "pri status main" "meta meta meta"; row-gap: 4px; padding: 10px 6px; }
  .wk-cell-priority { grid-area: pri; } .wk-cell-status { grid-area: status; } .wk-issue-main { grid-area: main; flex-wrap: wrap; row-gap: 4px; }
  .wk-issue .wk-issue-key { display: none; }
  .wk-title-link { white-space: normal; font-size: 15.5px; }
  .wk-blocked-reason { display: block; flex-basis: 100%; }
  .wk-issue-meta { grid-area: meta; flex-wrap: wrap; gap: 6px 12px; padding-left: 6px; }
  .wk-issue-meta .wk-assignee-btn { margin-left: auto; }
  .wk-milestone-chip { display: none; }
  .wk-issue-empty { padding: 12px; }
  .wk-col { flex-basis: 86vw; }
  /* Phones: a narrow column with the title on up to two lines, so every row reads without scrolling the chart; bars keep only their glyph. */
  .wk-tl-labels { flex: 0 0 124px; width: 124px; }
  .wk-tl-label { padding: 0 10px; }
  .wk-tl-label .wk-tl-title { font-size: 13px; line-height: 1.25; white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
  .wk-tl-label .wk-issue-key, .wk-tl-label .wk-avatar, .wk-tl-outside, .wk-tl-bar-text { display: none; }
  .wk-tl-label.wk-tl-group strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
  .wk-tl-tools .wk-hint { display: none; }
  .wk-desk { gap: 14px; margin-top: 14px; }
  .wk-desk-side { gap: 14px; }
  .wk-card, .wk-inkcard { padding: 18px 16px; border-radius: 18px; }
  .wk-todo-row { grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding: 12px 14px 12px 12px; }
  .wk-todo-badge { width: 40px; height: 40px; font-size: 12px; }
  .wk-todo-title { white-space: normal; font-size: 15px; }
  .wk-todo-sub { white-space: normal; }
  .wk-subtitle .wk-week ~ span { display: none; }
  .wk-todo-go { grid-column: 2; font-size: 14px; }
  .wk-drawer { top: 0; right: 0; bottom: 0; width: 100vw; border-radius: 0; }
  .wk-drawer-content { padding: 16px 16px 48px; }
  .wk-issue-title { font-size: 21px; }
  .wk-props { padding: 4px 10px; }
  .wk-prop-label { flex-basis: 104px; }
  .wk-activity { padding: 4px 14px; }
  .wk-edit-row { flex-wrap: wrap; }
  .wk-edit-row > .input:not(.wk-select):not(.wk-date) { flex: 1 1 150px; min-width: 0; }
  .wk-edit-row .wk-select, .wk-edit-row .wk-date { flex: 1 1 130px; min-width: 0; }
  .wk-inline-form .input, .wk-auto-form .wk-select { min-width: 0; flex: 1 1 100%; }
  .wk-onboard { margin: 16px auto; padding: 22px 18px 28px; border-radius: 22px; }
}
@media (prefers-reduced-motion: reduce) { .wk *, .wk-drawer { transition: none !important; animation: none !important; } }
@media print { .wk-drawer, .wk-toolbar, .wk-tabs, .wk-header-tools { display: none !important; } }

/* ---------- Sign-in screens ---------- */
body.auth-body { overflow: auto; background: var(--bg-sidebar); }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: min(440px, 100%); background: var(--bg); border-radius: 24px; box-shadow: var(--shadow); padding: 32px 32px 28px; display: flex; flex-direction: column; gap: 14px; }
/* Same lockup as the sidebar, one size up; a workspace with its own name shows it after a hairline. */
.auth-brand { display: flex; align-items: center; gap: 5px; font-weight: 700; font-size: 18px; letter-spacing: -0.02em; color: var(--text); min-width: 0; }
.auth-mark { width: 32px; height: 18px; flex: none; }
.auth-ws { margin-left: 6px; padding-left: 12px; border-left: 1px solid var(--border-strong); font-size: 15px; font-weight: 600; letter-spacing: 0; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-card h1 { margin: 10px 0 0; font-size: 28px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.auth-lead { margin: 0; color: var(--text-2); font-size: 15px; line-height: 1.5; text-wrap: pretty; }
.auth-form { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.auth-field { display: flex; flex-direction: column; gap: 5px; }
.auth-label { font-size: 13.5px; font-weight: 700; color: var(--text); }
.auth-hint { font-size: 12.5px; color: var(--text-2); }
.auth-field .input { height: 42px; font-size: 15px; }
.auth-code { font-size: 22px !important; letter-spacing: 0.18em; font-variant-numeric: tabular-nums; text-align: center; font-weight: 700; }
.auth-submit { height: 44px !important; justify-content: center; font-size: 15px; margin-top: 4px; }
.auth-error { margin: 0; color: var(--danger); font-size: 14px; font-weight: 600; }
.auth-google { height: 44px !important; justify-content: center; gap: 10px; font-size: 15px; }
.auth-g { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: #265fd0; font-weight: 800; box-shadow: inset 0 0 0 1.5px var(--border-strong); font-size: 13px; }
.auth-or { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 13px; font-weight: 600; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14.5px; color: var(--text-2); }
.auth-secret { font-family: var(--mono); font-size: 13px; background: var(--bg-subtle); padding: 2px 6px; border-radius: 6px; color: var(--text); word-break: break-all; }
.auth-qr { align-self: center; width: 200px; height: 200px; padding: 10px; border-radius: 16px; background: #fff; box-shadow: var(--shadow-sm); }
.auth-qr svg { width: 100%; height: 100%; display: block; }
.auth-recovery { list-style: none; margin: 0; padding: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; background: var(--bg-subtle); border-radius: 14px; }
.auth-recovery code { font-family: var(--mono); font-size: 15px; font-weight: 600; letter-spacing: 0.04em; }
.auth-row { display: flex; gap: 8px; flex-wrap: wrap; }
.auth-row .btn-primary { flex: 1; justify-content: center; }
.auth-back { align-self: flex-start; }
@media (max-width: 480px) { .auth-card { padding: 24px 18px; border-radius: 20px; } .auth-card h1 { font-size: 24px; } }

/* ---------- Privacy chip and account settings ---------- */
.tb-privacy { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; margin-right: 8px; border-radius: 999px; font-size: 12.5px; font-weight: 700; color: var(--text-2); background: var(--bg-subtle); }
.tb-privacy.shared { color: #0a7499; background: color-mix(in srgb, #3cc6ef 14%, var(--bg)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tb-privacy.shared { color: #6ad9f8; } }
:root[data-theme="dark"] .tb-privacy.shared { color: #6ad9f8; }
.tb-privacy:not(:disabled):hover { box-shadow: inset 0 0 0 1.5px var(--border-strong); }
.tb-privacy:disabled { cursor: default; opacity: 0.85; }
.acct { display: flex; flex-direction: column; gap: 10px; }
.acct h2:not(:first-child) { margin-top: 22px; }
.acct-h3 { font-size: 14px; font-weight: 800; margin: 10px 0 0; }
.acct-form { display: flex; flex-direction: column; gap: 10px; max-width: 420px; }
.acct-form .btn { align-self: flex-start; }
.acct-field { display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; font-weight: 700; }
.acct-field small { font-weight: 500; }
.acct-inline { display: flex; gap: 8px; flex-wrap: wrap; }
.acct-inline .input[type="email"] { flex: 1 1 220px; }
.acct-inline .wk-select { flex: 0 0 auto; width: auto; }
.acct-ok { display: flex; align-items: center; gap: 6px; color: #1b7f40; font-weight: 700; margin: 0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .acct-ok { color: #62e295; } }
:root[data-theme="dark"] .acct-ok { color: #62e295; }
.acct-link { display: flex; gap: 8px; }
.acct-link .input { flex: 1; font-family: var(--mono); font-size: 12.5px; }
.acct-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.acct-list li { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--border); font-size: 14px; }
.acct-table-wrap { overflow-x: auto; }
.acct-table td { vertical-align: middle; }
.acct-table td small { white-space: nowrap; }
.acct-table .btn-ghost { white-space: nowrap; }
.acct-table .wk-select { min-width: 150px; }
.acct-actions { display: flex; gap: 2px; justify-content: flex-end; flex-wrap: wrap; }
.acct-badge { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 800; background: color-mix(in srgb, #1b7f40 14%, var(--bg)); color: #1b7f40; }
.acct-badge.off { background: var(--bg-subtle); color: var(--text-2); }
.acct-disabled td { opacity: 0.6; }
.acct-check { font-weight: 600; color: var(--text); }
.acct-qr { width: 180px; height: 180px; align-self: flex-start; }

/* ---------- Workspaces ---------- */
.ws-menu-icon { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; background: #c2268d; color: #fff; font-size: 12px; font-weight: 800; flex: none; }
.ws-new { display: flex; flex-direction: column; gap: 12px; padding: 24px; width: min(460px, 92vw); }
.ws-new h2 { margin: 0; font-size: 22px; font-weight: 800; }
.ws-new p { margin: 0; }
.ws-new-actions { display: flex; justify-content: flex-end; gap: 8px; }
.ws-empty { max-width: 520px; margin: 0 auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 28px; border-radius: 20px; background: var(--bg-subtle); }
.ws-empty h2 { margin: 0; font-size: 20px; font-weight: 800; }
.ws-empty p { margin: 0; }
.acct-list .wk-select { width: auto; min-width: 150px; }

/* ---------- Export dialog ---------- */
.xp { display: flex; flex-direction: column; gap: 16px; padding: 24px; width: min(560px, 94vw); overflow-y: auto; }
.xp h2 { margin: 0; font-size: 22px; font-weight: 800; }
.xp-lede { margin: -8px 0 0; overflow-wrap: anywhere; }
.xp-formats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.xp-format { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; row-gap: 2px; align-items: center; text-align: left; padding: 12px 14px; border-radius: 14px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--border-strong); color: var(--text); transition: box-shadow 0.12s, background 0.12s; }
.xp-format:hover { background: var(--bg-subtle); }
.xp-format.on { box-shadow: inset 0 0 0 2px var(--accent-strong); background: color-mix(in srgb, var(--accent-strong) 5%, var(--bg)); }
.xp-format:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.xp-badge { grid-row: 1 / span 2; width: 46px; height: 54px; border-radius: 6px 14px 6px 6px; display: grid; place-items: end center; padding-bottom: 8px; font-size: 11px; font-weight: 800; letter-spacing: 0.02em; color: #fff; }
.xp-pdf { background: #c2268d; }
.xp-docx { background: #265fd0; }
.xp-html { background: #0f8fb8; }
.xp-md { background: #4a4470; }
.xp-name { font-weight: 800; font-size: 15px; }
.xp-hint { font-size: 12.5px; color: var(--text-2); line-height: 1.35; }
.xp-options { display: flex; flex-direction: column; gap: 4px; padding: 6px 4px; border-top: 1px solid var(--border); }
.xp-option { display: flex; gap: 10px; align-items: flex-start; padding: 8px 4px; cursor: pointer; }
.xp-option input { margin-top: 3px; accent-color: var(--accent-strong); width: 16px; height: 16px; flex: none; }
.xp-option > span { display: flex; flex-direction: column; gap: 1px; }
.xp-option.off { cursor: default; opacity: 0.55; }
.xp-option[hidden], .xp-row[hidden] { display: none; }
.xp-option-label { font-weight: 600; font-size: 14px; }
.xp-option-hint { font-size: 12.5px; color: var(--text-2); }
.xp-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 4px; }
.xp-paper { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--bg-subtle); box-shadow: inset 0 0 0 1px var(--border); }
.xp-paper button { height: 28px; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.xp-paper button.on { background: var(--bg); color: var(--text); box-shadow: var(--shadow-sm); }
.xp-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.xp-spacer { flex: 1; }
@media (max-width: 520px) {
  .xp { padding: 18px 16px; }
  .xp-formats { grid-template-columns: 1fr; }
  .xp-print { order: 3; width: 100%; justify-content: center; }
}

/* ---------- App name at the top of the sidebar ---------- */
/* The GetOrizon lockup: magenta GO monogram, then the name in one ink colour, Figtree 700.
   Monogram height ≈ 1.37 × the cap height; gap ≈ a quarter of the monogram height. */
.sb-brand { flex: 1; min-width: 0; display: flex; align-items: center; gap: 5px; height: 32px; padding: 0 6px; border-radius: 10px; color: var(--text); text-decoration: none; }
.sb-brand:hover { background: var(--bg-hover); }
.sb-brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sb-brand-mark { width: 29px; height: 16px; flex: none; }
.sb-brand-name { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; }
.sb-ws-row { padding: 0 10px 6px; }
.sb-ws-row .sb-workspace { width: 100%; background: var(--bg); box-shadow: var(--shadow-sm); }
.sb-ws-row .sb-workspace:hover { background: var(--bg-elevated); box-shadow: inset 0 0 0 1px var(--border-strong); }
.sb-ws-row .sb-avatar { background: #265fd0; width: 24px; height: 24px; }

/* ---------- Calendar date picker (pages and Projets) ---------- */
.pop-date { border-radius: 18px; }
.datepicker { padding: 14px; gap: 10px; }
.dp-title { font-size: 13px; font-weight: 800; color: var(--text-2); letter-spacing: 0.01em; }
.datepicker .date-field { height: 36px; border-radius: 10px; font-size: 14px; }
.dp-head { padding: 0; }
.dp-head .btn-icon { width: 30px; height: 30px; border-radius: 9px; }
.dp-month { font-size: 15px; font-weight: 800; color: var(--text); }
.dp-grid { gap: 2px; }
.dp-dow { font-size: 11.5px; font-weight: 700; text-transform: uppercase; color: var(--text-3); padding: 2px 0 4px; }
.dp-day { height: 34px; border-radius: 10px; font-size: 13.5px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; transition: background 0.1s, color 0.1s; }
.dp-day:hover { background: var(--bg-hover); }
.dp-day:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.dp-day.other { color: var(--text-3); font-weight: 500; }
.dp-day.today { color: #c2268d; box-shadow: inset 0 0 0 1.5px rgba(194, 38, 141, 0.55); font-weight: 800; }
.dp-day.selected, .dp-day.selected:hover { background: #c2268d; color: #fff; box-shadow: none; font-weight: 800; }
.dp-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 10px; }
.dp-quick { height: 28px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; color: var(--text); background: var(--bg-subtle); box-shadow: inset 0 0 0 1px var(--border); }
.dp-quick:hover { box-shadow: inset 0 0 0 1px #3cc6ef; background: var(--bg); }
.dp-clear { height: 28px; padding: 0 8px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--danger); }
.dp-clear:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
:root[data-theme="dark"] .dp-day.today { color: #ff7ac8; box-shadow: inset 0 0 0 1.5px rgba(255, 122, 200, 0.6); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .dp-day.today { color: #ff7ac8; box-shadow: inset 0 0 0 1.5px rgba(255, 122, 200, 0.6); } }
.dp-top { display: flex; align-items: center; justify-content: space-between; min-height: 24px; margin-bottom: -2px; }

/* ---------- Empty page: template chooser in aligned columns ---------- */
.starter-hint { color: var(--text-2); }
.starter-list { max-width: 620px; gap: 2px; }
.starter-item { display: grid; grid-template-columns: 20px minmax(0, 210px) minmax(0, 1fr); column-gap: 12px; align-items: center; padding: 7px 10px; border-radius: 10px; color: var(--text); font-weight: 500; }
.starter-item > :first-child { justify-self: center; }
.starter-item > span:nth-child(2) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.starter-item small { margin-left: 0; max-width: none; text-align: left; font-size: 13px; color: var(--text-3); font-weight: 400; }
.starter-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.starter-label { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; padding: 16px 10px 6px; }
@media (max-width: 600px) { .starter-item { grid-template-columns: 20px minmax(0, 1fr); } .starter-item small { display: none; } }

/* ---------- Settings: Connecter Claude ---------- */
.claude-examples { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px; }
.claude-examples span { align-self: flex-start; padding: 7px 12px; border-radius: 12px 12px 12px 4px; background: var(--bg-subtle); box-shadow: inset 0 0 0 1px var(--border); font-size: 13.5px; color: var(--text-2); }
.claude-step { display: flex; align-items: center; gap: 10px; margin: 22px 0 8px; font-size: 16px; font-weight: 800; }
.claude-step b { width: 24px; height: 24px; flex: none; border-radius: 999px; display: grid; place-items: center; background: #c2268d; color: #fff; font-size: 13px; }
.claude-key { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px 16px; border-radius: 14px; background: color-mix(in srgb, #1b7f40 8%, var(--bg)); box-shadow: inset 0 0 0 1px color-mix(in srgb, #1b7f40 30%, transparent); }
.claude-key p { margin: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.claude-key p .ic { color: #1b7f40; }
.claude-key code { font-family: var(--mono); font-size: 12.5px; padding: 6px 10px; border-radius: 8px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--border); overflow-wrap: anywhere; user-select: all; }
.claude-tabs { margin-bottom: 4px; }
.claude-steps { margin: 8px 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--text-2); }
.claude-config { position: relative; }
.claude-config pre { margin: 0; padding: 14px 16px; padding-right: 110px; border-radius: 12px; background: #1b0f4d; color: #eef3fc; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; white-space: pre; overflow: auto; max-height: 320px; }
.claude-config.wrap pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.claude-config .btn { position: absolute; top: 10px; right: 10px; background: #fff; color: #1b0f4d; }
.claude-note { margin-top: 10px; }
.claude-keys li { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
@media (max-width: 600px) { .claude-config pre { padding-right: 16px; padding-top: 50px; } }
