:root {
  --bg: #07101d;
  --bg-alt: #0b1629;
  --panel: rgba(10, 20, 38, 0.96);
  --panel-2: rgba(8, 16, 31, 0.98);
  --line: rgba(123, 172, 255, 0.18);
  --text: #edf4ff;
  --muted: #92a9cc;
  --blue: #61abff;
  --green: #56dda6;
  --red: #ff7481;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.24);
  --sidebar-width: 270px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle, rgba(135, 176, 255, 0.14) 0.8px, transparent 0.9px),
    radial-gradient(circle at 10% 10%, rgba(68, 129, 255, 0.22), transparent 24%),
    radial-gradient(circle at 85% 20%, rgba(57, 154, 255, 0.12), transparent 20%),
    linear-gradient(160deg, #050b14 0%, #08111f 52%, #0a1425 100%);
  background-size: 20px 20px, auto, auto, auto;
  background-position: 0 0, 0 0, 0 0, 0 0;
}

body.modal-open {
  overflow: hidden;
}

body::before {
  content: none;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  position: relative;
  align-items: start;
}

.app-shell > * {
  min-width: 0;
}

.sidebar {
  position: sticky;
  top: 18px;
  align-self: start;
  margin: 18px 0 18px 18px;
  min-height: calc(100vh - 36px);
  max-height: calc(100vh - 36px);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(10, 19, 36, 0.96), rgba(8, 16, 31, 0.92));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  z-index: 30;
}

.sidebar-head,
.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-head {
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(123, 172, 255, 0.12);
}

.brand {
  margin-bottom: 0;
}

.brand-badge {
  min-height: 56px;
  padding: 0 20px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.08rem;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, rgba(97, 171, 255, 0.25), rgba(86, 221, 166, 0.22));
  border: 1px solid rgba(97, 171, 255, 0.28);
}

.muted,
.hint {
  color: var(--muted);
}

.binding-protocol-note {
  margin: -2px 0 4px;
  font-size: 0.88rem;
  line-height: 1.45;
}

.binding-protocol-note.warning {
  color: #ffd7a6;
}

.binding-protocol-note.error {
  color: #ffc7ce;
}

.nav {
  display: grid;
  gap: 18px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  align-content: start;
  padding-right: 4px;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.nav::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.nav-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.nav-section {
  display: grid;
  gap: 8px;
  padding: 10px 12px 12px;
  border: 1px solid rgba(97, 171, 255, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.02);
}

.nav-section[data-open="0"] .nav-group {
  display: none;
}

.nav-title {
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #7fa7de;
}

.nav-tool-button,
.nav-section-toggle,
.sidebar-mobile-toggle,
.sidebar-close {
  appearance: none;
  border-radius: 14px;
  font: inherit;
}

.nav-tool-button,
.sidebar-close {
  padding: 9px 12px;
  border: 1px solid rgba(97, 171, 255, 0.18);
  background: rgba(97, 171, 255, 0.08);
  color: var(--text);
  cursor: pointer;
}

.nav-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.nav-chevron {
  width: 12px;
  height: 12px;
  border-right: 2px solid rgba(158, 197, 255, 0.82);
  border-bottom: 2px solid rgba(158, 197, 255, 0.82);
  transform: rotate(45deg);
  transition: transform 0.18s ease;
  margin-right: 4px;
}

.nav-section[data-open="1"] .nav-chevron {
  transform: rotate(225deg);
}

.nav-group {
  display: grid;
  gap: 8px;
}

.nav a,
.logout button,
.impersonation button,
button {
  appearance: none;
  border: 0;
  border-radius: 14px;
  font: inherit;
}

.nav a {
  text-decoration: none;
  color: var(--text);
  padding: 12px 14px;
  border: 1px solid transparent;
}

.nav a:hover,
.nav a.active {
  background: rgba(97, 171, 255, 0.09);
  border-color: rgba(97, 171, 255, 0.24);
}

.logout {
  margin-top: 0;
  padding-top: 16px;
  border-top: 1px solid rgba(123, 172, 255, 0.12);
  background: linear-gradient(180deg, rgba(8, 16, 31, 0), rgba(8, 16, 31, 0.9) 24%, rgba(8, 16, 31, 0.98) 100%);
  position: sticky;
  bottom: 0;
  z-index: 1;
}

.logout button,
.impersonation button,
button {
  padding: 12px 16px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--green), #8ff0c8);
  color: #04111f;
  font-weight: 700;
}

.main {
  padding: 34px;
}

.mobile-topbar,
.sidebar-close,
.sidebar-mobile-toggle {
  display: none;
}

.sidebar-mobile-toggle {
  padding: 10px 14px;
  border: 1px solid rgba(97, 171, 255, 0.18);
  background: rgba(97, 171, 255, 0.1);
  color: var(--text);
  cursor: pointer;
}

.sidebar-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(2, 7, 14, 0.62);
  z-index: 24;
}

.impersonation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(255, 116, 129, 0.08);
  border: 1px solid rgba(255, 116, 129, 0.18);
}

.impersonation span {
  display: block;
  color: #ffc5cb;
}

.page-head,
.login-hero {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.login-hero {
  min-height: calc(100vh - 68px);
  align-items: center;
}

.hero-copy {
  max-width: 700px;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #9ec5ff;
}

h1, h2 {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1;
}

h2 {
  font-size: 1.15rem;
}

.grid {
  display: grid;
  gap: 22px;
  margin-bottom: 0;
}

.grid > * {
  min-width: 0;
}

.two-up { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
  margin-bottom: 0;
}

.stat-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 22px;
  display: grid;
  gap: 10px;
}

.stat-card span {
  color: var(--muted);
}

.stat-card strong {
  font-size: 2rem;
}

.panel {
  padding: 22px;
}

.main > section {
  margin: 0;
  min-width: 0;
}

.main > section + section {
  margin-top: 22px;
}

.auth-card {
  width: min(440px, 100%);
}

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

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-head span {
  color: var(--muted);
}

.stack {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(123, 172, 255, 0.16);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.error {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 116, 129, 0.12);
  border: 1px solid rgba(255, 116, 129, 0.2);
  color: #ffc7ce;
}

.security-notice-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 183, 94, 0.28);
  background: linear-gradient(135deg, rgba(52, 27, 12, 0.94), rgba(24, 17, 9, 0.94));
  color: #ffe7bf;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
}

.security-notice-banner.closing {
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.security-notice-body {
  display: grid;
  gap: 6px;
}

.security-notice-body strong {
  font-size: 0.95rem;
}

.security-notice-body span {
  line-height: 1.5;
  font-size: 0.9rem;
  color: inherit;
}

.security-notice-close {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
}

.flash-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1400;
  width: min(320px, calc(100vw - 20px));
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(123, 172, 255, 0.18);
  background: rgba(8, 16, 31, 0.96);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.22);
  animation: flash-toast-in 180ms ease;
}

.flash-toast.closing {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.flash-toast-body {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.flash-toast-title {
  font-size: 0.9rem;
}

.flash-toast-body span {
  color: inherit;
  line-height: 1.45;
  font-size: 0.88rem;
}

.flash-toast-close {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
}

.flash-error {
  border-color: rgba(255, 116, 129, 0.26);
  background: rgba(35, 11, 17, 0.96);
  color: #ffd3d8;
}

.flash-success {
  border-color: rgba(86, 221, 166, 0.28);
  background: rgba(10, 28, 24, 0.96);
  color: #cffff0;
}

@keyframes flash-toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .security-notice-banner {
    flex-direction: column;
    align-items: stretch;
  }

  .security-notice-close {
    width: 100%;
  }

  .flash-toast {
    top: auto;
    right: 12px;
    left: 12px;
    bottom: 14px;
    width: auto;
  }
}

.token-reveal code {
  display: block;
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(8, 16, 31, 0.86);
  border: 1px solid rgba(123, 172, 255, 0.18);
}

.scope-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.scope-card {
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(123, 172, 255, 0.16);
  background: rgba(8, 16, 31, 0.5);
}

.scope-card strong {
  display: block;
  font-size: 1.5rem;
  margin-bottom: 6px;
}

.scope-card span {
  color: var(--muted);
}

.table-wrap {
  overflow: auto;
  width: 100%;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
}

.table-wrap.panel-scroll {
  max-height: 460px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 11px 10px;
  border-bottom: 1px solid rgba(123, 172, 255, 0.1);
  font-size: 0.92rem;
  vertical-align: top;
}

th {
  color: #aac7f4;
}

.inline-form {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.inline-password {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-left: 10px;
}

.inline-password input {
  width: 150px;
  padding: 9px 10px;
}

code {
  color: #d0e3ff;
  white-space: pre-wrap;
  word-break: break-word;
}

.edit-box {
  display: block;
}

.edit-box summary {
  cursor: pointer;
  color: #9ec5ff;
  margin-bottom: 8px;
  list-style: none;
}

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

.compact-form {
  margin-top: 10px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(123, 172, 255, 0.14);
  background: rgba(8, 16, 31, 0.82);
}

.compact-form textarea {
  min-height: 72px;
}

.preset-modal-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--green), #8ff0c8);
  color: #04111f !important;
  font-weight: 700;
  border: 0;
  margin: 0;
}

.preset-builder {
  gap: 16px;
}

.preset-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.preset-builder-section {
  display: grid;
  gap: 12px;
}

.preset-builder-section h3,
.preset-thresholds summary {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.preset-toggle-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.preset-toggle-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(123, 172, 255, 0.14);
  background: rgba(255, 255, 255, 0.02);
}

.preset-toggle-card.disabled {
  opacity: 0.62;
}

.preset-toggle-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.preset-toggle-head input[type="checkbox"] {
  width: auto;
}

.preset-dependent-note {
  margin: 0;
}

.preset-thresholds {
  display: grid;
  gap: 14px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(123, 172, 255, 0.14);
  background: rgba(255, 255, 255, 0.02);
}

.preset-thresholds summary {
  cursor: pointer;
  list-style: none;
}

.preset-thresholds summary::-webkit-details-marker {
  display: none;
}

.preset-threshold-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.preset-badge-list,
.preset-highlight-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preset-badge,
.preset-highlight {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(97, 171, 255, 0.16);
  background: rgba(97, 171, 255, 0.08);
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1;
}

.preset-highlight {
  background: rgba(86, 221, 166, 0.08);
  border-color: rgba(86, 221, 166, 0.16);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-row input[type="checkbox"] {
  width: auto;
}

.field-hint {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.profile-options-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(123, 172, 255, 0.14);
  background: rgba(255, 255, 255, 0.02);
}

.profile-options-card.compact {
  margin-top: 2px;
}

.profile-options-card legend {
  padding: 0 8px;
  color: #9ec5ff;
  font-weight: 700;
}

.profile-options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.profile-options-grid .checkbox-row {
  align-items: flex-start;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(97, 171, 255, 0.12);
  background: rgba(10, 19, 36, 0.55);
}

.profile-option-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(97, 171, 255, 0.14);
  background: rgba(9, 18, 34, 0.72);
}

.profile-option-box .checkbox-row {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.profile-option-box .muted {
  margin: 0;
  padding-top: 2px;
}

.profile-options-grid .checkbox-row span {
  display: grid;
  gap: 4px;
}

.profile-options-grid .checkbox-row strong {
  font-size: 0.95rem;
}

.profile-options-grid .checkbox-row small {
  color: var(--muted);
  line-height: 1.45;
}

.compatibility-note,
.table-meta {
  color: var(--muted);
}

.table-meta {
  margin-top: 4px;
  font-size: 0.84rem;
  line-height: 1.45;
}

.compatibility-note {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 186, 102, 0.18);
  background: rgba(255, 186, 102, 0.06);
}

.compatibility-note strong {
  color: #ffd9a2;
}

.compatibility-note p {
  margin: 0;
  white-space: pre-line;
}

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

.overview-controls {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.quick-range {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.range-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(97, 171, 255, 0.16);
  background: rgba(97, 171, 255, 0.08);
  color: var(--text);
  text-decoration: none;
}

.range-chip.active {
  background: linear-gradient(135deg, rgba(97, 171, 255, 0.95), rgba(86, 221, 166, 0.85));
  color: #07101d;
}

.custom-range {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  min-width: 0;
}

.refresh-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.compact-refresh-controls {
  display: grid;
  gap: 10px;
  justify-content: stretch;
  align-items: start;
  margin-bottom: 12px;
}

.refresh-chip-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.refresh-chip-row > * {
  flex: 0 0 auto;
}

.refresh-toggle.paused {
  background: linear-gradient(135deg, rgba(255, 182, 72, 0.95), rgba(255, 116, 129, 0.9));
  color: #07101d;
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mini-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.overview-top-grid {
  align-items: stretch;
}

.overview-summary-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
}

.overview-summary-panel .mini-stat-grid {
  flex: 1 1 auto;
  align-content: start;
}

.overview-notes-card {
  margin-top: auto;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(123, 172, 255, 0.14);
  background: rgba(8, 16, 31, 0.82);
}

.overview-notes-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  align-items: flex-start;
}

.overview-notes-card-head strong {
  font-size: 0.98rem;
}

.overview-notes-card-head span {
  color: var(--muted);
  font-size: 0.84rem;
  text-align: right;
}

.overview-notes-copy {
  margin: 0;
  line-height: 1.45;
}

.maintenance-info-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100%;
}

.maintenance-info-panel .panel-head {
  margin-bottom: 12px;
}

.maintenance-info-wrap {
  min-height: 0;
}

.maintenance-meta-cell {
  min-width: 0;
}

.maintenance-meta-line {
  white-space: nowrap;
}

.maintenance-meta-subtle {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 4px;
}

.maintenance-info-table th:nth-child(2),
.maintenance-info-table td:nth-child(2),
.maintenance-info-table th:nth-child(3),
.maintenance-info-table td:nth-child(3) {
  white-space: nowrap;
}

.maintenance-title-cell {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.maintenance-title-cell > div {
  min-width: 0;
}

.maintenance-title-cell strong {
  display: block;
  line-height: 1.35;
}

.maintenance-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  display: inline-block;
  flex: 0 0 auto;
}

.maintenance-dot-green {
  background: #56dda6;
  box-shadow: 0 0 0 4px rgba(86, 221, 166, 0.16);
}

.maintenance-dot-yellow {
  background: #f8cc6a;
  box-shadow: 0 0 0 4px rgba(248, 204, 106, 0.16);
}

.maintenance-dot-red {
  background: #ff7481;
  box-shadow: 0 0 0 4px rgba(255, 116, 129, 0.16);
}

.maintenance-link-button {
  width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  text-align: left;
  box-shadow: none;
}

.maintenance-link-button:hover,
.maintenance-link-button:focus-visible {
  color: #cfe0ff;
  outline: none;
}

.maintenance-link-button span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.maintenance-state-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(123, 172, 255, 0.18);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.maintenance-state-in-progress {
  background: rgba(255, 116, 129, 0.14);
  border-color: rgba(255, 116, 129, 0.22);
  color: #ffd3d8;
}

.maintenance-state-scheduled {
  background: rgba(248, 204, 106, 0.14);
  border-color: rgba(248, 204, 106, 0.24);
  color: #ffe6af;
}

.maintenance-state-completed {
  background: rgba(86, 221, 166, 0.14);
  border-color: rgba(86, 221, 166, 0.22);
  color: #cfffee;
}

.maintenance-modal-meta {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

.maintenance-modal-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.maintenance-modal-title strong {
  font-size: 1.06rem;
}

.maintenance-modal-body {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(123, 172, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: #dce9ff;
  line-height: 1.7;
  white-space: pre-wrap;
}

.mini-stat {
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(123, 172, 255, 0.14);
  background: rgba(8, 16, 31, 0.74);
}

.mini-stat span {
  display: block;
  color: var(--muted);
  margin-bottom: 6px;
}

.mini-stat strong {
  font-size: 1.35rem;
}

.chart-legend {
  display: flex;
  gap: 18px;
  margin-bottom: 10px;
  color: var(--muted);
}

.chart-legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  margin-right: 6px;
}

.chart-stage {
  position: relative;
  min-width: 0;
  overflow: hidden;
}

#overview-chart,
#overview-out-chart {
  width: 100%;
  display: block;
}

.chart-tooltip {
  position: absolute;
  z-index: 5;
  min-width: 170px;
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(123, 172, 255, 0.24);
  background: rgba(6, 13, 25, 0.96);
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.36);
  pointer-events: none;
}

.chart-tooltip strong {
  font-size: 0.95rem;
}

.chart-tooltip span {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  white-space: nowrap;
}

.chart-tooltip b {
  color: var(--text);
  font-weight: 700;
}

.chart-tooltip i {
  flex: 0 0 12px;
  margin-right: 0;
}

.legend-pass {
  background: #56dda6;
}

.legend-drop {
  background: #ff7481;
}

.table-wrap td .edit-box + .inline-form,
.table-wrap td .inline-form + .inline-form {
  margin-top: 8px;
}

.table-link {
  color: #9ec5ff;
  text-decoration: none;
}

.table-link:hover {
  text-decoration: underline;
}

.preset-action {
  width: 100%;
  flex-wrap: wrap;
}

.preset-action select {
  min-width: 180px;
}

.batch-toolbar {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 320px) auto;
  gap: 12px;
  align-items: end;
}

.router-pick-list {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(123, 172, 255, 0.14);
  background: rgba(8, 16, 31, 0.74);
}

.router-pick-list[hidden] {
  display: none;
}

.picker-title {
  color: var(--muted);
  font-size: 0.9rem;
}

.router-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.router-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(123, 172, 255, 0.16);
  background: rgba(11, 22, 41, 0.92);
  color: var(--text);
}

.router-pill input[type="checkbox"] {
  width: auto;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.compact-pager {
  margin-top: 14px;
}

.pager-link {
  color: #9ec5ff;
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(123, 172, 255, 0.16);
  background: rgba(8, 16, 31, 0.74);
}

.pager-link.disabled,
button.pager-link:disabled {
  pointer-events: none;
  opacity: 0.45;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  padding: 9px 13px;
  border-radius: 12px;
  border: 1px solid rgba(123, 172, 255, 0.18);
  background: rgba(8, 16, 31, 0.74);
  color: #9ec5ff;
  text-decoration: none;
  font-weight: 700;
}

.button-link-compact {
  min-width: 0;
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 0.92rem;
}

.subnav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.ip-detail-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.subnav a,
.ip-detail-tab {
  text-decoration: none;
  color: var(--text);
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  min-height: 96px;
  border-radius: 20px;
  border: 1px solid rgba(123, 172, 255, 0.16);
  background:
    linear-gradient(180deg, rgba(18, 32, 58, 0.92), rgba(8, 16, 31, 0.82));
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.22);
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.subnav a strong,
.ip-detail-tab strong {
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.subnav a span,
.ip-detail-tab span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.subnav a.active,
.subnav a:hover,
.ip-detail-tab.active,
.ip-detail-tab:hover {
  transform: translateY(-2px);
  border-color: rgba(123, 172, 255, 0.32);
  box-shadow: 0 22px 42px rgba(0, 0, 0, 0.28);
}

.subnav a.active,
.ip-detail-tab.active {
  background:
    linear-gradient(135deg, rgba(97, 171, 255, 0.22), rgba(86, 221, 166, 0.16)),
    linear-gradient(180deg, rgba(20, 38, 69, 0.98), rgba(10, 20, 37, 0.92));
  border-color: rgba(97, 171, 255, 0.42);
}

.subnav a.active strong,
.ip-detail-tab.active strong {
  color: #dff0ff;
}

.subnav a.active span,
.ip-detail-tab.active span {
  color: #c3dbff;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

#visible-scope {
  scroll-margin-top: 18px;
}

.scope-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.scope-grid .info-pill {
  width: 100%;
  justify-content: flex-start;
  border-radius: 16px;
}

.invite-cancel-link,
.invite-edit-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 14px;
  text-decoration: none;
}

.info-pill {
  display: inline-flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(123, 172, 255, 0.16);
  background: rgba(8, 16, 31, 0.74);
  color: var(--text);
}

.info-pill-compact {
  padding: 8px 10px;
  font-size: 0.88rem;
}

.panel-nested {
  margin: 0;
  background: rgba(8, 16, 31, 0.76);
}

.user-access-admin-list {
  display: grid;
  gap: 10px;
}

.user-access-admin-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(123, 172, 255, 0.14);
  background: rgba(8, 16, 31, 0.68);
}

.user-access-admin-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.user-access-admin-item-rich {
  align-items: flex-start;
}

.user-access-admin-item-rich > div {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.user-manage-access-stack {
  gap: 14px;
}

.user-manage-access-section {
  border: 1px solid rgba(123, 172, 255, 0.12);
  border-radius: 18px;
  padding: 12px;
  background: rgba(8, 16, 31, 0.58);
}

.admin-delegated-source-results {
  margin-top: 8px;
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.admin-delegated-source-option {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(123, 172, 255, 0.14);
  background: rgba(8, 16, 31, 0.68);
  color: var(--text);
}

.admin-delegated-source-option:hover {
  border-color: rgba(123, 172, 255, 0.3);
  background: rgba(12, 23, 44, 0.88);
}

.admin-delegated-source-option-empty {
  cursor: default;
  opacity: 0.8;
}

.admin-delegated-source-current {
  margin-top: 8px;
}

.user-manage-access-section > summary {
  margin-bottom: 0;
  font-weight: 700;
}

.user-manage-access-section[open] > summary {
  margin-bottom: 12px;
}

.invite-scope-summary {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(123, 172, 255, 0.14);
  background: rgba(8, 16, 31, 0.68);
}

.screen-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
}

.screen-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 9, 17, 0.82);
  backdrop-filter: blur(8px);
}

.screen-modal-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(1180px, calc(100vw - 28px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 24px;
  border-radius: 28px;
  border: 1px solid rgba(123, 172, 255, 0.18);
  background: linear-gradient(180deg, rgba(12, 23, 43, 0.98), rgba(8, 16, 31, 0.96));
  box-shadow: var(--shadow);
}

.screen-modal-head,
.screen-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.screen-modal-head {
  margin-bottom: 18px;
}

.screen-modal-foot {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(123, 172, 255, 0.12);
}

.invite-builder-grid {
  align-items: start;
}

.invite-ip-toolbar {
  grid-template-columns: minmax(0, 1fr) auto;
}

.ticket-message {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(123, 172, 255, 0.14);
  background: rgba(8, 16, 31, 0.74);
}

.ticket-message.owner {
  border-color: rgba(86, 221, 166, 0.18);
  background: rgba(14, 32, 33, 0.58);
}

.ticket-message-body {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
}

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 1200;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 8, 15, 0.78);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(720px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  padding: 18px;
  border-radius: 28px;
  border: 1px solid rgba(123, 172, 255, 0.22);
  background: rgba(6, 13, 25, 0.97);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.55);
}

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

.modal-body .compact-form {
  margin-top: 0;
}

.modal-close {
  background: rgba(97, 171, 255, 0.12);
  color: var(--text);
}

.router-count-trigger {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.router-count-trigger span {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.router-list-modal {
  display: grid;
  gap: 14px;
}

.router-list-modal-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.router-list-modal-list li {
  color: var(--text);
}

.attack-type-summary {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.attack-type-summary-label {
  min-width: 0;
}

.attack-type-summary-trigger {
  appearance: none;
  border: 1px solid rgba(97, 171, 255, 0.22);
  border-radius: 999px;
  padding: 3px 9px;
  background: rgba(97, 171, 255, 0.12);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.attack-type-summary-trigger:hover,
.attack-type-summary-trigger:focus-visible {
  border-color: rgba(97, 171, 255, 0.42);
  background: rgba(97, 171, 255, 0.2);
  transform: translateY(-1px);
}

.attack-type-summary-popover {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 30;
  min-width: 280px;
  max-width: min(360px, 78vw);
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(97, 171, 255, 0.16);
  background:
    linear-gradient(180deg, rgba(12, 18, 31, 0.98), rgba(10, 15, 27, 0.98));
  box-shadow: 0 24px 46px rgba(3, 7, 18, 0.42);
  display: none;
  gap: 12px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.attack-type-summary:hover .attack-type-summary-popover,
.attack-type-summary:focus-within .attack-type-summary-popover {
  display: grid;
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.attack-type-summary-popover::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 22px;
  width: 14px;
  height: 14px;
  border-top: 1px solid rgba(97, 171, 255, 0.16);
  border-left: 1px solid rgba(97, 171, 255, 0.16);
  background: rgba(12, 18, 31, 0.98);
  transform: rotate(45deg);
}

.attack-type-summary-title {
  margin: 0;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
}

.attack-summary-detail-list,
.attack-type-summary-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.attack-summary-detail-item,
.attack-type-summary-item {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(97, 171, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
}

.attack-summary-detail-top,
.attack-type-summary-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.attack-summary-detail-top strong,
.attack-type-summary-top strong {
  color: var(--text);
  font-size: 0.88rem;
}

.attack-summary-detail-meta,
.attack-type-summary-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.attack-summary-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.attack-summary-status.live {
  background: rgba(100, 255, 191, 0.14);
  color: #9cffcb;
}

.attack-summary-status.ended {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.attack-summary-more {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.attack-summary-modal {
  display: grid;
  gap: 14px;
}

@media (max-width: 720px) {
  .attack-type-summary-popover {
    display: none;
  }
}

.button-danger {
  background: linear-gradient(135deg, #ff7481, #ff9ca5);
  color: #2d050d;
}

.maintenance-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.maintenance-option {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(97, 171, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
}

.maintenance-option strong {
  font-size: 0.95rem;
}

.maintenance-mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.maintenance-range {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.status-note {
  color: #ffb9bf;
  font-size: 0.85rem;
}

button[disabled] {
  cursor: not-allowed;
  opacity: 0.6;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .maintenance-grid,
  .two-up,
  .stat-grid {
    grid-template-columns: 1fr;
  }
  .inline-password {
    width: 100%;
    flex-wrap: wrap;
    margin-left: 0;
  }
  .inline-password input {
    width: 100%;
  }
  .table-actions {
    flex-direction: column;
    align-items: flex-start;
  }
  .custom-range,
  .mini-stat-grid,
  .filter-bar,
  .batch-toolbar {
    grid-template-columns: 1fr;
  }
  .subnav {
    grid-template-columns: 1fr;
  }
  .ip-detail-tabs {
    grid-template-columns: 1fr;
  }
  .maintenance-range,
  .invite-builder-grid,
  .preset-form-grid,
  .preset-toggle-grid,
  .preset-threshold-grid,
  .profile-options-grid {
    grid-template-columns: 1fr;
  }
  .scope-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .invite-ip-toolbar {
    grid-template-columns: 1fr;
  }
  .pager {
    flex-direction: column;
    align-items: flex-start;
  }
  .modal-card {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    padding: 16px;
  }
  .screen-modal-card {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    padding: 16px;
  }
}

@media (max-width: 720px) {
  .scope-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1180px) {
  .sidebar {
    position: fixed;
    top: max(8px, env(safe-area-inset-top));
    left: 12px;
    width: min(88vw, 360px);
    height: calc(100dvh - max(8px, env(safe-area-inset-top)) - env(safe-area-inset-bottom) - 12px);
    min-height: 0;
    max-height: calc(100dvh - max(8px, env(safe-area-inset-top)) - env(safe-area-inset-bottom) - 12px);
    margin: 0;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
    transform: translateX(-110%);
    transition: transform 0.18s ease;
    overflow: hidden;
  }
  .nav {
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    scrollbar-width: thin;
  }
  .nav::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }
  .logout {
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
  }
  .app-shell.sidebar-mobile-open .sidebar {
    transform: translateX(0);
  }
  .app-shell.sidebar-mobile-open .sidebar-scrim {
    display: block;
  }
  .mobile-topbar {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 18px;
  }
  .sidebar-mobile-toggle,
  .sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .main {
    padding: 18px;
  }
  .page-head,
  .login-hero {
    gap: 18px;
  }
}

@media (max-width: 768px) {
  .main {
    padding: 14px;
  }
  .panel,
  .stat-card {
    padding: 16px;
    border-radius: 22px;
  }
  .panel-head,
  .refresh-controls,
  .impersonation,
  .page-head,
  .login-hero {
    flex-direction: column;
    align-items: stretch;
  }
  .page-head,
  .login-hero {
    margin-bottom: 18px;
  }
  .chart-legend,
  .quick-range,
  .refresh-chip-row,
  .table-actions {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
  }
  .refresh-controls.compact-refresh-controls {
    gap: 8px;
  }
  .refresh-chip-row {
    width: 100%;
    max-width: 100%;
  }
  .chart-legend span,
  .refresh-chip-row .muted,
  .quick-range .range-chip,
  .table-actions > * {
    white-space: nowrap;
  }
  th,
  td {
    padding: 9px 8px;
    font-size: 0.86rem;
  }
  #overview-chart,
  #overview-out-chart {
    min-height: 220px;
  }
  .mobile-topbar {
    margin-bottom: 14px;
  }
}

@media (max-width: 540px) {
  .stat-grid,
  .scope-metrics,
  .mini-stat-grid {
    grid-template-columns: 1fr;
  }
  h1 {
    font-size: clamp(1.7rem, 9vw, 2.25rem);
  }
  .brand-badge {
    min-height: 48px;
    padding: 0 16px;
    font-size: 1rem;
  }
  .sidebar {
    width: min(92vw, 340px);
    top: max(8px, env(safe-area-inset-top));
    left: 8px;
    height: calc(100dvh - max(8px, env(safe-area-inset-top)) - env(safe-area-inset-bottom) - 8px);
    max-height: calc(100dvh - max(8px, env(safe-area-inset-top)) - env(safe-area-inset-bottom) - 8px);
    padding: 20px 16px;
  }
}
