/* ═══════════════════════════════════════════════════════════════
   IT Institute · кабинет в дизайне «Деловая газета» (этап 3)
   Макеты: Claude Design, «Дизайн-система - кабинет», «Кабинет - шапка», «Кабинет - подвал».
   Цвета и шрифты — как на сайте (site/public/assets/paper/tokens.css); углы прямые,
   тень только у всплывающих слоёв (сплошная, сдвиг 6–8 px).
   ═══════════════════════════════════════════════════════════════ */

:root {
  --ink: #111111; --body: #333333; --muted: #5a5a5a; --hint: #767676;
  --rule: #d9d9d9; --tint: #f5f5f5; --tint-2: #ececec; --paper: #ffffff;
  --signal: #c0201b; --signal-dark: #9a1915; --signal-bg: #fbeceb;
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --sans: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --wrap: 1280px; --gutter: clamp(16px, 3vw, 40px);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--signal); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
input::placeholder, textarea::placeholder { color: var(--hint); }
button { font-family: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.c-wrap { max-width: var(--wrap); margin: 0 auto; padding-inline: var(--gutter); }
.c-main { flex: 1; width: 100%; }
/* пока страница ждёт данные, подвал уже ниже экрана — иначе его сдвиг при показе содержимого даёт CLS до 0,9 */
.c-main:has([data-wait-user][hidden]) { min-height: 100vh; }
.c-vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Шапка ── */
.ch { position: relative; z-index: 30; background: var(--paper); border-bottom: 1px solid var(--ink); }
.ch-bar { display: flex; align-items: stretch; gap: 36px; min-height: 64px; }
.ch-brand { display: flex; align-items: center; gap: 12px; flex: none; }
.ch-mark { font-family: var(--serif); font-size: 27px; font-weight: 700; letter-spacing: -.02em; line-height: 1; color: var(--ink); }
.ch-tag { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--signal); border-left: 1px solid var(--ink); padding-left: 12px; line-height: 20px; }
.ch-nav { display: flex; gap: 26px; font-size: 15px; font-weight: 600; }
.ch-nav a { display: flex; align-items: center; border-bottom: 3px solid transparent; padding-top: 3px; }
.ch-nav a[aria-current="page"] { border-bottom-color: var(--signal); color: var(--signal); }
.ch-gap { flex: 1; }
.ch-right { display: flex; align-items: center; gap: 22px; font-size: 14px; font-weight: 600; flex: none; }
.ch-site { display: flex; align-items: center; gap: 6px; color: var(--body); }
.ch-login { display: inline-flex; align-items: center; min-height: 40px; padding: 0 18px; background: var(--ink); color: var(--paper) !important; }
.ch-login:hover { background: var(--signal); }
.ch-skel { width: 34px; height: 34px; background: var(--tint-2); }
.ch-user { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0; border: 0; background: none; font-size: 14px; font-weight: 600; color: var(--ink); cursor: pointer; }
.ch-ava { width: 34px; height: 34px; flex: none; display: flex; align-items: center; justify-content: center; background: var(--ink); color: var(--paper); font-family: var(--serif); font-size: 17px; font-weight: 700; }
.ch-ava--lg { width: 44px; height: 44px; font-size: 22px; }
.ch-caret { font-size: 11px; }
.ch-menu { position: absolute; right: calc(max(0px, (100% - var(--wrap)) / 2) + var(--gutter)); top: calc(100% + 6px); width: 300px; background: var(--paper); border: 1px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); display: flex; flex-direction: column; }
.ch-menu-who { display: flex; gap: 12px; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--rule); }
.ch-menu-who > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ch-menu-name { font-size: 15px; font-weight: 600; }
.ch-menu-mail { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.ch-menu-list { display: flex; flex-direction: column; padding: 6px 0; font-size: 15px; }
.ch-menu-list a { min-height: 44px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; }
.ch-menu-list a:hover { background: var(--tint); }
.ch-plan-hint { font-family: var(--mono); font-size: 12px; color: var(--signal); }
.ch-menu-owner { border-top: 1px solid var(--rule); background: var(--tint); }
.ch-menu-owner a:hover { background: var(--tint-2); }
.ch-menu-head { padding: 8px 18px 4px; font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.ch-menu-out { min-height: 48px; display: flex; align-items: center; padding: 0 18px; border: 0; border-top: 1px solid var(--rule); background: none; font-size: 15px; font-weight: 600; color: var(--ink); text-align: left; cursor: pointer; }
.ch-menu-out:hover { background: var(--tint); color: var(--signal); }
.ch-mbtn { display: none; }
.ch-phone-menu { display: none; }

@media (max-width: 899px) {
  .ch-bar { gap: 12px; min-height: 60px; align-items: center; justify-content: space-between; }
  .ch-mark { font-size: 23px; }
  .ch-tag { font-size: 11px; padding-left: 10px; line-height: 18px; }
  .ch-brand { gap: 10px; }
  .ch-nav, .ch-gap, .ch-site, .ch-user, .ch-menu { display: none !important; }
  .ch-right { gap: 12px; }
  .ch-login { min-height: 44px; padding: 0 16px; font-size: 15px; }
  .ch-mbtn { display: flex; align-items: center; gap: 8px; min-height: 44px; min-width: 44px; padding: 0; border: 0; background: none; font-size: 15px; font-weight: 600; color: var(--ink); cursor: pointer; }
  .ch-mbtn .ch-ava { width: 36px; height: 36px; font-size: 18px; }
  .ch-skel { width: 36px; height: 36px; margin: 4px 0; }
  .ch-phone-menu:not([hidden]) { display: block; position: absolute; top: 100%; left: 0; right: 0; height: calc(100vh - 61px); overflow-y: auto; background: var(--paper); border-top: 1px solid var(--ink); }
  .ch-pm { display: flex; flex-direction: column; padding: 4px 16px 28px; }
  .ch-pm-who { display: flex; gap: 12px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--ink); }
  .ch-pm-who > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .ch-pm-who .ch-menu-name { font-size: 16px; }
  .ch-pm-who .ch-menu-mail { font-size: 14px; }
  .ch-pm-head { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 22px 0 4px; }
  .ch-pm-head--red { color: var(--signal); padding-top: 18px; }
  .ch-pm-sec { min-height: 52px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--rule); font-family: var(--serif); font-size: 21px; font-weight: 600; }
  .ch-pm-sec[aria-current="page"] { color: var(--signal); }
  .ch-pm-hint { font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--muted); }
  .ch-pm-link { min-height: 48px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--rule); font-size: 16px; }
  .ch-pm-out { min-height: 48px; display: flex; align-items: center; border: 0; border-bottom: 1px solid var(--rule); background: none; padding: 0; font-size: 16px; font-weight: 600; color: var(--ink); text-align: left; cursor: pointer; }
  .ch-pm-site { margin-top: 24px; min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--ink); font-size: 15px; font-weight: 600; }
  body.c-menu-open { overflow: hidden; }
}

/* ── Подвал ── */
.cf { border-top: 1px solid var(--ink); font-size: 14px; color: var(--body); background: var(--paper); }
.cf-in { padding-top: 18px; padding-bottom: 28px; display: flex; flex-wrap: wrap; gap: 10px 28px; align-items: center; }
.cf-copy { color: var(--muted); }
.cf-gap { flex: 1; }
.cf-nav { display: flex; flex-wrap: wrap; gap: 4px 24px; font-weight: 500; }
.cf-nav a { min-height: 44px; display: flex; align-items: center; color: var(--ink); }

/* ── Кнопки ── */
.c-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border: 0; border-radius: 0; background: var(--signal); color: var(--paper) !important; font-family: inherit; font-size: 15px; font-weight: 600; text-align: center; cursor: pointer; }
.c-btn:hover { background: var(--signal-dark); }
.c-btn--ink { background: var(--ink); }
.c-btn--ink:hover { background: var(--signal); }
.c-btn--line { background: var(--paper); color: var(--ink) !important; border: 1px solid var(--ink); }
.c-btn--line:hover { background: var(--ink); color: var(--paper) !important; }
.c-btn--sm { min-height: 44px; padding: 0 16px; font-size: 14px; }
.c-btn--wide { width: 100%; }
.c-btn:disabled, .c-btn[aria-disabled="true"] { background: #e6e6e6; color: var(--muted) !important; cursor: default; }
.c-btn--wait, .c-btn--wait:disabled { border: 1px dashed var(--hint); background: var(--tint); color: var(--muted) !important; cursor: default; }
.c-btn--soon, .c-btn--soon:disabled { border: 1px dashed var(--hint); background: var(--paper); color: var(--muted) !important; cursor: default; }
.c-btn--pro { min-height: 44px; padding: 0 16px; background: var(--paper); border: 1px solid var(--signal); color: var(--signal) !important; font-size: 14px; }
.c-btn--pro:hover { background: var(--signal); color: var(--paper) !important; }
.c-link { display: inline-block; border-bottom: 2px solid var(--ink); padding: 3px 0; font-weight: 600; }
.c-link:hover { border-bottom-color: var(--signal); }
.c-soon { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border: 1px solid var(--hint); color: var(--muted); font-weight: 400; }
.c-ya { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 52px; padding: 0 28px; border: 0; background: var(--ink); color: var(--paper) !important; font-size: 16px; font-weight: 600; cursor: pointer; }
.c-ya:hover { background: var(--signal); }
.c-ya-i { width: 24px; height: 24px; border-radius: 50%; background: #fc3f1d; color: #fff; display: flex; align-items: center; justify-content: center; font-family: Arial, sans-serif; font-size: 15px; font-weight: 700; }

/* ── Поля ── */
.c-field { display: flex; flex-direction: column; gap: 6px; }
.c-label { font-size: 14px; font-weight: 600; color: var(--ink); }
.c-input { width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--hint); border-radius: 0; background: var(--paper); color: var(--ink); font-family: inherit; font-size: 16px; }
.c-input:focus { border-color: var(--ink); }
.c-input[aria-invalid="true"] { border: 2px solid var(--signal); }
.c-input:disabled { border-color: var(--rule); background: var(--tint); color: var(--muted); }
.c-input--mono { font-family: var(--mono); }
textarea.c-input { padding: 12px 14px; min-height: 120px; resize: vertical; line-height: 1.5; }
select.c-input { -webkit-appearance: none; appearance: none; padding-right: 40px; cursor: pointer;
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23111' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 14px center; }
.c-hint { font-size: 13px; color: var(--muted); }
.c-err { font-size: 14px; color: var(--signal-dark); }
.c-pw { display: flex; border: 1px solid var(--hint); background: var(--paper); }
.c-pw:focus-within { border-color: var(--ink); }
.c-pw[data-invalid="true"] { border: 2px solid var(--signal); }
.c-pw .c-input { border: 0; min-height: 46px; flex: 1; min-width: 0; }
.c-pw-btn { min-width: 96px; border: 0; border-left: 1px solid var(--rule); background: none; font-size: 14px; font-weight: 600; color: var(--ink); cursor: pointer; }
.c-check { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 12px; font-size: 14px; line-height: 1.5; color: var(--body); }
.c-check input { width: 22px; height: 22px; margin: 0; accent-color: var(--signal); }
.c-check a { text-decoration: underline; text-underline-offset: 3px; }
.c-radio { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 0 14px; border: 1px solid var(--rule); font-size: 16px; cursor: pointer; }
.c-radio:has(input:checked) { border: 2px solid var(--ink); font-weight: 600; }
.c-radio input { width: 20px; height: 20px; margin: 0; accent-color: var(--signal); }
.c-switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.c-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.c-switch-ui { flex: none; width: 52px; height: 30px; border: 2px solid var(--ink); background: var(--paper); display: flex; align-items: center; padding: 0 3px; }
.c-switch-ui::after { content: ''; width: 20px; height: 20px; background: var(--ink); }
.c-switch input:checked + .c-switch-ui { background: var(--ink); justify-content: flex-end; }
.c-switch input:checked + .c-switch-ui::after { background: var(--paper); }
.c-switch input:focus-visible + .c-switch-ui { outline: 2px solid var(--signal); outline-offset: 2px; }

/* Ошибка у формы */
.c-alert { border: 1px solid var(--signal); background: var(--signal-bg); padding: 12px 14px; font-size: 15px; line-height: 1.45; display: flex; gap: 10px; }
.c-alert::before { content: '!'; flex: none; width: 20px; height: 20px; background: var(--signal); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }
.c-alert--ok { border-color: var(--ink); background: var(--tint); }
.c-failed { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; padding-top: 32px; padding-bottom: 32px; max-width: 680px; }
.c-alert--ok::before { content: '✓'; background: var(--ink); }

/* ── Бейджи ── */
.c-badge { display: inline-flex; align-items: center; padding: 2px 8px; font-size: 12px; font-weight: 600; border: 1px solid var(--ink); background: var(--paper); color: var(--ink); }
.c-badge--pub { background: var(--ink); color: var(--paper); }
.c-badge--req { color: var(--signal-dark); border: 1px dashed var(--signal); }
.c-badge--work { background: var(--tint); border-color: var(--rule); }
.c-lock { display: inline-flex; align-items: center; gap: 5px; padding: 1px 7px; border: 1px solid var(--ink); font-family: var(--mono); font-size: 11px; }
.c-lock::before { content: ''; width: 7px; height: 7px; border: 1.5px solid var(--ink); }
.c-tier { display: inline-flex; align-items: center; padding: 1px 7px; font-family: var(--mono); font-size: 12px; border: 1px solid var(--ink); }
.c-tier--pro { background: var(--ink); color: var(--paper); }

/* ── Сообщения ── */
#toast-container { position: fixed; top: 76px; right: var(--gutter); z-index: 60; display: flex; flex-direction: column; gap: 12px; width: min(400px, calc(100vw - 24px)); }
.c-toast { display: flex; gap: 12px; align-items: center; background: var(--ink); color: var(--paper); box-shadow: 6px 6px 0 var(--signal); padding: 12px 10px 12px 16px; font-size: 15px; }
.c-toast::before { content: '✓'; flex: none; width: 22px; height: 22px; background: var(--paper); color: var(--ink); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }
.c-toast--error { align-items: flex-start; background: var(--paper); color: var(--ink); border: 2px solid var(--signal); box-shadow: 6px 6px 0 var(--ink); padding: 14px 12px 14px 16px; }
.c-toast--error::before { content: '!'; background: var(--signal); color: #fff; font-size: 14px; }
.c-toast-text { flex: 1; line-height: 1.45; }
.c-toast-kind { display: block; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--signal-dark); }
.c-toast-x { width: 36px; min-height: 36px; border: 0; background: none; color: inherit; font-size: 22px; line-height: 1; cursor: pointer; }
@media (max-width: 599px) { #toast-container { top: 72px; left: 12px; right: 12px; width: auto; } }

/* ── Окно ── */
.c-modal { position: fixed; inset: 0; z-index: 70; background: rgba(17, 17, 17, .6); display: flex; align-items: center; justify-content: center; padding: 24px; }
.c-modal[hidden] { display: none; }
.c-dialog { width: min(520px, 100%); max-height: calc(100vh - 48px); overflow-y: auto; background: var(--paper); border-top: 4px solid var(--ink); box-shadow: 8px 8px 0 var(--ink); padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.c-dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.c-dialog-title { margin: 0; font-family: var(--serif); font-size: 24px; font-weight: 700; line-height: 1.15; }
.c-dialog-x { flex: none; width: 44px; height: 44px; margin: -10px -10px 0 0; border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--ink); }
.c-dialog-text { margin: 0; font-size: 15px; line-height: 1.5; color: var(--body); }
.c-dialog-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 599px) {
  .c-modal { align-items: flex-end; padding: 0; }
  .c-dialog { width: 100%; max-height: 92vh; box-shadow: none; }
  .c-dialog-actions .c-btn { flex: 1; }
}

/* ── Загрузка ── */
.c-loading { border: 1px solid var(--rule); }
.c-loading-bar { height: 3px; background: var(--tint); overflow: hidden; }
.c-loading-bar::after { content: ''; display: block; width: 38%; height: 3px; background: var(--signal); animation: c-load 1.2s ease-in-out infinite; }
@keyframes c-load { from { transform: translateX(-100%); } to { transform: translateX(270%); } }
@media (prefers-reduced-motion: reduce) { .c-loading-bar::after { animation: none; } }
.c-loading-in { padding: 6px 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.c-loading-label { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.c-skel { display: block; height: 14px; background: var(--tint); }
.c-skel--title { height: 32px; width: 60%; background: var(--tint-2); }

/* ── Cookie ── */
.c-cookie { position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; background: var(--ink); color: var(--paper); }
.c-cookie-in { padding-top: 16px; padding-bottom: 16px; display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; }
.c-cookie p { margin: 0; flex: 1 1 240px; font-size: 15px; line-height: 1.5; }
.c-cookie a { text-decoration: underline; text-underline-offset: 3px; }
.c-cookie a:hover { color: var(--paper); }
.c-cookie button { min-height: 44px; padding: 0 24px; border: 0; background: var(--paper); color: var(--ink); font-size: 15px; font-weight: 600; cursor: pointer; }

/* ── Заголовки страниц кабинета ── */
.c-page { padding-top: 32px; padding-bottom: 64px; }
.c-kicker { font-family: var(--sans); font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--signal); }
.c-h1 { margin: 0; font-family: var(--serif); font-size: clamp(34px, 4.2vw, 52px); line-height: 1.05; font-weight: 700; letter-spacing: -.025em; }
.c-h2 { margin: 0; font-family: var(--serif); font-size: 28px; font-weight: 700; line-height: 1.15; letter-spacing: -.01em; }
.c-lead { margin: 0; font-family: var(--serif); font-size: 19px; line-height: 1.5; color: var(--body); }
.c-textbtn { min-height: 44px; border: 0; background: none; padding: 0; font-size: 14px; font-weight: 600; color: var(--ink); border-bottom: 2px solid var(--ink); cursor: pointer; }
.c-textbtn:hover { color: var(--signal); border-bottom-color: var(--signal); }
