/* ==========================================================
   Этап 1. Сброс, типографика, каркас страницы
   ========================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--text);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: var(--fs-xl); font-weight: 500; line-height: var(--lh-tight); }
h2 { font-size: var(--fs-lg); font-weight: 600; line-height: var(--lh-tight); }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; max-width: 100%; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r-btn); }

.muted { color: var(--text-muted); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Каркас: сайдбар слева, панель справа ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: var(--page-gap);
  min-height: 100vh;
  padding: var(--page-gap);
}
.sidebar {
  position: sticky; top: var(--page-gap);
  align-self: start;
  height: calc(100vh - var(--page-gap) * 2);
  display: flex; flex-direction: column;
  padding: var(--sp-2) 0;
}
.panel {
  background: var(--bg-panel);
  border-radius: var(--r-panel);
  padding: 48px var(--panel-pad) var(--panel-pad);
  min-width: 0;
}

/* ---------- Шаблон страницы ---------- */
.page-back {
  display: inline-block; margin-bottom: var(--sp-3);
  font-size: var(--fs-sm); color: var(--text-muted); text-decoration: none;
}
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4); flex-wrap: wrap;
}
.page-head__actions { display: flex; align-items: center; gap: var(--sp-3); }
.page-sub { margin-top: var(--sp-2); color: var(--text-muted); }
.page-body { margin-top: var(--sp-6); }
.section + .section {
  margin-top: var(--sp-8); padding-top: var(--sp-8);
  border-top: 1px solid var(--border);
}

/* ---------- Мобильный: сайдбар становится шапкой ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; padding: 8px; gap: 8px; }
  .sidebar { position: static; height: auto; padding: 8px 8px 0; }
  .panel { padding-top: 28px; }
}
