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

html { color-scheme: light; scroll-behavior: smooth; background: var(--navy); }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }
a { color: var(--blue-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -60px;
  left: 12px;
  z-index: 1000;
  padding: 10px 16px;
  background: var(--surface);
  color: var(--navy);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.skip-link:focus { top: 8px; }
main:focus { outline: none; }

.container {
  width: min(100% - 32px, var(--container));
  margin-inline: auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--navy);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  height: var(--header-h);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand-logo { display: block; flex: 0 0 auto; }
.main-nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.main-nav a {
  color: rgba(255, 255, 255, 0.82);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.main-nav a:hover,
.main-nav a[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, 0.1); text-decoration: none; }
.auth-box { display: flex; align-items: center; gap: 8px; margin-left: var(--space-3); flex: 0 0 auto; }
.nav-download { flex: 0 0 auto; white-space: nowrap; }
.user-name { color: #fff; font-weight: 700; font-size: 14px; white-space: nowrap; }
.user-role { color: rgba(255, 255, 255, 0.6); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
.user-card { display: inline-flex; flex-direction: row; align-items: center; gap: 8px; line-height: 1.15; min-width: 0; max-width: 260px; }
.user-card-text { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; }
.user-card .user-name,
.user-card .user-role { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card .user-role { text-transform: none; letter-spacing: 0; }
.role-chief { color: #f0b6c4; }
.role-admin { color: #ff8b8b; }
.role-moderator { color: #7fe0a7; }
.role-captain, .role-assistant { color: #fff; }
.notif-wrap { position: relative; }
.notif-toggle { position: relative; font-size: 18px; line-height: 1; display: inline-flex; align-items: center; gap: 6px; }
.notif-label { display: none; font-size: 13px; font-weight: 600; }
.notif-time { display: block; font-size: 11px; color: var(--muted); }
.notif-count {
  position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 999px; background: var(--live, #c0392b); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}
.notif-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60;
  width: min(360px, calc(100vw - 24px)); max-height: 420px; overflow: auto;
  background: var(--surface, #fff); color: var(--text, #102a3a); border: 1px solid var(--line);
  border-radius: var(--radius, 10px); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25); padding: 8px;
}
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px 8px; }
.notif-item { display: flex; flex-direction: column; gap: 2px; padding: 9px 8px; border-radius: 8px; color: inherit; text-decoration: none; }
.notif-item:hover { background: rgba(0, 0, 0, 0.06); text-decoration: none; }
.notif-item span { color: var(--muted); font-size: 12px; }
.modal-overlay {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(3, 18, 30, 0.55);
}
.modal {
  width: min(460px, 100%); padding: 18px; border: 1px solid var(--line);
  border-radius: var(--radius, 12px); background: var(--surface, #fff); color: var(--text, #102a3a);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.modal-text { margin: 0 0 16px; line-height: 1.5; white-space: pre-line; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.nav-auth { display: none; }
.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  margin-left: auto;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 22px;
}
.header-link {
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
}
.header-link:hover { color: #fff; background: rgba(255, 255, 255, 0.1); text-decoration: none; }
.header-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Layout */
main { display: block; flex: 1 0 auto; min-height: 0; padding: 28px 0 56px; }
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.page-head h1 { margin: 0; font-size: clamp(24px, 3vw, 34px); line-height: 1.15; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.page-head p { margin: 6px 0 0; color: var(--muted); max-width: 70ch; }
.eyebrow {
  margin: 0 0 4px;
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.grid { display: grid; gap: var(--space-4); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.section { margin-bottom: var(--space-8); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; font-size: 20px; }
.section-head a { font-size: 14px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card h1, .card h2, .card h3 { overflow-wrap: anywhere; }
.card-pad { padding: var(--space-5); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { margin: 0; font-size: 16px; }
.card-body { padding: 18px; }
.card-link { color: inherit; display: block; }
.card-link:hover { text-decoration: none; border-color: var(--blue); }
.plate-link { color: inherit; }
.plate-link:hover { border-color: var(--blue); text-decoration: none; }
.plate-link:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.stat { padding: 18px; }
.stat-value { font-size: 30px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-label { margin-top: 6px; color: var(--muted); font-size: 13px; }
.hero {
  position: relative;
  overflow: hidden;
  margin-bottom: var(--space-6);
  padding: clamp(24px, 5vw, 46px);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue-dark) 100%);
  color: #fff;
  box-shadow: var(--shadow-lg);
}
.hero h1 { margin: 0 0 10px; max-width: 22ch; font-size: clamp(30px, 5vw, 52px); line-height: 1.05; letter-spacing: -0.03em; }
.hero p { margin: 0; max-width: 62ch; color: rgba(255, 255, 255, 0.78); font-size: 17px; }
.hero .eyebrow { color: #7fd3f4; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 22px; }
.hero .btn-secondary { background: transparent; border-color: rgba(255, 255, 255, 0.5); color: #fff; }
.hero .btn-secondary:hover { background: rgba(255, 255, 255, 0.12); border-color: #fff; color: #fff; }
.hero-link { padding: 9px 4px; color: #fff; font-size: 14px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.hero-link:hover { color: #fff; text-decoration-thickness: 2px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--blue-dark);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
  text-decoration: none;
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.btn:hover { background: var(--navy); color: #fff; text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn-secondary { background: var(--surface); border-color: #8494a1; color: var(--text); }
.btn-secondary:hover { background: var(--ice); border-color: var(--blue); color: var(--text); }
.btn-ghost { background: transparent; color: var(--blue-dark); border-color: transparent; }
.btn-ghost:hover { background: var(--ice); color: var(--blue-dark); }
.btn-danger { background: var(--live); }
.btn-danger:hover { background: #b31f1f; }
.btn-light { background: #fff; color: var(--navy); }
.btn-light:hover { background: var(--ice); color: var(--navy); }
.btn-sm { min-height: 32px; padding: 5px 10px; font-size: 13px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn[hidden] { display: none; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.6;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.badge-live { border-color: transparent; background: var(--live); color: #fff; }
.badge-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: pulse 1.6s infinite; }
.badge-scheduled { border-color: var(--blue); color: var(--blue-dark); }
.badge-finished { background: var(--surface-2); }
.badge-cancelled { text-decoration: line-through; }
.badge-approved { border-color: var(--green); background: var(--green-bg); color: var(--green); }
.badge-draft { border-style: dashed; }
.badge-gold { border-color: var(--gold); color: var(--yellow); background: #fbf6e8; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* Tables */
.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
table.data caption { text-align: left; }
table.data th {
  padding: 9px 12px;
  background: var(--navy);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
table.data th[aria-sort] { cursor: pointer; }
table.data td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.data tbody tr:nth-child(even) { background: var(--surface-2); }
table.data tbody tr.is-live { background: #fff8f8; }
table.data tbody tr:hover { background: var(--ice); }
table.data tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data th.num .th-sort { width: 100%; justify-content: flex-end; }
table.data .center { text-align: center; }
table.data .place { width: 44px; text-align: center; font-weight: 800; }
table.data .bib { width: 48px; text-align: center; color: var(--muted); }
table.data .name { font-weight: 600; }
table.data .name a:has(.phead) { white-space: nowrap; }
table.data td a:not(.btn) { text-decoration: underline; text-underline-offset: 2px; }
table.data .sticky-col { position: sticky; left: 0; background: var(--surface); z-index: 1; box-shadow: 2px 0 4px rgba(8, 35, 58, 0.07); }
table.data th.sticky-col { background: var(--navy); color: #fff; z-index: 4; }
table.data tbody tr:nth-child(even) .sticky-col { background: var(--surface-2); }
table.data tbody tr.is-live .sticky-col { background: #fff8f8; }
table.data tbody tr:hover .sticky-col { background: var(--ice); }
table.data .sticky-col.sticky-right { left: auto; right: 0; box-shadow: -2px 0 4px rgba(8, 35, 58, 0.07); }
.table-scroll-hint { display: none; margin: 0 0 6px; }
@media (max-width: 760px) {
  .table-scroll-hint { display: block; }
}

/* Social links: <details> мини-меню. Вне таблиц список всплывает, внутри таблицы раскрывается в потоке. */
.socials-menu { position: relative; display: inline-block; font-size: 13px; }
.socials-menu > summary {
  display: inline-flex; align-items: center; gap: 4px;
  cursor: pointer; font-weight: 600; color: var(--blue-dark); list-style: none;
}
.socials-menu > summary:hover { text-decoration: underline; }
.socials-menu > summary::-webkit-details-marker { display: none; }
.socials-menu > summary::after { content: "▾"; font-size: 10px; line-height: 1; }
.socials-menu[open] > summary::after { content: "▴"; }
.socials-menu ul {
  position: absolute; left: 0; top: calc(100% + 4px); z-index: 40;
  margin: 0; padding: 4px; list-style: none; min-width: 140px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-lg);
}
table.data td .socials-menu ul { position: static; top: auto; margin-top: 6px; }
@media (max-width: 640px) { .socials-menu ul { position: static; top: auto; margin-top: 6px; } }
.socials-menu li + li { margin-top: 2px; }
.socials-menu a,
table.data td .socials-menu a.social-link {
  display: block; padding: 6px 8px; border-radius: var(--radius-sm);
  color: var(--blue-dark); text-decoration: none; white-space: nowrap;
}
.socials-menu a:hover,
.socials-menu a:focus-visible { background: var(--ice); text-decoration: none; }

/* Mobile cards: .responsive on the table, .responsive-wrap on .table-wrap. */
@media (max-width: 640px) {
  .responsive-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  table.data.responsive thead { display: none; }
  table.data.responsive,
  table.data.responsive tbody,
  table.data.responsive tr,
  table.data.responsive td { display: block; width: auto; }
  table.data.responsive tr {
    margin-bottom: 10px;
    padding: 6px 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
  }
  table.data.responsive tbody tr:nth-child(even) { background: var(--surface); }
  table.data.responsive tbody tr.is-active { background: var(--ice); }
  table.data.responsive td {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 12px;
    padding: 4px 12px;
    border: 0;
    text-align: right;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  table.data.responsive td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    text-align: left;
  }
  table.data.responsive td:not([data-label])::before { content: none; }
  table.data.responsive td.name { font-weight: 700; }
  table.data.responsive td > .small,
  table.data.responsive td > .mono { flex: 1 1 100%; text-align: right; }
  table.data.responsive.table-wide { min-width: 0; }
  table.data.responsive .sticky-col { position: static; box-shadow: none; background: transparent; }
  table.data.responsive td.sticky-right { padding-top: 8px; border-top: 1px solid var(--line); }
  table.data.responsive td .table-actions { flex-wrap: wrap; }
  table.data.responsive tbody tr.startlist-session {
    margin: 4px 0;
    padding: 0;
    border: 0;
    background: transparent;
  }
  table.data.responsive tbody tr.startlist-session th {
    display: block;
    padding: 4px 2px;
    background: transparent;
    color: var(--blue-dark);
    font-size: 12px;
    letter-spacing: 0;
    text-transform: none;
  }
  table.data.responsive tr.row-detail { margin-top: -8px; }
  table.data.responsive tr.row-detail td::before { content: none; }
  .table-scroll-hint:has(+ .responsive-wrap) { display: none; }
}
table.data tr.place-1 td:first-child { box-shadow: inset 4px 0 var(--gold); }
table.data tr.place-2 td:first-child { box-shadow: inset 4px 0 var(--silver); }
table.data tr.place-3 td:first-child { box-shadow: inset 4px 0 var(--bronze); }
table.data tr.is-out td { color: var(--muted); }
.miss { color: var(--live); font-weight: 800; }
.zero { color: inherit; }
.row-toggle { cursor: pointer; }
.row-detail td { background: var(--ice) !important; }
.row-detail-inner { display: flex; flex-wrap: wrap; gap: 8px 24px; padding: 4px 0; font-size: 13px; color: var(--muted); }
.row-detail-inner b { color: var(--text); }

/* Flags */
.flag-cell { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 14px;
  border-radius: 2px;
  background: var(--ice);
  color: var(--navy);
  font-size: 8px;
  font-weight: 800;
  overflow: hidden;
  flex: 0 0 auto;
}
.flag img { width: 20px; height: 14px; object-fit: cover; display: block; }
.flag-code { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.03em; }

/* Голова скина: в окне ровно 1/8 скина (лицо). Размер задается шириной .phead. */
.phead {
  position: relative;
  display: inline-block;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  overflow: hidden;
  vertical-align: -5px;
  margin-right: 6px;
  border-radius: 3px;
  background: var(--surface-2) url('/assets/img/head-default.svg') center / 75% no-repeat;
}
.phead img {
  position: absolute;
  left: -100%;
  top: -100%;
  width: 800%;
  height: auto;
  max-width: none;
  image-rendering: pixelated;
}
/* Слой hat: лицо на 32 пикселя правее базового (40,8) при любой ширине скина. */
.phead .phead-hat { left: -500%; }
.user-card .phead { margin-right: 0; vertical-align: middle; }
.flag-cell .phead, .calendar-race-winner .phead { margin-right: 0; }
.page-head h1 .phead { width: 0.9em; height: 0.9em; vertical-align: -0.08em; margin-right: 0.25em; }
.leg-list .phead { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }

/* Forms */
.form { display: grid; gap: 16px; max-width: 520px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 700; font-size: 14px; }
.field .hint { color: var(--muted); font-size: 12px; }
.input, .select, .textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #7b8b98;
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
}
.textarea { min-height: 160px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--blue); outline: 0; box-shadow: 0 0 0 3px rgba(0, 136, 191, 0.25); }
.input:disabled, .select:disabled, .textarea:disabled {
  background: var(--surface-2);
  color: var(--muted);
  border-color: var(--line);
  cursor: not-allowed;
  opacity: 1;
}
.field-error { color: var(--live); font-size: 13px; min-height: 18px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.check-row { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.check-row input { width: 18px; height: 18px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 16px; }
.filters .field { min-width: 150px; }
.filters .field label { font-size: 12px; color: var(--muted); }

/* Alerts, empty, loading */
.alert { padding: 12px 14px; border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--radius-sm); background: var(--surface); font-size: 14px; }
.alert-error { border-left-color: var(--live); background: #fff7f7; }
.alert-success { border-left-color: var(--green); background: var(--green-bg); }
.alert-info { border-left-color: var(--blue); background: var(--ice); }
.alert-warning { border-left-color: var(--gold); background: #fdf8e9; }
.empty { padding: 34px 18px; text-align: center; color: var(--muted); }
.empty strong { display: block; margin-bottom: 4px; color: var(--text); }
.loading { padding: 28px 18px; color: var(--muted); text-align: center; }


/* Tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button {
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  padding: 10px 14px;
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--blue-dark); border-bottom-color: var(--blue); }

/* Sub-navigation (competitions: races / stages / sessions) */
.subnav {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
}
.subnav a {
  padding: 9px 14px;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
.subnav a:hover { color: var(--text); text-decoration: none; }
.subnav a[aria-current="page"] { color: var(--blue-dark); border-bottom-color: var(--blue); }

/* Lists */
.list { margin: 0; padding: 0; list-style: none; }
.list li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; padding-bottom: 0; }
.list li:first-child { padding-top: 0; }
.news-card .cover {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  background: linear-gradient(135deg, var(--navy), var(--blue));
}
.news-card .card-body { padding: 16px; }
.news-card h3 { margin: 0 0 6px; font-size: 17px; line-height: 1.25; }
.news-card time { color: var(--muted); font-size: 12px; }
.news-card p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }

/* Footer */
.site-footer {
  flex-shrink: 0;
  padding: 28px 0;
  background: var(--navy);
  color: rgba(255, 255, 255, 0.66);
  font-size: 13px;
}
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.site-footer a { color: rgba(255, 255, 255, 0.86); }
.site-footer .brand { font-size: 15px; }
.footer-social { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.footer-social a { color: rgba(255, 255, 255, 0.66); }
.footer-social a:hover,
.footer-social a:focus-visible { color: #7fd3f4; }

/* Toast */
.toast-region { position: fixed; right: 16px; bottom: 16px; z-index: 300; display: grid; gap: 8px; max-width: min(360px, calc(100vw - 32px)); }
.toast { padding: 11px 14px; border-radius: var(--radius); background: var(--navy); color: #fff; box-shadow: var(--shadow-lg); font-size: 14px; }
.toast-success { background: var(--green); }
.toast-error { background: var(--live); }

/* Utilities */
.hstack { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vstack { display: grid; gap: 8px; }
.spacer { flex: 1 1 auto; }
.justify-center { justify-content: center; }
.divider { height: 1px; background: var(--line); margin: 16px 0; border: 0; }
.code { font-family: var(--mono); font-size: 13px; background: var(--ice); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 2px 6px; overflow-wrap: anywhere; }
.copy-btn { border: 0; background: transparent; color: var(--blue-dark); font-size: 12px; font-weight: 700; padding: 2px 4px; }
.pill { display: inline-flex; padding: 1px 8px; border-radius: 999px; background: var(--ice); color: var(--blue-dark); font-size: 12px; font-weight: 700; }
.kv { display: grid; grid-template-columns: minmax(90px, max-content) minmax(0, 1fr); gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }

@media (max-width: 1200px) {
  .header-inner { gap: var(--space-3); }
  .user-card { max-width: 200px; }
}
@media (max-width: 1279px) {
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .main-nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 16px 16px;
    background: var(--navy);
    box-shadow: var(--shadow-lg);
  }
  .main-nav.is-open { display: flex; }
  .main-nav a { padding: 11px 10px; }
  .auth-box { display: none; }
  .nav-auth {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
  }
  .nav-auth .header-link { text-align: left; }
  .nav-auth .header-link.user-card { max-width: 100%; align-items: center; }
  .nav-auth .notif-label { display: inline; }
  .nav-auth .notif-count { left: 20px; right: auto; top: 8px; }
  .nav-auth .btn { align-self: flex-start; }
  .nav-auth .btn-light { color: var(--navy); }
  .nav-auth .btn-light:hover,
  .nav-auth .btn-light:focus-visible { color: var(--navy); background: var(--ice); }
}
@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .header-inner { gap: 8px; }
  .main-nav a { min-height: 44px; display: flex; align-items: center; }
  .nav-auth .header-link { min-height: 44px; display: flex; align-items: center; }
  .btn { min-height: 44px; }
  .page-head { align-items: flex-start; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  main { padding-top: 20px; }
  table.data th, table.data td { padding: 8px 9px; }
}
@media (max-width: 480px) {
  .container { width: calc(100% - 24px); }
  .hero-actions .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .badge-live::before { animation: none; }
}

@media print {
  .site-header, .site-footer, .nav-toggle, .btn { display: none !important; }
  body { background: #fff; }
  .table-wrap { box-shadow: none; }
}

/* Сводка зачета */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  align-items: start;
}
.summary-card { min-width: 0; overflow: hidden; }
.summary-card .card-head h2 { font-size: 15px; }
.summary-card .card-body { padding: 0; }
.summary-grid .table-wrap { border: 0; border-radius: 0; box-shadow: none; }
.summary-grid .empty { padding: 22px 18px; }
@media (max-width: 760px) {
  .summary-grid { grid-template-columns: minmax(0, 1fr); }
}
