/* Портфолио достижений — стили, направление «Профиль-витрина».
   Шрифты только локальные (font-src 'self'): внешние CDN не используем,
   чтобы не передавать IP пользователей сторонним сервисам. Unbounded и
   Golos Text берутся, если установлены; иначе — системные запасные. */

:root {
  --ink: #101828;
  --text: #344054;
  --muted: #667085;
  --paper: #ffffff;
  --surface: #ffffff;
  --sunken: #f7f6fa;
  --line: #e4e1ec;
  --line-soft: #efedf4;
  --accent: #5b3cc4;
  --accent-strong: #331f80;
  --accent-ink: #ffffff;
  --accent-soft: #f2eefc;
  --accent-line: #dcd5f3;
  --gold: #5c3b00;
  --gold-soft: #ffe9a8;
  --silver: #344054;
  --silver-soft: #e9ebf0;
  --bronze: #7a3e14;
  --bronze-soft: #f6dfcc;
  --ok: #1e6b43;
  --ok-soft: #e7f5ee;
  --warn: #7a4f00;
  --warn-soft: #fff4db;
  --bad: #a21b12;
  --bad-soft: #fdecea;
  --focus: #5b3cc4;
  --radius-s: 10px;
  --radius-m: 16px;
  --radius-l: 22px;
  --font: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, "PT Sans", sans-serif;
  --font-display: "Unbounded", "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #f2f1f7; --text: #d6d4e0; --muted: #a3a1b3; --paper: #0f0e14; --surface: #17161f; --sunken: #1d1c27;
    --line: #2d2b3a; --line-soft: #23222e; --accent: #a995f5; --accent-strong: #d3c8ff; --accent-ink: #160f33;
    --accent-soft: #241d42; --accent-line: #3d3270;
    --gold: #f5cf6b; --gold-soft: #3a2f12; --silver: #cfd4de; --silver-soft: #2a2c36;
    --bronze: #e7a77b; --bronze-soft: #3a2619; --ok: #7fd9a6; --ok-soft: #153223; --warn: #f0c46a;
    --warn-soft: #382c12; --bad: #ff9d92; --bad-soft: #3b1c1a; --focus: #a995f5;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #f2f1f7; --text: #d6d4e0; --muted: #a3a1b3; --paper: #0f0e14; --surface: #17161f; --sunken: #1d1c27;
  --line: #2d2b3a; --line-soft: #23222e; --accent: #a995f5; --accent-strong: #d3c8ff; --accent-ink: #160f33;
  --accent-soft: #241d42; --accent-line: #3d3270;
  --gold: #f5cf6b; --gold-soft: #3a2f12; --silver: #cfd4de; --silver-soft: #2a2c36;
  --bronze: #e7a77b; --bronze-soft: #3a2619; --ok: #7fd9a6; --ok-soft: #153223; --warn: #f0c46a;
  --warn-soft: #382c12; --bad: #ff9d92; --bad-soft: #3b1c1a; --focus: #a995f5;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--text);
  font: 15px/1.55 var(--font); font-feature-settings: "tnum" 1;
}
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { color: var(--ink); line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-family: var(--font-display); font-size: 2rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
.doc h2, .panel h2, .review-box h2 { font-family: var(--font); font-size: 1.15rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.text-warn { color: var(--warn); }
.small { font-size: .875rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- каркас ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line-soft); position: sticky; top: 0; z-index: 10; }
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 10px 24px; min-height: 64px;
  display: flex; align-items: center; gap: 10px 20px; flex-wrap: nowrap;
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.brand:hover { color: var(--ink); }
.brand-dot { color: var(--accent); }
.nav { display: flex; gap: 2px; flex-wrap: nowrap; flex: 1; min-width: 0; }
.nav a {
  color: var(--muted); text-decoration: none; padding: 0 12px; min-height: 40px; display: inline-flex; align-items: center;
  border-radius: 999px; font-weight: 500; font-size: .9375rem; white-space: nowrap;
}
.nav a:hover { color: var(--ink); background: var(--sunken); }
.nav a[aria-current="page"] { color: var(--accent-strong); background: var(--accent-soft); font-weight: 600; }
.who { display: flex; align-items: center; gap: 10px; font-size: .875rem; color: var(--muted); }
.who form { margin: 0; }
.who-name { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 600; }
.who-name:hover { color: var(--accent); }
.who-menu { position: relative; }
.who-menu > summary { list-style: none; cursor: pointer; border-radius: 12px; padding: 2px 6px 2px 2px; }
.who-menu > summary::-webkit-details-marker { display: none; }
.who-menu[open] > summary { background: var(--sunken); }
.who-caret { color: var(--muted); transition: transform .15s; }
.who-menu[open] .who-caret { transform: rotate(180deg); }
.who-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; min-width: 220px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 32px rgba(0,0,0,.18);
  display: flex; flex-direction: column;
}
.who-pop a, .who-pop button {
  display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 10px; border: 0; background: none;
  color: var(--ink); font: inherit; font-size: .9rem; text-decoration: none; cursor: pointer;
}
.who-pop a:hover, .who-pop button:hover { background: var(--sunken); }
.who-pop form { margin: 4px 0 0; padding-top: 4px; border-top: 1px solid var(--line-soft); }
.who-role { color: var(--muted); font-weight: 400; font-size: .8125rem; }
.avatar-s {
  width: 36px; height: 36px; border-radius: 12px; flex: none; background: var(--accent-soft); color: var(--accent-strong);
  display: inline-grid; place-items: center; font-weight: 700; font-size: .8125rem;
}
main { max-width: 1200px; margin: 0 auto; padding: 32px 24px 72px; }
.narrow { max-width: 520px; }
.medium { max-width: 820px; }
/* подвал — полоса на всю ширину внизу страницы; на коротких страницах прижат к низу экрана */
body { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1 0 auto; width: 100%; box-sizing: border-box; }
.foot { border-top: 1px solid var(--line-soft); background: var(--surface); font-size: .8125rem; color: var(--muted); }
.foot-inner { max-width: 1200px; margin: 0 auto; padding: 18px 24px; display: flex; flex-wrap: wrap; align-items: center;
              justify-content: space-between; gap: 8px 24px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--ink); text-decoration: underline; }
@media (max-width: 640px) {
  .topbar { position: static; }
  .topbar-inner { padding: 10px 16px; }
  main { padding: 24px 16px 56px; }
  .foot-inner { padding: 16px; flex-direction: column; align-items: flex-start; }
  .who-role { display: none; }
  h1 { font-size: 1.6rem; }
}

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head p { margin: 0; }
.back { display: inline-block; margin-bottom: 10px; font-size: .875rem; text-decoration: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 24px; }
.panel + .panel { margin-top: 16px; }
.stack > * + * { margin-top: 16px; }

/* ---------- кнопки и поля ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); color: var(--ink); }
.btn svg { flex: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--accent-ink); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-dark:hover { opacity: .9; color: var(--paper); border-color: var(--ink); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { color: #fff; filter: brightness(1.08); border-color: var(--ok); }
.btn-bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn-bad:hover { color: var(--bad); border-color: var(--bad); }
.btn-link { border: 0; background: none; color: var(--accent); padding: 0; min-height: 0; font-weight: 500; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: .875rem; }
.btn-lg { min-height: 50px; padding: 0 22px; border-radius: 16px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: progress; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.field label, .label { font-weight: 600; color: var(--ink); font-size: .9rem; }
.hint { font-size: .8125rem; color: var(--muted); }
.alt-suggest { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 2px; }
.alt-suggest[hidden], .alt-chip[hidden] { display: none; }
.alt-chip { border: 1px solid var(--line); background: var(--surface); color: var(--accent); border-radius: 999px;
  padding: 3px 10px; min-height: 0; font: inherit; font-weight: 500; text-align: left; overflow-wrap: break-word;
  max-width: 100%; cursor: pointer; transition: border-color .15s, background-color .15s; }
.alt-chip:hover, .alt-chip:focus-visible { border-color: var(--accent); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number],
input[type=search], select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; min-height: 46px; width: 100%;
}
textarea { min-height: 96px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--muted) 60%, var(--line)); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--bad); }
.err { color: var(--bad); font-size: .8125rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
@media (max-width: 720px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { width: 18px; height: 18px; margin-top: 3px; flex: none; accent-color: var(--accent); }

.alert { padding: 14px 16px; border-radius: 14px; margin-bottom: 16px; border: 1px solid; }
.alert-bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 25%, transparent); color: var(--text); }
.alert-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.alert-info { background: var(--accent-soft); border-color: var(--accent-line); }

/* ---------- бейджи статуса ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: .8125rem; font-weight: 600;
  padding: 3px 11px 3px 9px; border-radius: 999px; line-height: 1.4; max-width: 100%;
}
/* длинная плашка («Справочная: баллы студентам по ней пока не считаются») на телефоне переносится,
   а не вылезает за край карточки; точка — по центру по высоте, даже если плашку растянул соседний элемент */
.badge::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-approved { color: var(--ok); background: var(--ok-soft); }
.st-submitted { color: var(--warn); background: var(--warn-soft); }
.st-rejected { color: var(--bad); background: var(--bad-soft); }
.st-draft { color: var(--muted); background: var(--line-soft); }

/* ---------- медали ---------- */
.medal {
  width: 32px; height: 32px; border-radius: 10px; flex: none;
  display: inline-grid; place-items: center; font-weight: 700; font-size: .875rem;
}
.medal-1 { color: var(--gold); background: var(--gold-soft); }
.medal-2 { color: var(--silver); background: var(--silver-soft); }
.medal-3 { color: var(--bronze); background: var(--bronze-soft); }
.medal-n { color: var(--accent-strong); background: var(--accent-soft); }
.medal-p { color: var(--accent-strong); background: var(--accent-soft); }
.result { display: flex; align-items: center; gap: 10px; }
.result-text { display: flex; flex-direction: column; line-height: 1.3; }
.result-text small { color: var(--muted); font-size: .8125rem; }

/* ---------- витрина портфолио ---------- */
.private-note {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 12px 16px; margin-bottom: 28px;
  border-radius: 14px; background: var(--sunken); font-size: .875rem; color: var(--text);
}
.private-note svg { flex: none; color: var(--muted); }
.private-note span { flex: 1 1 280px; }
.private-note .bad { color: var(--bad); }
.hero { display: flex; flex-wrap: wrap; align-items: center; gap: 28px; margin-bottom: 32px; }
.avatar {
  width: 128px; height: 128px; border-radius: 34px; flex: none; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 2.5rem;
}
.hero-main { flex: 1 1 420px; min-width: 0; }
.hero-main h1 { font-size: 2.5rem; margin-bottom: 10px; }
.hero-sub { font-size: 1rem; color: var(--muted); margin-bottom: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--accent-line); color: var(--accent-strong); font-size: .8125rem; font-weight: 600;
}
.hero-actions { flex: 0 1 260px; display: flex; flex-direction: column; gap: 10px; }
.hero-actions .btn { width: 100%; }
.hero-actions .sub-link { text-align: center; font-size: .8125rem; color: var(--muted); }
@media (max-width: 640px) {
  .avatar { width: 88px; height: 88px; border-radius: 26px; font-size: 1.8rem; }
  .hero { gap: 20px; }
  .hero-main h1 { font-size: 1.9rem; }
  .hero-actions { flex-basis: 100%; }
}

.levels-strip { display: flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: var(--radius-l); overflow: hidden; margin-bottom: 40px; }
.levels-strip > div { flex: 1 1 150px; padding: 18px 22px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); margin: 0 -1px -1px 0; }
.lv-name { font-size: .8125rem; color: var(--muted); font-weight: 500; }
.lv-count { font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; color: var(--ink); line-height: 1.3; }
.lv-track { height: 6px; border-radius: 3px; background: var(--line-soft); margin-top: 8px; }
.lv-track span { display: block; height: 6px; border-radius: 3px; background: var(--accent); width: 0; }

.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section-head h2 { margin: 0; font-size: 1.4rem; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font: inherit; font-size: .8125rem; font-weight: 600; cursor: pointer;
}
.seg button:hover { border-color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
@media (max-width: 400px) { .cards { grid-template-columns: 1fr; } }
.ach-card {
  position: relative; display: flex; flex-direction: column; gap: 12px; padding: 22px; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.ach-card:hover { border-color: var(--accent-line); box-shadow: 0 6px 24px -12px color-mix(in srgb, var(--accent) 45%, transparent); }
.ach-card.is-rejected { background: color-mix(in srgb, var(--bad-soft) 35%, var(--surface)); }
.ach-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ach-card .medal { width: 52px; height: 52px; border-radius: 16px; font-family: var(--font-display); font-size: 1.25rem; }
.ach-card h3 { margin: 0; font-size: 1.05rem; line-height: 1.35; }
.ach-card h3 a { color: var(--ink); text-decoration: none; }
.ach-card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.ach-card h3 a:hover { text-decoration: underline; }
.ach-org { font-size: .875rem; color: var(--muted); }
.ach-meta { margin-top: auto; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .8125rem; color: var(--text); font-weight: 600; }
.ach-comment { font-size: .8125rem; color: var(--bad); line-height: 1.45; }
.cards-empty { padding: 40px 20px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius-l); }

/* ---------- фильтры ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.filters input[type=search] { flex: 1 1 240px; width: auto; }
.filters select { width: auto; flex: 0 1 auto; }
.filters .count { margin-left: auto; color: var(--muted); font-size: .875rem; }

/* ---------- таблица ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); overflow: hidden; }
table.data { width: 100%; border-collapse: collapse; }
.data th, .data td { padding: 14px 16px; text-align: left; vertical-align: top; }
.data thead th {
  background: var(--sunken); font-size: .8125rem; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line);
}
.data th button {
  font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
}
.data th button::after { content: "↕"; opacity: .35; font-size: .75rem; }
.data th[aria-sort="ascending"] button::after { content: "↑"; opacity: 1; }
.data th[aria-sort="descending"] button::after { content: "↓"; opacity: 1; }
.data th[aria-sort] { color: var(--ink); }
.data tbody tr { border-top: 1px solid var(--line-soft); }
.data tbody tr:first-child { border-top: 0; }
.data tbody tr.clickable { cursor: pointer; }
.data tbody tr.clickable:hover { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
.col-date { width: 120px; white-space: nowrap; color: var(--muted); }
.col-level { width: 150px; }
.col-result { width: 210px; }
.col-status { width: 150px; }
.col-file { width: 64px; text-align: center !important; }
.t-title { color: var(--ink); font-weight: 600; text-decoration: none; }
.t-title:hover { text-decoration: underline; color: var(--ink); }
.t-org { color: var(--muted); font-size: .875rem; margin-top: 2px; }
.t-comment { margin-top: 6px; font-size: .8125rem; color: var(--bad); }
.lvl { display: inline-flex; align-items: center; gap: 6px; font-size: .875rem; }
.lvl i { width: 8px; height: 8px; border-radius: 3px; background: var(--accent); }
.lvl i.lv-international { background: var(--accent-strong); }
.lvl i.lv-regional, .lvl i.lv-municipal, .lvl i.lv-university { background: color-mix(in srgb, var(--accent) 45%, var(--surface)); }
.empty { padding: 48px 20px; text-align: center; }
.empty p { color: var(--muted); }

@media (max-width: 760px) {
  .data thead { display: none; }
  .data, .data tbody, .data tr, .data td { display: block; width: 100%; }
  .data tbody tr { padding: 14px 16px; }
  .data td { padding: 4px 0; }
  .data tbody tr.data-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
  .data tbody tr.data-row .cell-title { grid-column: 1 / -1; }
  .data .col-date, .data .col-level, .data .col-result, .data .col-status, .data .col-file { width: auto; }
  .data .col-file { text-align: right !important; }
  /* подпись столбца над значением (ставит app.js); название, дата, уровень и статус понятны и без неё */
  .data:not(.scale-grid) td[data-label]:not(.cell-title):not(.col-date):not(.col-level):not(.col-status)::before {
    content: attr(data-label); display: block; font-size: .75rem; font-weight: 500; color: var(--muted); margin-bottom: 2px;
  }
}

/* ---------- вкладки ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.tabs a {
  min-height: 40px; padding: 0 16px; display: inline-flex; align-items: center; border-radius: 999px;
  border: 1px solid var(--line); text-decoration: none; color: var(--text); font-weight: 600; font-size: .875rem;
}
.tabs a:hover { border-color: var(--muted); color: var(--ink); }
.tabs a[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ---------- загрузка ---------- */
.drop {
  border: 2px dashed var(--accent-line); border-radius: var(--radius-l); background: var(--sunken);
  padding: 48px 24px; text-align: center; transition: border-color .15s, background .15s;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-icon {
  width: 64px; height: 64px; border-radius: 20px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; margin-bottom: 10px;
}
.drop strong { color: var(--ink); font-size: 1.15rem; }
.drop p { margin: 0 0 10px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.drop-compact { padding: 22px 18px; flex-direction: row; flex-wrap: wrap; justify-content: center; text-align: left; gap: 12px 16px; }
.drop-compact .drop-icon { width: 44px; height: 44px; border-radius: 14px; margin: 0; }
.progress { display: none; align-items: center; gap: 12px; margin-top: 12px; justify-content: center; }
.progress.on { display: flex; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.5s; } }
.tips { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 20px; }
.tip { padding: 18px; border-radius: var(--radius-m); background: var(--sunken); font-size: .875rem; }
.tip strong { display: block; color: var(--ink); margin-bottom: 4px; font-size: .9375rem; }

/* ---------- карточка достижения ---------- */
.card-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 24px; align-items: start; }
@media (max-width: 980px) { .card-layout { grid-template-columns: 1fr; } }
.preview { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); overflow: hidden; position: sticky; top: 84px; }
.preview img { display: block; width: 100%; height: auto; }
.preview iframe { display: block; width: 100%; height: 78vh; border: 0; }
.preview-bar { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: .875rem; color: var(--muted); gap: 8px; }
.drop.replace { border: 0; border-top: 1px dashed var(--accent-line); border-radius: 0; }
.replace-error { margin: 0 16px 16px; }
.conf { font-size: .75rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; margin-left: 6px; vertical-align: 1px; }
.conf-high { color: var(--ok); background: var(--ok-soft); }
.conf-medium { color: var(--warn); background: var(--warn-soft); }
.conf-low { color: var(--bad); background: var(--bad-soft); }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 12px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink); }
@media (max-width: 600px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 8px; } }
.namecheck { display: flex; gap: 8px; align-items: center; font-size: .875rem; }
.review-box { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 20px; }

/* ---------- вход ---------- */
.auth-intro { margin-bottom: 24px; }
.auth-intro .brand { display: inline-block; font-size: 1.3rem; margin-bottom: 18px; }

/* ---------- прочее ---------- */
.list-plain { list-style: none; padding: 0; margin: 0; }
.doc { line-height: 1.65; }
.doc p { margin-bottom: 1rem; max-width: 72ch; }
.consent-doc {
  max-height: 46vh; overflow: auto; padding: 20px 22px; background: var(--sunken);
  border: 1px solid var(--line); border-radius: var(--radius-m); margin-bottom: 16px;
}
.consent-doc p { max-width: 72ch; }
.hashline { font-size: .75rem; color: var(--muted); word-break: break-all; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form select, .inline-form input { width: auto; }
details.danger summary { cursor: pointer; color: var(--bad); font-weight: 600; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; }
.mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mb-16 { margin-bottom: 16px; }
.my-12 { margin: 12px 0 16px; }
[hidden] { display: none !important; }

/* ---------- печать портфолио (кнопка «Скачать PDF») ---------- */
@media print {
  :root { --paper: #fff; --surface: #fff; }
  .topbar, .foot, .private-note, .hero-actions, .seg, .no-print { display: none !important; }
  main { padding: 0; max-width: none; }
  .ach-card { break-inside: avoid; box-shadow: none; }
  .ach-card.is-hidden-print { display: none; }
  .cards { grid-template-columns: 1fr 1fr; }
  body { font-size: 12pt; }
}

/* ---------- проверка ИИ ---------- */
.ai-box { border-radius: var(--radius-m); padding: 16px 18px; margin-bottom: 16px; border: 1px solid var(--line); background: var(--sunken); }
.ai-box.rec-approve { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.ai-box.rec-check { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.ai-box.rec-reject { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.ai-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 10px; }
.ai-head svg { color: var(--accent); }
.ai-kicker { font-size: .8125rem; font-weight: 600; color: var(--muted); }
.ai-rec { color: var(--ink); font-size: 1rem; flex-basis: 100%; }
.checks { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-direction: column; gap: 6px; font-size: .875rem; }
.checks li { position: relative; padding-left: 22px; color: var(--text); }
.checks li::before { position: absolute; left: 0; top: 0; font-weight: 700; }
.checks .chk-ok::before { content: "✓"; color: var(--ok); }
.checks .chk-warn::before { content: "!"; color: var(--warn); left: 4px; }
.checks .chk-bad::before { content: "✕"; color: var(--bad); }
.ai-note { margin: 0; }
.hint-list { margin: 6px 0; padding-left: 18px; }
.rec-chip { display: inline-block; margin-top: 6px; font-size: .75rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
.rec-chip.rec-approve { color: var(--ok); background: var(--ok-soft); }
.rec-chip.rec-check { color: var(--warn); background: var(--warn-soft); }
.rec-chip.rec-reject { color: var(--bad); background: var(--bad-soft); }
.ai-pending { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.ai-pending [data-ai-msg] { flex: 1 1 320px; }

/* ---------- рейтинг ---------- */
.ava { display: block; flex: none; }
.rating-hero {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 32px;
  padding: 26px; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface);
}
.rating-me { display: flex; align-items: center; gap: 18px; }
.rating-me p { margin: 0; }
.rating-points { font-size: 1.1rem; color: var(--muted); }
.rating-points strong { font-family: var(--font-display); font-size: 2.6rem; color: var(--ink); line-height: 1.1; margin-right: 6px; }
.places { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; flex: 1 1 520px; max-width: 680px; }
@media (max-width: 640px) { .places { grid-template-columns: 1fr 1fr; } .place { padding: 10px 12px; gap: 8px; } .place-n { font-size: 1.3rem; } }
.place {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 56px; border-radius: 16px;
  border: 1px solid var(--line); color: var(--text); text-decoration: none; line-height: 1.25;
}
.place:hover { border-color: var(--accent-line); color: var(--ink); }
.place.is-current { border-color: var(--accent); background: var(--accent-soft); }
.place-n { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; color: var(--accent-strong); }
.seg-link {
  min-height: 38px; padding: 0 14px; display: inline-flex; align-items: center; border-radius: 999px;
  border: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: .8125rem; font-weight: 600;
}
.seg-link:hover { border-color: var(--muted); color: var(--ink); }
.seg-link[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.leaderboard { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-l); overflow: hidden; background: var(--surface); }
.lb-row { display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-top: 1px solid var(--line-soft); }
.lb-row:first-child { border-top: 0; }
.lb-row.is-me { background: var(--accent-soft); }
.lb-rank { width: 32px; flex: none; text-align: center; font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; color: var(--muted); }
.lb-row.top-1 .lb-rank { color: var(--gold); }
.lb-row.top-2 .lb-rank { color: var(--silver); }
.lb-row.top-3 .lb-rank { color: var(--bronze); }
.lb-who { flex: 1; min-width: 0; color: var(--ink); }
.lb-points { flex: none; text-align: right; }
.lb-points strong { font-size: 1.1rem; color: var(--ink); }
.lb-gap { padding: 2px 18px; color: var(--muted); border-top: 1px solid var(--line-soft); }
.col-points { width: 90px; text-align: right !important; white-space: nowrap; }
@media (max-width: 640px) { .rating-points strong { font-size: 2rem; } .lb-row { padding: 10px 12px; gap: 10px; } }

/* баллы на витрине и в карточке */
.rating-strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 14px 18px; margin: -12px 0 32px;
  border-radius: 16px; border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--accent-strong);
  text-decoration: none;
}
.rating-strip:hover { color: var(--accent-strong); border-color: var(--accent); }
.rating-strip strong { font-family: var(--font-display); font-size: 1.3rem; }
.rating-strip .go { margin-left: auto; font-weight: 600; }
.ach-points { font-weight: 700; color: var(--accent-strong); }
.score-box { display: flex; align-items: baseline; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--sunken); margin-bottom: 16px; font-size: .875rem; }
.score-box strong { font-family: var(--font-display); font-size: 1.3rem; color: var(--ink); }
.points-input { max-width: 120px; }
.kind-fields[hidden] { display: none !important; }

/* ---------- личная страница (профиль как в соцсети) ---------- */
main.profile-main { max-width: 1160px; padding-top: 20px; }
.profile-card { border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); overflow: hidden; margin-bottom: 20px; }
.cover { height: 150px; background: var(--accent); color: var(--accent-ink); position: relative; overflow: hidden; }
.cover svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.profile-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 22px; padding: 0 28px 18px; }
.profile-head .avatar { margin-top: -64px; width: 136px; height: 136px; border-radius: 50%; border: 6px solid var(--surface); font-size: 2.6rem; position: relative; }
.profile-id { flex: 1 1 320px; min-width: 0; padding-top: 14px; }
.profile-id h1 { margin: 0 0 4px; font-size: 1.9rem; }
.profile-status { color: var(--muted); margin: 0 0 10px; }
.profile-actions { display: flex; gap: 8px; padding-bottom: 6px; }
.profile-actions .btn { min-height: 40px; }
.profile-counters { display: flex; flex-wrap: wrap; margin: 0; border-top: 1px solid var(--line-soft); }
.profile-counters > div { flex: 1 1 120px; padding: 12px 28px; border-right: 1px solid var(--line-soft); }
.profile-counters > div:last-child { border-right: 0; }
.profile-counters dt { font-size: .8125rem; color: var(--muted); }
.profile-counters dd { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.4rem; color: var(--ink); }
.profile-counters dd.bad { color: var(--bad); }

.profile-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
.profile-side { display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 900px) {
  .profile-grid { grid-template-columns: 1fr; }
  /* На узком экране карточки идут над лентой плиткой, а не уезжают под неё */
  .profile-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
}
.side-card { border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); padding: 16px 18px; }
.side-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.side-head h2 { margin: 0; font-family: var(--font); font-size: 1rem; }
.side-points { margin: 0 0 8px; color: var(--muted); }
.side-points strong { font-family: var(--font-display); font-size: 2rem; color: var(--ink); margin-right: 4px; }
.side-places { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: .9rem; }
.side-places .place-n { display: inline-block; min-width: 30px; font-size: 1.1rem; }
.side-info { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: .875rem; }
.side-info dt { color: var(--muted); }
.side-info dd { margin: 0; color: var(--ink); overflow-wrap: break-word; min-width: 0; }
.side-levels { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: .875rem; }
.side-levels li { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; }
.side-levels .lv-track { grid-column: 1 / -1; margin: 0; }

.profile-feed { border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); padding: 18px 20px; min-width: 0; }
.feed-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.feed-head h2 { margin: 0; font-family: var(--font); font-size: 1.15rem; }
.feed-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.feed-tools input[type=search] { flex: 1 1 100%; }
.feed-tools select { width: auto; flex: 1 1 150px; min-height: 40px; padding: 6px 10px; font-size: .875rem; }
.feed-tools .count { flex-basis: 100%; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 4px 16px; align-items: center;
  padding: 14px 6px; border-bottom: 1px solid var(--line-soft); position: relative;
}
.feed-item:last-child { border-bottom: 0; }
.feed-item:hover { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.feed-item.is-rejected { background: color-mix(in srgb, var(--bad-soft) 40%, transparent); }
.feed-item .medal { width: 42px; height: 42px; border-radius: 12px; font-size: 1rem; }
.feed-title { color: var(--ink); font-weight: 600; text-decoration: none; line-height: 1.35; }
.feed-title::after { content: ""; position: absolute; inset: 0; }
.feed-title:hover { text-decoration: underline; color: var(--ink); }
.feed-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: .8125rem; color: var(--muted); margin-top: 3px; }
.feed-facts { display: flex; flex-direction: column; gap: 3px; font-size: .8125rem; color: var(--text); text-align: right; white-space: nowrap; }
.feed-facts .lvl { justify-content: flex-end; font-size: .8125rem; }
.feed-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 104px; }
.feed-points { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; color: var(--accent-strong); line-height: 1; }
.feed-points small { font-family: var(--font); font-weight: 500; font-size: .75rem; color: var(--muted); margin-left: 4px; }
@media (max-width: 640px) {
  .profile-head { padding: 0 16px 14px; }
  .profile-head .avatar { width: 104px; height: 104px; margin-top: -52px; font-size: 2rem; }
  .profile-counters > div { flex: 1 1 0; min-width: 0; padding: 10px 10px 10px 14px; }
  .profile-counters dt { font-size: .75rem; }
  .profile-counters dd { font-size: 1.2rem; }
  .cover { height: 110px; }
  .profile-feed { padding: 14px; }
  .feed-item { grid-template-columns: auto minmax(0, 1fr); }
  .feed-facts { grid-column: 2; flex-direction: row; flex-wrap: wrap; gap: 4px 12px; text-align: left; white-space: normal; }
  .feed-side { grid-column: 2; flex-direction: row; align-items: center; justify-content: flex-start; min-width: 0; gap: 12px; }
}
@media print {
  .cover, .profile-counters, .profile-side, .feed-tools, .feed-head .btn { display: none !important; }
  .profile-grid { display: block; }
  .profile-card, .profile-feed { border: 0; }
  .feed-item { break-inside: avoid; }
}


/* ---------- баллы: число под числом ---------- */
/* Число и слово — отдельные колонки фиксированной ширины, цифры одинаковой ширины (tabular-nums):
   «36 баллов», «32 балла» и «17 баллов» стоят строго друг под другом. */
.pts { display: inline-grid; grid-template-columns: 4ch 6.2ch; align-items: baseline; column-gap: 6px; text-align: left; }
.pts strong { text-align: right; font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.pts > span { color: var(--muted); font-size: .8125rem; }
.lb-row .pts strong { font-size: 1.1rem; color: var(--ink); }
.feed-points.pts strong { font-size: 1.05rem; color: var(--accent-strong); }
.lb-rank { font-variant-numeric: tabular-nums; }
.leaderboard:not(.is-open) .lb-extra { display: none; }
.leaderboard.is-open .lb-gap { display: none; }
.lb-toggle { margin-top: 12px; }

/* ---------- итог загрузки архива ---------- */
.batch-result h2 { font-family: var(--font); font-size: 1.15rem; margin-bottom: 4px; }
.batch-list { margin: 8px 0 0; padding-left: 22px; max-height: 320px; overflow: auto; }
.batch-list li { padding: 2px 0; }

/* ---------- переключатель темы ---------- */
.theme-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); display: inline-grid; place-items: center; cursor: pointer; flex: none;
}
.theme-btn:hover { border-color: var(--muted); }
.theme-btn .i-sun { display: none; }
:root[data-theme="dark"] .theme-btn .i-sun { display: block; }
:root[data-theme="dark"] .theme-btn .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-btn .i-moon { display: none; }
}

/* ---------- «Вершина»: знак и восхождение ---------- */
.brand-mark { flex: none; }
.brand-mark .bm-near { fill: var(--ink); }
.brand-mark .bm-far { fill: var(--accent); opacity: .55; }
.brand-mark .bm-snow { fill: var(--paper); }
.brand-mark .bm-pole { stroke: var(--ink); stroke-width: 1.2; }
.brand-mark .bm-flag { fill: var(--accent); }

.climb {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; padding: 18px 26px;
  border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface);
}
.climb-art { width: 300px; max-width: 100%; height: auto; flex: none; overflow: visible; }
.climb-art .cl-far { fill: var(--accent-line); opacity: .45; }
.climb-art .cl-mount { fill: var(--accent-soft); stroke: var(--accent-line); stroke-width: 1.5; }
.climb-art .cl-snow { fill: color-mix(in srgb, #fff 88%, var(--accent-soft)); stroke: var(--accent-line); stroke-width: 1.5; stroke-linejoin: round; }
.climb-art .cl-trail { stroke: var(--muted); stroke-width: 2.4; stroke-dasharray: 0 7; stroke-linecap: round; fill: none; opacity: .55; }
.climb-art .cl-done { stroke: var(--accent); stroke-width: 4; stroke-linecap: round; fill: none; }
.climb-art .cl-pole { stroke: var(--ink); stroke-width: 1.5; }
.climb-art .cl-flag { fill: var(--accent); }
.climb-art .cl-me { fill: var(--accent); stroke: var(--surface); stroke-width: 3; }
.climb-text { flex: 1 1 280px; }
.climb-text p { margin: 0; }
.climb-title { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; color: var(--ink); margin-bottom: 6px !important; }
.climb-facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; color: var(--text); }
.climb-facts strong { font-family: var(--font-display); font-variant-numeric: tabular-nums; color: var(--accent-strong); }

.lb-peak { display: inline-block; vertical-align: middle; fill: var(--gold); }
.lb-peak .lb-peak-flag { fill: var(--accent); stroke: var(--gold); stroke-width: .6; }

/* ---------- значок достижения в ленте ---------- */
.ach-ico {
  position: relative; width: 44px; height: 44px; border-radius: 13px; flex: none;
  display: inline-grid; place-items: center; color: var(--muted); background: var(--sunken);
}
.ach-ico.ai-gold { color: var(--gold); background: var(--gold-soft); }
.ach-ico.ai-silver { color: var(--silver); background: var(--silver-soft); }
.ach-ico.ai-bronze { color: var(--bronze); background: var(--bronze-soft); }
.ach-ico.ai-accent { color: var(--accent-strong); background: var(--accent-soft); }
.ach-place {
  position: absolute; right: -5px; top: -5px; min-width: 19px; height: 19px; padding: 0 4px; border-radius: 999px;
  display: grid; place-items: center; font-size: .6875rem; font-weight: 700; line-height: 1;
  color: var(--surface); background: var(--accent); border: 2px solid var(--surface);
}
.ai-gold .ach-place { background: #d4a017; color: #fff; }
.ai-silver .ach-place { background: #8a94a6; color: #fff; }
.ai-bronze .ach-place { background: #b8692e; color: #fff; }

/* ---------- меню: счётчик черновиков ---------- */
.nav-count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 4px;
  border-radius: 999px; background: var(--accent); color: var(--accent-ink, #fff); font-size: .6875rem; font-weight: 700;
}
:root:not([data-theme="dark"]) .nav-count { color: #fff; }

/* ---------- черновики ---------- */
.drafts-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px; border: 1px solid var(--line); border-bottom: 0; border-radius: var(--radius-l) var(--radius-l) 0 0;
  background: var(--sunken);
}
.drafts-bar .check { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; cursor: pointer; }
.drafts-pick, .drafts-do { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.drafts-pick .btn-link { font-size: .875rem; }
.drafts-del { position: relative; }
.drafts-del > summary { list-style: none; }
.drafts-del > summary::-webkit-details-marker { display: none; }
.drafts-del.is-off > summary { opacity: .45; cursor: not-allowed; }
.drafts-del-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 6; width: min(280px, 80vw); padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow, 0 8px 24px rgba(0,0,0,.15));
  display: grid; gap: 10px; justify-items: start;
}
.drafts-del-pop p { margin: 0; }
@media (max-width: 640px) {
  .drafts-do { width: 100%; }
  .drafts-del-pop { left: 0; right: auto; }
}
.drafts-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 0 0 var(--radius-l) var(--radius-l); background: var(--surface); }
.draft-row {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 4px 14px; align-items: center;
  padding: 12px 16px; border-top: 1px solid var(--line-soft);
}
.draft-row:first-child { border-top: 0; }
.draft-row.is-ready { background: color-mix(in srgb, var(--ok-soft) 35%, transparent); }
.draft-check { width: 18px; height: 18px; accent-color: var(--accent); }
.draft-state { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.draft-state .badge { white-space: normal; max-width: 260px; }
.spinner-sm { width: 10px; height: 10px; border-width: 2px; display: inline-block; vertical-align: -1px; }
@media (max-width: 640px) {
  .draft-row { grid-template-columns: auto auto minmax(0, 1fr); }
  .draft-state { grid-column: 3; align-items: flex-start; text-align: left; }
}
.drafts-nudge { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }

.queue-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 14px; padding: 12px 16px;
  border: 1px solid var(--accent-line); border-radius: var(--radius-m); background: var(--accent-soft);
}
.queue-track { flex: 1 1 120px; height: 6px; border-radius: 3px; background: var(--surface); overflow: hidden; }
.queue-nav { display: inline-flex; align-items: center; gap: 12px; margin-left: auto; }
.seg { display: inline-flex; }
.seg .btn { border-radius: 0; }
.seg .btn:first-child { border-radius: 999px 0 0 999px; }
.seg .btn:last-child { border-radius: 0 999px 999px 0; margin-left: -1px; }
.queue-track span { display: block; height: 100%; background: var(--accent); width: 0; }

/* ---------- быстрые ответы модератора ---------- */
.quick-replies { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 8px; }
.qr {
  min-height: 32px; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font: inherit; font-size: .8125rem; cursor: pointer;
}
.qr:hover { border-color: var(--muted); color: var(--ink); }
.qr[aria-pressed="true"] { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }

/* ---------- календарь мероприятий */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.cal-head h2 { margin: 0 8px; min-width: 150px; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow { font-size: .75rem; color: var(--muted); text-align: center; padding: 4px 0; font-weight: 600; }
.cal-day { min-height: 92px; border: 1px solid var(--line-soft); border-radius: 10px; padding: 4px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day.is-out { opacity: .45; }
.cal-day.is-today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-num { font-size: .8rem; color: var(--muted); padding: 0 2px; }
.cal-day.is-today .cal-num { color: var(--accent-strong); font-weight: 700; }
.cal-ev { display: block; font-size: .72rem; line-height: 1.25; padding: 2px 5px; border-radius: 6px; text-decoration: none;
  color: var(--accent-strong); background: var(--accent-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev.lv-bg-international { background: var(--accent-strong); color: #fff; }
.cal-ev.lv-bg-federal { background: color-mix(in srgb, var(--accent) 30%, var(--surface)); }
.cal-more { font-size: .7rem; color: var(--muted); padding: 0 4px; }
.up-ev { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; border-top: 1px solid var(--line-soft); text-decoration: none; color: var(--ink); }
.up-ev:first-of-type { border-top: 0; }
.up-date { font-size: .8rem; color: var(--accent-strong); font-weight: 600; }
.up-title { font-weight: 600; }
tr:target { background: var(--accent-soft); }
@media (max-width: 900px) {
  .cal-layout { grid-template-columns: 1fr; }
  .cal-day { min-height: 56px; }
  .cal-ev { font-size: 0; padding: 0; height: 6px; }   /* на телефоне — только цветная метка, подробности в списке */
}

/* ---------- согласие и «Мои данные» */
.consent-doc .doc-title { font-size: 1.25rem; text-align: center; margin: 0 0 20px; }
.doc-sec h3 { font-size: 1rem; margin: 22px 0 8px; color: var(--ink); }
.doc-sec ul { margin: 0 0 12px; padding-left: 22px; max-width: 72ch; }
.doc-sec li { margin: 4px 0; line-height: 1.55; }
.doc-group { font-weight: 600; margin: 12px 0 4px; color: var(--ink); }
.consent-bar { margin-top: 16px; }
/* закреплённая внизу панель — только на высоких экранах, иначе она закрывает сам текст */
@media (min-height: 760px) and (min-width: 700px) {
  .consent-bar { position: sticky; bottom: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
}
.consent-agree span { font-weight: 600; color: var(--ink); }
.consent-bar .small { margin: 8px 0 14px 28px; }
.consent-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: 28px; }
.profile-head { display: flex; align-items: center; gap: 16px; }
.profile-head h2 { margin: 0; }
.profile-head p { margin: 2px 0 0; }
.avatar-l { width: 56px; height: 56px; border-radius: 18px; flex: none; background: var(--accent-soft); color: var(--accent-strong);
  display: inline-grid; place-items: center; font-weight: 700; font-size: 1.1rem; }
.doc-rows { display: flex; flex-direction: column; }
.doc-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.doc-row:first-child { border-top: 0; }
.doc-row > div:first-child { display: flex; flex-direction: column; gap: 2px; }
.consent-state { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
@media (max-width: 600px) { .doc-row { flex-direction: column; align-items: flex-start; } .consent-actions, .consent-bar .small { margin-left: 0; } }

/* поле с ошибкой, к которому вернула форма, — коротко подсвечивается */
@keyframes flash-err { from { box-shadow: 0 0 0 4px color-mix(in srgb, var(--bad) 35%, transparent); } to { box-shadow: 0 0 0 0 transparent; } }
.flash { border-radius: 12px; animation: flash-err 1.6s ease-out; }

/* ---------- положение и другие документы к достижению */
.attachments { padding: 4px 20px 16px; }
.attachments h3 { font-size: .95rem; margin: 0 0 8px; }
.att-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line-soft); font-size: .9rem; }
.att-row:first-of-type { border-top: 0; }
.att-row form { margin: 0; }

/* ---------- почему столько баллов и несогласие студента */
.score-why { margin: 10px 0 16px; }
.score-why > summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: .9rem; }
.score-why[open] > summary { margin-bottom: 10px; }
.why-table { width: 100%; border-collapse: collapse; font-size: .875rem; margin: 6px 0 10px; }
.why-table td { padding: 6px 10px; border-top: 1px solid var(--line-soft); }
.why-table td:last-child { text-align: right; white-space: nowrap; color: var(--muted); }
.why-table tr.is-cur td { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.why-table tr.is-cur td:first-child { border-radius: 8px 0 0 8px; }
.why-table tr.is-cur td:last-child { border-radius: 0 8px 8px 0; color: var(--accent-strong); }
.claim { border-top: 1px dashed var(--line); padding-top: 12px; margin-top: 4px; }
.claim textarea { min-height: 70px; }

/* итог под таблицей «Из чего сложились баллы» */
.data tfoot .total-row td { padding: 14px 16px; border-top: 2px solid var(--line); font-weight: 600; color: var(--ink); }

/* строка с номинацией и файлом — чтобы различать похожие достижения (пять «IT-Планет») */
.feed-detail { margin-top: 2px; }
.feed-file { max-width: 42ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .85; }

/* место у победителя подставляется само — поле только для чтения */
.field input[readonly] { background: var(--sunken); color: var(--muted); cursor: default; }

/* ---------- «Моя страница»: плитки ---------- */
.view-bar { display: flex; gap: 8px; align-items: center; flex: 1 1 100%; }
.view-bar input[type=search] { flex: 1 1 auto; min-width: 0; }
.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; flex: none; }
.view-toggle button {
  border: 0; background: none; color: var(--muted); font: inherit; font-size: .8125rem; font-weight: 600;
  padding: 6px 14px; border-radius: 999px; cursor: pointer; min-height: 32px;
}
.view-toggle button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.fchips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 100%; }
.fchip {
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: .8125rem;
  padding: 5px 12px; border-radius: 999px; cursor: pointer; min-height: 32px;
}
.fchip span { color: var(--muted); margin-left: 3px; font-variant-numeric: tabular-nums; }
.fchip:hover { border-color: var(--muted); }
.fchip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.fchip[aria-pressed="true"] span { color: inherit; opacity: .7; }
.list-tools { display: contents; }
.gallery { padding-top: 6px; }
.g-sec { margin-top: 18px; }
.g-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.g-head h3 { margin: 0; font-family: var(--font); font-size: 1rem; }
.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.tile {
  position: relative; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-m);
  overflow: hidden; background: var(--surface); transition: border-color .15s, box-shadow .15s;
}
.tile:hover { border-color: var(--accent-line); box-shadow: 0 4px 14px color-mix(in srgb, var(--ink) 8%, transparent); }
.tile.is-rejected { border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.tile.is-folded { display: none; }
/* снизу — место под плашки результата и уровня (до двух строк): значок не прячется под ними */
.tile-thumb { position: relative; aspect-ratio: 4 / 3; background: var(--sunken); display: grid; place-items: center; overflow: hidden;
              padding-bottom: 58px; }
.tile-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.tile-badges { position: absolute; left: 8px; right: 8px; bottom: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.tbadge {
  font-size: .6875rem; font-weight: 600; line-height: 1.2; padding: 3px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); color: var(--text); border: 1px solid var(--line);
}
.tb-gold { background: #f6d77a; color: #4a3500; border-color: #e3bd4f; }
.tb-silver { background: #dfe3e8; color: #2d333a; border-color: #c4cbd3; }
.tb-bronze { background: #e9c3a0; color: #4a2a10; border-color: #d29f74; }
.tb-accent { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent-line); }
.tile-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.tile-title {
  color: var(--ink); font-weight: 600; font-size: .875rem; line-height: 1.35; text-decoration: none;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.tile-title::after { content: ""; position: absolute; inset: 0; }
.tile-title:hover { text-decoration: underline; color: var(--ink); }
.tile-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; }
.tile-points { font-family: var(--font-display); font-weight: 700; font-size: .875rem; color: var(--accent-strong); white-space: nowrap; }
.g-more { margin-top: 10px; }
@media (max-width: 480px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .view-toggle button { padding: 6px 10px; }
}
@media print { [data-feed][hidden] { display: block !important; } }

.preview-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-acts { display: inline-flex; align-items: center; gap: 12px; flex: none; }
.preview-acts form { margin: 0; }

.period-check, .none-check { margin: 8px 0 0; font-size: .875rem; }
.period-end { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }

.mod-groups { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0 0 16px; }
.mod-groups .fchips { flex: 1 1 auto; }
a.fchip { text-decoration: none; display: inline-flex; align-items: center; }
.decided-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.decided-bar form { margin: 0; }

/* узкая ячейка: подробности уходят под афишу, а не сжимаются в столбик по букве */
.ev-details { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-start; margin-top: 8px; }
.ev-poster { flex: none; width: 92px; display: flex; flex-direction: column; gap: 4px; font-size: .75rem; text-decoration: none; color: var(--accent-strong); }
.ev-poster img { width: 92px; height: 120px; object-fit: cover; object-position: top; border: 1px solid var(--line); border-radius: 8px; background: var(--sunken); }
.ev-kv { flex: 1 1 180px; min-width: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 10px; margin: 0; font-size: .8125rem; }
.ev-kv dt { color: var(--muted); }
.ev-kv dd { margin: 0; overflow-wrap: break-word; min-width: 0; }
.up-deadline { color: var(--accent-strong); }

th[data-sort] { cursor: pointer; user-select: none; white-space: nowrap; }
th[data-sort]::after { content: "↕"; margin-left: 6px; opacity: .35; font-size: .85em; }
th[data-sort][aria-sort="ascending"]::after { content: "↑"; opacity: .9; }
th[data-sort][aria-sort="descending"]::after { content: "↓"; opacity: .9; }
th[data-sort]:hover, th[data-sort]:focus-visible { color: var(--ink); }
.lb-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.lb-tools input[type=search] { flex: 1 1 220px; }
.lb-tools select { width: auto; flex: 0 1 200px; min-height: 40px; padding: 6px 10px; font-size: .875rem; }

/* ---------- навигация: «Ещё» на компьютере, выезжающее меню на телефоне ---------- */
.nav { align-items: center; }
.nav-more { position: relative; }
.nav-more > summary {
  list-style: none; cursor: pointer; color: var(--muted); padding: 0 12px 0 14px; min-height: 40px; display: inline-flex;
  align-items: center; gap: 4px; border-radius: 999px; font-weight: 500; font-size: .9375rem;
}
.nav-more > summary::-webkit-details-marker { display: none; }
.nav-more > summary:hover, .nav-more[open] > summary { color: var(--ink); background: var(--sunken); }
.nav-more > summary[aria-current="page"] { color: var(--accent-strong); background: var(--accent-soft); font-weight: 600; }
.nav-pop { left: 0; right: auto; }
.nav-pop a { display: flex; align-items: center; gap: 10px; min-height: 0; }
.nav-pop a[aria-current="page"] { color: var(--accent-strong); background: var(--accent-soft); font-weight: 600; }
.nav-pop svg, .drawer-nav svg { color: var(--muted); flex: none; }
.nav-pop a[aria-current="page"] svg, .drawer-nav a[aria-current="page"] svg { color: currentColor; }
.burger, .drawer-x {
  display: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 12px;
  width: 42px; height: 42px; place-items: center; cursor: pointer; padding: 0;
}
.drawer-x { display: inline-grid; margin-left: auto; border: 0; background: none; }
.drawer, .drawer-shade { display: none; }
@media (max-width: 960px) {
  .topbar { position: sticky; }
  .topbar-inner { min-height: 58px; flex-wrap: nowrap; gap: 10px; }
  .nav, .who-menu { display: none; }
  .who { margin-left: auto; }
  .burger { display: inline-grid; }
  .drawer-shade { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(10, 10, 20, .45);
                  opacity: 0; transition: opacity .2s; }
  .drawer-shade.is-open { opacity: 1; }
  .drawer {
    display: flex; flex-direction: column; position: fixed; top: 0; right: 0; bottom: 0; z-index: 41;
    width: min(320px, 86vw); background: var(--surface); border-left: 1px solid var(--line);
    box-shadow: -16px 0 40px rgba(0,0,0,.25); transform: translateX(105%); transition: transform .22s ease-out;
    visibility: hidden; overflow-y: auto; padding: 14px 12px max(16px, env(safe-area-inset-bottom));
  }
  .drawer.is-open { transform: none; visibility: visible; }
  .drawer-head { display: flex; align-items: center; gap: 10px; padding: 4px 6px 14px; border-bottom: 1px solid var(--line-soft); }
  .drawer-who { display: flex; flex-direction: column; line-height: 1.25; }
  .drawer-who .who-role { display: block; }
  .drawer-nav { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; }
  .drawer-nav a, .drawer-foot a, .drawer-foot button {
    display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 12px; border-radius: 12px;
    color: var(--ink); text-decoration: none; font: inherit; font-size: 1rem; background: none; border: 0;
    width: 100%; text-align: left; cursor: pointer;
  }
  .drawer-nav a[aria-current="page"] { color: var(--accent-strong); background: var(--accent-soft); font-weight: 600; }
  .drawer-nav a:hover, .drawer-foot a:hover, .drawer-foot button:hover { background: var(--sunken); }
  .drawer-foot { margin-top: auto; border-top: 1px solid var(--line-soft); padding-top: 8px; }
  .drawer-foot a, .drawer-foot button { min-height: 42px; font-size: .9375rem; color: var(--muted); }
  .drawer-foot form { margin: 0; }
  body.drawer-on { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) { .drawer, .drawer-shade { transition: none; } }

/* ---------- «Моя страница» на телефоне: кнопки переносятся, счётчики 2×2 ---------- */
@media (max-width: 640px) {
  .profile-actions { flex-wrap: wrap; width: 100%; }
  .profile-actions .btn-primary { display: none; }      /* «Добавить» уже есть в шапке */
  .profile-counters { display: grid; grid-template-columns: 1fr 1fr; }
  .profile-counters > div { border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .profile-counters > div:nth-child(odd) { border-right: 1px solid var(--line-soft); }
  .profile-counters > div:nth-last-child(-n+2):nth-child(odd), .profile-counters > div:last-child { border-bottom: 0; }
}

/* ---------- телефон: очередь, плитки, чипы ---------- */
.tile-title { overflow-wrap: break-word; hyphens: auto; hyphenate-limit-chars: 8 3 3; }
/* 360 px: две плитки в ряд — меньше отступы и шрифт, чтобы «программированию» помещалось целиком */
@media (max-width: 420px) { .tile-title { font-size: .78rem; } .tile-body { padding-left: 8px; padding-right: 8px; } }
@media (max-width: 380px) { .tile-title { font-size: .75rem; } }
/* телефон: плитка ниже — значок поменьше и место под плашки поуже, чтобы значок не упирался ни в край, ни в плашки */
@media (max-width: 420px) { .tile-thumb { padding-bottom: 50px; } .tile-thumb .ach-ico { width: 36px; height: 36px; border-radius: 11px; } }
@media (max-width: 380px) { .tile-thumb { padding-bottom: 48px; } .tile-thumb .ach-ico { width: 32px; height: 32px; border-radius: 10px; } .tile-thumb .ach-ico svg { width: 18px; height: 18px; } }
.g-head .small { white-space: nowrap; }
@media (max-width: 640px) {
  .queue-bar { flex-wrap: wrap; }
  .queue-nav { width: 100%; margin-left: 0; justify-content: space-between; }
  .queue-nav .seg { flex-wrap: nowrap; flex: 1 1 auto; }
  .queue-nav .seg .btn { flex: 1 1 0; justify-content: center; white-space: nowrap; }
  .queue-nav > a { white-space: nowrap; }
  /* быстрые фильтры — одной строкой с прокруткой, а не пятью строками */
  .fchips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -16px; padding-right: 16px; }
  .fchips::-webkit-scrollbar { display: none; }
  .fchip { flex: none; white-space: nowrap; }
}
.card-layout > * { min-width: 0; }      /* длинная строка внутри не распирает колонку шире экрана */

.pdf-pages { max-height: 78vh; overflow-y: auto; background: var(--sunken); padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.pdf-pages img { display: block; width: 100%; height: auto; border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,.18); background: #fff; }
.pdf-open { margin: 0; padding: 8px 16px; border-top: 1px solid var(--line); color: var(--muted); }
.btn.is-disabled { opacity: .45; pointer-events: none; }
@media (max-width: 860px) { .pdf-pages { max-height: none; } }

.period-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex-basis: 100%; }
.period-form input[type=date] { width: auto; min-height: 38px; padding: 6px 10px; font-size: .875rem; }

/* строка черновика целиком — ссылка на него: растянутая ссылка должна ограничиваться своей строкой,
   иначе её слой накрывает весь список и любой клик открывает последний черновик */
.draft-row { position: relative; }
.draft-row .draft-check, .draft-row .draft-state a, .draft-row .draft-state button, .draft-row form { position: relative; z-index: 1; }

/* ---------- «Сводка» ---------- */
.home-hi { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.home-hi h1 { margin: 0; }
.home-hi p { margin: 2px 0 0; }
.home-av { width: 48px; height: 48px; border-radius: 16px; font-size: 1rem; }
.home-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.home-stat {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-m);
  background: var(--surface); color: var(--ink); text-decoration: none;
}
.home-stat:hover { border-color: var(--accent-line); color: var(--ink); }
.home-stat span { font-size: .8125rem; color: var(--muted); }
.home-stat strong { font-family: var(--font-display); font-size: 1.6rem; line-height: 1.1; }
.home-stat small { font-family: var(--font); font-size: .8125rem; font-weight: 500; color: var(--muted); }
.home-stat.is-hot { border-color: var(--accent-line); background: var(--accent-soft); }
.home-stat.is-hot strong { color: var(--accent-strong); }
.home-todo h2 { margin-top: 0; }
.home-list { list-style: none; margin: 0; padding: 0; }
.home-list li + li { border-top: 1px solid var(--line-soft); }
.home-list a { display: flex; align-items: center; gap: 12px; padding: 12px 4px; text-decoration: none; color: var(--ink); border-radius: 10px; }
.home-list a:hover { background: var(--sunken); color: var(--ink); }
.hl-ico {
  flex: none; width: 32px; height: 32px; border-radius: 10px; display: inline-grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; font-size: .875rem;
}
.home-list .is-bad .hl-ico { background: var(--bad-soft); color: var(--bad); }
.home-list .is-muted .hl-ico { background: var(--sunken); color: var(--muted); }
.hl-text { flex: 1; min-width: 0; font-weight: 500; overflow-wrap: break-word; }
.hl-text small { display: block; font-weight: 400; color: var(--muted); font-size: .8125rem; margin-top: 2px; }
.hl-go { flex: none; font-size: .875rem; color: var(--accent-strong); white-space: nowrap; }
.home-list .is-muted .hl-go { color: var(--muted); }
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-top: 16px; }
.home-grid .panel { margin: 0; }
.home-ev { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; border-top: 1px solid var(--line-soft); text-decoration: none; color: var(--ink); }
.home-ev:first-of-type { border-top: 0; }
.home-ev:hover .t-title { text-decoration: underline; }
.home-ok { color: var(--ok); }
.home-bad { color: var(--bad); }
@media (max-width: 640px) {
  .home-list a { flex-wrap: wrap; }
  .hl-go { flex-basis: 100%; padding-left: 44px; white-space: normal; }
}

.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pager .is-current { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ---------- карточка мероприятия ---------- */
.ev-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.ev-desc p { margin: 0 0 8px; }
.ev-photo img { display: block; width: 100%; height: auto; }

/* ---------- разбалловка ---------- */
.scale-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.scale-head p { margin: 2px 0; }
.scale-section { margin: 28px 0 10px; font-size: 1.1rem; }
.scale-table h3 { margin: 0 0 6px; font-size: 1rem; }
.scale-grid th[scope="row"] { text-align: left; font-weight: 500; color: var(--ink); white-space: normal; }
.scale-grid td, .scale-grid thead th { text-align: center; }
/* стрелки регулировки закрывали число в узком поле — убираем их, число вводится с клавиатуры */
.scale-grid .scale-cell { width: 76px; min-height: 36px; padding: 4px 6px; text-align: center; font-variant-numeric: tabular-nums;
                          -moz-appearance: textfield; appearance: textfield; }
.scale-grid .scale-cell::-webkit-outer-spin-button,
.scale-grid .scale-cell::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.scale-actions { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 0; background: var(--paper);
                 border-top: 1px solid var(--line-soft); z-index: 5; }
.scale-preview { border-color: var(--accent-line); }
/* планшет: пять столбцов с полями ввода — плотнее, а если всё равно шире, листается сама таблица, не страница */
.scale-table .table-wrap { overflow-x: auto; }
@media (max-width: 1000px) {
  .scale-grid th, .scale-grid td { padding: 10px 8px; }
  .scale-grid .scale-cell { width: 64px; }
}
/* на телефоне и планшете шапка таблицы скрыта — каждая строка шкалы становится плитками «столбец → баллы» */
@media (max-width: 900px) {
  .data.scale-grid thead { display: none; }
  .data.scale-grid, .data.scale-grid tbody { display: block; width: 100%; }
  .data.scale-grid tbody tr { padding: 14px 16px; }
  .data.scale-grid tbody tr { display: grid; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); gap: 8px; }
  .data.scale-grid th[scope="row"] { display: block; grid-column: 1 / -1; padding: 0 0 2px; }
  .data.scale-grid td { display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 4px;
                        padding: 8px 6px; border-radius: 10px; background: var(--sunken); text-align: center; white-space: normal; }
  .data.scale-grid td::before { content: attr(data-label); font-size: .75rem; line-height: 1.25; color: var(--muted); }
  .scale-grid .scale-cell { width: 100%; max-width: 76px; }
  /* две кнопки рядом, а не друг под другом — панель снизу занимает меньше экрана */
  .scale-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px 0; }
  .scale-actions .btn { min-height: 44px; padding: 6px 10px; white-space: normal; line-height: 1.2; font-size: .875rem; }
}

/* кнопки под документом: распознать заново, повернуть */
.doc-tools { display: flex; flex-wrap: wrap; gap: 8px; }

/* выгрузка портфолио и описи за период */
.period-export { display: grid; gap: 12px; }
.period-fields { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.period-fields label { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.period-fields input { width: auto; }
.period-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.period-presets .chip { cursor: pointer; }
.period-menu { position: relative; }
.period-menu > summary { list-style: none; cursor: pointer; }
.period-menu > summary::-webkit-details-marker { display: none; }
/* окно поверх страницы: карточка профиля обрезает всё, что выходит за её край */
.period-pop { position: fixed; left: 50%; top: 18vh; transform: translateX(-50%); z-index: 60; width: min(480px, 92vw);
              max-height: 76vh; overflow: auto; padding: 18px; text-align: left;
              background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 50px rgba(0,0,0,.25); }
.plain-list { margin: 0; padding-left: 18px; display: grid; gap: 8px; }
/* шапка между телефоном и широким экраном: шесть вкладок студента в одну строку — плотнее отступы,
   у «Добавить» остаётся «+» */
@media (min-width: 961px) and (max-width: 1180px) {
  .topbar-inner { gap: 10px 14px; padding-left: 16px; padding-right: 16px; }
  .nav a { padding: 0 10px; font-size: .875rem; }
  .add-label { display: none; }
}
/* ещё уже — имя прячем, остаётся аватарка (имя и роль видны в меню профиля) */
@media (min-width: 961px) and (max-width: 1040px) {
  .who-text { display: none; }
  .topbar-inner { flex-wrap: nowrap; }
}
/* шапка, которой не хватает места (класс ставит app.js по факту ширины вкладок) */
.topbar-inner.fit-1 { gap: 10px 14px; }
.fit-1 .nav a, .fit-1 .nav-more > summary { padding: 0 10px; font-size: .875rem; }
.fit-1 .add-label, .fit-2 .who-text { display: none; }
.nav-off { display: none !important; }
/* разбалловка из нового Положения: что изменилось и чего в файле не нашли */
.scale-import-form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; }
.scale-import-form input[type=file] { max-width: 100%; font-size: .875rem; }
.scale-import-result { border-color: var(--accent-line); }
.scale-import-result p { margin: 0; }
.scale-grid td.is-changed { background: var(--accent-soft); }
.scale-grid td.is-changed .scale-cell { border-color: var(--accent); font-weight: 700; }
.scale-was { display: block; margin-top: 2px; font-size: .75rem; color: var(--muted); white-space: nowrap; }
.scale-grid tr.is-missing th { color: var(--muted); }

/* ---------- заставки ошибок (404, 403, 500…) ---------- */
.err { max-width: 560px; margin: 24px auto 48px; text-align: center; }
.err-art { width: 100%; max-width: 480px; height: auto; display: block; margin: 0 auto 8px; overflow: visible; }
.err-code { font-family: var(--font-display); font-weight: 800; font-size: 108px; letter-spacing: -.04em;
            fill: var(--accent-soft); stroke: var(--accent-line); stroke-width: 1.5; }
.err-sun { fill: var(--gold-soft); opacity: .9; }
.err-far { fill: var(--accent-line); opacity: .45; }
.err-mount { fill: var(--accent-soft); stroke: var(--accent-line); stroke-width: 1.5; stroke-linejoin: round; }
.err-snow { fill: color-mix(in srgb, #fff 88%, var(--accent-soft)); stroke: var(--accent-line); stroke-width: 1.5; stroke-linejoin: round; }
.err-trail { fill: none; stroke: var(--accent); stroke-width: 3; stroke-dasharray: 6 6; stroke-linecap: round; }
.err-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 3; }
.err-pole, .err-pole-flag { stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
.err-flag { fill: var(--accent); transform-origin: 169px 41px; }
.err-gap { fill: var(--paper); stroke: var(--accent-line); stroke-width: 1.5; stroke-linejoin: round; }
.err-sign { fill: var(--surface); stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; }
.err-sign-text { font-family: var(--font-display); font-weight: 800; font-size: 15px; fill: var(--accent-strong); }
.err-bar { stroke: var(--ink); stroke-width: 7; stroke-linecap: round; }
.err-bar-stripe { stroke: var(--bad); stroke-width: 5; stroke-dasharray: 10 10; }
.err-lock { fill: var(--ink); }
.err-lock-arc { fill: none; stroke: var(--ink); stroke-width: 3; }
.err-rock { fill: color-mix(in srgb, var(--muted) 55%, var(--accent-soft)); stroke: var(--ink); stroke-width: 1.2; stroke-linejoin: round; }
.err-mist path { stroke: var(--muted); stroke-width: 10; stroke-linecap: round; opacity: .22; }
.err-label { margin: 0 0 4px; font-size: .8125rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-strong); }
.err h1 { margin: 0 0 8px; }
.err-lead { margin: 0 auto 8px; max-width: 440px; color: var(--text); }
.err-actions { justify-content: center; margin-top: 18px; }
@media (prefers-reduced-motion: no-preference) {
  .err-flag { animation: err-wave 2.4s ease-in-out infinite; }
  .err-rocks .err-rock { animation: err-fall 2.6s ease-in infinite; }
  .err-rocks .r2 { animation-delay: .9s; }
  .err-rocks .r3 { animation-delay: 1.7s; }
  .err-mist path { animation: err-drift 6s ease-in-out infinite alternate; }
  .err-mist path:nth-child(2) { animation-duration: 8s; }
  .err-lost .err-sign, .err-lost .err-sign-text { animation: err-sway 3s ease-in-out infinite; transform-origin: 212px 172px; }
}
@keyframes err-wave { 50% { transform: scaleX(.82) skewY(-4deg); } }
@keyframes err-fall { 0% { transform: translate(0, -14px); opacity: 0; } 15% { opacity: 1; } 100% { transform: translate(18px, 70px) rotate(160deg); opacity: 0; } }
@keyframes err-drift { to { transform: translateX(26px); } }
@keyframes err-sway { 50% { transform: rotate(-4deg); } }
@media (max-width: 640px) { .err { margin-top: 8px; } .err-code { font-size: 108px; } }

/* ---------- немного жизни: флажки развеваются, тропа прорисовывается до вашего места ---------- */
@media (prefers-reduced-motion: no-preference) {
  .brand-mark .bm-flag, .climb-art .cl-flag, .lb-peak .lb-peak-flag {
    transform-box: fill-box; transform-origin: 0 50%; animation: flag-wave 3.2s ease-in-out infinite;
  }
  .brand:hover .bm-flag { animation-duration: 1s; }
  .climb-art .cl-done { stroke-dasharray: 1; animation: trail-draw 1.4s cubic-bezier(.3, .7, .3, 1) both; }
  .climb-art .cl-me { transform-box: fill-box; transform-origin: center;
                      animation: me-pop .4s 1.2s ease-out both, me-pulse 2.6s 1.8s ease-in-out infinite; }
}
@keyframes flag-wave { 0%, 100% { transform: none; } 50% { transform: scaleX(.84) skewY(-7deg); } }
@keyframes trail-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes me-pop { from { transform: scale(0); } 70% { transform: scale(1.25); } to { transform: scale(1); } }
@keyframes me-pulse { 50% { transform: scale(1.18); } }
@media print {
  .brand-mark .bm-flag, .climb-art .cl-flag, .lb-peak .lb-peak-flag, .climb-art .cl-done, .climb-art .cl-me { animation: none !important; }
  .climb-art .cl-done { stroke-dasharray: none; }
}
/* имя в мобильном меню — ссылка на «Мои данные и согласие», как имя в шапке на компьютере */
.drawer-me { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 6px 8px; margin: -6px 0 -6px -8px;
             border-radius: 12px; color: var(--ink); text-decoration: none; }
.drawer-me:hover, .drawer-me[aria-current="page"] { background: var(--sunken); color: var(--ink); }
.drawer-me .drawer-who { min-width: 0; }
.drawer-me .who-role { line-height: 1.3; }
.drawer-me-go { flex: none; margin-left: auto; color: var(--muted); }
/* телефон: длинная надпись на кнопке переносится, а не вылезает за карточку («Загрузить диплом с этого мероприятия») */
@media (max-width: 640px) {
  .btn { white-space: normal; max-width: 100%; text-align: center; line-height: 1.25; padding-top: 6px; padding-bottom: 6px; }
}
/* длинные значения без пробелов (подробности в журнале, ссылки, коды) переносятся, а не распирают таблицу */
.data td { overflow-wrap: break-word; }
.mono { overflow-wrap: anywhere; }

/* «Студенты»: архив грамот на группу или поток */
.arch-panel > summary { cursor: pointer; list-style: none; }
.arch-panel > summary::-webkit-details-marker { display: none; }
.arch-panel > summary::after { content: "▾"; margin-left: 6px; color: var(--muted); }
.arch-panel[open] > summary::after { content: "▴"; }
.arch-pick { display: grid; gap: 6px; font-weight: 500; max-width: 360px; }
/* очень узкий экран (или 360 px с полосой прокрутки): у «Добавить» остаётся «+», шапка в одну строку */
@media (max-width: 400px) {
  .add-label { display: none; }
  .topbar-inner { gap: 8px; padding-left: 12px; padding-right: 12px; }
}

/* ---------- «Аналитика» ---------- */
.an-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin-bottom: 16px; }
.an-filters label { display: grid; gap: 4px; font-size: .875rem; font-weight: 500; }
.an-filters select { min-width: 180px; }
.an-quota { width: 90px; }
.an-lead { max-width: 820px; margin: 0 0 16px; color: var(--text); }
.an-bars { display: grid; gap: 8px; margin-top: 8px; }
.an-bar-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) 40px; gap: 10px; align-items: center; }
.an-bar-label { font-variant-numeric: tabular-nums; font-size: .875rem; color: var(--muted); text-align: right; white-space: nowrap; }
.an-bar-label-wide { width: auto; }
.an-bars:has(.an-bar-label-wide) .an-bar-row { grid-template-columns: 110px minmax(0, 1fr) 48px; }
.an-bar-track { display: block; }
.an-bar-svg { display: block; width: 100%; height: 22px; border-radius: 6px; overflow: hidden; }
.an-bar-bg { fill: var(--sunken); }
.an-bar { fill: color-mix(in srgb, var(--accent-line) 70%, var(--surface)); }
.an-bar.is-pass { fill: var(--accent); }
.an-bar.is-edge { fill: color-mix(in srgb, var(--accent) 55%, var(--surface)); }
.an-bar-n { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); }
.an-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 12px 0 0; }
.an-key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 4px;
          background: color-mix(in srgb, var(--accent-line) 70%, var(--surface)); }
.an-key.is-pass { background: var(--accent); }
.an-key.is-edge { background: color-mix(in srgb, var(--accent) 55%, var(--surface)); }
.an-key.is-ok { background: var(--ok); }
.an-key.is-wait { background: color-mix(in srgb, var(--warn) 45%, var(--surface)); }
.an-cov { display: grid; gap: 16px; }
.an-cov-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin-bottom: 6px; }
.an-cov-track { display: block; width: 100%; height: 14px; border-radius: 7px; overflow: hidden; }
.an-cov-bg { fill: var(--sunken); }
.an-cov-ok { fill: var(--ok); }
.an-cov-wait { fill: color-mix(in srgb, var(--warn) 45%, var(--surface)); }
.an-cov-who { margin-top: 6px; }
.an-cov-who ul { margin: 6px 0 0; padding-left: 18px; columns: 2 220px; }
/* студенту: «как поднять балл» */
.hint-grid .col-points { white-space: nowrap; }
.hint-grid .gain { font-weight: 700; color: var(--accent-strong); }
.hint-grid .gain-0 { color: var(--muted); font-weight: 400; }

/* Видимость аналитики: галочки по ролям — по центру столбца */
.access-grid .col-check { width: 170px; text-align: center; }
.access-grid .col-check .check { justify-content: center; }
@media (max-width: 640px) { .access-grid .col-check { width: auto; text-align: left; } .access-grid .col-check .check { justify-content: flex-start; } }
