:root {
  --bg0: #0c1419;
  --bg1: #122028;
  --bg2: #1a2d38;
  --line: rgba(140, 180, 200, 0.18);
  --text: #e7f0f4;
  --muted: #8aa3b0;
  --accent: #2ec4b6;
  --accent-dim: rgba(46, 196, 182, 0.15);
  --online: #3ecf8e;
  --offline: #e4572e;
  --warn: #e9c46a;
  --bad: #e4572e;
  --good: #3ecf8e;
  --unknown: #7a8f9c;
  --font-display: "Space Grotesk", "Avenir Next", sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(46, 196, 182, 0.12), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(69, 123, 157, 0.18), transparent 50%),
    linear-gradient(180deg, var(--bg0), #0a1014 70%);
  color: var(--text);
  font-family: var(--font-body);
}

body {
  padding: 1.5rem clamp(1rem, 3vw, 2.5rem) 3rem;
}

.nav-tabs {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.nav-tab:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.nav-tab.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.badge-disabled {
  background: rgba(228, 87, 46, 0.2);
  color: #ff7b54;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-offline {
  background: rgba(228, 87, 46, 0.15);
  color: #e4572e;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.badge-online {
  background: rgba(62, 207, 142, 0.15);
  color: #3ecf8e;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.comment-text {
  color: var(--muted);
  font-size: 0.82rem;
  display: block;
  margin-top: 0.2rem;
}

.shell {
  max-width: 1320px;
  margin: 0 auto;
}

.hero {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.brand span {
  color: var(--accent);
}

.lede {
  margin: 0;
  color: var(--muted);
  max-width: 45rem;
  font-size: 1rem;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
  font-size: 0.9rem;
  color: var(--muted);
}

.meta-row strong {
  color: var(--text);
  font-weight: 600;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.4rem;
  align-items: center;
}

.olt-dropdown {
  min-width: 16rem;
  background: var(--bg2);
  border-color: var(--line);
  font-weight: 500;
}

button, .btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--text);
  font: inherit;
  padding: 0.6rem 1.1rem;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

button.primary {
  background: var(--accent);
  border-color: transparent;
  color: #062c28;
  font-weight: 600;
}

button:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stat {
  background: linear-gradient(160deg, var(--bg1), var(--bg2));
  border: 1px solid var(--line);
  padding: 1rem 1.1rem;
  min-height: 5.5rem;
  border-radius: 6px;
}

.stat .label {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat .value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  margin-top: 0.35rem;
  letter-spacing: -0.02em;
}

.stat.online .value { color: var(--online); }
.stat.offline .value { color: var(--offline); }

.toolbar {
  display: grid;
  grid-template-columns: 2fr repeat(2, minmax(10rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

input, select {
  width: 100%;
  background: var(--bg1);
  border: 1px solid var(--line);
  color: var(--text);
  font: inherit;
  padding: 0.7rem 0.9rem;
  border-radius: 4px;
}

input:focus, select:focus {
  outline: 2px solid var(--accent-dim);
  border-color: var(--accent);
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: auto;
  background: rgba(18, 32, 40, 0.75);
  backdrop-filter: blur(6px);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

th, td {
  padding: 0.75rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: #152833;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  z-index: 1;
}

td.name {
  white-space: normal;
  min-width: 15rem;
  font-weight: 500;
}

td.mono, th.mono {
  font-family: var(--font-mono);
  font-size: 0.88rem;
}

.olt-badge {
  display: inline-block;
  background: rgba(46, 196, 182, 0.12);
  color: var(--accent);
  border: 1px solid rgba(46, 196, 182, 0.3);
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
}

.badge.online { color: var(--online); }
.badge.offline { color: var(--offline); }

mark {
  background: rgba(233, 196, 106, 0.35);
  color: #fff;
  border-radius: 2px;
  padding: 0 0.2rem;
}

.sig {
  font-family: var(--font-mono);
  font-weight: 600;
}

.sig.good { color: var(--good); }
.sig.warn { color: var(--warn); }
.sig.bad { color: var(--bad); }
.sig.unknown, .sig.offline { color: var(--unknown); }

.status-line {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  min-height: 1.25rem;
}

.status-line.error { color: var(--bad); }

.empty {
  padding: 2.5rem;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 900px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  body { padding: 1rem; }
  .stat .value { font-size: 1.6rem; }
}

@media (max-width: 700px) {
  .table-wrap {
    border: 0;
    overflow: visible;
    background: transparent;
    backdrop-filter: none;
  }

  table,
  thead,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  table { min-width: 0; }
  thead { display: none; }

  tbody tr {
    margin-bottom: 0.8rem;
    padding: 0.45rem 0;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: linear-gradient(160deg, var(--bg1), var(--bg2));
  }

  tbody td {
    display: grid;
    grid-template-columns: minmax(6.5rem, 34%) minmax(0, 1fr);
    gap: 0.65rem;
    align-items: start;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid rgba(140, 180, 200, 0.1);
    white-space: normal;
    overflow-wrap: anywhere;
  }

  tbody td::before {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  tbody td:nth-child(1),
  tbody td:last-child {
    display: none;
  }

  tbody td:nth-child(2)::before { content: "User"; }
  tbody td:nth-child(3)::before { content: "Profile"; }
  tbody td:nth-child(4)::before { content: "Status"; }
  tbody td:nth-child(5)::before { content: "IP Address"; }
  tbody td:nth-child(6)::before { content: "Uptime"; }
  tbody td:nth-child(7)::before { content: "Caller ID / MAC"; }
  tbody td:nth-child(8)::before { content: "Last Logged Out"; }

  tbody td:last-of-type { border-bottom: 0; }
  tbody td.empty {
    display: block;
    padding: 2rem 1rem;
  }
  tbody td.empty::before { display: none; }
}
