/* ===== Токены: палитра бренд-гайда 404 (цвета сайта колледжа ДГУ) ===== */
/* Тёмная тема — основная: Полночный фон, Снежный текст, Васильковый акцент */
:root {
  --bg: #0c1222;
  --surface: #141b2d;
  --surface-2: #182034;
  --surface-3: #1d2538;
  --border: rgba(237, 240, 244, 0.09);
  --border-strong: rgba(237, 240, 244, 0.17);
  --text: #edf0f4;
  --muted: rgba(237, 240, 244, 0.66);
  --faint: rgba(237, 240, 244, 0.56);

  --primary: #6a86be;
  --primary-hover: #7c96cb;
  --primary-soft: rgba(106, 134, 190, 0.16);
  --on-primary: #0c1222;

  --green: #7fc8a2;
  --green-soft: rgba(127, 200, 162, 0.13);
  --amber: #e2b65e;
  --amber-soft: rgba(226, 182, 94, 0.13);
  --orange: #e59366;
  --orange-soft: rgba(229, 147, 102, 0.13);
  --red: #ee6b6f;
  --red-soft: rgba(229, 72, 77, 0.15);
  --violet: #a596e6;
  --violet-soft: rgba(165, 150, 230, 0.14);
  --sky: #7db7e0;
  --sky-soft: rgba(125, 183, 224, 0.13);
  --gray: #a6aebd;
  --gray-soft: rgba(125, 132, 146, 0.18);

  --glow: rgba(106, 134, 190, 0.2);
  --node: #edf0f4;

  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 10px 30px rgba(0, 0, 0, 0.22);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);
  --ring: 0 0 0 3px rgba(106, 134, 190, 0.35);

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: dark;
}

/* Светлая тема — инверсия бренд-гайда: Полночный на Снежном */
:root[data-theme="light"] {
  --bg: #edf0f4;
  --surface: #f6f8fa;
  --surface-2: #f1f4f7;
  --surface-3: #e1e6ed;
  --border: rgba(12, 18, 34, 0.1);
  --border-strong: rgba(12, 18, 34, 0.18);
  --text: #0c1222;
  --muted: rgba(12, 18, 34, 0.64);
  --faint: rgba(12, 18, 34, 0.62);
  --primary: #4c68a6;
  --primary-hover: #405a93;
  --primary-soft: rgba(106, 134, 190, 0.17);
  --on-primary: #f6f8fa;
  --green: #2e7d57;
  --green-soft: rgba(46, 125, 87, 0.11);
  --amber: #946713;
  --amber-soft: rgba(148, 103, 19, 0.11);
  --orange: #9a4520;
  --orange-soft: rgba(180, 85, 42, 0.11);
  --red: #c63a3f;
  --red-soft: rgba(198, 58, 63, 0.1);
  --violet: #6553b8;
  --violet-soft: rgba(101, 83, 184, 0.1);
  --sky: #2c6f9e;
  --sky-soft: rgba(44, 111, 158, 0.1);
  --gray: #5a6170;
  --gray-soft: rgba(12, 18, 34, 0.07);
  --glow: rgba(106, 134, 190, 0.22);
  --node: #8a93a6;
  --shadow-sm: 0 1px 2px rgba(12, 18, 34, 0.06);
  --shadow: 0 1px 2px rgba(12, 18, 34, 0.05), 0 8px 24px rgba(12, 18, 34, 0.07);
  --shadow-lg: 0 18px 50px rgba(12, 18, 34, 0.2);
  --ring: 0 0 0 3px rgba(76, 104, 166, 0.25);
  color-scheme: light;
}

/* Кромешная тьма: чёрный фон, поверхности чуть светлее, текст по-прежнему читается (WCAG AA).
   Фон страницы почти не светится: точки видны там, где проходит свет от курсора. */
:root[data-theme="black"] {
  --bg: #000000;
  --surface: #0b0c0f;
  --surface-2: #101115;
  --surface-3: #16171c;
  --border: rgba(230, 232, 236, 0.08);
  --border-strong: rgba(230, 232, 236, 0.15);
  --text: #e6e8ec;
  --muted: rgba(230, 232, 236, 0.66);
  --faint: rgba(230, 232, 236, 0.56);
  --primary: #6a86be;
  --primary-hover: #7c96cb;
  --primary-soft: rgba(106, 134, 190, 0.14);
  --on-primary: #000000;
  --glow: rgba(106, 134, 190, 0.12);
  --node: #c9ccd3;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.6);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.6), 0 12px 34px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.85);
  color-scheme: dark;
}

/* Небо: оттенок акцентного Василькового. Сверху насыщеннее, к горизонту светлеет, панели как облака.
   Акцент темнее обычного: и на панелях, и на самом небе текст держит контраст WCAG AA. */
:root[data-theme="sky"] {
  --bg: #b7cbf0;
  --surface: #f5f8fd;
  --surface-2: #edf2fa;
  --surface-3: #dfe7f5;
  --border: rgba(20, 40, 85, 0.13);
  --border-strong: rgba(20, 40, 85, 0.24);
  --text: #0b1a38;
  --muted: rgba(11, 26, 56, 0.82);
  --faint: rgba(11, 26, 56, 0.8);
  --primary: #27407a;
  --primary-hover: #1f3565;
  --primary-soft: rgba(39, 64, 122, 0.13);
  --on-primary: #f5f8fd;
  --green: #22694a;
  --green-soft: rgba(46, 125, 87, 0.13);
  --amber: #7d5610;
  --amber-soft: rgba(148, 103, 19, 0.14);
  --orange: #8a3d1b;
  --orange-soft: rgba(180, 85, 42, 0.13);
  --red: #b5333a;
  --red-soft: rgba(198, 58, 63, 0.12);
  --violet: #5a4aa8;
  --violet-soft: rgba(101, 83, 184, 0.12);
  --sky: #24628d;
  --sky-soft: rgba(44, 111, 158, 0.12);
  --gray: #4d5568;
  --gray-soft: rgba(12, 18, 34, 0.08);
  --glow: rgba(255, 255, 255, 0.42);
  --node: #ffffff;
  --shadow-sm: 0 1px 2px rgba(20, 40, 85, 0.1);
  --shadow: 0 1px 2px rgba(20, 40, 85, 0.08), 0 10px 28px rgba(20, 40, 85, 0.14);
  --shadow-lg: 0 20px 56px rgba(20, 40, 85, 0.3);
  --ring: 0 0 0 3px rgba(39, 64, 122, 0.3);
  color-scheme: light;
  background: var(--bg);
}
:root[data-theme="sky"] body { background: transparent; }
:root[data-theme="sky"] body::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background: linear-gradient(180deg, #96b1e6 0%, #b7cbf0 52%, #e0e9f8 100%);
}
/* облака: узор повторяется, поэтому полоса в две его ширины плывёт на одну без видимого шва;
   на телефоне узор не уже 1000px, иначе облака вытягиваются вверх */
:root[data-theme="sky"] body::after {
  --tile: max(100vw, 1000px);
  content: ""; position: fixed; top: 0; left: 0; z-index: -1; width: calc(var(--tile) * 2); height: 100lvh; pointer-events: none;
  background-image:
    radial-gradient(ellipse 13% 6% at 18% 17%, rgba(255, 255, 255, 0.86), transparent 72%),
    radial-gradient(ellipse 7% 7% at 14% 14.5%, rgba(255, 255, 255, 0.8), transparent 72%),
    radial-gradient(ellipse 8% 8.5% at 21% 13%, rgba(255, 255, 255, 0.76), transparent 72%),
    radial-gradient(ellipse 15% 6.5% at 68% 33%, rgba(255, 255, 255, 0.78), transparent 72%),
    radial-gradient(ellipse 8% 7.5% at 63.5% 29.5%, rgba(255, 255, 255, 0.72), transparent 72%),
    radial-gradient(ellipse 10% 9.5% at 71% 28%, rgba(255, 255, 255, 0.68), transparent 72%),
    radial-gradient(ellipse 18% 6% at 38% 68%, rgba(255, 255, 255, 0.6), transparent 72%),
    radial-gradient(ellipse 10% 7% at 34% 65%, rgba(255, 255, 255, 0.54), transparent 72%),
    radial-gradient(ellipse 11% 8% at 43% 63.5%, rgba(255, 255, 255, 0.5), transparent 72%),
    radial-gradient(ellipse 15% 5.5% at 83% 85%, rgba(255, 255, 255, 0.72), transparent 72%),
    radial-gradient(ellipse 8% 6% at 80% 82%, rgba(255, 255, 255, 0.62), transparent 72%);
  background-size: var(--tile) 100%;
  background-repeat: repeat-x;
  animation: sky-drift 260s linear infinite;
  will-change: transform;
}
@keyframes sky-drift { to { transform: translate3d(calc(var(--tile) * -1), 0, 0); } }
@media (prefers-reduced-motion: reduce) { :root[data-theme="sky"] body::after { animation: none; } }
@media print { :root[data-theme="sky"] body::before, :root[data-theme="sky"] body::after { display: none; } }

/* ===== База ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss03";
}

/* Выделение текста: в тёмных темах текст загорается в акцентном свете, в светлых вокруг него белое сияние.
   Цвета заданы прямо здесь: значения переменных внутри ::selection браузеры подставляют по-разному */
::selection { background: rgba(106, 134, 190, 0.55); color: #ffffff; text-shadow: 0 0 10px rgba(142, 166, 216, 0.9); }
:root[data-theme="black"] ::selection { background: rgba(106, 134, 190, 0.42); color: #ffffff; text-shadow: 0 0 12px rgba(142, 166, 216, 0.95); }
:root[data-theme="light"] ::selection { background: rgba(76, 104, 166, 0.26); color: #0c1222; text-shadow: 0 0 8px rgba(255, 255, 255, 0.85); }
:root[data-theme="sky"] ::selection { background: rgba(39, 64, 122, 0.24); color: #0b1a38; text-shadow: 0 0 8px rgba(255, 255, 255, 0.95); }

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 16px; font-weight: 600; }

p { margin: 0; }

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

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

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

[hidden] { display: none !important; }

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-lg { width: 24px; height: 24px; }
.icon-sm { width: 15px; height: 15px; }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; word-break: break-word; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.between { justify-content: space-between; }
.center { text-align: center; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ===== Кнопки ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.18s var(--ease), border-color 0.18s, transform 0.05s, box-shadow 0.25s var(--ease), color 0.18s;
}

.btn:hover { background: var(--surface-2); text-decoration: none; border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); box-shadow: 0 10px 30px -12px var(--primary); }

.btn-danger { background: var(--red); border-color: var(--red); color: var(--on-primary); }
.btn-danger:hover { background: var(--red); filter: brightness(0.95); border-color: var(--red); }

.btn-soft { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.btn-soft:hover { background: var(--primary-soft); border-color: var(--primary); }

.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }

.btn-lg { min-height: 50px; padding: 0 22px; font-size: 16px; border-radius: var(--radius); }
.btn-sm { min-height: 32px; padding: 0 11px; font-size: 13px; border-radius: var(--radius-xs); }
.btn-block { width: 100%; }
/* кнопка-значок не сжимается в тесном ряду: на телефоне она иначе становилась шириной в 2 px */
.btn-icon { flex: none; width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Формы ===== */
.field { display: flex; flex-direction: column; gap: 6px; }
/* подписи — как метки бренд-гайда: мелкие прописные с разрядкой */
.field > label, .label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}
.field .hint { font-size: 12px; color: var(--faint); }
.field .error { font-size: 13px; color: var(--red); }

.input, .select, .textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.textarea { resize: vertical; min-height: 96px; line-height: 1.45; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238790a3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input-sm, .select-sm { min-height: 34px; padding-top: 5px; padding-bottom: 5px; font-size: 14px; }

.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.input-icon .input { padding-left: 38px; }

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-3);
  border-radius: var(--radius-sm);
  gap: 2px;
}
.segmented button {
  border: 0;
  background: transparent;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ===== Карточки и чипы ===== */
.card {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, var(--text)), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-body { padding: 18px 20px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
  background: var(--gray-soft);
  color: var(--gray);
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip-lg { height: 32px; padding: 0 14px; font-size: 14px; }

.st-new { background: var(--sky-soft); color: var(--sky); }
.st-review { background: var(--violet-soft); color: var(--violet); }
.st-assigned { background: var(--primary-soft); color: var(--primary); }
.st-in_progress { background: var(--amber-soft); color: var(--amber); }
.st-need_info { background: var(--orange-soft); color: var(--orange); }
.st-resolved { background: var(--green-soft); color: var(--green); }
.st-rejected { background: var(--gray-soft); color: var(--gray); }

.pr-critical { background: var(--red-soft); color: var(--red); }
.pr-high { background: var(--orange-soft); color: var(--orange); }
.pr-normal { background: var(--gray-soft); color: var(--gray); }
.pr-low { background: var(--gray-soft); color: var(--faint); }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-3);
  color: var(--muted);
}
.badge-primary { background: var(--primary); color: var(--on-primary); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--muted);
}

.notice {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 14px;
}
.notice .icon { margin-top: 2px; }
.notice-info { background: var(--primary-soft); border-color: transparent; color: var(--text); }
.notice-info .icon { color: var(--primary); }
.notice-warn { background: var(--amber-soft); border-color: transparent; }
.notice-warn .icon { color: var(--amber); }
.notice-danger { background: var(--red-soft); border-color: transparent; }
.notice-danger .icon { color: var(--red); }
.notice-ok { background: var(--green-soft); border-color: transparent; }
.notice-ok .icon { color: var(--green); }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}
.empty .empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--faint);
}

.skeleton {
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 8px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

hr.sep { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }

/* ===== Тосты и модалки ===== */
.toasts {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(420px, calc(100% - 32px));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  animation: toast-in 0.2s ease-out;
}
.toast.error { background: color-mix(in srgb, var(--red) 22%, var(--surface-3)); border-color: color-mix(in srgb, var(--red) 45%, transparent); }
.toast.ok .icon { color: var(--green); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(6, 9, 18, 0.62);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fade 0.15s ease-out;
}
@keyframes fade { from { opacity: 0; } }

.modal {
  width: min(520px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: pop 0.18s ease-out;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 6px; }
.modal-body { padding: 12px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 20px 20px; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

/* ===== Шапка публичных страниц ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand { min-height: 24px; }
.brand:hover { text-decoration: none; }
/* знак 404 без подложки, как в бренд-гайде */
.lockup { display: block; background: currentColor; -webkit-mask: url("/static/img/lockup.svg") center / contain no-repeat; mask: url("/static/img/lockup.svg") center / contain no-repeat; }
.brand .lockup { height: 22px; width: auto; aspect-ratio: 11440 / 2730.67; }
.brand-sep { width: 1px; height: 22px; background: var(--border-strong); }
.brand small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); line-height: 1.2; }
.brand span { line-height: 1.2; }

.page { position: relative; max-width: 760px; margin: 0 auto; padding: 24px 20px 60px; }
.page-wide { max-width: 1120px; }
/* подвал всегда внизу экрана, даже если содержимого мало */
body:has(> .page) { display: flex; flex-direction: column; min-height: 100dvh; }
body:has(> .page) > .page { flex: 1 0 auto; width: 100%; }
body:has(> .page) > .footer { width: 100%; }
.footer { position: relative; max-width: 1120px; margin: 0 auto; padding: 18px 20px 30px; color: var(--muted); font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; border-top: 1px solid var(--border); }
.footer .lockup { height: 14px; width: auto; aspect-ratio: 11440 / 2730.67; color: var(--muted); }

/* ===== Страница обращения ===== */
.hero { padding: 6px 2px 22px; }
.hero .eyebrow { margin-bottom: 12px; }
.hero h1 { font-size: clamp(28px, 6vw, 44px); font-weight: 600; letter-spacing: -0.025em; line-height: 1.08; }
.hero p { margin-top: 10px; color: var(--muted); font-size: 16px; max-width: 560px; }

.place-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}
.place-pill .place-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  flex: none;
}
.place-pill.empty-place .place-icon { background: var(--surface-3); color: var(--faint); }
.place-pill .place-text { flex: 1; min-width: 0; }
.place-pill .place-text b { display: block; font-size: 15px; }
.place-pill .place-text span { font-size: 12.5px; color: var(--muted); }

.composer {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.composer:focus-within { border-color: var(--primary); box-shadow: var(--ring), var(--shadow); }
/* фото несут над полем сообщения: поле подсвечивается и подсказывает, что его можно отпустить */
.composer.is-drop { border-color: var(--primary); border-style: dashed; box-shadow: var(--ring), 0 0 40px -12px var(--primary), var(--shadow); }
.composer.is-drop::after {
  content: "Отпустите, чтобы прикрепить фото"; position: absolute; inset: 0; z-index: 2;
  display: grid; place-items: center; border-radius: inherit;
  background: color-mix(in srgb, var(--surface) 82%, var(--primary)); color: var(--text); font-weight: 600; font-size: 14px;
  pointer-events: none;
}
.composer textarea {
  display: block;
  width: 100%;
  min-height: 92px;
  max-height: 260px;
  border: 0;
  background: transparent;
  resize: none;
  padding: 16px 16px 6px;
  font-size: 16px;
  line-height: 1.45;
  outline: none;
}
.composer-bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px 10px; }
.composer-bar .btn-primary { margin-left: auto; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.photo-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 12px 4px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.photo-preview img { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; }
/* миниатюра нажимается: фото открывается крупно */
.photo-thumb {
  position: relative; flex: none; display: block; width: 64px; height: 64px; padding: 0;
  border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border)); border-radius: 10px;
  background: var(--surface-3); overflow: hidden; cursor: zoom-in;
  box-shadow: 0 6px 18px -10px color-mix(in srgb, var(--primary) 70%, transparent);
  animation: thumb-in 0.5s var(--ease-out, ease-out) both;
}
.photo-thumb img { width: 100%; height: 100%; border-radius: 0; object-fit: cover; transition: transform 0.4s var(--ease-out, ease-out); }
.photo-thumb .icon {
  position: absolute; right: 4px; bottom: 4px; width: 18px; height: 18px; padding: 3px; border-radius: 50%;
  background: color-mix(in srgb, var(--bg) 70%, transparent); color: var(--text);
}
.photo-thumb:hover img { transform: scale(1.06); }
.photo-thumb:active { transform: scale(0.96); }
@keyframes thumb-in { from { opacity: 0; transform: scale(0.85); filter: blur(4px); } }

.examples { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.example {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 13.5px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.example:hover { border-color: var(--primary); color: var(--primary); }

.thread { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.bubble-user {
  align-self: flex-end;
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 18px 18px 6px 18px;
  background: var(--primary);
  color: var(--on-primary);
  white-space: pre-wrap;
  word-break: break-word;
}
.bubble-user .bubble-photo { margin-top: 8px; border-radius: 10px; max-height: 160px; object-fit: cover; }

.ai-card {
  align-self: stretch;
  border-radius: 6px 20px 20px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: pop 0.2s ease-out;
}
.ai-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.ai-avatar {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
  flex: none;
}
.ai-avatar .icon { width: 17px; height: 17px; }
.ai-avatar .mark { width: 13px; height: auto; aspect-ratio: 1333.2 / 1736; }
.ai-card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.ai-answer { font-size: 15.5px; white-space: pre-wrap; }
.ai-tips { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.ai-tips li { display: flex; gap: 8px; font-size: 14px; }
.ai-tips li .icon { color: var(--green); margin-top: 2px; }
.ai-source {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 13px;
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  color: var(--muted);
}
.ai-card.kind-danger { border-color: color-mix(in srgb, var(--red) 45%, var(--border)); }
.ai-card.kind-danger .ai-card-head { background: var(--red-soft); }
.ai-card.kind-danger .ai-avatar { background: var(--red); border-color: var(--red); color: var(--on-primary); }
.ai-card.kind-secret .ai-card-head { background: var(--violet-soft); }

.typing { display: inline-flex; gap: 4px; padding: 6px 2px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }

.draft { margin-top: 4px; }
.draft .card-pad { display: flex; flex-direction: column; gap: 16px; }
.draft-more > summary { display: flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 600; cursor: pointer; list-style: none; border-radius: var(--radius-sm); }
.draft-more > summary::-webkit-details-marker { display: none; }
.draft-more > summary::after { content: "+"; margin-left: auto; color: var(--muted); font-size: 20px; line-height: 1; }
.draft-more[open] > summary::after { content: "\2212"; }
.draft-more-body { display: flex; flex-direction: column; gap: 16px; padding-top: 10px; }
@media (max-width: 720px) and (min-height: 480px) {
  /* кнопка отправки всегда на экране, пока форма видна */
  .draft-send { position: sticky; bottom: 0; z-index: 2; padding: 10px 0 calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--surface); }
}
.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.cat-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font-size: 14px;
  font-weight: 550;
  text-align: left;
  transition: all 0.12s;
}
.cat-option .icon { color: var(--muted); }
.cat-option:hover { border-color: var(--border-strong); }
.cat-option[aria-checked="true"] { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.cat-option[aria-checked="true"] .icon { color: var(--primary); }

.dup-box { border: 1px solid color-mix(in srgb, var(--amber) 40%, var(--border)); background: var(--amber-soft); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.dup-item { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; background: var(--surface); border-radius: var(--radius-sm); }

.done-card { text-align: center; padding: 34px 22px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.ticket-number { font-size: 38px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.code-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 16px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.qr-mini { width: 132px; height: 132px; padding: 8px; background: #fff; border-radius: 12px; border: 1px solid var(--border); }

.my-tickets { margin-top: 26px; }
.my-ticket {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.my-ticket:last-child { border-bottom: 0; }
/* подсветка строки повторяет скругление карточки, углы не становятся острыми */
.my-ticket:first-child { border-top-left-radius: calc(var(--radius-lg) - 1px); border-top-right-radius: calc(var(--radius-lg) - 1px); }
.my-ticket:last-child { border-bottom-left-radius: calc(var(--radius-lg) - 1px); border-bottom-right-radius: calc(var(--radius-lg) - 1px); }
.my-ticket:hover { background: var(--surface-2); text-decoration: none; }

.loc-list { max-height: 50vh; overflow: auto; display: flex; flex-direction: column; gap: 2px; margin: 0 -8px; }
.loc-group { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.14em; color: var(--faint); padding: 12px 8px 4px; }
.loc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border: 0;
  background: transparent;
  border-radius: var(--radius-sm);
  text-align: left;
  cursor: pointer;
  width: 100%;
}
.loc-item:hover { background: var(--surface-2); }
.loc-item .icon { color: var(--faint); }

/* ===== Страница статуса ===== */
.status-hero { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.status-hero .number { font-size: 14px; font-weight: 700; color: var(--muted); letter-spacing: 0.02em; }
.status-hero h1 { font-size: 22px; }

.stepper { display: flex; gap: 4px; margin-top: 4px; }
.step { flex: 1; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.step span { font-size: 12px; color: var(--faint); font-weight: 600; line-height: 1.2; }
.step.current span { color: var(--text); }
.step.done span { color: var(--muted); }

.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }
.info-grid dt { font-size: 12px; color: var(--faint); font-weight: 600; margin-bottom: 2px; }
.info-grid dd { margin: 0; font-size: 14.5px; }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { position: relative; padding: 0 0 16px 24px; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); }
.timeline li::after { content: ""; position: absolute; left: 9px; top: 18px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline li.hl::before { background: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.timeline .when { font-size: 12px; color: var(--faint); }
.timeline .note { margin-top: 4px; padding: 8px 10px; background: var(--surface-2); border-radius: var(--radius-sm); font-size: 14px; }

.comment { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); }
.comment.mine { background: var(--primary-soft); }
.comment.internal { background: var(--amber-soft); }
.comment-head { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); }
.comment-head b { color: var(--text); }

.stars { display: inline-flex; gap: 4px; }
.star { border: 0; background: none; padding: 2px; cursor: pointer; color: var(--border-strong); }
.star .icon { width: 30px; height: 30px; }
.star.on { color: var(--amber); }
.star.on .icon { fill: currentColor; }

.photo-thumb { border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); max-width: 260px; cursor: zoom-in; }
.photo-thumb img { width: 100%; max-height: 240px; object-fit: cover; }

.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, 0.85); display: grid; place-items: center; padding: 16px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; }

@media (max-width: 560px) {
  .card-pad { padding: 18px; }
  .cat-grid { gap: 6px; }
  .cat-option { padding: 9px 10px; font-size: 13px; gap: 8px; line-height: 1.25; }
  .info-grid { grid-template-columns: 1fr; }
  .step span { display: none; }
  .hide-mobile { display: none !important; }
  .brand small { display: none; }
  .ticket-number { font-size: 30px; }
  .code-box { font-size: 15px; }
}

/* ---------- служебные страницы и доступность ---------- */
.skip-link {
  position: fixed;
  left: 12px;
  top: -60px;
  z-index: 10000;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 12px; }
main:focus, [tabindex="-1"]:focus { outline: none; }
.footer a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.footer a:hover { color: var(--text); }
.prose h2 { font-size: 18px; margin: 26px 0 8px; }
.prose p { line-height: 1.6; margin: 8px 0; }
.prose ul { padding-left: 18px; line-height: 1.6; margin: 8px 0; }
.prose li { margin: 6px 0; }

/* Доступность: видимый фокус и кнопка закрытия просмотра фото */
a:focus-visible, button:focus-visible, [tabindex]:focus-visible, summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn:focus-visible { outline: none; }
.lightbox-close { position: absolute; top: 16px; right: 16px; color: #fff; }
/* Заголовок второго уровня, который выглядит как третий: порядок заголовков для экранных читалок без смены вида */
h2.h3 { font-size: 16px; font-weight: 600; letter-spacing: normal; }

/* ===== Выпадающий список в стиле сайта (select.js) ===== */
.ui-select { position: relative; display: block; width: 100%; min-width: 0; }
.ui-select-native { position: absolute !important; inset: 0; width: 100% !important; height: 100% !important; opacity: 0; pointer-events: none; }
.ui-select-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding-right: 10px; background-image: none; text-align: left; cursor: pointer; font: inherit;
}
.ui-select-btn:hover:not(:disabled) { border-color: color-mix(in srgb, var(--text) 26%, transparent); }
.ui-select-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.ui-select-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-select-btn .icon { flex: none; color: var(--muted); transition: transform 0.25s var(--ease-out); }
.ui-select.is-open .ui-select-btn { border-color: var(--primary); box-shadow: var(--ring); }
.ui-select.is-open .ui-select-btn .icon { transform: rotate(180deg); }
.ui-select-menu {
  position: fixed; z-index: 120;
  max-width: min(360px, calc(100vw - 16px));
  padding: 6px; overflow-y: auto; overscroll-behavior: contain;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow), 0 18px 40px -18px rgba(0, 0, 0, 0.5);
  transform-origin: 50% 0;
  animation: ui-menu-in 0.18s var(--ease-out) both;
}
.ui-select-menu.is-up { transform-origin: 50% 100%; }
.ui-select-menu.is-leaving { animation: ui-menu-out 0.14s ease-in both; }
@keyframes ui-menu-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
@keyframes ui-menu-out { to { opacity: 0; transform: translateY(-4px) scale(0.98); } }
.ui-option {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 10px; border-radius: var(--radius-xs);
  font-size: 14px; color: var(--text); cursor: pointer; user-select: none;
}
.ui-option .icon { flex: none; color: var(--primary); opacity: 0; }
.ui-option[aria-selected="true"] { font-weight: 600; }
.ui-option[aria-selected="true"] .icon { opacity: 1; }
.ui-option.is-active { background: var(--surface-3); }
.ui-option.is-disabled { color: var(--faint); cursor: default; }
@media (prefers-reduced-motion: reduce) { .ui-select-menu, .ui-select-menu.is-leaving { animation: none; } }
/* у списков и этажей схемы своё выделение фокуса, общая рамка не нужна */
.ui-select-btn:focus-visible, .pf-floor:focus-visible { outline: none; }

/* ===== Нет сети и ошибки загрузки ===== */
.net-banner {
  position: fixed; z-index: 95; top: 12px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 8px;
  max-width: calc(100vw - 32px); padding: 8px 14px;
  border: 1px solid color-mix(in srgb, var(--amber) 45%, var(--border)); border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 92%, var(--amber));
  box-shadow: var(--shadow);
  font-size: 13px; font-weight: 600; color: var(--text);
  animation: net-in 0.4s var(--ease-out) both;
}
.net-banner .icon { color: var(--amber); }
.net-banner.is-leaving { animation: net-out 0.3s ease-in both; }
@keyframes net-in { from { opacity: 0; transform: translate(-50%, -10px); } }
@keyframes net-out { to { opacity: 0; transform: translate(-50%, -10px); } }
.error-block { align-items: center; }
.error-block .btn { flex: none; }
.error-block.is-compact { font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .net-banner, .net-banner.is-leaving { animation: none; } }

/* ===== Служебные классы вместо встроенных стилей (CSP без unsafe-inline) =====
   С !important, как были встроенные стили: они должны перекрывать правила компонентов из любых файлов. */
.u-self-start { align-self: flex-start !important; }
.u-m0 { margin: 0 !important; }
.u-mt4 { margin-top: 4px !important; }
.u-mt6 { margin-top: 6px !important; }
.u-mb4 { margin-bottom: 4px !important; }
.u-mb8 { margin-bottom: 8px !important; }
.u-mb12 { margin-bottom: 12px !important; }
.u-mv-10-22 { margin: 10px 0 22px !important; }
.u-mv-6-14 { margin: 6px 0 14px !important; }
.u-mv-n4-14 { margin: -4px 0 14px !important; }
.u-mr-auto { margin-right: auto !important; }
.u-ml-auto { margin-left: auto !important; }
.u-flex-none { flex: none !important; }
.u-py16 { padding: 16px 0 !important; }
.u-block { display: block !important; }
.u-wrap { flex-wrap: wrap !important; }
.u-gap6 { gap: 6px !important; }
.u-gap7 { gap: 7px !important; }
.u-gap8 { gap: 8px !important; }
.u-gap12 { gap: 12px !important; }
.u-gap14 { gap: 14px !important; }
.u-gap24 { gap: 24px !important; }
.u-justify-start { justify-content: flex-start !important; }
.u-justify-center { justify-content: center !important; }
.u-wauto { width: auto !important; }
.u-w100 { width: 100% !important; }
.u-w70 { width: 70% !important; }
.u-w360 { width: min(360px, 100%) !important; }
.u-maxw180 { max-width: 180px !important; }
.u-maxw280 { max-width: 280px !important; }
.u-maxw420 { max-width: 420px !important; }
.u-maxw440 { max-width: 440px !important; }
.u-maxw640 { max-width: 640px !important; }
.u-minw160 { min-width: 160px !important; }
.u-minw180 { min-width: 180px !important; }
.u-minw220 { min-width: 220px !important; }
.u-minw280 { min-width: 280px !important; }
.u-minh60 { min-height: 60px !important; }
.u-minh64 { min-height: 64px !important; }
.u-minh70 { min-height: 70px !important; }
.u-sq28 { width: 28px !important; height: 28px !important; }
.u-fs16 { font-size: 16px !important; }
.u-fs18 { font-size: 18px !important; }
.u-fw700 { font-weight: 700 !important; }
.u-code-input { font-size: 18px !important; letter-spacing: 0.06em !important; }
.u-clamp3 { display: -webkit-box !important; -webkit-line-clamp: 3 !important; -webkit-box-orient: vertical !important; overflow: hidden !important; }
.u-cursor-default { cursor: default !important; }
.u-inherit { color: inherit !important; }
.u-plain-link { color: inherit !important; text-decoration: none !important; }
.u-primary { color: var(--primary) !important; }
.u-red { color: var(--red) !important; }
.u-green { color: var(--green) !important; }
.u-chart1 { color: var(--chart-1) !important; }
.u-chart2 { color: var(--chart-2) !important; }
.u-bg-chart1 { background: var(--chart-1) !important; }
.u-bg-chart2 { background: var(--chart-2) !important; }
.u-border-warn { border-color: color-mix(in srgb, var(--orange) 40%, var(--border)) !important; }
.u-offscreen { position: fixed !important; opacity: 0 !important; }
.u-pill-check { padding: 6px 10px !important; border: 1px solid var(--border) !important; border-radius: 999px !important; }
.u-avatar-lg { width: 54px !important; height: 54px !important; font-size: 18px !important; }
.my-ticket-icon { width: 34px !important; height: 34px !important; border-radius: 10px !important; display: grid !important; place-items: center !important; background: var(--surface-3) !important; color: var(--muted) !important; }
.sk-h40 { height: 40px !important; }
.sk-h44 { height: 44px !important; }
.sk-h58 { height: 58px !important; }
.sk-h90 { height: 90px !important; }
.sk-h120 { height: 120px !important; }
.sk-h150 { height: 150px !important; }
.sk-h180 { height: 180px !important; }
.sk-h220 { height: 220px !important; }
.sk-h320 { height: 320px !important; }
.sk-h400 { height: 400px !important; }
.is-inactive { opacity: 0.55 !important; }
.is-clickable { cursor: pointer !important; }

/* цвета статусов: точка у статуса, колонка доски, полоса в статистике */
.st-c-new { --st: var(--sky); }
.st-c-review { --st: var(--violet); }
.st-c-assigned { --st: var(--primary); }
.st-c-in_progress { --st: var(--amber); }
.st-c-need_info { --st: var(--orange); }
.st-c-resolved { --st: var(--green); }
.st-c-rejected { --st: var(--gray); }
.st-dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--st, var(--gray)); }
.hbar-track i[class*="st-c-"] { background: var(--st); }

/* На телефоне всё, что нажимают, не меньше пальца */
@media (max-width: 640px) {
  .example, .btn, .input, .pl-help { min-height: 44px; }
  .btn-icon, .pl-help { min-width: 44px; }
}

/* ---------- свой указатель для мыши (cursor.js) ---------- */
html.has-cursor, html.has-cursor * { cursor: none !important; }
/* над полями ввода системный текстовый курсор тоже заменён своим (.cursor-beam) */
html.has-cursor :is(input:not([type="checkbox"], [type="radio"], [type="file"], [type="button"], [type="submit"]), textarea, [contenteditable="true"]) { cursor: none !important; }
.cursor, .cursor-ring, .cursor-bit { position: fixed; top: 0; left: 0; z-index: 2147483000; width: 0; height: 0; pointer-events: none; }
.cursor, .cursor-ring { opacity: 0; transition: opacity 0.2s ease; will-change: transform; }
.cursor.is-on, .cursor-ring.is-on { opacity: 1; }
.cursor { color: var(--text); }
.cursor-pose { width: 0; height: 0; transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease; }
.cursor svg { display: block; width: 22px; height: 22px; margin: -11px 0 0 -11px; fill: currentColor; filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 5px var(--primary)); animation: cursor-idle 3.4s ease-in-out infinite; }
.cursor.is-hover .cursor-pose { transform: scale(1.4) rotate(45deg); }
.cursor.is-down .cursor-pose { transform: scale(0.72); }
.cursor.is-hover.is-down .cursor-pose { transform: scale(1.05) rotate(45deg); }
.cursor.is-disabled .cursor-pose { transform: scale(0.85); opacity: 0.45; }
.cursor.is-text .cursor-pose { opacity: 0; transform: scale(0.2) rotate(90deg); }
/* текстовый курсор мыши: черта с засечками вырастает из знака и мягко светится */
.cursor-beam { position: absolute; left: 0; top: 0; width: 0; height: 0; opacity: 0; transform: scaleY(0.2) rotate(-45deg); transition: transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.18s ease; }
.cursor-beam i { position: absolute; left: -1px; top: -10px; width: 2px; height: 20px; border-radius: 1px; background: currentColor; box-shadow: 0 0 1px rgba(0, 0, 0, 0.7), 0 0 6px var(--primary); }
.cursor-beam i::before, .cursor-beam i::after { content: ""; position: absolute; left: -3px; width: 8px; height: 2px; border-radius: 1px; background: currentColor; }
.cursor-beam i::before { top: -1px; }
.cursor-beam i::after { bottom: -1px; }
.cursor.is-text .cursor-beam { opacity: 1; transform: none; }
.cursor.is-text .cursor-beam i { animation: cursor-beam-glow 2.4s ease-in-out infinite; }
.cursor.is-text.is-down .cursor-beam { transform: scaleY(0.82); transition-duration: 0.12s; }
@keyframes cursor-beam-glow { 50% { box-shadow: 0 0 1px rgba(0, 0, 0, 0.7), 0 0 11px var(--primary); } }
.cursor-ring i { display: block; width: 36px; height: 36px; margin: -18px 0 0 -18px; border: 1px solid var(--primary); border-radius: 50%; opacity: 0.38; transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease; }
.cursor-ring.is-hover i { transform: scale(1.45); opacity: 0.7; }
.cursor-ring.is-down i { transform: scale(0.72); opacity: 0.9; }
.cursor-ring.is-text i, .cursor-ring.is-disabled i { opacity: 0; }
.cursor-bit svg { display: block; width: 14px; height: 14px; margin: -7px 0 0 -7px; fill: var(--primary); filter: drop-shadow(0 0 3px var(--primary)); }
@keyframes cursor-idle { 0%, 100% { transform: scale(1) rotate(0deg); } 50% { transform: scale(0.88) rotate(12deg); } }
/* несём карточку: форма сжимается и вращается, кольцо расходится и пульсирует, над подходящей колонкой всё ярче */
html.is-dragging .cursor.is-on .cursor-pose { transform: scale(0.7); }
html.is-dragging .cursor.is-on svg { animation: cursor-carry 1.4s linear infinite; }
html.is-dragging .cursor-ring.is-on i { animation: cursor-ring-carry 1.1s ease-in-out infinite; }
html.can-drop .cursor.is-on .cursor-pose { transform: scale(1.1); }
html.can-drop .cursor-ring.is-on i { border-width: 2px; animation-duration: 0.7s; }
@keyframes cursor-carry { to { transform: rotate(360deg); } }
@keyframes cursor-ring-carry { 0%, 100% { transform: scale(1.35); opacity: 0.55; } 50% { transform: scale(1.7); opacity: 0.95; } }
@media (prefers-reduced-motion: reduce) {
  .cursor svg, html.is-dragging .cursor.is-on svg, .cursor.is-text .cursor-beam i { animation: none; }
  .cursor-pose, .cursor-beam { transition: none; }
  .cursor-ring { display: none; }
}
@media print {
  .cursor, .cursor-ring, .cursor-bit { display: none; }
}

/* ===== Образцы тем (меню по правой кнопке); сам выбор темы — theme-picker.css ===== */
.theme-check { color: var(--primary); opacity: 0; }
/* образец темы: фон и акцент. Цвета намеренно постоянные: образец показывает тему, а не текущую */
.theme-swatch { position: relative; flex: none; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--border-strong); overflow: hidden; }
.theme-swatch svg { display: block; width: 100%; height: 100%; }
.sound-btn[aria-pressed="false"] { color: var(--faint); }
/* кнопки шапки не сжимаются; на самом узком экране место освобождает подпись рядом со знаком */
.topbar-inner > .btn { flex: none; }
@media (max-width: 400px) {
  .topbar .brand-sep, .topbar .brand > span:last-child { display: none; }
}
.ts-dark { background: linear-gradient(145deg, #1f2a44, #0c1222); }
.ts-light { background: linear-gradient(180deg, #ffffff, #dfe5ee); }
.ts-black { background: radial-gradient(circle, #16171c, #000000 72%); }
.ts-black svg { filter: drop-shadow(0 0 2.5px #8ea6d8); }
.ts-sky { background: linear-gradient(180deg, #96b1e6, #e0e9f8); }

/* ===== Подсказки при наведении (вместо системных) ===== */
.ui-tip {
  position: fixed; z-index: 130; max-width: min(280px, calc(100vw - 16px));
  padding: 6px 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-xs);
  background: var(--surface-3); color: var(--text);
  box-shadow: var(--shadow);
  font-size: 12.5px; font-weight: 500; line-height: 1.35;
  pointer-events: none;
  opacity: 0; transform: translateY(-3px);
  transition: opacity 0.16s ease, transform 0.2s var(--ease-out);
}
.ui-tip.is-above { transform: translateY(3px); }
.ui-tip.is-on { opacity: 1; transform: none; }

/* ===== Куда ведёт ссылка (вместо серой строки адреса браузера) ===== */
.ui-link {
  position: fixed; z-index: 131; left: 14px; bottom: 14px;
  display: flex; align-items: center; gap: 9px;
  max-width: min(560px, calc(100vw - 28px));
  padding: 5px 12px 5px 6px;
  border: 1px solid color-mix(in srgb, var(--primary) 34%, var(--border-strong));
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: var(--shadow), 0 0 0 4px color-mix(in srgb, var(--primary) 7%, transparent), 0 12px 30px -14px color-mix(in srgb, var(--primary) 55%, transparent);
  color: var(--text); font-size: 12.5px; line-height: 1.3;
  pointer-events: none; overflow: hidden;
  opacity: 0; transform: translateY(10px) scale(0.97); transform-origin: 0 100%;
  transition: opacity 0.18s ease, transform 0.38s var(--ease-out);
}
.ui-link.is-right { left: auto; right: 14px; transform-origin: 100% 100%; }
.ui-link.is-on { opacity: 1; transform: none; }
/* по нижнему краю пробегает свет, как по шкале состояния колледжа */
.ui-link::after {
  content: ""; position: absolute; left: 16px; right: 16px; bottom: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  opacity: 0; transform: scaleX(0);
}
.ui-link.is-swap::after { animation: ui-link-beam 0.9s var(--ease-out) both; }
.ui-link-ic {
  flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  color: var(--primary);
  background: radial-gradient(closest-side, color-mix(in srgb, var(--primary) 28%, transparent), transparent);
}
.ui-link-ic .spark { display: block; width: 12px; height: 12px; filter: drop-shadow(0 0 4px var(--primary)); }
.ui-link-ic .spark path { fill: currentColor; }
.ui-link-ic .icon { width: 14px; height: 14px; }
.ui-link.is-swap .ui-link-ic > * { animation: ui-link-spin 0.6s var(--ease-out) both; }
.ui-link-text { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.ui-link-text b { flex: none; font-weight: 600; white-space: nowrap; }
.ui-link-url { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-family: var(--mono); font-size: 11.5px; }
.ui-link.is-swap .ui-link-text { animation: ui-link-text 0.34s var(--ease-out) both; }
.ui-link-flag { flex: none; padding: 2px 8px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 600; white-space: nowrap; }
.ui-link-flag[hidden] { display: none; }
@keyframes ui-link-beam { 0% { opacity: 0; transform: scaleX(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: scaleX(1); } }
@keyframes ui-link-spin { from { opacity: 0; transform: scale(0.4) rotate(-90deg); } }
@keyframes ui-link-text { from { opacity: 0; transform: translateX(-6px); } }
/* пока адрес спрятан в data-href, ссылка выглядит и ведёт себя как ссылка */
a[data-href] { cursor: pointer; }
@media (prefers-reduced-motion: reduce) {
  .ui-link { transition: none; }
  .ui-link::after, .ui-link.is-swap .ui-link-ic > *, .ui-link.is-swap .ui-link-text { animation: none; }
}

/* ===== Меню по правой кнопке ===== */
.ctx-menu {
  position: fixed; z-index: 125;
  min-width: 248px; max-width: min(300px, calc(100vw - 16px));
  padding: 6px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: var(--shadow), 0 20px 44px -20px rgba(0, 0, 0, 0.6);
  max-height: calc(100dvh - 16px); overflow-y: auto; overscroll-behavior: contain;
  transform-origin: 0 0;
  animation: ui-menu-in 0.16s var(--ease-out) both;
}
.ctx-sub { z-index: 126; min-width: 210px; }
.ctx-menu.from-right { transform-origin: 100% 0; }
.ctx-menu.from-bottom { transform-origin: 0 100%; }
.ctx-menu.from-right.from-bottom { transform-origin: 100% 100%; }
.ctx-menu.is-leaving { animation: ui-menu-out 0.12s ease-in both; }
.ctx-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: var(--radius-xs);
  background: transparent; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.ctx-item .icon { color: var(--muted); }
.ctx-item:hover:not(:disabled), .ctx-item:focus-visible { background: var(--surface-3); outline: none; }
.ctx-item:focus-visible { box-shadow: inset 0 0 0 2px var(--primary); }
.ctx-item:disabled { color: var(--faint); cursor: default; }
.ctx-item:disabled .icon { opacity: 0.5; }
.ctx-item kbd { font: inherit; font-size: 12px; color: var(--muted); }
.ctx-item[aria-expanded="true"] { background: var(--surface-3); }
.ctx-chevron { margin-right: -3px; }
.ctx-item.is-danger, .ctx-item.is-danger .icon { color: var(--red); }
.ctx-item.is-danger:hover:not(:disabled), .ctx-item.is-danger:focus-visible { background: var(--red-soft); }
.ctx-item.is-danger:disabled, .ctx-item.is-danger:disabled .icon, .ctx-item.is-danger:disabled kbd { color: var(--faint); }
.ctx-title { max-width: 288px; padding: 6px 10px 5px; overflow: hidden; color: var(--muted); font-size: 12.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.ctx-tools { display: flex; gap: 2px; }
.ctx-item.ctx-tool { flex: 1; justify-content: center; width: auto; padding: 8px 0; }
/* строка или карточка, для которой открыто меню */
.ctx-target { outline: 2px solid var(--primary); outline-offset: -2px; }
tr.ctx-target { outline: 0; }
tr.ctx-target > td { background: var(--primary-soft); }
.ctx-sep { height: 1px; margin: 5px 8px; background: var(--border); }
.ctx-foot { padding: 6px 10px 4px; font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--border); margin-top: 5px; }
.theme-swatch.is-mini { width: 24px; height: 24px; border-radius: 7px; }
.ctx-item[aria-checked="true"] .theme-check { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .ui-tip { transition: none; } .ctx-menu, .ctx-menu.is-leaving { animation: none; } }
@media print { .ui-tip, .ui-link, .ctx-menu { display: none !important; } }

/* ===== Свой курсор ввода в полях (caret.js) ===== */
.has-ui-caret { caret-color: transparent !important; }
.ui-caret-mirror { position: absolute; top: 0; left: -9999px; visibility: hidden; overflow: hidden; height: auto; }
.ui-caret {
  position: fixed; left: 0; top: 0; z-index: 70; width: 2px; height: 18px;
  border-radius: 1px; background: var(--primary);
  box-shadow: 0 0 6px color-mix(in srgb, var(--primary) 70%, transparent);
  pointer-events: none; opacity: 0;
  transition: transform 0.11s cubic-bezier(0.2, 0.8, 0.3, 1), height 0.15s ease, opacity 0.15s ease;
}
.ui-caret.no-glide { transition: opacity 0.15s ease; }
.ui-caret.is-on { opacity: 1; animation: caret-breathe 1.15s ease-in-out infinite; }
.ui-caret.is-on.is-typing { animation: none; opacity: 1; box-shadow: 0 0 9px var(--primary); }
.ui-caret.is-on.is-appearing { animation: caret-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes caret-breathe { 0%, 100% { opacity: 1; } 55% { opacity: 0.12; } }
@keyframes caret-in { from { clip-path: inset(50% 0 50% 0); } to { clip-path: inset(0); } }
@media (prefers-reduced-motion: reduce) { .ui-caret, .ui-caret.is-on { transition: none; animation: none; } }
@media print { .ui-caret { display: none; } }

/* ===== iPhone и iPad: системные элементы в цветах темы ===== */
/* Safari на iOS 26 красит «жидкое стекло» своих панелей по фону страницы и закреплённой шапке,
   поэтому фон задан и корню: панели, строка состояния и область «оттягивания» страницы — в цвет темы.
   Меню выбора фото, клавиатура, колёса даты и времени следуют color-scheme темы, а выделенные
   пункты в них, галочки и курсор ввода — фирменному васильковому (accent-color, caret-color). */
html {
  background-color: var(--bg);
  accent-color: var(--primary);
  caret-color: var(--primary);
  -webkit-tap-highlight-color: color-mix(in srgb, var(--primary) 18%, transparent);
}
/* iOS увеличивает страницу, если у поля шрифт меньше 16 px: на сенсорных экранах поля не мельче */
@media (pointer: coarse) {
  input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="color"]), select, textarea { font-size: max(16px, 1em); }
}
/* автозаполнение паролей и контактов: вместо жёлтой или голубой заливки системы — цвета темы */
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus, textarea:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset;
  caret-color: var(--primary);
  transition: background-color 9999s ease-out;
}
/* долгое нажатие на кнопки и схему не вызывает системную лупу и меню «Скопировать»; у ссылок и фото оно остаётся */
.btn, .pf, .pp-stage, .pp-shutter, .photo-thumb, .nav, .topbar .brand { -webkit-touch-callout: none; }

/* вырезы экрана: «чёлка» и Dynamic Island в альбомной ориентации, полоска «домой» снизу */
.topbar { padding-top: env(safe-area-inset-top); }
.topbar-inner { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
.page { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
.footer { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); padding-bottom: calc(30px + env(safe-area-inset-bottom)); }
.toasts { bottom: calc(20px + env(safe-area-inset-bottom)); }
.lightbox { padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.lightbox-close { top: max(16px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right)); }

/* на телефоне окна выезжают снизу листом, как системные на iPhone, но в цветах сайта:
   полупрозрачное стекло темы, ручка сверху, лист можно смахнуть вниз */
@media (max-width: 560px) {
  .overlay { align-items: flex-end; padding: max(12px, env(safe-area-inset-top)) 0 0; }
  /* .overlay > .modal сильнее общих правил анимации окна в motion.css */
  .overlay > .modal {
    --sheet-y: 0px;
    width: 100%;
    max-height: calc(100dvh - max(12px, env(safe-area-inset-top)) - 8px);
    padding-bottom: env(safe-area-inset-bottom);
    border-radius: 26px 26px 0 0;
    border-bottom: 0;
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    backdrop-filter: blur(22px) saturate(1.4);
    -webkit-backdrop-filter: blur(22px) saturate(1.4);
    box-shadow: 0 -18px 50px -20px rgba(0, 0, 0, 0.55), inset 0 1px 0 color-mix(in srgb, var(--text) 8%, transparent);
    transform: translateY(var(--sheet-y));
    transition: transform 0.35s var(--ease-out, ease-out);
    animation: sheet-up 0.46s var(--ease-out, ease-out) both;
  }
  .overlay > .modal::before {
    content: ""; display: block; width: 38px; height: 5px; margin: 8px auto 0; border-radius: 3px;
    background: color-mix(in srgb, var(--text) 26%, transparent);
  }
  .overlay > .modal.is-dragging { transition: none; }
  .modal-head { padding-top: 10px; touch-action: none; }
  :root .overlay.is-leaving { animation: fade-out 0.3s ease-in both; }
  :root .overlay.is-leaving > .modal { animation: sheet-down 0.3s ease-in both; }
}
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-down { from { transform: translateY(var(--sheet-y, 0px)); } to { transform: translateY(100%); } }
@keyframes fade-out { to { opacity: 0; } }
@media (max-width: 560px) and (prefers-reduced-motion: reduce) {
  .overlay > .modal, :root .overlay.is-leaving > .modal { animation: none; transition: none; }
}

/* ===== Звёздные полосы прокрутки (core.js) ===== */
/* системные полосы спрятаны везде: на iPhone их не оформить, а системную полосу браузер тянет сам,
   и курсор сайта при этом замирал. Свои полосы появляются при прокрутке и при наведении к краю */
html.has-ui-scroll, html.has-ui-scroll * { scrollbar-width: none; }
html.has-ui-scroll::-webkit-scrollbar, html.has-ui-scroll ::-webkit-scrollbar { display: none; width: 0; height: 0; }
html.is-scroll-drag, html.is-scroll-drag * { -webkit-user-select: none; user-select: none; }

.ui-scroll {
  position: fixed; z-index: 2147482000; left: 0; top: 0;
  width: 14px; height: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.55s ease;
}
.ui-scroll.is-x { width: 0; height: 14px; }
.ui-scroll.is-on, .ui-scroll.is-drag { opacity: 1; transition-duration: 0.15s; }
.ui-scroll.is-none { display: none; }
/* дорожка: пунктир из звёздной пыли, к концам тает */
.ui-scroll::before {
  content: ""; position: absolute; top: 0; bottom: 0; right: 4px; width: 5px;
  background: radial-gradient(circle, color-mix(in srgb, var(--primary) 70%, var(--text)) 0 0.75px, transparent 1.4px) center top / 5px 12px repeat-y;
  -webkit-mask: linear-gradient(transparent, #000 14%, #000 86%, transparent);
  mask: linear-gradient(transparent, #000 14%, #000 86%, transparent);
  opacity: 0.4;
  transition: opacity 0.3s;
}
.ui-scroll.is-x::before {
  top: auto; bottom: 4px; left: 0; right: 0; width: auto; height: 5px;
  background: radial-gradient(circle, color-mix(in srgb, var(--primary) 70%, var(--text)) 0 0.75px, transparent 1.4px) left center / 12px 5px repeat-x;
  -webkit-mask: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
  mask: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
}
/* ползунок: луч света, к концам тает, в середине искра 404 */
.ui-scroll-thumb {
  position: absolute; top: 0; right: 5px; width: 3px; border-radius: 999px;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--primary) 80%, var(--text)) 28%, color-mix(in srgb, var(--primary) 80%, var(--text)) 72%, transparent);
  box-shadow: 0 0 9px color-mix(in srgb, var(--primary) 55%, transparent);
  transition: width 0.25s var(--ease-out, ease-out), right 0.25s var(--ease-out, ease-out), height 0.25s, bottom 0.25s, box-shadow 0.25s;
}
.ui-scroll.is-x .ui-scroll-thumb {
  top: auto; right: auto; left: 0; bottom: 5px; width: 0; height: 3px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--primary) 80%, var(--text)) 28%, color-mix(in srgb, var(--primary) 80%, var(--text)) 72%, transparent);
}
.ui-scroll-star {
  position: absolute; left: 50%; top: 50%; width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px;
  transform: rotate(var(--spin, 0deg));
  transition: transform 0.25s ease-out, width 0.25s, height 0.25s, margin 0.25s;
}
.ui-scroll-star svg {
  display: block; width: 100%; height: 100%;
  fill: color-mix(in srgb, var(--text) 85%, var(--primary));
  filter: drop-shadow(0 0 2px var(--primary)) drop-shadow(0 0 6px color-mix(in srgb, var(--primary) 70%, transparent));
  animation: ui-star-twinkle 2.8s ease-in-out infinite;
}
@keyframes ui-star-twinkle { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(0.7); opacity: 0.7; } }
/* звёздная пыль, которая отлетает от искры при прокрутке */
.ui-scroll-dust { position: fixed; left: 0; top: 0; z-index: 2147482000; width: 12px; height: 12px; margin: -6px 0 0 -6px; pointer-events: none; }
.ui-scroll-dust svg { display: block; width: 100%; height: 100%; fill: color-mix(in srgb, var(--primary) 70%, var(--text)); filter: drop-shadow(0 0 3px var(--primary)); }
/* мышью полосу можно взять: у края она шире, искра крупнее, пыль на дорожке ярче */
@media (hover: hover) and (pointer: fine) {
  .ui-scroll.is-on, .ui-scroll.is-drag { pointer-events: auto; cursor: pointer; }
  .ui-scroll:hover::before, .ui-scroll.is-drag::before { opacity: 0.85; }
  .ui-scroll:hover .ui-scroll-thumb, .ui-scroll.is-drag .ui-scroll-thumb { width: 5px; right: 4px; box-shadow: 0 0 14px color-mix(in srgb, var(--primary) 80%, transparent); }
  .ui-scroll.is-x:hover .ui-scroll-thumb, .ui-scroll.is-x.is-drag .ui-scroll-thumb { width: 0; right: auto; height: 5px; bottom: 4px; }
  .ui-scroll:hover .ui-scroll-star, .ui-scroll.is-drag .ui-scroll-star { width: 17px; height: 17px; margin: -8.5px 0 0 -8.5px; }
}
/* окно поверх страницы: полоса страницы не показывается, у окна своя */
.fv-lock .ui-scroll.is-page, body:has(> .overlay, > .lightbox, > .tut-backdrop) .ui-scroll.is-page { display: none; }
@media (prefers-reduced-motion: reduce) {
  .ui-scroll, .ui-scroll-thumb, .ui-scroll-star { transition: none; }
  .ui-scroll-star svg { animation: none; }
}
@media print { .ui-scroll, .ui-scroll-dust { display: none !important; } }

/* Поле пароля без type="password" (SECRET_FIELD в core.js): символы скрыты */
[data-secret] { -webkit-text-security: disc; }

/* ===== Переход между страницами (page-transition.js) ===== */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { z-index: 9998; }
::view-transition-old(root) { z-index: 1; }
/* в «Кромешную тьму» сворачивается прежняя тема: её снимок лежит сверху */
html.vt-collapse::view-transition-old(root) { z-index: 9998; }
html.vt-collapse::view-transition-new(root) { z-index: 1; }

/* ===== Искры по краям выделения (selection.js) ===== */
.sel-spark { position: fixed; top: 0; left: 0; z-index: 124; width: 0; height: 0; pointer-events: none; opacity: 0; transition: opacity 0.14s ease; }
.sel-spark.is-on { opacity: 1; }
.sel-spark svg {
  display: block; width: var(--size); height: var(--size); margin: calc(var(--size) / -2) 0 0 calc(var(--size) / -2);
  fill: color-mix(in srgb, var(--primary) 45%, var(--text));
  filter: drop-shadow(0 0 3px var(--primary));
  transform-origin: center;
}
.sel-spark.is-start { --size: 11px; }
.sel-spark.is-end { --size: 15px; }
.sel-spark.is-on svg { animation: sel-pop 0.42s cubic-bezier(0.34, 1.56, 0.64, 1) both, sel-twinkle 2.6s ease-in-out 0.42s infinite; }
.sel-spark.is-start.is-on svg { animation-delay: 0s, 1.1s; }
@keyframes sel-pop { from { opacity: 0; transform: scale(0) rotate(-90deg); } }
@keyframes sel-twinkle { 50% { opacity: 0.55; transform: scale(0.72) rotate(45deg); } }
@media (prefers-reduced-motion: reduce) { .sel-spark.is-on svg { animation: none; } }
@media print { .sel-spark { display: none; } }

/* ===== Своё перетаскивание (lift.js) ===== */
img, a { -webkit-user-drag: none; }
.qr-thumb, .print-qr { user-select: none; cursor: grab; transition: opacity 0.18s ease, filter 0.18s ease; }
img.is-lifted { opacity: 0.16; filter: grayscale(1); transition: opacity 0.18s ease, filter 0.18s ease; }
a.is-lifted { opacity: 0.45; transition: opacity 0.18s ease; }
html.is-lifting, html.is-lifting * { user-select: none; cursor: grabbing; }
.qr-lift, .img-lift, .link-lift {
  position: fixed; top: 0; left: 0; z-index: 130; pointer-events: none;
  will-change: transform;
}
.qr-lift, .img-lift { border-radius: 14px; box-shadow: 0 26px 52px -14px rgba(8, 12, 24, 0.6), 0 0 34px -6px var(--primary); }
.qr-lift { --scan: var(--primary); background: #fff; }
.qr-lift img { display: block; width: 100%; height: 100%; padding: 6%; }
.img-lift { overflow: hidden; background: var(--surface); }
.img-lift img { display: block; width: 100%; height: 100%; object-fit: contain; }
.link-lift {
  display: inline-flex; align-items: center; gap: 10px;
  max-width: min(380px, calc(100vw - 24px)); padding: 9px 15px 9px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-size: 13px; line-height: 1.3;
  box-shadow: var(--shadow-lg), 0 0 26px -6px var(--primary);
}
.link-lift svg { flex: none; width: 15px; height: 15px; fill: var(--primary); filter: drop-shadow(0 0 4px var(--primary)); animation: cursor-carry 1.4s linear infinite; }
.link-lift-text { display: flex; flex-direction: column; min-width: 0; }
.link-lift-text b { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.link-lift-url { overflow: hidden; color: var(--muted); font-family: var(--mono); font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
/* рамка сканера: четыре уголка */
.qr-lift::before {
  content: ""; position: absolute; inset: -5%;
  --len: 18%; --th: 3px;
  background:
    linear-gradient(var(--scan) 0 0) left top / var(--len) var(--th),
    linear-gradient(var(--scan) 0 0) left top / var(--th) var(--len),
    linear-gradient(var(--scan) 0 0) right top / var(--len) var(--th),
    linear-gradient(var(--scan) 0 0) right top / var(--th) var(--len),
    linear-gradient(var(--scan) 0 0) left bottom / var(--len) var(--th),
    linear-gradient(var(--scan) 0 0) left bottom / var(--th) var(--len),
    linear-gradient(var(--scan) 0 0) right bottom / var(--len) var(--th),
    linear-gradient(var(--scan) 0 0) right bottom / var(--th) var(--len);
  background-repeat: no-repeat;
  animation: qr-frame 0.9s ease-in-out infinite alternate;
}
/* бегущая линия сканера */
.qr-lift::after {
  content: ""; position: absolute; left: 4%; right: 4%; top: 4%; height: 16%;
  background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--scan) 38%, transparent));
  border-bottom: 2px solid var(--scan);
  animation: qr-scan 1.25s ease-in-out infinite alternate;
}
.qr-lift.is-dropping::before, .qr-lift.is-dropping::after { opacity: 0; transition: opacity 0.14s ease; }
@keyframes qr-frame { to { transform: scale(1.035); } }
@keyframes qr-scan { to { transform: translateY(500%); } }
@media print { .qr-lift, .img-lift, .link-lift { display: none; } }

/* ===== Доступность ===== */
/* На сенсорном экране зона нажатия больше самой кнопки: проще попасть пальцем и в перчатках, внешне ничего не меняется.
   :where не перебивает кнопки, которые расположены абсолютно */
@media (pointer: coarse) {
  :where(.tab, .btn-sm, .nav a, .t-link, .segmented button) { position: relative; }
  .tab::after, .btn-sm::after, .nav a::after, .t-link::after, .segmented button::after { content: ""; position: absolute; inset: -5px -2px; }
}
/* Увеличение 400% на обычном экране: шапка умещается в 320 пикселей */
@media (max-width: 340px) {
  .topbar-inner { gap: 4px; padding-left: 10px; padding-right: 10px; }
  .topbar-inner > .btn:not(.btn-icon) { padding-left: 8px; padding-right: 8px; }
}
/* Человек попросил больше контраста в настройках системы: границы и второстепенный текст заметно сильнее */
@media (prefers-contrast: more) {
  :root, :root[data-theme="dark"], :root[data-theme="black"] {
    --border: rgba(237, 240, 244, 0.5);
    --border-strong: rgba(237, 240, 244, 0.75);
    --muted: rgba(237, 240, 244, 0.9);
    --faint: rgba(237, 240, 244, 0.85);
  }
  :root[data-theme="light"], :root[data-theme="sky"] {
    --border: rgba(12, 18, 34, 0.5);
    --border-strong: rgba(12, 18, 34, 0.75);
    --muted: rgba(12, 18, 34, 0.9);
    --faint: rgba(12, 18, 34, 0.85);
  }
}

/* Стенд для проверяющих: вход в панель из шапки. На телефоне надпись не помещается, вместо неё значок, шапка плотнее */
.topbar-admin .icon { display: none; }
@media (max-width: 599px) {
  .topbar-inner { gap: 4px; padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
  .topbar-inner > .btn.topbar-admin { width: 44px; padding: 0; justify-content: center; }
  .topbar-admin .icon { display: block; }
  .topbar-admin-text { display: none; }
}
@media (max-width: 400px) {
  .topbar-inner > .btn:not(.btn-icon):not(.topbar-admin) { padding-left: 8px; padding-right: 8px; }
}
/* 320 пикселей (iPhone SE первого поколения): ещё плотнее, кнопки-значки 40 пикселей */
@media (max-width: 359px) {
  .topbar-inner { gap: 2px; padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); }
  .topbar-inner > .btn:not(.btn-icon):not(.topbar-admin) { padding-left: 6px; padding-right: 6px; }
  .topbar-inner > .btn-icon, .topbar-inner > .btn.topbar-admin { width: 40px; min-width: 40px; }
}
