/* Chirk v3.11.0 — компактная панель инструментов, текст, группы, вставка изображений, экран профиля.
   Цвета «Классического» оформления задаются здесь; «Тёплый графит» переопределяет их в theme.css. */

/* ───────── Панель инструментов: только иконки, подсказка при наведении ───────── */
.tool-btn.icon-only {
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  justify-content: center;
}

.tool-btn.icon-only .tool-icon {
  width: 20px;
  height: 20px;
}

.tool-icon-text svg,
.hotkey-icon-text svg,
.tool-icon-image svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool-icon-image .image-plus {
  stroke-width: 2.4;
}

.tool-btn:focus-visible,
.selection-action-btn:focus-visible,
.profile-chip:focus-visible,
.board-account-pill:focus-visible,
.profile-menu-item:focus-visible,
.text-size-control select:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 2px;
}

.tool-btn.icon-only.active {
  box-shadow: 0 0 0 2px #bfdbfe, 0 10px 24px rgba(37, 99, 235, 0.3);
}

.tool-add-image {
  border-color: rgba(147, 197, 253, 0.45);
}

.text-size-control {
  height: 38px;
  padding: 0 8px 0 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #d1d5db;
  font-weight: 700;
}

.text-size-control.hidden {
  display: none;
}

.text-size-control select {
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: #1f2937;
  color: #f9fafb;
  font: inherit;
  padding: 0 4px;
}

#boardCanvas[data-tool="text"] {
  cursor: text;
}

#zoomValue {
  min-width: 52px;
  text-align: center;
  display: inline-block;
}

/* ───────── Редактор текста на холсте ───────── */
.board-text-editor {
  position: fixed;
  z-index: 30;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.85), 0 0 0 4px rgba(37, 99, 235, 0.15);
  border-radius: 2px;
  resize: none;
  overflow: hidden;
  white-space: pre;
  font-weight: 400;
  font-style: normal;
  letter-spacing: normal;
  tab-size: 4;
}

.board-text-editor.hidden {
  display: none;
}

/* ───────── Действия с выделением ───────── */
.selection-actions {
  position: fixed;
  z-index: 28;
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.92);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.25);
}

.selection-actions.hidden {
  display: none;
}

.selection-action-btn {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.selection-action-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.selection-action-btn.hidden {
  display: none;
}

/* ───────── Сообщение о загрузке / ошибке вставки ───────── */
.board-toast {
  position: fixed;
  left: 50%;
  bottom: 64px;
  z-index: 40;
  transform: translateX(-50%);
  max-width: min(640px, calc(100vw - 32px));
  padding: 10px 16px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.94);
  color: #f8fafc;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.28);
}

.board-toast.hidden {
  display: none;
}

.board-toast[data-kind="error"] {
  background: #7f1d1d;
}

.board-toast[data-kind="ok"] {
  background: #14532d;
}

.board-toast[data-kind="busy"]::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  vertical-align: -1px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: chirk-spin 0.8s linear infinite;
}

@keyframes chirk-spin {
  to { transform: rotate(360deg); }
}

/* ───────── Горячие клавиши: занятое сочетание ───────── */
[data-hotkey].hotkey-conflict {
  border-color: #ef4444 !important;
  color: #b91c1c !important;
  background: #fef2f2 !important;
}

/* ───────── Экран выбора профиля ───────── */
#menuScreen .profile-gate {
  width: 100%;
  display: flex;
  justify-content: center;
}

#menuScreen .profile-gate.hidden,
#menuScreen .simple-menu-layout.hidden {
  display: none;
}

.profile-gate-card {
  position: relative;
  width: min(460px, 100%);
}

.profile-gate-title {
  margin: 6px 0 16px;
  color: #334155;
  font-size: 20px;
  font-weight: 900;
}

.profile-gate-notice {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #7c2d12;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.profile-gate-notice.hidden,
.profile-gate-recent.hidden,
.profile-gate-retry.hidden {
  display: none;
}

.profile-gate-retry {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid #fdba74;
  background: #fff;
  color: #7c2d12;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.profile-gate-card .simple-menu-field input,
.profile-gate-card .simple-menu-field select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  background: #fff;
  color: #0f172a;
  font: inherit;
  font-size: 16px;
}

.profile-gate-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.profile-gate-actions .simple-menu-primary {
  margin: 0;
}

.profile-gate-create {
  min-height: 48px;
  border-radius: 16px;
  border: 1px solid rgba(37, 99, 235, 0.35);
  background: #eff6ff;
  color: #1d4ed8;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.profile-gate-note {
  margin: 14px 0 0;
  color: #64748b;
  font-size: 13px;
  line-height: 1.4;
}

/* ───────── Главный экран: логотип и профиль ───────── */
.menu-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.menu-card-head .simple-menu-logo {
  margin-bottom: 0;
}

.ui-theme-switch-home.ui-theme-switch-inline {
  position: static;
  justify-items: start;
  margin-bottom: 14px;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 10px;
}

.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
  min-height: 44px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: #fff;
  color: #0f172a;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.profile-chip:hover {
  border-color: #2563eb;
}

.profile-chip .local-account-avatar {
  width: 34px;
  height: 34px;
  font-size: 15px;
  box-shadow: none;
}

.profile-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-chip-caret {
  color: #64748b;
  font-size: 12px;
}

button.board-account-pill {
  border: 0;
  font: inherit;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

button.board-account-pill:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ───────── Меню профиля и настройки ───────── */
.profile-menu-popover {
  position: fixed;
  z-index: 70;
  min-width: 230px;
  padding: 8px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.22);
  display: grid;
  gap: 2px;
}

.profile-menu-popover.hidden {
  display: none;
}

.profile-menu-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  margin-bottom: 4px;
}

.profile-menu-head .local-account-avatar {
  width: 36px;
  height: 36px;
  font-size: 15px;
  box-shadow: none;
}

.profile-menu-head-text {
  display: grid;
  min-width: 0;
}

.profile-menu-head-text b {
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-menu-head-text span {
  color: #64748b;
  font-size: 12px;
}

.profile-menu-item {
  min-height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #0f172a;
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}

.profile-menu-item:hover {
  background: #eff6ff;
}

#profileLogoutBtn {
  color: #b91c1c;
}

.profile-settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.45);
}

.profile-settings-overlay.hidden {
  display: none;
}

.profile-settings-card {
  width: min(440px, 100%);
  padding: 18px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.3);
}

.profile-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.profile-settings-title {
  font-size: 20px;
  font-weight: 900;
  color: #0f172a;
}

.profile-settings-body.local-account-card.profile-card {
  margin: 0 0 12px;
}

.profile-settings-name {
  font-size: 18px;
  font-weight: 900;
  color: #0f172a;
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-settings-danger {
  display: flex;
  justify-content: flex-end;
}

/* ───────── Узкий экран ───────── */
@media (max-width: 720px) {
  .profile-gate-actions {
    grid-template-columns: 1fr;
  }

  .menu-card-head .simple-menu-logo {
    font-size: 42px;
  }

  .profile-chip {
    max-width: 160px;
  }

  .tool-btn.icon-only {
    min-width: 40px;
    min-height: 40px;
  }
}

/* Широкое окно: инструменты в одну строку (подписи убраны, места хватает). */
@media (min-width: 1240px) {
  .toolbar .tools,
  .toolbar .right-tools {
    flex-wrap: nowrap;
  }
}

.right-tools .tool-btn,
.right-tools .color-label {
  white-space: nowrap;
}
