html[data-bs-theme="dark"] {
  color-scheme: dark;
  --bg: #12161c;
  --bg-elevated: #1a2028;
  --bg-soft: #161b22;
  --bg-2: #182028;
  --panel: rgba(26, 32, 40, 0.92);
  --navbar: rgba(18, 22, 28, 0.88);
  --text: #e8edf2;
  --text-muted: #8b97a6;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --chip: rgba(255, 255, 255, 0.05);
  --row-hover: rgba(255, 255, 255, 0.035);
  --row-line: rgba(255, 255, 255, 0.06);
  --nav-active-bg: rgba(255, 255, 255, 0.06);
  --accent: #e6c84a;
  --accent-2: #d4a82a;
  --accent-soft: rgba(230, 200, 74, 0.12);
  --accent-contrast: #141414;
  --link: #e6c84a;
  --success: #3dbe7a;
  --success-soft: rgba(61, 190, 122, 0.14);
  --success-text: #c8f7db;
  --warning-soft: rgba(230, 200, 74, 0.14);
  --warning-text: #f1db7a;
  --danger: #e87070;
  --danger-soft: rgba(232, 112, 112, 0.14);
  --danger-text: #ffd1d1;
  --info: #6ba3c8;
  --info-soft: rgba(107, 163, 200, 0.14);
  --info-text: #c5e2f2;
  --input-bg: rgba(12, 16, 22, 0.9);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.28);
  --beam: rgba(230, 200, 74, 0.07);
  --beam-cool: rgba(80, 110, 140, 0.12);
}

html[data-bs-theme="light"] {
  color-scheme: light;
  --bg: #f4f6f8;
  --bg-elevated: #ffffff;
  --bg-soft: #eef1f4;
  --bg-2: #e7ebf0;
  --panel: rgba(255, 255, 255, 0.94);
  --navbar: rgba(255, 255, 255, 0.9);
  --text: #1c2430;
  --text-muted: #5c6b7a;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);
  --chip: rgba(0, 0, 0, 0.04);
  --row-hover: rgba(0, 0, 0, 0.03);
  --row-line: rgba(0, 0, 0, 0.06);
  --nav-active-bg: rgba(230, 200, 74, 0.16);
  --accent: #e6c84a;
  --accent-2: #d4a82a;
  --accent-soft: rgba(230, 200, 74, 0.22);
  --accent-contrast: #141414;
  --link: #8a6410;
  --success: #1f8a4d;
  --success-soft: rgba(31, 138, 77, 0.12);
  --success-text: #146338;
  --warning-soft: rgba(212, 168, 42, 0.18);
  --warning-text: #7a5b08;
  --danger: #c44b4b;
  --danger-soft: rgba(196, 75, 75, 0.12);
  --danger-text: #8f2d2d;
  --info: #3d7ea3;
  --info-soft: rgba(61, 126, 163, 0.12);
  --info-text: #1d5678;
  --input-bg: #ffffff;
  --shadow-sm: 0 1px 2px rgba(20, 28, 40, 0.06);
  --shadow-md: 0 10px 28px rgba(20, 28, 40, 0.08);
  --beam: rgba(230, 200, 74, 0.18);
  --beam-cool: rgba(80, 110, 140, 0.06);
}

:root {
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

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

body.app-body,
body.auth-body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1100px 700px at 80% 8%, var(--beam), transparent 55%),
    radial-gradient(900px 600px at 5% 90%, var(--beam-cool), transparent 55%),
    linear-gradient(160deg, var(--bg), var(--bg-2));
  -webkit-font-smoothing: antialiased;
}

.beam {
  position: fixed;
  inset: -80px;
  background: linear-gradient(110deg, transparent 42%, var(--beam) 52%, transparent 62%);
  pointer-events: none;
  opacity: 0.55;
  z-index: -1;
}

.app-content {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 20px 16px 32px;
  min-height: calc(100vh - 8rem);
}

.app-footer {
  padding: 18px 16px 22px;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
}

.app-footer p { margin: 0; }

/* ——— Navbar ——— */
.app-navbar {
  position: sticky;
  z-index: 1030;
  background: var(--navbar);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
}

.app-navbar .navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 800;
  letter-spacing: -0.01em;
}

.app-navbar .navbar-brand:hover { color: var(--text); }

.brand-logo { display: block; }
html[data-bs-theme="dark"] .brand-logo-dark { display: none; }
html[data-bs-theme="light"] .brand-logo-light { display: none; }

.app-navbar .navbar-toggler {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.5rem;
}

.app-navbar .navbar-toggler:focus {
  box-shadow: 0 0 0 0.18rem var(--accent-soft);
}

.app-navbar .navbar-toggler-icon {
  background-image: none;
  position: relative;
  width: 1.15rem;
  height: 1.15rem;
}

.app-navbar .navbar-toggler-icon::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  border-radius: 2px;
  background: var(--text);
  box-shadow: 0 -6px 0 var(--text), 0 6px 0 var(--text);
}

.app-navbar .app-nav { gap: 2px; }

.app-navbar .nav-link {
  position: relative;
  color: var(--text-muted);
  font-weight: 650;
  border-radius: var(--radius-md);
  padding: 8px 12px;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus {
  color: var(--text);
  background: var(--chip);
}

.app-navbar .nav-link.active,
.app-navbar .dropdown-item.active {
  color: var(--text);
  background: var(--nav-active-bg);
}

.app-navbar .nav-link.active:not(.dropdown-toggle)::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.app-navbar .nav-link.dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.app-navbar .nav-link.dropdown-toggle::after {
  content: "";
  display: inline-block;
  width: 0.42em;
  height: 0.42em;
  margin-left: 2px;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  border-radius: 0;
  background: none;
  position: static;
  transform: translateY(-1px) rotate(45deg);
  flex: 0 0 auto;
}

.app-navbar .nav-link.dropdown-toggle.show::after {
  transform: translateY(2px) rotate(225deg);
}

.app-navbar .nav-link.dropdown-toggle.active::before {
  content: "";
  position: absolute;
  left: 12px;
  right: 26px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.app-navbar .nav-user-toggle {
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--chip);
  padding-right: 12px;
}

.app-navbar .nav-user-toggle:hover,
.app-navbar .nav-user-toggle:focus,
.app-navbar .nav-user-toggle.show {
  color: var(--text);
  background: var(--nav-active-bg);
  border-color: var(--border-strong);
}

.app-navbar .nav-user-toggle.active {
  color: var(--text);
  border-color: rgba(230, 200, 74, 0.55);
}

.app-navbar .nav-link.dropdown-toggle.nav-user-toggle.active::before {
  display: none;
}

.app-navbar .badge {
  background: var(--chip) !important;
  color: var(--text) !important;
  border: 1px solid var(--border);
  font-weight: 700;
}

.app-navbar .dropdown-menu {
  min-width: 220px;
  margin-top: 8px;
  padding: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.app-navbar .dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 6px 10px;
  color: var(--text);
  border-radius: 8px;
  font-weight: 650;
  font-size: 0.9rem;
}

.app-navbar .dropdown-item i {
  width: 1.05rem;
  flex: 0 0 1.05rem;
  text-align: center;
  color: var(--text-muted);
}

.app-navbar .dropdown-item .badge {
  margin-left: auto;
}

.app-navbar .dropdown-item:hover,
.app-navbar .dropdown-item:focus {
  color: var(--text);
  background: var(--chip);
}

.app-navbar .dropdown-item:hover i,
.app-navbar .dropdown-item:focus i,
.app-navbar .dropdown-item.active i {
  color: var(--text);
}

.app-navbar .dropdown-item.active::after { display: none; }

.app-navbar .dropdown-divider {
  border-color: var(--border);
  opacity: 1;
  margin: 4px 0;
}

@media (max-width: 991.98px) {
  .app-navbar .navbar-collapse {
    padding: 8px 0 12px;
  }

  .app-navbar .nav-link.active:not(.dropdown-toggle)::after,
  .app-navbar .nav-link.dropdown-toggle.active::before {
    left: 0;
    right: auto;
    top: 18%;
    bottom: 18%;
    width: 3px;
    height: auto;
  }

  .app-navbar .nav-link.dropdown-toggle {
    width: 100%;
  }
}

/* ——— Surfaces ——— */
.app-body .card,
.auth-body .card,
.glass-panel {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.app-body .card-header,
.app-body .card-footer {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
  font-weight: 700;
}

.app-body .card-header h1,
.app-body .card-header h2,
.app-body .card-header h3,
.app-body .card-header h4,
.app-body .card-header h5,
.app-body h1,
.app-body h2,
.app-body h3,
.app-body h4,
.app-body h5,
.app-body .h5 {
  color: var(--text);
}

.app-body a:not(.btn):not(.nav-link):not(.dropdown-item):not(.page-link):not(.navbar-brand) {
  color: var(--link);
}

.app-body a:not(.btn):not(.nav-link):not(.dropdown-item):not(.page-link):not(.navbar-brand):hover {
  color: var(--accent-2);
}

/* ——— Tables ——— */
.app-body .table-responsive:has(.dropdown),
.app-body .table-responsive:has(.app-row-actions) {
  overflow: visible;
}

.app-body .table-responsive,
.app-body table.table {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.app-body .table-responsive > .table,
.app-body .table-responsive > table.table {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.app-body .table {
  --bs-table-color: var(--text);
  --bs-table-bg: transparent;
  --bs-table-border-color: transparent;
  --bs-table-striped-color: var(--text);
  --bs-table-striped-bg: transparent;
  --bs-table-hover-color: var(--text);
  --bs-table-hover-bg: var(--row-hover);
  margin-bottom: 0;
  color: var(--text);
}

.app-body .table > :not(caption) > * > * {
  background-color: transparent;
  color: var(--text);
  box-shadow: none;
  border-bottom-color: var(--row-line);
}

.app-body .table-striped > tbody > tr:nth-of-type(odd) > * {
  --bs-table-bg-type: transparent;
  background-color: transparent;
  color: var(--text);
}

.app-body .table-bordered > :not(caption) > * {
  border-width: 0;
}

.app-body .table-bordered > :not(caption) > * > * {
  border-width: 0 0 1px;
  border-color: var(--row-line);
}

.app-body .table thead th {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border-bottom: 1px solid var(--border) !important;
  padding: 12px 16px;
  vertical-align: middle;
}

.app-body .table tbody td {
  padding: 12px 16px;
  vertical-align: middle;
  font-size: 0.92rem;
}

.app-body .app-table td:first-child,
.app-body .app-table th:first-child {
  white-space: nowrap;
}

.app-body .app-table td:first-child img {
  vertical-align: middle;
  margin-right: 8px;
}

.app-body .app-table .col-actions {
  text-align: right;
  white-space: nowrap;
}

.app-body .app-table .col-actions .app-row-actions {
  justify-content: flex-end;
}

.app-body .table thead th a {
  color: var(--text-muted);
  text-decoration: none;
  margin-left: 2px;
}

.app-body .table thead th a:hover { color: var(--text); }

.app-body .table tbody tr:last-child > * { border-bottom: 0; }

/* ——— Forms, buttons, alerts ——— */
.app-body .form-control,
.app-body .form-select,
.auth-body .form-control,
.auth-body .form-select {
  background: var(--input-bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius-md);
}

.app-body .form-control:focus,
.app-body .form-select:focus,
.auth-body .form-control:focus,
.auth-body .form-select:focus {
  background: var(--input-bg);
  color: var(--text);
  border-color: rgba(230, 200, 74, 0.65);
  box-shadow: 0 0 0 0.18rem rgba(230, 200, 74, 0.18);
}

.app-body .form-control:disabled,
.app-body .form-control[readonly],
.auth-body .form-control:disabled {
  background: var(--bg-soft);
  color: var(--text-muted);
}

.app-body .form-label,
.auth-body .form-label { font-weight: 650; }

.app-body .form-control::placeholder,
.auth-body .form-control::placeholder { color: var(--text-muted); }

.btn { border-radius: var(--radius-md); font-weight: 700; }

.app-body .btn-primary,
.app-body .btn-success,
.auth-body .btn-primary,
.auth-body .btn-success,
.btn-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-contrast);
  border: 0;
}

.app-body .btn-primary:hover,
.app-body .btn-success:hover,
.auth-body .btn-primary:hover,
.auth-body .btn-success:hover,
.btn-accent:hover,
.btn-accent:focus {
  background: linear-gradient(135deg, #efd25a, #e0b334);
  color: var(--accent-contrast);
}

.app-body .btn-outline-primary,
.app-body .btn-outline-success,
.auth-body .btn-outline-primary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
}

.app-body .btn-outline-primary:hover,
.app-body .btn-outline-success:hover,
.auth-body .btn-outline-primary:hover {
  background: var(--accent-soft);
  color: var(--text);
  border-color: var(--accent);
}

.app-body .btn-outline-warning {
  color: var(--warning-text);
  background: transparent;
  border-color: rgba(212, 168, 42, 0.55);
}

.app-body .btn-outline-warning:hover,
.app-body .btn-outline-warning:focus {
  color: var(--warning-text);
  background: var(--warning-soft);
  border-color: rgba(212, 168, 42, 0.75);
}

.app-body .btn-outline-danger,
.auth-body .btn-outline-danger {
  color: var(--danger-text);
  background: var(--danger-soft);
  border-color: rgba(232, 112, 112, 0.35);
}

.app-body .btn-secondary,
.app-body .btn-outline-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
}

.app-body .btn-secondary:hover,
.app-body .btn-outline-secondary:hover {
  background: var(--chip);
  color: var(--text);
  border-color: var(--border-strong);
}

.app-body .alert {
  border-radius: var(--radius-md);
  border-width: 1px;
}

.app-body .alert-danger,
.auth-body .alert-danger {
  color: var(--danger-text);
  background: var(--danger-soft);
  border-color: rgba(232, 112, 112, 0.3);
}

.app-body .alert-success,
.auth-body .alert-success {
  color: var(--success-text);
  background: var(--success-soft);
  border-color: rgba(61, 190, 122, 0.32);
}

.app-body .alert-warning {
  color: var(--warning-text);
  background: var(--warning-soft);
  border-color: rgba(230, 200, 74, 0.35);
}

.app-body .text-danger,
.auth-body .text-danger { color: var(--danger-text) !important; }

.app-body .btn-close,
.auth-body .btn-close {
  filter: none;
}

html[data-bs-theme="dark"] .btn-close {
  filter: invert(1) grayscale(1);
}

/* ——— Modals, accordion, lists ——— */
.app-body .modal {
  z-index: 1055;
}

.app-body .modal-content {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.app-body .modal-header,
.app-body .modal-footer { border-color: var(--border); }

.confirm-dialog {
  width: min(460px, calc(100% - 1.5rem));
  margin-left: auto;
  margin-right: auto;
}

.confirm-dialog .modal-header,
.confirm-dialog .modal-footer {
  border: 0;
}

.confirm-dialog .modal-header { padding: 16px 18px 0; }

.confirm-dialog .modal-title {
  font-size: 1.15rem;
  font-weight: 750;
}

.confirm-dialog .modal-body { padding: 12px 18px 6px; }

.confirm-dialog .modal-footer {
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 18px 16px;
}

.confirm-dialog .close-lead { margin-bottom: 12px; }
.confirm-dialog .close-meta { margin-bottom: 8px; }
.confirm-dialog .close-desc { margin: 0; }

.confirm-dialog .close-meta b,
.confirm-dialog .close-desc b {
  white-space: normal;
  font-weight: 700;
}

.confirm-dialog .confirm-wide { grid-column: 1 / -1; }

.confirm-dialog .btn {
  min-height: 42px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.app-body .accordion-item {
  background: var(--panel);
  color: var(--text);
  border-color: var(--border);
}

.app-body .accordion-button {
  background: transparent;
  color: var(--text);
  font-weight: 700;
  box-shadow: none;
}

.app-body .accordion-button:not(.collapsed) {
  background: var(--accent-soft);
  color: var(--text);
}

.app-body .accordion-button:focus {
  box-shadow: 0 0 0 0.18rem rgba(230, 200, 74, 0.18);
}

.app-body .accordion-body { background: transparent; }

.app-body .list-group-item {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.app-body .input-group-text {
  background: var(--bg-soft);
  color: var(--text-muted);
  border-color: var(--border-strong);
}

.app-body code,
.app-body pre { color: var(--warning-text); }

/* ——— Auth ——— */
.auth-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(420px, 100%);
  padding: 36px 32px 22px;
}

.auth-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  margin-bottom: 28px;
}

.auth-head .brand-logo {
  width: 148px;
  height: auto;
  margin-bottom: 6px;
}

.auth-title {
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  text-wrap: balance;
  margin: 0;
}

.auth-title-accent { color: var(--link); }

.auth-subtitle {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.4;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.auth-body .auth-field .form-label {
  margin: 0;
  font-size: 0.92rem;
}

.auth-body .auth-field .form-control {
  min-height: 46px;
  padding: 10px 14px;
}

.auth-submit {
  width: 100%;
  min-height: 46px;
  margin-top: 4px;
}

.auth-foot {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
}

@media (max-width: 767.98px) {
  .app-content { padding: 14px 10px 24px; }
  .app-body .table thead th,
  .app-body .table tbody td { padding: 8px 10px; }
}

/* ——— Queue, actions, nav identity ——— */
.nav-user-name {
  cursor: default;
  color: var(--text);
}

.nav-user-name:hover {
  background: transparent;
  color: var(--text);
}

.nav-link-exit {
  color: var(--text-muted);
}

.nav-link-mode {
  border: 1px solid var(--border-strong);
}

.app-navbar .badge-alert {
  background: var(--danger-soft) !important;
  color: var(--danger-text) !important;
  border-color: rgba(232, 112, 112, 0.45);
}

.queue-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
}

.queue-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
}

.queue-panel-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.queue-panel.is-collapsed .queue-panel-body {
  display: none;
}

.queue-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.queue-active {
  display: none;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 650;
}

.queue-panel.is-collapsed .queue-active {
  display: block;
}

.queue-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-left: auto;
  padding: 0;
  flex: 0 0 32px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
}

.queue-toggle:hover,
.queue-toggle:focus {
  color: var(--text);
  background: var(--chip);
}

.queue-toggle .bi {
  display: block;
  font-size: 0.95rem;
  line-height: 1;
  transition: transform 0.15s ease;
}

.queue-panel.is-collapsed .queue-toggle .bi {
  transform: rotate(180deg);
}

.queue-toggle.has-filter {
  color: var(--accent);
  border-color: rgba(230, 200, 74, 0.45);
}

.queue-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--chip);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 650;
}

.queue-stat b {
  color: var(--text);
  font-size: 0.95rem;
}

.queue-stat.is-alert {
  background: var(--danger-soft);
  border-color: rgba(232, 112, 112, 0.4);
  color: var(--danger-text);
}

.queue-stat.is-alert b { color: var(--danger-text); }

.queue-toolbar {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin: 0;
}

.queue-search {
  flex: 1 1 auto;
  min-width: 0;
  height: 42px;
}

.queue-toolbar .btn {
  height: 42px;
  padding: 0 16px;
  white-space: nowrap;
}

.queue-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
}

button.queue-chip {
  font: inherit;
  cursor: pointer;
}

.queue-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 700;
}

.queue-chip-line {
  padding-left: 6px;
}

.queue-chip-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border-radius: 50%;
  display: block;
}

.queue-chip-name {
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
  color: var(--text-muted);
}

.queue-chip:hover {
  color: var(--text);
  background: var(--chip);
}

.queue-chip.is-active {
  color: var(--text);
  background: var(--nav-active-bg);
  border-color: var(--border-strong);
}

.queue-chip.is-active .queue-chip-name {
  color: var(--text);
}

.queue-chip-alert.is-active {
  color: var(--danger-text);
  background: var(--danger-soft);
  border-color: rgba(232, 112, 112, 0.45);
}

.queue-empty {
  margin: 8px 0 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--chip);
  color: var(--text-muted);
}

.sort-link {
  color: var(--text-muted);
  text-decoration: none;
}

.sort-link.is-active { color: var(--text); }

.ticket-sort {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
}

.ticket-sort .form-select {
  min-height: 36px;
}

.ticket-sort select[name="stype"] {
  flex: 1 1 auto;
  min-width: 0;
}

.ticket-sort select[name="sorder"] {
  flex: 0 0 5.6rem;
}

.ticket-sort .btn {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 36px;
}

.app-list-mobile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.ticket-card {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}

.ticket-card.is-overdue {
  border-color: rgba(232, 112, 112, 0.4);
  box-shadow: inset 3px 0 0 var(--danger);
}

.ticket-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.ticket-head img {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
}

.ticket-id {
  min-width: 0;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 750;
  letter-spacing: 0.01em;
}

.ticket-when {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.ticket-facts {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 6px 0 0;
}

.ticket-facts div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
  font-size: 0.8rem;
  line-height: 1.35;
}

.ticket-facts dt,
.ticket-facts dd {
  margin: 0;
}

.ticket-facts dt {
  color: var(--text-muted);
  font-weight: 650;
}

.ticket-facts dd {
  font-weight: 650;
  overflow-wrap: anywhere;
}

.ticket-hall {
  margin-top: 4px;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.3;
}

.ticket-desc {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.ticket-note {
  margin-top: 6px;
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.ticket-note > span {
  display: block;
  margin-bottom: 1px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.ticket-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.ticket-actions .app-row-actions {
  width: 100%;
}

.ticket-actions .btn {
  min-height: 32px;
}

.ticket-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: auto;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.ticket-check .form-check-input {
  margin: 0;
}

.queue-live-alert { margin-bottom: 14px; }
.live-form-error { margin-bottom: 12px; }

.toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1400;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast-note {
  min-width: 260px;
  max-width: 360px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-md);
  padding: 10px 12px 8px;
  font-size: 0.92rem;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.toast-note.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-note.hide {
  opacity: 0;
  transform: translateY(8px);
}

.toast-note.success { border-color: color-mix(in srgb, var(--success) 55%, var(--border)); }
.toast-note.error { border-color: color-mix(in srgb, var(--danger) 55%, var(--border)); }

.toast-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.toast-message { line-height: 1.25; }

.toast-close {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
}

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

.toast-progress {
  margin-top: 8px;
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 12%, transparent);
  overflow: hidden;
}

.toast-progress-bar {
  height: 100%;
  width: 100%;
  transform-origin: left center;
}

.toast-note.success .toast-progress-bar { background: var(--success); }
.toast-note.error .toast-progress-bar { background: var(--danger); }

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

.app-row-actions .btn {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}

.app-row-actions .dropdown-toggle::after {
  width: 0.38em;
  height: 0.38em;
  margin-left: 0.5em;
  vertical-align: 0.05em;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

.app-row-actions .dropdown-toggle.show::after {
  vertical-align: 0.15em;
  transform: rotate(225deg);
}

.app-row-actions .dropdown-menu {
  min-width: 196px;
  margin-top: 6px;
  padding: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.app-row-actions .dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 6px 10px;
  color: var(--text);
  border-radius: 8px;
  font-weight: 650;
  font-size: 0.9rem;
}

.app-row-actions .dropdown-item i {
  width: 1.05rem;
  flex: 0 0 1.05rem;
  text-align: center;
  color: var(--text-muted);
}

.app-row-actions .dropdown-item:hover,
.app-row-actions .dropdown-item:focus {
  color: var(--text);
  background: var(--chip);
}

.app-row-actions .dropdown-item:hover i,
.app-row-actions .dropdown-item:focus i {
  color: var(--text);
}

.app-row-actions .dropdown-divider {
  border-color: var(--border);
  opacity: 1;
  margin: 4px 0;
}

.app-row-actions .dropdown-item.row-menu-danger,
.app-row-actions .dropdown-item.row-menu-danger i {
  color: var(--danger-text);
}

.app-row-actions .dropdown-item.row-menu-danger:hover,
.app-row-actions .dropdown-item.row-menu-danger:focus,
.app-row-actions .dropdown-item.row-menu-danger:hover i,
.app-row-actions .dropdown-item.row-menu-danger:focus i {
  color: var(--danger-text);
  background: var(--danger-soft);
}

.btn-quiet-danger {
  background: transparent;
  color: var(--danger-text);
  border: 1px solid transparent;
  font-weight: 650;
}

.btn-quiet-danger:hover,
.btn-quiet-danger:focus {
  background: var(--danger-soft);
  color: var(--danger-text);
  border-color: rgba(232, 112, 112, 0.35);
}

.app-body tr.row-overdue > * {
  box-shadow: inset 3px 0 0 var(--danger);
}

.time-overdue { color: var(--danger-text); font-weight: 750; }
.time-soon { color: var(--warning-text); font-weight: 700; }
.time-watch { color: var(--warning-text); }
.time-ok { color: var(--success-text); }

.cell-clamp { max-width: 340px; cursor: pointer; }

.clamp-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cell-clamp.is-open .clamp-text {
  display: block;
  -webkit-line-clamp: unset;
}

.settings-page {
  width: min(560px, 100%);
  margin: 8px auto 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.settings-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 2px;
}

.settings-title {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.settings-user {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 650;
}

.settings-card {
  padding: 18px 18px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
}

.settings-card-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.settings-card-head p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

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

.settings-field .form-label {
  margin: 0;
}

.settings-form .form-control,
.settings-form .form-select {
  min-height: 42px;
}

.settings-form .form-select {
  background-color: var(--input-bg);
  background-image: var(--bs-form-select-bg-img);
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px 12px;
}

.settings-form .btn {
  align-self: flex-start;
  min-height: 42px;
  padding: 0 16px;
}

.settings-page .alert {
  margin: 0;
}

.doc-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.doc-page > .alert {
  margin: 0;
}

.doc-upload {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
}

.doc-upload-form {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}

.doc-upload-form .form-control,
.doc-upload-form .btn {
  min-height: 42px;
}

.doc-upload-form .btn {
  padding: 0 16px;
}

.doc-file {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  min-width: 0;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--input-bg);
  cursor: pointer;
}

.doc-file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.doc-file-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--chip);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
}

.doc-file-name {
  position: relative;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 0.88rem;
  pointer-events: none;
}

.doc-file-name.is-chosen {
  color: var(--text);
}

.doc-file:focus-within {
  border-color: rgba(230, 200, 74, 0.65);
  box-shadow: 0 0 0 0.18rem rgba(230, 200, 74, 0.18);
}

.doc-list {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  overflow: hidden;
}

.doc-list-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.doc-search {
  width: min(320px, 100%);
  height: 42px;
  margin-left: auto;
}

.doc-list .table-responsive,
.doc-list table.table {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.doc-list .queue-empty {
  margin: 14px;
}

.doc-table .col-size,
.doc-size {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.doc-table .col-actions {
  text-align: right;
  white-space: nowrap;
}

.doc-format {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 750;
  color: var(--text-muted);
  white-space: nowrap;
}

.doc-format-pdf { color: var(--danger-text); }
.doc-format-zip { color: var(--warning-text); }
.doc-format-slf { color: var(--info-text); }

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

.doc-actions .btn {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.doc-icon-btn {
  width: 32px;
  padding: 0;
}

.doc-cards {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
}

.doc-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--chip);
}

.doc-card-title {
  font-weight: 750;
  line-height: 1.35;
}

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

.doc-card .doc-actions {
  justify-content: flex-start;
}

.modal .settings-field .form-control {
  min-height: 42px;
}

.gen-page {
  width: min(720px, 100%);
  margin: 8px auto 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.gen-page > .btn {
  align-self: flex-start;
  min-height: 42px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
}

.gen-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.gen-form .form-control,
.gen-form .btn {
  min-height: 42px;
}

.gen-form .btn {
  padding: 0 16px;
}

.gen-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.gen-row {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 6px 8px 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--input-bg);
}

.gen-label {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.gen-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 750;
}

.gen-alert {
  margin-top: 14px;
}

.gen-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.gen-actions .btn {
  min-height: 42px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
}

@media (max-width: 767.98px) {
  .gen-form { grid-template-columns: 1fr; }
  .gen-form .btn { width: 100%; }
  .gen-row { grid-template-columns: minmax(0, 1fr) auto; }
  .gen-label { grid-column: 1 / -1; }
}

.close-page {
  width: min(640px, 100%);
  margin: 8px auto 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.close-lead {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.close-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.close-meta div,
.close-summary > div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--input-bg);
}

.close-meta div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.close-meta span,
.close-desc span,
.close-summary dt {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.close-meta b {
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.close-desc {
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--chip);
  line-height: 1.45;
}

.close-desc span {
  display: block;
  margin-bottom: 4px;
}

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

.close-form .form-control,
.close-form .form-select {
  min-height: 42px;
}

.close-form textarea.form-control {
  min-height: 120px;
  resize: vertical;
}

.close-form .form-select {
  background-color: var(--input-bg);
  background-image: var(--bs-form-select-bg-img);
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px 12px;
}

.close-form .form-select:disabled {
  color: var(--text-muted);
  background-color: var(--bg-soft);
  opacity: 1;
}

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

.close-actions .btn {
  min-height: 42px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.close-result {
  margin: 0;
}

.close-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0 16px;
}

.close-summary > div {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.close-summary dd {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 767.98px) {
  .close-meta,
  .close-summary > div { grid-template-columns: 1fr; }
}

@media (max-width: 767.98px) {
  .doc-upload-form { grid-template-columns: 1fr; }
  .doc-upload-form .btn { width: 100%; }
  .doc-list-head { flex-wrap: wrap; }
  .doc-search { width: 100%; margin-left: 0; }
  .doc-table-wrap { display: none; }
  .doc-cards { display: flex; }
}

.accordion-summary {
  margin-left: 10px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.82rem;
}

.report-warn {
  color: var(--danger-text);
  font-weight: 750;
}

.report-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}

.report-users-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.report-users-head .form-label { margin: 0; }

.report-form select[multiple] {
  width: 100%;
  height: 11rem;
}

.report-period {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.report-period > div { width: 11.5rem; }

.admin-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.admin-head-action {
  flex: 0 0 auto;
  margin-left: auto;
}

.admin-head-action .btn {
  min-height: 42px;
  padding: 0 16px;
}

.admin-title {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.admin-lead {
  margin: 4px 0 0;
  max-width: 46rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.admin-subtitle {
  margin: 0 0 10px;
  font-size: 1rem;
  font-weight: 800;
}

.admin-subtitle + .admin-subtitle,
form + .admin-subtitle { margin-top: 18px; }

.admin-panel {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
}

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

.admin-tools .form-control,
.admin-filters .form-control,
.admin-filters .form-select,
.admin-filters .btn,
.report-form .form-control,
.report-form .form-select,
.report-form .btn:not(.btn-sm) {
  min-height: 42px;
}

.admin-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 14px;
}

.admin-filters .btn,
.report-form .btn:not(.btn-sm) {
  padding: 0 16px;
}

.admin-note {
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.admin-page > .alert { margin: 0; }

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

.admin-bulk > .btn {
  margin: 0 0 12px;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.admin-actions form { margin: 0; }

.admin-dialog {
  width: min(560px, calc(100% - 1.5rem));
  max-width: min(560px, calc(100% - 1.5rem));
  margin-left: auto;
  margin-right: auto;
}

.admin-dialog .modal-header,
.admin-dialog .modal-footer { border: 0; }

.admin-dialog .modal-header {
  align-items: flex-start;
  padding: 18px 18px 0;
}

.admin-dialog .modal-title {
  font-size: 1.2rem;
  font-weight: 750;
}

.user-dialog-kicker {
  margin: 0 0 2px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.admin-dialog .modal-body { padding: 14px 18px 2px; }

.user-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 12px;
  margin: 0;
}

.user-form .settings-field { min-width: 0; }

.user-form .is-wide { grid-column: 1 / -1; }

.user-form .form-control,
.user-form .form-select {
  width: 100%;
  height: 42px;
  min-height: 42px;
  margin: 0;
}

.user-form .form-select {
  background-color: var(--input-bg);
  background-image: var(--bs-form-select-bg-img);
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px 12px;
}

.admin-dialog .modal-footer {
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 18px 18px;
}

.admin-dialog .user-dialog-delete { margin-right: auto; }

.admin-dialog .btn {
  min-height: 42px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.admin-dialog .settings-form { margin-top: 4px; }

.admin-page .accordion {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-page .accordion-item {
  overflow: hidden;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  background: var(--panel);
}

.admin-page .accordion-button {
  min-height: 52px;
  padding: 12px 16px;
}

.admin-page .accordion .form-control:not(.form-control-sm),
.admin-page .accordion .form-select:not(.form-select-sm),
.admin-page .accordion .btn:not(.btn-sm) {
  min-height: 42px;
}

.admin-page .nav-pills {
  gap: 6px;
}

.admin-page .nav-pills .nav-link {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--chip);
  color: var(--text-muted);
  font-weight: 650;
}

.admin-page .nav-pills .nav-link.active {
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-contrast);
}

.admin-page .nav-tabs {
  gap: 4px;
  border-bottom-color: var(--border);
}

.admin-page .nav-tabs .nav-link {
  border: 0;
  border-radius: 8px 8px 0 0;
  color: var(--text-muted);
  font-weight: 700;
}

.admin-page .nav-tabs .nav-link.active {
  border: 1px solid var(--border);
  border-bottom-color: transparent;
  background: var(--bg-elevated);
  color: var(--text);
}

.ref-scroll { max-height: min(70vh, 640px); overflow: auto; }

.ref-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-elevated);
}

.ref-table td,
.ref-table th { vertical-align: middle; }

.ref-actions { width: 1%; white-space: nowrap; }
.ref-col-type { width: 7.5rem; }
.ref-col-status { width: 9rem; }
.ref-node-list .list-group-item { padding: 0.55rem 0.75rem; }

@media (max-width: 767.98px) {
  .admin-actions { justify-content: flex-start; }
  .admin-filters .btn,
  .report-period,
  .report-period > div,
  .report-period > .btn { width: 100%; }
  .user-form { grid-template-columns: 1fr; }
  .user-form .is-wide { grid-column: auto; }
}

@media (max-width: 420px) {
  .admin-dialog .modal-footer:has(.user-dialog-delete) {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .admin-dialog .modal-footer:has(.user-dialog-delete) .btn-success {
    grid-column: 1 / -1;
    order: -1;
  }

  .admin-dialog .modal-footer:has(.user-dialog-delete) .user-dialog-delete {
    margin-right: 0;
  }
}
