/* Доска занимает свободную высоту окна: своей прокрутки у неё нет. */
#screen-board {
  overflow: hidden;
  background: #f4f6f8;
  border-radius: calc(18px * var(--ui-scale));
  flex: 1 1 auto;
  min-height: calc(100dvh - var(--header-h) - var(--space) * 3);
  height: calc(100dvh - var(--header-h) - var(--space) * 3);
  color: #152033;
}
body.board-focus #screen-board { height: 100dvh; min-height: 100dvh; }
body.board-focus #app > header.top { display: none !important; }
.academ-board { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.academ-board.board-focus .board-bar,
.academ-board.board-focus .solid-panel,
.academ-board.board-focus .board-formula-dock,
.academ-board.board-focus .board-sheet,
.academ-board.board-focus .academ-videos { display: none !important; }
.board-focus-exit {
  /* Справа, но ниже кнопки/панели «Библиотека» Excalidraw. */
  position: fixed; top: 72px; right: 12px; z-index: 80;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.18);
}
.board-workspace {
  flex: 1; min-height: 0; min-width: 0;
  display: flex; flex-direction: column;
}
.board-workspace.with-solid {
  flex-direction: row;
  align-items: stretch;
}
.academ-board-canvas { flex: 1; min-height: 0; min-width: 0; position: relative; }
.academ-board-canvas .excalidraw { height: 100%; }
.academ-board-canvas.paint-erase { cursor: none; }
.academ-board-canvas.paint-erase canvas {
  cursor: none !important;
  touch-action: none;
}
.board-erase-hint {
  flex: 0 0 auto; flex-basis: auto !important;
  margin: 0; padding: 6px 12px;
  background: #fff7e6; border-bottom: 1px solid #f0d9a8; color: #7a4b00;
}
.board-erase-brush {
  display: none; position: absolute; z-index: 6; pointer-events: none;
  border: 2px solid #dc2626; border-radius: 50%;
  background: rgba(252, 165, 165, 0.35);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.8);
}
.academ-videos { display: flex; gap: 8px; overflow: auto; background: #fff; padding: 8px; }
.academ-videos video { max-height: 140px; background: #111; }
.board-app { display: flex; flex-direction: column; min-height: 0; flex: 1; height: 100%; color: #111; }
.board-bar {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: stretch;
  padding: 10px 12px; color: #152033;
  background:
    linear-gradient(180deg, #ffffff 0%, #f5f7fb 100%);
  border-bottom: 1px solid #e2e6ef;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.7);
}
.board-tool-group {
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid #e6eaf2;
  border-radius: 14px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
}
.board-tool-grow { flex: 1 1 220px; }
.board-tool-end {
  margin-left: auto;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  padding-right: 0;
}
.board-tool-label {
  font-size: 11px; line-height: 1; letter-spacing: 0.06em;
  text-transform: uppercase; color: #7a8494; font-weight: 700;
}
.board-tool-row {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.board-bar button, .board-bar select, .board-bar input, .board-bar .board-file {
  display: inline-flex; align-items: center; justify-content: center;
  width: auto; min-height: 34px; margin: 0; color: #152033;
  padding: 0 12px; font-size: 13px; font-weight: 600;
  border: 1px solid #d7dde8; border-radius: 10px; background: #f8f9fc;
}
.board-bar select { min-width: 112px; max-width: 200px; }
.board-bar .board-select-wide { min-width: 150px; max-width: 260px; flex: 1 1 150px; }
.board-bar .board-select-subject { min-width: 130px; max-width: 170px; }
.board-bar input.board-bank-search {
  min-width: 150px; max-width: 230px; flex: 1 1 150px;
  font-weight: 500; background: #fff;
}
.board-bar select:disabled { opacity: 0.6; }
.board-bar input.board-name {
  min-width: 120px; max-width: none; flex: 1 1 140px;
  font-weight: 500; background: #fff;
}
.board-bar button:hover, .board-bar .board-file:hover { background: #eef2f8; border-color: #c5ccd8; }
.board-bar button.on {
  background: #152033; color: #fff; border-color: #152033;
}
.board-bar button.primary,
.board-bar .board-focus-btn {
  background: #152033; color: #fff; border-color: #152033;
}
.board-bar button.primary:hover,
.board-bar .board-focus-btn:hover { background: #243247; border-color: #243247; }
.board-hint { margin: 0; flex-basis: 100%; color: #445; font-size: 13px; }
.board-file { cursor: pointer; }
.solid-panel {
  display: flex; flex-direction: column; flex-wrap: nowrap;
  gap: 8px; align-items: stretch; align-self: stretch;
  flex: 0 0 min(42vw, 520px); width: min(42vw, 520px); max-width: 520px;
  min-width: 300px; min-height: 0; height: auto; max-height: 100%;
  overflow: auto;
  padding: 10px 12px; box-sizing: border-box;
  background: #fff; border-right: 1px solid #d5dbe3;
}
.solid-panel .board-hint { flex-basis: auto; margin: 0; }
.solid-panel .solid-toolbar { flex-wrap: wrap; }
.board-formula-dock {
  flex: 0 0 auto;
  display: flex; flex-direction: column; gap: 8px;
  margin: 0; padding: 10px 12px 12px;
  border-bottom: 1px solid #d5dbe3; background: #f4f7fc;
}
.board-formula-dock-head {
  display: flex; flex-wrap: wrap; gap: 10px 16px;
  align-items: flex-start; justify-content: space-between;
}
.board-formula-dock-head strong { display: block; font-size: 0.98rem; }
.board-formula-dock-head .muted { margin: 4px 0 0; }
.board-formula-dock-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.board-formula-dock-body {
  padding: 10px 12px; border-radius: 12px; border: 1px solid #d8dee9; background: #fff;
}
.board-formula-dock-body .desk-eq-ribbon { max-height: 180px; }
.board-formula-dock-body .desk-eq-field {
  width: 100%; min-height: 64px; font-size: 1.35rem;
}
.board-formula-dock-note { margin: 0; color: #9c4a00; }
.solid-chrome { display: flex; flex-direction: column; gap: 6px; flex: 0 0 auto; }
.solid-toolbar-top {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.solid-toolbar-title { flex: 1 1 auto; font-size: 0.98rem; color: #152033; }
.solid-close-btn {
  flex: 0 0 auto !important;
  margin: 0 !important;
  padding: 8px 14px !important;
  border-radius: 8px !important;
  border: none !important;
  background: #dc2626 !important;
  color: #fff !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.28);
}
.solid-close-btn:hover { background: #b91c1c !important; }
.solid-toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; width: 100%; }
.solid-toolbar button {
  margin-top: 0 !important; width: auto !important; display: inline-flex !important;
  padding: 6px 10px; border: 1px solid #c9d2de; border-radius: 8px;
  background: #fff; color: #152033; cursor: pointer;
}
.solid-toolbar button.on { background: #111 !important; color: #fff !important; border-color: #111 !important; }
.solid-toolbar-fields { align-items: flex-end; }
.solid-field {
  display: inline-flex; flex-direction: column; align-items: stretch; gap: 3px;
  min-width: 11rem; max-width: 100%;
}
.solid-field span { font-size: 11px; color: #5b6f82; line-height: 1.2; }
.solid-field-color { min-width: 0; }
.solid-select,
.solid-toolbar select.solid-select {
  display: inline-block !important;
  width: auto !important;
  min-width: 11rem;
  max-width: 100%;
  margin-top: 0 !important;
  height: 34px;
  padding: 4px 10px !important;
  border: 1px solid #c9d2de !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  color: #102033 !important;
  font-size: 13px !important;
  line-height: 1.2;
}
.solid-toolbar input[type="color"] {
  display: inline-block !important; width: 42px !important; height: 34px;
  margin-top: 0 !important; padding: 2px !important;
  border: 1px solid #c9d2de; border-radius: 8px; background: #fff; cursor: pointer;
}
.solid-layout-btns { display: inline-flex; flex-wrap: wrap; gap: 4px; flex: 0 0 auto; }
.solid-toolbar-top .solid-layout-btns button {
  padding: 6px 10px; font-size: 12px;
}
.solid-toolbar-tools { gap: 6px; }
.solid-toolbar-note { margin: 0; width: 100%; line-height: 1.35; }
.solid-swatches { display: inline-flex; gap: 4px; align-items: center; margin-left: 4px; }
.solid-field-color { min-width: 0 !important; justify-content: center; }
.solid-swatch {
  width: 18px; height: 18px; padding: 0; border-radius: 4px;
  border: 2px solid transparent; cursor: pointer;
}
.solid-swatch.on { border-color: #111; }
.solid-stage {
  width: 100%; height: 360px; max-width: 100%;
  margin: 0;
  border: 1px solid #d5dbe3; border-radius: 10px; overflow: hidden; background: #f7f8fa;
  flex: 0 0 auto;
  position: relative;
}
.solid-stage canvas { display: block; width: 100%; height: 100%; }
.solid-panel.solid-layout-panel {
  overflow: auto;
  height: auto;
  max-height: 100%;
}
.solid-panel.solid-layout-panel .solid-chrome { flex: 0 0 auto; }
.solid-panel.solid-layout-panel .solid-stage {
  flex: 0 0 auto;
  width: 100%;
  height: 360px;
}
.solid-panel.solid-layout-page {
  position: fixed; inset: 0; z-index: 96;
  width: auto; max-width: none; min-width: 0;
  flex: 0 0 0; margin: 0; border-right: 0; background: #fff;
  padding: 12px 14px 16px; overflow: hidden;
  box-sizing: border-box;
  height: auto; max-height: none;
}
.solid-panel.solid-layout-page .solid-chrome {
  flex: 0 0 auto;
}
.solid-panel.solid-layout-page .solid-stage {
  flex: 1 1 0; width: 100%; height: auto; min-height: 0;
  max-width: none; margin: 0; border-radius: 12px;
}
@media (max-width: 900px) {
  .board-workspace.with-solid { flex-direction: column; }
  .solid-panel {
    flex: 0 0 auto; width: 100%; max-width: none; min-width: 0;
    border-right: 0; border-bottom: 1px solid #d5dbe3;
    height: auto; max-height: none;
  }
}
.board-sheet {
  position: fixed; inset: 0; z-index: 90; background: rgba(18, 24, 38, 0.5);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.board-sheet-panel {
  position: relative; width: min(480px, 100%); max-height: min(88vh, 640px);
  overflow: hidden; display: flex; flex-direction: column;
  background: #fff; border-radius: 18px;
  box-shadow: 0 18px 48px rgba(18, 24, 38, 0.22);
}
.board-sheet-panel header {
  position: relative; padding: 18px 56px 10px 20px; box-sizing: border-box;
}
.board-sheet-panel header h2 { margin: 0 0 6px; font-size: 1.15rem; }
.board-sheet-panel header .muted { margin: 0; }
.board-sheet-close {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  width: 40px; height: 40px; margin: 0; padding: 0; border: 0;
  border-radius: 10px; background: #eef1f6;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: transparent; font-size: 0; line-height: 0;
  overflow: hidden;
}
.board-sheet-close::before,
.board-sheet-close::after {
  content: "";
  position: absolute; left: 50%; top: 50%;
  width: 16px; height: 2px; margin: -1px 0 0 -8px;
  background: #1f2937; border-radius: 1px;
}
.board-sheet-close::before { transform: rotate(45deg); }
.board-sheet-close::after { transform: rotate(-45deg); }
.board-sheet-body { padding: 4px 16px 8px; overflow: auto; flex: 1; min-height: 0; }
.board-sheet-foot {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; align-items: center;
  padding: 14px 18px 16px; border-top: 1px solid #e8ebf1;
}
.glue-format {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px;
}
.glue-format label {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border: 1px solid #d7dbe5; border-radius: 10px;
  background: #f7f8fb; cursor: pointer; font-weight: 600; color: #334;
}
.glue-format label.on { background: #152033; color: #fff; border-color: #152033; }
.glue-format input { margin: 0; }
.glue-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.glue-row {
  display: flex; gap: 10px; align-items: center; justify-content: space-between;
  border: 1px solid #e6e8ee; border-radius: 12px; padding: 8px 10px; background: #f7f9fc;
}
.glue-row.off { opacity: 0.55; background: #fff; }
.glue-check {
  display: flex !important;
  flex-direction: row !important;
  gap: 10px;
  align-items: center;
  min-width: 0;
  flex: 1 1 auto;
  margin: 0 !important;
  cursor: pointer;
  color: #152033 !important;
  font-size: 0.95rem;
  font-weight: 600;
}
.glue-check input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px !important;
  height: 18px;
  margin: 0 !important;
  padding: 0;
  accent-color: #3b6cff;
}
.glue-page {
  flex: 0 0 28px; height: 28px; border-radius: 8px; background: #111; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.glue-row.off .glue-page { background: #c5cad3; }
.glue-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #152033;
}
.glue-move { display: inline-flex; gap: 4px; flex: 0 0 auto; }
.glue-move button { min-width: 36px; padding: 6px 8px; }
.formula-group { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.formula-live { display: flex; gap: 6px; align-items: center; min-height: 52px; padding: 4px 8px; background: #f7f8fa; border-radius: 8px; }
.formula-slot { width: 52px; text-align: center; }
.formula-frac { display: inline-flex; flex-direction: column; align-items: stretch; }
.formula-frac > .formula-slot:first-child { border-bottom: 1px solid #111; }
.formula-script, .formula-root, .formula-fence, .formula-lim, .formula-big { display: inline-flex; align-items: center; gap: 2px; }
.formula-scripts { display: inline-flex; flex-direction: column; }
.board-bar label {
  display: inline-flex; align-items: center; gap: 6px;
  width: auto; margin: 0;
}
.board-width { width: 90px; padding: 0; }
.board-bank label { display: block; width: auto; }
.board-bank select { display: block; width: 100%; margin-top: 4px; }
.board-stage {
  position: relative; flex: 1; overflow: hidden; touch-action: none;
  background-color: #f7f8fa;
  background-image: linear-gradient(#e4e9ef 1px, transparent 1px), linear-gradient(90deg, #e4e9ef 1px, transparent 1px);
  background-size: 28px 28px;
}
.board-world { position: absolute; inset: 0; transform-origin: 0 0; }
.board-item {
  position: absolute; min-width: 36px; min-height: 28px; color: #111;
  font-family: "Manrope", "Segoe UI", sans-serif;
}
.board-item.on { outline: 2px solid #111; outline-offset: 2px; }
.board-note { background: #fff4c2; color: #111; padding: 8px; border-radius: 8px; white-space: pre-wrap; }
.board-text, .board-chem { background: #fff; color: #111; padding: 8px; border: 1px solid #111; white-space: pre-wrap; }
.board-chem sup, .board-chem sub { line-height: 0; }
.board-shape, .board-pen { background: transparent; overflow: visible; }
.board-shape svg, .board-pen svg { width: 100%; height: 100%; overflow: visible; }
.board-image, .board-video { background: #fff; border: 1px solid #111; }
.board-image img, .board-video video { width: 100%; height: 100%; object-fit: contain; display: block; background: #fff; }
.board-task { background: #fff; color: #111; border: 1px solid #111; padding: 8px; overflow: auto; }
.board-task p { margin: 0 0 6px; white-space: pre-wrap; }
.board-task button { margin: 0 6px 6px 0; }
.board-bank {
  position: absolute; top: 8px; right: 8px; width: min(320px, 90%);
  max-height: 70%; overflow: auto; background: #fff; color: #111;
  border: 1px solid #111; padding: 8px; z-index: 3;
}
.board-bank button { display: block; width: 100%; text-align: left; margin-top: 6px; color: #111; background: #f4f6f8; }
.board-file input { display: none; }
img[src*="/academ/telegram/"] { animation: academ-float 2.4s ease-in-out infinite; }
@keyframes academ-float { 50% { transform: translateY(-6px); } }

/* ——— Компактная панель доски: одна-две строки вместо пяти карточек ———
   Группы стоят в ряд без рамок, подписи — короткие маркеры слева,
   высота элементов 30px. Холст получает освободившиеся ~150px. */
.board-bar {
  gap: 4px 6px; padding: 5px 8px; align-items: center;
  background: #fff;
}
.board-tool-group {
  flex-direction: row; align-items: center; gap: 4px;
  padding: 0 8px 0 0; background: transparent; border: 0; border-radius: 0;
  box-shadow: none; border-right: 1px solid #e6eaf2;
}
.board-tool-group:last-child, .board-tool-end { border-right: 0; padding-right: 0; }
.board-tool-grow { flex: 0 1 auto; }
.board-tool-label {
  font-size: 10px; letter-spacing: 0.04em; color: #8a93a3; writing-mode: horizontal-tb;
  white-space: nowrap;
}
.board-tool-row { flex-wrap: nowrap; gap: 4px; }
.board-bar button, .board-bar select, .board-bar input, .board-bar .board-file {
  min-height: 30px; height: 30px; padding: 0 9px; font-size: 12.5px; border-radius: 8px;
}
.board-bar select { min-width: 96px; max-width: 170px; }
.board-bar .board-select-subject { min-width: 110px; max-width: 140px; }
.board-bar .board-select-wide { min-width: 140px; max-width: 240px; }
.board-bar input.board-bank-search { min-width: 120px; max-width: 190px; }
.board-bar input.board-name { min-width: 90px; max-width: 140px; flex: 0 1 120px; }
.board-tool-end { margin-left: auto; }
@media (max-width: 1100px) {
  .board-tool-label { display: none; }
  .board-tool-row { flex-wrap: wrap; }
}
/* На экране доски шапка сайта тоньше: остальное место — холсту. */
body:has(#screen-board:not([hidden])) { --brand-ico: calc(30px * var(--ui-scale)); }
body:has(#screen-board:not([hidden])) #app > header.top { padding-top: 3px; padding-bottom: 3px; min-height: 0; }
body:has(#screen-board:not([hidden])) #screen-board {
  height: calc(100dvh - var(--header-h) - var(--space) * 2);
  min-height: calc(100dvh - var(--header-h) - var(--space) * 2);
}
/* Выбор доски преподавателя онлайн-школы (в шапке, только на экране доски) */
.board-teacher { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.board-teacher[hidden] { display: none; }
.board-teacher select { height: 30px; padding: 0 8px; border-radius: 999px; font-size: 12.5px; }
.board-teacher-busy { font-style: normal; color: #b45309; background: #fff7e6; border-radius: 999px; padding: 2px 8px; }
.board-teacher-busy[hidden] { display: none; }

/* ===== Широкая доска: на экране доски поля страницы почти убраны. ===== */
#app:has(#screen-board:not([hidden])) { padding-left: 6px; padding-right: 6px; }
#app:has(#screen-board:not([hidden])) #screen-board { border-radius: 12px; }

/* ===== Панель инструментов Excalidraw — вертикально, у левого края холста. ===== */
.board-app .App-menu_top .shapes-section {
  position: absolute; left: 0; top: 54px; z-index: 4;
  width: auto; margin: 0; pointer-events: none;
}
.board-app .App-menu_top .shapes-section > div,
.board-app .App-menu_top .shapes-section .Stack_vertical,
.board-app .App-menu_top .shapes-section .App-toolbar-container { width: auto; }
.board-app .App-menu_top .shapes-section .App-toolbar { pointer-events: auto; padding: 4px; }
.board-app .App-menu_top .shapes-section .App-toolbar > .Stack_horizontal {
  display: flex !important; flex-direction: column; flex-wrap: nowrap; gap: 2px; align-items: center; justify-content: flex-start; height: auto !important;
  max-height: calc(100dvh - 300px); min-height: 0; overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin;
}
.board-app .App-menu_top .shapes-section .App-toolbar__divider { width: 24px; height: 1px; margin: 3px auto; }
.board-app .App-menu_top .shapes-section .HintViewer {
  position: fixed; left: 50%; top: auto; bottom: 18px; transform: translateX(-50%);
  width: auto; max-width: 60vw; pointer-events: none; opacity: 0.85;
}
/* Панель свойств выделенной фигуры уезжает правее вертикальной панели, чтобы не перекрывать её. */
.board-app .App-menu_top .App-menu_top__left { margin-left: 0; }
.board-app .App-menu_top .App-menu_top__left > :not(:first-child),
.board-app .App-menu__left { margin-left: 60px; }
.board-app .App-menu_top .shapes-section .App-toolbar > .Stack_horizontal > * { flex: 0 0 auto; margin: 0; }
.board-app .App-menu_top .shapes-section .ToolIcon { width: 34px; height: 34px; }
.board-app .App-menu_top .layer-ui__wrapper__top-right { grid-column: 3; justify-self: end; }

/* ===== «Папки» доски ===== */
.fld-overlay {
  position: fixed; inset: 0; z-index: 1200; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(15, 23, 42, 0.42); backdrop-filter: blur(2px);
}
.fld-overlay[hidden] { display: none; }
.fld-panel {
  width: min(1080px, 100%); max-height: calc(100dvh - 48px); display: flex; flex-direction: column; gap: 10px;
  padding: 18px 20px 14px; border-radius: 18px; background: #fff; color: #152033;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
}
.fld-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.fld-head h2 { margin: 0 0 2px; font-size: 1.35rem; }
.fld-head .fld-sub { margin: 0; color: #5b6f82; }
.fld-x {
  position: relative;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid #dfe5ec;
  background: #f6f8fa;
  cursor: pointer;
  font-size: 0;
  line-height: 0;
  color: transparent;
}
.fld-x::before,
.fld-x::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 15px;
  height: 2px;
  border-radius: 2px;
  background: #152033;
  transform: translate(-50%, -50%) rotate(45deg);
}
.fld-x::after { transform: translate(-50%, -50%) rotate(-45deg); }
.fld-x:hover { background: #eef1f6; }
.fld-x:focus-visible { outline: 2px solid #4f46e5; outline-offset: 2px; }
.fld-tabs { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid #e6ebf0; padding-bottom: 8px; }
.fld-tab {
  width: auto; margin: 0; padding: 7px 12px; border-radius: 999px; border: 1px solid #dfe5ec; background: #f6f8fa;
  color: #152033; font-weight: 600; font-size: 0.92rem; cursor: pointer;
}
.fld-tab span { display: inline-block; min-width: 1.4em; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: #e3e9f0; font-size: 0.78rem; color: #45576a; }
.fld-tab.on { background: #4f46e5; border-color: #4f46e5; color: #fff; }
.fld-tab.on span { background: rgba(255, 255, 255, 0.25); color: #fff; }
.fld-tab-add { background: #fff; border-style: dashed; color: #4f46e5; }
.fld-bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: center; }
.fld-bar > div { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fld-panel button.small, .fld-file { width: auto; margin: 0; min-height: 32px; padding: 6px 12px; font-size: 0.86rem; border-radius: 10px; }
.fld-file { display: inline-flex; align-items: center; cursor: pointer; }
.fld-file input { display: none; }
.fld-panel .danger-text { color: #c92a2a; }
.fld-note { margin: 0; min-height: 1.2em; font-size: 0.88rem; color: #45576a; }
.fld-note.bad { color: #c92a2a; }
.fld-grid {
  flex: 1 1 auto; min-height: 160px; overflow: auto; display: grid; gap: 12px; align-content: start;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); padding: 2px;
}
.fld-card { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid #e3e9f0; border-radius: 14px; background: #fbfcfd; }
.fld-thumb {
  position: relative; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: #eef2f6;
  display: flex; align-items: center; justify-content: center;
}
.fld-thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.fld-kind-big { font-size: 1.6rem; font-weight: 800; color: #9aa9b8; }
.fld-thumb .fld-kind { position: absolute; left: 6px; top: 6px; right: auto; bottom: auto; width: auto; height: auto; display: inline-block; white-space: nowrap; line-height: 1.4; padding: 2px 7px; border-radius: 6px; font-style: normal; font-size: 0.72rem; font-weight: 700; background: #1f2937; color: #fff; }
.fld-thumb .fld-kind.pdf { background: #c92a2a; }
.fld-thumb .fld-kind.excalidraw { background: #4f46e5; }
.fld-card h4 { margin: 0; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fld-meta { margin: 0; font-size: 0.8rem; color: #5b6f82; }
.fld-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.fld-actions button.small { min-height: 28px; padding: 4px 8px; font-size: 0.8rem; }
.fld-actions select { width: auto; min-height: 28px; margin: 0; padding: 2px 6px; font-size: 0.8rem; border-radius: 8px; }
.fld-empty { grid-column: 1 / -1; margin: 24px 0; text-align: center; color: #5b6f82; }
.fld-usage { margin: 0; }
@media (max-width: 640px) {
  .fld-overlay { padding: 8px; }
  .fld-panel { padding: 14px 12px; max-height: calc(100dvh - 16px); }
  .fld-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
.fld-panel .fld-file { background: #4f46e5; color: #fff; font-weight: 700; border: 0; }
.fld-panel .fld-file:hover { background: #4338ca; }
.fld-panel .fld-file:focus-within { outline: 2px solid #a5b4fc; outline-offset: 2px; }

/* Редактор формул (js/desk-math.js, MathLive) */
.desk-math { display: flex; flex-direction: column; gap: 8px; }
.desk-math-bar { display: flex; flex-wrap: wrap; gap: 4px; }
.desk-math-bar button {
  min-width: 34px; padding: 4px 8px; border-radius: 8px;
  border: 1px solid #d5dbe3; background: #f7f9fc; color: #152033;
  font: 600 14px/1.2 inherit; cursor: pointer;
}
.desk-math-bar button:hover, .desk-math-bar button:focus-visible { background: #e8eefc; border-color: #9fb4e8; }
.desk-math-field {
  display: block; width: 100%; min-height: 56px; box-sizing: border-box;
  padding: 8px 10px; font-size: 1.5rem;
  border: 1px solid #c9d2e0; border-radius: 10px; background: #fff;
}
.desk-math-field:focus-within { outline: 2px solid #6b7cff; outline-offset: 1px; }
.desk-math-src summary { cursor: pointer; font-size: 12px; color: #5b6479; }
.desk-math-src textarea {
  width: 100%; box-sizing: border-box; margin-top: 4px;
  font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  border: 1px solid #d5dbe3; border-radius: 8px; padding: 6px 8px;
}
