* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #0f1420;
  color: #e8ecf4;
  min-height: 100vh;
}

/* ---------- Login ---------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.bg-glow {
  position: fixed;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(30,58,110,.35) 0%, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.login-card {
  position: relative;
  z-index: 1;
  width: 360px;
  max-width: 92vw;
  padding: 40px 36px;
  background: #161d2e;
  border: 1px solid #253352;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
.logo {
  font-size: 13px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #ff6600;
  font-weight: 600;
  margin-bottom: 14px;
  text-align: center;
}
.login-card h1 {
  font-size: 26px;
  text-align: center;
  margin-bottom: 22px;
}
.login-card label {
  display: block;
  font-size: 13px;
  color: #8a94ab;
  margin: 14px 0 6px;
}
.login-card input {
  width: 100%;
  padding: 11px 14px;
  background: #0f1420;
  border: 1px solid #2a3a5e;
  border-radius: 8px;
  color: #e8ecf4;
  font-size: 15px;
  outline: none;
}
.login-card input:focus { border-color: #ff6600; }
.login-card button {
  width: 100%;
  margin-top: 22px;
  padding: 12px;
  background: #ff6600;
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.login-card button:hover { background: #e55c00; }
.error {
  background: rgba(220,60,60,.12);
  border: 1px solid rgba(220,60,60,.4);
  color: #ff8a8a;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 6px;
}

/* ---------- Dashboard ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px;
  flex-shrink: 0;
  background: #131a2a;
  border-right: 1px solid #223050;
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
}
.sidebar-logo {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 28px;
  padding: 0 10px;
}
.sidebar-logo span { color: #ff6600; margin: 0 4px; }
.sidebar nav { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: #aab4cb;
  text-decoration: none;
  font-size: 14px;
  transition: background .12s, color .12s;
}
.sidebar nav a:hover { background: #1c2740; color: #fff; }
.sidebar nav a.active { background: #1e3a6e; color: #fff; }
.sidebar nav a.disabled { opacity: .45; cursor: default; }
.sidebar-footer {
  border-top: 1px solid #223050;
  padding-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}
.sidebar-footer .user { color: #8a94ab; }
.sidebar-footer .logout { color: #ff8533; text-decoration: none; }
.sidebar-footer .logout:hover { text-decoration: underline; }
.content { flex: 1; padding: 34px 40px; }
.content h1 { font-size: 24px; margin-bottom: 20px; }
.panel {
  background: #161d2e;
  border: 1px solid #253352;
  border-radius: 12px;
  padding: 24px;
  color: #aab4cb;
}

@media (max-width: 700px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; padding: 10px; }
  .sidebar-logo { margin: 0 14px 0 6px; }
  .sidebar nav { flex-direction: row; overflow-x: auto; }
  .sidebar-footer { border: none; padding: 0 8px; }
  .content { padding: 20px; }
}

/* ---------- Components ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.btn {
  display: inline-block;
  padding: 9px 18px;
  background: #1c2740;
  border: 1px solid #2a3a5e;
  border-radius: 8px;
  color: #e8ecf4;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: background .12s;
}
.btn:hover { background: #253352; }
.btn-primary { background: #ff6600; border-color: #ff6600; font-weight: 600; }
.btn-primary:hover { background: #e55c00; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-start { border-color: #2e7d4f; color: #6fd39a; }
.btn-stop { border-color: #7d5e2e; color: #e0b36f; }
.btn-del { border-color: #7d2e2e; color: #e07a7a; }
.panel.warn { border-color: rgba(224,160,80,.5); color: #e0b36f; }
.panel code { background: #0f1420; padding: 2px 6px; border-radius: 5px; font-size: 13px; }
.table-panel { padding: 8px 0; overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  text-align: left; padding: 10px 14px; color: #8a94ab;
  font-size: 12px; text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 1px solid #223050;
}
.tbl td { padding: 11px 14px; border-bottom: 1px solid #1c2740; color: #cbd3e4; }
.tbl tr:last-child td { border-bottom: none; }
.muted { color: #6f7a93; }
.small { font-size: 12px; }
.st { font-size: 13px; white-space: nowrap; }
.st-on { color: #6fd39a; }
.st-mid { color: #e0b36f; }
.st-off { color: #6f7a93; }
.actions { text-align: right; white-space: nowrap; }
.actions .btn { margin-left: 5px; }

/* Stats */
.stats { display: flex; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.stat-card {
  flex: 1; min-width: 150px;
  background: #161d2e; border: 1px solid #253352; border-radius: 12px;
  padding: 20px 24px;
}
.stat-num { font-size: 32px; font-weight: 700; }
.stat-num.on { color: #6fd39a; }
.stat-num.off { color: #8a94ab; }
.stat-label { color: #8a94ab; font-size: 13px; margin-top: 4px; }

/* Form */
.form-panel { max-width: 760px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.grid2 .span2 { grid-column: span 2; }
.form-panel label { display: block; font-size: 13px; color: #8a94ab; margin-bottom: 6px; }
.form-panel input, .form-panel select {
  width: 100%; padding: 10px 13px;
  background: #0f1420; border: 1px solid #2a3a5e; border-radius: 8px;
  color: #e8ecf4; font-size: 14px; outline: none;
}
.form-panel input:focus, .form-panel select:focus { border-color: #ff6600; }
@media (max-width: 700px) { .grid2 { grid-template-columns: 1fr; } .grid2 .span2 { grid-column: span 1; } }

/* Toast */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 99;
  background: #1e3a6e; color: #fff; padding: 12px 20px; border-radius: 10px;
  font-size: 14px; opacity: 0; transform: translateY(12px);
  transition: opacity .2s, transform .2s; pointer-events: none;
  box-shadow: 0 8px 30px rgba(0,0,0,.4);
}
.toast.show { opacity: 1; transform: none; }
.toast.err { background: #7d2e2e; }
