:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;

  background:#090d14;
  color:#e8edf5;
}

* { box-sizing:border-box; }

body {
  margin:0;
  min-height:100vh;
  background:
    radial-gradient(circle at top left,#142039 0,transparent 35%),
    #090d14;
}

.hidden { display:none !important; }

.center {
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
}

.login-card {
  width:100%;
  max-width:400px;
  padding:36px;
  background:#111824;
  border:1px solid #263247;
  border-radius:16px;
  box-shadow:0 24px 80px rgba(0,0,0,.35);
}

.brand {
  font-size:27px;
  font-weight:800;
  letter-spacing:.08em;
}

.subtitle {
  margin:5px 0 32px;
  color:#8e9bb0;
}

label {
  display:block;
  margin-bottom:8px;
  font-size:14px;
}

input {
  width:100%;
  padding:13px 14px;
  background:#090e17;
  color:white;
  border:1px solid #334158;
  border-radius:8px;
  font-size:16px;
  outline:none;
}

input:focus {
  border-color:#7696ff;
}

button {
  margin-top:16px;
  padding:11px 17px;
  border:0;
  border-radius:8px;
  font-weight:600;
  cursor:pointer;
  background:#e9eefb;
  color:#111827;
}

.login-card button { width:100%; }

button.secondary {
  margin:0;
  background:#182231;
  color:#dce5f5;
  border:1px solid #344158;
}

.error {
  min-height:20px;
  margin-top:14px;
  color:#ff8e8e;
  font-size:14px;
}

header {
  height:64px;
  padding:0 32px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  background:#0d131d;
  border-bottom:1px solid #202b3d;
}

header strong {
  letter-spacing:.06em;
}

header span {
  margin-left:10px;
  color:#8e9bb0;
}

.header-actions {
  display:flex;
  align-items:center;
  gap:7px;
  font-size:13px;
}

.status-dot {
  width:8px;
  height:8px;
  margin:0;
  border-radius:50%;
  background:#4bd18b;
}

main {
  max-width:1450px;
  margin:auto;
  padding:34px;
}

.page-title {
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:26px;
}

h1,h2,p { margin:0; }

h1 { font-size:27px; }

.page-title p {
  margin-top:7px;
  color:#8491a6;
}

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

.card {
  padding:20px;
  background:#111824;
  border:1px solid #263247;
  border-radius:12px;
}

.card-label {
  color:#8794a8;
  font-size:13px;
}

.card-value {
  margin-top:8px;
  font-size:29px;
  font-weight:700;
}

.panel {
  margin-top:20px;
  background:#111824;
  border:1px solid #263247;
  border-radius:12px;
  overflow:hidden;
}

.panel-title {
  padding:18px 20px;
  display:flex;
  justify-content:space-between;
  border-bottom:1px solid #263247;
}

.panel-title h2 {
  font-size:17px;
}

.panel-title span {
  color:#8491a6;
}

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

table {
  width:100%;
  border-collapse:collapse;
}

th,td {
  padding:14px 20px;
  text-align:left;
  white-space:nowrap;
  border-bottom:1px solid #202b3b;
  font-size:14px;
}

th {
  color:#8491a6;
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.04em;
}

tbody tr:last-child td {
  border-bottom:0;
}

.badge {
  display:inline-block;
  padding:4px 8px;
  border-radius:20px;
  background:#1d2939;
  font-size:12px;
}

.good {
  background:#123626;
  color:#78e2ac;
}

.warn {
  background:#3b3017;
  color:#f1cb72;
}

.bad {
  background:#3c1d23;
  color:#ff969f;
}

@media(max-width:700px) {
  header { padding:0 16px; }
  main { padding:22px 14px; }
  .page-title { align-items:flex-start; }
  #status-text { display:none; }
}

.muted {
  margin-top:4px;
  color:#718096;
  font-size:11px;
}

.mono {
  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    "Liberation Mono",
    monospace;
}

.device-link {
  padding:0;
  margin:0;
  border:0;
  background:none;
  color:#eef4ff;
  font:inherit;
  font-weight:700;
  cursor:pointer;
  text-align:left;
}

.device-link:hover {
  text-decoration:underline;
}

.modal {
  position:fixed;
  inset:0;
  z-index:1000;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
}

.modal-backdrop {
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.72);
  backdrop-filter:blur(3px);
}

.modal-card {
  position:relative;
  z-index:1;
  width:min(980px,100%);
  max-height:90vh;
  overflow:auto;
  background:#0f1724;
  border:1px solid #2a3950;
  border-radius:14px;
  box-shadow:0 30px 100px rgba(0,0,0,.55);
}

.modal-header {
  position:sticky;
  top:0;
  z-index:2;
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  padding:22px 24px;
  background:#0f1724;
  border-bottom:1px solid #263247;
}

.modal-header h2 {
  margin-top:4px;
  font-size:22px;
}

.eyebrow {
  color:#7393c8;
  font-size:11px;
  font-weight:700;
  letter-spacing:.12em;
}

.detail-loading,
.detail-error {
  padding:28px 24px;
}

.detail-error {
  color:#ff9a9a;
}

.detail-body {
  padding:24px;
}

.detail-grid {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:18px;
}

.detail-section {
  padding:18px;
  background:#111b29;
  border:1px solid #26364d;
  border-radius:10px;
}

.detail-section h3 {
  margin:0 0 16px;
  font-size:14px;
  color:#dce8fb;
}

.detail-row {
  display:grid;
  grid-template-columns:145px minmax(0,1fr);
  gap:14px;
  padding:8px 0;
  border-bottom:1px solid #202d40;
}

.detail-row:last-child {
  border-bottom:0;
}

.detail-label {
  color:#7f91aa;
  font-size:12px;
}

.detail-value {
  min-width:0;
  overflow-wrap:anywhere;
  font-size:13px;
}

.telemetry-note {
  margin-top:18px;
  padding:15px 18px;
  background:#172132;
  border:1px dashed #3b4b65;
  border-radius:9px;
  color:#8fa1bb;
  font-size:12px;
  line-height:1.6;
}

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

  .detail-row {
    grid-template-columns:120px minmax(0,1fr);
  }

  .modal {
    padding:10px;
  }
}

.gateway-actions {
  margin-top:18px;
  padding:18px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  background:#111b29;
  border:1px solid #26364d;
  border-radius:10px;
}

.gateway-actions-left {
  min-width:0;
}

.gateway-actions-title {
  font-size:14px;
  font-weight:700;
  color:#e6eefc;
}

.gateway-actions-help {
  margin-top:5px;
  color:#8091a9;
  font-size:12px;
  line-height:1.5;
}

.gateway-actions-buttons {
  display:flex;
  gap:10px;
  flex-shrink:0;
}

button.action {
  margin:0;
}

button.activate {
  background:#123b28;
  color:#82e5b0;
  border:1px solid #245b3d;
}

button.drain {
  background:#3d3016;
  color:#f2cd72;
  border:1px solid #66501f;
}

button:disabled {
  cursor:not-allowed;
  opacity:.42;
}

.action-result {
  margin-top:12px;
  padding:12px 14px;
  border-radius:8px;
  background:#162235;
  border:1px solid #293b55;
  font-size:12px;
  line-height:1.5;
}

.action-result.success {
  color:#83e4af;
}

.action-result.error {
  color:#ff9898;
}

@media(max-width:760px) {
  .gateway-actions {
    align-items:stretch;
    flex-direction:column;
  }

  .gateway-actions-buttons {
    width:100%;
  }

  .gateway-actions-buttons button {
    flex:1;
  }
}

button.maintenance {
  background:#34274a;
  color:#d8b8ff;
  border:1px solid #55406f;
}

button.resume {
  background:#17394a;
  color:#8bdcf2;
  border:1px solid #285d75;
}
