* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Segoe UI, Arial, sans-serif;
  background: radial-gradient(circle at top right, #172554 0%, #0f172a 32%, #0b1220 100%);
  color: #e2e8f0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid #334155;
  background: #0b1220;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand-row {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.brand-wrap {
  display: flex;
  flex-direction: column;
}

.brand {
  font-size: 26px;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.2px;
}

.subtitle {
  font-size: 12px;
  color: #94a3b8;
  letter-spacing: 0.3px;
}

.tabs {
  display: flex;
  gap: 8px;
  background: #0f172a;
  border: 1px solid #233046;
  border-radius: 10px;
  padding: 4px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #cbd5e1;
  cursor: pointer;
  font-weight: 600;
}

.tab.active {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #eff6ff;
}

.tab:hover {
  background: #172033;
}

.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 18px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.card,
.panel {
  background: linear-gradient(180deg, #18263a 0%, #152233 100%);
  border-radius: 10px;
  padding: 14px;
  border: 1px solid #334155;
  box-shadow: 0 6px 22px rgba(2, 6, 23, 0.25);
}

.metric h2 {
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card h2,
.panel h2 {
  font-size: 16px;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

#bandwidth,
#rawBandwidth,
#flowCount,
#listenerCount,
#deviceCount {
  font-size: 28px;
  font-weight: bold;
  line-height: 1.1;
}

.split-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  margin-bottom: 12px;
}

form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

input,
select,
button {
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
}

select {
  min-width: 130px;
}

button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  background: #1d4ed8;
  border-color: #1d4ed8;
  font-weight: 600;
}

button:hover {
  filter: brightness(1.08);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #2e3d53;
  border-radius: 8px;
  overflow: hidden;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid #334155;
  padding: 8px;
  font-size: 14px;
}

thead th {
  background: #111b2b;
  color: #cbd5e1;
  font-weight: 600;
}

tbody tr:hover {
  background: #1a2a42;
}

.delete {
  background: #dc2626;
  border-color: #dc2626;
}

.secondary {
  background: #334155;
  border-color: #334155;
}

.edit {
  background: #0ea5e9;
  border-color: #0ea5e9;
}

.icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #93c5fd;
}

.icon svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.action-buttons {
  display: flex;
  gap: 8px;
}

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

.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid transparent;
}

.status-chip.enabled {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.35);
  color: #86efac;
}

.status-chip.disabled {
  background: rgba(148, 163, 184, 0.15);
  border-color: rgba(148, 163, 184, 0.35);
  color: #cbd5e1;
}

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

  .tabs {
    width: 100%;
    overflow-x: auto;
  }

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

.chart-list {
  display: grid;
  gap: 8px;
}

.chart-row {
  display: grid;
  grid-template-columns: 210px 1fr 90px;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.chart-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #0f172a;
  border: 1px solid #334155;
  overflow: hidden;
}

.chart-fill {
  height: 100%;
  background: linear-gradient(90deg, #22d3ee, #3b82f6);
}

.chart-value {
  text-align: right;
  color: #94a3b8;
}

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

#currentUserLabel {
  color: #cbd5e1;
  font-size: 13px;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-card {
  width: min(430px, 92vw);
  background: linear-gradient(180deg, #18263a 0%, #111f31 100%);
  border: 1px solid #334155;
  border-radius: 14px;
  box-shadow: 0 20px 40px rgba(2, 6, 23, 0.4);
  padding: 24px;
  text-align: center;
}

.auth-logo {
  width: 68px;
  height: 68px;
  object-fit: contain;
  margin-bottom: 8px;
}

.auth-card h1 {
  margin: 0 0 6px;
  font-size: 24px;
}

.auth-card p {
  margin: 0 0 14px;
  color: #aebcd1;
  font-size: 14px;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.error-text {
  color: #fca5a5;
  min-height: 18px;
  font-size: 13px;
  margin-top: 8px;
}

.hint-text {
  color: #93c5fd;
  font-size: 12px;
  margin-top: 8px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.7);
  display: grid;
  place-items: center;
  z-index: 20;
  padding: 20px;
}

.modal-card {
  width: min(420px, 92vw);
  background: #132034;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 16px;
}

.modal-card h3 {
  margin-top: 0;
}

.modal-card p {
  color: #aebcd1;
  font-size: 13px;
}
