/* ================= Driftboard styles ================= */
:root {
  --bg: #f3f3f2;
  --canvas: #f0f0ee;
  --dot: transparent;
  --panel: #ffffff;
  --panel-2: #f7f7f5;
  --hover: rgba(0, 0, 0, 0.05);
  --text: #1f2328;
  --muted: #6b6f76;
  --border: #e4e2dc;
  --card: #ffffff;
  --col-bg: #e6e4de;
  --shadow: 0 1px 2px rgba(20, 20, 10, 0.08), 0 2px 6px rgba(20, 20, 10, 0.06);
  --shadow-lg: 0 14px 34px rgba(20, 20, 10, 0.18), 0 2px 6px rgba(20, 20, 10, 0.08);
  --accent: #2f6df6;
  --accent-soft: rgba(47, 109, 246, 0.12);
  --danger: #d64545;
  --c-default: #ffffff;
  --c-yellow: #fff3b0; --c-orange: #ffe0c2; --c-red: #ffd5d1; --c-pink: #fbd6ec; --c-purple: #e7ddff;
  --c-blue: #d7e6ff; --c-teal: #cdf0eb; --c-green: #d9f2cf; --c-gray: #e9e9e6;
  --s-default: #9aa0a8;
  --s-yellow: #f2c230; --s-orange: #f5973d; --s-red: #ec5f59; --s-pink: #e566ad; --s-purple: #8b6cf0;
  --s-blue: #4f8ef7; --s-teal: #2db3a0; --s-green: #57b847; --s-gray: #8d939b;
  --lc-light: #a9adb3; --lc-gray: #8a8f98; --lc-dark: #2b2f36; --lc-red: #e5484d; --lc-orange: #f76b15; --lc-yellow: #e0a800;
  --lc-green: #30a46c; --lc-blue: #2f6df6; --lc-purple: #8e4ec6;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #191919; --canvas: #1e1e1e; --dot: transparent; --panel: #252525; --panel-2: #1f1f1f;
    --hover: rgba(255, 255, 255, 0.07); --text: #e8e8e8; --muted: #9b9b9b; --border: #363636; --card: #2c2c2c;
    --col-bg: #272727; --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 14px 34px rgba(0, 0, 0, 0.55); --accent: #5b8cff; --accent-soft: rgba(91, 140, 255, 0.18);
    --c-default: #2c2c2c; --c-yellow: #4a4220; --c-orange: #4d3520; --c-red: #4d2b2b; --c-pink: #4a2a3e; --c-purple: #3a3256;
    --c-blue: #253a5c; --c-teal: #1e4542; --c-green: #2a4425; --c-gray: #3a3c42; --lc-dark: #dcdee2; --lc-gray: #8b909a; --lc-light: #d0d0d0;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #191919; --canvas: #1e1e1e; --dot: transparent; --panel: #252525; --panel-2: #1f1f1f;
  --hover: rgba(255, 255, 255, 0.07); --text: #e8e8e8; --muted: #9b9b9b; --border: #363636; --card: #2c2c2c;
  --col-bg: #272727; --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 14px 34px rgba(0, 0, 0, 0.55); --accent: #5b8cff; --accent-soft: rgba(91, 140, 255, 0.18);
  --c-default: #2c2c2c; --c-yellow: #4a4220; --c-orange: #4d3520; --c-red: #4d2b2b; --c-pink: #4a2a3e; --c-purple: #3a3256;
  --c-blue: #253a5c; --c-teal: #1e4542; --c-green: #2a4425; --c-gray: #3a3c42; --lc-dark: #dcdee2; --lc-gray: #8b909a; --lc-light: #d0d0d0;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  font-size: 14px; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { opacity: 0.4; cursor: default; }
kbd {
  font-family: inherit; font-size: 11px; padding: 1px 6px; border-radius: 5px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--muted); white-space: nowrap;
}
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12.5px; margin: 8px 0 0; }
.hint.center { text-align: center; }
.spacer { flex: 1; }
.ic { display: block; flex: none; }

/* ---------- layout ---------- */
#app {
  display: grid; height: 100vh; height: 100dvh;
  grid-template-rows: 52px 1fr; grid-template-columns: 68px 1fr auto;
}
#topbar {
  grid-column: 1 / 4; display: flex; align-items: center; gap: 10px; padding: 0 12px 0 14px;
  background: var(--panel); border-bottom: 1px solid var(--border); z-index: 30; min-width: 0;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; color: var(--text); text-decoration: none; flex: none; }
#crumbs { display: flex; align-items: center; gap: 4px; min-width: 0; overflow: hidden; margin-left: 10px; }
.crumb {
  display: flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 7px; color: var(--muted);
  text-decoration: none; white-space: nowrap; min-width: 0; max-width: 220px;
}
.crumb-text { overflow: hidden; text-overflow: ellipsis; }
a.crumb:hover { background: var(--hover); color: var(--text); }
.crumb.current { color: var(--text); font-weight: 600; cursor: default; }
.crumb-sep { color: var(--muted); opacity: 0.6; }
.sync { font-size: 12px; color: var(--muted); white-space: nowrap; }
.sync.saving { color: var(--muted); }
.sync.offline { color: var(--danger); font-weight: 600; }
.chip { font-size: 12px; padding: 3px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
#topactions { display: flex; align-items: center; gap: 4px; }
.search-btn {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--muted); margin-right: 6px;
}
.search-btn:hover { color: var(--text); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  border-radius: 8px; border: 0; background: none; color: var(--muted);
}
.icon-btn:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); }
.icon-btn.tiny { width: 22px; height: 22px; font-size: 11px; margin-left: auto; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel); color: var(--text); font-weight: 500; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); background: var(--accent); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn-small {
  padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--panel);
  font-size: 12.5px; color: var(--text);
}
.btn-small:hover { background: var(--hover); }
.btn-link { border: 0; background: none; color: var(--accent); padding: 4px; font-weight: 500; }
.share-btn { margin: 0 4px; }

/* ---------- toolbar ---------- */
#toolbar {
  grid-row: 2; grid-column: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 0; background: var(--panel); border-right: 1px solid var(--border); z-index: 20;
  overflow-y: auto; scrollbar-width: none;
}
.readonly #toolbar { display: none; }
.readonly #app { grid-template-columns: 0 1fr auto; }
.tool {
  position: relative; width: 56px; padding: 7px 0 5px; border-radius: 9px; border: 0; background: none;
  display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px;
  color: var(--muted); cursor: grab; user-select: none; touch-action: none; flex: none;
}
.tool:hover { background: var(--hover); color: var(--text); }
.tool.active { background: var(--accent-soft); color: var(--accent); }
.tool-spacer { flex: 1; min-height: 12px; }
.tool-badge {
  position: absolute; top: 3px; right: 8px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--muted); color: var(--panel); font-size: 10px; line-height: 16px; font-weight: 700;
}
.tool-ghost {
  position: fixed; z-index: 1000; pointer-events: none; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 8px;
  background: var(--panel); box-shadow: var(--shadow-lg); color: var(--text); font-weight: 600;
}

/* ---------- canvas ---------- */
#viewport {
  grid-row: 2; grid-column: 2; position: relative; overflow: hidden; touch-action: none;
  background-color: var(--canvas);
  cursor: default; outline: none;
}
#viewport.space, #viewport.space .card { cursor: grab; }
#viewport.panning, #viewport.panning .card { cursor: grabbing; }
#viewport.line-tool, #viewport.line-tool .card { cursor: crosshair; }
#viewport.drop-hover::after {
  content: 'Drop to add to the board'; position: absolute; inset: 12px; border: 3px dashed var(--accent);
  border-radius: 14px; display: flex; align-items: flex-start; justify-content: center; padding-top: 20px;
  color: var(--accent); font-weight: 600; pointer-events: none; background: var(--accent-soft);
}
#world { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-origin: 0 0; }
#lines { position: absolute; left: -50000px; top: -50000px; width: 100000px; height: 100000px; pointer-events: none; overflow: visible; z-index: 0; }
#cards { position: absolute; left: 0; top: 0; z-index: 1; }
#marquee { position: absolute; border: 1px solid var(--accent); background: var(--accent-soft); z-index: 50; pointer-events: none; border-radius: 3px; }

/* lines */
#lines .line-path { fill: none; stroke-linecap: round; }
#lines .line-path.temp { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 6 5; }
#lines .line-hit { fill: none; stroke: transparent; stroke-width: 16; pointer-events: stroke; cursor: pointer; }
#lines .line.selected .line-path { filter: drop-shadow(0 0 3px var(--accent)); }
#lines .handle { fill: var(--panel); stroke: var(--accent); stroke-width: 2; pointer-events: all; cursor: move; }
#lines .handle-bend { fill: var(--accent); }
#lines .line-label {
  font: 600 13px "Inter", "Segoe UI", system-ui, sans-serif; fill: var(--text); paint-order: stroke;
  stroke: var(--canvas); stroke-width: 6px; stroke-linejoin: round; text-anchor: middle; dominant-baseline: middle;
  pointer-events: all; cursor: pointer;
}

/* ---------- cards ---------- */
.card {
  position: absolute; --card-bg: var(--card); background: var(--card-bg); border-radius: 7px;
  box-shadow: var(--shadow); user-select: none; -webkit-user-select: none; color: var(--text);
  transition: box-shadow 0.15s;
}
.card[data-color="default"] { --card-bg: var(--card); }
.card[data-color="yellow"] { --card-bg: var(--c-yellow); }
.card[data-color="orange"] { --card-bg: var(--c-orange); }
.card[data-color="red"] { --card-bg: var(--c-red); }
.card[data-color="pink"] { --card-bg: var(--c-pink); }
.card[data-color="purple"] { --card-bg: var(--c-purple); }
.card[data-color="blue"] { --card-bg: var(--c-blue); }
.card[data-color="teal"] { --card-bg: var(--c-teal); }
.card[data-color="green"] { --card-bg: var(--c-green); }
.card[data-color="gray"] { --card-bg: var(--c-gray); }
.card:hover { box-shadow: var(--shadow), 0 0 0 1px var(--border); }
.card.selected { box-shadow: var(--shadow), 0 0 0 2px var(--accent); }
.card.editing { box-shadow: var(--shadow-lg), 0 0 0 2px var(--accent); user-select: text; -webkit-user-select: text; cursor: auto; }
.card.dragging { pointer-events: none; box-shadow: var(--shadow-lg); opacity: 0.94; }
.card.drop-target { box-shadow: var(--shadow-lg), 0 0 0 3px var(--accent) !important; }
.card.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 6px var(--accent); } 100% { box-shadow: var(--shadow); } }
.card.loading { opacity: 0.85; }
.card [contenteditable="true"] { outline: none; cursor: text; }
.card img { -webkit-user-drag: none; }
[data-placeholder]:empty::before { content: attr(data-placeholder); color: var(--muted); opacity: 0.75; pointer-events: none; }

.resize-handle {
  position: absolute; right: -6px; bottom: -6px; width: 14px; height: 14px; cursor: ew-resize; display: none;
  background: var(--panel); border: 2px solid var(--accent); border-radius: 4px; z-index: 3;
}
.card.selected:not(.dragging) > .resize-handle { display: block; }
.card-board > .resize-handle, .col-body .resize-handle { display: none !important; }
.connect-handle {
  position: absolute; right: -24px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%;
  background: var(--panel); border: 2px solid var(--accent); cursor: crosshair; display: none; z-index: 3;
}
.connect-handle::after { content: ''; position: absolute; inset: 2px; border-radius: 50%; background: var(--accent); }
.card.selected:not(.editing):not(.dragging) > .connect-handle { display: block; }
.col-body .card.selected > .connect-handle { right: -14px; }
.comment-badge {
  position: absolute; top: -10px; right: 10px; padding: 1px 7px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel); font-size: 11px; box-shadow: var(--shadow); z-index: 2;
}

/* rich text */
.rich { line-height: 1.5; overflow-wrap: anywhere; min-height: 1.5em; }
.rich h1 { font-size: 1.55em; line-height: 1.25; margin: 0.15em 0 0.3em; }
.rich h2 { font-size: 1.2em; line-height: 1.3; margin: 0.15em 0 0.25em; }
.rich h3 { font-size: 1.05em; margin: 0.1em 0; }
.rich p { margin: 0 0 0.4em; }
.rich ul, .rich ol { margin: 0.2em 0; padding-left: 1.4em; }
.rich blockquote { margin: 0.35em 0; padding-left: 10px; border-left: 3px solid var(--s-gray); color: var(--muted); }
.rich pre { margin: 0.35em 0; padding: 8px 10px; border-radius: 6px; background: var(--hover); font: 12.5px/1.45 ui-monospace, Consolas, monospace; white-space: pre-wrap; }
.rich code { font: 12.5px ui-monospace, Consolas, monospace; background: var(--hover); padding: 1px 4px; border-radius: 4px; }
.rich a { color: var(--accent); }
.rich hr { border: 0; border-top: 1px solid var(--border); }

.card-note { padding: 12px 14px; min-height: 44px; }

/* document */
.card-doc { padding: 14px; }
.doc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.doc-icon { font-size: 20px; }
.doc-title { font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }
.doc-excerpt { color: var(--muted); font-size: 13px; line-height: 1.45; max-height: 7.3em; overflow: hidden; white-space: pre-line; }
.doc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; font-size: 12px; }

/* to-do */
.card-todo { padding: 12px 12px 10px; }
.todo-title { font-weight: 700; font-size: 15px; margin: 0 2px 6px; overflow-wrap: anywhere; min-height: 1.4em; }
.todo-progress { display: flex; align-items: center; gap: 8px; margin: 0 2px 8px; font-size: 11.5px; color: var(--muted); }
.todo-bar { flex: 1; height: 5px; border-radius: 3px; background: var(--hover); overflow: hidden; }
.todo-bar > div { height: 100%; background: var(--s-green); border-radius: 3px; transition: width 0.3s; }
.todo-item { display: flex; align-items: flex-start; gap: 8px; padding: 3px 2px; border-radius: 5px; }
.todo-item input[type=checkbox] { width: 16px; height: 16px; margin: 2px 0 0; flex: none; accent-color: var(--s-green); cursor: pointer; }
.todo-text { flex: 1; line-height: 1.45; overflow-wrap: anywhere; min-width: 20px; }
.todo-item.done .todo-text { text-decoration: line-through; color: var(--muted); }
.todo-due { font-size: 11px; padding: 1px 6px; border-radius: 9px; background: var(--hover); color: var(--muted); white-space: nowrap; flex: none; }
.todo-due.overdue { background: rgba(229, 72, 77, 0.15); color: var(--lc-red); }
.todo-due.today { background: var(--accent-soft); color: var(--accent); }
.todo-date { font: inherit; font-size: 11px; border: 1px solid var(--border); border-radius: 5px; background: var(--panel); color: var(--muted); padding: 1px 3px; width: 112px; flex: none; }
.todo-del { border: 0; background: none; color: var(--muted); font-size: 16px; line-height: 1; padding: 0 4px; border-radius: 4px; }
.todo-del:hover { color: var(--danger); background: var(--hover); }
.todo-add { border: 0; background: none; color: var(--muted); padding: 6px 4px 2px; font-size: 13px; }
.todo-add:hover { color: var(--accent); }

/* link */
.card-link { overflow: hidden; }
.link-media { position: relative; background: var(--hover); }
.link-media img { display: block; width: 100%; max-height: 260px; object-fit: cover; }
.link-media iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; }
.play-btn {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 56px; height: 40px;
  border-radius: 10px; border: 0; background: rgba(230, 30, 30, 0.92); color: #fff; font-size: 18px;
}
.link-body { padding: 10px 12px 11px; }
.link-title { font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.link-desc { color: var(--muted); font-size: 12.5px; line-height: 1.4; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.link-meta { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.link-domain { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.favicon { width: 14px; height: 14px; border-radius: 3px; }
.link-open { text-decoration: none; color: var(--muted); padding: 0 5px; border-radius: 4px; font-size: 14px; }
.link-open:hover { background: var(--hover); color: var(--accent); }
.link-empty { display: flex; align-items: center; gap: 8px; padding: 12px; }
.link-empty-icon { font-size: 18px; }
.link-input { flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: 6px; padding: 7px 9px; font: inherit; background: var(--panel); color: var(--text); outline: none; }
.link-input:focus { border-color: var(--accent); }

/* image */
.card-image { overflow: hidden; }
.img-wrap { position: relative; background: var(--hover); min-height: 40px; }
.img-wrap img { display: block; width: 100%; height: auto; }
.img-wrap.broken::after { content: 'Image unavailable'; display: block; padding: 30px 10px; text-align: center; color: var(--muted); }
.img-placeholder { padding: 40px 10px; text-align: center; color: var(--muted); }
.upload-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, 0.35); }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid rgba(0, 0, 0, 0.15); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.img-caption { padding: 8px 12px 10px; font-size: 13px; color: var(--muted); line-height: 1.4; overflow-wrap: anywhere; }

/* file */
.card-file { overflow: hidden; }
.card-file audio { display: block; width: 100%; height: 40px; padding: 8px 8px 0; }
.card-file video { display: block; width: 100%; background: #000; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.file-icon {
  width: 38px; height: 46px; border-radius: 5px; flex: none; display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 6px; font-size: 9.5px; font-weight: 800; color: #fff; background: var(--s-gray);
}
.ft-pdf { background: #e5484d; } .ft-audio { background: #8e4ec6; } .ft-video { background: #f76b15; }
.ft-doc { background: #2f6df6; } .ft-sheet { background: #30a46c; } .ft-slides { background: #e0a800; }
.ft-archive { background: #6b6f76; } .ft-image { background: #2db3a0; }
.file-info { flex: 1; min-width: 0; }
.file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { font-size: 12px; color: var(--muted); margin-top: 2px; }
.file-btn { text-decoration: none; color: var(--muted); padding: 4px 7px; border-radius: 6px; font-size: 15px; }
.file-btn:hover { background: var(--hover); color: var(--accent); }

/* board */
.card-board { padding: 8px 8px 9px; width: 128px; text-align: center; background: var(--card); }
.board-tile {
  height: 84px; border-radius: 6px; display: flex; align-items: center; justify-content: center;
  background: var(--s-blue); margin-bottom: 7px; box-shadow: inset 0 -10px 20px rgba(0, 0, 0, 0.08);
}
.card-board[data-color="default"] .board-tile { background: var(--s-default); }
.card-board[data-color="yellow"] .board-tile { background: var(--s-yellow); }
.card-board[data-color="orange"] .board-tile { background: var(--s-orange); }
.card-board[data-color="red"] .board-tile { background: var(--s-red); }
.card-board[data-color="pink"] .board-tile { background: var(--s-pink); }
.card-board[data-color="purple"] .board-tile { background: var(--s-purple); }
.card-board[data-color="blue"] .board-tile { background: var(--s-blue); }
.card-board[data-color="teal"] .board-tile { background: var(--s-teal); }
.card-board[data-color="green"] .board-tile { background: var(--s-green); }
.card-board[data-color="gray"] .board-tile { background: var(--s-gray); }
.card-board[data-color] { --card-bg: var(--card); }
.board-icon { font-size: 36px; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.15)); }
.board-title { font-weight: 600; font-size: 13px; line-height: 1.3; overflow-wrap: anywhere; min-height: 1.3em; }
.board-count { font-size: 11px; color: var(--muted); margin-top: 2px; }
.col-body .card-board { width: auto; display: grid; grid-template-columns: 56px 1fr; grid-template-rows: auto auto; column-gap: 10px; text-align: left; align-items: center; }
.col-body .board-tile { height: 44px; margin: 0; grid-row: 1 / 3; }
.col-body .board-icon { font-size: 22px; }

/* column */
.card-column { --card-bg: var(--col-bg); background: var(--card-bg); padding: 0 8px 4px; min-height: 90px; }
.card-column[data-color] { --card-bg: var(--c-default); }
.card-column[data-color="yellow"] { --card-bg: var(--c-yellow); }
.card-column[data-color="orange"] { --card-bg: var(--c-orange); }
.card-column[data-color="red"] { --card-bg: var(--c-red); }
.card-column[data-color="pink"] { --card-bg: var(--c-pink); }
.card-column[data-color="purple"] { --card-bg: var(--c-purple); }
.card-column[data-color="blue"] { --card-bg: var(--c-blue); }
.card-column[data-color="teal"] { --card-bg: var(--c-teal); }
.card-column[data-color="green"] { --card-bg: var(--c-green); }
.card-column[data-color="gray"] { --card-bg: var(--c-gray); }
.card-column[data-color="default"] { --card-bg: var(--col-bg); }
.col-head { display: flex; align-items: center; gap: 6px; padding: 10px 4px 8px; }
.col-title { flex: 1; font-weight: 700; font-size: 14.5px; overflow-wrap: anywhere; min-height: 1.3em; }
.col-count { font-size: 12px; color: var(--muted); }
.col-collapse { border: 0; background: none; color: var(--muted); padding: 0 4px; font-size: 14px; border-radius: 4px; }
.col-collapse:hover { background: var(--hover); color: var(--text); }
.col-body { min-height: 40px; padding-bottom: 4px; }
.card-column.collapsed .col-body { display: none; }
.card-column.collapsed { min-height: 0; padding-bottom: 0; }
.col-body > .card { position: relative; left: auto !important; top: auto !important; width: auto !important; margin-bottom: 8px; z-index: auto; }
.col-empty { display: none; padding: 18px 8px; text-align: center; color: var(--muted); font-size: 12.5px; border: 2px dashed rgba(127, 127, 127, 0.25); border-radius: 7px; margin-bottom: 8px; }
.col-body:not(:has(> .card)) > .col-empty { display: block; }
.drop-bar { height: 4px; margin: -6px 2px 2px; border-radius: 2px; background: var(--accent); }

/* swatch */
.card-swatch { overflow: hidden; }
.swatch-color { position: relative; height: 92px; }
.swatch-info { padding: 8px 10px 9px; }
.swatch-name { font-weight: 600; font-size: 13px; min-height: 1.3em; overflow-wrap: anywhere; }
.swatch-hex { font: 12px ui-monospace, Consolas, monospace; color: var(--muted); margin-top: 2px; cursor: copy; display: inline-block; }
.swatch-picker { position: absolute; right: 8px; bottom: 8px; width: 34px; height: 30px; border: 2px solid #fff; border-radius: 6px; padding: 0; cursor: pointer; background: none; }
.swatch-hex-input { width: 100%; font: 12px ui-monospace, Consolas, monospace; margin-top: 4px; padding: 3px 5px; border: 1px solid var(--border); border-radius: 4px; background: var(--panel); color: var(--text); }

/* sketch */
.card-sketch { overflow: hidden; position: relative; }
.sketch-wrap svg { display: block; width: 100%; height: auto; aspect-ratio: 1000 / 640; }
.sketch-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #8a8f98; font-size: 13px; pointer-events: none; }

/* ---------- selection toolbar & format bar ---------- */
#selbar {
  position: fixed; z-index: 60; display: flex; align-items: center; gap: 2px; padding: 4px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg);
}
#selbar[hidden] { display: none; }
.sb-btn {
  display: inline-flex; align-items: center; gap: 4px; height: 32px; min-width: 32px; padding: 0 7px; border-radius: 7px;
  border: 0; background: none; color: var(--text);
}
.sb-btn:hover { background: var(--hover); }
.sb-btn.danger:hover { color: var(--danger); }
.sb-label { font-size: 12.5px; font-weight: 500; }
.sb-sep { width: 1px; height: 20px; background: var(--border); margin: 0 3px; }
.sb-emoji { font-size: 17px; }
.sb-text { font-size: 16px; font-weight: 700; min-width: 16px; text-align: center; }
.color-dot { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.15); display: inline-block; }
.color-dot[data-color="default"], .color-swatch[data-color="default"] { background: var(--c-default); }
.color-dot[data-color="yellow"], .color-swatch[data-color="yellow"] { background: var(--s-yellow); }
.color-dot[data-color="orange"], .color-swatch[data-color="orange"] { background: var(--s-orange); }
.color-dot[data-color="red"], .color-swatch[data-color="red"] { background: var(--s-red); }
.color-dot[data-color="pink"], .color-swatch[data-color="pink"] { background: var(--s-pink); }
.color-dot[data-color="purple"], .color-swatch[data-color="purple"] { background: var(--s-purple); }
.color-dot[data-color="blue"], .color-swatch[data-color="blue"] { background: var(--s-blue); }
.color-dot[data-color="teal"], .color-swatch[data-color="teal"] { background: var(--s-teal); }
.color-dot[data-color="green"], .color-swatch[data-color="green"] { background: var(--s-green); }
.color-dot[data-color="gray"], .color-swatch[data-color="gray"] { background: var(--s-gray); }
.color-grid { display: grid; grid-template-columns: repeat(5, 30px); gap: 6px; padding: 8px; }
.color-swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(0, 0, 0, 0.08); }
.color-swatch:hover { transform: scale(1.12); }
.color-grid:has(.line) { grid-template-columns: repeat(4, 30px); }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 34px); gap: 2px; padding: 6px; }
.emoji-btn { width: 34px; height: 34px; border: 0; background: none; border-radius: 6px; font-size: 19px; }
.emoji-btn:hover { background: var(--hover); }
.arrange { padding: 8px; min-width: 300px; }
.arr-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; margin: 4px 4px 6px; }
.arr-row { display: flex; gap: 4px; margin-bottom: 4px; }
.arr-btn { flex: 1; padding: 7px 8px; border-radius: 6px; border: 1px solid var(--border); background: var(--panel); font-size: 12.5px; white-space: nowrap; }
.arr-btn:hover { background: var(--hover); }

.fmt-bar { display: flex; align-items: center; gap: 1px; flex-wrap: wrap; }
.fmt-btn { min-width: 30px; height: 30px; padding: 0 6px; border-radius: 6px; border: 0; background: none; color: var(--text); font-size: 14px; }
.fmt-btn:hover { background: var(--hover); }
.fmt-text { font-size: 12.5px; font-weight: 700; }
.fmt-code { font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; }
.fmt-hl { background: #ffe066; color: #222; padding: 0 3px; border-radius: 2px; font-weight: 700; }
.fmt-red { color: #e5484d; font-weight: 800; }
.fmt-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.fmt-done { color: var(--accent); font-weight: 600; font-size: 13px; padding: 0 10px; }

/* ---------- zoom bar & empty state ---------- */
#zoombar {
  position: absolute; right: 14px; bottom: 14px; z-index: 40; display: flex; align-items: center; gap: 2px; padding: 3px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow);
}
.zoom-label { min-width: 52px; height: 30px; border: 0; background: none; font-size: 12.5px; font-weight: 600; border-radius: 6px; color: var(--text); }
.zoom-label:hover { background: var(--hover); }
#zoombar .icon-btn { width: 30px; height: 30px; }
#empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 5; }
#empty[hidden] { display: none; }
.empty-box {
  pointer-events: auto; max-width: 460px; text-align: center; padding: 28px 30px; border-radius: 16px;
  background: var(--panel); box-shadow: var(--shadow-lg); border: 1px solid var(--border);
}
.empty-title { font-size: 19px; font-weight: 700; margin-bottom: 6px; }
.empty-sub { color: var(--muted); line-height: 1.5; margin-bottom: 18px; }
.empty-tpls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.tpl-mini { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--border); background: var(--panel-2); font-weight: 500; text-align: left; }
.tpl-mini:hover { border-color: var(--accent); background: var(--accent-soft); }
.tpl-mini span:first-child { font-size: 18px; }

/* ---------- popovers & menus ---------- */
.popover {
  position: fixed; z-index: 2000; background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-lg); animation: pop 0.1s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-3px); } }
.menu { padding: 5px; min-width: 230px; }
.menu-item {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; padding: 7px 9px;
  border: 0; background: none; border-radius: 6px; text-align: left; color: var(--text);
}
.menu-item:hover:not(:disabled) { background: var(--hover); }
.menu-item.danger { color: var(--danger); }
.menu-label { display: flex; align-items: center; gap: 9px; }
.menu-label .ic { color: var(--muted); }
.menu-hint { font-size: 11.5px; color: var(--muted); }
.menu-sep { height: 1px; background: var(--border); margin: 5px 4px; }
.menu-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 9px; gap: 10px; }
.segmented { display: flex; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.seg { border: 0; background: none; padding: 4px 10px; font-size: 12.5px; color: var(--muted); }
.seg.active { background: var(--accent); color: #fff; }

/* ---------- overlays & modals ---------- */
.overlay { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; background: rgba(15, 15, 20, 0.45); animation: fade 0.12s ease-out; padding: 16px; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 520px; max-width: 100%; max-height: calc(100vh - 40px); overflow: auto; background: var(--panel); border-radius: 14px; box-shadow: var(--shadow-lg); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 6px; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 8px 18px 16px; }
.modal-text { margin: 0; line-height: 1.5; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 0 18px 16px; }
.input {
  width: 100%; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-2);
  color: var(--text); font: inherit; outline: none; resize: vertical;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.empty-note { padding: 24px 12px; text-align: center; color: var(--muted); line-height: 1.5; }
.callout { margin-top: 14px; padding: 12px 14px; border-radius: 9px; background: var(--accent-soft); line-height: 1.5; font-size: 13px; }
.callout code, .share code { background: var(--panel); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.share-row { margin-bottom: 14px; }
.share-row label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.share-input { display: flex; gap: 6px; }
.share-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }

/* search */
.search-overlay { align-items: flex-start; padding-top: 10vh; }
.search-box { width: 640px; max-width: 100%; background: var(--panel); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; }
.search-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--muted); }
.search-input { flex: 1; border: 0; outline: none; background: none; font: inherit; font-size: 16px; color: var(--text); padding: 4px 0; }
.search-results { max-height: 60vh; overflow: auto; padding: 6px; }
.search-section { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 8px 10px 4px; }
.search-row { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: none; text-align: left; color: var(--text); }
.search-row.active { background: var(--accent-soft); }
.sr-icon { width: 22px; display: flex; justify-content: center; padding-top: 1px; color: var(--muted); font-size: 16px; flex: none; }
.sr-main { flex: 1; min-width: 0; }
.sr-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-snippet { font-size: 12.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-snippet mark { background: #ffe066; color: #222; border-radius: 2px; }
.sr-path { font-size: 11.5px; color: var(--muted); margin-top: 2px; opacity: 0.85; }
.sr-type { font-size: 11px; color: var(--muted); flex: none; padding-top: 3px; }

/* templates & picker */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.tpl-tile { padding: 16px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel-2); text-align: left; transition: transform 0.1s; }
.tpl-tile:hover { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-2px); }
.tpl-icon { font-size: 28px; margin-bottom: 8px; }
.tpl-name { font-weight: 700; margin-bottom: 3px; }
.tpl-desc { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.picker-list { max-height: 55vh; overflow: auto; margin: 0 -6px; }
.picker-row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; border: 0; border-radius: 7px; background: none; text-align: left; color: var(--text); }
.picker-row:hover:not(:disabled) { background: var(--accent-soft); }

/* shortcuts */
.shortcuts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.shortcuts h4 { margin: 4px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.sc-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0; font-size: 13px; }

/* document editor */
.doc-overlay { padding: 0; background: rgba(15, 15, 20, 0.55); }
.doc-editor { width: 100%; height: 100%; display: flex; flex-direction: column; background: var(--canvas); }
.doc-top { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.doc-scroll { flex: 1; overflow: auto; padding: 36px 16px 80px; }
.doc-paper { max-width: 780px; min-height: 100%; margin: 0 auto; padding: 48px 64px; background: var(--card); border-radius: 8px; box-shadow: var(--shadow); }
.doc-title-input { width: 100%; border: 0; outline: none; background: none; font-family: inherit; font-size: 30px; font-weight: 700; line-height: 1.25; color: var(--text); margin-bottom: 16px; }
.doc-body { font-size: 16px; line-height: 1.7; min-height: 50vh; outline: none; }

/* sketch editor */
.sketch-overlay { background: rgba(15, 15, 20, 0.6); }
.sketch-editor { width: min(1100px, 100%, calc((100vh - 150px) * 1.5625 + 24px)); background: var(--panel); border-radius: 14px; padding: 12px; box-shadow: var(--shadow-lg); }
.sketch-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.sk-group { display: flex; align-items: center; gap: 4px; padding: 3px; border-radius: 8px; background: var(--panel-2); }
.sk-color { width: 24px; height: 24px; border-radius: 50%; border: 2px solid rgba(0, 0, 0, 0.12); }
.sk-color.active { outline: 2px solid var(--accent); outline-offset: 2px; }
.sk-size { width: 30px; height: 30px; border: 0; border-radius: 6px; background: none; display: flex; align-items: center; justify-content: center; }
.sk-size span { background: var(--text); border-radius: 50%; display: block; }
.sk-size.active { background: var(--accent-soft); }
.sketch-paper { background: #fff; border-radius: 8px; border: 1px solid var(--border); overflow: hidden; }
.sketch-svg { display: block; width: 100%; height: auto; aspect-ratio: 1000 / 640; touch-action: none; cursor: crosshair; }
.sketch-svg.erasing { cursor: cell; }

/* lightbox */
.lightbox { background: rgba(0, 0, 0, 0.85); cursor: zoom-out; }
.lightbox-fig { margin: 0; max-width: 94vw; max-height: 92vh; text-align: center; }
.lightbox-fig img { max-width: 94vw; max-height: 86vh; border-radius: 6px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); }
.lightbox-fig figcaption { color: #ddd; margin-top: 10px; }

/* ---------- side panel ---------- */
#sidepanel { grid-row: 2; grid-column: 3; width: 340px; background: var(--panel); border-left: 1px solid var(--border); z-index: 25; overflow: hidden; display: flex; }
#sidepanel[hidden] { display: none; }
.side-inner { display: flex; flex-direction: column; width: 100%; min-height: 0; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 10px 8px 16px; }
.side-head h3 { margin: 0; font-size: 16px; }
.side-tools { padding: 0 16px 8px; }
.side-target { display: flex; align-items: center; gap: 8px; margin: 0 12px 8px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-2); text-align: left; color: var(--text); }
.side-target span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.side-list { flex: 1; overflow: auto; padding: 4px 12px 12px; }
.trash-row { display: flex; align-items: center; gap: 8px; padding: 8px 6px; border-radius: 8px; }
.trash-row:hover { background: var(--hover); }
.tr-icon { width: 22px; display: flex; justify-content: center; color: var(--muted); flex: none; }
.tr-main { flex: 1; min-width: 0; }
.tr-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-meta { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comment { padding: 10px 2px; border-bottom: 1px solid var(--border); }
.comment-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--s-purple); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.comment-text { margin: 6px 0 0 32px; white-space: pre-wrap; line-height: 1.45; overflow-wrap: anywhere; }
.comment-form { padding: 10px 12px 14px; border-top: 1px solid var(--border); }
.comment-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 12px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 3000; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 14px; padding: 10px 14px 10px 16px; border-radius: 10px;
  background: #24262b; color: #f1f1f1; box-shadow: var(--shadow-lg); font-size: 13.5px; transition: opacity 0.3s, transform 0.3s; max-width: 90vw;
}
.toast.out { opacity: 0; transform: translateY(8px); }
.toast-action { border: 0; background: none; color: #8fb2ff; font-weight: 700; padding: 2px 4px; }

.fatal { position: fixed; inset: 0; z-index: 5000; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; text-align: center; }
.fatal pre { color: var(--muted); }

/* ---------- custom colours & clear cards ---------- */
.card[data-color="custom"] { --card-bg: var(--custom); }
.card[data-color="clear"] { --card-bg: transparent; box-shadow: none; }
.card[data-color="clear"]:hover { box-shadow: 0 0 0 1px var(--border); }
.card[data-color="clear"].selected { box-shadow: 0 0 0 2px var(--accent); }
.card.on-dark { color: #f4f4f5; --muted: rgba(255, 255, 255, 0.72); }
.card.on-light { color: #1f2328; --muted: rgba(0, 0, 0, 0.55); }
.card-board[data-color="custom"] { --card-bg: var(--card); }
.card-board[data-color="custom"] .board-tile { background: var(--custom); }
.card-column[data-color="custom"] { --card-bg: var(--custom); }
.card-column[data-color="clear"] { --card-bg: transparent; }
.card-sketch { --card-bg: #ffffff; }
.card-sketch[data-color="clear"] .sketch-empty { color: var(--muted); }
.board-tile.has-img { padding: 0; overflow: hidden; background: var(--hover) !important; }
.board-img { width: 100%; height: 100%; object-fit: cover; display: block; filter: none; }
.crumb-icon.board-img, .sb-emoji.board-img { width: 18px; height: 18px; border-radius: 4px; object-fit: cover; }
.col-body .board-tile.has-img { height: 44px; }

/* serif headings, like a printed page */
.col-title, .rich h1, .rich h2, .doc-title-input, .tp-head b { font-family: Georgia, "Times New Roman", serif; }
.col-head { flex-direction: column; gap: 1px; padding: 12px 4px 8px; position: relative; text-align: center; }
.col-title { font-size: 15px; width: 100%; padding: 0 22px; }
.col-count { font-size: 11px; }
.col-collapse { position: absolute; right: 2px; top: 10px; }

/* empty image frame */
.img-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); border: 2px dashed rgba(127, 127, 127, 0.3); border-radius: 6px; margin: 6px; font-size: 12px; }
.img-empty-icon { font-size: 26px; opacity: 0.6; }
.img-empty-hint { font-size: 11px; opacity: 0.8; }

/* ---------- colour picker ---------- */
.cp { padding: 12px; width: 236px; }
.cp-title { font-weight: 700; font-size: 13px; margin-bottom: 8px; }
.cp-sub { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 10px 0 6px; }
.cp-grid { display: grid; grid-template-columns: repeat(6, 30px); gap: 6px; }
.cp-swatch { width: 30px; height: 30px; border-radius: 6px; border: 1px solid rgba(127, 127, 127, 0.35); padding: 0; }
.cp-swatch:hover { transform: scale(1.1); }
.cp-swatch.active { outline: 2px solid var(--accent); outline-offset: 2px; }
.cp-swatch.clear { background: repeating-conic-gradient(rgba(127, 127, 127, 0.35) 0 25%, transparent 0 50%) 0 0 / 10px 10px !important; }
.cp-sep { height: 1px; background: var(--border); margin: 12px 0; }
.cp-custom { width: 100%; justify-content: center; }
.cp-rainbow { width: 16px; height: 16px; border-radius: 50%; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.cw { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.cw-wheel { position: relative; width: 180px; height: 180px; cursor: crosshair; touch-action: none; }
.cw-canvas { display: block; border-radius: 50%; }
.cw-marker { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3); pointer-events: none; }
.cw-slider { width: 100%; -webkit-appearance: none; appearance: none; height: 12px; border-radius: 6px; outline: none; }
.cw-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid #555; cursor: pointer; }
.cw-slider::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid #555; cursor: pointer; }
.cw-row { display: flex; gap: 6px; width: 100%; align-items: center; }
.cw-preview { width: 34px; height: 34px; border-radius: 6px; flex: none; border: 1px solid var(--border); }
.cw-hex { font-family: ui-monospace, Consolas, monospace; padding: 7px 8px; }
.icon-picker { padding: 10px; width: 310px; }
.icon-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.icon-picker .emoji-grid { padding: 0; }
.menu-note { padding: 6px 9px; font-size: 12px; color: var(--muted); max-width: 240px; line-height: 1.4; }
.sb-fx { font-style: italic; font-family: Georgia, serif; }

/* ---------- table ---------- */
.card-table { padding: 0; }
.tbl-wrap { position: relative; }
.tbl { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13px; }
.tbl td { border: 1px solid var(--border); padding: 0; vertical-align: top; position: relative; }
.tbl tr:first-child td { border-top: 0; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td:first-child { border-left: 0; }
.tbl td:last-child { border-right: 0; }
.tbl .cell { padding: 7px 9px; min-height: 32px; line-height: 1.35; overflow-wrap: anywhere; white-space: pre-wrap; outline: none; }
.tbl td.num .cell { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td[style*="text-align"] .cell { text-align: inherit; }
.tbl td.b .cell { font-weight: 700; }
.tbl td.i .cell { font-style: italic; }
.tbl tr.hdr td { background: var(--hover); font-weight: 700; }
.tbl tr.hdr td[style*="background"] { background: unset; }
.card-table.editing .cell { cursor: text; }
.card-table.editing td.active { box-shadow: inset 0 0 0 2px var(--accent); }
.card-table.editing td.in-range { background-image: linear-gradient(var(--accent-soft), var(--accent-soft)); }
.tbl-cols { position: absolute; left: 0; right: 0; top: -30px; height: 24px; }
.tbl-col { position: absolute; top: 0; height: 24px; display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--panel); border: 1px solid var(--border); border-radius: 5px 5px 0 0; box-sizing: border-box; }
.tbl-col.on { color: var(--accent); background: var(--accent-soft); }
.tbl-grip { position: absolute; top: 0; width: 10px; margin-left: -5px; height: 24px; cursor: col-resize; z-index: 2; }
.tbl-grip:hover { background: linear-gradient(var(--accent), var(--accent)) center / 2px 100% no-repeat; }
.tbl-nums { position: absolute; left: -32px; top: 0; width: 26px; }
.tbl-num { position: absolute; left: 0; width: 26px; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); background: var(--panel); border: 1px solid var(--border); border-radius: 5px 0 0 5px; box-sizing: border-box; }
.tbl-num.on { color: var(--accent); background: var(--accent-soft); }

/* ---------- template picker ---------- */
#tplpanel { position: absolute; right: 16px; bottom: 16px; z-index: 45; width: 300px; max-height: calc(100% - 32px); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 14px; }
#tplpanel[hidden] { display: none; }
.tp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.tp-head b { font-size: 17px; }
.tp-back { border: 0; background: none; font-weight: 700; font-size: 15px; padding: 4px 0; }
.tp-list { overflow: auto; display: flex; flex-direction: column; gap: 1px; margin: 0 -6px; padding: 0 6px; min-height: 0; }
.tp-item { display: flex; justify-content: space-between; align-items: center; border: 0; background: none; text-align: left; padding: 8px 12px; border-radius: 7px; font-size: 14.5px; color: var(--text); }
.tp-item:hover { background: var(--hover); }
.tp-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tp-more { color: var(--muted); }
.tp-badge { font-size: 10px; font-weight: 800; background: var(--hover); padding: 2px 6px; border-radius: 4px; color: var(--muted); }
.tp-group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 10px 12px 4px; }
.tp-use { margin-top: 12px; justify-content: center; padding: 11px; background: #f2622e; border-color: #f2622e; color: #fff; font-weight: 700; }
.tp-use:hover:not(:disabled) { background: #e2541f !important; }
.tp-keep { justify-content: center; margin: 10px 0 0; }

/* ---------- comment cards (on the board) ---------- */
:root { --cm-bg: #e7eef9; --cm-text: #1f2a3a; --cm-muted: #66748a; --cm-link: #2f6df6; --cm-input: #ffffff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --cm-bg: #2b3546; --cm-text: #e9edf4; --cm-muted: #8e9bb0; --cm-link: #7fa8ff; --cm-input: #222a37; } }
:root[data-theme="dark"] { --cm-bg: #2b3546; --cm-text: #e9edf4; --cm-muted: #8e9bb0; --cm-link: #7fa8ff; --cm-input: #222a37; }
.card-comment { --card-bg: var(--cm-bg); color: var(--cm-text); padding: 12px 14px 10px; border-radius: 2px; border-top: 4px solid var(--cm-line, #6cc644); }
.cm-list { display: flex; flex-direction: column; gap: 10px; }
.cm-head { display: flex; align-items: center; gap: 6px; font-size: 11.5px; }
.cm-av { width: 18px; height: 18px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: #fff; background: linear-gradient(135deg, #e8668b, #8b6cf0); }
.cm-name { font-weight: 700; }
.cm-time { color: var(--cm-muted); }
.cm-del { margin-left: auto; border: 0; background: none; color: var(--cm-muted); font-size: 14px; line-height: 1; padding: 0 2px; opacity: 0; }
.cm:hover .cm-del { opacity: 1; }
.cm-del:hover { color: var(--danger); }
.cm-text { font-size: 12.5px; line-height: 1.45; margin: 3px 0 0 24px; white-space: pre-wrap; overflow-wrap: anywhere; }
.cm-reply { border: 0; background: none; color: var(--cm-link); font-size: 11.5px; font-weight: 600; padding: 8px 0 0 24px; }
.cm-reply:hover { text-decoration: underline; }
.cm-empty { color: var(--cm-muted); font-size: 12px; font-style: italic; }
.cm-input { width: 100%; margin-top: 10px; border: 1px solid rgba(127, 140, 160, 0.35); border-radius: 6px; background: var(--cm-input); color: var(--cm-text); font: inherit; font-size: 12.5px; padding: 7px 9px; resize: vertical; outline: none; }
.cm-input:focus { border-color: var(--cm-link); }
.cm-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.cm-hint { font-size: 10.5px; color: var(--cm-muted); }
.cm-post { border: 0; border-radius: 5px; background: var(--cm-link); color: #fff; font-size: 12px; font-weight: 600; padding: 4px 12px; }

/* ---------- Unsorted ---------- */
#unsorted-btn { position: absolute; top: 14px; right: 16px; z-index: 40; padding: 6px 11px; border-radius: 6px; border: 1px solid var(--border); background: var(--panel); color: var(--muted); font-size: 12.5px; box-shadow: var(--shadow); }
#unsorted-btn b { color: var(--text); }
#unsorted-btn:hover { color: var(--text); border-color: var(--muted); }
#unsorted-btn[hidden] { display: none; }
#sidepanel[data-kind="unsorted"] { width: 380px; background: var(--panel-2); }
.unsorted { position: relative; }
.us-head { display: flex; align-items: center; justify-content: center; position: relative; padding: 18px 16px 14px; border-bottom: 1px solid var(--border); }
.us-head h3 { margin: 0; font-size: 18px; font-weight: 600; color: var(--muted); }
.us-close { position: absolute; right: 16px; border: 0; background: none; color: var(--muted); font-size: 13px; }
.us-close:hover { color: var(--text); }
.us-tools { display: flex; gap: 6px; padding: 12px 20px 4px; }
.us-quick { padding: 7px 10px; font-size: 13px; }
.us-upload { padding: 6px 10px; }
.us-list { flex: 1; overflow: auto; padding: 12px 18px 40px; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 8px; position: relative; }
.us-item { position: relative; cursor: grab; width: 100%; }
.us-item[data-size="m"] { width: calc(50% - 4px); }
.us-item[data-size="s"] { width: calc(33.333% - 5.34px); }
.us-item[data-size="s"] .card { font-size: 11px; }
.us-item[data-size="s"] .rich h1, .us-item[data-size="s"] .rich h2 { font-size: 1.1em; }
.us-item .card-image .img-caption { font-size: 11px; padding: 5px 8px; }
.us-item.drop-before::before { content: ''; position: absolute; left: -6px; top: 0; bottom: 0; width: 4px; border-radius: 2px; background: var(--accent); z-index: 3; }
.us-item[data-size="l"].drop-before::before { left: 0; right: 0; top: -6px; bottom: auto; width: auto; height: 4px; }
.us-list.drop-end::after { content: ''; width: 100%; height: 4px; border-radius: 2px; background: var(--accent); }
.us-tools-hover { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity 0.15s; z-index: 2; }
.us-item:hover .us-tools-hover { opacity: 1; }
.us-item.us-lifted .us-tools-hover { display: none; }
.us-btn { min-width: 24px; height: 24px; border-radius: 12px; border: 0; background: rgba(0, 0, 0, 0.65); color: #fff; font-size: 12px; font-weight: 700; line-height: 1; padding: 0 7px; }
.us-btn:hover { background: rgba(0, 0, 0, 0.85); }
.us-item:active { cursor: grabbing; }
.us-item > .card { position: relative !important; left: auto !important; top: auto !important; width: auto !important; z-index: auto !important; }
.us-item .card-image, .us-item .card-image .img-wrap img { border-radius: 2px; }
.us-item:hover > .card { box-shadow: var(--shadow), 0 0 0 2px var(--accent); }
.us-del { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 15px; line-height: 1; opacity: 0; transition: opacity 0.15s; z-index: 2; }
.us-item:hover .us-del { opacity: 1; }
.us-empty { padding: 40px 30px; text-align: center; color: var(--muted); line-height: 1.5; font-size: 13px; }
.us-empty b { color: var(--text); font-size: 15px; }
.us-empty-icon { font-size: 34px; margin-bottom: 8px; }
.unsorted.drop-hover::after { content: 'Drop to save in Unsorted'; position: absolute; inset: 8px; border: 3px dashed var(--accent); border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-weight: 700; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.us-ghost { position: fixed !important; z-index: 3000; pointer-events: none; transform-origin: 0 0; opacity: 0.85; box-shadow: var(--shadow-lg) !important; transition: opacity 0.1s; }
.us-ghost.over-board { opacity: 1; }
.us-item, .us-item * { -webkit-user-select: none; user-select: none; -webkit-user-drag: none; }
.unsorted, .unsorted * { -webkit-user-select: none; user-select: none; }
.unsorted input { -webkit-user-select: text; user-select: text; }
#topbar, #toolbar, #zoombar, #unsorted-btn, #selbar { -webkit-user-select: none; user-select: none; }
.us-item { touch-action: none; }
.us-item.us-lifted > .card { opacity: 0.25; box-shadow: none; }
.us-item.us-lifted .us-del { display: none; }
body.us-dragging, body.us-dragging * { cursor: grabbing !important; -webkit-user-select: none; user-select: none; }
#unsorted-btn.drop-hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); transform: scale(1.06); }

/* ---------- drawing on the board ---------- */
.card-drawing, .card-drawing:hover { --card-bg: transparent; background: transparent; box-shadow: none !important; border-radius: 0; }
.card-drawing.selected { outline: 1px dashed var(--accent); outline-offset: 4px; }
.card-drawing { pointer-events: none; } /* picked by its ink, not its box — see drawingsAt() */
.card-drawing.ink-hover, .card-drawing.ask-hover { filter: drop-shadow(0 0 3px var(--accent)) drop-shadow(0 0 1px var(--accent)); }
#viewport.over-ink:not(.draw-mode) { cursor: pointer; }
.which { padding: 10px; width: 250px; }
.which-title { font-weight: 700; font-size: 14px; }
.which-sub { font-size: 12px; color: var(--muted); margin: 2px 0 8px; line-height: 1.4; }
.which-row { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 6px; border-radius: 7px; color: var(--text); text-align: left; }
.which-row:hover { background: var(--accent-soft); }
.which-prev { width: 56px; height: 40px; flex: none; border-radius: 5px; background: var(--canvas); border: 1px solid var(--border); padding: 4px; box-sizing: border-box; }
.which-prev svg { width: 100%; height: 100%; display: block; }
.which-cancel { justify-content: center; color: var(--muted); margin-top: 4px; }
.card-drawing > .resize-handle, .card-drawing > .lock-badge { display: none !important; }
.card-drawing > .resize-handle { width: 10px; height: 10px; border-radius: 50%; }
.card-drawing > .connect-handle { display: none !important; }
.drawing-wrap, .drawing-wrap svg { display: block; width: 100%; height: 100%; overflow: visible; }
#drawtemp { position: absolute; left: -50000px; top: -50000px; width: 100000px; height: 100000px; pointer-events: none; overflow: visible; z-index: 3; }
#viewport.draw-mode, #viewport.draw-mode * { cursor: crosshair !important; }
#viewport.draw-mode #drawbar, #viewport.draw-mode #drawbar * { cursor: pointer !important; }
#drawbar { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 46; display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); }
#drawbar[hidden] { display: none; }
.db-label { font-weight: 700; font-size: 13px; padding: 0 6px; }
.db-color { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(127, 127, 127, 0.4); padding: 0; }
.db-color.active { outline: 2px solid var(--accent); outline-offset: 2px; }
.db-custom { background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.db-size { width: 28px; height: 28px; border-radius: 6px; border: 0; background: none; display: flex; align-items: center; justify-content: center; }
.db-size span { border-radius: 50%; display: block; border: 1px solid rgba(127, 127, 127, 0.5); }
.db-size.active, .db-btn.active { background: var(--accent-soft); color: var(--accent); }
.db-sep { width: 1px; height: 20px; background: var(--border); }
.db-btn { border: 0; background: none; padding: 5px 9px; border-radius: 6px; font-size: 13px; color: var(--text); }
.db-btn:hover { background: var(--hover); }
.db-done { background: var(--accent); color: #fff; font-weight: 600; }
.db-done:hover { background: var(--accent); filter: brightness(1.1); }

/* ---------- columns: write inside ---------- */
.col-add { display: block; width: 100%; border: 0; background: none; color: var(--muted); font-size: 12.5px; text-align: left; padding: 2px 6px 8px; opacity: 0; transition: opacity 0.15s; }
.card-column:hover > .col-add, .card-column.selected > .col-add { opacity: 1; }
.col-add:hover { color: var(--accent); }
.card-column.collapsed > .col-add { display: none; }

/* ---------- captions, lock, connect dots ---------- */
.add-caption { color: var(--muted); font-style: italic; cursor: text; display: none; }
.card-image.selected .add-caption { display: block; }
.add-caption:hover { color: var(--accent); }
.lock-badge { position: absolute; top: -9px; left: -9px; font-size: 11px; background: var(--panel); border: 1px solid var(--border); border-radius: 50%; width: 20px; height: 20px; display: none; align-items: center; justify-content: center; z-index: 3; }
.card.locked:hover > .lock-badge, .card.locked.selected > .lock-badge { display: flex; }
.card.locked > .resize-handle { display: none !important; }
.card:not(.selected):not(.editing):not(.dragging):hover > .connect-handle { display: block; opacity: 0.55; }
.card:not(.selected):hover > .connect-handle:hover { opacity: 1; }
.sb-btn.on { color: var(--accent); background: var(--accent-soft); }
.fmt-tc { font-weight: 800; background: linear-gradient(90deg, #e5484d, #f5c400, #30a46c, #0090ff, #8e4ec6); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- document editor (Milanote-style) ---------- */
.doc-overlay { padding: 2vh 16px; background: rgba(0, 0, 0, 0.55); }
.doc-modal { width: min(860px, 100%); height: 96vh; display: flex; flex-direction: column; background: var(--panel); border-radius: 6px; box-shadow: var(--shadow-lg); overflow: hidden; }
.doc-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.doc-head-title { flex: 1; display: flex; justify-content: center; }
.doc-head .doc-title-input { text-align: center; font-size: 17px; font-weight: 700; margin: 0; max-width: 520px; }
.doc-export { border: 0; background: none; color: var(--text); font-weight: 600; font-size: 13.5px; padding: 6px 8px; border-radius: 6px; }
.doc-export:hover { background: var(--hover); }
.doc-main { flex: 1; display: flex; min-height: 0; }
.doc-tools { width: 84px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 0; overflow-y: auto; }
.dt-btn { width: 40px; min-height: 36px; border: 0; background: none; color: var(--text); border-radius: 7px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 15px; }
.dt-btn:hover { background: var(--hover); }
.dt-btn.big { width: 70px; padding: 4px 0 6px; }
.dt-btn.big .dt-ic, .dt-btn.big > .ic { width: 30px; height: 30px; border-radius: 6px; background: var(--hover); display: flex; align-items: center; justify-content: center; padding: 6px; box-sizing: border-box; }
.dt-t { font-family: Georgia, serif; font-weight: 800; font-size: 17px; }
.dt-label { font-size: 11px; color: var(--muted); }
.doc-main .doc-scroll { flex: 1; overflow: auto; padding: 20px 56px 80px 12px; }
.doc-main .doc-body { min-height: 100%; font-size: 15.5px; line-height: 1.7; }
.doc-body img { max-width: 100%; border-radius: 4px; display: block; margin: 8px 0; }
.doc-body table, .rich table { border-collapse: collapse; width: 100%; margin: 8px 0; }
.doc-body td, .doc-body th, .rich td, .rich th { border: 1px solid var(--border); padding: 6px 10px; min-width: 40px; }
.rich img { max-width: 100%; }
.menu-title { font-weight: 700; font-size: 15px; padding: 10px 12px 4px; }
.ex-ic { width: 14px; height: 16px; border-radius: 2px; border: 1.5px solid var(--muted); display: inline-block; }
.ex-pdf { border-color: #e5484d; background: rgba(229, 72, 77, 0.2); }
.ex-word { border-color: #2f6df6; background: rgba(47, 109, 246, 0.2); }

/* ---------- ••• more tools ---------- */
.tool-more { padding: 4px 0; }
.tool-sep { width: 36px; height: 1px; background: var(--border); margin: 6px 0; flex: none; }
.more-grid { display: grid; grid-template-columns: repeat(2, 84px); gap: 6px; padding: 10px; }
.more-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border: 0; background: none; border-radius: 8px; color: var(--text); font-size: 12.5px; }
.more-tile:hover { background: var(--hover); }
.more-ic { width: 40px; height: 40px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: var(--hover); }
.more-t { font-family: Georgia, serif; font-weight: 800; font-size: 20px; }

/* ---------- map card ---------- */
.card-map { overflow: hidden; }
.map-head { display: flex; align-items: center; gap: 6px; padding: 8px 10px; font-weight: 600; font-size: 13px; cursor: grab; }
.map-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-frame iframe { display: block; width: 100%; height: 230px; border: 0; background: var(--hover); }
.card-map:not(.selected) .map-frame iframe { pointer-events: none; }
.map-foot { display: flex; justify-content: space-between; padding: 6px 10px 8px; font-size: 11.5px; }
.map-foot a { color: var(--muted); text-decoration: none; }
.map-foot a:hover { color: var(--accent); }

/* ---------- audio recorder ---------- */
.rec { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 10px 0; }
.rec-dot { width: 22px; height: 22px; border-radius: 50%; background: #e5484d; animation: recpulse 1.2s infinite; }
@keyframes recpulse { 50% { opacity: 0.35; transform: scale(0.85); } }
.rec-time { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.fmt-card-colour { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- accounts & sharing ---------- */
.avatar-btn { border: 0; background: none; padding: 0 0 0 4px; display: flex; align-items: center; }
.avatar-btn .avatar { width: 30px; height: 30px; font-size: 13px; }
.avatar-btn:hover .avatar { box-shadow: 0 0 0 3px var(--accent-soft); }
.avatar.big { width: 38px; height: 38px; font-size: 16px; flex: none; }
.menu-user { display: flex; align-items: center; gap: 10px; padding: 8px 9px; }
.chip.tiny { font-size: 10.5px; padding: 1px 7px; margin-left: 6px; }
.shared-chip { white-space: nowrap; }
.share-label { display: block; font-weight: 600; font-size: 13px; margin: 2px 0 8px; }
.share-sep { height: 1px; background: var(--border); margin: 16px 0; }
.people { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.person { display: flex; align-items: center; gap: 10px; padding: 5px 2px; }
.person .avatar { flex: none; }
.person-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.input.select { width: auto; padding: 6px 8px; resize: none; }
.share-add { display: flex; gap: 6px; margin: 8px 0; }
.share-add select:first-child { flex: 1; min-width: 0; }
.picker-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 12px 12px 4px; }
.form { display: flex; flex-direction: column; gap: 10px; }
.form[hidden], .form label[hidden] { display: none; }
.form label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 13px; }
.form-error { color: var(--danger); font-size: 13px; min-height: 1em; }
.form-error:empty { display: none; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 6px 0; cursor: pointer; }
.admin-add { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-bottom: 4px; }
.admin .person .btn-small { white-space: nowrap; }

.auth-page { overflow: auto; display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; background-color: var(--canvas); background-image: radial-gradient(circle, var(--dot) 1.1px, transparent 1.3px); background-size: 24px 24px; }
.auth-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 28px 28px 24px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; margin-bottom: 18px; }
.auth-card h1 { font-size: 21px; margin: 0 0 6px; }
.auth-card p.muted { margin: 0 0 16px; line-height: 1.5; font-size: 13.5px; }
.auth-submit { justify-content: center; padding: 10px; margin-top: 4px; }
.auth-switch { text-align: center; font-size: 13px; color: var(--muted); margin: 16px 0 0; }
.auth-switch a { color: var(--accent); }

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  #app { grid-template-columns: 0 1fr 0; grid-template-rows: 50px 1fr 64px; }
  #toolbar {
    grid-row: 3; grid-column: 1 / 4; flex-direction: row; justify-content: flex-start; overflow-x: auto; overflow-y: hidden;
    padding: 4px 6px; border-right: 0; border-top: 1px solid var(--border);
  }
  .tool { width: 54px; }
  .tool-spacer { display: none; }
  #viewport { grid-column: 1 / 4; }
  .readonly #app { grid-template-rows: 50px 1fr 0; }
  .brand span, .search-btn span, .search-btn kbd, .share-btn span, #sync, #btn-theme { display: none; }
  .search-btn { padding: 6px 8px; margin: 0; }
  #crumbs { margin-left: 2px; }
  .crumb { max-width: 120px; }
  #sidepanel { position: fixed; right: 0; top: 50px; bottom: 64px; width: min(340px, 100vw); box-shadow: var(--shadow-lg); }
  .shortcuts { grid-template-columns: 1fr; }
  .admin-add { grid-template-columns: 1fr; }
  .admin .person { flex-wrap: wrap; }
  .shared-chip { display: none; }
  .doc-paper { padding: 28px 22px; }
}

/* ---------- print ---------- */
@media print {
  #topbar, #toolbar, #zoombar, #selbar, #sidepanel, .toasts, #empty, .resize-handle, .connect-handle { display: none !important; }
  #app { display: block; height: auto; }
  #viewport { position: fixed; inset: 0; background: #fff !important; }
  .card { box-shadow: 0 0 0 1px #ddd !important; break-inside: avoid; }
}
