/*
 * Оболочка админки (#213, шаг 2): меню разделов, верхняя полоса с поиском, вкладки раздела, нижние
 * вкладки узкого экрана, «К содержимому», свой фокус. Вид — как у оболочки пульта (`public-new/shell.css`,
 * #205), значения — из макетов `docs/dizajn-pulta/213-maket/`; цвета — только токены `shared/tokens.css`.
 *
 * Узкий экран — до 860 px, как у всех правил админки (`admin.css`): меню слева прячется, внизу
 * вкладки. Цели нажатия на узком — не меньше 44 px (WCAG 2.2 2.5.8, чек-лист 9889).
 */

/* ── свой фокус с клавиатуры (WCAG 2.4.7, 2.4.11): 2 px бирюзы, на тёмном — светлый ─────── */
.nav :focus-visible { outline-color: var(--focus-on-dark); }
main.main:focus { outline: none; }

/* ── «К содержимому»: видна, только когда до неё дошли клавиатурой ────────────────────── */
.shell-skip {
  position: absolute; left: 8px; top: -60px; z-index: 50;
  padding: 10px 14px; border-radius: 6px;
  background: var(--card); color: var(--accent); font-weight: 500;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.shell-skip:focus-visible { top: 8px; }

/* ── меню слева ───────────────────────────────────────────────────────────────────── */
.shell-column { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; }
.nav .shell-nav-item {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  min-height: 40px; padding: 9px 10px; border-radius: 8px;
  font-size: 14px; color: var(--nav-quiet); text-decoration: none;
}
.nav .shell-nav-item:hover { color: #ffffff; text-decoration: none; }
.nav .shell-nav-item.on { color: #ffffff; background: var(--nav-active); }
.nav .shell-nav-item .count { font-size: 11px; background: var(--warn); color: var(--text); border-radius: 9px; padding: 0 6px; font-weight: 600; }
.nav .spacer + .shell-nav-item { margin-bottom: 8px; }

/* ── верхняя полоса ───────────────────────────────────────────────────────────────── */
.shell-topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 36px; min-height: 56px;
  border-bottom: 1px solid var(--border); background: var(--card);
  position: sticky; top: 0; z-index: 5;
}
.shell-title { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell-search-field {
  width: 280px; height: 36px; padding: 0 10px;
  border: 1px solid var(--border-input); border-radius: 6px;
  background: var(--card); color: var(--text); font: inherit; font-size: 13px;
}
.shell-search-field::placeholder { color: var(--text-quiet); opacity: 1; }
.shell-search-field:focus-visible { outline-offset: 0; }
.shell-icon-button {
  display: inline-grid; place-items: center; min-width: 44px; min-height: 44px;
  border-radius: 6px; color: var(--text-2);
}
.shell-narrow-only { display: none; }

/* ── вкладки раздела ──────────────────────────────────────────────────────────────── */
.shell-tabs {
  display: flex; gap: 4px; padding: 0 36px;
  border-bottom: 1px solid var(--border); background: var(--card);
  overflow-x: auto;
}
.shell-tab {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px;
  border-bottom: 2px solid transparent; color: var(--text-2); font-size: 14px; white-space: nowrap;
}
.shell-tab:hover { color: var(--text); text-decoration: none; }
.shell-tab.on { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.shell-tab:focus-visible { outline-offset: -2px; }

/* ── нижние вкладки: только на узком экране ───────────────────────────────────────── */
.shell-tabbar { display: none; }

/* ── экраны оболочки: «Ещё», «Поиск» ─────────────────────────────────────────────── */
.shell-quiet { color: var(--text-2); font-size: 13px; line-height: 1.45; }
.shell-more {
  display: flex; flex-direction: column;
  border: 1px solid var(--border); border-radius: 8px; background: var(--card); overflow: hidden;
}
.shell-more-item {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  min-height: 48px; padding: 8px 16px;
  border-top: 1px solid var(--row-line); color: var(--text); font-size: 15px;
}
.shell-more-item:first-child { border-top: 0; }
.shell-more-item > .shell-quiet { flex-shrink: 0; white-space: nowrap; }
.shell-more-item:hover { background: var(--table-head); color: var(--text); text-decoration: none; }
.shell-more-item:focus-visible { outline-offset: -2px; }
.shell-more-footer .foot {
  padding: 12px 16px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); font-size: 13px; line-height: 1.45;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.shell-more-footer .who { font-weight: 500; }
.shell-more-footer .sub { color: var(--text-2); }
.shell-more-footer button {
  min-height: 44px; padding: 0 16px; border: 1px solid var(--border-field); border-radius: 6px;
  background: var(--card); color: var(--text); font-size: 14px; cursor: pointer;
}
.shell-search-page { display: flex; gap: 8px; align-items: center; }
.shell-search-page .shell-search-wide { flex: 1; width: auto; max-width: 520px; height: 40px; font-size: 14px; }
.shell-search-page .ui-button { height: 40px; }

/* ── узкий экран ──────────────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .shell > .nav { display: none; }
  .shell-topbar {
    padding: 0 4px 0 16px; min-height: 48px;
    background: var(--nav); border-bottom: 0; border-top: 4px solid var(--staff);
  }
  .shell-topbar :focus-visible { outline-color: var(--focus-on-dark); }
  .shell-title { color: #ffffff; }
  .shell-search { display: none; }
  .shell-narrow-only { display: inline-grid; }
  .shell-icon-button { color: var(--nav-text); }
  .shell-tabs { padding: 0 8px; }
  /* Содержимое не уходит под нижние вкладки. */
  .shell-column { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
  .shell-tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--card); border-top: 1px solid var(--border);
  }
  .shell-tabbar-2 { grid-template-columns: repeat(2, 1fr); }
  .shell-tabbar-3 { grid-template-columns: repeat(3, 1fr); }
  .shell-tabbar-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 56px; padding: 6px 0; font-size: 11px; color: var(--text-2);
  }
  .shell-tabbar-item:hover { text-decoration: none; }
  .shell-tabbar-item svg { color: var(--text-quiet); }
  .shell-tabbar-item.on, .shell-tabbar-item.on svg { color: var(--accent); font-weight: 600; }
  .shell-tabbar-item:focus-visible { outline-offset: -3px; }
  .shell-search-page .ui-button { min-height: 44px; }
  .shell-search-page .shell-search-wide { height: 44px; }
}
