/* Шрифты локальные (CSP default-src 'self', без внешних CDN). */
@font-face {
  font-family: "Adwaita Sans";
  src: url("/static/AdwaitaSans.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/static/JetBrainsMono.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* Токены дизайн-системы: спокойный светлый холст и чистая монохромная лестница oklch в тёмной теме.
   Цвет используется только для семантических статусов (--ok, --warn, --err).
   Тёмная тема объявлена дважды: внутри prefers-color-scheme (работает даже до/без JS)
   и на явном селекторе [data-theme=dark] (ручной выбор поверх светлой ОС). */
:root {
  color-scheme: light dark;
  --bg: oklch(.97 .004 155);
  --bg-soft: oklch(.985 .003 155);
  --card: oklch(1 0 0);
  --card-2: oklch(.964 .004 155);
  --line: oklch(.912 .005 155);
  --line-soft: oklch(.942 .004 155);
  --text: oklch(.21 .008 155);
  --muted: oklch(.43 .008 155);
  --dim: oklch(.47 .008 155);
  --accent: oklch(.265 .042 160);
  --accent-2: oklch(.33 .045 160);
  --on-accent: oklch(.99 0 0);
  --link: oklch(.34 .038 160);
  --ok: oklch(.45 .125 152);
  --warn: oklch(.48 .135 62);
  --err: oklch(.48 .18 25);
  --r: 16px;
  --r-sm: 12px;
  --shadow: 0 1px 2px oklch(0 0 0 / .035), 0 4px 16px oklch(0 0 0 / .04);
  --sans: "Adwaita Sans", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Cantarell, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar-w: 256px;
  --topbar-h: 60px;
  --maxw: 1180px;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

@media (prefers-color-scheme: dark) {
  [data-theme=dark], :root:not([data-theme=light]) {
    --bg: oklch(.17 0 0);
    --bg-soft: oklch(.205 0 0);
    --card: oklch(.22 0 0);
    --card-2: oklch(.26 0 0);
    --line: oklch(.29 0 0);
    --line-soft: oklch(.25 0 0);
    --text: oklch(.94 0 0);
    --muted: oklch(.75 0 0);
    --dim: oklch(.70 0 0);
    --accent: oklch(.95 0 0);
    --accent-2: oklch(.85 0 0);
    --on-accent: oklch(.18 0 0);
    --link: oklch(.82 0 0);
    --ok: oklch(.78 .15 150);
    --warn: oklch(.80 .13 70);
    --err: oklch(.72 .16 25);
    --shadow: 0 1px 2px oklch(0 0 0 / .30), 0 4px 16px oklch(0 0 0 / .22);
  }
}

[data-theme=dark] {
  --bg: oklch(.17 0 0);
  --bg-soft: oklch(.205 0 0);
  --card: oklch(.22 0 0);
  --card-2: oklch(.26 0 0);
  --line: oklch(.29 0 0);
  --line-soft: oklch(.25 0 0);
  --text: oklch(.94 0 0);
  --muted: oklch(.75 0 0);
  --dim: oklch(.70 0 0);
  --accent: oklch(.95 0 0);
  --accent-2: oklch(.85 0 0);
  --on-accent: oklch(.18 0 0);
  --link: oklch(.82 0 0);
  --ok: oklch(.78 .15 150);
  --warn: oklch(.80 .13 70);
  --err: oklch(.72 .16 25);
  --shadow: 0 1px 2px oklch(0 0 0 / .30), 0 4px 16px oklch(0 0 0 / .22);
}

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

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

a {
  color: inherit;
  text-decoration: none;
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -.022em;
  line-height: 1.18;
  color: var(--text);
}

p, dl, dd, ol, ul {
  margin: 0;
}

img, svg {
  display: block;
  max-width: 100%;
}

.ui-icon {
  flex: none;
}

.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.015em;
}

.muted-unit {
  color: var(--dim);
  font-weight: 400;
}

.warn-text {
  color: var(--warn);
}

.sep {
  color: var(--dim);
  margin-inline: 5px;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 500;
}

.skip-link:focus {
  top: 12px;
}

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

/* ── Марка ────────────────────────────────────────────────── */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  font-size: 18px;
  letter-spacing: -.035em;
  color: var(--text);
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--accent);
  color: var(--on-accent);
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 2.5px;
  padding: 6px;
  flex: none;
}

.brand-mark i {
  display: block;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
}

.brand-mark i:nth-child(1) { width: 100%; }
.brand-mark i:nth-child(2) { width: 72%; }
.brand-mark i:nth-child(3) { width: 88%; opacity: .65; }

/* ── Кнопки и иконки ──────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .12s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(.985);
}

.btn.compact {
  height: 36px;
  padding: 0 13px;
  font-size: 13.5px;
  border-radius: 10px;
}

.btn.btn-full {
  width: 100%;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover {
  background: var(--accent-2);
}

.btn-ghost {
  background: var(--card);
  border-color: var(--line);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--dim);
  background: var(--bg-soft);
}

.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s var(--ease), background .15s var(--ease), border-color .15s var(--ease), transform .12s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.icon-btn.bordered {
  border-color: var(--line);
  background: var(--card);
}

.icon-btn:hover {
  color: var(--text);
  background: var(--card-2);
  border-color: var(--line);
}

.icon-btn:active {
  transform: scale(.94);
}

.rays {
  transform-origin: 12px 12px;
  transition: transform .45s var(--ease);
}

.icon-btn:hover .rays {
  transform: rotate(45deg);
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  transition: color .15s var(--ease);
}

.text-link:hover {
  color: var(--text);
}

.back-link {
  margin-bottom: 14px;
}

/* ── Статусные метки и индикаторы (тонкая линия, без заливки) ─ */
.state {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  white-space: nowrap;
  flex: none;
}

.state.ok {
  color: var(--ok);
  border-color: color-mix(in oklch, var(--ok) 40%, var(--line));
}

.state.warn {
  color: var(--warn);
  border-color: color-mix(in oklch, var(--warn) 44%, var(--line));
}

.state.err {
  color: var(--err);
  border-color: color-mix(in oklch, var(--err) 45%, var(--line));
}

.nav-count.warn-count {
  color: var(--warn);
  border-color: color-mix(in oklch, var(--warn) 42%, var(--line));
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  display: inline-block;
  flex: none;
}

.dot.muted-dot {
  background: var(--dim);
}

.dot.warn-dot {
  background: var(--warn);
}

.dot-ind {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  border: 1.5px solid var(--bg);
}

/* ── Сегментированный переключатель (.seg) ────────────────── */
.seg {
  position: relative;
  display: inline-grid;
  align-items: center;
  padding: 3px;
  background: var(--card-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
}

.seg[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.seg[data-count="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.seg[data-count="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.seg-thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  border-radius: 9px;
  background: var(--card);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow);
  transition: transform .36s var(--ease);
  pointer-events: none;
}

.seg[data-count="2"] .seg-thumb { width: calc((100% - 6px) / 2); }
.seg[data-count="3"] .seg-thumb { width: calc((100% - 6px) / 3); }
.seg[data-count="4"] .seg-thumb { width: calc((100% - 6px) / 4); }

.seg[data-index="0"] .seg-thumb { transform: translateX(0%); }
.seg[data-index="1"] .seg-thumb { transform: translateX(100%); }
.seg[data-index="2"] .seg-thumb { transform: translateX(200%); }
.seg[data-index="3"] .seg-thumb { transform: translateX(300%); }

.seg-item {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: none;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  padding: 6px 13px;
  border-radius: 9px;
  text-align: center;
  white-space: nowrap;
  transition: color .18s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.seg-item:hover {
  color: var(--text);
}

.seg-item.is-active {
  color: var(--text);
}

/* ── Поля ввода и исправление автозаполнения ──────────────── */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-group label {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
}

.field-group label small {
  font-weight: 400;
  color: var(--dim);
  margin-left: 4px;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="search"],
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 14.5px;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}

input[type="email"],
input[type="password"],
input[type="text"],
select {
  height: 42px;
  padding: 0 14px;
}

textarea {
  padding: 11px 14px;
  line-height: 1.5;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--dim);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--dim);
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: inset 0 0 0 1000px var(--card);
  box-shadow: inset 0 0 0 1000px var(--card);
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  transition: background-color 100000s ease-in-out 0s;
}

input:autofill {
  box-shadow: inset 0 0 0 1000px var(--card);
  -webkit-text-fill-color: var(--text);
}

.form-error {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  border: 1px solid color-mix(in oklch, var(--err) 42%, var(--line));
  background: color-mix(in oklch, var(--err) 7%, var(--card));
  color: var(--err);
  font-size: 13.5px;
}

.flash {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 20px;
  padding: 11px 15px;
  border-radius: var(--r-sm);
  border: 1px solid color-mix(in oklch, var(--ok) 38%, var(--line));
  background: var(--card);
  color: var(--text);
  font-size: 14px;
}

.flash .ui-icon {
  color: var(--ok);
}

/* ── Поверхности и списки (Adwaita boxed-list + Revolut) ───── */
.surface {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
}

.boxed-list {
  overflow: hidden;
}

.box-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  min-width: 0;
  transition: background .15s var(--ease);
}

.box-row + .box-row,
.lesson + .lesson,
.timeline-gap + .lesson,
.result-row + .result-row,
.staff-item + .staff-item {
  border-top: 1px solid var(--line-soft);
}

a.box-row:hover {
  background: var(--bg-soft);
}

.row-glyph {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--dim);
  flex: none;
  transition: color .15s var(--ease);
}

a.box-row:hover .row-glyph,
.catalog-card:hover .row-glyph,
.cmd-item:hover .row-glyph {
  color: var(--text);
}

.row-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.row-copy strong {
  font-size: 14.5px;
  font-weight: 560;
  color: var(--text);
  overflow-wrap: anywhere;
}

.row-copy small {
  font-size: 13px;
  color: var(--muted);
}

.row-arrow {
  color: var(--dim);
  flex: none;
  transition: transform .18s var(--ease), color .15s var(--ease);
}

a.box-row:hover .row-arrow {
  color: var(--text);
  transform: translateX(2px);
}

.empty {
  padding: 28px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* ── Каркас приложения (Sidebar + Topbar + Main) ──────────── */
body.signed-in {
  padding-left: var(--sidebar-w);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--bg-soft);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 30;
}

.sidebar-top {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid var(--line-soft);
}

.side-nav {
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  transition: background .15s var(--ease), color .15s var(--ease);
}

.nav-link:hover {
  color: var(--text);
  background: var(--card-2);
}

.nav-link.selected {
  color: var(--text);
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--line);
}

.nav-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-count {
  font-size: 12px;
  color: var(--text);
  padding: 1px 7px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}

.sidebar-bottom {
  padding: 12px;
  border-top: 1px solid var(--line-soft);
}

.sidebar-concept {
  margin-top: 8px;
  padding: 0 8px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--dim);
}

.account-dock {
  display: flex;
  align-items: center;
  gap: 6px;
}

.account {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 10px;
  min-width: 0;
  flex: 1;
  transition: background .15s var(--ease);
}

.account:hover,
.account.selected {
  background: var(--card-2);
}

.account .row-copy strong {
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account .row-copy small {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  display: grid;
  place-items: center;
  flex: none;
}

.avatar.big {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  font-size: 17px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar-h);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: color-mix(in oklch, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.3) blur(8px);
  border-bottom: 1px solid var(--line-soft);
}

.mobile-brand,
.mobile-search-btn,
.top-avatar,
.bottom-nav {
  display: none;
}

.cmd-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(400px, 100%);
  height: 36px;
  padding: 0 11px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color .15s var(--ease), color .15s var(--ease);
}

.cmd-trigger:hover {
  border-color: var(--dim);
  color: var(--text);
}

.cmd-trigger-text {
  flex: 1;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cmd-kbd {
  font-size: 11.5px;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--dim);
}

.topbar-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.app-main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px 32px 48px;
}

.app-footer {
  margin-top: 48px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 12.5px;
  color: var(--dim);
}

/* ── Заголовки страниц и секций ───────────────────────────── */
.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.page-heading-copy {
  min-width: 0;
}

.page-heading h1 {
  font-size: clamp(24px, 2.6vw, 30px);
}

.page-subtitle {
  margin-top: 5px;
  color: var(--muted);
  font-size: 14.5px;
  max-width: 66ch;
}

.page-heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-heading h2 {
  font-size: 17px;
}

.section-heading p {
  margin-top: 2px;
  font-size: 13px;
  color: var(--muted);
}

.heading-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.content-stack {
  display: flex;
  flex-direction: column;
  gap: 28px;
  margin-top: 28px;
}

/* ── Экран входа (/login) ─────────────────────────────────── */
.public-main {
  min-height: 100dvh;
}

.login-stage {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(380px, 480px) minmax(0, 1fr);
  background: var(--bg);
}

.login-column {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 28px 40px;
  gap: 28px;
}

.login-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.login-form-wrap {
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.login-intro h1 {
  font-size: 28px;
}

.login-intro .lede {
  margin-top: 8px;
  font-size: 14.5px;
  color: var(--muted);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.password-input {
  position: relative;
}

.password-input input {
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  top: 2px;
  right: 2px;
}

.demo-switcher {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.demo-switcher-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}

.demo-switcher-head small {
  color: var(--dim);
  font-size: 12px;
}

.demo-cards {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
}

.demo-account-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 15px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .15s var(--ease);
}

.demo-account-btn + .demo-account-btn {
  border-top: 1px solid var(--line-soft);
}

.demo-account-btn:hover {
  background: var(--bg-soft);
}

.demo-account-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.demo-account-copy strong {
  font-size: 13.5px;
  font-weight: 560;
}

.demo-account-copy small {
  font-size: 12px;
  color: var(--muted);
}

.demo-code {
  font-size: 12px;
  color: var(--muted);
  padding: 2px 8px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  flex: none;
}

.login-footer {
  font-size: 12px;
  color: var(--dim);
  line-height: 1.45;
  max-width: 42ch;
}

.login-visual {
  padding: 16px 16px 16px 0;
  min-height: 0;
}

.login-photo-frame {
  width: 100%;
  height: 100%;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--card-2);
}

.login-photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

@media (prefers-color-scheme: dark) {
  [data-theme=dark] .login-photo-frame img,
  :root:not([data-theme=light]) .login-photo-frame img {
    filter: brightness(.86) contrast(1.03);
  }
}

[data-theme=dark] .login-photo-frame img {
  filter: brightness(.86) contrast(1.03);
}

/* ── Главная страница: фокус-пара и сетка дашборда ────────── */
.focus-card {
  margin-bottom: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  color: var(--muted);
}

.status-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}

.head-meta {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}

.focus-body {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr) auto;
  gap: 22px;
  padding: 22px;
  align-items: center;
}

.focus-time {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-right: 18px;
  border-right: 1px solid var(--line-soft);
}

.focus-time time {
  font-size: 26px;
  font-weight: 600;
  line-height: 1.05;
  color: var(--text);
}

.focus-time span {
  font-size: 12.5px;
  color: var(--dim);
}

.focus-main {
  min-width: 0;
}

.focus-main h2 {
  font-size: clamp(19px, 2vw, 22px);
}

.focus-meta,
.lesson-meta {
  margin-top: 5px;
  font-size: 13.5px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  row-gap: 2px;
}

.focus-hint,
.lesson-hint {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--dim);
}

.focus-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.focus-room {
  font-size: 18px;
  font-weight: 600;
}

.room-diff {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.room-diff del {
  color: var(--dim);
  font-weight: 400;
}

.room-diff.large {
  font-size: 17px;
  margin-top: 2px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.dashboard-side-stack {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

.summary-strip-card {
  padding: 18px;
}

.summary-strip-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.summary-strip-head h2 {
  font-size: 16px;
}

.summary-strip-head p {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
}

.summary-kv-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

.summary-kv-row small {
  display: block;
  font-size: 12px;
  color: var(--dim);
  margin-bottom: 3px;
}

.summary-kv-row strong {
  font-size: 16px;
  font-weight: 600;
}

/* ── Строка пары и окно между занятиями ───────────────────── */
.lesson {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) auto;
  gap: 16px;
  padding: 16px 18px;
  align-items: start;
}

.lesson-time {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 1px;
}

.lesson-time b {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.lesson-time span {
  font-size: 12px;
  color: var(--dim);
}

.lesson-main {
  min-width: 0;
}

.lesson-main h3 {
  font-size: 15.5px;
  font-weight: 580;
}

.lesson-room {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  text-align: right;
}

.room-code {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
}

.timeline-gap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-top: 1px solid var(--line-soft);
  background: var(--bg-soft);
  font-size: 12.5px;
  color: var(--muted);
}

.gap-label {
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 11.5px;
  white-space: nowrap;
}

/* ── Расписание: панель управления и матрица недели ───────── */
.schedule-controls {
  padding: 16px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.schedule-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.week-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.week-range-label {
  font-size: 13.5px;
  font-weight: 560;
  padding: 0 6px;
}

.week-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.day-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 9px 4px;
  border-radius: 11px;
  border: 1px solid var(--line-soft);
  background: var(--bg-soft);
  transition: border-color .15s var(--ease), background .15s var(--ease);
}

.day-cell:hover {
  border-color: var(--dim);
}

.day-cell.is-today {
  border-color: var(--line);
  background: var(--card);
}

.day-cell.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.day-short {
  font-size: 11.5px;
  color: var(--muted);
}

.day-cell.selected .day-short {
  color: color-mix(in oklch, var(--on-accent) 78%, transparent);
}

.day-num {
  font-size: 15px;
  font-weight: 600;
}

.day-indicator {
  height: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.day-indicator i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  display: block;
}

.ind-dot {
  background: var(--dim);
}

.ind-warn {
  background: var(--warn);
}

.day-cell.selected .ind-dot {
  background: var(--on-accent);
}

.week-matrix-wrap {
  margin-bottom: 24px;
  overflow: hidden;
}

.week-matrix {
  display: grid;
  grid-template-columns: 80px repeat(5, minmax(0, 1fr));
}

.matrix-corner,
.matrix-day-head {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
  min-width: 0;
}

.matrix-corner {
  font-size: 11.5px;
  color: var(--dim);
  display: flex;
  align-items: center;
}

.matrix-day-head {
  border-left: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: background .15s var(--ease);
}

.matrix-day-head:hover {
  background: var(--card-2);
}

.matrix-day-head span {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matrix-day-head strong {
  font-size: 13px;
}

.matrix-day-head.is-today strong {
  color: var(--ok);
}

.matrix-time-cell {
  padding: 10px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg-soft);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.slot-caption {
  font-size: 11px;
  color: var(--dim);
}

.matrix-time-cell b {
  font-size: 13.5px;
}

.matrix-time-cell small {
  font-size: 11.5px;
  color: var(--dim);
}

.matrix-cell {
  padding: 6px;
  border-left: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  min-width: 0;
  overflow: hidden;
  display: flex;
}

.matrix-card {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  background: var(--bg-soft);
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow: hidden;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}

.matrix-card:hover {
  border-color: var(--dim);
  background: var(--card);
}

.matrix-card.is-moved {
  border-color: color-mix(in oklch, var(--warn) 45%, var(--line));
}

.matrix-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 6px;
  font-size: 11px;
  min-width: 0;
}

.matrix-kind {
  color: var(--muted);
  min-width: 0;
}

.matrix-room {
  font-weight: 600;
  max-width: 100%;
  white-space: nowrap;
}

.matrix-card h3 {
  font-size: 12.8px;
  line-height: 1.28;
  overflow-wrap: break-word;
  hyphens: auto;
}

.matrix-teacher {
  font-size: 11.5px;
  color: var(--dim);
  margin-top: auto;
  overflow-wrap: break-word;
}

.matrix-empty {
  width: 100%;
  display: grid;
  place-items: center;
  color: var(--line);
  font-size: 13px;
}

.matrix-foot {
  padding: 11px 16px;
  font-size: 12.5px;
  color: var(--dim);
  background: var(--bg-soft);
}

.schedule-days {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@media (min-width: 1081px) {
  .week-mobile-stack {
    display: none;
  }
}

@media (max-width: 1080px) {
  .week-matrix-wrap {
    display: none;
  }
}

/* ── Успеваемость: сводная полоса и строки ведомости ───────── */
.metrics-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
}

.metrics-bar.metrics-bar-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-cell {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.metric-cell + .metric-cell {
  border-left: 1px solid var(--line-soft);
}

.metric-label {
  font-size: 12.5px;
  color: var(--muted);
}

.metric-value {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.1;
}

.metric-value small {
  font-size: 13.5px;
  font-weight: 400;
  color: var(--dim);
}

.metric-note {
  font-size: 12.5px;
  color: var(--dim);
  line-height: 1.35;
}

.result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px 148px;
  gap: 16px;
  padding: 16px 18px;
  align-items: center;
}

.result-row.session-row {
  grid-template-columns: 118px minmax(0, 1fr) auto;
}

.result-info {
  min-width: 0;
}

.result-info h3 {
  font-size: 15px;
  font-weight: 560;
}

.result-score {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.result-score strong {
  font-size: 15px;
}

.result-score small {
  font-size: 12px;
  color: var(--dim);
}

.result-final {
  display: flex;
  justify-content: flex-end;
}

.session-date {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.session-date b {
  font-size: 14px;
}

.session-date span {
  font-size: 12.5px;
  color: var(--dim);
}

/* ── Заявки, формы и таймлайн ─────────────────────────────── */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.catalog-card {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color .18s var(--ease);
}

.catalog-card:hover {
  border-color: var(--dim);
}

.catalog-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.catalog-card-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}

.catalog-card-body strong {
  font-size: 15.5px;
  font-weight: 600;
}

.catalog-card-body p {
  font-size: 13.5px;
  color: var(--muted);
}

.catalog-card-foot {
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  transition: color .15s var(--ease);
}

.catalog-card:hover .catalog-card-foot {
  color: var(--text);
}

.pagination {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.form-split {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, .85fr);
  gap: 22px;
  align-items: start;
}

.detail-panel {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.side-info-card {
  padding: 20px;
}

.side-card-title {
  font-size: 15px;
  margin-bottom: 14px;
}

.mini-dl {
  display: flex;
  flex-direction: column;
}

.mini-dl > div {
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mini-dl > div + div {
  border-top: 1px solid var(--line-soft);
}

.mini-dl dt {
  font-size: 12px;
  color: var(--dim);
}

.mini-dl dd {
  font-size: 13.5px;
  color: var(--text);
}

.delivery-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.delivery-fieldset legend {
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 8px;
}

.delivery-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radio-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 15px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-soft);
  cursor: pointer;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}

.radio-option:hover {
  border-color: var(--dim);
}

.radio-option:has(input:checked) {
  border-color: var(--text);
  background: var(--card);
}

.radio-option input {
  margin-top: 3px;
  accent-color: var(--accent);
}

.radio-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.radio-copy strong {
  font-size: 14px;
  font-weight: 560;
}

.radio-copy small {
  font-size: 12.5px;
  color: var(--muted);
}

.form-hint {
  font-size: 12.5px;
  color: var(--dim);
}

.form-actions,
.detail-actions,
.notice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.detail-head h2 {
  font-size: 18px;
}

.detail-sub {
  margin-top: 3px;
  font-size: 13px;
  color: var(--muted);
}

.live-timer-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-soft);
}

.live-timer-copy {
  display: flex;
  align-items: center;
  gap: 11px;
}

.live-timer-copy strong {
  display: block;
  font-size: 13.5px;
}

.live-timer-copy small {
  font-size: 12.5px;
  color: var(--muted);
}

.mono-timer {
  font-size: 16px;
  font-weight: 600;
}

.timeline {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.timeline li {
  position: relative;
  display: flex;
  gap: 13px;
  padding-bottom: 18px;
  color: var(--dim);
}

.timeline li:last-child {
  padding-bottom: 0;
}

.timeline li:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 10.5px;
  top: 22px;
  bottom: 0;
  width: 1px;
  background: var(--line);
}

.timeline-mark {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  display: grid;
  place-items: center;
  flex: none;
  position: relative;
  z-index: 1;
}

.timeline li.done {
  color: var(--text);
}

.timeline li.done .timeline-mark {
  border-color: color-mix(in oklch, var(--ok) 45%, var(--line));
  color: var(--ok);
}

.timeline li.current {
  color: var(--text);
}

.timeline li.current .timeline-mark {
  border-color: color-mix(in oklch, var(--warn) 48%, var(--line));
  color: var(--warn);
}

.timeline li strong {
  display: block;
  font-size: 14px;
  font-weight: 560;
}

.timeline li p {
  margin-top: 2px;
  font-size: 13px;
  color: var(--muted);
}

.request-comment {
  padding: 13px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-soft);
  background: var(--bg-soft);
}

.request-comment strong {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 4px;
}

.request-comment p {
  font-size: 14px;
}

.request-comment.staff-reply {
  border-color: color-mix(in oklch, var(--ok) 35%, var(--line));
}

.callout {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 15px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-soft);
  font-size: 13.5px;
  color: var(--text);
}

/* ── Бланк документа (/requests/<id>/document) ────────────── */
.doc-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.doc-toolbar .back-link {
  margin-bottom: 0;
}

.document-sheet {
  padding: 36px 40px;
  max-width: 840px;
}

.doc-letterhead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.doc-org {
  display: flex;
  align-items: center;
  gap: 12px;
}

.doc-org strong {
  display: block;
  font-size: 15.5px;
}

.doc-org span {
  font-size: 12.5px;
  color: var(--muted);
}

.doc-meta-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  text-align: right;
  font-size: 12.5px;
  color: var(--muted);
}

.doc-meta-box b {
  font-size: 13.5px;
  color: var(--text);
}

.doc-body {
  padding: 26px 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.doc-body h1 {
  font-size: 24px;
}

.doc-statement {
  font-size: 15px;
  line-height: 1.65;
}

.doc-kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-soft);
  background: var(--bg-soft);
}

.doc-kv-grid dt {
  font-size: 12px;
  color: var(--dim);
}

.doc-kv-grid dd {
  margin-top: 2px;
  font-size: 14px;
  font-weight: 500;
}

.doc-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.doc-table th,
.doc-table td {
  padding: 10px 13px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
}

.doc-table th {
  font-weight: 560;
  color: var(--muted);
  background: var(--bg-soft);
}

.doc-table tr:last-child td {
  border-bottom: 0;
}

.doc-verification {
  padding-top: 22px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.stamp-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.stamp-badge strong {
  display: block;
  font-size: 13.5px;
}

.stamp-badge small {
  font-size: 12px;
  color: var(--muted);
}

.doc-disclaimer {
  font-size: 12px;
  color: var(--dim);
  max-width: 58ch;
}

.qr-svg {
  border-radius: 8px;
  border: 1px solid var(--line);
  flex: none;
}

/* ── Уведомления ──────────────────────────────────────────── */
.notice-row {
  align-items: flex-start;
  padding: 16px 18px;
}

.notice-row .row-glyph {
  margin-top: 2px;
}

.notice-meta {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  color: var(--dim);
  margin-bottom: 2px;
}

.unread-dot {
  margin-left: 7px;
}

.notice-body {
  margin-top: 2px;
  font-size: 13.5px;
  color: var(--muted);
}

.notice-detail-card {
  max-width: 720px;
}

.transfer-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border-radius: var(--r-sm);
  border: 1px solid color-mix(in oklch, var(--warn) 42%, var(--line));
  background: var(--bg-soft);
}

.transfer-strip small {
  font-size: 12px;
  color: var(--muted);
}

.notice-detail-body {
  font-size: 15px;
  line-height: 1.6;
}

/* ── Профиль и электронный пропуск ────────────────────────── */
.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, .95fr);
  gap: 24px;
  align-items: start;
}

.profile-side-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-head-copy h2 {
  font-size: 20px;
}

.profile-head-copy p {
  margin-top: 3px;
  font-size: 13.5px;
  color: var(--muted);
}

.profile-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

.profile-fields dt {
  font-size: 12px;
  color: var(--dim);
}

.profile-fields dd {
  margin-top: 2px;
  font-size: 14px;
  font-weight: 500;
}

.profile-actions {
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

.pass-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.pass-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pass-card-top h2 {
  font-size: 18px;
}

.pass-card-mid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

.pass-card-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pass-card-meta small {
  font-size: 12px;
  color: var(--dim);
}

.pass-card-meta strong {
  font-size: 17px;
}

.pass-card-meta p {
  font-size: 13px;
  color: var(--muted);
}

.pass-valid {
  margin-top: 4px;
  font-size: 12px;
  color: var(--dim);
}

/* ── Кабинет учебного офиса (/staff) ──────────────────────── */
.staff-grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, .95fr);
  gap: 24px;
  align-items: start;
}

.staff-side-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.staff-item {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.staff-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.staff-item-head > div {
  min-width: 0;
}

.staff-item-head > div > strong {
  display: block;
  font-size: 14.5px;
  font-weight: 580;
}

.staff-item-head > div > small {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--muted);
}

.staff-item-head > .num {
  white-space: nowrap;
  flex: none;
}

.staff-item-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.staff-item-title strong {
  display: block;
  font-size: 15px;
  font-weight: 580;
}

.staff-item-title small {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--muted);
}

.staff-item-meta {
  font-size: 13px;
  color: var(--muted);
}

.staff-comment,
.staff-reply-note {
  padding: 10px 13px;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  background: var(--bg-soft);
  font-size: 13.5px;
}

.staff-reply-note {
  border-color: color-mix(in oklch, var(--ok) 35%, var(--line));
}

.staff-resolve-form {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.staff-resolve-form input {
  height: 36px;
  font-size: 13.5px;
  border-radius: 10px;
}

.card-subhead h2 {
  font-size: 17px;
}

.card-subhead p {
  margin-top: 3px;
  font-size: 13px;
  color: var(--muted);
}

.announce-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.published-list {
  display: flex;
  flex-direction: column;
}

.published-item {
  padding: 11px 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.published-item + .published-item {
  border-top: 1px solid var(--line-soft);
}

.published-meta {
  font-size: 12px;
  color: var(--dim);
}

.published-item strong {
  font-size: 13.5px;
}

.published-item p {
  font-size: 13px;
  color: var(--muted);
}

/* ── Ошибка ───────────────────────────────────────────────── */
.error-panel {
  max-width: 520px;
  margin: 40px auto;
  align-items: flex-start;
}

.error-code {
  font-size: 13px;
  color: var(--dim);
}

/* ── Модальные окна (<dialog>) ────────────────────────────── */
.modal-dialog {
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow);
  width: min(540px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px);
}

.modal-dialog::backdrop {
  background: oklch(0 0 0 / .45);
  backdrop-filter: blur(3px);
}

.cmd-shell {
  display: flex;
  flex-direction: column;
  max-height: 75dvh;
}

.cmd-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
}

.cmd-input {
  border: 0 !important;
  background: transparent !important;
  height: 36px !important;
  padding: 0 4px !important;
  font-size: 14.5px;
}

.cmd-results {
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cmd-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  transition: background .12s var(--ease);
}

.cmd-item:hover,
.cmd-item:focus-visible {
  background: var(--bg-soft);
  outline: none;
}

.cmd-cat {
  font-size: 11.5px;
  color: var(--dim);
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid var(--line-soft);
  flex: none;
}

.cmd-empty {
  padding: 24px 16px;
  text-align: center;
  font-size: 13.5px;
  color: var(--muted);
}

.pass-dialog {
  width: min(360px, calc(100vw - 24px));
}

.pass-modal-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pass-modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pass-caption {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 500;
}

.pass-qr-frame {
  display: grid;
  place-items: center;
  padding: 20px;
  border-radius: var(--r-sm);
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
}

.pass-modal-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pass-modal-meta strong {
  font-size: 17px;
}

.pass-modal-meta > p {
  font-size: 13px;
  color: var(--muted);
}

.pass-kv-row {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.pass-kv-row small {
  display: block;
  font-size: 11.5px;
  color: var(--dim);
}

.pass-kv-row b {
  font-size: 14px;
}

.pass-footnote {
  margin-top: 8px;
  font-size: 12px;
  color: var(--dim) !important;
}

/* Круговой переход темы через SVG (без inline-стилей для CSP default-src 'self') */
.theme-wave {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 90;
}

.wave-from-light {
  fill: oklch(.97 .004 155);
}

.wave-from-dark {
  fill: oklch(.17 0 0);
}

/* ── Хореография кадров и внутренних объектов ───────────────
   Движение повторяет смысл элемента и сидит на одной кривой --ease:
   вход страницы собирает блоки один раз и замирает; детали внутри карточек
   откликаются только на :hover / действие пользователя. */
@keyframes frame-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bar-draw {
  from {
    transform: scaleX(.32);
    opacity: .45;
  }
  to {
    transform: scaleX(1);
    opacity: 1;
  }
}

@keyframes photo-settle {
  from {
    transform: scale(1.032);
    opacity: .88;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(.982);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes row-reveal {
  from {
    opacity: .38;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bell-swing {
  0%   { transform: rotate(0deg); }
  25%  { transform: rotate(-9deg); }
  55%  { transform: rotate(6.5deg); }
  80%  { transform: rotate(-3deg); }
  100% { transform: rotate(0deg); }
}

@keyframes target-flash {
  0%   { background: color-mix(in oklch, var(--ok) 11%, var(--card)); }
  100% { background: transparent; }
}

@keyframes field-pulse {
  0%   { border-color: var(--text); }
  100% { border-color: var(--line); }
}

/* Однократная сборка полосок марки */
.brand-mark i {
  transform-origin: left center;
  transition: transform .32s var(--ease), opacity .25s var(--ease);
  animation: bar-draw .48s var(--ease) both;
}
.brand-mark i:nth-child(2) { animation-delay: .05s; }
.brand-mark i:nth-child(3) { animation-delay: .10s; }

.brand:hover .brand-mark i:nth-child(1) { transform: scaleX(.86); }
.brand:hover .brand-mark i:nth-child(2) { transform: scaleX(1.18); }
.brand:hover .brand-mark i:nth-child(3) { transform: scaleX(.94); }

/* Каскадный вход кадров страницы */
.page-heading,
.focus-card,
.metrics-bar,
.schedule-controls,
.week-matrix-wrap,
.dashboard-grid > *,
.content-stack > *,
.catalog-grid > *,
.profile-grid > *,
.staff-grid > *,
.form-split > *,
.document-sheet,
.notices-list,
.login-form-wrap {
  animation: frame-in .38s var(--ease) both;
}

.focus-card,
.metrics-bar,
.schedule-controls,
.catalog-grid > :nth-child(1),
.profile-grid > :nth-child(1),
.staff-grid > :nth-child(1),
.form-split > :nth-child(1) {
  animation-delay: .035s;
}

.dashboard-grid > :nth-child(1),
.week-matrix-wrap,
.content-stack > :nth-child(1),
.catalog-grid > :nth-child(2),
.profile-grid > :nth-child(2),
.staff-grid > :nth-child(2),
.form-split > :nth-child(2),
.notices-list {
  animation-delay: .07s;
}

.dashboard-grid > :nth-child(2),
.content-stack > :nth-child(2),
.catalog-grid > :nth-child(3) {
  animation-delay: .105s;
}

/* Внутренние узлы главных карточек */
.focus-body > * {
  animation: frame-in .42s var(--ease) both;
}
.focus-body > :nth-child(1) { animation-delay: .06s; }
.focus-body > :nth-child(2) { animation-delay: .095s; }
.focus-body > :nth-child(3) { animation-delay: .13s; }

.metrics-bar .metric-cell {
  animation: frame-in .38s var(--ease) both;
}
.metrics-bar .metric-cell:nth-child(1) { animation-delay: .04s; }
.metrics-bar .metric-cell:nth-child(2) { animation-delay: .075s; }
.metrics-bar .metric-cell:nth-child(3) { animation-delay: .11s; }
.metrics-bar .metric-cell:nth-child(4) { animation-delay: .145s; }

.timeline li {
  animation: frame-in .36s var(--ease) both;
}
.timeline li:nth-child(1) { animation-delay: .05s; }
.timeline li:nth-child(2) { animation-delay: .10s; }
.timeline li:nth-child(3) { animation-delay: .15s; }

.demo-cards .demo-account-btn {
  animation: frame-in .36s var(--ease) both;
}
.demo-cards .demo-account-btn:nth-child(1) { animation-delay: .06s; }
.demo-cards .demo-account-btn:nth-child(2) { animation-delay: .10s; }
.demo-cards .demo-account-btn:nth-child(3) { animation-delay: .14s; }

.login-photo-frame img {
  animation: photo-settle .88s var(--ease) both;
  transition: transform .65s var(--ease), filter .3s var(--ease);
}

.login-photo-frame:hover img {
  transform: scale(1.014);
}

/* Тактильный отклик карточек, ячеек и внутренних элементов */
.catalog-card,
.matrix-card {
  transition: border-color .18s var(--ease), background .18s var(--ease), transform .22s var(--ease), box-shadow .22s var(--ease);
}

.catalog-card:hover,
.matrix-card:hover {
  transform: translateY(-1.5px);
  box-shadow: var(--shadow);
}

.catalog-card:active,
.matrix-card:active {
  transform: translateY(0) scale(.992);
}

.day-cell {
  transition: border-color .15s var(--ease), background .15s var(--ease), color .15s var(--ease), transform .18s var(--ease);
}

.day-cell:hover:not(.selected) {
  transform: translateY(-1px);
}

.day-cell:active {
  transform: scale(.97);
}

.demo-code {
  transition: border-color .18s var(--ease), color .18s var(--ease), transform .18s var(--ease);
}

.demo-account-btn:hover .demo-code {
  border-color: var(--dim);
  color: var(--text);
  transform: translateX(1.5px);
}

.pass-card-qr .qr-svg {
  transition: transform .28s var(--ease), border-color .22s var(--ease);
}

.pass-card:hover .pass-card-qr .qr-svg {
  transform: scale(1.03);
  border-color: var(--dim);
}

.lesson {
  transition: background .18s var(--ease);
}

.lesson:hover {
  background: color-mix(in oklch, var(--bg-soft) 65%, var(--card));
}

.lesson:target {
  animation: target-flash 1.6s var(--ease) 1;
}

.row-reveal {
  animation: row-reveal .22s var(--ease) both;
}

input.field-filled {
  animation: field-pulse .55s var(--ease) 1;
}

.modal-dialog[open] {
  animation: dialog-in .2s var(--ease) both;
}

/* Внутренние детали векторных иконок (семантическое движение на :hover) */
.ic-part {
  transform-box: view-box;
  transition: transform .36s var(--ease), opacity .25s var(--ease);
}

.ic-clock .clock-hand,
.ic-refresh .spin-vec,
.ic-plus .plus-vec {
  transform-origin: 12px 12px;
}

.ic-bell .bell-dome,
.ic-bell .bell-clapper {
  transform-origin: 12px 4px;
}

.btn:hover .arrow-vec,
.text-link:hover .arrow-vec,
.catalog-card:hover .arrow-vec {
  transform: translateX(2.5px);
}

.btn:hover .left-vec,
.text-link:hover .left-vec,
.icon-btn:hover .left-vec {
  transform: translateX(-2.5px);
}

.icon-btn:hover .diag-vec {
  transform: translate(2px, -2px);
}

.btn:hover .plus-vec {
  transform: rotate(90deg);
}

.btn:hover .dl-vec,
.icon-btn:hover .dl-vec {
  transform: translateY(2px);
}

.btn:hover .spin-vec {
  transform: rotate(180deg);
}

.btn:hover .out-vec {
  transform: translateX(2.5px);
}

.icon-btn:hover .copy-front {
  transform: translate(1.2px, -1.2px);
}

.bell-btn:hover .bell-dome,
.nav-link:hover .bell-dome {
  animation: bell-swing .55s var(--ease) 1;
}

.bell-btn:hover .bell-clapper,
.nav-link:hover .bell-clapper {
  transform: translateX(1.2px);
}

a.box-row:hover .swap-top,
.transfer-strip:hover .swap-top {
  transform: translateX(-2.5px);
}

a.box-row:hover .swap-bot,
.transfer-strip:hover .swap-bot {
  transform: translateX(2.5px);
}

a.box-row:hover .layer-top,
.catalog-card:hover .layer-top,
.btn:hover .layer-top {
  transform: translateY(-2px);
}

a.box-row:hover .layer-bot,
.catalog-card:hover .layer-bot,
.btn:hover .layer-bot {
  transform: translateY(1.8px);
}

a.box-row:hover .ic-file .line-a,
.catalog-card:hover .ic-file .line-a {
  transform: translateX(1.5px);
}

a.box-row:hover .ic-file .line-b,
.catalog-card:hover .ic-file .line-b {
  transform: translateX(1.5px);
  transition-delay: .04s;
}

a.box-row:hover .msg-box,
.catalog-card:hover .msg-box {
  transform: translateY(-1.5px);
}

a.box-row:hover .clock-hand,
.detail-panel:hover .clock-hand {
  transform: rotate(180deg);
  transition-duration: .62s;
}

.nav-link:hover .chart-line {
  transform: translateY(-1.2px);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-delay: 0ms !important;
    transition-duration: .001ms !important;
  }
}

/* ── Финансы, кампус, навигатор и обновлённый /staff ───────── */
.mt-12 { margin-top: 12px; }
.mt-24 { margin-top: 24px; }
.pt-top { padding-top: 16px; border-top: 1px solid var(--line-soft); }

.quick-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.quick-tile {
  padding: 15px 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  transition: border-color .18s var(--ease), transform .22s var(--ease), box-shadow .22s var(--ease);
}

a.quick-tile:hover,
.quick-tile-form:hover {
  border-color: var(--dim);
  transform: translateY(-1.5px);
  box-shadow: var(--shadow);
}

.quick-tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.quick-tile strong {
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-tile small {
  font-size: 12.5px;
  color: var(--muted);
}

.inline-instant-form button {
  border: 0;
  background: none;
  padding: 0;
  font-family: inherit;
  cursor: pointer;
}

.dashboard-main-stack {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

.gap-action {
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}

.gap-action:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.catalog-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.catalog-card-static:hover {
  transform: none;
}

.catalog-card-actions {
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.slot-submit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.aligned-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  align-items: start;
}

.aligned-two-col > section {
  min-width: 0;
}

.charge-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 16px;
  padding: 16px 18px;
  align-items: center;
}

.charge-row + .charge-row {
  border-top: 1px solid var(--line-soft);
}

.charge-info {
  min-width: 0;
}

.charge-info strong {
  font-size: 14.5px;
  font-weight: 580;
}

.charge-amount {
  font-size: 16px;
  white-space: nowrap;
}

.charge-actions {
  display: flex;
  justify-content: flex-end;
}

.pay-inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pay-inline-form select {
  height: 36px;
  width: auto;
  min-width: 132px;
  font-size: 13px;
  border-radius: 10px;
}

.guest-pass-list {
  display: flex;
  flex-direction: column;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  gap: 10px;
}

.guest-pass-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-soft);
  background: var(--bg-soft);
}

.guest-qr-mini .qr-svg {
  border-radius: 6px;
}

.navigator-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.navigator-input-row {
  display: flex;
  gap: 10px;
}

.navigator-input-row input {
  height: 42px;
  padding: 0 14px;
  flex: 1;
}

.chip-row,
.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.quick-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--muted);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color .15s var(--ease), color .15s var(--ease), background .15s var(--ease);
}

.quick-chip:hover {
  border-color: var(--dim);
  color: var(--text);
  background: var(--card);
}

.navigator-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.playbook-summary {
  margin-top: 5px;
  font-size: 14px;
  color: var(--muted);
}

.playbook-steps {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.playbook-steps li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  background: var(--bg-soft);
  font-size: 13.5px;
}

.step-idx {
  color: var(--dim);
  font-size: 12.5px;
  padding-top: 1px;
}

.staff-resolve-block {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 4px;
}

.staff-resolve-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.staff-resolve-row > input[type="text"] {
  flex: 1 1 240px;
  height: 36px;
  font-size: 13.5px;
  border-radius: 10px;
}

.staff-resolve-btns {
  display: flex;
  gap: 6px;
  flex: none;
}

.override-inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  flex-wrap: wrap;
}

.override-inline-form select {
  width: 158px;
  height: 36px;
  font-size: 13px;
  border-radius: 10px;
}

.override-inline-form input[type="text"] {
  flex: 1 1 180px;
  height: 36px;
  font-size: 13px;
  border-radius: 10px;
}

.staff-reply-note.is-returned,
.request-comment.staff-returned {
  border-color: color-mix(in oklch, var(--err) 40%, var(--line));
}

.timeline li.returned {
  color: var(--text);
}

.timeline li.returned .timeline-mark {
  border-color: color-mix(in oklch, var(--err) 48%, var(--line));
  color: var(--err);
}

.ic-compass .compass-needle {
  transform-origin: 12px 12px;
}

.icon-btn:hover .compass-needle,
.btn:hover .compass-needle,
a.box-row:hover .compass-needle {
  transform: rotate(35deg);
}

.quick-tile:hover .wallet-flap,
.nav-link:hover .wallet-flap,
a.box-row:hover .wallet-flap {
  transform: translateX(-1.5px);
}

.staff-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, .92fr);
  gap: 24px;
  align-items: start;
}

.staff-main-grid > section,
.staff-main-grid > .staff-side-stack {
  min-width: 0;
}

.staff-main-grid .seg-item {
  padding: 6px 10px;
  font-size: 12.5px;
}

.sim-banner {
  margin-bottom: 20px;
}

.gap-book-form {
  margin-left: auto;
  flex: none;
}

.gap-book-btn {
  height: 30px;
  padding: 0 11px;
  font-size: 12px;
  border-radius: 8px;
}

.gap-booked {
  margin-left: auto;
}

.document-sheet {
  position: relative;
  overflow: hidden;
}

.doc-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-24deg);
  font-family: var(--mono);
  font-size: clamp(32px, 5vw, 54px);
  font-weight: 700;
  letter-spacing: .12em;
  color: color-mix(in oklch, var(--text) 7%, transparent);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.document-sheet > :not(.doc-watermark) {
  position: relative;
  z-index: 1;
}

.verify-standalone {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 20px 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.verify-public-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.verify-card h1 {
  font-size: 23px;
  margin-top: 2px;
}

.btn.is-submitting {
  opacity: .72;
  pointer-events: none;
}

/* ── Адаптивность: планшеты и смартфоны (до 360px) ────────── */
@media (max-width: 1024px) {
  .dashboard-grid,
  .profile-grid,
  .staff-grid,
  .staff-main-grid,
  .form-split,
  .aligned-two-col,
  .quick-strip,
  .form-row-3 {
    grid-template-columns: minmax(0, 1fr);
  }

  .catalog-grid,
  .catalog-grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }

  .metrics-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-cell:nth-child(3) {
    border-left: 0;
  }

  .metric-cell:nth-child(n+3) {
    border-top: 1px solid var(--line-soft);
  }

  .metrics-bar.metrics-bar-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metrics-bar.metrics-bar-3 .metric-cell:nth-child(3) {
    border-left: 1px solid var(--line-soft);
    border-top: 0;
  }
}

@media (max-width: 920px) {
  .btn,
  .btn.compact,
  .gap-book-btn {
    min-height: 44px;
  }

  .icon-btn {
    min-width: 44px;
    min-height: 44px;
  }

  .bottom-nav a,
  .day-cell,
  .seg-item,
  .quick-chip,
  .demo-account-btn {
    min-height: 44px;
  }

  .timeline-gap {
    flex-wrap: wrap;
  }

  body.signed-in {
    padding-left: 0;
    padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  }

  .sidebar,
  .cmd-trigger {
    display: none;
  }

  .mobile-brand,
  .mobile-search-btn {
    display: inline-flex;
  }

  .top-avatar {
    display: grid;
    width: 32px;
    height: 32px;
    margin-left: 4px;
  }

  .topbar {
    padding: 0 16px;
  }

  .app-main {
    padding: 20px 16px 32px;
  }

  .bottom-nav {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 35;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in oklch, var(--card) 92%, transparent);
    backdrop-filter: saturate(1.3) blur(10px);
    border-top: 1px solid var(--line);
  }

  .bottom-nav a {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 2px;
    border-radius: 9px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
  }

  .bottom-nav a span:last-child {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .bottom-nav a.selected {
    color: var(--text);
  }

  .bottom-icon {
    position: relative;
    display: grid;
    place-items: center;
    height: 22px;
  }

  .bottom-icon i {
    position: absolute;
    top: 0;
    right: -3px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ok);
  }

  .bottom-icon i.warn {
    background: var(--warn);
  }

  .login-stage {
    grid-template-columns: minmax(0, 1fr);
  }

  .login-visual {
    display: none;
  }

  .login-column {
    padding: 20px 18px 28px;
  }
}

@media (max-width: 680px) {
  .page-heading {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .page-heading-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .section-heading {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .section-heading .seg {
    width: 100%;
  }

  .seg-item {
    padding: 7px 6px;
    font-size: 12.5px;
  }

  .focus-body {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding: 18px;
  }

  .focus-time {
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
    padding-right: 0;
    padding-bottom: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .focus-time time {
    font-size: 22px;
  }

  .focus-side {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--line-soft);
  }

  .lesson {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 12px;
    padding: 14px 15px;
  }

  .lesson-room {
    grid-column: 2;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    gap: 8px;
  }

  .metrics-bar,
  .metrics-bar.metrics-bar-3 {
    grid-template-columns: minmax(0, 1fr);
  }

  .metric-cell + .metric-cell {
    border-left: 0 !important;
    border-top: 1px solid var(--line-soft) !important;
  }

  .result-row,
  .result-row.session-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 14px 15px;
  }

  .result-score,
  .result-final {
    align-items: flex-start;
    justify-content: flex-start;
    text-align: left;
  }

  .result-score {
    flex-direction: row;
    gap: 8px;
    align-items: baseline;
  }

  .profile-fields,
  .doc-kv-grid,
  .form-row-2 {
    grid-template-columns: minmax(0, 1fr);
  }

  .staff-resolve-form,
  .staff-resolve-row,
  .navigator-input-row,
  .pay-inline-form {
    flex-direction: column;
    align-items: stretch;
  }

  .staff-resolve-btns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .charge-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 14px 15px;
  }

  .charge-actions {
    justify-content: stretch;
  }

  .pay-inline-form {
    width: 100%;
  }

  .pay-inline-form select {
    width: 100%;
  }

  .override-inline-form select,
  .override-inline-form input[type="text"],
  .override-inline-form button {
    width: 100%;
  }

  .document-sheet {
    padding: 22px 18px;
  }

  .doc-letterhead,
  .doc-verification {
    flex-direction: column;
    align-items: flex-start;
  }

  .doc-meta-box {
    align-items: flex-start;
    text-align: left;
  }
}

@media (max-width: 520px) {
  .topbar {
    padding: 0 12px;
    gap: 6px;
  }

  .topbar-tools {
    gap: 2px;
  }

  .topbar-tools > [data-open-pass] {
    display: none;
  }

  .topbar-tools .icon-btn {
    width: 40px;
    min-width: 40px;
    height: 44px;
  }

  .top-avatar {
    width: 36px;
    height: 36px;
    margin-left: 2px;
  }

  .staff-resolve-btns {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ── Печать бланка документа ──────────────────────────────── */
@media print {
  body {
    padding: 0 !important;
    background: #fff !important;
    color: #000 !important;
  }

  .sidebar,
  .topbar,
  .bottom-nav,
  .app-footer,
  .no-print,
  .flash {
    display: none !important;
  }

  .app-main {
    max-width: none;
    padding: 0;
  }

  .document-sheet {
    border: 0;
    box-shadow: none;
    padding: 0;
    max-width: none;
  }
}
