/* FrostForms Design System */
:root {
  --frost-bg: #2f3136;
  --frost-bg-elevated: #36393f;
  --frost-bg-input: #202225;
  --frost-border: #202225;
  --frost-border-subtle: #23272a;
  --frost-text: #ffffff;
  --frost-text-muted: #b9bbbe;
  --frost-text-dim: #72767d;
  --frost-primary: #5865f2;
  --frost-primary-hover: #4752c4;
  --frost-success: #43b581;
  --frost-success-hover: #3aa374;
  --frost-danger: #ed4245;
  --frost-danger-hover: #c93b3e;
  --frost-warning: #faa61a;
  --frost-warning-hover: #e09416;
  --frost-neutral: #4f545c;
  --frost-neutral-hover: #5d6269;
  --frost-radius-sm: 6px;
  --frost-radius: 8px;
  --frost-radius-lg: 12px;
  --frost-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  --frost-shadow-toast: 0 8px 24px rgba(0, 0, 0, 0.45);
  --frost-font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --frost-btn-height: 42px;
  --frost-btn-height-sm: 32px;
}

html,
body {
  background: var(--frost-bg);
  color: var(--frost-text);
  font-family: var(--frost-font);
  margin: 0;
  padding: 0;
  width: 100%;
  height: auto !important;
  min-height: 100vh !important;
  overflow: auto !important;
  overflow-y: auto !important;
}

body {
  display: block !important;
  box-sizing: border-box;
}

.card {
  max-width: 1200px;
  width: calc(100% - 40px);
  background: var(--frost-bg-elevated);
  padding: 30px;
  border-radius: var(--frost-radius-lg);
  border: 1px solid var(--frost-border);
  box-shadow: var(--frost-shadow);
  margin: 40px auto;
  height: auto !important;
  min-height: auto !important;
  overflow: visible !important;
  box-sizing: border-box;
}

h2 {
  color: var(--frost-primary);
  border-bottom: 1px solid var(--frost-bg);
  padding-bottom: 15px;
  margin-top: 0;
}

h3 {
  color: var(--frost-success);
  margin-top: 25px;
}

/* ——— Buttons ——— */
.frost-btn,
.btn-submit,
.btn-secondary,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--frost-btn-height);
  padding: 0 18px;
  border-radius: var(--frost-radius);
  border: 1px solid transparent;
  font-family: var(--frost-font);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.12s, opacity 0.2s;
  white-space: nowrap;
  user-select: none;
}

.frost-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.frost-btn:disabled,
.frost-btn.is-loading {
  opacity: 0.65;
  cursor: wait;
  pointer-events: none;
}

.frost-btn--block,
.btn-submit {
  width: 100%;
}

.frost-btn--sm {
  min-height: var(--frost-btn-height-sm);
  padding: 0 12px;
  font-size: 13px;
  border-radius: var(--frost-radius-sm);
}

.frost-btn--icon {
  min-width: var(--frost-btn-height-sm);
  padding: 0 10px;
}

.frost-btn--primary,
.btn-submit {
  background: var(--frost-primary);
  color: #fff;
  border-color: var(--frost-primary);
}

.frost-btn--primary:hover:not(:disabled),
.btn-submit:hover:not(:disabled) {
  background: var(--frost-primary-hover);
  border-color: var(--frost-primary-hover);
  color: #fff;
}

.frost-btn--success {
  background: var(--frost-success);
  color: #fff;
  border-color: var(--frost-success);
}

.frost-btn--success:hover:not(:disabled) {
  background: var(--frost-success-hover);
  border-color: var(--frost-success-hover);
}

.frost-btn--secondary,
.btn-secondary {
  background: var(--frost-neutral);
  color: #fff;
  border-color: var(--frost-neutral);
  margin-bottom: 0;
}

.frost-btn--secondary:hover:not(:disabled),
.btn-secondary:hover:not(:disabled) {
  background: var(--frost-neutral-hover);
  border-color: var(--frost-neutral-hover);
  color: #fff;
}

.frost-btn--danger,
.btn-danger {
  background: var(--frost-danger);
  color: #fff;
  border-color: var(--frost-danger);
}

.frost-btn--danger:hover:not(:disabled),
.btn-danger:hover:not(:disabled) {
  background: var(--frost-danger-hover);
  border-color: var(--frost-danger-hover);
}

.frost-btn--warning {
  background: var(--frost-warning);
  color: #1e1f22;
  border-color: var(--frost-warning);
}

.frost-btn--warning:hover:not(:disabled) {
  background: var(--frost-warning-hover);
  border-color: var(--frost-warning-hover);
}

.frost-btn--outline {
  background: transparent;
  color: var(--frost-primary);
  border-color: var(--frost-primary);
}

.frost-btn--outline:hover:not(:disabled) {
  background: rgba(88, 101, 242, 0.15);
  color: #fff;
}

.frost-btn__spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: frostSpin 0.7s linear infinite;
  flex-shrink: 0;
}

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

/* ——— Form controls ——— */
.form-group {
  margin-bottom: 15px;
}

label {
  display: block;
  margin-bottom: 8px;
  color: var(--frost-text-muted);
  font-weight: 600;
  font-size: 14px;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.4;
}

.input-field {
  width: 100%;
  padding: 12px;
  background: var(--frost-bg-input);
  border: 1px solid var(--frost-border-subtle);
  border-radius: var(--frost-radius-sm);
  color: var(--frost-text);
  box-sizing: border-box;
  font-size: 15px;
  font-family: var(--frost-font);
  margin-bottom: 5px;
  transition: border-color 0.2s;
}

.input-field:focus {
  border-color: var(--frost-primary);
  outline: none;
}

.frost-hint {
  background: var(--frost-bg-input);
  border-left: 4px solid var(--frost-primary);
  padding: 12px 14px;
  border-radius: var(--frost-radius-sm);
  margin-bottom: 22px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--frost-text-muted);
}

/* ——— List / nav buttons ——— */
.item-btn {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 15px;
  background: var(--frost-bg);
  border: 1px solid var(--frost-border);
  border-radius: var(--frost-radius-sm);
  color: #dcddde;
  text-align: left;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 12px;
  text-decoration: none;
  transition: 0.2s;
  box-sizing: border-box;
}

a.item-btn.frost-dept-btn,
div.item-btn.frost-dept-btn {
  display: flex !important;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.frost-dept-btn__icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex: none;
}

.frost-dept-btn__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: none;
}

.frost-dept-btn__label {
  flex: none;
  font-weight: 700;
}

.frost-dept-btn__title {
  flex: 1 1 120px;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.frost-dept-btn__maint {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--frost-warning);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.frost-dept-btn__closed {
  flex: 0 0 auto;
  margin-left: auto;
  color: #8a8e96;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

/* Неактивные кнопки (техобслуживание / заявка закрыта): hover как у .item-btn, курсор «запрещено» */
.item-btn.frost-dept-btn--maint:hover,
.item-btn.frost-dept-btn--closed:hover {
  background: var(--frost-neutral);
  color: #fff;
  border-color: var(--frost-primary);
  cursor: not-allowed !important;
}

.frost-form-closed-status {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #8a8e96;
  background: rgba(114, 118, 125, 0.2);
  border: 1px solid rgba(114, 118, 125, 0.35);
  border-radius: 4px;
  cursor: default;
  pointer-events: none;
  opacity: 0.9;
  white-space: nowrap;
}

.frost-file-field {
  padding: 10px 12px;
  cursor: pointer;
}

.frost-file-field::file-selector-button {
  margin-right: 12px;
  padding: 8px 14px;
  border: none;
  border-radius: var(--frost-radius-sm);
  background: var(--frost-primary);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.frost-file-hint {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--frost-text-dim);
}

.item-btn:hover {
  background: var(--frost-neutral);
  color: #fff;
  border-color: var(--frost-primary);
}

.frost-dept-btn {
  border-left-width: 4px;
  border-left-style: solid;
}

/* ——— Back nav ——— */
.frost-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  min-height: var(--frost-btn-height-sm);
  background: var(--frost-neutral);
  color: #fff !important;
  text-decoration: none;
  border-radius: var(--frost-radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--frost-border);
  transition: background 0.2s;
  line-height: 1.2;
  max-width: 100%;
  box-sizing: border-box;
}

.frost-back-btn:hover {
  background: var(--frost-primary);
  color: #fff !important;
}

.frost-page-head__title {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.frost-page-head__title-text,
.frost-dept-head-row {
  flex: 1 1 8rem;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.frost-dept-head-row {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 100%;
}

.frost-dept-head-row .frost-dept-head-icon {
  flex: none;
  display: block;
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.frost-dept-head-text {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  flex: 1 1 8rem;
  min-width: 0;
}

.frost-dept-head-row .frost-dept-dot {
  flex: none;
  width: 12px;
  height: 12px;
  min-width: 12px;
  max-width: 12px;
  border-radius: 50%;
  display: block;
}

.frost-dept-head-row .frost-dept-label {
  flex: none;
  white-space: nowrap;
  font-weight: 700;
  line-height: 1.35;
}

.frost-dept-head-row .frost-dept-head-name {
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.35;
  color: var(--frost-primary);
  font-weight: 700;
}

/* ——— Alerts (in-page) ——— */
.frost-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--frost-radius);
  border: 1px solid var(--frost-border-subtle);
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.5;
  background: var(--frost-bg-input);
}

.frost-alert__icon {
  flex-shrink: 0;
  font-size: 18px;
  line-height: 1.2;
}

.frost-alert--success {
  border-left: 4px solid var(--frost-success);
}

.frost-alert--error {
  border-left: 4px solid var(--frost-danger);
}

.frost-alert--warning {
  border-left: 4px solid var(--frost-warning);
}

.frost-alert--info {
  border-left: 4px solid var(--frost-primary);
}

/* ——— Status pages ——— */
.frost-status-card {
  text-align: center;
}

.frost-status-card--success {
  border-color: var(--frost-success);
}

.frost-status-card--error {
  border-color: var(--frost-danger);
}

.frost-status-card--warning {
  border-color: var(--frost-warning);
}

.frost-status-card h2.frost-status-card__title--success {
  color: var(--frost-success);
  border-bottom: none;
}

.frost-status-card h2.frost-status-card__title--error {
  color: var(--frost-danger);
  border-bottom: none;
}

.frost-status-card h2.frost-status-card__title--warning {
  color: var(--frost-warning);
  border-bottom: none;
}

.frost-status-card__message {
  color: var(--frost-text-muted);
  line-height: 1.6;
  text-align: center;
}

.frost-status-card__countdown {
  color: var(--frost-text-dim);
  font-size: 14px;
  margin-top: 20px;
}

.frost-status-card__countdown b {
  color: var(--frost-primary);
}

/* ——— Toast ——— */
.frost-toast-host {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100050;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(420px, calc(100vw - 24px));
  pointer-events: none;
}

.frost-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--frost-radius);
  background: var(--frost-bg-elevated);
  border: 1px solid var(--frost-border-subtle);
  box-shadow: var(--frost-shadow-toast);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  animation: frostToastIn 0.28s ease;
  box-sizing: border-box;
}

.frost-toast.is-leaving {
  animation: frostToastOut 0.22s ease forwards;
}

@keyframes frostToastIn {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes frostToastOut {
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

.frost-toast__icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}

.frost-toast--success {
  border-left: 4px solid var(--frost-success);
}

.frost-toast--success .frost-toast__icon {
  background: rgba(67, 181, 129, 0.2);
  color: var(--frost-success);
}

.frost-toast--error {
  border-left: 4px solid var(--frost-danger);
}

.frost-toast--error .frost-toast__icon {
  background: rgba(237, 66, 69, 0.2);
  color: var(--frost-danger);
}

.frost-toast--warning {
  border-left: 4px solid var(--frost-warning);
}

.frost-toast--warning .frost-toast__icon {
  background: rgba(250, 166, 26, 0.2);
  color: var(--frost-warning);
}

.frost-toast--info {
  border-left: 4px solid var(--frost-primary);
}

.frost-toast--info .frost-toast__icon {
  background: rgba(88, 101, 242, 0.2);
  color: var(--frost-primary);
}

/* ——— Confirm modal ——— */
.frost-confirm-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100060;
  background: rgba(0, 0, 0, 0.72);
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  pointer-events: none;
}

.frost-confirm-backdrop.is-open {
  display: flex;
  pointer-events: auto;
}

.frost-confirm-card {
  background: var(--frost-bg-elevated);
  border: 1px solid var(--frost-border);
  border-radius: var(--frost-radius-lg);
  padding: 22px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--frost-shadow-toast);
  animation: frostModalIn 0.22s ease;
}

@keyframes frostModalIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.frost-confirm-card__title {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.frost-confirm-card__message {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--frost-text-muted);
}

.frost-confirm-card__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.frost-confirm-card__actions .frost-btn {
  flex: 1 1 120px;
}

.frost-confirm-card__actions--stack {
  flex-direction: column;
}

.frost-confirm-card__actions--stack .frost-btn {
  flex: 1 1 auto;
  width: 100%;
}

.frost-prompt-input {
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 14px;
}

/* ——— Inline page loader (no layout jump) ——— */
.frost-list-loader {
  min-height: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 0 12px;
  opacity: 1;
  transition: opacity 0.35s ease;
}

.frost-list-loader.is-fading {
  opacity: 0;
}

.frost-list-loader__track {
  width: min(320px, 100%);
  height: 6px;
  border-radius: 999px;
  background: #202225;
  overflow: hidden;
  border: 1px solid #23272a;
}

.frost-list-loader__bar {
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--frost-primary), #7289da, var(--frost-primary));
  animation: frostLoadBar 1.1s ease-in-out infinite;
}

@keyframes frostLoadBar {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(280%);
  }
}

.frost-list-content {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.frost-list-content.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ——— Admin dept spoiler (details) ——— */
.dept-sort-item {
  margin-bottom: 10px;
}

.admin-dept-details {
  position: relative;
  background: #2f3136;
  border: 1px solid #202225;
  border-radius: 6px;
  padding: 10px 12px;
  color: #fff;
}

.admin-dept-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  padding: 4px 0;
  list-style: none;
  cursor: pointer;
  user-select: none;
  color: #dcddde;
  font-weight: 700;
}

.admin-dept-details[open] > summary.admin-dept-summary {
  padding-right: clamp(440px, 48vw, 560px);
  margin-bottom: 2px;
  box-sizing: border-box;
  flex-wrap: wrap;
  row-gap: 6px;
}

.admin-dept-summary__badges {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  flex: 0 1 auto;
  margin-left: auto;
  max-width: 100%;
}

.admin-dept-details[open] .admin-dept-summary__badges {
  margin-right: 6px;
}

.admin-dept-details[open] .admin-dept-actions {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  white-space: nowrap;
  max-width: min(560px, calc(100% - 16px));
  pointer-events: auto;
}

@media (max-width: 900px) {
  .admin-dept-details[open] > summary.admin-dept-summary {
    padding-right: 0;
    padding-bottom: 0;
  }

  .admin-dept-details[open] .admin-dept-summary__badges {
    flex: 1 1 100%;
    margin-left: 0;
    margin-top: 2px;
    order: 10;
  }

  /* Кнопки в потоке сразу под заголовком, не внизу карточки с формами */
  .admin-dept-details[open] .admin-dept-actions {
    position: static;
    top: auto;
    bottom: auto;
    left: auto;
    right: auto;
    z-index: auto;
    max-width: none;
    justify-content: flex-start;
    flex-wrap: wrap;
    margin: 4px 0 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #36393f;
  }
}

.admin-dept-details[open] .admin-dept-actions .frost-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.admin-dept-panel {
  display: block;
  width: 100%;
}

.admin-dept-panel .forms-container {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid #36393f;
  width: 100%;
  box-sizing: border-box;
}

.admin-dept-summary::-webkit-details-marker {
  display: none;
}

.admin-dept-summary::before {
  content: "▶";
  flex: 0 0 auto;
  width: 14px;
  color: #72767d;
  font-size: 11px;
  line-height: 1;
}

.admin-dept-details[open] > .admin-dept-summary::before {
  content: "▼";
}

.admin-dept-summary__icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex-shrink: 0;
}

.admin-dept-summary__accent {
  font-weight: 700;
  flex-shrink: 0;
}

.admin-dept-summary__name {
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-word;
}

.admin-dept-empty {
  color: #72767d;
  margin: 0 0 0 10px;
  font-size: 14px;
}

.frost-form-closed-badge {
  display: inline-block;
  flex-shrink: 0;
  margin-left: 8px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #faa61a;
  background: rgba(250, 166, 26, 0.15);
  border: 1px solid rgba(250, 166, 26, 0.35);
  border-radius: 4px;
  vertical-align: middle;
  white-space: nowrap;
}

.frost-dept-maint-badge {
  color: #faa61a;
  font-size: 11px;
  font-weight: bold;
  white-space: nowrap;
  flex: 0 0 auto;
}

.frost-hidden-badge {
  display: inline-block;
  flex-shrink: 0;
  margin-left: 8px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #b9bbbe;
  background: rgba(185, 187, 190, 0.12);
  border: 1px solid rgba(185, 187, 190, 0.35);
  border-radius: 4px;
  vertical-align: middle;
  white-space: nowrap;
}

.dept-actions {
  display: flex;
  gap: 5px;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

/* ——— Drag and drop ——— */
.frost-drag-handle {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #202225;
  border: 1px solid #36393f;
  color: #72767d;
  font-size: 14px;
  line-height: 1;
  cursor: grab;
  user-select: none;
}

.frost-drag-handle:active {
  cursor: grabbing;
}

.dept-sort-item.is-dragging,
.form-sort-item.is-dragging,
.field-row--question.is-dragging {
  opacity: 0.55;
}

.forms-container.is-drop-target,
#adminDeptsSortRoot.is-drop-target {
  outline: 2px dashed var(--frost-primary);
  outline-offset: 4px;
  border-radius: 6px;
}

.frost-sort-hint {
  margin: 0 0 10px;
  font-size: 12px;
  color: #72767d;
  line-height: 1.45;
}

.form-sort-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #202225;
  padding: 12px;
  border-radius: 4px;
  margin-bottom: 5px;
  margin-left: 10px;
  border: 1px solid transparent;
}

.form-sort-item__head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
}

.form-sort-item__title {
  flex: 1;
  min-width: 0;
  color: #fff;
  font-size: 15px;
  word-break: break-word;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-sort-item__actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  width: 100%;
}

/* ——— Select options builder (admin) ——— */
.field-row--question {
  flex-direction: column;
  align-items: stretch;
}

.field-row__head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
}

.field-options-panel {
  display: none;
  width: 100%;
  margin-top: 4px;
  padding: 12px;
  background: #202225;
  border: 1px solid #23272a;
  border-radius: 6px;
  box-sizing: border-box;
}

.field-options-panel.is-open {
  display: block;
}

.field-options-panel__title {
  margin: 0 0 10px;
  font-size: 12px;
  color: #b9bbbe;
  font-weight: 600;
}

.field-option-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.field-option-row input {
  flex: 1;
  margin: 0;
}

.field-option-row--other input {
  border-style: dashed;
}

.field-options-panel__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* ——— Public form: «Другое» ——— */
.frost-other-wrap {
  margin-top: 10px;
  display: none;
}

.frost-other-wrap.is-visible {
  display: block;
}

/* ——— Admin ——— */
.admin-box {
  background: var(--frost-bg);
  padding: 15px;
  border-radius: var(--frost-radius-sm);
  border: 1px solid var(--frost-border);
  margin-bottom: 20px;
}

.admin-box > summary.admin-box-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px;
  list-style: none;
  cursor: pointer;
  user-select: none;
  outline: none;
  font-size: 16px;
  font-weight: bold;
}

.admin-box > summary.admin-box-summary::-webkit-details-marker {
  display: none;
}

.admin-box > summary.admin-box-summary::before {
  content: "▶";
  flex: 0 0 auto;
  width: 14px;
  color: #72767d;
  font-size: 11px;
  line-height: 1;
}

.admin-box[open] > summary.admin-box-summary::before {
  content: "▼";
}

.admin-box-summary--green {
  color: #43b581;
}

.admin-box-summary--blue {
  color: #5865f2;
}

.admin-box-summary--orange {
  color: #faa61a;
}

.field-row {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.admin-tab-bar {
  display: flex;
  gap: 10px;
  background: var(--frost-bg-input);
  padding: 10px;
  border-radius: var(--frost-radius);
  margin-bottom: 25px;
}

.admin-tab {
  flex: 1;
  min-height: var(--frost-btn-height);
  padding: 0 12px;
  background: var(--frost-bg);
  border: 1px solid transparent;
  color: var(--frost-text-muted);
  border-radius: var(--frost-radius-sm);
  font-weight: 600;
  font-size: 14px;
  font-family: var(--frost-font);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.admin-tab:hover {
  background: var(--frost-neutral);
  color: #fff;
}

.admin-tab.is-active {
  background: var(--frost-primary);
  color: #fff;
  border-color: var(--frost-primary);
}

.admin-refresh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--frost-neutral);
  border-radius: var(--frost-radius);
  background: var(--frost-bg-elevated);
  color: #dcddde;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  flex-shrink: 0;
}

.admin-refresh-btn:hover:not(:disabled) {
  background: var(--frost-neutral);
}

.admin-refresh-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.admin-refresh-btn.spin svg {
  animation: frostSpin 0.75s linear infinite;
}

.server-disk-track {
  height: 28px;
  background: var(--frost-bg-input);
  border-radius: var(--frost-radius-sm);
  overflow: hidden;
  border: 1px solid var(--frost-border-subtle);
}

.server-disk-fill {
  height: 100%;
  transition: width 0.35s ease, background 0.35s ease;
  min-width: 2%;
}

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

.admin-server-toolbar__refresh {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.admin-server-panel,
.admin-server-maint-panel {
  box-sizing: border-box;
  max-width: 100%;
}

.admin-server-maint-panel {
  margin-top: 20px;
  padding: 14px;
  background: #2a2c30;
  border-radius: 8px;
  border: 1px solid #23272a;
}

.admin-server-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.admin-server-actions .frost-btn {
  width: 100%;
  max-width: 100%;
  margin: 0;
  box-sizing: border-box;
  white-space: normal;
  text-align: center;
  line-height: 1.35;
}

.admin-server-note {
  margin: 12px 0 0;
  font-size: 11px;
  color: #72767d;
  line-height: 1.45;
}

.admin-logs-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.admin-logs-head__title {
  flex: 1;
  min-width: 200px;
}

.admin-logs-head__refresh {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.admin-logs-filters {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.admin-logs-period {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-logs-period-btn {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--frost-border-subtle);
  border-radius: var(--frost-radius-sm);
  background: var(--frost-bg-input);
  color: var(--frost-text-muted);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--frost-font);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.admin-logs-period-btn:hover {
  background: var(--frost-neutral);
  color: #fff;
}

.admin-logs-period-btn.is-active {
  background: var(--frost-primary);
  border-color: var(--frost-primary);
  color: #fff;
}

.admin-logs-range {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
}

.admin-logs-range__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: #72767d;
  min-width: 0;
}

.admin-logs-date-input {
  margin: 0;
  min-width: 0;
  width: 100%;
  max-width: 160px;
  box-sizing: border-box;
}

.admin-logs-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.admin-logs-stats-hint {
  margin: 0 0 12px;
  font-size: 11px;
  color: #72767d;
  line-height: 1.4;
}

.admin-logs-stat-chip {
  padding: 4px 10px;
  border-radius: 4px;
  border: 2px solid transparent;
  color: #fff;
  font-weight: 600;
  font-size: 12px;
  font-family: var(--frost-font);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s, opacity 0.15s;
}

.admin-logs-stat-chip:hover {
  opacity: 0.92;
}

.admin-logs-stat-chip:active {
  transform: scale(0.98);
}

.admin-logs-stat-chip.is-active {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.admin-logs-stat-chip--used {
  background: #43b581;
}

.admin-logs-stat-chip--norole {
  background: #faa61a;
}

.admin-logs-stat-chip--noguild {
  background: #9b59b6;
}

.admin-logs-stat-chip--failed {
  background: #f04747;
}

.admin-logs-browsing {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #b9bbbe;
  cursor: pointer;
  user-select: none;
}

.admin-logs-browsing input {
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.admin-logs-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.admin-logs-table {
  min-width: 720px;
}

.admin-logs-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--frost-border-subtle);
}

.admin-logs-pagination__info {
  margin: 0;
  font-size: 12px;
  color: #72767d;
}

.admin-logs-pagination__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.72);
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.admin-modal-backdrop.is-open {
  display: flex;
}

.admin-modal-card {
  background: var(--frost-bg);
  border: 1px solid var(--frost-border);
  border-radius: var(--frost-radius-lg);
  padding: 22px;
  width: 100%;
  max-width: 480px;
  box-sizing: border-box;
  animation: frostModalIn 0.22s ease;
}

.admin-modal-card h3 {
  margin: 0 0 16px;
  color: var(--frost-success);
  font-size: 18px;
}

.admin-form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.frost-log-chip {
  padding: 4px 10px;
  border-radius: var(--frost-radius-sm);
  color: #fff;
  font-weight: 600;
  font-size: 12px;
}

details > summary {
  list-style: none;
}

details > summary::-webkit-details-marker {
  display: none;
}

@media (max-width: 520px) {
  .card {
    padding: 18px 14px !important;
    width: calc(100% - 24px) !important;
    margin-left: auto;
    margin-right: auto;
  }

  .frost-dept-btn__maint {
    flex: 1 1 100%;
    margin-left: 0;
    text-align: right;
  }

  .frost-dept-head-row .frost-dept-label {
    white-space: normal;
  }

  .frost-back-btn {
    width: 100%;
    justify-content: center;
  }

  .admin-tab {
    font-size: 12px;
    padding: 0 8px;
  }

  .frost-confirm-card__actions .frost-btn {
    flex: 1 1 100%;
  }

  .admin-tab-panel--server {
    padding: 12px !important;
  }

  .admin-server-panel {
    padding: 14px 12px !important;
  }

  .admin-server-maint-panel {
    padding: 12px !important;
  }

  .admin-server-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-server-toolbar__refresh {
    justify-content: space-between;
    width: 100%;
  }

  .admin-tab-panel--logs {
    padding: 12px !important;
  }

  .admin-logs-head {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-logs-head__refresh {
    justify-content: space-between;
    width: 100%;
  }

  .admin-logs-period-btn {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
  }

  .admin-logs-range__field {
    flex: 1 1 120px;
  }

  .admin-logs-date-input {
    max-width: 100%;
  }

  .admin-logs-range .frost-btn {
    flex: 1 1 100%;
  }

  .admin-logs-pagination {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-logs-pagination__actions .frost-btn {
    flex: 1 1 calc(50% - 4px);
  }
}
