:root {
  --bg: #f2f3f5;
  --dot: #cfd2d8;
  --panel: #ffffff;
  --line: #e8e9ec;
  --text: #1f2329;
  --muted: #6b7280;
  --accent: #4262ff;
  --accent-dark: #2f4be0;
  --accent-soft: #eef1ff;
  --danger: #e5484d;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 8px 24px rgba(16, 24, 40, .10);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--bg);
  font-family: var(--font); color: var(--text);
  -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none;
}
button { font-family: inherit; }
input, textarea { font-family: inherit; color: var(--text); }
.hidden { display: none !important; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.flip { transform: scaleX(-1); }

/* ================= Холст ================= */
#viewport {
  position: fixed; inset: 0; overflow: hidden; overflow: clip; touch-action: none; /* clip: браузер не может прокрутить доску сам (например, к курсору ввода) */
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 1.2px, transparent 1.3px);
  background-size: 24px 24px;
}
body.dark-board #viewport { background-image: radial-gradient(#4a4d55 1.2px, transparent 1.3px); }
#viewport[data-grid="lines"] { background-image: linear-gradient(to right, #e1e3e8 1px, transparent 1px), linear-gradient(to bottom, #e1e3e8 1px, transparent 1px); }
body.dark-board #viewport[data-grid="lines"] { background-image: linear-gradient(to right, #3a3d44 1px, transparent 1px), linear-gradient(to bottom, #3a3d44 1px, transparent 1px); }
#viewport[data-grid="none"], body.dark-board #viewport[data-grid="none"] { background-image: none; }
#viewport[data-tool="hand"] { cursor: grab; }
/* щит на время перетаскивания: только курсор «рука» (правило на всех потомков пересчитывало стили всей доски) */
#panShield { position: absolute; inset: 0; z-index: 2147483000; display: none; }
#panShield.grab { display: block; cursor: grab; }
#panShield.grabbing { display: block; cursor: grabbing; }
#viewport[data-tool="note"], #viewport[data-tool="text"], #viewport[data-tool="shape"], #viewport[data-tool="frame"],
#viewport[data-tool="connector"], #viewport[data-tool="pen"], #viewport[data-tool="highlighter"],
#viewport[data-tool="comment"], #viewport[data-tool="emoji"] { cursor: crosshair; }
#viewport[data-tool="eraser"] { cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24'><circle cx='12' cy='12' r='9' fill='white' fill-opacity='.6' stroke='%23e5484d' stroke-width='2'/></svg>") 12 12, crosshair; }
#viewport:not([data-tool="select"]) .item, #viewport:not([data-tool="select"]) .hit { cursor: inherit; }

#world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
#framesLayer, #itemsLayer, #guides, #overlay, #editors { position: absolute; left: 0; top: 0; }
#guides, #overlay { pointer-events: none; }
#svgLayer { position: absolute; left: -50000px; top: -50000px; width: 100000px; height: 100000px; overflow: visible; pointer-events: none; }
.hit { pointer-events: stroke; }
.clabel { font: 500 14px var(--font); fill: #1f2329; paint-order: stroke; stroke: #fff; stroke-width: 5px; stroke-linejoin: round; pointer-events: none; }

/* ================= Объекты ================= */
.item { position: absolute; left: 0; top: 0; transform-origin: 50% 50%; }
.txtwrap { width: 100%; height: 100%; display: flex; align-items: center; }
.txt {
  width: 100%; max-height: 100%; outline: none; white-space: pre-wrap; overflow-wrap: anywhere;
  line-height: 1.3; font-size: 16px;
}
[contenteditable="true"], [contenteditable="plaintext-only"] { user-select: text; -webkit-user-select: text; cursor: text; }

/* стикер как листок бумаги: тень сильнее у нижнего края */
.item.note { box-shadow: 0 1px 2px rgba(0, 0, 0, .07), 0 3px 6px rgba(0, 0, 0, .05), 0 14px 16px -10px rgba(0, 0, 0, .28); border-radius: 2px; }
.item.note .author {
  position: absolute; left: 8px; bottom: 5px; max-width: calc(100% - 16px); font: 500 11px var(--font); color: rgba(0, 0, 0, .45);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: opacity .15s; pointer-events: none;
}
.item.note:hover .author { opacity: 1; }
.item.note.editing .author { opacity: 0; }
.item.note .txtwrap { overflow: hidden; }

.item.text .txtwrap { display: block; height: auto; }
.item.text .txt { padding: 4px 6px; min-height: 1.3em; max-height: none; }
.item.text.editing { outline: 1px dashed rgba(66, 98, 255, .45); }
.item.text.auto { max-width: 720px; }
.item.text.auto .txt { min-width: 40px; }

.item.shape .shape-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.item.shape .txtwrap { position: absolute; inset: 8px 12px; width: auto; height: auto; overflow: hidden; }

.item.image { background: #eceef1; border-radius: 2px; } /* пока картинка не загружена */
.item.image img { width: 100%; height: 100%; display: block; object-fit: fill; pointer-events: none; border-radius: 2px; }
.item.image img:not([src]) { visibility: hidden; }
.item.emoji .emoji-char { width: 100%; height: 100%; display: grid; place-items: center; line-height: 1; }

.item.frame { pointer-events: none; box-shadow: 0 0 0 1px #d6d8de, 0 1px 4px rgba(0, 0, 0, .04); }
.frame-title {
  position: absolute; left: 0; bottom: 100%; transform-origin: 0 100%;
  padding: 0 4px 6px 0; font-size: 14px; font-weight: 600; color: #5f6169;
  white-space: nowrap; pointer-events: auto; cursor: pointer; max-width: 600px; overflow: hidden; text-overflow: ellipsis;
}
.frame-title:hover { color: var(--accent); }
.frame-title.hidden-edit { visibility: hidden; }

.vote-badge {
  position: absolute; top: -11px; right: -11px; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 13px;
  background: #1f2329; color: #fff; font: 700 13px var(--font); display: grid; place-items: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .2); pointer-events: none; z-index: 2;
}
.vote-badge.mine { background: var(--accent); font-size: 10px; letter-spacing: 1px; }

/* ================= Выделение ================= */
.sel-box { position: absolute; border: 1.5px solid var(--accent); pointer-events: none; }
.sel-box.multi { border-style: solid; }
.sel-sub { position: absolute; border: 1px solid rgba(66, 98, 255, .45); pointer-events: none; }
.handle {
  position: absolute; width: 10px; height: 10px; background: #fff; border: 1.5px solid var(--accent);
  border-radius: 3px; pointer-events: auto; z-index: 2;
}
.handle.nw, .handle.se { cursor: nwse-resize; }
.handle.ne, .handle.sw { cursor: nesw-resize; }
.handle.n, .handle.s { cursor: ns-resize; }
.handle.e, .handle.w { cursor: ew-resize; }
.handle.rot { border-radius: 50%; cursor: grab; }
.handle.rot::after { content: ""; position: absolute; left: 50%; top: 100%; width: 1px; height: 14px; background: var(--accent); }
.handle.endpoint { width: 12px; height: 12px; border-radius: 50%; cursor: move; border-width: 2px; }
.handle.plus {
  width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; border: 2px solid #fff;
  display: grid; place-items: center; cursor: pointer; opacity: .55; transition: opacity .12s, transform .12s;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
}
.handle.plus:hover { opacity: 1; }
.handle.plus .ic { width: 14px; height: 14px; stroke-width: 2.6; }
.lock-badge {
  position: absolute; right: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; background: #fff;
  display: grid; place-items: center; color: var(--muted); box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
}
.lock-badge .ic { width: 14px; height: 14px; }
.target-box { position: absolute; border: 2px dashed var(--accent); border-radius: 4px; pointer-events: none; }
.side-dot { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); }
.side-dot.on { background: var(--accent); width: 14px; height: 14px; }
.guide { position: absolute; background: #f1365f; }
.hover-box { position: absolute; border: 1.5px solid var(--accent); border-radius: 2px; pointer-events: none; opacity: .75; }
.handle.link-dot {
  width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid var(--accent);
  cursor: crosshair; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: background .1s;
}
.handle.link-dot:hover { background: var(--accent); }
.remote-sel { position: absolute; border: 2px solid; border-radius: 2px; pointer-events: none; }
.remote-tag {
  position: absolute; left: -2px; bottom: 100%; transform-origin: 0 100%; padding: 1px 7px; border-radius: 4px 4px 4px 0;
  color: #fff; font: 600 11px var(--font); white-space: nowrap;
}
.size-label.quiet { background: #1f2329; opacity: .85; }
.size-label {
  position: absolute; padding: 2px 8px; border-radius: 6px; background: var(--accent); color: #fff;
  font: 600 12px var(--font); white-space: nowrap; transform-origin: 50% 0; pointer-events: none; font-variant-numeric: tabular-nums;
}
.drop-frame { position: absolute; border: 2px solid var(--accent); background: rgba(66, 98, 255, .04); border-radius: 2px; pointer-events: none; }

.inline-editor {
  position: absolute; min-width: 60px; padding: 4px 8px; background: #fff; border: 2px solid var(--accent);
  border-radius: 6px; font: 500 14px var(--font); white-space: pre; outline: none; pointer-events: auto;
}
.inline-editor.ftitle { font-weight: 600; transform-origin: 50% 50%; }

#marquee { position: absolute; border: 1px solid var(--accent); background: rgba(66, 98, 255, .08); pointer-events: none; z-index: 20; }

/* ================= Комментарии и курсоры ================= */
#pins { position: absolute; inset: 0; pointer-events: none; z-index: 30; }
.pin {
  position: absolute; left: 0; top: 0; width: 32px; height: 32px; margin-top: -34px;
  border-radius: 16px 16px 16px 4px; border: 2px solid #fff; color: #fff; pointer-events: auto; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font: 700 13px var(--font);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
.pin.resolved { opacity: .5; }
.pin-n:not(:empty) {
  position: absolute; top: -8px; right: -8px; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 4px;
  background: #1f2329; color: #fff; font-size: 11px; display: grid; place-items: center; border: 2px solid #fff;
}
#cursors { position: absolute; inset: 0; pointer-events: none; z-index: 35; overflow: hidden; }
.cursor { position: absolute; left: 0; top: 0; transition: transform .12s linear; }
.cursor-arrow { width: 22px; height: 22px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .3)); }
.cursor .tag {
  position: absolute; left: 16px; top: 18px; padding: 2px 8px; border-radius: 10px; color: #fff;
  font: 600 12px var(--font); white-space: nowrap; transition: opacity .3s;
}
.cursor .bubble {
  position: absolute; left: 16px; top: 42px; max-width: 260px; padding: 7px 11px; border-radius: 4px 14px 14px 14px;
  color: #fff; font: 500 14px var(--font); white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
}
.cursor.idle .tag { opacity: 0; }
#followFrame { position: absolute; inset: 0; border: 4px solid var(--accent); pointer-events: none; z-index: 40; }
#followLabel { position: absolute; top: 0; left: 50%; transform: translateX(-50%); color: #fff; padding: 5px 14px; border-radius: 0 0 10px 10px; font: 600 13px var(--font); }

/* ================= Панели ================= */
.panel { background: var(--panel); border-radius: 12px; box-shadow: var(--shadow); }
#topLeft, #topRight { position: fixed; top: 12px; height: 48px; display: flex; align-items: center; gap: 2px; padding: 0 6px; z-index: 50; }
#topLeft { left: 12px; }
#topRight { right: 12px; }
.logo {
  width: 30px; height: 30px; border-radius: 8px; margin: 0 6px 0 2px; color: #fff; font-weight: 800;
  display: grid; place-items: center; background: linear-gradient(135deg, #4262ff, #8b5cf6);
}
.board-icon {
  width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; display: grid; place-items: center;
  cursor: pointer; padding: 0; font-size: 20px; line-height: 1; color: #8a9099; flex: none;
}
.board-icon:hover { background: #f2f3f5; }
.board-icon .bi-emoji { font-family: "Segoe UI Emoji", "Apple Color Emoji", sans-serif; }
body.viewer .board-icon { cursor: default; }
body.viewer .board-icon.empty { display: none; }
.popover.icon-pop { width: 252px; }
.board-title {
  font-weight: 600; font-size: 15px; padding: 6px 8px; border-radius: 6px; max-width: 280px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: text; outline: none;
}
.board-title:hover { background: #f2f3f5; }
.board-title[contenteditable="true"], .board-title[contenteditable="plaintext-only"] { background: #fff; box-shadow: 0 0 0 2px var(--accent); text-overflow: clip; }
.tb-sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; flex: none; }
.tbtn {
  position: relative; height: 36px; min-width: 36px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: #2b2f36;
  font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.tbtn:hover { background: #f2f3f5; }
.tbtn:disabled { opacity: .35; cursor: default; background: transparent; }
.font-face { font-weight: 600; font-size: 15px; }
.tbtn.on { background: var(--accent-soft); color: var(--accent); }
.tbtn.primary { background: var(--accent); color: #fff; padding: 0 14px 0 11px; margin-left: 4px; }
.tbtn.primary .ic { width: 18px; height: 18px; }
.present-btn { background: #f2f3f5; margin-left: 4px; }
.present-btn .ic { width: 18px; height: 18px; fill: currentColor; }
.tbtn.primary:hover { background: var(--accent-dark); }
.vbadge {
  position: absolute; top: 1px; right: 1px; min-width: 16px; height: 16px; border-radius: 8px; padding: 0 4px;
  background: var(--accent); color: #fff; font-size: 10.5px; display: grid; place-items: center;
}
#presence { display: flex; align-items: center; padding: 0 6px; cursor: pointer; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; color: #fff; display: grid; place-items: center; flex: none;
  font-weight: 700; font-size: 13px; border: 2px solid #fff; margin-left: -8px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .06);
}
#presence .avatar:first-child { margin-left: 0; }
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.logo { cursor: pointer; }
.blocked { position: fixed; inset: 0; z-index: 200; background: rgba(242, 243, 245, .92); display: grid; place-items: center; padding: 16px; }
.blocked-card { background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 28px; width: min(420px, 100%); text-align: center; }
.blocked-card h2 { margin: 0 0 8px; font-size: 20px; }
.blocked-card p { color: var(--muted); margin: 0 0 16px; line-height: 1.5; }
.blocked-card .cb { text-decoration: none; }
.share-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 14px; }
.pinput.sel { width: auto; min-width: 170px; padding: 6px 8px; cursor: pointer; }
.share-people { margin-top: 12px; }
.share-people .pinput.sel { min-width: 120px; }
a.cb { text-decoration: none; }
.avatar.following { box-shadow: 0 0 0 2px var(--accent); }
.avatar.more { background: #e8e9ec; color: #2b2f36; }
.avatar.sm { width: 26px; height: 26px; margin: 0; font-size: 12px; }
.viewer-badge { font-size: 12px; font-weight: 600; color: var(--muted); background: #f2f3f5; padding: 5px 9px; border-radius: 6px; margin-right: 4px; }
.conn { width: 8px; height: 8px; border-radius: 50%; margin: 0 6px 0 8px; flex: none; }
.conn.online { background: #22a06b; box-shadow: 0 0 0 3px rgba(34, 160, 107, .18); }
.conn.offline { background: #e8a200; box-shadow: 0 0 0 3px rgba(232, 162, 0, .2); }
.timer-chip {
  height: 32px; padding: 0 12px; margin-right: 4px; border: 0; border-radius: 16px; background: #1f2329; color: #fff;
  font: 700 14px ui-monospace, "Cascadia Mono", Consolas, monospace; cursor: pointer;
}
.timer-chip.soon { background: #e8a200; }
.vote-chip { background: var(--accent); font-family: inherit; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.vote-chip .ic { width: 16px; height: 16px; }
.timer-chip.done { background: var(--danger); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }

#leftRail { position: fixed; left: 12px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 50; max-height: calc(100vh - 150px); }
#toolbar, #undoBar { display: flex; flex-direction: column; gap: 2px; padding: 6px; }
#toolbar { overflow-y: auto; scrollbar-width: none; min-height: 0; }
#toolbar::-webkit-scrollbar { display: none; }
#toolbar .tool { flex: none; }
#undoBar .tool { height: 40px; }
#undoBar .tool:disabled { opacity: .35; cursor: default; background: transparent; }
.tool.more-tools { color: #5f6169; position: sticky; bottom: 0; background: #fff; }
.tool.more-tools:hover { background: #f2f3f5; }
/* невысокие экраны: кнопки компактнее, чтобы «+» и «отменить» помещались */
@media (max-height: 860px) { #toolbar .tool, #undoBar .tool { width: 40px; height: 38px; } #toolbar .tool .ic { width: 22px; height: 22px; } #leftRail { max-height: calc(100vh - 130px); } }
@media (max-height: 640px) { #undoBar { display: none; } }
.tool.dragging { background: var(--accent-soft); box-shadow: 0 4px 14px rgba(16, 24, 40, .18); cursor: grabbing; z-index: 2; }
body.no-undo #undoBar { display: none; }
.tool {
  position: relative; width: 44px; height: 44px; border: 0; border-radius: 8px; background: transparent; color: #2b2f36;
  display: grid; place-items: center; cursor: pointer;
}
.tool .ic { width: 24px; height: 24px; }
.tool:hover { background: #f2f3f5; }
.tool.active { background: var(--accent-soft); color: var(--accent); }
.tool .caret { position: absolute; right: 4px; bottom: 4px; width: 0; height: 0; border-left: 4px solid transparent; border-top: 4px solid currentColor; opacity: .45; }
.tsep { height: 1px; background: var(--line); margin: 4px 6px; }
.popover.tools-pop { width: 290px; }
.tool-rows { display: flex; flex-direction: column; gap: 1px; max-height: min(460px, calc(100vh - 140px)); overflow: hidden auto; }
.tool-row { display: flex; align-items: center; gap: 4px; }
.tool-row .oitem { flex: 1; min-width: 0; }
.tool-row .cb.tpin { width: 32px; min-width: 32px; height: 32px; padding: 0; color: var(--muted); }
.tool-row .cb.tpin.on { color: var(--accent); background: transparent; }
.tool-row .cb.tpin .ic { width: 18px; height: 18px; }

/* статус доски, профиль */
.board-status { font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 10px; white-space: nowrap; flex: none; margin-right: 2px; }
.board-status.progress { background: #fff4d6; color: #9a6b00; }
.board-status.review { background: #e9f2fe; color: #2459c7; }
.board-status.done { background: #e4f6ea; color: #17804a; }
.prof-top { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.prof-btns { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.avatar.lg { width: 64px; height: 64px; font-size: 26px; margin: 0; border-width: 0; }
.modal .plabel { margin-top: 14px; }
.modal .cgrid { grid-template-columns: repeat(8, 28px); }
.modal .cgrid .sw { width: 28px; height: 28px; }
/* «Меньше анимации» */
body.reduce-motion *, body.reduce-motion *::after { transition: none !important; }
body.reduce-motion .flyer { animation: none; bottom: 90px; }
body.reduce-motion .timer-chip.done { animation: none; }

/* полосы прокрутки */
.scrollbar { position: fixed; z-index: 45; }
.scrollbar.h { left: 0; right: 14px; bottom: 2px; height: 10px; }
.scrollbar.v { top: 0; bottom: 14px; right: 2px; width: 10px; }
.scrollbar .thumb { position: absolute; left: 0; top: 0; border-radius: 5px; background: rgba(31, 35, 41, .22); transition: background .15s; }
.scrollbar.h .thumb { height: 6px; top: 2px; }
.scrollbar.v .thumb { width: 6px; left: 2px; }
.scrollbar:hover .thumb, .scrollbar.drag .thumb { background: rgba(31, 35, 41, .42); }
.scrollbar.h:hover .thumb, .scrollbar.h.drag .thumb { height: 8px; top: 1px; }
.scrollbar.v:hover .thumb, .scrollbar.v.drag .thumb { width: 8px; left: 1px; }
.scrollbar.idle, body.no-scrollbars .scrollbar { display: none; }
body.dark-board .scrollbar .thumb { background: rgba(255, 255, 255, .25); }
body.no-cursors #cursors { display: none; }
body.no-comments #pins { display: none; }

#bottomRight { position: fixed; right: 12px; bottom: 12px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; z-index: 50; }
#zoombar { display: flex; align-items: center; padding: 4px; height: 44px; }
.zoom-level { min-width: 56px; font-variant-numeric: tabular-nums; }
#minimap { width: 220px; height: 140px; cursor: pointer; }

/* ================= Контекстная панель ================= */
#context { position: fixed; z-index: 60; display: flex; align-items: center; gap: 2px; padding: 4px; height: 44px; }
.cb {
  height: 36px; min-width: 36px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: #2b2f36;
  font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.cb:hover { background: #f2f3f5; }
.cb.on { background: var(--accent-soft); color: var(--accent); }
.cb.fmt { font-size: 15px; width: 34px; padding: 0; }
.cb.fmt-bold { font-weight: 800; }
.cb.fmt-italic { font-style: italic; font-family: Georgia, serif; }
.cb.fmt-underline { text-decoration: underline; }
.cb.fmt-strike { text-decoration: line-through; }
.csep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; flex: none; }
.ctext { font-size: 13px; color: var(--muted); padding: 0 8px; }
.swface { width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); background: conic-gradient(#f24726, #fac710, #8fd14f, #12cdd4, #4262ff, #9510ac, #f24726); }
.swface.none, .sw.none { background: linear-gradient(to top right, #fff calc(50% - 1px), var(--danger) 50%, #fff calc(50% + 1px)); }
.letter-face { font-weight: 800; font-size: 16px; line-height: 1; border-bottom: 3px solid; padding: 0 2px 1px; }
.stroke-face { width: 18px; height: 18px; border-radius: 4px; border: 3px solid; }
.fs { min-width: 30px; font-variant-numeric: tabular-nums; }

/* ================= Всплывающие окна ================= */
.popover { position: fixed; z-index: 80; background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 10px; min-width: 180px; max-width: 340px; }
.popover.narrow { min-width: 140px; }
.popover.thread { width: 330px; }
.popover.people-pop { width: 290px; }
.popover.timer-pop, .popover.vote-pop { width: 300px; }
.plabel { font-size: 12px; color: var(--muted); font-weight: 600; margin: 6px 2px 6px; }
.plabel:first-child { margin-top: 0; }
.phint { font-size: 12.5px; color: var(--muted); line-height: 1.45; margin: 6px 2px; }
.cgrid { display: grid; grid-template-columns: repeat(8, 24px); gap: 6px; }
.cgrid.sticky { grid-template-columns: repeat(4, 34px); gap: 8px; }
.sw:not(.handle) { width: 24px; height: 24px; border-radius: 50%; border: 0; padding: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14); }
.cgrid.sticky .sw { width: 34px; height: 34px; border-radius: 4px; }
.sw.on { outline: 2px solid var(--accent); outline-offset: 2px; }
.olist { display: flex; flex-direction: column; gap: 2px; }
.olist.row { flex-direction: row; flex-wrap: wrap; gap: 6px; }
.olist.scroll { max-height: 320px; overflow: auto; }
.oitem {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 0; background: transparent; border-radius: 8px;
  font-size: 14px; font-weight: 500; color: #2b2f36; cursor: pointer; text-align: left; white-space: nowrap;
}
.oitem:hover { background: #f2f3f5; }
.oitem.on { background: var(--accent-soft); color: var(--accent); }
.oitem kbd { margin-left: auto; }
.olist.row .oitem, .olist.row .cb { border: 1px solid var(--line); padding: 5px 10px; height: auto; }
kbd { font: 500 11.5px ui-monospace, Consolas, monospace; color: var(--muted); background: #f2f3f5; border-radius: 5px; padding: 2px 6px; white-space: nowrap; }
.shape-grid { display: grid; grid-template-columns: repeat(5, 42px); gap: 4px; }
.shape-grid .cb { width: 42px; height: 42px; padding: 0; }
.shape-ic { width: 26px; height: 22px; }
.icon-grid { display: grid; grid-template-columns: repeat(4, 40px); gap: 4px; }
.icon-grid .cb { width: 40px; padding: 0; }
.emoji-grid { display: grid; grid-template-columns: repeat(5, 42px); gap: 4px; }
.em { width: 42px; height: 42px; border: 0; border-radius: 8px; background: transparent; font-size: 24px; cursor: pointer; }
.em:hover { background: #f2f3f5; }
.pinput { width: 100%; border: 1px solid #dfe1e6; border-radius: 8px; padding: 8px 10px; font-size: 14px; outline: none; user-select: text; -webkit-user-select: text; background: #fff; }
.pinput:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.pinput { resize: vertical; min-height: 60px; }
.pinput.num { width: 76px; }
.inline-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 14px; }
.inline-row .pinput:not(.num) { flex: 1; }
.cb.wide { width: 100%; margin-top: 8px; height: 38px; }
.cb.primary { background: var(--accent); color: #fff; }
.cb.primary:hover { background: var(--accent-dark); }
.cb.danger { color: var(--danger); }
.cb.danger-fill { background: var(--danger); color: #fff; }
.cb.small { height: 28px; font-size: 12.5px; padding: 0 10px; background: #f2f3f5; }
.cb.small:hover { background: var(--accent-soft); color: var(--accent); }
.people { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow: auto; }
.person { display: flex; align-items: center; gap: 8px; padding: 4px 2px; }
.pname { flex: 1; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer-big { font: 700 42px ui-monospace, Consolas, monospace; text-align: center; margin: 4px 0 10px; }
.thead { display: flex; align-items: center; gap: 2px; margin-bottom: 8px; }
.thead b { flex: 1; font-size: 14px; }
.msgs { max-height: 280px; overflow: auto; display: flex; flex-direction: column; gap: 12px; margin-bottom: 8px; }
.msgs:empty { display: none; }
.msg { display: flex; gap: 8px; }
.mbody { flex: 1; min-width: 0; }
.mmeta { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.mtext { font-size: 14px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; -webkit-user-select: text; }

.menu { position: fixed; z-index: 90; padding: 6px; min-width: 250px; }
.cmenu { position: fixed; z-index: 92; padding: 6px; min-width: 250px; max-width: 340px; border-radius: 14px; }
.citem {
  display: flex; width: 100%; align-items: center; gap: 12px; padding: 0 10px; height: 40px; border: 0; background: transparent;
  border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; color: #2b2f36; text-align: left; white-space: nowrap;
}
.citem .ic { width: 19px; height: 19px; color: #3d4350; }
.citem:hover, .citem.open { background: #f2f3f5; }
.citem .ctitle { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.citem kbd { background: transparent; padding: 0; font-size: 12.5px; }
.citem .chev { font-size: 20px; line-height: 1; color: #6b7280; margin-right: -2px; }
.citem.danger, .citem.danger .ic { color: var(--danger); }
.citem.disabled { opacity: .4; cursor: default; }
.citem.disabled:hover { background: transparent; }
.switch { width: 30px; height: 18px; border-radius: 9px; background: #c9ccd2; position: relative; flex: none; transition: background .15s; }
.switch::after { content: ""; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(12px); }
.radio { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #9aa0aa; flex: none; position: relative; }
.radio.on { border-color: var(--accent); }
.radio.on::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--accent); }
.cmenu-custom { padding: 6px 8px 8px; }
.details { display: flex; flex-direction: column; }
.drow { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid #f2f3f5; font-size: 14px; }
.drow span { color: var(--muted); }
.drow b { font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.popover.meet-pop { width: 284px; }
.react-row { display: flex; justify-content: space-between; margin-bottom: 4px; }
.react-row .em { width: 40px; height: 40px; font-size: 25px; transition: transform .12s; }
.react-row .em:hover { transform: scale(1.18); background: transparent; }
.mitem {
  display: flex; width: 100%; align-items: center; gap: 16px; padding: 7px 10px; border: 0; background: transparent;
  border-radius: 6px; font-size: 14px; font-weight: 500; cursor: pointer; color: #2b2f36; text-align: left;
}
.mitem:hover { background: #f2f3f5; }
.mitem kbd { margin-left: auto; }
.mitem.danger { color: var(--danger); }
.msep { height: 1px; background: #eceef1; margin: 4px 2px; }

/* ================= Модальные окна ================= */
.modal-back { position: fixed; inset: 0; background: rgba(16, 20, 30, .32); display: grid; place-items: center; z-index: 100; }
.modal { background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 20px 22px; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 64px); overflow: auto; }
.modal.wide { width: min(880px, calc(100vw - 32px)); }
.modal.small { width: min(420px, calc(100vw - 32px)); }
.modal.palette { width: min(560px, calc(100vw - 32px)); padding: 8px; align-self: start; margin-top: 12vh; }
.modal p { color: #3d4350; line-height: 1.5; margin: 0 0 8px; }
.mhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.mhead h2 { font-size: 18px; margin: 0; }
.mfoot { display: flex; gap: 8px; margin-top: 14px; }
.mfoot .cb.wide { margin-top: 0; }
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tcard {
  text-align: left; border: 1px solid #e3e5e9; border-radius: 12px; padding: 16px; background: #fafbfc; cursor: pointer;
  display: flex; flex-direction: column; gap: 6px; min-height: 96px;
}
.tcard:hover { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px var(--accent-soft); }
.tcard b { font-size: 15px; }
.tcard span { font-size: 13px; color: var(--muted); line-height: 1.4; }
.pal-input { width: 100%; border: 0; border-bottom: 1px solid #eceef1; padding: 12px; font-size: 16px; outline: none; user-select: text; }
.pal-list { padding: 6px 0 2px; max-height: 50vh; overflow: auto; }
.pal-item { display: flex; width: 100%; align-items: center; padding: 9px 12px; border: 0; background: transparent; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; text-align: left; color: #2b2f36; }
.pal-item.on, .pal-item:hover { background: var(--accent-soft); }
.pal-item kbd { margin-left: auto; }
.kgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 4px 28px; }
.kcol h3 { font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; margin: 10px 0 6px; }
.krow { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 5px 0; font-size: 13.5px; border-bottom: 1px solid #f2f3f5; }
.krow kbd { order: 2; }
.linkbox { margin: 14px 0; }
.linkbox .cb.primary { height: 38px; }

/* ================= Боковая панель фреймов ================= */
#framesPanel { position: fixed; left: 76px; top: 72px; bottom: 72px; width: 260px; z-index: 45; padding: 12px; overflow: auto; }
.fphead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.flist { margin-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.fitem { display: flex; gap: 10px; align-items: center; padding: 8px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; text-align: left; color: #2b2f36; }
.fitem:hover { background: #f2f3f5; }
.fnum { width: 24px; height: 24px; border-radius: 6px; background: #f2f3f5; display: grid; place-items: center; font-size: 12px; color: var(--muted); flex: none; }
.fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#layersPanel { position: fixed; left: 76px; top: 72px; bottom: 72px; width: 280px; z-index: 45; padding: 12px; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
#layersPanel.hidden { display: none; }
.llist { display: flex; flex-direction: column; gap: 2px; }
.lrow { display: flex; align-items: center; gap: 2px; border-radius: 8px; padding: 2px 2px 2px 0; }
.lrow:hover { background: #f2f3f5; }
.lrow.on { background: var(--accent-soft); }
.lrow.off .lname { opacity: .5; }
.lname { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 8px; font: 500 14px var(--font); color: #2b2f36; text-align: left; cursor: pointer; }
.lname span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow.on .lname { color: var(--accent); font-weight: 600; }
.lcount { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 500; }
.lrow .cb.on { color: var(--accent); }
.layer-off { display: none !important; }
#boardsPanel { position: fixed; left: 12px; top: 70px; bottom: 12px; width: 300px; z-index: 56; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
#boardsPanel .fphead { margin-bottom: 0; }
#boardsPanel .cb.wide { margin-top: 0; flex: none; }
#boardsPanel .phint { margin: 0 2px; }
.team-sel { width: 100%; }
.blist { flex: 1; overflow: auto; margin-top: 0; min-height: 0; }
.blist .fitem { text-decoration: none; }
.blist .fitem.on { background: var(--accent-soft); color: var(--accent); }
.bicon { width: 26px; height: 26px; display: grid; place-items: center; font-size: 17px; flex: none; font-family: "Segoe UI Emoji", "Apple Color Emoji", sans-serif; }
.blist .fname { flex: 1; }
.ic.starred { width: 16px; height: 16px; color: #f5b400; fill: #f5b400; }
#commentsPanel { position: fixed; right: 12px; top: 70px; bottom: 70px; width: 330px; z-index: 46; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
#commentsPanel .fphead { margin-bottom: 0; }
.cfilter { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #3d4350; cursor: pointer; padding: 2px; }
.cfilter input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.clist { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.citem-c { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 10px 8px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; color: inherit; font: inherit; }
.citem-c:hover { background: #f2f3f5; }
.citem-c.resolved { opacity: .6; }
.citem-c .avatar.sm { margin: 0; }
.cbody { flex: 1; min-width: 0; }
.ctext2 { font-size: 14px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.creplies { font-size: 12px; color: var(--accent); font-weight: 600; margin-top: 4px; }

/* ================= Поиск, чат, реакции ================= */
#searchBar { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; padding: 4px 6px; width: min(520px, calc(100vw - 32px)); z-index: 61; }
#searchBar .srow { display: flex; align-items: center; gap: 2px; height: 38px; }
#searchBar .srow.hidden { display: none; }
#replaceRow { border-top: 1px solid var(--line); padding-top: 4px; height: 42px !important; }
#replaceRow .sicon { width: 36px; flex: none; }
#searchMore svg { transition: transform .15s; transform: rotate(180deg); }
#searchMore[aria-expanded="true"] svg { transform: rotate(-90deg); }
.sopt { font-size: 12.5px; font-weight: 600; color: var(--muted); width: 32px; }
.sopt[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.sbtn { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; height: 30px; padding: 0 10px; font: 500 13px var(--font); color: var(--text); cursor: pointer; white-space: nowrap; }
.sbtn:hover { background: var(--bg); }
.sbtn:disabled { opacity: .45; cursor: default; }
.sicon { color: var(--muted); display: grid; }
#searchInput, #replaceInput { flex: 1; min-width: 0; border: 0; outline: none; font-size: 15px; padding: 0 6px; user-select: text; }
#searchCount { font-size: 12.5px; color: var(--muted); white-space: nowrap; padding: 0 4px; }
.chat-input {
  position: fixed; z-index: 70; width: 240px; padding: 8px 12px; border-radius: 4px 16px 16px 16px; border: 0;
  background: var(--accent); color: #fff; font-size: 14px; outline: none; box-shadow: var(--shadow); user-select: text;
}
.chat-input::placeholder { color: rgba(255, 255, 255, .75); }
#reactions { position: fixed; inset: 0; pointer-events: none; z-index: 75; overflow: hidden; }
.flyer { position: absolute; bottom: 70px; display: flex; flex-direction: column; align-items: center; animation: fly 2.9s ease-out forwards; }
.flyer-emoji { font-size: 42px; line-height: 1; }
.flyer-name { font-size: 11px; font-weight: 600; color: #fff; padding: 2px 7px; border-radius: 6px; margin-top: 4px; }
@keyframes fly {
  0% { transform: translateY(0) scale(.5); opacity: 0; }
  12% { transform: translateY(-24px) scale(1.15); opacity: 1; }
  100% { transform: translateY(-55vh) scale(1); opacity: 0; }
}

/* ================= Презентация и режим просмотра ================= */
#presentHud { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: none; align-items: center; gap: 4px; padding: 4px 8px; height: 46px; z-index: 60; font-weight: 600; font-variant-numeric: tabular-nums; }
#presentCount { padding: 0 8px; }
body.presenting #presentHud { display: flex; }
body.presenting #topLeft, body.presenting #topRight, body.presenting #leftRail, body.presenting #bottomRight,
body.presenting #context, body.presenting #framesPanel, body.presenting #layersPanel, body.presenting #boardsPanel, body.presenting #commentsPanel,
body.presenting .scrollbar, body.presenting #searchBar, body.presenting #overlay,
body.presenting #pins { display: none !important; }
body.presenting #viewport { background-image: none; }

body.viewer #toolbar .tool:not([data-tool="select"]):not([data-tool="hand"]) { display: none; }
body.viewer #undoBar { display: none; }
body.viewer .board-title { cursor: default; }

/* ================= История доски ================= */
#historyPanel, #notesPanel { position: fixed; right: 12px; top: 70px; bottom: 70px; width: 340px; z-index: 46; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
#historyPanel .fphead, #notesPanel .fphead { margin-bottom: 0; }
.htabs { display: flex; gap: 4px; background: #f2f3f5; border-radius: 10px; padding: 3px; }
.htab { flex: 1; height: 30px; border: 0; border-radius: 8px; background: transparent; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.htab.on { background: #fff; color: #1a1a1a; box-shadow: 0 1px 3px rgba(16, 24, 40, .12); }
.hlist { flex: 1; overflow: auto; min-height: 0; display: flex; flex-direction: column; gap: 2px; }
.hday { font-size: 12px; font-weight: 700; color: var(--muted); margin: 10px 4px 4px; }
.hday:first-child { margin-top: 2px; }
.hrow { display: flex; gap: 10px; align-items: flex-start; padding: 8px 6px; border-radius: 10px; }
.hrow:hover { background: #f6f7f9; }
.hrow.restored .htext { color: var(--muted); }
.hrow .avatar.sm { margin: 0; flex: none; }
.hbody { flex: 1; min-width: 0; }
.hmeta { font-size: 12px; color: var(--muted); }
.htext { font-size: 13.5px; line-height: 1.4; color: #2b2f36; overflow-wrap: anywhere; }
.htext.auto { color: #3d4350; }
.vrow .htext { font-weight: 600; }
.hacts { display: flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.hrow:hover .hacts, .hacts:focus-within, .vrow .hacts { opacity: 1; }
.hacts .cb { width: 30px; height: 30px; padding: 0; }
.hacts .cb .ic { width: 18px; height: 18px; }
.vicon { width: 28px; height: 28px; border-radius: 8px; background: #f2f3f5; display: grid; place-items: center; color: var(--muted); flex: none; }
.vicon .ic { width: 16px; height: 16px; }
.vsave { margin: 2px 0 0; }
.vsave .cb.primary { width: 38px; padding: 0; flex: none; }
@media (hover: none) { .hacts { opacity: 1; } }

/* ================= Заметки встречи ================= */
#notesPanel .grow { flex: 1; }
#notesPanel .fphead .cb { width: 32px; padding: 0; }
.ndate { margin: -4px 2px 0; text-transform: capitalize; }
.nlist { flex: 1; overflow: auto; min-height: 0; display: flex; flex-direction: column; gap: 1px; padding-right: 2px; }
.nrow { display: flex; align-items: flex-start; gap: 8px; border-radius: 8px; padding: 2px 4px; }
.nrow:hover { background: #f6f7f9; }
.nrow.k-h { margin-top: 10px; }
.nrow.k-h:first-child { margin-top: 0; }
.nmark { width: 16px; flex: none; text-align: center; color: var(--muted); line-height: 30px; }
.nrow input[type="checkbox"] { width: 16px; height: 16px; margin: 7px 0 0; flex: none; accent-color: var(--accent); }
.ntext { flex: 1; min-width: 0; border: 0; outline: none; resize: none; background: transparent; font: inherit; font-size: 14px; line-height: 1.45; padding: 5px 0; color: #1a1a1a; overflow: hidden; user-select: text; -webkit-user-select: text; }
.nrow.k-h .ntext { font-size: 15.5px; font-weight: 700; }
.nrow.done .ntext { text-decoration: line-through; color: var(--muted); }
.nrow .ndel { width: 26px; height: 26px; padding: 0; margin-top: 2px; opacity: 0; flex: none; }
.nrow .ndel .ic { width: 15px; height: 15px; }
.nrow:hover .ndel, .nrow:focus-within .ndel { opacity: 1; }
.nadd { display: flex; gap: 6px; flex-wrap: wrap; }
.nempty .cb.wide { margin-top: 10px; }

/* ================= Приватный режим ================= */
.priv-banner { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 44; display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 14px; font-size: 13.5px; max-width: calc(100vw - 24px); background: #2b2d33; color: #fff; }
.priv-banner .ic { width: 18px; height: 18px; flex: none; }
.priv-banner span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.priv-banner .cb.small { flex: none; }
.item.priv-hidden .txt { visibility: hidden; }
.item.priv-hidden::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; transform: translate(-50%, -50%); opacity: .45; pointer-events: none;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231a1a1a' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='11' width='14' height='9' rx='2'/%3E%3Cpath d='M8 11V8a4 4 0 018 0v3'/%3E%3C/svg%3E");
}
.item.text.priv-hidden { min-width: 60px; min-height: 40px; background: #eef0f4; border-radius: 6px; }

/* ================= Свои шаблоны ================= */
.tcard.own { position: relative; border-color: #d9def8; background: #f7f8ff; }
.tcard .tmeta { font-size: 12px; }
.tcard .tdel { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; padding: 0; opacity: 0; }
.tcard:hover .tdel, .tcard:focus-within .tdel { opacity: 1; }
.tcard.own b { padding-right: 28px; }
.modal .plabel + .tgrid { margin-bottom: 6px; }

/* ================= Иконки, лассо, размеры ================= */
.item.icon { background: transparent; }
.icon-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.icon-svg path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.icons-pop { width: 320px; }
.icons-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-top: 8px; max-height: 300px; overflow: auto; }
.icons-grid .cb { width: 100%; height: 38px; padding: 0; }
.icons-grid .cb .ic { width: 22px; height: 22px; }
#lassoLayer { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 21; }
#lassoLayer path { fill: rgba(66, 98, 255, .07); stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 5 4; stroke-linejoin: round; }
#viewport[data-tool="lasso"] { cursor: crosshair; }
.cfilt { font-size: 13px; font-weight: 500; padding: 0 4px; display: inline-flex; align-items: center; gap: 4px; }
.cfilt::after { content: ""; width: 0; height: 0; border: 4px solid transparent; border-top-color: currentColor; margin-top: 4px; }
.geom-pop { width: 236px; }
.geom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.gfield { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.gfield span { width: 14px; text-align: center; }
.gfield .pinput.num { width: 100%; padding: 6px 8px; }
.geom-pop .cfilter { margin-top: 8px; }

/* ================= Текст с оформлением, упоминания, уведомления ================= */
.txt ul, .txt ol { margin: 0; padding-left: 1.3em; text-align: left; }
.txt li { margin: 0; }
.txt a { color: #2a5bd7; text-decoration: underline; cursor: pointer; }
.mention { color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 0 2px; -webkit-box-decoration-break: clone; box-decoration-break: clone; overflow-wrap: anywhere; }
.mention-pop { position: fixed; z-index: 120; min-width: 200px; max-width: 280px; padding: 4px; display: flex; flex-direction: column; }
.mention-pop .mitem { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 0; background: transparent; border-radius: 6px; font: inherit; font-size: 14px; cursor: pointer; text-align: left; }
.mention-pop .mitem.on, .mention-pop .mitem:hover { background: var(--accent-soft); }
.mention-pop .avatar.sm { margin: 0; }
.link-pop { width: 300px; }
#btnNotify { position: relative; }
.nbadge { position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: #f24822; color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; line-height: 1; }
.notify-pop { width: 340px; max-height: min(520px, calc(100vh - 90px)); display: flex; flex-direction: column; }
.nhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.nlist2 { overflow: auto; display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.nitem { display: flex; gap: 10px; align-items: flex-start; text-align: left; border: 0; background: transparent; border-radius: 10px; padding: 8px; cursor: pointer; font: inherit; color: inherit; }
.nitem:hover { background: #f2f3f5; }
.nitem.unread { background: #f4f6ff; }
.nitem .avatar.sm { margin: 0; flex: none; }
.nbody { min-width: 0; flex: 1; }
.nmeta { font-size: 12px; color: var(--muted); }
.ntitle { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nsnip { font-size: 13px; color: #3d4350; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }

/* ================= Линии: изгибы и вставка ================= */
.handle.bend { width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 1.5px solid var(--accent); cursor: move; }
.handle.bend.add { width: 9px; height: 9px; background: var(--accent-soft); border-style: dashed; opacity: .9; cursor: copy; }
.handle.bend.add:hover { background: var(--accent); }
#svgLayer g.drop-line path:not(.hit):not(.head) { stroke: var(--accent) !important; stroke-width: 4px; }

/* ================= Составные объекты ================= */
.avatar.xs { width: 18px; height: 18px; font-size: 10px; margin: 0; flex: none; }
/* карточка задачи */
.item.card { background: #fff; border-radius: 8px; border-left: 6px solid #4262ff; box-shadow: 0 1px 4px rgba(16, 24, 40, .14); padding: 10px 12px 8px; display: flex; flex-direction: column; }
.item.card .txtwrap { flex: 1; min-height: 0; overflow: hidden; display: flex; }
.item.card .txt { width: 100%; line-height: 1.35; }
.item.card.done .txt { text-decoration: line-through; color: var(--muted); }
.card-foot { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; min-height: 22px; }
.card-foot .chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 11px; background: #f2f3f5; font-size: 12px; color: #3d4350; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.card-foot .chip.late { background: #fde2e1; color: #b42318; }
.card-foot .chip.ok { background: #d9f2e6; color: #16794c; }
/* канбан */
.item.kanban { background: #fff; border: 1px solid #d3d6dc; border-radius: 12px; }
.kb-title { position: absolute; left: 16px; right: 16px; top: 0; height: 52px; display: flex; align-items: center; font-size: 20px; font-weight: 700; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.kb-cols { position: absolute; inset: 52px 0 16px 0; }
.kb-col { position: absolute; top: 0; bottom: 0; border-radius: 10px; }
.kb-head { height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 6px 0 12px; font-weight: 600; font-size: 14px; color: #3d4350; }
.kb-name { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: text; }
.kb-count { font-size: 12px; color: var(--muted); font-weight: 600; }
.kb-add { width: 26px; height: 26px; border: 0; border-radius: 6px; background: transparent; display: grid; place-items: center; cursor: pointer; color: #3d4350; }
.kb-add:hover { background: rgba(255, 255, 255, .7); }
.kb-add .ic { width: 16px; height: 16px; }
.kb-pop { width: 300px; }
.kb-lanes { position: absolute; inset: 0; pointer-events: none; }
.kb-lane { position: absolute; left: 8px; right: 8px; border-top: 1px dashed rgba(0, 0, 0, .18); }
.kb-lane-name { position: absolute; left: 22px; top: 4px; padding: 2px 8px; border-radius: 6px; background: rgba(255, 255, 255, .85); font-size: 13px; font-weight: 600; color: #3d4350; pointer-events: auto; cursor: text; max-width: 240px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.kb-col.kb-hid .kb-head { flex-direction: column; height: auto; padding: 8px 0; gap: 6px; }
.kb-col.kb-hid .kb-name { writing-mode: vertical-rl; flex: none; max-height: 220px; }
.kb-col.kb-hid .kb-add { display: none; }
.kb-sw { width: 22px; height: 22px; flex: none; border: 1px solid rgba(0, 0, 0, .15); border-radius: 6px; cursor: pointer; padding: 0; }
.kb-gap { width: 28px; flex: none; }
.kb-row { gap: 4px; }
.kb-row .pinput { flex: 1; min-width: 0; }
.kb-edit { display: flex; flex-direction: column; gap: 6px; }
/* таблица */
.item.table { background: #fff; border: 1px solid #c9cdd4; }
.tbl-grid { position: absolute; inset: 0; display: grid; }
.tbl-cell { border-right: 1px solid #e1e4e8; border-bottom: 1px solid #e1e4e8; padding: 6px 8px; font-size: 14px; line-height: 1.3; overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; outline: none; }
.item.table.hdr .tbl-cell:nth-child(-n+16) { }
.item.table.hdr .tbl-grid > .tbl-cell[data-cell^="c_0_"] { background: #f2f3f5; font-weight: 600; }
.tbl-cell.editing { background: #fff; box-shadow: inset 0 0 0 2px var(--accent); user-select: text; -webkit-user-select: text; cursor: text; }
.tbl-cell.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-h { background: #f2f3f5; font-weight: 600; }
.tbl-h[data-type="num"]::before { content: "# "; color: var(--muted); font-weight: 500; }
.tbl-h[data-type="sel"]::before { content: "◉ "; color: var(--muted); font-weight: 500; }
.tbl-h[data-sort]::after { content: " " attr(data-sort); color: var(--accent); }
.tbl-pill { display: inline-block; max-width: 100%; padding: 1px 9px; border-radius: 11px; font-size: 13px; line-height: 20px; color: #2b2f38; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.tbl-grp { background: #eef1ff; font-weight: 600; font-size: 13px; color: #3d4350; white-space: nowrap; text-overflow: ellipsis; }
.tbl-foot { background: #f7f8fa; font-size: 13px; color: #3d4350; text-align: right; white-space: nowrap; }
.tbl-agl { color: var(--muted); margin-right: 6px; font-weight: 500; }
.item.table.as-kanban { border-radius: 12px; }
.tk-box { position: absolute; inset: 0; }
.item.table:not(.as-kanban) .tk-box, .item.table.as-kanban .tbl-grid { display: none; }
.tk-col { position: absolute; top: 12px; bottom: 12px; border-radius: 10px; transition: box-shadow .12s; }
.tk-col.drop { box-shadow: inset 0 0 0 2px var(--accent); }
.tk-head { height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 6px 0 12px; font-weight: 600; font-size: 14px; color: #3d4350; }
.tk-name { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tk-count { font-size: 12px; color: var(--muted); }
.tk-card { position: absolute; left: 8px; right: 8px; height: 64px; background: #fff; border-radius: 8px; box-shadow: 0 1px 2px rgba(16, 24, 40, .12); padding: 8px 10px; cursor: grab; }
.tk-card.dragging { z-index: 5; box-shadow: var(--shadow); cursor: grabbing; }
.tk-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; outline: none; }
.tk-title.empty { color: var(--muted); font-weight: 500; }
.tk-title.editing { white-space: pre-wrap; background: #fff; box-shadow: 0 0 0 2px var(--accent); border-radius: 4px; user-select: text; -webkit-user-select: text; cursor: text; }
.tk-meta { font-size: 12px; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 14px; padding: 16px; text-align: center; }
.tf-pop { width: 340px; max-height: min(520px, calc(100vh - 120px)); overflow-y: auto; }
.tf-list { display: flex; flex-direction: column; gap: 12px; }
.tf-row { display: flex; flex-direction: column; gap: 6px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.tf-row:last-child { border-bottom: 0; padding-bottom: 0; }
.tf-name { font-weight: 600; font-size: 14px; }
.tf-seg { display: flex; gap: 4px; }
.tf-seg.tf-wrap, .tf-agg { flex-wrap: wrap; }
.tf-opt { border: 1px solid var(--line); background: var(--panel); border-radius: 7px; padding: 4px 9px; font: 500 12.5px var(--font); color: var(--text); cursor: pointer; }
.tf-opt:hover { background: var(--bg); }
.tf-opt.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.tf-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.tf-frow { display: flex; align-items: center; gap: 6px; padding: 4px 0; }
.tf-ftext { flex: 1; font-size: 13.5px; }
.tf-add { display: flex; flex-direction: column; gap: 6px; margin: 6px 0; }
.fs.on-dot { color: var(--accent); }
/* интеллект-карта */
.item.mind { border: 2px solid #4262ff; border-radius: 26px; background: #fff; display: flex; align-items: center; padding: 4px 12px; }
.item.mind.root { border-radius: 30px; }
.item.mind .txtwrap { width: 100%; display: flex; align-items: center; }
.item.mind .txt { width: 100%; line-height: 1.25; }
.mind-edge { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
.mind-edge path { fill: none; stroke-width: 2.5; stroke-linecap: round; }
/* блок кода */
.item.code { background: #1e2230; border-radius: 10px; color: #e6e9f2; overflow: hidden; display: flex; flex-direction: column; }
.code-bar { height: 30px; flex: none; display: flex; align-items: center; padding: 0 14px; font-size: 12px; font-weight: 600; color: #8b93a7; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.code-pre { flex: 1; margin: 0; padding: 8px 14px 12px; font: 13px/1.45 ui-monospace, "Cascadia Mono", Consolas, monospace; white-space: pre; overflow: hidden; tab-size: 2; outline: none; }
.item.code.empty:not(.editing) .code-pre::before { content: "Двойной щелчок — написать код"; color: #6b7386; }
.item.code.editing .code-pre { user-select: text; -webkit-user-select: text; cursor: text; }
.tk-k { color: #c792ea; } .tk-s { color: #c3e88d; } .tk-n { color: #f78c6c; } .tk-c { color: #697098; font-style: italic; }
/* видео */
.item.video { background: #111; border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.video-bar { height: 32px; flex: none; display: flex; align-items: center; padding: 0 12px; color: #fff; font-size: 13px; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.video-box { flex: 1; position: relative; min-height: 0; }
.video-box img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-box iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 64px; height: 64px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .62); color: #fff; display: grid; place-items: center; cursor: pointer; }
.video-play:hover { background: #f24822; }
.video-play .ic { width: 28px; height: 28px; fill: currentColor; }
/* ссылка и PDF */
.item.link { background: #fff; border: 1px solid #d3d6dc; border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.link-img { display: none; width: 100%; flex: 1 1 55%; min-height: 0; object-fit: cover; }
.item.link.with-img .link-img { display: block; }
.link-body { padding: 10px 14px 0; flex: none; min-height: 0; overflow: hidden; }
.link-title { font-weight: 600; font-size: 15px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.link-desc { font-size: 13px; color: #3d4350; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.link-site { font-size: 12px; color: var(--muted); margin-top: 4px; }
.link-open { margin: 8px 14px 10px; align-self: flex-start; height: 28px; padding: 0 12px; border-radius: 7px; border: 1px solid #d3d6dc; background: #fff; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; flex: none; }
.link-open:hover { border-color: var(--accent); color: var(--accent); }
.item.doc { background: #fff; border: 1px solid #d3d6dc; box-shadow: 0 1px 4px rgba(16, 24, 40, .1); overflow: hidden; }
.doc-page { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: fill; }
.item.doc.loading .doc-page:not([src]), .item.doc.failed .doc-page { visibility: hidden; }
.doc-ph { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 12px; text-align: center; }
.doc-badge { width: 36px; height: 44px; border-radius: 6px; background: #e5322d; color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; flex: none; }
.doc-name { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; color: #3d4350; }
.doc-pager { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 10px; background: rgba(26, 26, 26, .78); color: #fff; opacity: 0; transition: opacity .15s; }
.item.doc:hover .doc-pager { opacity: 1; }
.item.doc.single .doc-pager { display: none; }
.doc-nav { width: 28px; height: 28px; border: 0; border-radius: 7px; background: transparent; color: #fff; display: grid; place-items: center; cursor: pointer; }
.doc-nav:hover { background: rgba(255, 255, 255, .18); }
.doc-nav .ic { width: 18px; height: 18px; }
.doc-num { font-size: 12.5px; font-weight: 600; padding: 0 6px; min-width: 52px; text-align: center; }
.doc-ctx-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb.dis { opacity: .35; pointer-events: none; }

/* узкое окно на компьютере: верхние панели не должны наезжать друг на друга */
@media (max-width: 1000px) and (min-width: 641px) {
  #topLeft .board-title { max-width: max(70px, calc(100vw - 690px)); }
}
@media (max-width: 900px) and (min-width: 641px) {
  #topLeft .board-title { max-width: max(70px, calc(100vw - 600px)); }
  #btnShare span { display: none; }
  #btnShare { padding: 0 10px; }
}
@media (max-width: 760px) and (min-width: 641px) {
  #topLeft .board-title { max-width: max(70px, calc(100vw - 530px)); }
  #btnExport, #topRight .tb-sep { display: none; }
}

/* ================= Телефон ================= */
@media (max-width: 640px) {
  #topLeft, #topRight { height: 44px; top: 8px; }
  #topLeft { left: 8px; right: 8px; padding: 0 4px; }
  #topLeft .logo, #btnExport { display: none; }
  #topLeft .board-title { flex: 1; max-width: none; min-width: 0; }
  #topRight { top: 58px; right: 8px; padding: 0 4px; max-width: calc(100vw - 16px); overflow-x: auto; scrollbar-width: none; }
  #topRight > * { flex-shrink: 0; }
  /* таймер и голосование на телефоне — отдельной строкой под панелью, чтобы она не вылезала за экран */
  #timerChip, #voteChip { position: fixed; top: 110px; box-shadow: 0 2px 8px rgba(0, 0, 0, .18); margin: 0; }
  #timerChip { right: 8px; }
  #voteChip { left: 8px; }
  #topRight .tb-sep, #btnShare span { display: none; }
  #btnShare { padding: 0 10px; }
  #presence .avatar:not(:first-child):not(.more) { display: none; }
  #leftRail { left: 8px; right: 8px; top: auto; bottom: 8px; transform: none; flex-direction: row; max-height: none; }
  #toolbar { flex-direction: row; overflow-x: auto; overflow-y: hidden; flex: 1; min-width: 0; padding: 4px; }
  #toolbar .tool, #undoBar .tool { width: 40px; height: 40px; }
  #toolbar .tool .ic { width: 22px; height: 22px; }
  .tool.more-tools { position: sticky; right: 0; bottom: auto; box-shadow: -10px 0 8px -6px rgba(0, 0, 0, .18); border-radius: 0 10px 10px 0; }
  #undoBar { flex-direction: row; padding: 4px; }
  #bottomRight { right: 8px; bottom: 68px; }
  #btnMinimap, #btnFit, #btnHelp, #zoombar .tb-sep, #minimap { display: none !important; }
  #zoombar { height: 40px; }
  .scrollbar { display: none; }
  #boardsPanel, #commentsPanel, #framesPanel, #layersPanel, #overviewPanel, #historyPanel, #notesPanel { left: 8px; right: 8px; width: auto; top: 104px; bottom: 120px; }
  .priv-banner { top: 104px; left: 8px; right: 8px; transform: none; max-width: none; font-size: 12.5px; }
  .priv-banner span { white-space: normal; line-height: 1.35; }
  .tcard .tdel { opacity: 1; }
  #context { max-width: calc(100vw - 16px); overflow-x: auto; scrollbar-width: none; }
  .cmenu { max-width: calc(100vw - 32px); }
  .popover { max-width: calc(100vw - 16px); }
  .popover.thread, .popover.tools-pop { width: min(330px, calc(100vw - 16px)); }
  #searchBar { top: 104px; }
}
@media (max-width: 380px) { #undoBar { display: none; } }

#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); background: #1f2329; color: #fff;
  padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 500; opacity: 0; transition: opacity .2s, transform .2s;
  pointer-events: none; z-index: 120; max-width: calc(100vw - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.show.with-act { pointer-events: auto; }
#toast .toast-act { margin-left: 14px; border: 0; background: none; color: #9db0ff; font: 600 14px var(--font); cursor: pointer; padding: 0; }

/* ================= Сайт обновился, пока доска была открыта ================= */
.update-bar { position: fixed; left: 50%; top: 64px; transform: translateX(-50%); z-index: 200; display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px);
  padding: 10px 12px 10px 16px; background: #1f2430; color: #fff; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.2); font-size: 14px; line-height: 1.35; }
.update-bar .update-btn { flex: none; border: 0; border-radius: 7px; padding: 7px 12px; background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.update-bar .update-btn:hover { filter: brightness(1.08); }

/* ================= Документ на доске ================= */
.item.mdoc { background: #fff; box-shadow: 0 1px 3px rgba(16, 24, 40, .1), 0 6px 18px rgba(16, 24, 40, .08); border-radius: 4px; min-height: 160px; }
.item.mdoc .txtwrap { display: block; height: auto; }
.item.mdoc .txt { max-height: none; min-height: 3em; line-height: 1.55; overflow-wrap: break-word; }
.item.mdoc.editing .txt { cursor: text; }
.mdoc-badge { position: absolute; left: 14px; top: 12px; display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); pointer-events: none; }
.mdoc-badge .ic { width: 15px; height: 15px; }
.txt .rt-h1, .txt h1 { font-size: 1.75em; font-weight: 700; line-height: 1.25; margin: .5em 0 .3em; }
.txt .rt-h2, .txt h2 { font-size: 1.4em; font-weight: 700; line-height: 1.3; margin: .5em 0 .25em; }
.txt .rt-h3, .txt h3 { font-size: 1.18em; font-weight: 700; line-height: 1.35; margin: .4em 0 .2em; }
.txt > .rt-h1:first-child, .txt > h1:first-child, .txt > .rt-h2:first-child, .txt > h2:first-child { margin-top: 0; }
.sug-ins { color: #0a7d5b; background: #e6f7ef; text-decoration: underline; text-decoration-color: #19b37d; }
.sug-del { color: #b42318; background: #fde8e8; text-decoration: line-through; }
.sug-pop { width: 340px; max-height: min(480px, calc(100vh - 120px)); overflow-y: auto; }
.sug-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.sug-row { display: flex; align-items: center; gap: 4px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.sug-body { flex: 1; min-width: 0; }
.sug-meta { font-size: 12px; color: var(--muted); }
.sug-text { font-size: 13.5px; overflow-wrap: anywhere; }
.sug-text.ins { color: #0a7d5b; }
.sug-text.del { color: #b42318; text-decoration: line-through; }
.item.mdoc .txt > .rt-h1:first-child:only-child:has(> br:only-child)::before, .item.mdoc .txt:empty::before { content: "Без названия"; color: #b4b8c0; }

/* ================= Обрезка картинки ================= */
.item.image.cropped { overflow: hidden; }
.crop-ui { position: absolute; z-index: 5; overflow: visible; touch-action: none; }
.crop-ui > img { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .35; pointer-events: none; user-select: none; }
.crop-box { position: absolute; border: 2px solid var(--accent); box-sizing: border-box; cursor: move; background: transparent;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .6); }
.crop-box::before { content: ""; position: absolute; inset: 0; pointer-events: none; }
.crop-h { position: absolute; width: var(--hs, 12px); height: var(--hs, 12px); background: #fff; border: 1.5px solid var(--accent); border-radius: 2px; box-sizing: border-box; transform: translate(-50%, -50%); }
.crop-nw { left: 0; top: 0; cursor: nwse-resize; } .crop-n { left: 50%; top: 0; cursor: ns-resize; } .crop-ne { left: 100%; top: 0; cursor: nesw-resize; }
.crop-e { left: 100%; top: 50%; cursor: ew-resize; } .crop-se { left: 100%; top: 100%; cursor: nwse-resize; } .crop-s { left: 50%; top: 100%; cursor: ns-resize; }
.crop-sw { left: 0; top: 100%; cursor: nesw-resize; } .crop-w { left: 0; top: 50%; cursor: ew-resize; }
.crop-bar { position: absolute; display: flex; gap: 6px; transform-origin: 50% 0; white-space: nowrap; }
.crop-bar button { border: 0; border-radius: 8px; height: 32px; padding: 0 12px; font: 600 13px var(--font); cursor: pointer; box-shadow: var(--shadow); }
.crop-ok { background: var(--accent); color: #fff; }
.crop-reset { background: #fff; color: var(--text); }
.crop-win { position: absolute; overflow: hidden; pointer-events: none; }
.crop-win img { position: absolute; max-width: none; user-select: none; }

/* ================= Режим фокуса ================= */
body.focus-mode #itemsLayer > .item:not(.focus-on), body.focus-mode #framesLayer > .item:not(.focus-on), body.focus-mode #svgLayer g[data-id]:not(.focus-on) { opacity: .07; pointer-events: none; transition: opacity .2s; }
body.focus-mode #leftRail, body.focus-mode #minimap { display: none; }
.focus-bar { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 62; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px 0 6px; max-width: calc(100vw - 32px); }
.focus-bar.hidden { display: none; }
.focus-back { display: flex; align-items: center; gap: 4px; border: 0; background: var(--accent-soft); color: var(--accent); border-radius: 8px; height: 32px; padding: 0 10px 0 6px; font: 600 13.5px var(--font); cursor: pointer; }
.focus-back .ic { width: 18px; height: 18px; }
.focus-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mm-pop { width: 380px; }
.mm-code { width: 100%; min-height: 160px; font: 13px/1.45 ui-monospace, Consolas, monospace; resize: vertical; white-space: pre; }
.phint.err { color: var(--danger); }

/* ================= График ================= */
.item.chart { background: #fff; border: 1px solid #d3d6dc; border-radius: 8px; overflow: hidden; }
.chart-svg { display: block; width: 100%; height: 100%; }
.ch-title { font: 700 16px var(--font); fill: #1a1a1a; }
.ch-axis { font: 400 11px var(--font); fill: #6b7280; }
.ch-label { font: 400 12px var(--font); fill: #3d4350; }
.ch-empty { font: 500 14px var(--font); fill: #9aa0a8; }
.ch-grid { stroke: #eceef1; stroke-width: 1; }
.ch-zero { stroke: #c9cdd4; stroke-width: 1; }
.style-row { display: flex; align-items: center; gap: 2px; }
.style-row .oitem { flex: 1; }
.style-chip { display: inline-grid; place-items: center; width: 34px; height: 24px; border-radius: 5px; border: 2px solid #c9cdd4; background: #fff; font-size: 12px; flex: none; }
.style-chip.note { border-color: transparent; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.style-chip.line, .style-chip.path { height: 0; border-width: 3px 0 0 0; border-radius: 0; background: none; }
.style-pop { width: 300px; }

/* ================= Доступность ================= */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
#overviewPanel { position: fixed; right: 12px; top: 72px; bottom: 72px; width: 300px; z-index: 46; padding: 12px; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
#overviewPanel.hidden { display: none; }
.ov-list { display: flex; flex-direction: column; gap: 2px; }
.ov-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; border: 0; background: transparent; border-radius: 8px; padding: 7px 8px; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.ov-item:hover, .ov-item:focus-visible { background: var(--accent-soft); outline: none; }
.ov-type { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.ov-text { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
body.presenting #overviewPanel { display: none; }
.txt .rt-cl { position: relative; padding-left: 1.6em; }
.txt .rt-cl.done { color: #8a9099; text-decoration: line-through; }
.rt-box { position: absolute; left: .1em; top: .22em; width: 1.05em; height: 1.05em; border: 1.5px solid #8a9099; border-radius: 4px; box-sizing: border-box; cursor: pointer; background: #fff; user-select: none; }
.rt-cl.done > .rt-box { background: #22a06b; border-color: #22a06b; }
.rt-cl.done > .rt-box::after { content: ""; position: absolute; left: 30%; top: 8%; width: 30%; height: 55%; border: solid #fff; border-width: 0 .14em .14em 0; transform: rotate(45deg); }

/* ================= Новый вид панелей (макет 2026-10-23, «близко к Miro») ================= */
:root { --ink: #050038; --bg: #f2f2f2; --bar-shadow: 0 2px 8px rgba(5, 0, 56, .08), 0 0 0 1px rgba(5, 0, 56, .05); }
.ic { stroke-width: 2; }
.panel, .popover, .menu, .cmenu, .modal { color: var(--ink); }
.tbtn, .tool, .cb, .oitem, .citem, .citem .ic, .mitem, .fitem, .lname, .pal-item { color: var(--ink); }
#viewport[data-grid="lines"] { background-image: linear-gradient(to right, #e3e3e8 1px, transparent 1px), linear-gradient(to bottom, #e3e3e8 1px, transparent 1px); }
#topLeft, #topRight { top: 16px; height: 56px; padding: 0 8px; gap: 4px; box-shadow: var(--bar-shadow); }
#topLeft { left: 16px; }
#topRight { right: 16px; }
#topLeft .tbtn, #topRight .tbtn { height: 40px; min-width: 40px; }
#topLeft .tbtn .ic, #topRight .tbtn:not(.primary):not(.present-btn) .ic { width: 24px; height: 24px; }
.present-btn { width: 40px; padding: 0; background: #f2f2f6; }
.present-btn .ic { width: 20px; height: 20px; }
.tbtn.primary { height: 40px; padding: 0 16px 0 13px; font-size: 15px; }
.tbtn.primary .ic { width: 20px; height: 20px; }
.logo.wordmark {
  width: auto; height: auto; margin: 0 2px 0 4px; padding: 0 6px 3px; border-radius: 8px; background: none;
  color: var(--ink); font: 700 26px/1 "Mivorli Brand", var(--font); letter-spacing: -.3px;
}
.logo.wordmark:hover { background: #f2f2f6; }
.board-icon { width: 36px; height: 36px; }
.bi-blob { display: block; width: 24px; height: 24px; border-radius: 8px 8px 8px 3px; background: linear-gradient(135deg, #7fd3ff, var(--accent)); }
.board-title { font-weight: 500; }
.avatar { width: 32px; height: 32px; }
#leftRail { left: 16px; }
#toolbar, #undoBar { box-shadow: var(--bar-shadow); }
#bottomRight { right: 16px; bottom: 16px; }
#zoombar { height: 48px; padding: 0 4px; box-shadow: var(--bar-shadow); }
#zoombar .tbtn { height: 40px; min-width: 40px; }
#zoombar .tbtn .ic { width: 24px; height: 24px; }
.zoom-level { font-size: 15px; font-weight: 500; }
#context { height: 48px; padding: 0 6px; border-radius: 10px; }
#context .cb .ic { width: 22px; height: 22px; }
#context .ctx-x { display: none !important; }
#context .ctx-toggle { color: #6b6b8a; width: 28px; min-width: 28px; padding: 0; }
@media (max-width: 760px) { #topLeft .logo.wordmark { display: none; } }
@media (max-width: 640px) {
  #topLeft, #topRight { height: 44px; top: 8px; }
  #topLeft { left: 8px; }
  #topRight { top: 58px; right: 8px; }
  #leftRail { left: 8px; }
  #bottomRight { right: 8px; bottom: 68px; }
  #zoombar { height: 40px; }
  #topLeft .tbtn, #topRight .tbtn { height: 36px; min-width: 36px; }
}

/* ================= Всплывающие окна в новом виде ================= */
:root { --pop-shadow: 0 10px 30px rgba(5, 0, 56, .14), 0 0 0 1px rgba(5, 0, 56, .06); --muted2: #6b6b8a; }
.popover { padding: 12px; border-radius: 12px; box-shadow: var(--pop-shadow); max-width: 360px; }
.menu, .cmenu { box-shadow: var(--pop-shadow); }
.popover .plabel, .modal .plabel { font-size: 12px; font-weight: 600; color: var(--muted2); margin: 14px 2px 8px; letter-spacing: .01em; }
.popover > .plabel:first-child { margin-top: 2px; }
.phint { color: var(--muted2); }
/* длинные пункты переносятся, а не вылезают за окно */
.popover .oitem { white-space: normal; line-height: 1.3; min-height: 36px; padding: 7px 10px; }
.popover .oitem > span { min-width: 0; overflow-wrap: anywhere; }
.popover .oitem .ic { flex: none; }
.popover .olist.row .oitem, .popover .olist.row .cb { min-height: 32px; border-radius: 8px; border-color: #e6e6eb; }
.popover .olist.row .oitem.on, .popover .olist.row .cb.on { border-color: var(--accent); }
.citem { height: auto; min-height: 40px; padding: 8px 10px; white-space: normal; line-height: 1.3; }
.citem .ctitle { white-space: normal; text-overflow: clip; overflow-wrap: anywhere; }
.cmenu { max-width: 360px; }
.sw:not(.handle) { box-shadow: inset 0 0 0 1px rgba(5, 0, 56, .12); }
.sw.on { outline-offset: 2px; outline-width: 2px; }
/* сегменты */
.seg { display: flex; gap: 2px; padding: 3px; background: #f2f2f6; border-radius: 10px; }
.seg .cb { flex: 1; height: 34px; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink); }
.seg .cb .ic { width: 18px; height: 18px; }
.seg .cb.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(5, 0, 56, .12); }
.seg .cb:hover:not(.on) { background: rgba(255, 255, 255, .6); }
/* толщина линии — образцом, а не цифрой */
.wrow { display: flex; gap: 6px; }
.wrow .cb { flex: 1; height: 36px; padding: 0 8px; border: 1px solid #e6e6eb; }
.wrow .cb.on { border-color: var(--accent); background: var(--accent-soft); }
.wline { display: block; width: 100%; min-width: 18px; border-radius: 6px; background: currentColor; }
/* строка-переключатель */
.swrow { display: flex; width: 100%; align-items: center; gap: 12px; padding: 8px 4px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; text-align: left; font: inherit; color: var(--ink); }
.swrow:hover { background: #f4f4f7; }
.swtext { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.swtitle { font-size: 14px; font-weight: 500; }
.swhint { font-size: 12.5px; color: var(--muted2); line-height: 1.35; }
.psep { height: 1px; background: #ececf2; margin: 12px -12px 6px; }
.plink { border: 0; background: none; padding: 6px 4px 2px; color: var(--accent); font: 500 13px var(--font); cursor: pointer; }
.plink:hover { text-decoration: underline; }
.popover.pen-pop { width: 312px; }
.popover.pen-pop .cgrid { grid-template-columns: repeat(8, 28px); gap: 8px; }
.popover.pen-pop .cgrid .sw { width: 28px; height: 28px; }
.popover .inline-row { flex-wrap: wrap; }
.popover .ctext { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.popover .inline-row .ctext { flex: 1; padding: 0 2px; }
.hist-item { white-space: normal; overflow-wrap: anywhere; }

/* ================= Формы и модальные окна в новом виде ================= */
.modal-back { background: rgba(5, 0, 56, .28); }
.modal { border-radius: 16px; padding: 24px; box-shadow: 0 24px 60px rgba(5, 0, 56, .22), 0 0 0 1px rgba(5, 0, 56, .06); }
.mhead { margin-bottom: 18px; }
.mhead h2 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.modal .plabel { font-size: 13px; font-weight: 600; color: var(--ink); margin: 18px 0 8px; }
.modal > .plabel:first-of-type, .mhead + .plabel { margin-top: 0; }
.modal p, .modal .phint { color: var(--muted2); }
/* поля */
.pinput, select, textarea.pinput {
  border: 1px solid #d9d9e3; border-radius: 8px; font-size: 14px; color: var(--ink); background-color: #fff;
  transition: border-color .12s, box-shadow .12s;
}
.pinput { padding: 8px 12px; min-height: 38px; }
.pinput:hover, select:hover { border-color: #b9b9c8; }
.pinput:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(66, 98, 255, .16); outline: none; }
.pinput::placeholder { color: #9a9ab0; }
/* выпадающий список — свой, а не системный */
select, .pinput.sel {
  -webkit-appearance: none; appearance: none; height: 38px; padding: 0 34px 0 12px; cursor: pointer; font: 500 14px var(--font);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23050038' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
select::-ms-expand { display: none; }
/* галочки и переключатели */
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }
/* кнопки */
.cb.wide { height: 40px; border-radius: 8px; background: #f2f2f6; font-weight: 600; }
.cb.wide:hover { background: #e8e8f0; }
.cb.primary, .cb.wide.primary { background: var(--accent); color: #fff; height: 38px; padding: 0 16px; }
.cb.primary:hover { background: var(--accent-dark); }
.cb.small { height: 30px; border-radius: 7px; background: #f2f2f6; font-weight: 600; color: var(--ink); }
.cb.small:hover { background: #e8e8f0; color: var(--ink); }
.modal .inline-row { gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.modal .inline-row > select, .modal .inline-row > .pinput.sel { flex: 1 1 140px; min-width: 0; }
.share-row { padding: 8px 0; gap: 16px; }
.share-row > span:first-child { flex: 1; min-width: 0; }
.share-row select { flex: 0 0 auto; min-width: 190px; }
.modal label { cursor: pointer; }
.modal .inline-row > textarea.pinput { flex: 1 1 100%; min-height: 64px; }

/* ================= Окна кнопок слева, как в Miro (toolfly.js) ================= */
.popover.fly { padding: 8px; min-width: 232px; border-radius: 14px; }
.fly-row { display: flex; width: 100%; align-items: center; gap: 12px; height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent;
  color: var(--ink); font: 400 15px var(--font); cursor: pointer; text-align: left; white-space: nowrap; }
.fly-row .ic { width: 20px; height: 20px; flex: none; }
.fly-row .fly-label { flex: 1; }
.fly-row kbd { background: none; color: #6b6b8a; font: 400 14px var(--font); padding: 0; }
.fly-row:hover { background: #f1f1f4; }
.fly-row.on { background: #ebebef; }
.fly-sep { height: 1px; background: #ececf2; margin: 6px 4px; }
.popover.fly-notes-pop { min-width: 0; padding: 12px; }
.fly-notes { display: grid; grid-template-columns: repeat(2, 52px); gap: 10px; }
.fly-note { width: 52px; height: 52px; border: 0; border-radius: 2px; cursor: pointer; padding: 0;
  box-shadow: inset 0 0 0 1px rgba(5, 0, 56, .1), 0 1px 2px rgba(0, 0, 0, .08); transition: transform .1s; }
.fly-note:hover { transform: scale(1.06); }
.fly-note.on { outline: 2px solid var(--accent); outline-offset: 3px; }
/* колонка рисования */
.draw-bar { position: fixed; z-index: 51; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; box-shadow: var(--bar-shadow); }
.draw-bar.hidden { display: none; }
.draw-bar.row { flex-direction: row; }
.draw-bar .tool { width: 44px; height: 44px; padding: 0; }
.draw-bar .tool .ic { width: 24px; height: 24px; }
.draw-bar .tool.active { background: #ebebef; color: var(--ink); }
.draw-sep { width: 28px; height: 1px; background: #e6e6eb; margin: 4px 0; }
.draw-bar.row .draw-sep { width: 1px; height: 28px; margin: 0 4px; }
.draw-preset { width: 44px; height: 44px; border: 0; background: transparent; border-radius: 50%; display: grid; place-items: center; cursor: pointer; padding: 0; }
.draw-dot { width: 30px; height: 30px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(5, 0, 56, .16); }
.draw-preset.on .draw-dot { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent); }
.draw-preset:hover .draw-dot { transform: scale(1.06); }
.popover.draw-pop { width: 212px; padding: 16px; }
.draw-range { width: 100%; accent-color: var(--accent); margin: 2px 0 6px; cursor: pointer; }
.draw-colors { display: grid; grid-template-columns: repeat(4, 34px); gap: 10px 12px; max-height: 260px; overflow-y: auto; padding: 2px; }
.draw-sw { width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer; padding: 0; display: grid; place-items: center; color: #fff; }
.draw-sw.light { box-shadow: inset 0 0 0 1px rgba(5, 0, 56, .2); color: var(--ink); }
.draw-sw .ic { width: 18px; height: 18px; stroke-width: 2.6; }
.draw-sw:hover { transform: scale(1.08); }
body.presenting .draw-bar, body.focus-mode .draw-bar { display: none; }

/* ================= Левая панель, вариант В: блоки, серое выделение, чёрные иконки ================= */
#leftRail { gap: 10px; }
#navBar, #toolbar, #undoBar { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px; border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .10), 0 0 0 1px rgba(0, 0, 0, .03); }
#leftRail .tool { width: 40px; height: 40px; border-radius: 8px; color: #1c1c1e; }
#leftRail .tool .ic { width: 24px; height: 24px; stroke-width: 2.2; }
#leftRail .tool:hover { background: #f1f1f4; }
#leftRail .tool.active { background: #ebebef; color: #1c1c1e; }
#leftRail .tool.more-tools { color: #1c1c1e; background: transparent; }
@media (min-width: 641px) { #leftRail .tool.more-tools { position: static; } }
#leftRail .tool.more-tools:hover { background: #f1f1f4; }
#undoBar .tool:disabled { color: #b9b9c3; opacity: 1; }
#undoBar .tool.rail-toggle { height: 28px; color: #6b6b80; }
#undoBar .tool.rail-toggle .ic { width: 20px; height: 20px; }
body.rail-collapsed #navBar, body.rail-collapsed #toolbar { display: none; }
body.viewer #toolbar { display: none; }
.draw-bar { border-radius: 10px; box-shadow: 0 1px 4px rgba(0, 0, 0, .10), 0 0 0 1px rgba(0, 0, 0, .03); }
.draw-bar .tool { width: 40px; height: 40px; color: #1c1c1e; }
.draw-bar .tool .ic { stroke-width: 2.2; }
@media (max-height: 860px) { #leftRail .tool { height: 36px; } #leftRail { gap: 8px; } }
@media (max-width: 640px) {
  #navBar, #toolbar, #undoBar { flex-direction: row; padding: 4px; }
  #undoBar .tool.rail-toggle, #navBar .tool[data-tool="hand"] { display: none; }
  #leftRail .tool.more-tools { background: #fff; }
}

/* ================= Доска по наброскам: выделение, плюсы, пустая доска, тише интерфейс, логотип ================= */
.sel-box { border-color: var(--accent); }
.handle { width: 12px; height: 12px; border-width: 2px; border-radius: 50%; box-shadow: 0 1px 2px rgba(5, 0, 56, .18); }
.handle.n, .handle.s { width: 18px; height: 8px; border-radius: 4px; }
.handle.e, .handle.w { width: 8px; height: 18px; border-radius: 4px; }
/* поворот: невидимая зона снаружи уголка, курсор — стрелка по кругу */
.handle.rot-zone { width: 18px; height: 18px; background: transparent; border: 0; box-shadow: none; z-index: 1;
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path d='M19 12a7 7 0 1 1-2.05-4.95' fill='none' stroke='white' stroke-width='4' stroke-linecap='round'/><path d='M19 12a7 7 0 1 1-2.05-4.95' fill='none' stroke='%23050038' stroke-width='2' stroke-linecap='round'/><path d='M17.5 3.5v4h-4' fill='none' stroke='%23050038' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>") 12 12, grab; }
.handle.rot-zone::after { display: none; }
/* «+»: только у края, к которому подвели мышь */
.handle.plus { opacity: 0; width: 22px; height: 22px; background: var(--accent); border: 2px solid #fff; transition: opacity .15s; box-shadow: 0 2px 6px rgba(66, 98, 255, .4); }
.handle.plus.near { opacity: 1; }
.handle.plus:hover { opacity: 1; }
/* тише интерфейс: без вечной точки «подключено» (о пропаже связи скажет плашка), без лишних кнопок внизу */
#connDot { display: none !important; }
#btnFrames, #btnLayers, #zoombar > .tb-sep:first-of-type { display: none; }
/* логотип: стопка стикеров */
.brand-mark { width: 28px; height: 28px; flex: none; display: block; }
.logo.wordmark { display: flex; align-items: center; gap: 7px; }
/* пустая доска */
.start-card { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 55; width: min(680px, calc(100vw - 32px)); padding: 24px; border-radius: 16px;
  box-shadow: 0 18px 50px rgba(5, 0, 56, .16), 0 0 0 1px rgba(5, 0, 56, .05); animation: startIn .25s ease; }
@keyframes startIn { from { opacity: 0; transform: translate(-50%, -46%); } }
.start-card h3 { margin: 0 0 4px; font-size: 20px; }
.start-card p { margin: 0 0 18px; color: var(--muted2, #6b6b8a); font-size: 14px; }
.start-x { position: absolute; top: 14px; right: 14px; }
.start-tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.start-tile { border: 0; background: none; padding: 0; cursor: pointer; text-align: left; font: 500 13px var(--font); color: var(--ink); display: flex; flex-direction: column; gap: 8px; }
.start-pic { display: grid; place-items: center; height: 76px; border-radius: 10px; background: #f4f4f6; box-shadow: inset 0 0 0 1px #e6e6ec; overflow: hidden; transition: box-shadow .15s; }
.start-pic svg { width: 100%; height: 100%; }
.start-pic.blank { background: var(--accent); box-shadow: none; color: #fff; }
.start-pic.blank .ic { width: 30px; height: 30px; }
.start-tile:hover .start-pic { box-shadow: inset 0 0 0 2px var(--accent); }
.start-tile:hover .start-pic.blank { box-shadow: none; filter: brightness(1.08); }
.start-all { margin-top: 16px; border: 0; background: none; padding: 0; color: var(--accent); font: 600 14px var(--font); cursor: pointer; }
@media (max-width: 640px) { .start-tiles { grid-template-columns: repeat(3, 1fr); } .start-card { top: 45%; } }
/* большая доска: во время движения слой — готовая картинка (см. applyCamera) */
#world.moving { will-change: transform; }

/* сетка — отдельный слой (#grid): при прокрутке сдвигается готовой картинкой, фон не перерисовывается на каждом кадре */
#viewport, #viewport[data-grid], body.dark-board #viewport, body.dark-board #viewport[data-grid] { background-image: none !important; }
#grid { position: absolute; left: 0; top: 0; pointer-events: none; will-change: transform; background-image: radial-gradient(var(--dot) 1.2px, transparent 1.3px); }
body.dark-board #grid { background-image: radial-gradient(#4a4d55 1.2px, transparent 1.3px); }
#viewport[data-grid="lines"] #grid { background-image: linear-gradient(to right, #e3e3e8 1px, transparent 1px), linear-gradient(to bottom, #e3e3e8 1px, transparent 1px); }
body.dark-board #viewport[data-grid="lines"] #grid { background-image: linear-gradient(to right, #3a3d44 1px, transparent 1px), linear-gradient(to bottom, #3a3d44 1px, transparent 1px); }
#viewport[data-grid="none"] #grid, body.presenting #grid, body.proto-mode #grid { display: none; }

/* проверка скорости доски */
.speed-shade { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); z-index: 9999; background: #1a1a2e; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.2); pointer-events: none; }
.speed-table { width: 100%; border-collapse: collapse; margin: 8px 0 10px; font-size: 14px; }
.speed-table td { padding: 6px 4px; border-bottom: 1px solid var(--line, #eceef2); }
.speed-table td:last-child { text-align: right; font-weight: 600; }
.speed-table td.ok { color: #1b8a4b; } .speed-table td.mid { color: #b7791f; } .speed-table td.bad { color: #d64545; }
.speed-verdict { margin: 4px 0 6px; line-height: 1.45; }

/* отдалённый вид большой доски: рисунки одной картинкой (render.js, lodRender) */
#lodLayer { position: absolute; pointer-events: none; display: none; }
#world.lod #lodLayer { display: block; }
#world.lod #svgLayer g.pth:not(.lod-live) { display: none; }

/* «Дописать из Miro» после импорта через API (miro.js showFinish) */
.miro-finish { position: fixed; left: 50%; top: 64px; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; max-width: min(860px, calc(100vw - 32px)); }
.miro-finish .mf-text { display: flex; flex-direction: column; gap: 2px; font-size: 13px; line-height: 1.4; color: var(--muted2, #5b5b7a); }
.miro-finish .mf-text b { color: var(--text, #1a1a2e); font-size: 14px; }
.miro-finish button { flex: none; white-space: nowrap; }
@media (max-width: 720px) { .miro-finish { flex-wrap: wrap; top: 60px; } }

/* экран загрузки доски (core.js B.loadingText) */
.board-loading { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(242, 243, 245, .55); }
body.dark-board .board-loading { background: rgba(30, 32, 38, .55); }
.board-loading.hidden { display: none; }
.bl-card { display: flex; align-items: center; gap: 12px; background: var(--panel); color: var(--text); padding: 14px 20px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14.5px; font-weight: 500; }
.bl-spin { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid var(--accent-soft); border-top-color: var(--accent); animation: bl-spin .8s linear infinite; flex: none; }
@keyframes bl-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .bl-spin { animation-duration: 2.4s; } }

/* исчезающие чернила (ink.js): слой поверх объектов, штрихи гаснут плавно */
#inkLayer { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; z-index: 5; }
#inkLayer .ink-stroke { transition: opacity .9s ease; }
#inkLayer .ink-stroke.fade { opacity: 0; }
#viewport[data-tool="ink"] { cursor: crosshair; }

/* исчезающие чернила: задержка исчезания в колонке карандаша */
.draw-delay { width: 44px; height: 30px; border: 0; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font: 600 12.5px var(--font); cursor: pointer; margin-top: 2px; }
.draw-delay:hover { background: #e2e7ff; }
.draw-delays { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 8px; max-width: 240px; }
.draw-delay-opt { min-width: 52px; height: 32px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); font: 500 13px var(--font); cursor: pointer; }
.draw-delay-opt.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* Word-документ (.docx) на доске: страница рисуется внутри (wdoc.js) */
.docx-host { position: absolute; inset: 0; overflow: hidden; pointer-events: none; background: #fff; }
.item.docx .doc-page { display: none; }
.item.docx.loading .docx-host { opacity: 0; }
.item.doc.docx .doc-pager { display: none; }

/* картинка из Word-документа, которую тянут на доску */
.doc-img-ghost { position: fixed; z-index: 2147483000; pointer-events: none; opacity: .85; box-shadow: 0 8px 24px rgba(16, 24, 40, .25); border-radius: 4px; }
