/* Каркас страниц редакторов админки: шапка в две строки, карточка описания, разделы карточками, редактор уроков в три колонки.
   Подключается после admin.css на admin-editor.html и admin-checks.html. Только токены из base.css и admin.css. */

/* ---------- Липкая шапка ---------- */
.eh { --eh-top: 64px; position: sticky; top: var(--eh-top); z-index: 20; background: var(--background); border-bottom: 1px solid var(--border); }
.eh-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.eh-top { min-height: 56px; }
.eh-bar { min-height: 48px; border-top: 1px solid var(--border); justify-content: space-between; gap: 8px 16px; }
.eh-kind { flex: none; }
.eh-title { flex: 1; min-width: 0; font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0; transition: opacity .15s; }
.eh.is-scrolled .eh-title { opacity: 1; }
.eh-status { flex: none; display: inline-flex; }
.eh-info { display: flex; align-items: center; gap: 4px 12px; min-width: 0; flex: 1; font-size: 12px; color: var(--muted-foreground); }
.eh-bar .le-actions { flex: none; flex-wrap: nowrap; align-items: center; }
.eh-dirty { padding: 2px 8px; border-radius: 999px; background: var(--warning-tint); color: var(--warning-ink); white-space: nowrap; }
.eh-note { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.eh-note .input { height: 28px; width: 220px; max-width: 40vw; font-size: 12px; }
.eh-info .le-save { white-space: nowrap; }
.le-save[data-state="unsaved"] > .icon { display: none; }
.le-save[data-state="unsaved"]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--warning-ink); flex: none; }
@media (max-width: 639px) {
  .eh-ver, .eh-info [data-version], .eh-dirty { display: none; }
  .eh-note .input { width: 120px; }
  .eh-info { flex: 0 1 auto; }
  .eh-bar { justify-content: space-between; }
}

/* ---------- Разделы карточками ---------- */
.le-ed .le-sec { gap: 16px; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--card); color: var(--card-foreground); }
.le-ed .le-sec + .le-sec { padding-top: 24px; border-top: 1px solid var(--border); }
.le-ed .le-sec .le-sec, .le-ed .le-tabpanel .le-sec { padding: 0; border: 0; border-radius: 0; background: transparent; }
.le-ed .le-tabpanel { padding: 24px; margin-top: 16px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--card); }
/* Мелкие прописные подписи через капитель, а не text-transform: innerText остаётся исходным, на нём строятся проверки текста */
.le-ed .field > label, .le-ed .field > .label, .eh-label { font-size: 13px; font-weight: 500; font-variant-caps: all-small-caps; letter-spacing: .06em; color: var(--muted-foreground); }
.le-ed .check-row label, .le-ed .check-row span { font-variant-caps: normal; letter-spacing: normal; }

/* ---------- Карточка описания ---------- */
.eh-meta-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.eh-meta-actions { display: flex; gap: 8px; }
.eh-read, .eh-form { display: grid; gap: 16px; }
.eh-read-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.eh-read-row { display: grid; gap: 4px; min-width: 0; }
.eh-name { font-size: 16px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.eh-text { font-size: 14px; overflow-wrap: anywhere; }
.eh-value { font-size: 14px; overflow-wrap: anywhere; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.eh-value .field-hint { flex-basis: 100%; }
.eh-none { color: var(--muted-foreground); }
.eh-link { color: var(--primary); text-decoration: underline; }
.eh-day { padding: 2px 10px; border-radius: 999px; background: var(--muted); font-size: 13px; }
.eh-error { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-radius: var(--radius); background: var(--destructive-tint); color: var(--destructive-ink); font-size: 14px; }
.eh-error[hidden] { display: none; }

/* ---------- Редактор уроков: три колонки ---------- */
.lb-shell { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; --lb-top: calc(64px + 56px + 48px + 16px); }
.lb-rail { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--card); }
.lb-rail-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.lb-canvas { min-width: 0; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--card); }
.lb-props { min-width: 0; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--card); display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 1100px) {
  .lb-shell { grid-template-columns: 48px minmax(0, 1fr) 280px; }
  .lb-rail { flex-direction: column; position: sticky; top: var(--lb-top); padding: 6px; }
  .lb-rail-sep { width: 20px; height: 1px; margin: 4px 0; }
  .lb-props { position: sticky; top: var(--lb-top); }
}
.lb-shell.is-ro { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .lb-shell.is-ro { grid-template-columns: minmax(0, 1fr) 280px; } }
.lb-shell.is-ro .lb-rail { display: none; }

.lb { position: relative; padding: 8px 8px 8px 4px; border: 1px solid transparent; border-radius: var(--radius); }
.lb:hover { border-color: var(--border); }
.lb.is-sel, .lb:focus-within { border-color: var(--primary); }
.lb-grip { flex: none; align-self: flex-start; width: 20px; height: 28px; display: inline-grid; place-items: center; padding: 0; border: 0; background: transparent; color: var(--muted-foreground); cursor: grab; border-radius: 4px; opacity: .45; }
.lb:hover .lb-grip, .lb.is-sel .lb-grip, .lb-grip:focus-visible { opacity: 1; }
.lb-grip:hover { background: var(--muted); }
.lb-grip:active { cursor: grabbing; }
.lb.is-drag { opacity: .45; }
.lb.is-over-top { box-shadow: 0 -2px 0 0 var(--primary); }
.lb.is-over-bottom { box-shadow: 0 2px 0 0 var(--primary); }
.lb-chip { display: inline-flex; align-items: center; gap: 4px; }
.lb-chip .icon { width: 12px; height: 12px; }
.lb-hint { color: var(--muted-foreground); font-size: 12px; }
.lb-cols[data-ratio="1:2"] { grid-template-columns: 1fr 2fr; }
.lb-cols[data-ratio="2:1"] { grid-template-columns: 2fr 1fr; }
@media (max-width: 639px) { .lb-cols[data-ratio] { grid-template-columns: 1fr; } }
.lb-table.has-head tr:first-child td { font-weight: 600; background: var(--muted); }
.lb-step-main { display: grid; gap: 4px; flex: 1; min-width: 0; }

/* Панель свойств */
.lb-props-empty { display: grid; gap: 8px; justify-items: start; color: var(--muted-foreground); font-size: 14px; }
.lb-props-head { display: flex; align-items: center; gap: 8px; }
.lb-props-ic { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: var(--radius); background: var(--muted); flex: none; }
.lb-props-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; }
.lb-props-body { display: grid; gap: 16px; }
.lb-props-note { font-size: 14px; color: var(--muted-foreground); }
.lb-enum { display: flex; flex-wrap: wrap; gap: 4px; }

/* Слэш-меню: заголовки групп */
.le-palette-h { padding: 8px 12px 4px; font-size: 13px; font-weight: 500; font-variant-caps: all-small-caps; letter-spacing: .06em; color: var(--muted-foreground); }
.le-palette .menu-item { gap: 8px; }
.le-palette .menu-item small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }

/* Панель форматирования над выделением */
.lb-bubble { position: fixed; z-index: 60; display: flex; flex-direction: column; gap: 4px; padding: 4px; background: var(--popover); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); max-width: calc(100vw - 16px); }
.lb-bubble[hidden] { display: none; }
.lb-bubble-row { display: flex; flex-wrap: wrap; gap: 2px; }
.lb-bubble [aria-pressed="true"] { background: var(--primary-tint); color: var(--primary); }
.lb-bubble-link[hidden] { display: none; }
.lb-bubble-link .input { height: 28px; }

/* Пустые служебные контейнеры не должны давать лишний зазор в стопке */
.le-ed > :empty { display: none; }
.eh-read-pair { align-items: start; }
