/* АС Дизайн — локальная админка (прототип) */

html, body.adm { height: 100%; }

body.adm {
  --a-panel: rgba(251, 250, 247, .74);
  --a-paper: #efece5;
  --a-muted: #6d6a63;
  --a-line: rgba(28, 28, 26, .14);
  --a-line-strong: rgba(28, 28, 26, .38);
  --a-olive: #5c6247;
  --a-warn: #9a6427;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: 15px;
}

body.adm::before { display: none; }

/* ---------- Верхняя панель ---------- */

.adm-top {
  flex: none;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 62px;
  padding: 0 clamp(16px, 2.2vw, 28px);
  border-bottom: 1px solid var(--a-line);
  background: rgba(247, 245, 240, .94);
  backdrop-filter: blur(8px);
  z-index: 20;
}

.adm-top__brand { display: flex; align-items: baseline; gap: 14px; min-width: 0; }

.adm-top__name {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: .08em;
  white-space: nowrap;
}

.adm-top__tag {
  font-size: 15px;
  color: var(--a-muted);
  letter-spacing: .04em;
  white-space: nowrap;
}

.adm-top__tag em {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  border: 1px solid var(--a-line);
  font-style: normal;
  font-size: 15px;
  line-height: 1.2;
  color: var(--a-muted);
}

.adm-top__state {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-size: 15px;
  color: var(--a-muted);
  white-space: nowrap;
  cursor: pointer;
}

.adm-top__state:hover { color: var(--ink); }

.adm-top__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--a-olive);
  flex: none;
}

.adm-top__state[data-state="dirty"] { color: var(--ink); }
.adm-top__state[data-state="dirty"] .adm-top__dot { background: var(--a-warn); }

.adm-top__acts { display: flex; align-items: center; gap: 8px; }

/* ---------- Кнопки и ссылки ---------- */

.adm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: .04em;
  text-decoration: none;
  cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
}

.adm-btn:hover { background: #000; }

.adm-btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--a-line-strong);
}

.adm-btn--ghost:hover { background: var(--a-paper); }

.adm-btn:disabled { opacity: .4; cursor: default; }

.adm-linkbtn {
  padding: 0;
  border: 0;
  background: none;
  font-size: 15px;
  color: var(--a-muted);
  text-align: left;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--a-line);
  text-underline-offset: 4px;
}

.adm-linkbtn:hover { color: var(--ink); text-decoration-color: currentColor; }

/* ---------- Каркас ---------- */

.adm-shell { flex: 1; display: flex; min-height: 0; }

.adm-side {
  flex: none;
  width: 248px;
  display: flex;
  flex-direction: column;
  padding: 28px 20px 24px;
  border-right: 1px solid var(--a-line);
  overflow-y: auto;
}

.adm-nav { display: flex; flex-direction: column; }

.adm-nav__item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 10px;
  border: 0;
  border-bottom: 1px solid var(--a-line);
  background: none;
  font-size: 16px;
  text-align: left;
  cursor: pointer;
  transition: background .16s var(--ease);
}

.adm-nav__item:hover { background: rgba(255, 255, 255, .36); }

.adm-nav__item.is-active {
  background: var(--a-paper);
  box-shadow: inset 2px 0 0 var(--ink);
}

.adm-nav__count { font-size: 15px; color: var(--a-muted); }

.adm-note { margin-top: auto; padding-top: 32px; }
.adm-note p {
  margin: 8px 0 0;
  font-size: 15px;
  line-height: 1.45;
  color: var(--a-muted);
}

.adm-side__tools {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--a-line);
}

.adm-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 32px clamp(20px, 3vw, 44px) 72px;
}

.adm-view { max-width: 1440px; }

body.adm-compact {
  display: grid;
  align-content: safe center;
  justify-items: center;
  min-height: 100svh;
  height: auto;
  overflow: visible;
  padding: 24px 16px;
}

.adm-compact__panel {
  width: min(100%, 640px);
  border: 1px solid var(--a-line);
  background: #fbfaf7;
}

.adm-compact--login .adm-compact__panel { max-width: 400px; }

.adm-compact .adm-top {
  justify-content: space-between;
  min-height: 54px;
  padding: 10px clamp(20px, 4vw, 28px);
}

.adm-compact .adm-main {
  overflow: visible;
  padding: clamp(20px, 4vw, 28px);
}

.adm-compact .adm-title { font-size: clamp(26px, 4vw, 32px); }

.adm-compact__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.adm-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.adm-eyebrow {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--a-muted);
}

.adm-title {
  margin: 4px 0 0;
  font-size: clamp(28px, 2.6vw, 36px);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: .01em;
}

.adm-lead {
  max-width: 620px;
  margin: 0 0 26px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--a-muted);
}

/* ---------- Фильтры ---------- */

.adm-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 20px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--a-line);
}

.adm-filter {
  padding: 9px 0;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  font-size: 15px;
  color: var(--a-muted);
  cursor: pointer;
}

.adm-filter span { margin-left: 4px; opacity: .7; }
.adm-filter:hover { color: var(--ink); }
.adm-filter.is-active { color: var(--ink); border-bottom-color: var(--ink); }

/* ---------- Проекты: список + редактор ---------- */

.adm-projects {
  display: grid;
  grid-template-columns: minmax(300px, 370px) minmax(0, 1fr);
  gap: clamp(20px, 2.4vw, 36px);
  align-items: start;
}

.adm-list { border-top: 1px solid var(--a-line); }

.adm-row {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 8px 10px 6px;
  border-bottom: 1px solid var(--a-line);
  cursor: pointer;
  transition: background .14s var(--ease);
}

.adm-row:hover { background: rgba(255, 255, 255, .38); }
.adm-row:focus-visible { outline: 1px solid var(--ink); outline-offset: -1px; }

.adm-row.is-active {
  background: var(--a-paper);
  box-shadow: inset 2px 0 0 var(--ink);
}

.adm-row.is-hidden .adm-row__thumb,
.adm-row.is-hidden .adm-row__body { opacity: .5; }

.adm-row__thumb {
  width: 50px;
  height: 62px;
  object-fit: cover;
  display: block;
  background: var(--bg-deep);
}

.adm-row__thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: var(--a-muted);
  border: 1px solid var(--a-line);
  background: var(--a-panel);
}

.adm-row__body { min-width: 0; }

.adm-row__title {
  display: block;
  font-size: 16px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.adm-row__meta {
  display: block;
  margin-top: 3px;
  font-size: 15px;
  line-height: 1.2;
  color: var(--a-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.adm-row__ctrl { display: flex; gap: 2px; }

.adm-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  background: none;
  color: #9a968e;
  cursor: pointer;
}

.adm-icon svg { width: 18px; height: 18px; }
.adm-icon:hover { color: var(--ink); }
.adm-icon.is-on { color: var(--a-olive); }
.adm-icon.is-on svg { fill: currentColor; stroke: none; }

.adm-empty {
  padding: 28px 12px;
  font-size: 15px;
  color: var(--a-muted);
  border-bottom: 1px solid var(--a-line);
}

/* ---------- Редактор проекта ---------- */

.adm-editor {
  min-width: 0;
  padding: clamp(16px, 1.8vw, 24px);
  border: 1px solid var(--a-line);
  background: var(--a-panel);
}

.ed__top {
  display: grid;
  grid-template-columns: clamp(150px, 15vw, 196px) minmax(0, 1fr);
  gap: clamp(18px, 2vw, 30px);
  align-items: start;
}

.ed__coverwrap { min-width: 0; }

.ed__cover {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0;
  border: 1px solid var(--a-line);
  background: var(--bg-deep);
  overflow: hidden;
  cursor: pointer;
}

.ed__cover-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  height: 100%;
  background: var(--a-paper);
  color: var(--a-muted);
  font-size: 15px;
  line-height: 1.3;
  text-align: center;
}

.ed__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ed__cover-hint {
  position: absolute;
  inset: auto 0 0;
  padding: 9px 10px;
  background: rgba(28, 28, 26, .72);
  color: var(--bg);
  font-size: 15px;
  line-height: 1.2;
  text-align: left;
  opacity: 0;
  transition: opacity .18s var(--ease);
}

.ed__cover:hover .ed__cover-hint,
.ed__cover:focus-visible .ed__cover-hint { opacity: 1; }

.ed__cover-cap {
  margin: 8px 0 0;
  font-size: 15px;
  color: var(--a-muted);
}

.ed__fields { min-width: 0; }

.ed__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.ed__slug {
  margin: 0;
  font-size: 15px;
  color: var(--a-muted);
  white-space: nowrap;
}

.ed__grid { display: grid; gap: 12px; }

.fld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.fld > span {
  font-size: 15px;
  line-height: 1.2;
  color: var(--a-muted);
}

.fld input,
.fld textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--a-line);
  border-radius: 0;
  background: rgba(255, 255, 255, .5);
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.45;
  resize: vertical;
}

.fld input::placeholder,
.fld textarea::placeholder { color: #9a968e; }

.fld input:focus,
.fld textarea:focus {
  outline: none;
  border-color: var(--ink);
  background: rgba(255, 255, 255, .82);
}

.fld-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

/* Фотографии */

.ed__photos { margin-top: 26px; }

.ed__subhead {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 12px;
}

.ed__count { font-size: 15px; color: var(--a-muted); }

.ed__subhead .adm-btn {
  margin-left: auto;
  min-height: 36px;
  padding: 0 14px;
}

.ph-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 10px;
}

.ph {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid var(--a-line);
  background: var(--bg-deep);
  overflow: hidden;
  cursor: grab;
}

.ph.is-drag { opacity: .35; }
.ph.is-over { outline: 2px solid var(--ink); outline-offset: -2px; }

.ph__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.ph__acts {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 4px;
  opacity: 0;
  transition: opacity .16s var(--ease);
  background: linear-gradient(rgba(28, 28, 26, .28), transparent 42%, transparent 58%, rgba(28, 28, 26, .28));
}

.ph:hover .ph__acts,
.ph:focus-within .ph__acts { opacity: 1; }

.ph__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  background: rgba(247, 245, 240, .92);
  color: var(--ink);
  cursor: pointer;
}

.ph__btn svg { width: 15px; height: 15px; }
.ph__btn:hover { background: var(--bg); }
.ph__btn--cover svg { fill: currentColor; stroke: none; }

.ph--add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-style: dashed;
  border-color: var(--a-line-strong);
  background: transparent;
  color: var(--a-muted);
  font-size: 15px;
  cursor: pointer;
}

.ph--add:hover { color: var(--ink); border-color: var(--ink); background: rgba(255, 255, 255, .36); }

.ph--add span:first-child { font-size: 22px; line-height: 1; }

.ed__hint {
  margin: 10px 0 0;
  font-size: 15px;
  line-height: 1.4;
  color: var(--a-muted);
}

.ed__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--a-line);
}

.ed__toggles { display: flex; flex-direction: column; gap: 10px; }

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  cursor: pointer;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch span {
  position: relative;
  flex: none;
  width: 38px;
  height: 20px;
  border: 1px solid var(--a-line-strong);
  background: transparent;
  transition: background .18s var(--ease), border-color .18s var(--ease);
}

.switch span::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--a-muted);
  transition: transform .18s var(--ease), background .18s var(--ease);
}

.switch input:checked + span { background: var(--a-olive); border-color: var(--a-olive); }
.switch input:checked + span::after { transform: translateX(18px); background: var(--bg); }
.switch input:focus-visible + span { outline: 1px solid var(--ink); outline-offset: 2px; }

.switch em { font-style: normal; }

.ed__link {
  font-size: 15px;
  color: var(--a-muted);
  text-decoration: underline;
  text-decoration-color: var(--a-line);
  text-underline-offset: 4px;
}

.ed__link:hover { color: var(--ink); text-decoration-color: currentColor; }

/* ---------- Тексты сайта ---------- */

.adm-texts { max-width: 900px; }

.adm-textsec {
  border: 1px solid var(--a-line);
  border-bottom: 0;
  background: var(--a-panel);
}

.adm-textsec:last-child { border-bottom: 1px solid var(--a-line); }

.adm-textsec > summary {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
}

.adm-textsec > summary::-webkit-details-marker { display: none; }

.adm-textsec > summary:hover { background: rgba(255, 255, 255, .36); }

.adm-textsec__num { font-size: 15px; color: var(--a-muted); }

.adm-textsec__title { font-size: 20px; }

.adm-textsec__count { margin-left: auto; font-size: 15px; color: var(--a-muted); }

.adm-textsec__body {
  display: grid;
  gap: 14px;
  padding: 4px 18px 20px;
}

.adm-svc {
  display: grid;
  gap: 10px;
  padding: 14px 0;
  border-top: 1px solid var(--a-line);
}

.adm-svc:first-of-type { border-top: 0; padding-top: 4px; }

.adm-svc__num { font-size: 15px; color: var(--a-muted); }

.adm-people {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.adm-fields2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.adm-note-inline {
  margin: -4px 0 0;
  font-size: 15px;
  line-height: 1.4;
  color: var(--a-muted);
}

.fld > span .adm-note-inline {
  display: block;
  margin: 2px 0 0;
  font-style: normal;
}

.adm-main > .adm-empty {
  padding: 40px 24px;
  border: 1px solid var(--a-line);
  background: var(--a-panel);
  line-height: 1.5;
}

.adm-main > .adm-empty code {
  font-family: Consolas, 'Courier New', monospace;
  font-size: 15px;
  white-space: nowrap;
}

/* ---------- Публикации ---------- */

.adm-history { max-width: 900px; border-top: 1px solid var(--a-line); }

.adm-hist {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: baseline;
  padding: 16px 4px;
  border-bottom: 1px solid var(--a-line);
}

.adm-hist__v { font-size: 20px; }
.adm-hist__date { font-size: 15px; color: var(--a-muted); }
.adm-hist__summary { margin: 0; font-size: 16px; line-height: 1.4; }
.adm-hist__meta { font-size: 15px; color: var(--a-muted); text-align: right; white-space: nowrap; }

/* ---------- Диалог, тост ---------- */

.adm-dialog {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--bg);
  color: var(--ink);
}

.adm-dialog::backdrop { background: rgba(28, 28, 26, .42); }

.adm-dialog form { padding: 24px; }

.adm-dialog__title {
  margin: 6px 0 18px;
  font-size: 28px;
  font-weight: 500;
  line-height: 1.15;
}

.adm-dialog__body {
  max-height: 44vh;
  overflow-y: auto;
  padding: 14px 0;
  border-top: 1px solid var(--a-line);
  border-bottom: 1px solid var(--a-line);
}

.adm-changes { margin: 0; padding: 0; list-style: none; }

.adm-changes li {
  display: flex;
  gap: 10px;
  padding: 5px 0;
  font-size: 15px;
  line-height: 1.4;
}

.adm-changes li span:first-child { color: var(--a-muted); flex: none; min-width: 74px; }

.adm-changes .adm-more { color: var(--a-muted); padding-top: 8px; }

.adm-dialog__note {
  margin: 14px 0 20px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--a-muted);
}

.adm-dialog__acts { display: flex; justify-content: flex-end; gap: 8px; }

.adm-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 100;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  background: var(--ink);
  color: var(--bg);
  font-size: 15px;
  line-height: 1.3;
  box-shadow: 0 10px 30px rgba(28, 28, 26, .25);
}

/* ---------- Адаптив ---------- */

@media (max-width: 1240px) {
  .adm-projects { grid-template-columns: minmax(280px, 320px) minmax(0, 1fr); }
  .ed__top { grid-template-columns: 150px minmax(0, 1fr); }
}

@media (max-width: 1180px) {
  .adm-shell { flex-direction: column; }

  .adm-side {
    width: auto;
    flex: none;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    padding: 10px 20px;
    border-right: 0;
    border-bottom: 1px solid var(--a-line);
    overflow: visible;
  }

  .adm-nav { flex-direction: row; flex: 1; overflow-x: auto; }

  .adm-nav__item {
    width: auto;
    border-bottom: 2px solid transparent;
    padding: 8px 10px;
    white-space: nowrap;
  }

  .adm-nav__item.is-active { box-shadow: none; border-bottom-color: var(--ink); background: none; }

  .adm-note { display: none; }

  .adm-side__tools { flex-direction: row; gap: 16px; margin: 0; padding: 0; border: 0; }

  .adm-main { padding: 26px 20px 64px; }
}

@media (max-width: 1000px) {
  body.adm { overflow: auto; }

  .adm-top { flex-wrap: wrap; gap: 12px 20px; padding: 12px 20px; }

  .adm-top__state { order: 3; width: 100%; margin-left: 0; }

  .adm-top__acts { margin-left: auto; }

  .adm-shell { display: block; }

  .adm-main { overflow: visible; }

  .adm-projects { grid-template-columns: 1fr; }

  .adm-list {
    max-height: 360px;
    overflow-y: auto;
    border-bottom: 1px solid var(--a-line);
    margin-bottom: 22px;
  }
}

@media (max-width: 700px) {
  .adm-top__tag { display: none; }

  .adm-top__name { font-size: 18px; }

  .adm-side { flex-direction: column; align-items: stretch; gap: 6px; padding: 8px 16px 10px; }

  .adm-nav { flex-wrap: wrap; overflow: visible; gap: 0 2px; }

  .adm-nav__item { padding: 7px 8px; }

  .adm-side__tools {
    flex-direction: row;
    gap: 16px;
    padding-top: 8px;
    border-top: 1px solid var(--a-line);
  }

  .adm-head { align-items: flex-start; flex-direction: column; gap: 12px; }

  .adm-title { font-size: 28px; }

  .ed__top { grid-template-columns: 1fr; }

  .ed__coverwrap { width: 150px; }

  .fld-row { grid-template-columns: 1fr; }

  .adm-people,
  .adm-fields2 { grid-template-columns: 1fr; }

  .adm-hist { grid-template-columns: 1fr; gap: 4px; }

  .adm-hist__meta { text-align: left; }

  .adm-dialog form { padding: 18px; }

  .adm-dialog__title { font-size: 24px; }
}
