:root {
  --sidebar-width: 288px;
  --panel-bg: rgba(15, 23, 42, 0.82);
  --panel-border: rgba(148, 163, 184, 0.18);
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(14, 165, 233, 0.18), transparent 30rem),
    radial-gradient(circle at bottom right, rgba(59, 130, 246, 0.14), transparent 28rem),
    #020617;
}

.auth-body {
  display: grid;
  place-items: center;
}

.auth-shell {
  width: min(100%, 460px);
  padding: 1rem;
}

.auth-card,
.panel,
.metric-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(18px);
}

.auth-card {
  border-radius: 28px;
  padding: 2rem;
}

.auth-logo,
.brand-logo {
  display: inline-grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  color: white;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.2rem;
  border-right: 1px solid var(--panel-border);
  background: rgba(2, 6, 23, 0.92);
  overflow-y: auto;
}

.brand-mark {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  margin-bottom: 1.4rem;
}

.brand-mark small {
  display: block;
  color: #94a3b8;
}

.sidebar .nav-link {
  color: #cbd5e1;
  border-radius: 0.85rem;
  padding: 0.68rem 0.8rem;
}

.sidebar .nav-link:hover {
  background: rgba(14, 165, 233, 0.14);
  color: white;
}

.nav-section {
  margin: 0.8rem 0 0.25rem;
  padding: 0 0.8rem;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.content {
  padding: 1.1rem;
}

.topbar,
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar {
  margin-bottom: 1.4rem;
}

.topbar h1,
.panel h2 {
  margin: 0;
  font-size: 1.35rem;
}

.search-input {
  width: 260px;
}

.search-results {
  position: fixed;
  right: 10rem;
  top: 4rem;
  z-index: 10;
  width: 320px;
  border: 1px solid var(--panel-border);
  border-radius: 1rem;
  background: #0f172a;
  padding: 0.5rem;
}

.search-results a {
  display: block;
  padding: 0.55rem 0.7rem;
  color: white;
  text-decoration: none;
  border-radius: 0.7rem;
}

.search-results a:hover {
  background: rgba(14, 165, 233, 0.14);
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1rem;
}

.metric-card,
.panel {
  border-radius: 22px;
  padding: 1.15rem;
}

.metric-card span,
.metric-card small {
  display: block;
  color: #94a3b8;
}

.metric-card strong {
  display: block;
  margin: 0.35rem 0;
  font-size: 2rem;
}

.metric-card.danger strong {
  color: #f87171;
}

.chart-bars {
  min-height: 220px;
  display: flex;
  gap: 0.65rem;
  align-items: end;
  padding-top: 1rem;
}

.chart-bar {
  flex: 1;
  text-align: center;
}

.chart-bar span {
  display: block;
  min-height: 8px;
  border-radius: 999px 999px 0 0;
  background: linear-gradient(180deg, #38bdf8, #2563eb);
}

.chart-bar small {
  color: #94a3b8;
}

.alert-row {
  border: 1px solid var(--panel-border);
  border-left: 4px solid #38bdf8;
  border-radius: 0.8rem;
  padding: 0.7rem;
}

.alert-row.warning {
  border-left-color: #f59e0b;
}

.alert-row.critical {
  border-left-color: #ef4444;
}

.alert-row small {
  display: block;
  color: #94a3b8;
}

.table {
  --bs-table-bg: transparent;
}

.module-table-wrap {
  overflow-x: auto;
  margin-top: 0.75rem;
}

.module-table {
  min-width: 1080px;
  table-layout: fixed;
  font-size: 0.84rem;
}

.module-table th,
.module-table td {
  white-space: nowrap;
  vertical-align: middle;
  padding: 0.55rem 0.6rem;
}

.module-cell {
  overflow: hidden;
  text-overflow: ellipsis;
}

.module-cell-id {
  width: 56px;
}

.module-cell-ban_status {
  text-align: center;
}

.module-actions {
  min-width: 156px;
  white-space: nowrap;
  text-align: right;
}

.module-actions .btn {
  margin-left: 0.25rem;
}

.module-table-domains {
  min-width: 1280px;
}

.module-table-domains th:nth-child(1),
.module-table-domains td:nth-child(1) {
  width: 58px;
}

.module-table-domains th:nth-child(2),
.module-table-domains td:nth-child(2) {
  width: 180px;
}

.module-table-domains th:nth-child(3),
.module-table-domains td:nth-child(3) {
  width: 120px;
}

.module-table-domains th:nth-child(4),
.module-table-domains td:nth-child(4) {
  width: 80px;
  text-align: center;
}

.module-table-domains th:nth-child(5),
.module-table-domains td:nth-child(5),
.module-table-domains th:nth-child(7),
.module-table-domains td:nth-child(7),
.module-table-domains th:nth-child(8),
.module-table-domains td:nth-child(8) {
  width: 190px;
}

.module-table-domains th:nth-child(6),
.module-table-domains td:nth-child(6) {
  width: 120px;
  text-align: center;
}

.module-table-domains th:nth-child(9),
.module-table-domains td:nth-child(9) {
  width: 130px;
}

.module-table-domains th:last-child,
.module-table-domains td:last-child {
  width: 260px;
}

.status-dot {
  display: inline-block;
  width: 0.68rem;
  height: 0.68rem;
  margin-right: 0.4rem;
  border-radius: 999px;
  vertical-align: middle;
}

.status-dot.success {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.16);
}

.status-dot.danger {
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.16);
}

.balancer-table-wrap {
  overflow-x: auto;
  overflow-y: visible;
  max-width: calc(100vw - var(--sidebar-width) - 3.5rem);
  padding-bottom: 7rem;
}

.balancer-table {
  min-width: 1240px;
  table-layout: fixed;
  font-size: 0.82rem;
}

.balancer-table th,
.balancer-table td {
  white-space: nowrap;
  vertical-align: middle;
  padding: 0.68rem 0.6rem;
  height: 56px;
}

.balancer-table th:nth-child(1),
.balancer-table td:nth-child(1) {
  width: 64px;
}

.balancer-table th:nth-child(2),
.balancer-table td:nth-child(2) {
  width: 140px;
}

.balancer-table th:nth-child(3),
.balancer-table td:nth-child(3) {
  width: 170px;
}

.balancer-table th:nth-child(4),
.balancer-table td:nth-child(4),
.balancer-table th:nth-child(5),
.balancer-table td:nth-child(5) {
  width: 210px;
}

.balancer-table th:nth-child(6),
.balancer-table td:nth-child(6) {
  width: 105px;
}

.balancer-table th:nth-child(7),
.balancer-table td:nth-child(7) {
  width: 86px;
}

.balancer-table th:nth-child(8),
.balancer-table td:nth-child(8) {
  width: 390px;
}

.balancer-table th:last-child,
.balancer-table td:last-child {
  position: sticky;
  right: 0;
  width: 112px;
  background: #0f172a;
  box-shadow: -8px 0 16px rgba(2, 6, 23, 0.35);
  z-index: 3;
}

.balancer-table tr.dropdown-open-row {
  position: relative;
  z-index: 1000;
}

.balancer-table tr.dropdown-open-row td {
  position: relative;
  z-index: 1000;
}

.balancer-table tr.dropdown-open-row td:last-child {
  z-index: 1001;
}

.balancer-cell {
  overflow: hidden;
  text-overflow: ellipsis;
}

.balancer-settings-cell {
  min-width: 390px;
  max-width: 390px;
}

.balancer-remote-edit-cell {
  min-width: 210px;
}

.balancer-remote-input {
  width: 100%;
  height: 38px;
  font-size: 0.78rem;
}

.balancer-failover-input {
  width: 100%;
  max-width: 100%;
  height: 38px;
  min-height: 38px;
  max-height: 140px;
  resize: vertical;
  white-space: pre;
  overflow: auto;
  box-sizing: border-box;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
}

.balancer-remote-input[data-dirty="1"],
.balancer-failover-input[data-dirty="1"] {
  border-color: #f59e0b;
}

.balancer-remote-input.balancer-saved,
.balancer-failover-input.balancer-saved {
  border-color: #22c55e;
}

.balancer-actions {
  text-align: right;
  overflow: visible;
}

.balancer-actions .dropdown {
  position: relative;
  display: inline-block;
}

.balancer-actions .dropdown-menu {
  top: calc(100% + 0.25rem);
  right: 0;
  left: auto;
  z-index: 5000;
  min-width: 205px;
  transform: none !important;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.45);
}

.otp-input {
  letter-spacing: 0.5rem;
  font-weight: 700;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .grid-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .search-input {
    width: 100%;
  }
}
