/* Меню сайта, вкладки, разделы админки, редактор главной и меню. */

/* Шапка: на узком экране пункты меню уезжают в боковую панель, кнопка «Меню» её выдвигает */
.nav-toggle, .nav-head, .nav-scrim { display: none; }
.top .nav { flex-wrap: wrap; column-gap: 18px; row-gap: 0; }
.top .nav img.ic { width: 16px; height: 16px; object-fit: contain; }
@media (max-width: 980px) {
  .top .wrap { flex-wrap: nowrap; gap: 10px; min-height: 56px; padding-top: 0; padding-bottom: 0; }
  .top .who { margin-left: auto; }
  .nav-toggle { display: inline-flex; order: 3; }
  .top .nav { position: fixed; z-index: 90; top: 0; right: 0; bottom: 0; width: min(320px, 86vw); order: 0; flex: none;
    flex-direction: column; flex-wrap: nowrap; gap: 0; padding: 0 0 24px; overflow-y: auto; overscroll-behavior: contain;
    background: var(--head); box-shadow: -8px 0 32px rgba(0, 0, 0, .35); transform: translateX(100%); visibility: hidden;
    transition: transform .22s ease-out, visibility 0s linear .22s; }
  .top.open .nav { transform: none; visibility: visible; transition: transform .22s ease-out; }
  .nav-head { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 8px 0 20px; margin-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, .1); color: var(--head-text); font-weight: 600; }
  .nav-head span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-close { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 0;
    border-radius: var(--radius); background: none; color: var(--head-text); cursor: pointer; }
  .nav-close:hover { background: rgba(255, 255, 255, .08); }
  .nav-close .ic { width: 22px; height: 22px; }
  .top .nav a { display: flex; gap: 14px; min-height: 48px; padding: 0 20px; border: 0; border-left: 3px solid transparent;
    font-size: 16px; white-space: normal; }
  .top .nav a .ic { width: 20px; height: 20px; opacity: .85; }
  .top .nav a[aria-current] { border-left-color: var(--accent); background: rgba(255, 255, 255, .06); }
  .top .nav a:hover { background: rgba(255, 255, 255, .06); }
  .nav-scrim { display: block; position: fixed; inset: 0; z-index: 80; background: rgba(0, 10, 25, .55); opacity: 0;
    pointer-events: none; transition: opacity .22s; }
  .top.open .nav-scrim { opacity: 1; pointer-events: auto; }
  .nav-scrim[hidden] { display: none; }
  body.nav-open { overflow: hidden; }
  /* без скриптов панель не выдвинуть: показываем пункты обычным списком под шапкой */
  html:not(.js) .top .wrap { flex-wrap: wrap; }
  html:not(.js) .top .nav { position: static; width: auto; flex-basis: 100%; transform: none; visibility: visible; box-shadow: none; padding: 0; }
  html:not(.js) .nav-toggle { display: none; }
}
@media (max-width: 520px) { .nav-toggle span { display: none; } .nav-toggle { padding: 0 9px; } .brand-name { font-size: 16px; } }
@media (prefers-reduced-motion: reduce) { .top .nav, .nav-scrim { transition: none !important; } }

/* Вкладки */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: thin; }
.tabs [role=tab] { flex: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; cursor: pointer;
  padding: 10px 14px; color: var(--muted); font: 500 14px var(--sans); }
.tabs [role=tab]:hover { color: var(--ink); }
.tabs [role=tab][aria-selected=true] { color: var(--ink); border-bottom-color: var(--accent); }
.tabs [role=tab]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tab-note { margin-left: 6px; color: var(--second); font-size: 12px; }

/* Формы настроек: поля не растягиваются на всю ширину экрана */
.form-body.narrow { max-width: 720px; }
.form-body .field input.short { max-width: 220px; }
.check-row small { line-height: 1.45; }
details.adv { margin: 4px 0 16px; border-top: 1px dashed var(--line); }
details.adv > summary { cursor: pointer; padding: 12px 0; color: var(--accent-ink); font-weight: 500; font-size: 14px; list-style-position: inside; }
details.adv > summary .muted { font-weight: 400; font-size: 13px; margin-left: 6px; }
details.adv[open] > summary { margin-bottom: 6px; }

/* Боковое меню админки по группам; на телефоне сворачивается в одну кнопку с текущим разделом */
.side nav.grouped .nav-group + .nav-group { margin-top: 14px; }
.side .nav-title { font-size: 12.5px; color: var(--muted); padding: 0 0 4px; }
.side-toggle { display: none; }
@media (max-width: 860px) {
  .side-toggle { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 1px solid var(--line);
    border-radius: var(--radius); background: var(--surface); color: var(--ink); font: 500 15px var(--sans); cursor: pointer; }
  .side-toggle .ic { width: 18px; height: 18px; }
  .side-toggle .chev { margin-left: auto; display: inline-flex; transition: transform .15s; }
  .side.open .side-toggle .chev { transform: rotate(180deg); }
  .side nav.grouped { display: block; overflow: visible; margin-top: 8px; padding: 6px 12px 10px; border: 1px solid var(--line);
    border-radius: var(--radius); background: var(--surface); }
  .js .side:not(.open) nav.grouped { display: none; }
  .side nav.grouped a { margin: 0 -8px; padding: 10px 8px; white-space: normal; }
  .side .me.plain { display: none; }
  .side nav:not(.grouped) { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; overflow: visible; }
  .side nav:not(.grouped) a { padding: 9px 10px; }
}

/* Редактор главной и меню */
.home-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.home-item { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.home-item.off .home-name, .home-item.off .icon-btn, .home-item.off .nav-row > input { opacity: .55; }
.home-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px 8px 12px; }
.home-row > input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.home-row .check { margin: 0; }
.home-tools { display: flex; gap: 4px; margin-left: auto; }
.btn.icon-only { padding: 0; width: 32px; justify-content: center; }
.home-open { flex: 1 1 200px; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 4px; border: 0; background: none;
  cursor: pointer; text-align: left; font: 500 15px var(--sans); color: var(--ink); }
.home-open .home-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-open .home-kind { font-size: 13px; font-weight: 400; white-space: nowrap; }
.home-open .chev { margin-left: auto; display: inline-flex; color: var(--muted); transition: transform .15s; }
.home-item.open .home-open .chev { transform: rotate(180deg); }
.home-body { display: none; padding: 4px 14px 14px; border-top: 1px solid var(--line-soft); }
.home-item.open .home-body { display: block; }
.home-body .field { margin: 12px 0 0; }
.home-body .field > input { width: 100%; }
.hint.first { margin: 0 0 14px; }

.ed { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.ed:focus-within { border-color: var(--accent); }
.ed-bar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border-bottom: 1px solid var(--line-soft); }
.ed-bar .btn { padding: 0; width: 32px; justify-content: center; }
.ed-bar select.ed-subst { width: auto; height: 30px; font-size: 13px; padding: 0 8px; margin-left: auto; }
.ed-area { min-height: 130px; max-height: 60vh; overflow-y: auto; padding: 10px 12px; line-height: 1.55; outline: none; color: var(--text); }
.ed-area:empty::before { content: attr(data-placeholder); color: var(--muted); }
.ed-area p { margin: 0 0 10px; }
.ed-area ul { margin: 0 0 10px; padding-left: 22px; }
.ed-area a { color: var(--accent-ink); }

.nav-row > input:not([type=checkbox]) { flex: 1 1 150px; min-width: 0; }
.nav-row > input[aria-label=Адрес] { flex-basis: 240px; }
.nav-url { flex: 1 1 150px; font-size: 13px; }
.icon-btn { width: 38px; height: 38px; flex: none; display: inline-flex; align-items: center; justify-content: center; border: 1px dashed var(--line);
  border-radius: var(--radius); background: var(--bg); color: var(--ink); cursor: pointer; }
.icon-btn:hover { border-color: var(--accent); border-style: solid; }
.icon-btn .ic { width: 18px; height: 18px; }
.icon-btn img.ic { object-fit: contain; }
.no-ic { font-size: 11px; color: var(--muted); }

.icon-pick { max-width: 640px; }
.icon-pick .modal-body { padding: 14px 16px 16px; }
.icon-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.icon-acts label.btn { cursor: pointer; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 4px; margin-top: 10px; max-height: 50vh; overflow-y: auto; }
.icon-cell { height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: var(--radius);
  background: none; color: var(--ink); cursor: pointer; }
.icon-cell:hover, .icon-cell:focus-visible { background: var(--accent-soft); border-color: var(--accent); }
.icon-cell .ic { width: 20px; height: 20px; }

.save-bar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px;
  padding: 12px 0; background: var(--bg); border-top: 1px solid var(--line); }
.save-bar .form-error { margin: 0; flex-basis: 100%; }
@media (max-width: 600px) {
  .home-open .home-kind { display: none; }
  .nav-row > input[aria-label=Адрес] { flex-basis: 100%; }
}

/* Формы в кабинете и админке не шире удобной строки, даже на большом мониторе */
.layout .content .section > .form-body { max-width: 720px; }
.layout .content .section > .form-body.wide { max-width: none; }

/* Первые шаги в админке */
.first-steps { margin-bottom: 18px; }
.first-steps > header .act { margin-left: auto; }
.steps { list-style: none; margin: 0; padding: 6px 16px 10px; display: grid; gap: 2px; }
.steps li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; }
.steps li + li { border-top: 1px solid var(--line-soft); }
.steps li .ic { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--muted); }
.steps li.done .ic { color: var(--ok, #1a8f5a); }
.steps li.done b { color: var(--muted); font-weight: 500; }
.steps li div { display: flex; flex-direction: column; gap: 2px; }
.steps li .muted { font-size: 13.5px; }
.fw-ok { display: flex; align-items: flex-start; gap: 6px; margin: -6px 0 14px; }
.fw-ok .ic { width: 15px; height: 15px; flex: none; margin-top: 2px; color: var(--ok); }

/* Оформление во вкладке редактора главной: три компактные карточки */
.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.brand-card { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.brand-card .brand-preview { min-height: 72px; height: 72px; padding: 6px; gap: 0; }
.brand-card .brand-preview img { max-height: 58px; max-width: 100%; object-fit: contain; }
.brand-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.brand-info .brand-upload { margin: 6px 0 2px; gap: 6px; }
.brand-info small { font-size: 12px; line-height: 1.4; }
.brand-info .form-error { margin: 4px 0 0; }
.save-bar[hidden] { display: none; }
