@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700;800&family=Outfit:wght@400;500;600;700&display=swap');

:root {
  --bg: #090f1f;
  --bg-2: #101a33;
  --bg-3: #1c2a4a;
  --text: #ebf2ff;
  --muted: #a5b7d9;
  --line: rgba(177, 201, 255, 0.2);
  --panel: rgba(19, 30, 58, 0.64);
  --panel-solid: #152447;
  --brand: #14d9c4;
  --brand-2: #2f7ef7;
  --danger: #ff5d7a;
  --warn: #f5ab2d;
  --shadow: 0 20px 60px rgba(2, 8, 28, 0.5);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--text);
  font-family: 'Outfit', 'Segoe UI', sans-serif;
  background:
    radial-gradient(1000px 400px at -8% -15%, rgba(20, 217, 196, 0.22) 0, transparent 58%),
    radial-gradient(900px 500px at 110% -20%, rgba(47, 126, 247, 0.3) 0, transparent 58%),
    linear-gradient(145deg, var(--bg), var(--bg-2) 52%, var(--bg-3));
}

h1, h2, h3 {
  margin: 0 0 0.75rem;
  font-family: 'Sora', 'Outfit', sans-serif;
  letter-spacing: -0.02em;
  color: #f5f9ff;
}

h1 {
  font-size: clamp(1.8rem, 2.6vw, 2.5rem);
  margin-bottom: 1.1rem;
}

a {
  color: #8fdcff;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1.15rem;
  background: rgba(8, 15, 34, 0.84);
  border-bottom: 1px solid rgba(154, 187, 255, 0.2);
  backdrop-filter: blur(12px);
}

.brand-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: #dff7ff;
}

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(145deg, var(--brand), #42f8cb);
  box-shadow: 0 0 0 6px rgba(20, 217, 196, 0.2), 0 0 24px rgba(20, 217, 196, 0.6);
}

.brand-text {
  display: grid;
  line-height: 1.05;
}

.brand-text strong {
  font-size: 1.06rem;
  font-family: 'Sora', sans-serif;
}

.brand-text span {
  color: #8ab0dc;
  font-size: 0.78rem;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.nav-link {
  color: #d2def9;
  font-size: 0.93rem;
  font-weight: 600;
  padding: 0.45rem 0.68rem;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: all 0.2s ease;
}

.nav-link:hover {
  border-color: rgba(143, 220, 255, 0.3);
  background: rgba(143, 220, 255, 0.08);
  color: #eff8ff;
}

.nav-link.active {
  color: #04192f;
  border-color: rgba(20, 217, 196, 0.7);
  background: linear-gradient(145deg, #38f5d1, #5ed8ff);
}

.nav-pill {
  background: rgba(255, 93, 122, 0.14);
  border: 1px solid rgba(255, 93, 122, 0.4);
  color: #ffd7df;
}

.app-main { padding: 1.2rem; }
.content-shell {
  max-width: 1500px;
  margin: 0 auto;
  animation: pageIn 280ms ease;
}

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  background: var(--panel);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

.metric-card {
  position: relative;
  overflow: hidden;
  min-height: 142px;
}

.metric-card::after {
  content: '';
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 999px;
  right: -46px;
  top: -46px;
  background: radial-gradient(circle, rgba(56, 245, 209, 0.3), transparent 65%);
}

.metric-value {
  font-family: 'Sora', sans-serif;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  line-height: 1;
  margin-top: 0.45rem;
  color: #ffffff;
}

.metric-note {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.84rem;
  color: var(--muted);
}

.alive-card .metric-value { color: #58ffd1; }
.inactive-card .metric-value { color: #ff9fb3; }

.heartbeat-card p {
  margin: 0.35rem 0;
  color: #c6d8f7;
}

.status-pill {
  display: inline-block;
  border: 1px solid rgba(20, 217, 196, 0.45);
  background: rgba(20, 217, 196, 0.15);
  color: #9ff9e9;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 0.78rem;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(13, 24, 48, 0.35);
}

th {
  text-align: left;
  font-size: 0.79rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9fb8e6;
  border-bottom: 1px solid rgba(175, 198, 255, 0.22);
  padding: 0.72rem 0.68rem;
  background: rgba(20, 33, 62, 0.6);
}

td {
  padding: 0.68rem;
  border-bottom: 1px solid rgba(170, 193, 240, 0.12);
  color: #e2ecff;
  vertical-align: top;
}

tr:hover td {
  background: rgba(47, 126, 247, 0.12);
}

form.inline {
  display: inline-flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin: 0;
}

input, select, button {
  border-radius: 12px;
  border: 1px solid rgba(184, 206, 255, 0.35);
  min-height: 38px;
  padding: 0.48rem 0.66rem;
  font: inherit;
}

input, select {
  background: rgba(10, 21, 44, 0.55);
  color: #f4f8ff;
}

input::placeholder { color: #89a6d6; }

input:focus, select:focus {
  outline: none;
  border-color: rgba(56, 245, 209, 0.8);
  box-shadow: 0 0 0 3px rgba(56, 245, 209, 0.18);
}

button {
  cursor: pointer;
  color: #04192f;
  font-weight: 700;
  border-color: rgba(56, 245, 209, 0.8);
  background: linear-gradient(150deg, #38f5d1, #6ad1ff);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 25px rgba(69, 185, 255, 0.32);
}

button.danger {
  color: #fff4f7;
  border-color: rgba(255, 93, 122, 0.7);
  background: linear-gradient(150deg, #ff6f90, #d43f6b);
}

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

.pagination {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.9rem;
  color: #c8d8f7;
}

.pagination a {
  color: #04192f;
  font-weight: 700;
  border: 1px solid rgba(103, 189, 255, 0.6);
  background: linear-gradient(150deg, #62ddff, #7da7ff);
  border-radius: 999px;
  padding: 0.3rem 0.72rem;
}

.pagination-wrap {
  justify-content: space-between;
  flex-wrap: wrap;
}

.page-controls a,
.page-disabled {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
}

.page-disabled {
  color: #95addb;
  border: 1px solid rgba(148, 176, 231, 0.35);
  background: rgba(24, 40, 74, 0.45);
}

.pagination-jump label {
  color: #c8d8f7;
  font-weight: 600;
}

.pagination-jump input[type=\"number\"] {
  width: 100px;
}

.sort-link {
  color: #b7c9ee;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.sort-link:hover {
  color: #e9f2ff;
}

.badge {
  border-radius: 999px;
  padding: 0.21rem 0.6rem;
  font-size: 0.77rem;
  font-weight: 700;
}

.badge.alive { background: rgba(20, 217, 196, 0.2); color: #8fffe3; }
.badge.inactive { background: rgba(255, 93, 122, 0.2); color: #ffd0da; }

.modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
  background: rgba(4, 10, 23, 0.68);
  backdrop-filter: blur(6px);
}

.modal-overlay.open { display: flex; }

.modal-card {
  width: min(560px, 96vw);
  border-radius: 22px;
  border: 1px solid rgba(169, 194, 255, 0.38);
  padding: 1.2rem;
  background: linear-gradient(160deg, rgba(22, 38, 72, 0.96), rgba(15, 29, 57, 0.94));
  box-shadow: 0 30px 80px rgba(1, 5, 17, 0.65);
  animation: modalPop 200ms ease-out;
}

.compact-modal {
  width: min(430px, 94vw);
  text-align: center;
}

.auth-card {
  max-width: 500px;
  margin: 5.6rem auto 1rem;
  padding: 1.35rem 1.45rem;
}

.auth-center {
  min-height: calc(100vh - 170px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-center .auth-card {
  margin: 0;
  width: min(500px, 96vw);
}

.auth-form-center {
  width: min(360px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 1rem;
}

.auth-form-center p {
  margin: 0;
}

.auth-form-center label {
  display: block;
  text-align: left;
  font-weight: 600;
  color: #d8e6ff;
}

.auth-form-center input {
  width: 100%;
  min-height: 42px;
}

.auth-form-center button {
  justify-self: stretch;
  width: 100%;
  min-height: 44px;
}

.auth-card h2 {
  text-align: center;
  margin-bottom: 1.1rem;
}

.alert {
  border-radius: 11px;
  padding: 0.62rem 0.74rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.alert.error {
  background: rgba(255, 93, 122, 0.17);
  border: 1px solid rgba(255, 93, 122, 0.42);
  color: #ffd2dc;
}

.alert.success {
  background: rgba(20, 217, 196, 0.17);
  border: 1px solid rgba(20, 217, 196, 0.38);
  color: #b9fff0;
}

.app-footer {
  text-align: center;
  color: #88a5d6;
  font-size: 0.84rem;
  padding: 0.8rem 1rem 1.1rem;
}

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

@keyframes modalPop {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .main-nav {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.3rem;
  }

  .nav-link { white-space: nowrap; }
}

@media (max-width: 780px) {
  .app-main { padding: 0.75rem; }

  th:nth-child(4), td:nth-child(4), th:nth-child(5), td:nth-child(5) {
    display: none;
  }
}
