/* KISS: канва 80% + аккордеон 20%, fullscreen */

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px;
}

.page {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

/* ---------- Workspace (канва) ---------- */
.workspace {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 1rem;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  margin: 8px;
}

.canvas {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-width: 100%;
  position: relative;
}

.canvas__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.canvas__drawing {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  z-index: 3;
}

.canvas__drawing canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.canvas__header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.canvas__logo {
  flex-shrink: 0;
  height: 19px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
}

.canvas__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  white-space: pre-line;
  word-break: break-word;
  min-width: 0;
}

.canvas__body {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.canvas__body > .canvas__drawing {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  pointer-events: auto;
}

.canvas__strip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.canvas__strip_top {
  background: #2e7d32;
}

.canvas__strip_bottom {
  background: #c62828;
}

.canvas__strip-label {
  position: relative;
  white-space: pre-line;
  word-break: break-word;
}

.canvas__grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 100px 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 1px;
  background: transparent;
  border: 1px solid #ccc;
  border-radius: 6px;
  overflow: hidden;
  min-height: 200px;
}

.canvas-block {
  background: #fff;
  padding: 0.6rem;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  border: 1px solid #e0e0e0;
}

.canvas-block_title-bottom {
  display: flex;
  flex-direction: column;
}

.canvas-block__title_bottom {
  flex: 0 0 auto;
  padding-top: 0.4rem;
}

.canvas-block:nth-child(1) { grid-column: 1; grid-row: 1; }
.canvas-block:nth-child(2) { grid-column: 3; grid-row: 1; }
.canvas-block:nth-child(3) { grid-column: 1; grid-row: 2; }
.canvas-block:nth-child(4) { grid-column: 3; grid-row: 2; }

.canvas__center {
  grid-column: 2;
  grid-row: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  background: transparent;
  padding: 5px;
}

.canvas__center-placeholder {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: #ccc;
  border: 2px solid #999;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.canvas__center-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
}

.canvas__center-hint {
  font-size: 7rem;
  font-weight: 700;
  color: #1565c0;
  line-height: 1;
  letter-spacing: 0.02em;
}

/* Блок таблицы */
.canvas-block__title {
  margin: 0 0 0.4rem 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #212121;
  text-align: center;
}

.canvas-block__title_bottom {
  margin: 0;
  text-align: center;
}

.canvas-block__title_bottom .canvas-block__icon {
  opacity: 0.9;
}

.canvas-block__icon {
  font-style: normal;
  color: #757575;
}

.canvas-block__content {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  position: relative;
  font-size: 0.8125rem;
}

.canvas-block__content-inner {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  transform-origin: 0 0;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0.5rem;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}

.canvas-block__content-inner .canvas-block__col {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
}

.canvas-block__col {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  background: #fafafa;
  border: 1px solid #eee;
  overflow: hidden;
}

.canvas-block__th {
  flex: 0 0 auto;
  padding: 0.35rem 0.5rem;
  min-height: 2.5em;
  box-sizing: border-box;
  font-weight: 600;
  font-size: 0.7rem;
  color: #212121;
  text-align: left;
  line-height: 1.25;
  border-bottom: 1px solid #eee;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}

.canvas-block__cells {
  flex: 1 1 0;
  min-height: 0;
  overflow: auto;
  position: relative;
  padding: 0.35rem;
  background: #fff;
}

.canvas-block__cells-scaled {
  position: absolute;
  left: 0;
  top: 0;
}

.canvas-block__cells-inner {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transform-origin: 0 0;
}

.canvas-block__cell {
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  text-align: left;
  vertical-align: top;
  line-height: 1.35;
  min-height: 0;
  font-size: 1em; /* наследует от .canvas-block__cells-inner для масштаба без искажений */
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: pre-line;
  box-sizing: border-box;
}

/* Фоны ячеек по колонке (как в макете): аспект — зелёный, показатели — жёлтый, целевые — розовый */
.canvas-block__col.col-aspect .canvas-block__cell {
  background: #DAF4BE;
  border-color: rgba(76, 175, 80, 0.25);
}

.canvas-block__col.col-goal .canvas-block__cell {
  background: #FFFFBD;
  border-color: rgba(255, 193, 7, 0.35);
}

.canvas-block__col.col-target .canvas-block__cell {
  background: #FFC0D9;
  border-color: rgba(233, 30, 99, 0.2);
}

.canvas-block__col.col-extra .canvas-block__cell {
  background: #e8e8e8;
}

/* Верхние блоки: шапка — светло-голубая */
.canvas-block:nth-child(1) .canvas-block__th,
.canvas-block:nth-child(2) .canvas-block__th {
  background: #b7d9ed;
}

/* Нижние блоки: шапка — светло-оранжевая */
.canvas-block:nth-child(3) .canvas-block__th,
.canvas-block:nth-child(4) .canvas-block__th {
  background: #ffe0b2;
}

/* Редактируемый блок канвы (открыта соответствующая секция в меню) */
.canvas-block_editing {
  outline: 2px solid #1976d2;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(25, 118, 210, 0.15);
  z-index: 1;
}

/* ---------- Menu (аккордеон + бургер) ---------- */
.menu {
  position: relative;
  width: 20%;
  min-width: 200px;
  max-width: 320px;
  flex-shrink: 0;
  border-left: 1px solid #ddd;
  background: #fafafa;
  transition: width 0.2s ease, min-width 0.2s ease;
}

.menu.menu_collapsed {
  width: 48px;
  min-width: 48px;
  max-width: 48px;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
}

.menu.menu_collapsed .menu__panel {
  display: none;
}

.menu__collapsed-tools {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
}

/* В развёрнутом меню показываем только бургер и панель «Редактор», без инструментов рисования */
.menu:not(.menu_collapsed) .menu__export,
.menu:not(.menu_collapsed) .menu__draw-sep,
.menu:not(.menu_collapsed) .menu__draw-tools,
.menu:not(.menu_collapsed) .menu__draw-options,
.menu:not(.menu_collapsed) .menu__draw-history {
  display: none;
}

.menu.menu_collapsed .menu__collapsed-tools {
  width: 48px;
  min-width: 48px;
  overflow-x: hidden;
}

.menu__burger {
  width: 48px;
  height: 48px;
  padding: 0;
  border: none;
  border-left: 1px solid #ddd;
  border-bottom: 1px solid #ddd;
  border-radius: 0 0 0 6px;
  background: #f0f0f0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background 0.15s;
}

.menu__export {
  width: 48px;
  height: 48px;
  padding: 0;
  border: none;
  border-left: 1px solid #ddd;
  border-bottom: 1px solid #ddd;
  background: #f0f0f0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.menu__export:hover {
  background: #e5e5e5;
}

.menu__export-icon {
  width: 22px;
  height: 22px;
}

.menu__burger:hover {
  background: #e5e5e5;
}

.menu__burger:hover {
  background: #e5e5e5;
}

.menu__burger-line {
  display: block;
  width: 20px;
  height: 2px;
  background: #333;
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}

/* Разделитель и панель рисования (видны только в свернутом меню) */
.menu__draw-sep {
  width: 100%;
  height: 0;
  border-top: 1px solid #ddd;
  margin: 4px 0;
}

.menu__draw-tools,
.menu__draw-options {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 4px 6px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* В свёрнутой панели (48px) — вертикальный стек, без выхода за границы */
.menu.menu_collapsed .menu__draw-options {
  padding: 4px 2px;
  gap: 4px;
  overflow: hidden;
}

.menu.menu_collapsed .menu__draw-fill-mode {
  flex-direction: column;
  width: 100%;
}

.menu.menu_collapsed .menu__draw-fill-btn {
  width: 100%;
  padding: 4px 2px;
  font-size: 0.6rem;
  border-right: none;
  border-bottom: 1px solid #bdbdbd;
}

.menu.menu_collapsed .menu__draw-fill-btn:last-child {
  border-bottom: none;
}

.menu.menu_collapsed .menu__draw-colors {
  flex-direction: column;
  gap: 4px;
}

.menu.menu_collapsed .menu__draw-color-cell {
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.menu.menu_collapsed .menu__draw-color-label {
  font-size: 0.58rem;
  line-height: 1.2;
  text-align: center;
  word-break: break-all;
}

.menu.menu_collapsed .menu__draw-color {
  width: 28px;
  height: 22px;
  max-width: 28px;
  min-width: 28px;
  flex-shrink: 0;
}

.menu__draw-history {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
}

.menu__draw-tools {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px;
}

.menu__draw-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #f5f5f5;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #424242;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.menu__draw-btn:hover {
  background: #e8e8e8;
  color: #1976d2;
}

.menu__draw-btn_active,
.menu__draw-btn[aria-pressed="true"] {
  background: #1976d2;
  color: #fff;
  border-color: #1565c0;
}

.menu__draw-btn_active:hover,
.menu__draw-btn[aria-pressed="true"]:hover {
  background: #1565c0;
  color: #fff;
}

/* Режим: контур / заливка / оба — сегментированный переключатель */
.menu__draw-fill-mode {
  display: flex;
  width: 100%;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #bdbdbd;
  background: #e8e8e8;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.menu__draw-fill-btn {
  flex: 1;
  padding: 6px 4px;
  font-size: 0.7rem;
  font-weight: 500;
  border: none;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  color: #616161;
  transition: background 0.15s, color 0.15s;
}

.menu__draw-fill-btn:not(:last-child) {
  border-right: 1px solid #bdbdbd;
}

.menu__draw-fill-btn:hover {
  background: rgba(255, 255, 255, 0.7);
  color: #424242;
}

.menu__draw-fill-btn_active,
.menu__draw-fill-btn.menu__draw-fill-btn_active {
  background: #fff;
  color: #1976d2;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* Цвета контура и заливки — одна строка, два поля */
.menu__draw-colors {
  display: flex;
  gap: 8px;
  width: 100%;
}

.menu__draw-color-cell {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  transition: opacity 0.2s;
}

.menu__draw-options[data-fill-mode="outline"] .menu__draw-color-cell[data-for="fill"],
.menu__draw-options[data-fill-mode="fill"] .menu__draw-color-cell[data-for="stroke"] {
  opacity: 0.5;
  pointer-events: none;
}

.menu__draw-color-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: #616161;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.menu__draw-color {
  width: 100%;
  max-width: 36px;
  height: 28px;
  padding: 2px;
  border: 2px solid #bdbdbd;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.menu__draw-color:hover {
  border-color: #1976d2;
  box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
}

.menu__draw-color:focus {
  outline: none;
  border-color: #1976d2;
  box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.3);
}

.menu__draw-history {
  flex-direction: row;
  justify-content: center;
}

.menu__draw-history-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.menu__draw-history-btn:disabled:hover {
  background: #f5f5f5;
  color: #424242;
}

/* Открытое меню: крестик (закрыть) */
.menu:not(.menu_collapsed) .menu__burger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu:not(.menu_collapsed) .menu__burger-line:nth-child(2) {
  opacity: 0;
}

.menu:not(.menu_collapsed) .menu__burger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Свёрнутое меню: бургер (открыть) */
.menu.menu_collapsed .menu__burger-line:nth-child(1),
.menu.menu_collapsed .menu__burger-line:nth-child(3) {
  transform: none;
}

.menu.menu_collapsed .menu__burger-line:nth-child(2) {
  opacity: 1;
}

.menu__panel {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  padding-top: 48px;
  display: flex;
  flex-direction: column;
}

.menu__panel-content {
  flex: 1;
  min-height: 0;
  padding: 0.75rem 1rem 1rem;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

.menu__panel-content::-webkit-scrollbar {
  width: 8px;
}

.menu__panel-content::-webkit-scrollbar-track {
  background: #f0f0f0;
  border-radius: 4px;
}

.menu__panel-content::-webkit-scrollbar-thumb {
  background: #bdbdbd;
  border-radius: 4px;
}

.menu__panel-content::-webkit-scrollbar-thumb:hover {
  background: #9e9e9e;
}

.menu__panel-header {
  flex-shrink: 0;
  padding: 0.75rem 1rem 0.5rem;
  background: linear-gradient(to bottom, #fff 0%, #fafafa 100%);
  border-bottom: 1px solid #e8e8e8;
  position: sticky;
  top: 0;
  z-index: 2;
}

.menu__title {
  margin: 0 0 0.35rem 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #212121;
  letter-spacing: -0.01em;
}

.menu__hint {
  margin: 0;
  font-size: 0.8rem;
  color: #616161;
  line-height: 1.4;
}


.menu__panel-footer {
  flex-shrink: 0;
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.menu__link-home {
  display: block;
  text-align: center;
  padding: 0.4rem 1rem;
  font-size: 0.9rem;
  color: #1565c0;
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.2s ease, color 0.2s ease;
}

.menu__link-home:hover {
  background: #e3f2fd;
  color: #0d47a1;
}

.menu__clear-all {
  display: block;
  width: 100%;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  background: #c62828;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.menu__clear-all:hover {
  background: #b71c1c;
}

.menu__clear-all:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(198, 40, 40, 0.4);
}

.accordion {
  padding: 0;
}

.accordion__section {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  margin-bottom: 0.6rem;
  overflow: hidden;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.accordion__section:last-child {
  margin-bottom: 0;
}

.accordion__section:hover {
  border-color: #bdbdbd;
}

.accordion__section_open {
  border-color: #1976d2;
  box-shadow: 0 2px 8px rgba(25, 118, 210, 0.15);
}

.accordion__head {
  width: 100%;
  min-height: 44px;
  padding: 0.75rem 2.25rem 0.75rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
  border: none;
  background: #f8f8f8;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s ease, color 0.2s ease;
  position: relative;
  color: #424242;
  display: flex;
  align-items: center;
}

.accordion__head:hover {
  background: #eeeeee;
  color: #212121;
}

.accordion__head:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px #1976d2;
}

.accordion__head::after {
  content: '';
  position: absolute;
  right: 1rem;
  top: 50%;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #616161;
  transform: translateY(-50%);
  transition: transform 0.25s ease;
}

.accordion__section_open .accordion__head {
  background: #e3f2fd;
  color: #1565c0;
  border-radius: 8px 8px 0 0;
}

.accordion__section_open .accordion__head::after {
  transform: translateY(-30%) rotate(180deg);
  border-top-color: #1565c0;
}

.accordion__body {
  padding: 0.85rem 1rem;
  border-top: 1px solid #e3f2fd;
  background: #fafafa;
}

/* ---------- Форма настроек канвы ---------- */
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.settings-form__group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.75rem;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.settings-form__group:hover {
  border-color: #e0e0e0;
}

.settings-form__group:focus-within {
  border-color: #1976d2;
  box-shadow: 0 0 0 1px rgba(25, 118, 210, 0.2);
}

.settings-form__label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #424242;
  display: block;
  margin-bottom: 0.1rem;
}

.settings-form__hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: #757575;
}

.settings-form__input {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid #bdbdbd;
  border-radius: 6px;
  font: inherit;
  font-size: 0.875rem;
  resize: vertical;
  min-height: 2.5em;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.settings-form__input:hover {
  border-color: #9e9e9e;
}

.settings-form__input:focus {
  outline: none;
  border-color: #1976d2;
  box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.25);
}

.settings-form__input_title {
  min-height: 3em;
}

.settings-form__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.settings-form__row_inline {
  margin-top: 0.4rem;
}

.settings-form__label_inline {
  margin: 0;
  margin-right: 0.25rem;
  font-weight: normal;
  font-size: 0.9em;
}

.settings-form__input_number {
  width: 4rem;
  margin-right: 0.5rem;
}

.settings-form__color {
  width: 2.75rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid #bdbdbd;
  border-radius: 6px;
  cursor: pointer;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.settings-form__color:hover {
  border-color: #1976d2;
}

.settings-form__color:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.35);
}

.settings-form__file {
  font-size: 0.8rem;
  max-width: 100%;
  min-height: 2.25rem;
}

.settings-form__btn {
  padding: 0.4rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid #bdbdbd;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.settings-form__btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.35);
}

.settings-form__btn_remove {
  color: #c62828;
  border-color: #e57373;
}

.settings-form__btn_remove:hover {
  background: #ffebee;
  border-color: #ef5350;
}

.form-group_block-title {
  margin-bottom: 0.6rem;
}

.form-group_block-title .form-group__label {
  margin-bottom: 0.2rem;
}

.form-group_block-title .form-group__input {
  width: 100%;
}

.form-columns-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.form-columns-header__label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #424242;
}

.form-group__add-col {
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid #1976d2;
  border-radius: 6px;
  background: #e3f2fd;
  color: #1565c0;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.form-group__add-col:hover {
  background: #1976d2;
  color: #fff;
}

.form-group__col-header {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.25rem;
}

.form-group__col-header .form-group__input {
  flex: 1;
  min-width: 0;
}

.form-group__remove-col {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  color: #757575;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.form-group__remove-col:hover {
  background: #ffebee;
  color: #c62828;
  border-color: #ffcdd2;
}

.form-rows {
  margin-bottom: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.form-group_column {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group__label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #424242;
  display: block;
  margin-bottom: 0.15rem;
}

.form-group__inputs {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group__row {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.form-group__row.dragging {
  opacity: 0.6;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.form-group__row.drop-target {
  outline: 2px dashed #1976d2;
  outline-offset: 2px;
  background: rgba(25, 118, 210, 0.06);
}

.form-group__grip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 24px;
  height: 32px;
  margin: 0 -0.2rem 0 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: grab;
  color: #9e9e9e;
  transition: color 0.15s;
}

.form-group__grip:hover {
  color: #616161;
}

.form-group__grip:active {
  cursor: grabbing;
}

.form-group__grip:focus-visible {
  outline: none;
  color: #1976d2;
  box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.3);
  border-radius: 4px;
}

.form-group__grip-icon {
  display: block;
  pointer-events: none;
}

.form-group__row .form-group__input {
  flex: 1;
  min-width: 0;
}

.form-group__input {
  padding: 0.5rem 0.6rem;
  border: 1px solid #bdbdbd;
  border-radius: 6px;
  font-size: 0.875rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  resize: vertical;
  min-height: 2.5em;
}

textarea.form-group__input {
  font-family: inherit;
  line-height: 1.35;
}

.form-group__input:hover {
  border-color: #9e9e9e;
}

.form-group__input:focus {
  outline: none;
  border-color: #1976d2;
  box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.25);
}

.form-group__input:focus-visible {
  outline: none;
  border-color: #1976d2;
  box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.3);
}

.form-group__input::placeholder {
  color: #9e9e9e;
}

.form-group__delete {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background: #fff;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  color: #757575;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.form-group__delete:hover {
  background: #ffebee;
  color: #c62828;
  border-color: #ffcdd2;
}

.form-group__delete:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(198, 40, 40, 0.35);
}

.form-group__add {
  align-self: flex-start;
  min-width: 36px;
  min-height: 36px;
  padding: 0.4rem 0.6rem;
  border: 1px solid #bdbdbd;
  border-radius: 6px;
  background: #fff;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  color: #424242;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.form-group__add:hover {
  background: #e3f2fd;
  border-color: #1976d2;
  color: #1565c0;
}

.form-group__add:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.35);
}

/* ---------- Главная страница ---------- */
.page_home {
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 1.5rem;
  overflow: auto;
}

.home__header {
  margin-bottom: 1.75rem;
  text-align: center;
}

.home__title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: #1a1a1a;
  letter-spacing: -0.02em;
}

.home__cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto 1fr 1fr;
  gap: 1.25rem;
  width: 100%;
  max-width: 720px;
  min-height: 320px;
  margin-bottom: 1.75rem;
}

.home__card_span-2 {
  grid-column: span 2;
  min-height: 100px;
}

.home__card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.home__card:hover {
  border-color: #bdbdbd;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.home__card-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem;
  text-decoration: none;
  color: inherit;
  min-height: 0;
  transition: background 0.2s ease;
  border-radius: 12px 12px 0 0;
}

.home__card-main:hover {
  background: #fafafa;
}

.home__card-main:focus-visible {
  outline: none;
  background: #f5f5f5;
  box-shadow: inset 0 0 0 2px #1976d2;
}

.home__card-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #212121;
  text-align: center;
  line-height: 1.35;
}

.home__card-action {
  font-size: 0.875rem;
  font-weight: 500;
  color: #1976d2;
  opacity: 0.9;
}

.home__card-main:hover .home__card-action {
  opacity: 1;
  text-decoration: underline;
}

.home__card-pdf {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  margin: 0 0.75rem 0.75rem;
  background: #f5f5f5;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  color: #616161;
  transition: background 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}

.home__card-pdf:hover {
  background: #eeeeee;
  color: #424242;
}

.home__card-checkbox {
  margin: 0;
  width: 1rem;
  height: 1rem;
  accent-color: #2e7d32;
  cursor: pointer;
}

.home__card-pdf-label {
  user-select: none;
}

.home__footer {
  margin-top: auto;
}

.home__btn-pdf {
  padding: 0.65rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: #2e7d32;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

.home__btn-pdf:hover {
  background: #1b5e20;
}

.home__btn-pdf:active {
  transform: scale(0.98);
}

.home__btn-pdf:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(46, 125, 50, 0.5);
}

@media (max-width: 520px) {
  .home__cards {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(5, 1fr);
    min-height: 280px;
  }
  .home__card_span-2 {
    grid-column: auto;
  }
}

/* ---------- Канва-заглушка ---------- */
.canvas_placeholder .canvas__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.canvas__placeholder-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  z-index: 1;
}

.canvas__placeholder-text {
  margin: 0;
  color: #9e9e9e;
  font-size: 1rem;
}

/* ---------- Канва обложки ---------- */
.canvas_cover {
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 0;
}

.canvas_cover .canvas__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.canvas_cover .canvas__drawing {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: auto;
}

.canvas_cover .canvas__cover-header {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 1;
  pointer-events: none;
}

.canvas_cover .canvas__cover-header .canvas__logo_cover {
  pointer-events: auto;
}

.canvas_cover .canvas__logo_cover {
  max-width: 180px;
  max-height: 48px;
  object-fit: contain;
}

.canvas_cover .canvas__cover-body {
  flex: 1;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  min-height: 0;
}

.canvas_cover .canvas__cover-title {
  margin: 0 0 0.5rem 0;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-align: center;
  line-height: 1.2;
  color: #000000;
}

.canvas_cover .canvas__cover-subtitle {
  margin: 0;
  font-size: clamp(1.25rem, 3vw, 2rem);
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
  color: #c62828;
}
