/* Стили конструктора: светлый спокойный вид, удобно на телефоне (375 px) и на компьютере.
   Цвета по макету дизайнера (docs/design/admin-pk): тёмно-зелёная колонка меню, светлый серо-зелёный фон, жёлтая главная кнопка,
   зелёные ссылки и отметки, красный — удаление и ошибки. Все цвета конструктора — переменные ниже, другие файлы стилей берут их отсюда. */
:root {
  --ink: #1b211e;
  --muted: #5a6861;
  --paper: #f2f5f2;
  --card: #ffffff;
  --line: #d8dfda;
  --field-line: #b9c3bd;
  --chip: #e6ece8;
  --hover: #eef3ef;
  --amber: #f5b335;
  --amber-dark: #e3a01f;
  --red: #b3261e;
  --red-soft: #fbecea;
  --red-line: #ebb5b0;
  --green: #24583f;
  --green-soft: #e5f1e9;
  --green-line: #a9d1b8;
  --note-soft: #fdf3dc;
  --note-line: #ecd48a;
  --note-ink: #7a5300;
  --side: #1b2620;
  --side-ink: #e9efea;
  --side-muted: #9fb1a6;
  --side-hover: #24322a;
  --side-active: #2d3e34;
  --side-line: #34443a;
  --focus: #2f7a55;
  --radius: 8px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

a { color: var(--green); }
h1 { font-size: 1.7rem; line-height: 1.2; margin: 0 0 .5rem; }
h2 { font-size: 1.25rem; line-height: 1.25; margin: 2rem 0 .5rem; }
h3 { font-size: 1.1rem; margin: 1.5rem 0 .4rem; }
h4 { font-size: 1rem; margin: 1.2rem 0 .3rem; }
p { margin: 0 0 .75rem; }

/* Страница */
.page { max-width: 760px; margin: 0 auto; padding: 24px 16px 96px; }
.lead { color: var(--muted); }
.back { margin: 0 0 1rem; }
.empty { color: var(--muted); padding: 1rem 0; }
.link-out { font-weight: 600; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 20px; }
.card-narrow { max-width: 420px; margin: 24px auto; }

/* Кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: .5rem 1.1rem;
  border: 1px solid var(--field-line); border-radius: var(--radius);
  background: var(--card); color: var(--ink);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--hover); }
.btn:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.btn-primary { background: var(--amber); border-color: var(--amber); color: var(--ink); }
.btn-primary:hover { background: var(--amber-dark); border-color: var(--amber-dark); }
.btn-quiet { border-color: var(--line); font-weight: 500; }
.btn-wide { width: 100%; }

/* Сообщения */
.flash { padding: .75rem 1rem; border-radius: var(--radius); border: 1px solid; margin: 0 0 1rem; }
.flash-ok { background: var(--green-soft); border-color: var(--green-line); color: var(--green); }
.flash-error { background: var(--red-soft); border-color: var(--red-line); color: var(--red); }
.flash-note { background: var(--note-soft); border-color: var(--note-line); }

/* Состояние публикации */
.status {
  display: flex; flex-wrap: wrap; align-items: center; gap: 1rem;
  padding: 16px; margin: 1rem 0; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card);
}
.status-dirty { border-color: var(--amber); background: var(--note-soft); }
.status-text { margin: 0; flex: 1 1 260px; }
.status-text strong { display: block; font-size: 1.1rem; }
.status-text span { color: var(--muted); }
.status-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.status-actions form { margin: 0; }

/* Страница лендинга (макет 15): нумерованный список блоков слева, текущий подсвечен; вид блока на сайте — под полями */
.lblocks { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.lb > a, .lb-off { display: grid; grid-template-columns: 2.2rem minmax(0, 1fr) 16px; gap: 8px; align-items: center; min-height: 48px; padding: 8px 12px; border-radius: 6px; color: var(--ink); text-decoration: none; }
.lb > a:hover { background: var(--hover); }
.lb > a[aria-current="page"] { background: var(--green-soft); color: var(--green); font-weight: 600; }
.lb .ico { width: 16px; height: 16px; color: var(--muted); }
.lb-off { color: var(--muted); grid-template-columns: 2.2rem minmax(0, 1fr); }
.lb-num { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.landing-main { min-width: 0; }
.landing-main > .panel .save-bar { margin: 1.5rem 0 0; border-radius: var(--radius); border: 1px solid var(--line); }

.badge { display: inline-block; padding: .05rem .55rem; font-size: .8rem; font-weight: 500; background: var(--chip); border-radius: 99px; vertical-align: middle; }
.badge-ok { background: var(--green-soft); color: var(--green); }

/* Форма правки */
.edit-form { margin-top: 1rem; }
.group { margin: 0 0 1rem; }
.group-0 { padding-top: .25rem; }
.group > h2, .group > h3, .group > h4 { margin-top: 1.5rem; }
.field { margin: 0 0 1.25rem; }
.field label { display: block; font-weight: 700; margin-bottom: .15rem; }
.opt { font-weight: 400; color: var(--muted); font-size: .9rem; }
.hint { color: var(--muted); font-size: .92rem; margin: 0 0 .4rem; }
.hint-marks { margin: .35rem 0 0; }

input[type="text"], input[type="password"], textarea, select {
  display: block; width: 100%; min-height: 46px; padding: .6rem .8rem;
  font: inherit; color: var(--ink); background: var(--card);
  border: 1px solid var(--field-line); border-radius: var(--radius);
}
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--green); }
.field-error input, .field-error textarea, .field-error select { border-color: var(--red); background: var(--red-soft); }
.error { color: var(--red); font-weight: 600; margin: .35rem 0 0; }
.counter { color: var(--muted); font-size: .85rem; margin: .25rem 0 0; text-align: right; }
.counter.over { color: var(--red); font-weight: 600; }

/* Сворачиваемые пункты списков */
.item { margin: 0 0 .6rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.item > summary { padding: 14px 16px; font-weight: 600; cursor: pointer; min-height: 48px; }
.item[open] > summary { border-bottom: 1px solid var(--line); }
.item-body { padding: 16px 16px 4px; }
.item-body .group > h2, .item-body .group > h3, .item-body .group > h4 { margin-top: .5rem; }

/* Панель сохранения закреплена внизу экрана */
.save-bar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem;
  margin: 1.5rem -16px 0; padding: 12px 16px;
  background: rgba(242, 245, 242, .96); border-top: 1px solid var(--line);
}
.save-note { color: var(--muted); font-size: .92rem; }

/* Образец выдачи поиска */
.serp-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: .5rem; }
.serp-url { color: #2b6a3b; font-size: .9rem; margin: 0 0 .15rem; overflow-wrap: anywhere; }
.serp-title { color: #1a0dab; font-size: 1.2rem; line-height: 1.3; margin: 0 0 .25rem; overflow-wrap: anywhere; }
.serp-desc { color: #4d5156; font-size: .95rem; margin: 0; overflow-wrap: anywhere; }

/* История */
.version { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; }
.version form { margin: 0; }

@media (min-width: 700px) {
  h1 { font-size: 2.1rem; }
  .page { padding-top: 32px; }
  .card-narrow { padding: 32px; }
  .save-bar { margin-left: 0; margin-right: 0; border-radius: var(--radius); border: 1px solid var(--line); }
}

@media (max-width: 480px) {
  .status-actions, .status-actions form, .status-actions .btn { width: 100%; }
}

@media (prefers-reduced-motion: no-preference) {
  .btn, input, textarea, select { transition: background-color .15s, border-color .15s; }

  /* Раскрывающиеся пункты списков открываются и закрываются быстрым плавным движением, а не скачком */
  :root { interpolate-size: allow-keywords; }
  .item::details-content {
    height: 0; overflow: clip; opacity: 0;
    transition: height .18s ease-out, opacity .18s ease-out, content-visibility .18s allow-discrete;
  }
  .item[open]::details-content { height: auto; opacity: 1; }
  .item > summary::marker { transition: none; }
}

/* Экран правки блока: поля слева, окно с видом сайта справа (только на широком экране) */
.live { display: none; }
@media (min-width: 1100px) {
  .page-wide { max-width: 1680px; }
  .editor { display: grid; grid-template-columns: minmax(400px, 520px) minmax(0, 1fr); gap: 32px; align-items: start; }
  .live:not([hidden]) { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 16px; height: calc(100vh - 32px); }
  .live-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
  .live-state { color: var(--muted, #66665f); font-size: .9rem; }
  .live-modes { margin-left: auto; display: flex; gap: 6px; }
  .live-modes .btn { min-height: 36px; padding: .3rem .8rem; }
  .live-modes .btn[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
  .live-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #111; }
  .live-frame { position: absolute; top: 0; left: 0; border: 0; transform-origin: 0 0; background: #111; }
  .live .hint { margin: 0; }
  .landing-main > .live:not([hidden]) { position: static; height: 640px; margin-top: 24px; }
}
