/* Основа и общий макет доски (B-7). Значения — только var(--…) из tokens.css.
   Цветов (hex, rgb) и чисел в px у отступов и скруглений здесь нет — тест test_b7_kit это проверяет. */

@font-face { font-family: Onest; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/Onest-Regular.ttf") format("truetype"); }
@font-face { font-family: Onest; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/Onest-Medium.ttf") format("truetype"); }
@font-face { font-family: Onest; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/Onest-SemiBold.ttf") format("truetype"); }
@font-face { font-family: Onest; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/Onest-Bold.ttf") format("truetype"); }

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-width: 0;
  background: var(--bg-page);
  color: var(--text-body);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  overflow-wrap: anywhere;
}

h1, h2, h3 { margin: 0; color: var(--text-heading); font-weight: var(--fw-semibold); }
h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); letter-spacing: var(--ls-h1); }
h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); letter-spacing: var(--ls-h2); }
h3 { font-size: var(--fs-h3); line-height: var(--lh-h3); }
p { margin: 0; }

a { color: var(--link); text-underline-offset: 0.15em; }
a:hover { color: var(--link-hover); }

img, svg { max-width: 100%; }

:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--shadow-focus); border-radius: var(--radius-s); }

.caption { font-size: var(--fs-caption); line-height: var(--lh-caption); font-weight: var(--fw-medium); color: var(--text-muted); }
.text-sm { font-size: var(--fs-body-sm); line-height: var(--lh-body-sm); }
.muted { color: var(--text-muted); }
.num { font-variant-numeric: tabular-nums; }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack-s { display: flex; flex-direction: column; gap: var(--space-2); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Пропуск к содержанию */
.skip-link { position: absolute; left: var(--space-4); top: calc(-1 * var(--space-8)); padding: var(--space-2) var(--space-4); background: var(--bg-card); z-index: 10; }
.skip-link:focus { top: var(--space-2); }

/* Макет: меню слева, сверху имя и роль ------------------------------------------- */

.shell {
  display: grid;
  grid-template-columns: var(--nav-w) minmax(0, 1fr);
  min-height: 100vh;
}

.shell-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-5) var(--space-4);
  border-right: var(--border-w) solid var(--divider);
  min-width: 0;
}

.shell-brand {
  display: flex;
  align-items: center;
  min-height: var(--tap-min);
  margin: 0 var(--space-3) var(--space-4);
  font-size: var(--fs-h3);
  line-height: var(--lh-h3);
  font-weight: var(--fw-semibold);
  color: var(--text-heading);
  text-decoration: none;
}
.shell-brand:hover { color: var(--text-heading); }

.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-1); }

.nav-link {
  display: flex;
  align-items: center;
  min-height: var(--tap-min);
  padding: 0 var(--space-3);
  border-radius: var(--radius-m);
  color: var(--text-body);
  font-size: var(--fs-button-cabinet);
  text-decoration: none;
}
.nav-link:hover { background: var(--bg-soft); color: var(--text-body); }
.nav-link[aria-current="page"] { background: var(--selected-bg); color: var(--selected-text); font-weight: var(--fw-semibold); }
.nav-link:focus-visible { border-radius: var(--radius-m); }

.shell-main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3) var(--space-4);
  padding: var(--space-3) var(--space-6);
  border-bottom: var(--border-w) solid var(--divider);
  min-height: calc(var(--tap-min) + 2 * var(--space-3));
}

.topbar-user { display: flex; flex-direction: column; align-items: flex-end; min-width: 0; }
.topbar-name { font-size: var(--fs-body-sm); line-height: var(--lh-body-sm); font-weight: var(--fw-semibold); color: var(--text-heading); }
.topbar-role { font-size: var(--fs-caption); line-height: var(--lh-caption); font-weight: var(--fw-medium); color: var(--text-muted); }
.topbar form { margin: 0; }

.content {
  width: 100%;
  max-width: var(--container-max);
  padding: var(--space-6) var(--space-6) var(--space-7);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  min-width: 0;
}

/* Страница без меню (вход) */
.bare {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-8) var(--space-4) var(--space-7);
}
.bare-inner { width: 100%; max-width: var(--container-narrow); display: flex; flex-direction: column; gap: var(--space-5); }
.login-box { max-width: calc(var(--container-narrow) * 0.6); }

/* Узкий экран: меню — строкой сверху с переносом, без горизонтальной прокрутки страницы */
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .shell-nav { border-right: 0; border-bottom: var(--border-w) solid var(--divider); padding: var(--space-3) var(--space-4); }
  .shell-brand { margin: 0 0 var(--space-2); }
  .nav-list { flex-direction: row; flex-wrap: wrap; gap: var(--space-1) var(--space-2); }
  .topbar { padding: var(--space-3) var(--space-4); justify-content: space-between; }
  .topbar-user { align-items: flex-start; }
  .content { padding: var(--space-5) var(--space-4) var(--space-7); }
  h1 { font-size: var(--fs-h1-mobile); }
  .bare { padding: var(--space-6) var(--space-4); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
