:root {
  --bg: #0d1117;
  --bg-grid: #131822;
  --panel: #161b22;
  --panel-border: #232a35;
  --panel-border-soft: #1c222c;
  --text: #e6edf3;
  --text-muted: #7d8590;
  --text-faint: #4b5563;

  --accent: #4fb8c9;
  --accent-soft: rgba(79, 184, 201, 0.12);

  --day: #3ecf8e;
  --day-soft: rgba(62, 207, 142, 0.14);
  --night: #7c83fd;
  --night-soft: rgba(124, 131, 253, 0.16);

  --danger: #f0a860;

  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --font-sans: 'IBM Plex Sans', system-ui, sans-serif;

  --radius: 10px;
}

:root[data-theme="light"] {
  --bg: #eef1f5;
  --bg-grid: #e2e7ed;
  --panel: #ffffff;
  --panel-border: #d7dde4;
  --panel-border-soft: #e3e8ee;
  --text: #1a2027;
  --text-muted: #5b6572;
  --text-faint: #9aa4b2;

  --accent: #1f8fa3;
  --accent-soft: rgba(31, 143, 163, 0.1);

  --day: #1f9d64;
  --day-soft: rgba(31, 157, 100, 0.12);
  --night: #6a5ef5;
  --night-soft: rgba(106, 94, 245, 0.14);

  --danger: #c9762e;
}

/* Тема "RTSK" — по цветам со скриншота портала sd.rtsk.loc (тёмно-бирюзовый
   хедер #0d4b62, синие ссылки #0a5896, светлые панели на белом фоне) —
   палитра снята попиксельно, не на глаз. Без структурных правок вёрстки,
   как и у остальных тем, — только переменные. */
:root[data-theme="rtsk"] {
  --bg: #eef2f5;
  --bg-grid: #e1e8ed;
  --panel: #ffffff;
  --panel-border: #cfdce4;
  --panel-border-soft: #e1eaee;
  --text: #123447;
  --text-muted: #4d7186;
  --text-faint: #93aab6;

  --accent: #0a5896;
  --accent-soft: rgba(10, 88, 150, 0.1);

  --day: #1f9d64;
  --day-soft: rgba(31, 157, 100, 0.12);
  --night: #6a5ef5;
  --night-soft: rgba(106, 94, 245, 0.14);

  --danger: #c9762e;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background:
    linear-gradient(var(--bg-grid) 1px, transparent 1px) 0 0 / 100% 28px,
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px) 0 0 / 28px 100%,
    var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.hidden { display: none !important; }

.login {
  width: 100%;
  max-width: 360px;
  display: flex;
  justify-content: center;
}

.login__panel {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login__title {
  margin: 0 0 18px;
  font-size: 19px;
  font-weight: 600;
  color: var(--text);
}

.text-input {
  appearance: none;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  padding: 10px 12px;
  margin: 6px 0 16px;
  transition: border-color 0.15s ease;
}

.text-input::placeholder { color: var(--text-faint); }

.text-input:focus {
  outline: none;
  border-color: var(--accent);
}

.login .submit {
  margin-top: 4px;
}

.console {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.console__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand__eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 6px;
}

.brand__title {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.header__right {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-left: auto; /* прижимает блок (и аватар) к правому краю, даже когда
                         .console__header переносит его на отдельную строку —
                         на такой строке space-between с одним элементом не
                         работает, а auto-margин работает всегда */
}

.readout {
  text-align: right;
  font-family: var(--font-mono);
}

.readout__row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.readout__clock {
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.readout__date {
  font-size: 12px;
  color: var(--text-muted);
}

.readout__row--shift {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.readout__divider { color: var(--text-faint); }

.shift-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--day);
  box-shadow: 0 0 0 3px var(--day-soft);
  animation: pulse 2.4s ease-in-out infinite;
}

.shift-dot.is-night {
  background: var(--night);
  box-shadow: 0 0 0 3px var(--night-soft);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

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

.field__label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.field__hint {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-faint);
}

.segmented {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 3px;
  width: fit-content;
}

.segmented__option {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 18px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

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

.segmented__option.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.segmented__option:focus-visible,
.chip:focus-visible,
.submit:focus-visible,
.text-input:focus-visible,
.mini-add:focus-visible,
.mini-remove:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Режим редактирования (админ, req_form): чип + кнопка удаления рядом с
   ним рассматриваются как одна единица внутри .chips flex-wrap. */
.chip-wrap {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.chip {
  appearance: none;
  border: 1px solid var(--panel-border);
  background: var(--bg);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 500;
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--text);
}

.chip.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.preview {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px dashed var(--panel-border);
  border-radius: 8px;
}

.preview__label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.preview__filename {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
  word-break: break-all;
  transition: color 0.2s ease;
}

.preview__filename.is-ready { color: var(--accent); }

.submit {
  appearance: none;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #06181c;
  font-family: var(--font-sans);
  font-size: 14.5px;
  font-weight: 600;
  padding: 13px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: opacity 0.15s ease, transform 0.05s ease;
}

.submit:disabled {
  background: var(--panel-border);
  color: var(--text-faint);
  cursor: not-allowed;
}

.submit:not(:disabled):hover { opacity: 0.92; }
.submit:not(:disabled):active { transform: scale(0.99); }

.submit__spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(6, 24, 28, 0.35);
  border-top-color: #06181c;
  display: none;
}

.submit.is-loading .submit__spinner {
  display: inline-block;
  animation: spin 0.7s linear infinite;
}

.submit.is-loading .submit__label { opacity: 0.85; }

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

.status-line {
  margin: 0;
  min-height: 16px;
  font-size: 12.5px;
  color: var(--danger);
}

.status-line.is-success { color: var(--day); }
.status-line.is-info { color: var(--accent); }

.group-card {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg);
}

.group-card + .group-card { margin-top: 12px; }

.group-card__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.group-card__form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.mini-input {
  appearance: none;
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 12.5px;
  padding: 8px 10px;
}

.mini-input::placeholder { color: var(--text-faint); }

.mini-input:focus {
  outline: none;
  border-color: var(--accent);
}

.mini-add {
  appearance: none;
  border: 1px dashed var(--accent);
  background: transparent;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  width: fit-content;
  transition: background 0.15s ease;
}

.mini-add:hover { background: var(--accent-soft); }

.mini-add--danger {
  border-color: var(--danger);
  color: var(--danger);
}

.mini-add--danger:hover { background: rgba(240, 168, 96, 0.12); }

.role-card__meta {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: -6px;
}

.role-card__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.permission-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.permission-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 2px;
}

.permission-row__label {
  font-size: 13.5px;
  color: var(--text);
}

.switch {
  appearance: none;
  border: none;
  padding: 0;
  width: 40px;
  height: 24px;
  border-radius: 999px;
  background: var(--panel-border);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.switch::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease;
}

.switch.is-active {
  background: var(--accent);
}

.switch.is-active::before {
  transform: translateX(16px);
}

.switch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.group-card__rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.group-card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--panel-border-soft);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.group-card__row-text {
  flex: 1 1 auto;
  min-width: 0; /* иначе flex-элемент не сжимается меньше содержимого — текст
                   разной длины двигал бы кнопки в разные позиции по строкам */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-card__row > .mini-add,
.group-card__row > .mini-copy,
.group-card__row > .mini-remove {
  flex-shrink: 0;
}

.mini-remove {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--danger);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

/* Конструктор референса */

.block-editor {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.block-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--panel-border-soft);
  border-radius: 8px;
  padding: 10px;
}

.block-item__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.token-btn {
  appearance: none;
  border: 1px dashed var(--panel-border);
  background: var(--bg);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.token-btn:hover { border-color: var(--accent); background: var(--accent-soft); }

.block-item__remove { margin-left: auto; }

.block-item__textarea {
  margin: 0;
  resize: vertical;
  min-height: 64px;
}

.load-block-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--panel-border-soft);
  border-radius: 6px;
  padding: 7px 10px;
}

.load-block-row .text-input {
  margin: 0;
  flex: 1;
}

.load-block-row__token {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  white-space: nowrap;
}

.group-card__empty {
  font-size: 12px;
  color: var(--text-faint);
  font-style: italic;
}

/* Вкладки профиля */

.tab-panel {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* Безопасность: сессии, 2FA */

.session-row__badge {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--day);
  border: 1px solid var(--day);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}

.totp-qr {
  width: 180px;
  height: 180px;
  border-radius: 8px;
  border: 1px solid var(--panel-border-soft);
  background: #fff;
  padding: 8px;
}

.backup-codes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}

.backup-codes__item {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--panel-border-soft);
  border-radius: 6px;
  padding: 6px 8px;
  text-align: center;
}

.console__footer {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

@media (prefers-reduced-motion: reduce) {
  .shift-dot { animation: none; }
  .submit__spinner { animation: none; }
}

@media (max-width: 420px) {
  .console__header { flex-direction: column; }
  .readout { text-align: left; }
  .readout__row,
  .readout__row--shift { justify-content: flex-start; }
  .panel { padding: 18px; }
  .header__right { width: 100%; justify-content: space-between; align-items: center; }
}

/* ============== Меню профиля (аватар + dropdown / bottom sheet) ============== */

.profile {
  position: relative;
  z-index: 41;
}

.profile__trigger {
  appearance: none;
  border: 1px solid var(--panel-border);
  background: var(--bg);
  border-radius: 999px;
  padding: 0;
  width: 34px;
  height: 34px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease;
}

.profile__trigger:hover { border-color: var(--accent); }

.profile__trigger[aria-expanded="true"] { border-color: var(--accent); }

.profile__trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.profile__avatar {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 999px;
}

.profile__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile__dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 220px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 42;
}

.profile__dropdown.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.profile__sheet-handle { display: none; }

.profile__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 10px 10px;
}

.profile__name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.profile__role {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.profile__divider {
  height: 1px;
  background: var(--panel-border-soft);
  margin: 4px 0;
}

.profile__item {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 13.5px;
  text-align: left;
  padding: 9px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.profile__item:hover { background: var(--accent-soft); color: var(--accent); }

.profile__item--danger:hover { background: rgba(240, 168, 96, 0.12); color: var(--danger); }

.profile__item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.device-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(240, 168, 96, 0.12);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text);
}

.device-alert__text { flex: 1; }

.device-alert__close {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--danger);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: transparent;
  pointer-events: none;
  z-index: 40;
}

.sheet-backdrop.is-open { pointer-events: auto; }

@media (max-width: 420px) {
  .profile__dropdown {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
    box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.5);
  }

  .profile__dropdown.is-open { transform: translateY(0); }

  .profile__sheet-handle {
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 999px;
    background: var(--panel-border);
    margin: 2px auto 10px;
  }

  .profile__item { font-size: 15px; padding: 12px 10px; }

  .sheet-backdrop.is-open { background: rgba(6, 10, 16, 0.6); }
}

/* ============== Подстраницы (Профиль / Настройки / FAQ) ============== */

.subpage-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.subpage-nav__back {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 6px 12px;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.subpage-nav__back:hover { border-color: var(--accent); color: var(--accent); }

.subpage-nav .profile__item--danger {
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 6px 12px;
}

.info-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.info-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--panel-border-soft);
  border-radius: 8px;
}

.info-row__label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.info-row__value {
  font-size: 13.5px;
  color: var(--text);
  text-align: right;
  word-break: break-word;
}

.mini-copy {
  appearance: none;
  border: 1px solid var(--panel-border);
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  line-height: 1;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.mini-copy:hover { background: var(--accent-soft); }

.avatar-upload {
  display: flex;
  align-items: center;
  gap: 16px;
}

.avatar-upload__preview {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  color: var(--accent);
}

.avatar-upload__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-upload__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar-upload__actions .mini-add { cursor: pointer; }

.crop-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.crop-modal.is-open { display: flex; }

.crop-modal__panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 340px;
  width: 100%;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.crop-modal__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  align-self: flex-start;
}

.crop-stage {
  width: 260px;
  height: 260px;
  max-width: 100%;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  cursor: grab;
  touch-action: none;
}

.crop-stage.is-dragging { cursor: grabbing; }

.crop-stage__img {
  position: absolute;
  top: 50%;
  left: 50%;
  max-width: none;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.crop-zoom {
  width: 100%;
  accent-color: var(--accent);
}

.crop-modal__actions {
  display: flex;
  gap: 10px;
  width: 100%;
}

.crop-modal__actions .mini-add {
  flex: 1;
  width: auto;
  text-align: center;
}

/* Модалки создания направления/типа отчёта (req_form, режим редактирования) —
   та же оверлей-механика, что у .crop-modal, но шире и без кропа. */
.form-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.form-modal.is-open { display: flex; }

.form-modal__panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 420px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.form-modal__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.form-modal__actions {
  display: flex;
  gap: 10px;
  width: 100%;
}

.form-modal__actions .mini-add {
  flex: 1;
  width: auto;
  text-align: center;
}

.crop-modal__actions .submit { flex: 1; }

/* ============== Читалка ============== */

.viewer-row { cursor: pointer; }
.viewer-row:hover { border-color: var(--accent); }

/* Полноэкранный редактор отчёта (OnlyOffice) — сознательно ВНЕ .console:
   узкие 480px, в которые вписан весь остальной сайт, не годятся для
   полноценного редактора документов. */

body.oo-body {
  display: block;
  padding: 0;
  min-height: 100vh;
}

.oo-page {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.oo-page__header {
  padding: 16px 24px;
  flex-shrink: 0;
}

.oo-page__status {
  margin: 0 24px;
  flex-shrink: 0;
}

.oo-editor {
  flex: 1;
  min-height: 0; /* иначе flex-контейнер не даст iframe внутри сжаться/растянуться на всю высоту */
}

.oo-editor iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* ============== FAQ ============== */

.faq {
  gap: 28px;
}

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

.faq__q {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.faq__a {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-muted);
}

.faq__list {
  margin: 0;
  padding-left: 20px;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-muted);
}

.faq__a code,
.faq__table code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 5px;
  border-radius: 4px;
}

.faq__table-wrap { overflow-x: auto; }

.faq__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.faq__table th,
.faq__table td {
  text-align: left;
  padding: 8px 10px;
  border: 1px solid var(--panel-border-soft);
  color: var(--text-muted);
  vertical-align: top;
}

.faq__table th {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--bg);
}
