/* Шапка, меню сервиса и подвал сайтов emax (ADR-0006). Только переменные --emax-* из tokens.css. */
.emx-header, .emx-footer, .emx-tabbar, .emx-menu { --emx-width: 1100px; font-family: var(--emax-font-body); }
.emx-header *, .emx-footer *, .emx-tabbar *, .emx-menu * { box-sizing: border-box; }
.emx-wrap { max-width: var(--emx-width); margin: 0 auto; padding-inline: var(--emax-space-4); }

/* Шапка */
.emx-header { position: sticky; top: 0; z-index: 20; background: var(--emax-surface); border-bottom: 1px solid var(--emax-border); color: var(--emax-text); }
.emx-bar { position: relative; display: flex; align-items: center; gap: var(--emax-space-6); height: var(--emax-size-header-height); }
.emx-brand { display: flex; align-items: center; gap: var(--emax-space-2); height: 40px; padding: 0 10px 0 6px; margin-left: -6px; border-radius: var(--emax-radius-input); color: var(--emax-text); text-decoration: none; font: 700 19px/1 var(--emax-font-display); letter-spacing: -0.01em; flex: none; }
.emx-brand:hover { background: var(--emax-teal-tint); }
.emx-brand .emx-logo { width: 28px; height: 28px; }
.emx-logo { display: block; flex: none; }
.emx-i { width: 20px; height: 20px; flex: none; }

.emx-nav { display: flex; gap: 22px; align-self: stretch; min-width: 0; }
.emx-nav a, .emx-row2 a { position: relative; display: flex; align-items: center; gap: 7px; color: var(--emax-muted); font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap; }
.emx-nav .emx-i { width: 18px; height: 18px; }
.emx-nav a[aria-current="page"], .emx-row2 a[aria-current="page"] { color: var(--emax-text); }
.emx-nav a[aria-current="page"]::after, .emx-row2 a[aria-current="page"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--emax-teal); }
.emx-nav a:hover, .emx-row2 a:hover { color: var(--emax-text); }

.emx-row2 { display: flex; gap: 20px; height: var(--emax-size-header-row2); overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--emax-border); -webkit-mask-image: linear-gradient(90deg, #000 90%, transparent); mask-image: linear-gradient(90deg, #000 90%, transparent); }
.emx-row2::-webkit-scrollbar { display: none; }
.emx-row2 a { font-size: 14.5px; }
.emx-row2 a[aria-current="page"]::after { bottom: 0; }
.emx-sep { width: 1px; height: 18px; align-self: center; background: var(--emax-border); flex: none; }

.emx-acts { margin-left: auto; display: flex; align-items: center; gap: var(--emax-space-2); flex: none; }
.emx-ib { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--emax-border); border-radius: var(--emax-radius-input); background: none; color: var(--emax-text); cursor: pointer; padding: 0; }
.emx-ib:hover, .emx-ib[aria-expanded="true"] { background: var(--emax-teal-tint); }
.emx-ib[aria-expanded="true"] { border-color: var(--emax-teal); }
.emx-login { display: inline-flex; align-items: center; height: 40px; padding: 0 16px; border-radius: var(--emax-radius-button); background: var(--emax-teal); color: var(--emax-on-accent); font-weight: 600; font-size: 14.5px; text-decoration: none; }
.emx-av { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--emax-teal); color: var(--emax-on-accent); font: 700 16px/1 var(--emax-font-display); cursor: pointer; }
.emx-badge { display: inline-block; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--emax-teal); color: var(--emax-on-accent); font: 700 11px/18px var(--emax-font-body); text-align: center; }

/* Тема: показываем луну в светлой теме и солнце в тёмной */
.emx-theme .emx-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .emx-theme .emx-sun { display: block; }
  :root:not([data-theme="light"]) .emx-theme .emx-moon { display: none; }
}
:root[data-theme="dark"] .emx-theme .emx-sun { display: block; }
:root[data-theme="dark"] .emx-theme .emx-moon { display: none; }

/* Меню сервисов и аккаунта */
.emx-menu { position: absolute; top: calc(100% + 4px); right: 0; z-index: 30; width: 320px; display: grid; gap: 2px; padding: var(--emax-space-2); background: var(--emax-surface); border: 1px solid var(--emax-border); border-radius: var(--emax-radius-card-lg); box-shadow: 0 14px 36px rgba(8, 18, 20, 0.18); color: var(--emax-text); }
.emx-menu[hidden], .emx-scrim[hidden] { display: none; }
.emx-menu-acc { width: 260px; }
.emx-mh { margin: 0; padding: 6px 10px 4px; font-size: 12.5px; font-weight: 600; color: var(--emax-muted); }
.emx-it { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 10px; border-radius: var(--emax-radius-input); color: inherit; text-decoration: none; }
.emx-it:hover, .emx-it:focus-visible, .emx-it[aria-current="page"] { background: var(--emax-teal-tint); }
.emx-it b { display: block; font: 700 16px/1.2 var(--emax-font-display); letter-spacing: -0.01em; }
.emx-it small { display: block; font-size: 13px; color: var(--emax-muted); line-height: 1.3; }
.emx-it em { font-style: normal; font-size: 12px; font-weight: 600; color: var(--emax-teal); }
.emx-tile { width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--emax-radius-input); background: var(--emax-teal-tint); color: var(--emax-teal); }
.emx-tile .emx-logo { width: 22px; height: 22px; }
.emx-mlink { display: block; padding: 9px 10px; border-radius: var(--emax-radius-input); color: var(--emax-teal); font-weight: 600; font-size: 14.5px; text-decoration: none; }
.emx-mlink:hover { background: var(--emax-teal-tint); }
.emx-msep { height: 1px; margin: 4px 2px; background: var(--emax-border); }
.emx-who { padding: 8px 10px 6px; }
.emx-who b { display: block; }
.emx-who small { font-size: 13px; color: var(--emax-muted); }
/* Слои: шапка 20 (меню внутри неё), затемнение 19, нижняя панель 18 */
.emx-scrim { position: fixed; inset: 0; z-index: 19; background: rgba(8, 16, 18, 0.45); }

/* Нижняя панель на телефоне */
.emx-tabbar { display: none; }
@media (max-width: 719px) {
  .emx-bar { gap: var(--emax-space-2); }
  .emx-nav { display: none; }
  .emx-acts { gap: 6px; }
  .emx-tabbar { position: fixed; z-index: 18; left: 0; right: 0; bottom: 0; display: flex; padding: 8px 0 calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--emax-surface); border-top: 1px solid var(--emax-border); }
  .emx-tabbar a { position: relative; flex: 1; display: grid; justify-items: center; gap: 4px; color: var(--emax-muted); font-size: 11.5px; font-weight: 600; text-decoration: none; }
  .emx-tabbar .emx-i { width: 22px; height: 22px; }
  .emx-tabbar a[aria-current="page"] { color: var(--emax-teal); }
  .emx-tabbar .emx-badge { position: absolute; top: -5px; left: calc(50% + 4px); }
  body:has(.emx-tabbar) { padding-bottom: calc(var(--emax-size-tabbar-height) + env(safe-area-inset-bottom, 0px)); }
  .emx-menu { position: fixed; top: auto; left: 0; right: 0; bottom: 0; width: auto; border-radius: 18px 18px 0 0; border-width: 1px 0 0; padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
}

/* Подвал */
.emx-footer { margin-top: var(--emax-space-8); background: var(--emax-surface); border-top: 1px solid var(--emax-border); color: var(--emax-text); font-size: 14.5px; }
.emx-footer .emx-wrap { display: grid; gap: 18px; padding-block: var(--emax-space-6) 18px; }
.emx-ftop { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; }
.emx-fh { margin: 0 0 8px; font: 600 12.5px/1.2 var(--emax-font-body); color: var(--emax-muted); }
.emx-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.emx-footer a { color: var(--emax-text); text-decoration: none; }
.emx-footer a:hover { color: var(--emax-teal); }
.emx-note { margin: 0; max-width: 72ch; color: var(--emax-muted); font-size: 13.5px; line-height: 1.5; }
.emx-note a { text-decoration: underline; }
.emx-fsvc { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; padding-top: 14px; border-top: 1px solid var(--emax-border); }
/* Без ссылок и пояснения полоса сервисов идёт первой: вторая линия под рамкой подвала не нужна */
.emx-footer .emx-wrap > .emx-fsvc:first-child { border-top: 0; padding-top: 0; }
.emx-fsvc span { font-size: 13px; color: var(--emax-muted); }
.emx-fsvc a { font: 700 15px/1 var(--emax-font-display); letter-spacing: -0.01em; }
.emx-fsvc a[aria-current="page"] { color: var(--emax-teal); }
.emx-fbot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; color: var(--emax-muted); font-size: 13px; }
.emx-fbot .emx-logo { width: 18px; height: 18px; }
.emx-age { border: 1.5px solid currentColor; border-radius: 6px; padding: 1px 6px; font-weight: 700; font-size: 12px; line-height: 1.3; }
@media (max-width: 719px) { .emx-footer .emx-wrap { padding-block: 18px 16px; } }

.emx-header :focus-visible, .emx-footer :focus-visible, .emx-tabbar :focus-visible, .emx-menu :focus-visible { outline: 2px solid var(--emax-teal); outline-offset: 2px; }
