:root {
  --pf-bg: #080c14;
  --pf-surface: rgba(18, 25, 39, .92);
  --pf-surface-2: #151e2f;
  --pf-border: rgba(148, 163, 184, .15);
  --pf-muted: #91a0b8;
  --pf-primary: #6ea8fe;
}

html, body { min-height: 100%; }
body {
  background:
    radial-gradient(circle at 8% 0%, rgba(13,110,253,.14), transparent 29rem),
    radial-gradient(circle at 90% 12%, rgba(13,202,240,.08), transparent 28rem),
    var(--pf-bg);
  color: #edf3ff;
}

.login-body {
  background:
    radial-gradient(circle at 50% -10%, rgba(13,110,253,.22), transparent 30rem),
    var(--pf-bg);
}

.dashboard-nav {
  background: rgba(8, 12, 20, .86);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--pf-border);
  min-height: 64px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg,#0d6efd,#5b8cff);
  box-shadow: 0 9px 28px rgba(13,110,253,.28);
}
.brand-mark-lg { width: 58px; height: 58px; border-radius: 17px; font-size: 25px; }

.eyebrow {
  font-size: .72rem;
  letter-spacing: .14em;
  color: #6ea8fe;
  font-weight: 800;
  margin-bottom: .4rem;
}

.search-wrap {
  position: relative;
  width: min(100%, 390px);
}
.search-wrap > i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--pf-muted);
  z-index: 2;
}
.search-wrap input { padding-left: 40px; }

.metric-card,
.panel-card {
  background: linear-gradient(180deg, rgba(22,30,46,.97), rgba(15,22,35,.97));
  border: 1px solid var(--pf-border);
  box-shadow: 0 18px 45px rgba(0,0,0,.16);
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 112px;
  padding: 20px;
  border-radius: 17px;
}
.metric-icon,
.section-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}
.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  font-size: 1.3rem;
}
.section-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
}
.metric-label { color: var(--pf-muted); font-size: .82rem; font-weight: 650; }
.metric-value { font-size: 1.85rem; line-height: 1.1; font-weight: 800; margin-top: 2px; }

.panel-card {
  border-radius: 18px;
  overflow: hidden;
}
.panel-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--pf-border);
  background: rgba(255,255,255,.012);
}

.dashboard-table {
  --bs-table-bg: transparent;
  --bs-table-color: #e9f0fb;
  --bs-table-border-color: var(--pf-border);
}
.dashboard-table thead th {
  color: #8797b0;
  font-size: .72rem;
  letter-spacing: .075em;
  text-transform: uppercase;
  font-weight: 800;
  white-space: nowrap;
  padding: 14px 16px;
  background: rgba(255,255,255,.015);
}
.dashboard-table tbody td { padding: 15px 16px; }
.dashboard-table tbody tr { transition: background-color .16s ease; }
.dashboard-table tbody tr:hover { background: rgba(110,168,254,.045); }

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .03em;
  border: 1px solid;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; }
.status-chip.online { color: #75e6a8; background: rgba(25,135,84,.12); border-color: rgba(25,135,84,.35); }
.status-chip.online .status-dot { background:#45d48a; box-shadow:0 0 0 4px rgba(69,212,138,.11); }
.status-chip.offline { color: #ff9da6; background: rgba(220,53,69,.1); border-color: rgba(220,53,69,.3); }
.status-chip.offline .status-dot { background:#ff6f7d; }
.status-chip.paused { color: #ffd36a; background: rgba(255,193,7,.09); border-color: rgba(255,193,7,.28); }
.status-chip.paused .status-dot { background:#ffc107; }

.endpoint-cell {
  max-width: 440px;
  display:flex;
  align-items:center;
  gap:7px;
  flex-wrap:wrap;
}
.endpoint-cell > span:first-child { overflow-wrap:anywhere; }

.data-box {
  min-height: 43px;
  display: flex;
  align-items: center;
  padding: 9px 12px;
  border: 1px solid var(--pf-border);
  border-radius: 10px;
  background: rgba(5,10,18,.42);
}
.proxy-url { resize: vertical; min-height: 82px; }

.detail-list > div {
  display:grid;
  grid-template-columns: minmax(120px, .8fr) minmax(0, 1.2fr);
  gap: 14px;
  padding: 11px 0;
  border-bottom:1px solid var(--pf-border);
}
.detail-list > div:last-child { border-bottom:0; }
.detail-list dt { color: var(--pf-muted); font-weight: 600; }
.detail-list dd { margin:0; text-align:right; overflow-wrap:anywhere; }

.form-control,
.input-group-text {
  border-color: rgba(148,163,184,.19);
  background-color: rgba(5,10,18,.55);
}
.form-control:focus {
  border-color: rgba(110,168,254,.65);
  box-shadow: 0 0 0 .2rem rgba(13,110,253,.12);
  background-color: rgba(5,10,18,.66);
}

.btn { border-radius: 9px; }
.alert { border-radius: 12px; }

@media (max-width: 767.98px) {
  .metric-card { min-height: 98px; padding: 15px; }
  .metric-icon { width: 42px; height: 42px; }
  .metric-value { font-size: 1.55rem; }
  .detail-list > div { grid-template-columns: 1fr; gap: 3px; }
  .detail-list dd { text-align:left; }
}

/* Online / offline dashboard split */
.page-switch,
.mobile-page-switch {
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--pf-border);
  border-radius: 11px;
  background: rgba(5, 10, 18, .45);
}
.page-switch-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--pf-muted);
  text-decoration: none;
  font-size: .78rem;
  font-weight: 750;
  white-space: nowrap;
  transition: background-color .16s ease, color .16s ease;
}
.page-switch-link:hover {
  color: #fff;
  background: rgba(255,255,255,.055);
}
.page-switch-link.active-online {
  color: #83ebb0;
  background: rgba(25,135,84,.16);
}
.page-switch-link.active-offline {
  color: #ff9da6;
  background: rgba(220,53,69,.13);
}
.count-badge {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  color: inherit;
  font-size: .68rem;
}
.metric-link {
  color: inherit;
  text-decoration: none;
  display: block;
}
.metric-link .metric-card {
  transition: transform .16s ease, border-color .16s ease;
}
.metric-link:hover .metric-card {
  transform: translateY(-2px);
  border-color: rgba(110,168,254,.34);
}
.location-cell {
  min-width: 190px;
  max-width: 280px;
}
.location-loading,
.location-unavailable {
  color: var(--pf-muted);
  font-size: .82rem;
}
.location-primary {
  color: #eaf2ff;
  font-weight: 650;
  line-height: 1.35;
}

@media (max-width: 575.98px) {
  .mobile-page-switch .page-switch-link { padding-left: 8px; padding-right: 8px; }
}


/* NEW proxy marker: shown by PHP only during the first 24 hours after first_seen. */
.new-proxy-badge {
  display: inline-flex;
  align-items: center;
  gap: .28rem;
  padding: .26rem .5rem;
  border-radius: 999px;
  border: 1px solid rgba(13,202,240,.48);
  background: linear-gradient(135deg, rgba(13,202,240,.18), rgba(111,66,193,.18));
  color: #8de9ff;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .055em;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 0 0 1px rgba(13,202,240,.04) inset, 0 0 14px rgba(13,202,240,.08);
}
.new-proxy-badge i { font-size: .72rem; }
.new-proxy-badge-lg {
  font-size: .75rem;
  padding: .34rem .62rem;
}

/* API Gateway */
.api-key-reveal { border: 1px solid rgba(25, 135, 84, .35) !important; }
.api-endpoints { display: grid; gap: 12px; }
.api-endpoints > div {
  display: grid;
  grid-template-columns: 54px minmax(260px, 1fr) minmax(180px, .7fr);
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--pf-border);
}
.api-endpoints > div:last-child { border-bottom: 0; }
.api-endpoints code { overflow-wrap: anywhere; color: #d9e7ff; }
@media (max-width: 767.98px) {
  .api-endpoints > div { grid-template-columns: 54px minmax(0, 1fr); }
  .api-endpoints > div > span:last-child { grid-column: 2; }
}
