:root {
  color-scheme: dark;
  --background: #0b0e14;
  --surface: #111620;
  --surface-raised: #171e2a;
  --border: #242d3b;
  --text: #edf1f7;
  --muted: #8c98aa;
  --accent: #6d8cff;
  --green: #39d6a0;
  --red: #ff6b78;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

.card {
  background: #14161b;
  border: 1px solid #23262e;
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 380px;
}

h1 {
  font-size: 20px;
  margin: 0 0 20px;
  font-weight: 600;
}

label {
  display: block;
  font-size: 13px;
  color: #9aa1ad;
  margin: 14px 0 6px;
}

input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #2a2e37;
  background: #0f1115;
  color: inherit;
  font: inherit;
}

input:focus {
  outline: none;
  border-color: #5b8cff;
}

button {
  margin-top: 20px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: #5b8cff;
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}

button:hover {
  background: #4a7bf0;
}

button:disabled {
  opacity: .6;
  cursor: default;
}

.err {
  color: #ff6b6b;
  min-height: 1.4em;
  margin: 12px 0 0;
  font-size: 13px;
}

/* Dashboard layout */

.dashboard {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 75% -15%, rgba(73, 102, 190, .13), transparent 40%),
    var(--background);
}

.layout {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  width: 250px;
  flex: 0 0 250px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 28px 18px 20px;
  background: rgba(15, 20, 29, .96);
  border-right: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #7894ff, #5269d9);
  color: white;
  font-size: 21px;
  font-weight: 800;
  box-shadow: 0 5px 20px rgba(89, 116, 235, .25);
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 16px;
  letter-spacing: -.3px;
}

.brand span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 1.2px;
  font-weight: 700;
}

.navigation {
  margin-top: 48px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 9px;
  color: #aab4c4;
  text-decoration: none;
  font-weight: 600;
}

.nav-link.active {
  background: rgba(109, 140, 255, .13);
  color: #9eb2ff;
}

.nav-icon {
  font-size: 19px;
}

.sidebar-bottom {
  margin-top: auto;
}

.connection-indicator {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 10px;
  color: #aeb8c7;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}

.online-dot {
  width: 8px;
  height: 8px;
  display: inline-block;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px rgba(57, 214, 160, .45);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 8px 10px;
}

.avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #27344e;
  color: #a9bcff;
  font-weight: 700;
}

.user-details strong,
.user-details span {
  display: block;
}

.user-details strong {
  max-width: 145px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
}

.user-details span {
  color: var(--muted);
  font-size: 11px;
}

.logout-button {
  margin-top: 12px;
  padding: 9px 12px;
  background: transparent;
  border: 1px solid var(--border);
  color: #aeb8c7;
  font-size: 12px;
}

.logout-button:hover {
  background: #202735;
}

.main-content {
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  padding: 44px clamp(22px, 4vw, 58px) 25px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 34px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #8198e9;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.8px;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(25px, 3vw, 32px);
  letter-spacing: -.8px;
}

.subtitle {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.live-label {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: #b8c5d6;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .8px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.summary-card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(145deg, #151d29, #111620);
}

.summary-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #a8b3c3;
  font-size: 12px;
}

.summary-icon {
  color: #a6b8ff;
  font-size: 17px;
}

.summary-icon.green {
  color: var(--green);
}

.summary-icon.blue {
  color: #7ebdff;
}

.summary-value {
  display: block;
  margin-top: 13px;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -.7px;
}

.summary-caption {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.time-value {
  font-size: 23px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 42px 0 18px;
}

.section-heading h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -.3px;
}

.section-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.refresh-button {
  width: auto;
  margin: 0;
  padding: 9px 14px;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: #d3dbea;
  font-size: 12px;
}

.refresh-button:hover {
  background: #27334a;
}

.refresh-button span {
  margin-right: 5px;
  font-size: 17px;
}

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

.server-card {
  min-width: 0;
  padding: 23px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: linear-gradient(145deg, #151c28, #111620);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
}

.server-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.server-identity {
  display: flex;
  align-items: center;
  gap: 13px;
}

.server-icon {
  width: 45px;
  height: 45px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 800;
}

.arma-icon {
  background: rgba(198, 155, 91, .15);
  color: #e0b778;
}

.ts-icon {
  background: rgba(91, 150, 255, .15);
  color: #88b5ff;
}

.server-identity h3 {
  margin: 0;
  font-size: 16px;
}

.server-identity p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.status-active {
  background: rgba(57, 214, 160, .1);
  color: var(--green);
}

.status-inactive {
  background: rgba(151, 164, 183, .1);
  color: #a7b1c0;
}

.status-failed {
  background: rgba(255, 107, 120, .12);
  color: var(--red);
}

.status-pending {
  background: rgba(255, 193, 92, .12);
  color: #ffc15c;
}

.status-unknown {
  background: rgba(151, 164, 183, .1);
  color: #a7b1c0;
}

.server-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 25px;
  padding: 17px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.server-details span,
.server-details strong {
  display: block;
}

.server-details span {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
}

.server-details strong {
  overflow-wrap: anywhere;
  color: #d9e0eb;
  font-size: 12px;
  font-weight: 600;
}

.server-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-top: 19px;
}

.action-button {
  min-width: 0;
  margin: 0;
  padding: 10px 7px;
  border: 1px solid var(--border);
  background: #1b2432;
  color: #dce5f3;
  font-size: 11px;
}

.action-button:hover {
  background: #2a374c;
}

.start-button {
  border-color: rgba(57, 214, 160, .25);
  color: #68e0b2;
}

.stop-button {
  border-color: rgba(255, 107, 120, .25);
  color: #ff8993;
}

.restart-button {
  border-color: rgba(126, 189, 255, .25);
  color: #8ec4ff;
}

.notice {
  display: none;
  margin-top: 20px;
  padding: 12px 15px;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: #cbd6e5;
  font-size: 12px;
}

.notice.visible {
  display: block;
}

.notice-success {
  border-color: rgba(57, 214, 160, .3);
  background: rgba(57, 214, 160, .07);
  color: #75e4bd;
}

.notice-error {
  border-color: rgba(255, 107, 120, .3);
  background: rgba(255, 107, 120, .07);
  color: #ff9aa3;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-top: 45px;
  padding-top: 17px;
  border-top: 1px solid var(--border);
  color: #667387;
  font-size: 10px;
}

@media (max-width: 900px) {
  .sidebar {
    width: 210px;
    flex-basis: 210px;
  }

  .main-content {
    padding: 32px 22px 22px;
  }

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

@media (max-width: 650px) {
  .layout {
    display: block;
  }

  .sidebar {
    width: 100%;
    min-height: 0;
    padding: 15px 18px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .brand {
    padding: 0;
  }

  .navigation {
    display: none;
  }

  .sidebar-bottom {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-top: 12px;
  }

  .connection-indicator {
    padding: 5px 0;
    border: 0;
  }

  .user-info {
    padding: 5px 0;
    margin-left: auto;
  }

  .avatar {
    width: 30px;
    height: 30px;
  }

  .logout-button {
    width: auto;
    margin: 0;
    padding: 7px 10px;
  }

  .main-content {
    padding: 27px 16px 20px;
  }

  .topbar {
    align-items: flex-start;
  }

  .live-label {
    padding: 7px 9px;
    font-size: 8px;
  }

  .summary-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .summary-card {
    padding: 15px;
  }

  .summary-card:last-child {
    grid-column: 1 / -1;
  }

  .section-heading {
    margin-top: 30px;
  }

  .server-card {
    padding: 18px;
  }

  .footer {
    flex-direction: column;
    gap: 5px;
  }
}

@media (max-width: 380px) {
  .server-card-top {
    flex-direction: column;
  }

  .server-actions {
    gap: 6px;
  }

  .action-button {
    padding: 9px 4px;
    font-size: 10px;
  }
}

/* Stage 1 live monitoring */
.monitoring-section{margin-top:36px}
.monitoring-heading{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:16px}
.monitoring-heading h2{margin:0 0 5px}
.monitoring-heading p,.monitoring-heading span{color:var(--muted);font-size:11px}
.metrics-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}
.metric-card,.uptime-card{min-width:0;padding:17px;border:1px solid var(--border);border-radius:12px;background:linear-gradient(145deg,#151d29,#111620)}
.metric-card>span,.uptime-card>span{display:block;color:var(--muted);font-size:11px}
.metric-card strong{display:block;margin-top:10px;font-size:24px}
.metric-card small{display:block;min-height:16px;margin-top:9px;color:var(--muted);font-size:10px;overflow-wrap:anywhere}
.metric-track{height:6px;margin-top:12px;overflow:hidden;border-radius:8px;background:#273142}
.metric-track i{display:block;width:0;height:100%;border-radius:inherit;background:var(--accent);transition:width .25s ease}
.uptime-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;margin-top:14px}
.uptime-card strong{display:block;margin-top:9px;font-size:17px;overflow-wrap:anywhere}
#monitoring-error{min-height:18px;color:var(--red);font-size:11px}
@media(max-width:900px){.metrics-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:650px){.metrics-grid,.uptime-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.metric-card,.uptime-card{padding:13px}.metric-card strong{font-size:20px}}

