:root {
  --bg: #0f1724;
  --panel: #182233;
  --line: #2a3a52;
  --ink: #e8eef8;
  --muted: #8ea0b8;
  --blue: #2b88d8;
  --blue-2: #1b5f9a;
  --green: #13a10e;
  --ok: #3dcc7a;
  --warn: #ffb900;
  --danger: #e81123;
  --font: "Segoe UI", Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background:
    radial-gradient(1200px 500px at 10% -10%, #1a3a66 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: #fff;
  color: #1b1b1b;
  border-radius: 8px;
  padding: 32px 28px 28px;
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
}
.login-mark {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background:
    linear-gradient(135deg, #2b88d8, #107c10);
  margin-bottom: 14px;
}
.login-card h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
}
.login-sub { margin: 0 0 18px; color: #5a6573; font-size: 14px; }
.login-error {
  background: #fde7e9;
  color: #a80000;
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 14px;
  font-size: 13px;
}
.login-card label { display: block; margin-bottom: 12px; }
.login-card span { display: block; font-size: 12px; color: #5a6573; margin-bottom: 6px; }
.login-card input {
  width: 100%;
  border: 1px solid #c8c8c8;
  border-radius: 4px;
  padding: 10px 12px;
  font: inherit;
}
.login-card input:focus { outline: 2px solid #2b88d8; border-color: #2b88d8; }
.login-card button {
  width: 100%;
  margin-top: 8px;
  border: 0;
  background: #2b88d8;
  color: #fff;
  font: inherit;
  font-weight: 700;
  padding: 11px 14px;
  border-radius: 4px;
  cursor: pointer;
}
.login-card button:hover { background: #2478bf; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 23, 36, 0.88);
  position: sticky;
  top: 0;
}
.brand { display: flex; gap: 12px; align-items: center; }
.shield {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(180deg, #2b88d8, #107c10);
}
.brand small { display: block; color: var(--muted); font-size: 12px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 8px 12px;
  border-radius: 4px;
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}
#btnSound {
  border-color: #ffb900;
  color: #ffb900;
}
#btnSound.is-on {
  border-color: #3dcc7a;
  color: #3dcc7a;
}
.live-dot {
  color: var(--ok);
  font-size: 12px;
  font-weight: 700;
}
.live-dot::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(61, 204, 122, 0.18);
}

main { padding: 20px 22px 40px; }
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
}
.stat b { display: block; font-size: 22px; }
.stat span { color: var(--muted); font-size: 12px; }

.table-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.table-head {
  padding: 16px 18px 8px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.table-head h2 { margin: 0 0 4px; font-size: 18px; }
.table-head p { margin: 0; color: var(--muted); font-size: 13px; }
.btn-purge {
  background: transparent;
  color: #ff8a8a;
  border: 1px solid #7a2a32;
  border-radius: 4px;
  padding: 8px 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.btn-purge:hover { background: #3a1518; color: #fff; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  vertical-align: middle;
}
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.empty { text-align: center; color: var(--muted); padding: 28px !important; }
code {
  font-family: Consolas, "Courier New", monospace;
  color: #9cd2ff;
}
.btn-clean {
  background: linear-gradient(180deg, #13a10e, #0b7a06);
  color: #fff;
  border: 0;
  border-radius: 4px;
  padding: 8px 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.btn-clean:disabled { opacity: .45; cursor: default; }
.st {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.st-online { background: #16351f; color: #3dcc7a; }
.st-queued { background: #3a2e08; color: #ffb900; }
.st-cleaning { background: #163044; color: #6cb8ff; }
.st-cleaned { background: #102a18; color: #9ae6b4; }

.toasts {
  position: fixed;
  top: 72px;
  right: 18px;
  z-index: 50;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}
.toast-card {
  background: #163044;
  border: 1px solid #2b88d8;
  border-left: 4px solid #3dcc7a;
  color: #e8eef8;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 12px 30px rgba(0,0,0,.35);
  animation: toastIn .25s ease both;
  pointer-events: auto;
}
.toast-card strong { display: block; margin-bottom: 4px; }
.toast-card span { color: #b7c6d8; font-size: 13px; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: none; }
}
.live-dot.is-ping {
  color: #ffb900;
}
.live-dot.is-ping::before {
  background: #ffb900;
  box-shadow: 0 0 0 6px rgba(255, 185, 0, 0.25);
}

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