/* Шрифт Manrope (SIL Open Font License, файл fonts/OFL.txt) хранится вместе с сайтом. */
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/manrope-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/manrope-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
    U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --bg: #f7f6f3;
  --surface: #ffffff;
  --ink: #1d2360;
  --text: #2b2f4a;
  --muted: #6b6f86;
  --line: #ebe8e1;
  --field: #d9d6e3;
  --violet: #5b4bd5;
  --violet-dark: #4a3bbf;
  --violet-soft: #efedfd;
  --orange: #e8650f;
  --orange-strong: #c84b09;
  --orange-hover: #ad3f06;
  --orange-soft: #fff0e3;
  --gold: #f5b400;
  --gold-dark: #d99a00;
  --gold-light: #ffe9a3;
  --gold-soft: #fff7e0;
  --silver: #c3c9d6;
  --silver-dark: #8e97ab;
  --silver-light: #eef1f6;
  --bronze: #d88a55;
  --bronze-dark: #b25f28;
  --bronze-light: #f7d6bd;
  --bronze-soft: #fcf0e6;
  --ok: #1d7a43;
  --ok-soft: #e3f5ea;
  --pending: #8a5300;
  --pending-soft: #fff3d6;
  --danger: #b42318;
  --danger-soft: #fdeaea;
  --radius-lg: 22px;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(29, 35, 96, 0.04), 0 6px 20px rgba(29, 35, 96, 0.05);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231d2360' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5l6 6 6-6'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--violet-dark); text-underline-offset: 3px; }
a:hover { color: var(--violet); }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { color: var(--ink); font-weight: 800; letter-spacing: -0.015em; }
h1 { font-size: clamp(1.7rem, 1.35rem + 1.5vw, 2.3rem); line-height: 1.15; }
h2 { font-size: 1.25rem; line-height: 1.25; }
h3 { font-size: 1rem; line-height: 1.35; letter-spacing: 0; }
button, input, select, textarea { font-family: inherit; }
:focus-visible { outline: 3px solid rgba(91, 75, 213, 0.45); outline-offset: 2px; }
[hidden] { display: none !important; }

.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 700px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.icon {
  width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.25em;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* Шапка */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding-top: 12px; padding-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand-logo { width: 42px; height: 42px; }
.brand-name { display: block; font-size: 1.0625rem; font-weight: 800; line-height: 1.15; }
.brand-school { display: block; color: var(--muted); font-size: 0.8125rem; font-weight: 600; line-height: 1.25; }
.main-nav { order: 3; display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.nav-link {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px;
  background: #f3f2f7; color: var(--text); font-size: 0.9375rem; font-weight: 700; text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}
.nav-link .icon { color: var(--violet); }
.nav-link:hover { background: var(--violet-soft); color: var(--ink); }
.nav-link[aria-current="page"] { --icon-cut: var(--violet); background: var(--violet); color: #fff; }
.nav-link[aria-current="page"] .icon { color: #fff; }
.badge-count {
  min-width: 22px; padding: 0 6px; border-radius: 999px; background: var(--orange-strong); color: #fff;
  font-size: 0.75rem; font-weight: 800; line-height: 22px; text-align: center;
}
@media (min-width: 900px) {
  .header-inner { flex-wrap: nowrap; }
  .brand { margin-right: 18px; }
  .main-nav { order: 0; width: auto; margin-right: auto; }
  .nav-link { background: transparent; }
}

.account-menu { position: relative; }
.account-menu > summary {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 12px 4px 4px;
  border-radius: 999px; background: #f3f2f7; color: var(--ink); font-weight: 800; list-style: none; cursor: pointer;
}
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu > summary:hover { background: var(--violet-soft); }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--violet); color: #fff; }
.avatar .icon { width: 20px; height: 20px; }
.account-name { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-panel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 10; min-width: 250px; padding: 6px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  box-shadow: 0 12px 32px rgba(29, 35, 96, 0.12);
}
.menu-panel a, .menu-panel button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0;
  border-radius: 10px; background: none; color: var(--text); font: inherit; font-weight: 600;
  text-align: left; text-decoration: none; cursor: pointer;
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--violet-soft); color: var(--ink); }
.menu-meta { margin-bottom: 4px; padding: 8px 12px 10px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 0.875rem; font-weight: 600; }
@media (max-width: 479px) {
  .nav-link { padding: 7px 12px; }
  .nav-link .icon { display: none; }
  .account-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .account-menu > summary { padding: 4px; }
  .account-menu > summary > .icon { display: none; }
}

/* Общие элементы */
.site-main { padding-top: 28px; padding-bottom: 56px; }
.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 20px;
}
.subtitle { margin-top: 8px; color: var(--muted); font-weight: 600; }
.section { margin-top: 28px; }
.back-link {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px;
  color: var(--muted); font-weight: 700; text-decoration: none;
}
.back-link:hover { color: var(--violet-dark); }
.card, .panel {
  padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow);
}
@media (min-width: 720px) { .card, .panel { padding: 22px 24px; } }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.link-small {
  display: inline-flex; align-items: center; gap: 4px; color: var(--violet-dark);
  font-size: 0.875rem; font-weight: 700; text-decoration: none;
}
.link-small:hover { text-decoration: underline; }
.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; }
.export-menu { position: relative; }
.export-menu > summary { list-style: none; cursor: pointer; }
.export-menu > summary::-webkit-details-marker { display: none; }
.export-menu > summary:hover { text-decoration: underline; }
.export-menu .menu-panel { min-width: 190px; }
.empty { padding: 22px 16px; border-radius: var(--radius); background: #f3f1ec; color: var(--muted); font-weight: 600; text-align: center; list-style: none; }
.card .empty { background: #f7f6f3; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px;
  padding: 10px 20px; border: 1px solid transparent; border-radius: 14px; background: var(--violet-soft);
  color: var(--violet-dark); font: inherit; font-weight: 800; text-align: center; text-decoration: none;
  cursor: pointer; transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.button:hover { background: #e3dffb; color: var(--violet-dark); }
.button-primary { background: var(--orange-strong); color: #fff; box-shadow: 0 6px 14px rgba(200, 75, 9, 0.22); }
.button-primary:hover, .button-primary:active { background: var(--orange-hover); color: #fff; }
.button-warm { background: var(--orange-soft); color: var(--orange-strong); }
.button-warm:hover { background: #ffe2c9; color: var(--orange-hover); }
.button-danger { border-color: #f1c4c0; background: var(--surface); color: var(--danger); }
.button-danger:hover { background: var(--danger-soft); color: var(--danger); }
.button-small { min-height: 40px; padding: 7px 16px; border-radius: 12px; }
.button-block { width: 100%; }
.button:disabled { opacity: 0.6; cursor: progress; }

.messages { display: grid; gap: 8px; margin: 0 0 20px; padding: 0; list-style: none; }
.notice { padding: 12px 16px; border-radius: var(--radius-sm); background: var(--violet-soft); color: #2f2869; font-weight: 600; }
.notice-success { background: var(--ok-soft); color: #145c32; }
.notice-warning { background: var(--pending-soft); color: #6e4200; }
.notice-error { background: var(--danger-soft); color: #8c1b12; }

.status {
  display: inline-block; padding: 4px 11px; border-radius: 999px;
  font-size: 0.8125rem; font-weight: 800; white-space: nowrap;
}
.status-pending { background: var(--pending-soft); color: var(--pending); }
.status-returned { background: var(--orange-soft); color: var(--orange-strong); }
.status-approved { background: var(--ok-soft); color: var(--ok); }
.status-rejected { background: var(--danger-soft); color: var(--danger); }
.points-pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--orange-soft);
  color: var(--orange-strong); font-size: 0.8125rem; font-weight: 800; white-space: nowrap;
}

/* Значки категорий: цвет задаётся по значку, поэтому новая категория сразу получает оформление. */
[data-icon="leaf"] { --cat: #1f9d55; --cat-soft: #e2f6e9; }
[data-icon="heart"] { --cat: #e0457b; --cat-soft: #fde7ef; }
[data-icon="flag"] { --cat: #ef5b2b; --cat-soft: #ffece4; }
[data-icon="shield"] { --cat: #6a5ae0; --cat-soft: #eeebfd; }
[data-icon="compass"] { --cat: #1597b0; --cat-soft: #e0f4f7; }
[data-icon="medal"] { --cat: #2f74de; --cat-soft: #e5effd; }
[data-icon="sport"] { --cat: #f08c00; --cat-soft: #fff1da; }
[data-icon="star"] { --cat: #e0a800; --cat-soft: #fdf5d6; }
.cat-icon {
  --icon-cut: var(--cat-soft, #fff);
  display: inline-grid; flex: none; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--cat-soft, #f1f0f6); color: var(--cat, var(--muted));
}
.cat-icon .icon { width: 60%; height: 60%; }
.cat-icon-lg { width: 46px; height: 46px; }

/* Выбор периода и группы */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 22px; }
.period-switch {
  display: flex; flex: 1 1 100%; align-items: center; gap: 2px; min-width: 0; padding: 3px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); box-shadow: var(--shadow);
}
.period-arrow {
  display: grid; flex: none; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  color: var(--ink); text-decoration: none; transition: background-color 0.15s;
}
.period-arrow:hover { background: var(--violet-soft); color: var(--violet-dark); }
.period-arrow.is-disabled { color: #cfcdd8; }
.select-pill { position: relative; display: flex; flex: 1 1 auto; align-items: center; min-width: 0; }
.select-pill > .icon { position: absolute; left: 12px; color: var(--violet); pointer-events: none; }
.toolbar > .select-pill { flex: 1 1 100%; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); }
.select-pill select {
  min-height: 40px; padding: 8px 32px 8px 40px; border: 0; border-radius: 999px; background-position: right 10px center;
  color: var(--ink); font-weight: 800; text-overflow: ellipsis; cursor: pointer;
}
@media (min-width: 640px) {
  .period-switch, .toolbar > .select-pill { flex: 0 1 auto; }
  .period-switch .select-pill select, .period-switch .select-pill .cs { min-width: 250px; }
  .toolbar > .select-pill select, .toolbar > .select-pill .cs { min-width: 210px; }
}

/* Главная страница */
.hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 18px; }
.hero h1 { display: inline-flex; align-items: flex-start; gap: 4px; font-size: clamp(2rem, 1.4rem + 2.6vw, 3.1rem); line-height: 1.05; }
@media (max-width: 559px) { .hero .button { width: 100%; } }
.home-layout, .home-main, .home-aside { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-content: start; }
@media (min-width: 1180px) { .home-layout { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 24px; } }

.podium { display: flex; align-items: flex-end; justify-content: center; gap: 8px; }
.podium-card {
  display: flex; flex: 1 1 0; flex-direction: column; align-items: center; gap: 2px; min-width: 0; max-width: 300px;
  padding: 16px 8px 14px; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow); text-align: center;
}
.podium-card.place-1 { order: 2; padding-top: 12px; padding-bottom: 28px; border: 2px solid var(--gold); background: linear-gradient(180deg, #ffe9a3 0%, var(--gold-soft) 60%); box-shadow: 0 10px 28px rgba(245, 180, 0, 0.35); }
.podium-card.place-2 { order: 1; padding-bottom: 20px; border: 2px solid var(--silver); background: linear-gradient(180deg, #e6e9f0 0%, #f8f9fc 60%); }
.podium-card.place-3 { order: 3; border: 2px solid var(--bronze); background: linear-gradient(180deg, #f1d3b8 0%, var(--bronze-soft) 60%); }
.podium-crown { width: 30px; height: 30px; margin-bottom: -2px; color: var(--gold); }
.place-badge {
  display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: 4px; border-radius: 50%;
  background: var(--silver-dark); color: #fff; font-weight: 800;
}
.place-1 .place-badge { background: var(--gold); color: #5a3d00; }
.place-3 .place-badge { background: var(--bronze-dark); }
.podium-classes { color: var(--ink); font-size: 1.6rem; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.podium-classes a { color: inherit; text-decoration: none; }
.podium-classes a:hover { color: var(--violet); }
.podium-total { color: var(--ink); font-size: 0.8125rem; font-weight: 700; }
.podium-total strong { color: var(--orange); font-size: 1.5rem; font-weight: 800; }
.podium-note { margin-top: 6px; color: var(--muted); font-size: 0.75rem; font-weight: 600; line-height: 1.3; }
.medal { --metal-dark: var(--silver-dark); --metal: var(--silver); --metal-light: var(--silver-light); position: relative; width: 46px; height: 46px; margin: 12px 0 4px; }
.place-1 .medal { width: 62px; height: 62px; --metal-dark: var(--gold-dark); --metal: var(--gold); --metal-light: var(--gold-light); }
.place-3 .medal { width: 38px; height: 38px; --metal-dark: var(--bronze-dark); --metal: var(--bronze); --metal-light: var(--bronze-light); }
.medal-coin { position: absolute; inset: 0; width: 100%; height: 100%; }
@media (min-width: 720px) {
  .podium { gap: 16px; }
  .podium-card { padding: 22px 16px 22px; }
  .podium-card.place-1 { padding-top: 14px; padding-bottom: 30px; }
  .podium-crown { width: 40px; height: 40px; }
  .place-badge { width: 40px; height: 40px; font-size: 1.125rem; }
  .podium-classes { font-size: 2.6rem; }
  .place-1 .podium-classes { font-size: 3.1rem; }
  .podium-total { font-size: 1rem; }
  .podium-total strong { font-size: 2rem; }
  .medal { width: 70px; height: 70px; margin: 22px 0 8px; }
  .place-1 .medal { width: 96px; height: 96px; }
  .place-3 .medal { width: 58px; height: 58px; }
  .place-1 .podium-card, .podium-card.place-1 { padding-top: 20px; }
}

.standings { margin: 0; padding: 0; list-style: none; }
.standings-head { display: none; }
.standing {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "place name total" "meta meta meta";
  align-items: center; gap: 8px 12px; padding: 12px 0; border-top: 1px solid var(--line);
}
.standings > .standing:first-child { border-top: 0; }
.place-num {
  grid-area: place; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: #f1f0f6; color: var(--ink); font-weight: 800;
}
.standing.place-1 .place-num { background: var(--gold); color: #5a3d00; }
.standing.place-2 .place-num { background: var(--silver-dark); color: #fff; }
.standing.place-3 .place-num { background: var(--bronze-dark); color: #fff; }
.standing-name { grid-area: name; color: var(--ink); font-size: 1.3rem; font-weight: 800; text-decoration: none; }
.standing-name:hover { color: var(--violet); }
.standing-meta { grid-area: meta; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; min-width: 0; }
.standing-total { grid-area: total; color: var(--muted); font-size: 0.875rem; font-weight: 700; text-align: right; white-space: nowrap; }
.standing-total strong { margin-right: 3px; color: var(--ink); font-size: 1.4rem; font-weight: 800; }
@media (min-width: 720px) {
  .standing, .standings-head { grid-template-columns: 44px 64px minmax(0, 1fr) 118px; grid-template-areas: "place name meta total"; }
  .standings-head {
    display: grid; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line);
    color: var(--muted); font-size: 0.8125rem; font-weight: 700;
  }
  .standings-head span:last-child { text-align: right; }
}

/* Шкала из десяти звёзд: закрашенная часть равна доле от итога лидера. */
.star-bar {
  --size: 15px;
  position: relative; flex: none; width: calc(var(--size) * 10); height: var(--size);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23e7e4ee' d='M12 2.8l2.8 5.8 6.3.9-4.6 4.4 1.1 6.3L12 17.2l-5.6 3 1.1-6.3-4.6-4.4 6.3-.9z'/%3E%3C/svg%3E") repeat-x left center / var(--size) var(--size);
}
.star-bar::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: var(--fill, 0%);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23f7931e' d='M12 2.8l2.8 5.8 6.3.9-4.6 4.4 1.1 6.3L12 17.2l-5.6 3 1.1-6.3-4.6-4.4 6.3-.9z'/%3E%3C/svg%3E") repeat-x left center / var(--size) var(--size);
}
.category-counts { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.category-counts li {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 3px; border-radius: 999px;
  background: var(--cat-soft); color: var(--ink); font-size: 0.8125rem; font-weight: 800;
}
.category-counts .cat-icon { --icon-cut: #fff; width: 24px; height: 24px; background: #fff; }
.category-counts .is-negative { background: var(--danger-soft); color: var(--danger); }

.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.category-grid a {
  display: flex; align-items: center; gap: 8px; height: 100%; padding: 6px; border-radius: var(--radius-sm);
  color: var(--ink); font-size: 0.875rem; font-weight: 700; line-height: 1.25; text-decoration: none;
  transition: background-color 0.15s;
}
.category-grid a:hover, .category-grid a[aria-current="true"] { background: var(--cat-soft); }
.category-grid a > span:last-child { min-width: 0; overflow-wrap: break-word; }
.category-grid .cat-icon-lg { width: 40px; height: 40px; }

/* Лента достижений */
.feed { margin: 0; padding: 0; list-style: none; }
.feed-item {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: start; gap: 14px;
  padding: 14px 0; border-top: 1px solid var(--line);
}
.feed > .feed-item:first-child { padding-top: 2px; border-top: 0; }
.feed-thumb {
  --icon-cut: var(--cat-soft);
  position: relative; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 16px;
  background: var(--cat-soft, #f1f0f6); color: var(--cat, var(--muted));
}
.feed-thumb img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.feed-thumb > .icon { width: 30px; height: 30px; }
.feed-badge { position: absolute; right: -6px; bottom: -6px; width: 28px; height: 28px; border: 2px solid var(--surface); }
.feed-title { color: var(--ink); font-size: 0.9375rem; font-weight: 800; line-height: 1.3; }
.feed-title a { color: inherit; text-decoration: none; }
.feed-title a:hover { color: var(--violet); }
.feed-meta { margin-top: 3px; color: var(--muted); font-size: 0.8125rem; font-weight: 600; }
.feed-meta a { color: var(--violet-dark); font-weight: 800; text-decoration: none; }
.feed-text { margin-top: 5px; color: var(--text); font-size: 0.875rem; overflow-wrap: anywhere; }
.feed-compact .feed-text { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
@media (min-width: 720px) {
  .feed:not(.feed-compact) .feed-item { grid-template-columns: 92px minmax(0, 1fr) auto; gap: 18px; }
  .feed:not(.feed-compact) .feed-thumb { width: 92px; height: 92px; border-radius: 18px; }
  .feed:not(.feed-compact) .feed-thumb > .icon { width: 40px; height: 40px; }
}

.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; margin-top: 20px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tab {
  padding: 8px 15px; border-radius: 999px; background: #eceaf2; color: var(--text);
  font-weight: 700; text-decoration: none; transition: background-color 0.15s;
}
.tab:hover { background: var(--violet-soft); color: var(--ink); }
.tab[aria-current="page"] { background: var(--violet); color: #fff; }

/* Страница класса */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px; margin-bottom: 20px; }
.stat {
  padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); color: var(--muted); font-weight: 700;
}
.stat-value { display: block; color: var(--ink); font-size: 1.9rem; font-weight: 800; line-height: 1.15; }
.stat-main { border-color: #fbdcc3; background: var(--orange-soft); color: var(--orange-strong); }
.stat-main .stat-value { color: var(--orange-strong); }
.breakdown { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 28px; margin: 0; padding: 0; list-style: none; }
.breakdown li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); color: var(--ink); font-weight: 700; }
.breakdown li:first-child { border-top: 0; }
.breakdown .count { margin-left: auto; font-size: 1.125rem; font-weight: 800; }
@media (min-width: 720px) {
  .breakdown { grid-template-columns: 1fr 1fr; }
  .breakdown li:nth-child(2) { border-top: 0; }
}

/* Формы */
.form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.field { display: grid; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.field-label { padding: 0; color: var(--ink); font-weight: 800; }
.help { color: var(--muted); font-size: 0.875rem; }
.error { color: var(--danger); font-size: 0.875rem; font-weight: 700; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.static-value { color: var(--ink); font-size: 1.125rem; font-weight: 800; }
select, input[type="text"], input[type="date"], input[type="number"], input[type="password"], textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border: 1px solid var(--field); border-radius: var(--radius-sm);
  background-color: var(--surface); color: var(--text); font: inherit;
}
select { appearance: none; padding-right: 40px; background: var(--surface) var(--chevron) no-repeat right 14px center / 16px; }
.select-pill select { background-color: transparent; }
textarea { resize: vertical; }

/* Свой выпадающий список (на устройствах с мышью; на телефонах остаётся системный) */
.cs { position: relative; flex: 1 1 auto; min-width: 0; width: 100%; }
.cs-native {
  position: absolute !important; bottom: 0; left: 0; width: 1px !important; height: 1px !important; min-height: 0 !important;
  padding: 0 !important; border: 0 !important; opacity: 0; pointer-events: none;
}
.cs-button {
  display: block; width: 100%; min-height: 46px; padding: 10px 40px 10px 14px; border: 1px solid var(--field);
  border-radius: var(--radius-sm); background: var(--surface) var(--chevron) no-repeat right 14px center / 16px;
  color: var(--text); font: inherit; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}
.cs-button[aria-expanded="true"] { border-color: var(--violet); }
.cs-button:focus-visible { border-color: var(--violet); outline: 3px solid rgba(91, 75, 213, 0.18); outline-offset: 0; }
.cs-button:disabled { opacity: 0.6; cursor: not-allowed; }
.has-error .cs-button { border-color: var(--danger); }
.select-pill .cs-button {
  min-height: 40px; padding: 8px 32px 8px 40px; border: 0; border-radius: 999px; background-color: transparent;
  background-position: right 10px center; color: var(--ink); font-weight: 800;
}
.select-pill .cs-button:focus-visible { outline-offset: 0; }
.cs-list {
  position: absolute; z-index: 40; top: calc(100% + 8px); left: 0; min-width: 100%; width: max-content; max-width: min(92vw, 440px);
  max-height: min(340px, 60vh); margin: 0; padding: 6px; overflow-y: auto; list-style: none;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  box-shadow: 0 2px 4px rgba(29, 35, 96, 0.06), 0 16px 40px rgba(29, 35, 96, 0.16);
}
.cs-list[hidden] { display: none; }
.cs-group { padding: 10px 12px 4px; color: var(--muted); font-size: 0.75rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.cs-group:first-child { padding-top: 6px; }
.cs-option {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--text); font-weight: 600; cursor: pointer;
}
.cs-option svg { flex: none; color: var(--violet); visibility: hidden; }
.cs-option[aria-selected="true"] { color: var(--ink); font-weight: 800; }
.cs-option[aria-selected="true"] svg { visibility: visible; }
.cs-option.is-active { background: var(--violet-soft); }
.cs-option[aria-disabled="true"] { color: #b4b7c8; cursor: not-allowed; }

input:focus, select:focus, textarea:focus { border-color: var(--violet); outline: 3px solid rgba(91, 75, 213, 0.18); outline-offset: 0; }
/* Календарь */
.datepicker { position: relative; }
.datepicker-input { padding-right: 52px; }
.datepicker-toggle {
  position: absolute; top: 0; right: 0; display: grid; place-items: center; width: 50px; height: 100%;
  border: 0; background: none; color: var(--violet); cursor: pointer; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.datepicker-toggle:hover { color: var(--violet-dark); }
.datepicker-panel {
  position: absolute; z-index: 30; top: calc(100% + 8px); left: 0; width: min(100%, 400px); padding: 18px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  box-shadow: 0 2px 4px rgba(29, 35, 96, 0.06), 0 16px 40px rgba(29, 35, 96, 0.16);
}
.datepicker-panel[hidden] { display: none; }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dp-title { color: var(--ink); font-size: 1.1875rem; font-weight: 800; }
.dp-nav {
  width: 42px; height: 42px; border: 0; border-radius: 12px; background: var(--violet-soft); color: var(--violet-dark);
  font: inherit; font-size: 1.625rem; font-weight: 800; line-height: 1; cursor: pointer;
}
.dp-nav:hover { background: #e2defa; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.dp-weekday { padding: 6px 0; color: var(--muted); font-size: 0.875rem; font-weight: 800; text-align: center; }
.dp-weekend { color: var(--orange); }
.dp-day {
  aspect-ratio: 1; min-height: 42px; border: 2px solid transparent; border-radius: 12px; background: none;
  color: var(--text); font: inherit; font-size: 1.0625rem; font-weight: 700; cursor: pointer;
}
.dp-day:hover:not(:disabled) { background: var(--violet-soft); }
.dp-other { color: #b4b7c8; font-weight: 500; }
.dp-today { border-color: var(--orange); color: var(--orange-strong); }
.dp-selected, .dp-selected:hover:not(:disabled) { background: var(--violet); border-color: var(--violet); color: #fff; }
.dp-day:disabled { color: #cfd1dc; cursor: not-allowed; }
.dp-foot { display: flex; justify-content: space-between; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.dp-foot button {
  padding: 8px 14px; border: 0; border-radius: 10px; background: none; color: var(--violet-dark);
  font: inherit; font-weight: 800; cursor: pointer;
}
.dp-foot button:hover:not(:disabled) { background: var(--violet-soft); }
.dp-foot button:disabled { color: #b4b7c8; cursor: not-allowed; }
.dp-nav:focus-visible, .dp-day:focus-visible, .dp-foot button:focus-visible, .datepicker-toggle:focus-visible {
  outline: 3px solid rgba(91, 75, 213, 0.35); outline-offset: 1px;
}

.checkbox-label { display: flex; align-items: flex-start; gap: 10px; color: var(--ink); font-weight: 700; cursor: pointer; }
.checkbox-label input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--violet); }

.category-options { display: grid; gap: 8px; }
@media (min-width: 600px) { .category-options { grid-template-columns: 1fr 1fr; } }
.category-option {
  display: grid; grid-template-columns: auto auto 1fr; align-items: start; gap: 10px; padding: 12px;
  border: 1px solid var(--field); border-radius: var(--radius-sm); background: var(--surface);
  cursor: pointer; transition: border-color 0.15s, background-color 0.15s;
}
.category-option:hover { border-color: #b9b3ea; }
.category-option:has(input:checked) { border-color: var(--violet); background: var(--violet-soft); }
.category-option input { width: 20px; height: 20px; margin: 8px 0 0; accent-color: var(--violet); }
.category-option-name { display: block; color: var(--ink); font-weight: 800; line-height: 1.3; }
.category-option-text { display: block; margin-top: 2px; color: var(--muted); font-size: 0.8125rem; line-height: 1.4; }

.upload { display: grid; gap: 10px; padding: 16px; border: 2px dashed #d6d2e6; border-radius: var(--radius); background: #fbfaff; }
.upload-preview, .upload-current { max-height: 240px; width: auto; border-radius: 12px; }
input[type="file"] { width: 100%; font: inherit; }
input[type="file"]::file-selector-button {
  margin-right: 12px; padding: 10px 16px; border: 0; border-radius: 10px;
  background: var(--violet-soft); color: var(--violet-dark); font: inherit; font-weight: 800; cursor: pointer;
}

/* Заявки */
.request-list { margin: 0; padding: 0; list-style: none; }
.request {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between;
  gap: 10px 16px; padding: 16px 0; border-top: 1px solid var(--line);
}
.request-list > .request:first-child { padding-top: 0; border-top: 0; }
.request-list > .request:last-child { padding-bottom: 0; }
.request-main { flex: 1 1 320px; min-width: 0; }
.request-title { color: var(--ink); font-size: 1.0625rem; font-weight: 800; text-decoration: none; }
.request-title:hover { color: var(--violet); }
.request-comment { margin-top: 8px; padding: 9px 12px; border-radius: 10px; background: #f6f5fa; font-size: 0.9375rem; }
.request-side { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
@media (min-width: 960px) { .detail-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; } }
.details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 16px; }
.details dt { color: var(--muted); font-weight: 600; }
.details dd { margin: 0; color: var(--ink); font-weight: 700; }
.description { overflow-wrap: anywhere; }
.photo { margin: 20px 0 0; }
.photo img { border-radius: var(--radius); }
.photo figcaption { margin-top: 8px; }
.side { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.decision-actions { display: grid; gap: 8px; }
.history { display: grid; gap: 14px; margin: 12px 0 0; padding: 0; list-style: none; }
.history li { padding-left: 14px; border-left: 3px solid var(--violet-soft); overflow-wrap: anywhere; }
.history strong { color: var(--ink); }
.history-meta { color: var(--muted); font-size: 0.8125rem; font-weight: 600; }
.simple-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.simple-list li { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.simple-list li:last-child { padding-bottom: 0; border-bottom: 0; }

/* Правила */
.prose { max-width: 820px; }
.prose h2 { margin: 30px 0 12px; }
.prose p, .prose ul, .prose ol { margin: 0 0 12px; }
.prose li { margin-bottom: 6px; }
.rule-categories { display: grid; gap: 16px; padding: 0; list-style: none; }
.rule-categories li { display: grid; grid-template-columns: auto 1fr; gap: 14px; margin: 0; }
.rule-categories p { margin: 2px 0 0; }
.callout { margin-top: 32px; padding: 18px 20px; border-radius: var(--radius); background: var(--orange-soft); }
.callout h2 { margin-top: 0; }

.auth-box { max-width: 440px; margin: 8px auto 0; }
.auth-box .form { margin-top: 20px; }

/* Отступы между заголовком страницы и формой или панелью */
.narrow > .form, .narrow > .notice, .panel > .form, .panel > .help, .panel > .toolbar { margin-top: 16px; }
.panel > .toolbar { margin-bottom: 0; }
.section.card > h2 + * { margin-top: 12px; }

.site-footer { padding: 22px 0 30px; border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 0.875rem; font-weight: 600; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.footer-inner .icon { color: var(--orange); }

/* Списки, которые сами являются карточками, сохраняют внутренние отступы карточки. */
ul.card, ol.card { padding: 18px; }
@media (min-width: 720px) { ul.card, ol.card { padding: 22px 24px; } }

/* Страница достижения: реакции и ссылка */
.achievement .description { margin-top: 0; font-size: 1.0625rem; }
.achievement .photo { margin: 0 0 18px; }
.reaction-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.reaction {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 16px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  color: var(--text); font: inherit; font-weight: 800; cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
}
.reaction:hover { border-color: var(--violet); background: var(--violet-soft); }
.reaction:active { transform: scale(0.96); }
.reaction.is-mine { border-color: var(--violet); background: var(--violet-soft); color: var(--violet-dark); }
.reaction-emoji { font-size: 1.25rem; line-height: 1; }
.reaction-count { min-width: 1ch; font-variant-numeric: tabular-nums; }
.share { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.share-label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 0.875rem; font-weight: 700; }
.share-row { display: flex; flex-wrap: wrap; gap: 8px; }
input.share-input {
  flex: 1 1 240px; min-width: 0; min-height: 40px; padding: 7px 14px; border: 1px solid var(--field);
  border-radius: 12px; background: #faf9f7; color: var(--text); font: inherit; font-size: 0.875rem;
}
@media (prefers-reduced-motion: reduce) { .reaction { transition: none; } }
