* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, 'Segoe UI', Roboto, sans-serif; background: #f1f4f9; color: #1f2937; line-height: 1.55; }

/* Пунктов в меню администратора девять, и на ноутбучном экране они
   начинали переноситься по слогам: «Промпты ИИ» в две строки, имя
   пользователя в три. Разрешаем перенос целыми пунктами и запрещаем
   рвать сами подписи. */
.topnav { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; background: #17325e; color: #fff; padding: 10px 22px; }
.topnav a { color: #cfe0ff; text-decoration: none; padding: 6px 9px; border-radius: 8px; white-space: nowrap; }
.topnav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.topnav .spacer, .filterbar .spacer { flex: 1; }
.topnav .who { color: #9db8e8; font-size: 13px; white-space: nowrap; }
.topnav .logout { border: 1px solid rgba(255,255,255,.3); }

.brand { font-weight: 800; font-size: 20px; letter-spacing: .5px; }
.brand span { color: #6ea8ff; }
.brand em { font-style: normal; font-size: 11px; color: #9db8e8; margin-left: 6px; }
.brand.big { font-size: 30px; color: #17325e; margin-bottom: 4px; }
.brand.big span { color: #2f6fd6; }

.wrap { max-width: 1180px; margin: 22px auto; padding: 0 18px; }
.center { max-width: 760px; margin: 6vh auto; padding: 0 16px; }
.center-text { text-align: center; }

.card { background: #fff; border-radius: 14px; padding: 20px 22px; margin-bottom: 18px; box-shadow: 0 3px 14px rgba(23,50,94,.07); }
.login-card { max-width: 420px; margin: 0 auto; text-align: center; }
.login-card form { text-align: left; margin-top: 14px; }
.test-card { max-width: 720px; margin: 0 auto; }

h1 { font-size: 24px; color: #17325e; }
h2 { font-size: 17px; margin-bottom: 12px; color: #17325e; }
h3 { font-size: 15px; margin: 14px 0 8px; color: #17325e; }
.muted { color: #6b7280; } .small { font-size: 13px; } .dim { opacity: .55; }
.nowrap { white-space: nowrap; }

.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; max-width: 100%; }
/* Формы внутри блока кнопок тоже должны переноситься. Форма импорта —
   поле выбора файла плюс кнопка — на телефоне вылезала за правый край,
   и «Импорт из XLSX» оказывалась за пределами экрана. */
.actions form { display: inline-flex; gap: 6px; align-items: center;
                flex-wrap: wrap; max-width: 100%; }
.actions input[type=file] { max-width: 100%; }
@media (max-width: 560px) {
  .actions, .actions form { width: 100%; }
  .actions .btn { flex: 1 1 auto; justify-content: center; }
}

label { display: block; margin-bottom: 12px; font-size: 14px; color: #374151; }
input, select, textarea { width: 100%; padding: 9px 12px; border: 1px solid #d3dae6; border-radius: 9px; font-size: 14px; font-family: inherit; background: #fff; }
/* галочки и переключатели под общее «во всю ширину» не подпадают: внутри
   строки они растягивались на весь ряд и выдавливали карточку заявки */
input[type=checkbox], input[type=radio] { width: auto; flex: 0 0 auto; padding: 0; }
textarea { resize: vertical; }
/* строка очереди: галочка выбора слева, карточка занимает остальное */
.taskrow { display: flex; align-items: center; gap: 10px; }
.taskrow .task { flex: 1 1 auto; min-width: 0; }
.row { display: flex; gap: 10px; } .row input { flex: 1; }
.rowwrap { display: flex; gap: 10px; flex-wrap: wrap; }
.rowwrap input, .rowwrap select { width: auto; flex: 1; min-width: 160px; }
.inline-filter select { width: auto; }

/* white-space: nowrap — надпись на кнопке не переносится по слогам.
   Переноситься умеет ряд кнопок целиком, отдельная кнопка — нет. */
.btn { display: inline-block; padding: 8px 16px; border-radius: 9px; border: 1px solid #cbd5e6; background: #fff; color: #1f2937; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #2f6fd6; color: #17325e; }
.btn.primary { background: #2f6fd6; border-color: #2f6fd6; color: #fff; }
.btn.primary:hover { background: #275db4; }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.wide { width: 100%; }
/* Необратимое действие. Красный не заливкой, а контуром: кнопка стоит
   рядом с обычными и не должна перетягивать взгляд на себя. */
.btn.danger { border-color: #e5b4b4; color: #b91c1c; }
.btn.danger:hover { border-color: #b91c1c; background: #fef2f2; color: #991b1b; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.flash { padding: 11px 16px; border-radius: 10px; margin-bottom: 14px; background: #e7f6ee; color: #0b6b3a; border: 1px solid #b8e6cc; }
.flash.err { background: #fdeaea; color: #9b1c1c; border-color: #f3c2c2; }
.flash.warn { background: #fff4dd; color: #8a5300; border-color: #f5d79a; }

.hint { margin-top: 16px; font-size: 13px; color: #6b7280; background: #f6f8fc; border-radius: 10px; padding: 10px 14px; text-align: left; }

.cards4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: #fff; border-radius: 14px; padding: 16px 20px; box-shadow: 0 3px 14px rgba(23,50,94,.07); }
.stat b { font-size: 30px; color: #17325e; display: block; }
.stat span { color: #6b7280; font-size: 13px; }
.stat.amber b { color: #b45309; } .stat.green b { color: #047857; }

.grid1 { display: grid; grid-template-columns: 1fr; gap: 18px; margin-bottom: 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }

/* Таблица не должна распирать карточку. Виновники — длинные строки
   без пробелов: ссылка с токеном в тексте письма, почта вида
   очень.длинный.адрес@домен. Браузер не переносит их по умолчанию
   и раздвигает колонки, а вместе с ними и всю страницу. */
table { width: 100%; border-collapse: collapse; font-size: 14px;
        table-layout: auto; }
th { text-align: left; color: #6b7280; font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .3px; }
/* break-word, а не anywhere: рвём слово, только если оно не влезает
   целиком. С anywhere почта и служебная метка рассыпались по слогам
   («auth_in vite»), потому что браузер учитывал такой перенос уже
   при расчёте ширины колонок. */
th, td { padding: 8px 10px; border-bottom: 1px solid #eef1f6; vertical-align: middle;
         overflow-wrap: break-word; }
td.nowrap, th.nowrap { overflow-wrap: normal; }
/* Метки статусов и типов не переносим: они короткие и должны читаться
   одним словом. */
td .tag { white-space: nowrap; }
tr:last-child td { border-bottom: none; }
/* Широкие таблицы (отчёты, журнал) на узком экране прокручиваются
   внутри карточки, а не выталкивают страницу вбок. */
.card { overflow-x: auto; }

.tag { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12.5px; background: #eef1f6; color: #4b5563; text-decoration: none; }
.tag.pub { background: #e7f6ee; color: #0b6b3a; }
.tag.review { background: #fff4dd; color: #92600a; }
.tag.refused { background: #fdeaea; color: #9b1c1c; }
.tag.expired { background: #f3e8ff; color: #6d28d9; }
.tag.b24 { background: #e3edff; color: #1d4ed8; }

.zone { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; color: #fff; }
.zone.green { background: #10b981; } .zone.yellow { background: #f59e0b; }
.zone.orange { background: #f97316; } .zone.red { background: #ef4444; }

.chart { height: 320px; } .chart.tall { height: 380px; } .chart.short { height: 200px; }

.linkbox { font-family: Consolas, monospace; font-size: 12px; color: #475569; background: #f6f8fc; padding: 3px 8px; border-radius: 7px; display: inline-block; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }

.scalebars { display: flex; flex-direction: column; gap: 7px; margin: 10px 0; }
.scalebar { display: flex; align-items: center; gap: 10px; }
.scalebar .sname { width: 260px; font-size: 13.5px; }
.scalebar .bar { flex: 1; height: 12px; background: #eef1f6; border-radius: 6px; overflow: hidden; }
.scalebar .fill { height: 100%; border-radius: 6px; }
.fill.green { background: #10b981; } .fill.yellow { background: #f59e0b; }
.fill.orange { background: #f97316; } .fill.red { background: #ef4444; }
.scalebar .sval { width: 52px; text-align: right; font-size: 13px; color: #374151; }

.redbox { background: #fdeaea; border-left: 4px solid #ef4444; border-radius: 8px; padding: 10px 14px; margin: 10px 0; font-size: 14px; }
.warnbox { background: #fff4dd; border-left: 4px solid #f59e0b; border-radius: 8px; padding: 10px 14px; margin: 10px 0; font-size: 14px; }
.aibox { background: #eef4ff; border-left: 4px solid #2f6fd6; border-radius: 8px; padding: 10px 14px; margin-top: 12px; font-size: 14px; }

/* overflow-wrap: anywhere — чтобы ссылка с длинным токеном в тексте
   письма или заключения переносилась, а не растягивала блок на всю
   свою длину. Найдено на экране «Письма»: раскрытое письмо со ссылкой
   для установки пароля выдавливало колонки «Тип» и «Статус» за экран. */
pre, .rec-text { white-space: pre-wrap; overflow-wrap: anywhere;
                 font-family: inherit; font-size: 14px; background: #f8fafc;
                 border-radius: 10px; padding: 12px 14px; }
.rec { margin-bottom: 14px; }
.rec-head { font-weight: 600; margin-bottom: 6px; color: #17325e; }

.task { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: #fff; border-radius: 12px; padding: 13px 18px; margin-bottom: 9px; box-shadow: 0 2px 8px rgba(23,50,94,.06); text-decoration: none; color: inherit; border-left: 4px solid transparent; }
.task:hover { box-shadow: 0 4px 14px rgba(23,50,94,.12); }
.task.critical { border-left-color: #ef4444; background: #fffafa; }
.firemark { color: #b91c1c; font-weight: 700; font-size: 12.5px; margin-right: 6px; }
.task .zone { margin-left: 8px; }
.over { color: #b91c1c; }

.filterbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; }
.filterbar select { width: auto; }
.chk { display: flex; align-items: center; gap: 6px; margin: 0; white-space: nowrap; }
.chk input { width: auto; }
.counts { display: flex; gap: 8px; }

.note { border-top: 1px solid #eef1f6; padding: 9px 0; font-size: 14px; }
.hist { border-top: 1px solid #eef1f6; padding: 9px 0; }
.hist:first-of-type { border-top: none; }
.hist-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* test taking */
.test-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 14px; }
.progress-wrap { flex: 1; max-width: 320px; min-width: 120px; }
/* nowrap обязателен: на узком экране блок сжимался, и счётчик «0 / 40»
   рассыпался на три строки — цифра, дробь, цифра. */
.progress-info { font-size: 12.5px; color: #6b7280; text-align: right;
                 margin-bottom: 3px; white-space: nowrap; }
.progress-bar { background: #e7ebf3; height: 9px; border-radius: 5px; overflow: hidden; }
#pfill { height: 100%; width: 0; background: linear-gradient(90deg, #2f6fd6, #6ea8ff); transition: width .3s; }
.question { padding: 14px 0; border-bottom: 1px solid #eef1f6; }
.q-text { font-size: 15.5px; margin-bottom: 10px; }
.q-num { display: inline-block; min-width: 26px; font-weight: 700; color: #2f6fd6; }
.options { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.option { text-align: center; padding: 9px 4px; border: 1.5px solid #d3dae6; border-radius: 9px; cursor: pointer; font-size: 13px; user-select: none; }
.option:hover { border-color: #2f6fd6; }
.option.selected { background: #2f6fd6; border-color: #2f6fd6; color: #fff; }
@media (max-width: 560px) {
  .options { grid-template-columns: 1fr 1fr; }
  .options .option:last-child { grid-column: span 2; }
  /* На телефоне название теста и прогресс не помещаются в одну строку:
     ставим их друг под другом, полоса растягивается на всю ширину. */
  .test-head { flex-direction: column; align-items: stretch; gap: 8px; }
  .progress-wrap { max-width: none; }
  .progress-info { text-align: left; }
}
.test-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; }
.chipbox { display: flex; flex-wrap: wrap; gap: 6px; max-height: 180px; overflow-y: auto; padding: 6px; background: #f8fafc; border-radius: 10px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; background: #fff; border: 1px solid #d3dae6; border-radius: 99px; font-size: 13px; margin: 0; cursor: pointer; white-space: nowrap; }
.chip input { width: auto; }
.chip em { color: #9ca3af; font-size: 11.5px; }
details summary { cursor: pointer; }

@media print {
  .topnav, .noprint, .flash { display: none !important; }
  body { background: #fff; padding: 0; }
  .wrap { max-width: 100%; margin: 0; }
  .card { box-shadow: none; border: 1px solid #d9dee8; page-break-inside: avoid; }
  .avoid-break { page-break-inside: avoid; }
}

.consent ul { margin: 10px 0 10px 22px; }
.consent li { margin: 7px 0; }
.consent-actions { display: flex; gap: 10px; margin-top: 16px; }
.bigcheck { font-size: 54px; color: #10b981; }
