* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: #0d0d1a;
  color: #c8c8d4;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}

/* ── Login Page ── */

.login-container {
  max-width: 400px;
  margin: 10vh auto;
  padding: 2rem;
  position: relative;
  z-index: 1;
}

.login-header { text-align: center; margin-bottom: 2rem; }

.logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #00d4aa, #0088aa);
  border-radius: 12px;
  font-size: 1.5rem;
  font-weight: 700;
  color: #0d0d1a;
  margin-bottom: 1rem;
}

.login-header h1 { font-size: 1.4rem; color: #e8e8f0; font-weight: 600; }
.subtitle { color: #666680; font-size: 0.85rem; margin-top: 0.25rem; }

.form-group { margin-bottom: 1rem; }

.form-group label {
  display: block;
  font-size: 0.8rem;
  color: #888899;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-group input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: #14142a;
  border: 1px solid #2a2a40;
  border-radius: 6px;
  color: #e8e8f0;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus { border-color: #00d4aa; }

.error {
  background: rgba(255, 60, 60, 0.1);
  border: 1px solid #ff3c3c;
  color: #ff6b6b;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

button[type="submit"], .btn-primary {
  width: 100%;
  padding: 0.75rem;
  background: linear-gradient(135deg, #00d4aa, #0088aa);
  border: none;
  border-radius: 6px;
  color: #0d0d1a;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

button[type="submit"]:hover { opacity: 0.9; }

.last-login {
  margin-top: 1.2rem;
  text-align: center;
  font-family: 'Courier New', monospace;
  font-size: 0.7rem;
  color: #333348;
}

.footer {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.75rem;
  color: #444460;
  font-family: 'Courier New', monospace;
}

/* Scan-line overlay (login page) */
.scanline {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 10;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
}

/* ── LED ── */

.led {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #00d4aa;
  border-radius: 50%;
  box-shadow: 0 0 4px #00d4aa;
  animation: led-blink 2s infinite;
  vertical-align: middle;
}

@keyframes led-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ── Dashboard Layout ── */

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

/* Sidebar */
.sidebar {
  width: 200px;
  background: #0a0a18;
  border-right: 1px solid #1e1e38;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem;
  font-weight: 600;
  color: #e8e8f0;
  font-size: 0.9rem;
  border-bottom: 1px solid #1e1e38;
}

.logo-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #00d4aa, #0088aa);
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #0d0d1a;
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  padding: 0.5rem 0;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  color: #888899;
  text-decoration: none;
  font-size: 0.8rem;
  border-left: 3px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.sidebar-item:hover { color: #c8c8d4; }
.sidebar-item.active { color: #00d4aa; border-left-color: #00d4aa; background: rgba(0, 212, 170, 0.04); }

.sidebar-item.locked {
  color: #333348;
  cursor: not-allowed;
}

.sidebar-item.locked::after {
  content: '\1F512';
  font-size: 0.6rem;
  margin-left: auto;
}

.sidebar-item.has-alert::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #ff9f1c;
  border-radius: 50%;
  position: absolute;
  right: 12px;
}

.sidebar-item.has-alert { position: relative; }

.sidebar-icon { font-size: 0.7rem; width: 1rem; text-align: center; }

.sidebar-footer {
  padding: 0.8rem 1rem;
  border-top: 1px solid #1e1e38;
  font-size: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

/* Main content area */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 1.5rem;
  background: #12122a;
  border-bottom: 1px solid #1e1e38;
}

.header-title { font-weight: 600; color: #e8e8f0; font-size: 0.95rem; }

.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: #666680;
}

.header-status { color: #00d4aa; }

.badge {
  background: #1e1e38;
  color: #00d4aa;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.btn-logout {
  background: none;
  border: 1px solid #2a2a40;
  color: #888899;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.7rem;
}

.btn-logout:hover { border-color: #ff3c3c; color: #ff6b6b; }

/* Alert banner */
.alert-banner {
  background: rgba(255, 159, 28, 0.08);
  border-bottom: 1px solid rgba(255, 159, 28, 0.2);
  color: #ff9f1c;
  padding: 0.5rem 1.5rem;
  font-size: 0.8rem;
}

/* Main */
main {
  padding: 1.5rem;
  max-width: 960px;
  flex: 1;
}

main h2 {
  font-size: 1rem;
  color: #e8e8f0;
  margin-bottom: 1rem;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1.2rem;
}

.card {
  background: #14142a;
  border: 1px solid #1e1e38;
  border-radius: 8px;
  padding: 1rem;
}

.card-label {
  font-size: 0.7rem;
  color: #666680;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
}

.card-value {
  font-size: 1.2rem;
  font-weight: 600;
  color: #e8e8f0;
  font-family: 'Courier New', monospace;
}

.card-network { grid-column: span 2; }

.serial-info {
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  color: #444460;
  margin-bottom: 1.2rem;
}

/* ── Network Topology ── */

.network-map {
  width: 100%;
  height: 80px;
  margin-top: 0.5rem;
}

.network-map line { stroke: #2a2a40; }

.hub-pulse {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { r: 6; opacity: 1; }
  50% { r: 8; opacity: 0.7; }
}

/* ── Log Terminal ── */

.log-terminal {
  background: #090916;
  border: 1px solid #1e1e38;
  border-radius: 8px;
  overflow: hidden;
  margin-top: 1rem;
}

.log-header {
  background: #12122a;
  padding: 0.4rem 0.8rem;
  font-size: 0.7rem;
  color: #666680;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #1e1e38;
}

.log-body {
  height: 160px;
  overflow: hidden;
  position: relative;
}

.log-scroll {
  font-family: 'Courier New', monospace;
  font-size: 0.72rem;
  line-height: 1.6;
  padding: 0.5rem 0.8rem;
  white-space: pre;
  color: #555568;
  animation: log-scroll 30s linear infinite;
}

@keyframes log-scroll {
  0% { transform: translateY(0); }
  100% { transform: translateY(-50%); }
}

.log-ts { color: #444460; }
.log-tag { font-weight: 600; }
.log-tag.auth { color: #5588cc; }
.log-tag.sys { color: #666680; }
.log-tag.fw { color: #ff9f1c; }
.log-tag.net { color: #00d4aa; }
