/* ==========================================================================
   K-DAVO — экран правки готовой книги (см. /static/editor.js).
   Отдельный файл: правка появилась позже интерфейса сборки и не должна
   вмешиваться в его стили. Токены (--ink, --line, --red …) берутся из
   app.css, поэтому этот файл подключается после него.
   ========================================================================== */

.editor__sub {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.editor__body {
  margin-top: 18px;
  padding-bottom: 8px;
  border-top: 1px solid var(--line-soft);
}

/* ---------- раздел ------------------------------------------------------- */

.ed-group {
  border-bottom: 1px solid var(--line-soft);
  padding: 4px 0;
}

.ed-group__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 12px 2px;
  cursor: pointer;
  list-style: none;
  font-size: 15px;
}

.ed-group__head::-webkit-details-marker { display: none; }

.ed-group__head::before {
  content: '▸';
  color: var(--faint);
  transition: transform .18s var(--ease);
}

.ed-group[open] > .ed-group__head::before { transform: rotate(90deg); }

.ed-group__head b {
  font-weight: 750;
  letter-spacing: -.01em;
}

.ed-group__n {
  margin-left: auto;
  font-size: 13px;
  color: var(--faint);
  white-space: nowrap;
}

/* ---------- блок I–VII внутри раздела ------------------------------------ */

.ed-block {
  margin: 6px 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  background: var(--bg);
}

.ed-block[open] { background: var(--surface); }

.ed-block__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 11px 12px;
  cursor: pointer;
  list-style: none;
  font-size: 14px;
}

.ed-block__head::-webkit-details-marker { display: none; }

.ed-block__head::before {
  content: '▸';
  color: var(--faint);
  transition: transform .18s var(--ease);
}

.ed-block[open] > .ed-block__head::before { transform: rotate(90deg); }

.ed-block__head b { font-weight: 700; }

.ed-block > .ed-row,
.ed-block > .ed-sub { margin-left: 12px; margin-right: 12px; }

.ed-block > .ed-row:last-child { margin-bottom: 12px; }

.ed-note {
  margin: 0 0 10px;
  padding: 0 2px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.ed-sub {
  margin: 14px 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* ---------- строка правки ------------------------------------------------ */

.ed-row {
  display: grid;
  grid-template-columns: 210px 1fr auto;
  align-items: start;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
}

.ed-row + .ed-row { margin-top: 2px; }

.ed-row.is-bullet { grid-template-columns: 44px 1fr auto; }

.ed-row:hover { background: var(--line-soft); }

.ed-row.is-changed { background: var(--amber-soft); }

.ed-row.is-deleted { opacity: .55; }

.ed-row.is-deleted .ed-input {
  text-decoration: line-through;
  background: transparent;
}

.ed-row__label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 9px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

.ed-row.is-oor .ed-row__label { color: var(--red-deep); }

.ed-hint {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--faint);
}

.ed-input {
  width: 100%;
  font: inherit;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  min-height: 40px;
  resize: vertical;
  overflow: hidden;
}

.ed-input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-soft);
}

.ed-input:disabled { color: var(--muted); }

.ed-kill {
  align-self: start;
  margin-top: 4px;
  width: 32px;
  height: 32px;
  font-size: 19px;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
}

.ed-kill:hover {
  color: var(--red);
  background: var(--red-soft);
  border-color: var(--red-line);
}

/* ---------- нижняя панель ------------------------------------------------ */

.editor__bar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 14px 2px 4px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--surface) 28%);
}

.editor__count {
  font-size: 14px;
  font-weight: 650;
  color: var(--ink-2);
}

.editor__bar .btn { margin-left: 0; }
.editor__bar .btn:first-of-type { margin-left: auto; }

.editor__msg {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  font-size: 14px;
  line-height: 1.45;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-2);
}

.editor__msg.is-ok {
  border-color: #BFE7CF;
  background: var(--green-soft);
  color: #14603A;
}

.editor__msg.is-warn {
  border-color: var(--red-line);
  background: var(--red-soft);
  color: var(--red-deep);
}

@media (max-width: 720px) {
  .ed-row { grid-template-columns: 1fr auto; }
  .ed-row__label { grid-column: 1 / -1; padding-top: 0; }
}
