/* «Портфолио учащегося» — оформление в стиле сервиса МЭШ */
:root {
    --font-sans: "Manrope", "Segoe UI", system-ui, -apple-system, Roboto, "Carlito", sans-serif;
    --container: 1180px;
    --topbar-height: 64px;
    --surface-3: #f7f8fc;
    --text-light: #5f6882;
    --blue: #3B6EF5;
    --blue-dark: #2F57E0;
    --blue-soft-2: #eef0fd;
    --blue-soft: #EEF0FE;
    --grey-soft: #F2F3F7;
    --grey-line: #E7E9F4;
    --text: #1D2138;
    --muted: #7B8194;
    --muted-2: #9AA1B2;
    --yellow: #FEF3C8;
    --yellow-line: #F6DFA0;
    --green: #22C55E;
    --green-soft: #E6F8EF;
    --peach: #FFF1E7;
    --orange: #F97316;
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --shadow: 0 2px 14px rgba(31, 35, 48, .06);
    --pf-bg: linear-gradient(135deg, #EAD9FF 0%, #FBD9E8 45%, #D6E4FF 100%);
}

* { box-sizing: border-box; }

/* Manrope — та же гарнитура, что в основном интерфейсе АИС «Школа».
   Файлы шрифта в репозиторий не входят: если их нет, берётся системный Manrope,
   иначе подставляется системный гротеск. Чтобы подключить свои файлы, положите
   Manrope-*.woff2 в portfolio/static/portfolio/fonts/ и раскомментируйте url(). */
@font-face {
    font-family: "Manrope"; font-style: normal; font-weight: 400; font-display: swap;
    src: local("Manrope"), local("Manrope-Regular")
    /* , url("../fonts/Manrope-Regular.woff2") format("woff2") */;
}
@font-face {
    font-family: "Manrope"; font-style: normal; font-weight: 600; font-display: swap;
    src: local("Manrope SemiBold"), local("Manrope-SemiBold")
    /* , url("../fonts/Manrope-SemiBold.woff2") format("woff2") */;
}
@font-face {
    font-family: "Manrope"; font-style: normal; font-weight: 700; font-display: swap;
    src: local("Manrope Bold"), local("Manrope-Bold")
    /* , url("../fonts/Manrope-Bold.woff2") format("woff2") */;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--text);
    background: var(--pf-bg);
    background-attachment: fixed;
    font-size: 15px;
    line-height: 1.5;
    letter-spacing: -0.005em;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { margin: 0; font-weight: 700; }
h3, h4 { margin: 0; font-weight: 600; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.shell { max-width: 1160px; margin: 0 auto; padding: 0 16px 48px; }

/* ---------- Верхняя панель сервисов АИС «Школа» ---------- */
.topbar {
    position: sticky; top: 0; z-index: 300; height: var(--topbar-height);
    background: #fff; border-bottom: 1px solid var(--grey-line);
}
.topbar-inner {
    width: min(var(--container), calc(100% - 48px)); height: 100%; margin: auto;
    display: flex; align-items: center; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; color: inherit; }
.brand:hover { color: inherit; text-decoration: none; }
.brand-logo { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-title { display: block; font-size: 19px; font-weight: 700; color: var(--text); white-space: nowrap; line-height: 1.15; }
.brand-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
.topbar-nav { display: flex; align-items: center; gap: 6px; flex: 1; margin-left: 12px; }
.nav-link {
    display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px;
    border: none; border-radius: 10px; background: transparent; color: var(--text-light);
    font-size: 14px; font-weight: 600; white-space: nowrap;
}
.nav-link:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav-link.is-active { background: var(--surface-3); color: var(--text); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.icon-btn {
    width: 38px; height: 38px; border: none; border-radius: 10px; background: transparent;
    color: var(--text-light); display: grid; place-items: center;
}
.icon-btn:hover { background: var(--surface-3); color: var(--blue); }
.user-btn {
    display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px 0 8px;
    border: 1px solid var(--grey-line); border-radius: 999px; background: #fff; color: var(--text);
}
.user-btn:hover { text-decoration: none; background: var(--surface-3); }
.user-avatar {
    width: 28px; height: 28px; border-radius: 50%; background: var(--blue-soft); color: var(--blue);
    display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.user-btn .name { font-size: 14px; font-weight: 600; line-height: 1.1; }
.user-btn .role { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* ---------- Страница входа ---------- */
.login-wrap { max-width: 440px; margin: 60px auto; }
.login-card { background: #fff; border-radius: var(--radius-lg); padding: 34px 32px; box-shadow: var(--shadow); text-align: center; }
.login-card .brand-logo { width: 56px; height: 56px; margin: 0 auto 16px; }
.login-card h1 { font-size: 22px; margin-bottom: 8px; }
.login-card p { color: var(--muted); margin: 0 0 22px; }
.login-card .btn { width: 100%; justify-content: center; }
.login-note { color: var(--muted-2); font-size: 13px; margin-top: 18px; }

/* ---------- Шапка портфолио ---------- */
.pf-head {
    background: #fff;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: 18px 26px 0;
    box-shadow: var(--shadow);
}
.pf-head-row { display: flex; align-items: center; gap: 16px; }
.pf-badges { display: flex; }
.pf-badge {
    width: 54px; height: 54px; border-radius: 18px;
    display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 18px;
}
.pf-badge.star { background: linear-gradient(140deg, #7C3AED, #C026D3); font-size: 22px; }
.pf-badge.initials { background: #2563EB; margin-left: -14px; border: 3px solid #fff; }
.pf-title-block { flex: 1; min-width: 0; }
.pf-eyebrow { color: var(--muted-2); font-size: 13px; }
.pf-name { font-size: 24px; line-height: 1.2; }
.pf-actions { display: flex; align-items: center; gap: 10px; }

.btn {
    border: 0; border-radius: var(--radius-sm); padding: 11px 18px;
    font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); text-decoration: none; }
.btn-ghost { background: #fff; color: var(--text); border: 1px solid var(--grey-line); }
.btn-round {
    width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--grey-line);
    background: #fff; display: grid; place-items: center; padding: 0;
}

/* ---------- Вкладки разделов ---------- */
.pf-tabs { display: flex; align-items: center; gap: 6px; padding: 14px 0 12px; overflow-x: auto; }
.pf-tab {
    padding: 10px 16px; border-radius: var(--radius-sm); color: var(--text);
    font-weight: 600; white-space: nowrap;
}
.pf-tab:hover { background: #F8F9FB; text-decoration: none; }
.pf-tab.is-active { background: var(--grey-soft); }
.pf-tab.is-muted { color: var(--muted-2); }

/* ---------- Карточки ---------- */
.card {
    background: #fff; border-radius: var(--radius-lg); padding: 24px 26px;
    box-shadow: var(--shadow); margin-top: 18px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 6px; }
.card-title { font-size: 18px; font-weight: 600; }
.card-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip {
    border-radius: 10px; padding: 9px 14px; font-weight: 600; font-size: 14px;
    background: #fff; color: var(--text); border: 1px solid var(--grey-line);
}
.chip.is-active { background: var(--blue); color: #fff; border-color: var(--blue); }
.chip .count { color: var(--muted-2); margin-left: 6px; font-weight: 500; }
.chip.is-active .count { color: rgba(255, 255, 255, .8); }

/* ---------- Лента времени ---------- */
.tl { position: relative; margin-top: 18px; }
.tl::before {
    content: ""; position: absolute; left: 61px; top: 6px; bottom: 6px;
    width: 2px; background: var(--grey-line);
}
.tl-group { display: grid; grid-template-columns: 60px 1fr; gap: 0 28px; }
.tl-year {
    color: #C9CDD8; font-size: 24px; font-weight: 600; letter-spacing: .04em;
    writing-mode: vertical-rl; transform: rotate(180deg); height: 92px; justify-self: start;
}
.tl-items { display: grid; gap: 16px; padding-bottom: 16px; min-width: 0; }

.entry {
    position: relative; background: #fff; border: 1px solid var(--grey-line);
    border-radius: 18px; padding: 20px 22px; display: flex; gap: 18px;
}
.entry::before {
    content: ""; position: absolute; left: -34px; top: 38px;
    width: 15px; height: 15px; border-radius: 50%; background: #fff;
    border: 3px solid #7C8CF8;
}
.entry-main { flex: 1; min-width: 0; }
.entry-title { font-size: 17px; margin: 10px 0 6px; }
.entry-level { font-weight: 600; font-size: 14px; }
.entry-meta { color: var(--muted); font-size: 14px; }
.entry-meta .sep { color: #C9CDD8; margin: 0 6px; }
.entry-dates { color: var(--muted); font-size: 14px; margin-top: 10px; }
.entry-side { display: flex; align-items: flex-start; gap: 12px; }

.tag { border-radius: 9px; padding: 6px 12px; font-size: 13px; font-weight: 600; }
.tag-kind { background: var(--blue-soft); color: #4C5BD4; }
.tag-form { background: var(--grey-soft); color: var(--muted); }
.tag-check {
    width: 28px; height: 28px; border-radius: 9px; background: var(--green-soft);
    color: var(--green); display: inline-grid; place-items: center; font-size: 15px; font-weight: 700;
}

.award {
    background: var(--yellow); border-radius: 14px; padding: 14px 16px;
    min-width: 210px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.award-name { font-weight: 600; font-size: 15px; }
.award-date { color: #9A7B34; font-size: 13px; margin-top: 4px; }
.entry-art { opacity: .55; flex-shrink: 0; align-self: center; }
.more-btn {
    width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--grey-line);
    background: #fff; color: var(--muted); display: grid; place-items: center; letter-spacing: 1px;
}

/* ---------- Диагностики ---------- */
.stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 860px) { .stats-row { grid-template-columns: 1fr; } }

.donut-wrap { display: flex; align-items: center; gap: 22px; }
.donut-total { font-size: 13px; color: var(--muted); text-align: center; }
.donut-total b { display: block; font-size: 24px; font-weight: 600; color: var(--text); }
.legend { display: grid; gap: 10px; font-size: 14px; flex: 1; }
.legend-row { display: flex; align-items: center; gap: 10px; }
.legend-row .dot { width: 10px; height: 10px; border-radius: 50%; }
.legend-row .value { margin-left: auto; font-weight: 500; color: var(--muted); }

.best { display: flex; align-items: center; gap: 18px; }
.best-name { font-size: 16px; font-weight: 600; }
.best-score { color: var(--muted); font-size: 14px; margin-top: 4px; }
.ring-label { font-size: 17px; font-weight: 600; }
.ring-label small { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }

.diag {
    border: 1px solid var(--grey-line); border-radius: 18px; padding: 22px 24px; background: #fff;
}
.diag-head { display: flex; justify-content: space-between; gap: 20px; }
.diag-title { font-size: 17px; }
.diag-score { display: flex; align-items: center; gap: 16px; text-align: right; }
.diag-score .label { color: var(--muted); font-size: 14px; }
.diag-score .value { font-weight: 600; }
.diag-score .mark { color: #E8A33D; font-weight: 600; }
.callout { background: #F2F5FF; border-radius: var(--radius-md); padding: 16px 18px; margin-top: 16px; }
.callout h4 { font-size: 15px; margin-bottom: 6px; }
.expander {
    width: 100%; margin-top: 14px; padding-top: 14px; border: 0; border-top: 1px solid var(--grey-line);
    background: none; color: var(--blue); font-weight: 600; text-align: left;
}

.rating { margin-top: 22px; border-top: 1px solid var(--grey-line); padding-top: 20px; }
.rating-head { display: flex; justify-content: space-between; align-items: center; }
.rank-cards { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--grey-line); border-radius: var(--radius-md); overflow: hidden; margin-top: 14px; }
.rank-card { padding: 16px 18px; display: flex; align-items: center; gap: 12px; border-right: 1px solid var(--grey-line); position: relative; }
.rank-card:last-child { border-right: 0; }
.rank-card.is-primary { background: #F4F6FF; }
.rank-card.is-primary::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--blue); }
.rank-place { font-size: 18px; font-weight: 600; }
.rank-place.is-primary { color: var(--blue); }
.rank-where { color: var(--muted); font-size: 14px; }
.rank-icon { font-size: 22px; }

.banner {
    background: var(--peach); border-radius: var(--radius-md); padding: 16px 20px; margin-top: 16px;
}
.banner b { color: var(--orange); display: block; margin-bottom: 4px; }

.rating-grid { margin-top: 18px; display: grid; gap: 10px; }
.rr { display: grid; grid-template-columns: 46px 1fr 230px 28px; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; }
.rr.is-me { background: #FFF8EC; border: 1px dashed #F0B94B; }
.rr-place { width: 40px; height: 40px; border-radius: 50%; background: var(--grey-soft); display: grid; place-items: center; font-weight: 600; }
.rr.is-me .rr-place { background: var(--blue); color: #fff; }
.rr-bar { min-width: 72px; position: relative; height: 40px; border-radius: 20px; background: var(--grey-soft); display: flex; align-items: center; padding: 0 16px; color: var(--muted); font-size: 13px; }
.rr.is-me .rr-bar { background: #8B9AF8; color: #fff; }
.rr-avatar { position: absolute; right: -8px; top: -2px; width: 44px; height: 44px; border-radius: 50%; background: #fff; border: 1px solid var(--grey-line); display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--text); }
.rr-avatar .face { width: 16px; height: 16px; border-radius: 50%; background: #D5D9E4; }
.rr-result { font-size: 14px; }
.rr-progress { height: 5px; border-radius: 3px; background: var(--grey-soft); margin-top: 6px; overflow: hidden; }
.rr-progress i { display: block; height: 100%; border-radius: 3px; }
.rr-mark { text-align: right; color: var(--muted-2); font-weight: 500; }
.axis { display: flex; justify-content: space-between; color: var(--muted-2); font-size: 12px; padding: 6px 282px 0 58px; }

/* ---------- График динамики ---------- */
.chart-wrap { display: grid; grid-template-columns: 1fr 240px; gap: 24px; align-items: center; }
@media (max-width: 860px) { .chart-wrap { grid-template-columns: 1fr; } }
.chart-legend { display: grid; gap: 12px; font-size: 14px; }
.chart-legend .row { display: flex; align-items: center; gap: 10px; }
.chart-legend .box { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; color: #fff; font-size: 12px; }

/* ---------- Пустое состояние ---------- */
.empty { text-align: center; padding: 44px 20px; }
.empty h3 { font-size: 18px; margin-bottom: 6px; }
.empty p { color: var(--muted); margin: 0 auto; max-width: 460px; }
.empty .btn { margin-top: 18px; }

/* ---------- Настройки ---------- */
.settings-grid { display: grid; grid-template-columns: 320px 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .settings-grid { grid-template-columns: 1fr; } }
.switch-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--grey-line); }
.switch-row:last-child { border-bottom: 0; }
.switch-row .title { font-weight: 600; }
.switch-row .hint { color: var(--muted); font-size: 13px; }
.switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track { position: absolute; inset: 0; background: #D5D9E4; border-radius: 12px; transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .track { background: var(--blue); }
.switch input:checked + .track::after { transform: translateX(18px); }
.sub-list { padding-left: 16px; border-left: 2px solid var(--grey-line); margin: 6px 0 6px 4px; }

/* ---------- Палитра оформления ---------- */
.palette { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.palette-item { border-radius: var(--radius-md); overflow: hidden; border: 2px solid transparent; cursor: pointer; }
.palette-item.is-active { border-color: var(--blue); }
.palette-cover { height: 74px; display: grid; place-items: center; color: #fff; font-weight: 700; }
.bg-swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.bg-swatch { height: 46px; border-radius: 12px; border: 2px solid transparent; }
.bg-swatch.is-active { border-color: var(--blue); }

/* ---------- Админ: загрузка ---------- */
.admin-shell { max-width: 1100px; margin: 0 auto; padding: 26px 16px 60px; }
.admin-head { background: var(--blue); color: #fff; border-radius: var(--radius-md); padding: 18px 22px; display: flex; justify-content: space-between; align-items: center; }
.admin-head h1 { font-size: 20px; }
.admin-head a { color: #fff; opacity: .9; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 16px; }
.stat { background: #fff; border-radius: var(--radius-md); padding: 16px 18px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 23px; font-weight: 600; }
.stat span { color: var(--muted); font-size: 13px; }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th { text-align: left; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--grey-line); }
table.grid td { padding: 11px 12px; border-bottom: 1px solid var(--grey-line); }
table.grid tr:last-child td { border-bottom: 0; }
.status { border-radius: 8px; padding: 4px 10px; font-size: 12px; font-weight: 700; }
.status.uploaded { background: var(--grey-soft); color: var(--muted); }
.status.validated { background: var(--blue-soft); color: var(--blue); }
.status.applied { background: var(--green-soft); color: #15803D; }
.status.failed { background: #FEE2E2; color: #B91C1C; }
.dropzone { border: 2px dashed #C7CDDD; border-radius: var(--radius-md); padding: 26px; text-align: center; background: #FBFCFE; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: 14px; }
.field select, .field input[type="text"], .field textarea, .field input[type="date"], .field input[type="number"] {
    border: 1px solid var(--grey-line); border-radius: var(--radius-sm); padding: 10px 12px; font: inherit; background: #fff;
}
.errors { background: #FEF2F2; border: 1px solid #FCA5A5; border-radius: var(--radius-md); padding: 14px 16px; margin-top: 14px; }
.errors li { margin-bottom: 4px; }
.messages { margin-top: 14px; display: grid; gap: 8px; }
.messages .msg { background: #fff; border-left: 4px solid var(--blue); border-radius: 10px; padding: 12px 16px; box-shadow: var(--shadow); }

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

/* точка на ленте времени для любых карточек */
.tl-items > * { position: relative; }
.tl-items > .diag::before {
    content: ""; position: absolute; left: -35px; top: 38px;
    width: 15px; height: 15px; border-radius: 50%; background: #fff; border: 3px solid #7C8CF8;
}
.filters-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 4px; }
.select { border: 1px solid var(--grey-line); border-radius: var(--radius-sm); padding: 10px 14px; background: #fff; font: inherit; }

/* ---------- Вкладки подразделов ---------- */
.subtabs { display: flex; gap: 26px; border-bottom: 1px solid var(--grey-line); margin: 4px 0 8px; overflow-x: auto; }
.subtab {
    padding: 12px 2px 14px; color: var(--muted); font-weight: 600; white-space: nowrap;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.subtab:hover { color: var(--text); text-decoration: none; }
.subtab.is-active { color: var(--blue); border-bottom-color: var(--blue); }
.subtab .count { color: var(--muted-2); margin-left: 6px; font-weight: 500; }

/* ---------- Полноэкранная форма ввода данных ---------- */
.form-page { max-width: 980px; margin: 0 auto; padding: 22px 16px 120px; }
.form-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.form-head h1 { font-size: 26px; }
.form-crumbs { color: var(--muted); font-size: 14px; margin-top: 6px; }
.form-crumbs .pill {
    background: var(--blue-soft); color: #3B4FCF; border-radius: 9px; padding: 5px 12px;
    font-weight: 600; font-size: 13px; margin-right: 8px; display: inline-block;
}
.form-tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--grey-line); margin-top: 18px; }
.form-tab {
    background: none; border: 0; padding: 14px 2px 16px; font-weight: 600; color: var(--muted);
    border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.form-tab.is-active { color: var(--blue); border-bottom-color: var(--blue); }
.tab-panel { display: none; padding-top: 22px; }
.tab-panel.is-active { display: block; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 22px; }
.field-grid .wide { grid-column: 1 / -1; }
@media (max-width: 720px) { .field-grid { grid-template-columns: 1fr; } }
.field .req { color: #E5484D; margin-left: 2px; }
.field .help { color: var(--muted); font-size: 13px; }
.field .error { color: #E5484D; font-size: 13px; }
.control {
    width: 100%; border: 1px solid #D8DCE7; border-radius: var(--radius-sm); padding: 12px 14px;
    font: inherit; background: #fff; color: var(--text);
}
.control:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(47, 98, 232, .12); }
select.control { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #7B8194 50%), linear-gradient(135deg, #7B8194 50%, transparent 50%); background-position: right 18px center, right 12px center; background-size: 6px 6px; background-repeat: no-repeat; }
textarea.control { resize: vertical; }
.form-footer {
    background: #fff; border-top: 1px solid var(--grey-line);
    padding: 16px 26px; display: flex; justify-content: flex-end; gap: 12px;
    margin: 26px -26px -26px; border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.upload-zone {
    border: 2px dashed #C7CDDD; border-radius: var(--radius-md); padding: 30px; text-align: center;
    background: #FBFCFE;
}
.file-list { display: grid; gap: 10px; margin-top: 16px; }
.file-row {
    display: flex; align-items: center; gap: 12px; border: 1px solid var(--grey-line);
    border-radius: var(--radius-sm); padding: 12px 14px;
}
.file-row .ext {
    width: 34px; height: 34px; border-radius: 9px; background: var(--blue-soft); color: #3B4FCF;
    display: grid; place-items: center; font-size: 11px; font-weight: 700;
}

/* ---------- Кабинет оператора ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 4px; }
.page-head h1 { font-size: 24px; }
.toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.toolbar .control { max-width: 340px; }
.operator-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; align-items: start; margin-top: 16px; }
@media (max-width: 980px) { .operator-grid { grid-template-columns: 1fr; } }
.cell-user { display: flex; align-items: center; gap: 12px; }
.cell-user .user-avatar { width: 34px; height: 34px; font-size: 12px; }
.btn-danger { background: #FEECEC; color: #C0292E; }
.btn-danger:hover { background: #FBDCDC; }

/* ---------- Шторка оформления (открывается иконкой «Палитра») ---------- */
.palette-drawer {
    position: fixed; top: 0; left: 0; bottom: 0; width: 360px; max-width: 92vw; z-index: 400;
    background: #fff; box-shadow: 6px 0 28px rgba(29, 33, 56, .12); padding: 24px;
    overflow-y: auto;
}
.palette-drawer[hidden] { display: none; }
.palette-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.palette-backdrop { position: fixed; inset: 0; background: rgba(29, 33, 56, .28); z-index: 399; }
.palette-backdrop[hidden] { display: none; }

/* ---------- Адаптация под планшет и телефон ---------- */
@media (max-width: 900px) {
    .shell { padding: 0 12px 32px; }
    .topbar-inner { width: calc(100% - 24px); gap: 12px; }
    .brand-sub { display: none; }
    .brand-title { font-size: 17px; }
    .topbar-nav { overflow-x: auto; scrollbar-width: none; margin-left: 0; }
    .topbar-nav::-webkit-scrollbar { display: none; }
    .user-btn { padding: 0 8px; }
    .user-btn .name, .user-btn .role { display: none; }

    .pf-head { padding: 14px 16px 0; border-radius: 0 0 18px 18px; }
    .pf-head-row { flex-wrap: wrap; row-gap: 12px; }
    .pf-title-block { flex: 1 1 auto; }
    .pf-name { font-size: 20px; }
    .pf-badge { width: 46px; height: 46px; border-radius: 15px; font-size: 16px; }
    .pf-actions { margin-left: auto; }
    .pf-actions .btn-ghost { padding: 10px 14px; }

    .card { padding: 18px 16px; border-radius: 18px; }
    .card-head { flex-wrap: wrap; row-gap: 12px; }
    .stats-row, .chart-wrap, .settings-grid, .operator-grid, .cabinet-grid { grid-template-columns: 1fr; }
    .stat-row { grid-template-columns: repeat(2, 1fr); }

    .tl::before { left: 33px; }
    .tl-group { grid-template-columns: 30px 1fr; gap: 0 20px; }
    .tl-year { font-size: 18px; height: 74px; }
    .entry { flex-direction: column; padding: 16px; gap: 14px; }
    .entry::before { left: -26px; top: 26px; width: 12px; height: 12px; border-width: 2px; }
    .entry-side { width: 100%; align-items: center; justify-content: flex-end; }
    .award { min-width: 0; flex: 1; }
    .form-tabs { font-size: 14px; }
    .form-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
    .form-crumbs .pill { margin-right: 0; }
    .entry-art { display: none; }

    .diag { padding: 18px 16px; }
    .diag-head { flex-direction: column; gap: 14px; }
    .diag-score { width: 100%; justify-content: space-between; text-align: left; }
    .rank-cards { grid-template-columns: 1fr; }
    .rank-card { border-right: 0; border-bottom: 1px solid var(--grey-line); }
    .rank-card:last-child { border-bottom: 0; }
    .axis { display: none; }

    .palette-drawer { width: 100%; max-width: none; padding: 20px 16px; }
    .form-page { padding: 18px 0 40px; }
    .form-head { flex-direction: column; gap: 12px; }
    .form-head h1 { font-size: 21px; }
    .form-tabs { gap: 18px; overflow-x: auto; }
    .form-footer { flex-direction: column-reverse; margin: 22px -16px -18px; padding: 14px 16px; }
    .form-footer .btn { width: 100%; justify-content: center; }

    .admin-shell { padding: 18px 12px 48px; }
    .page-head { flex-direction: column; gap: 12px; }
    .toolbar .control { max-width: none; width: 100%; }
    table.grid { display: block; overflow-x: auto; white-space: nowrap; }
}

@media (max-width: 620px) {
    .pf-tabs { gap: 4px; }
    .pf-tab { padding: 9px 12px; font-size: 14px; }
    .rr { grid-template-columns: 38px 1fr; grid-template-areas: "place bar" "result result"; row-gap: 8px; }
    .rr-place { grid-area: place; width: 34px; height: 34px; }
    .rr-bar { grid-area: bar; height: 34px; }
    .rr-avatar { width: 36px; height: 36px; top: -1px; }
    .rr-result { grid-area: result; }
    .rr-mark { display: none; }
    .stat-row, .metric-row { grid-template-columns: 1fr; }
    .section-grid, .palette { grid-template-columns: 1fr; }
    .bg-swatches { grid-template-columns: repeat(2, 1fr); }
    .chips { gap: 6px; }
    .chip { padding: 8px 12px; font-size: 13px; }
    .entry-title { font-size: 16px; }
}
