:root {
  --ink: #edf5f8;
  --muted: #91a9b5;
  --quiet: #6e8794;
  --line: #284153;
  --panel: #142535;
  --panel-soft: #192d3e;
  --sidebar: #091927;
  --canvas: #0c1a28;
  --accent: #39a9d2;
  --accent-strong: #1684b2;
  --green: #66d0a2;
  --amber: #e9bd69;
  --red: #f0787d;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font: 14px/1.45 "Trebuchet MS", "Segoe UI", sans-serif;
}
body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  content: "";
  pointer-events: none;
  background: radial-gradient(circle at 70% -20%, #15486455, transparent 42%), linear-gradient(135deg, #0c1d2c, #081522 60%, #0b1b28);
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  height: 100vh;
  padding: 30px 20px 22px;
  color: var(--muted);
  background: linear-gradient(180deg, #0a1d2c, #081522);
  border-right: 1px solid #1e3748;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 7px; color: #fff; text-decoration: none; font-weight: 800; letter-spacing: 2px; font-size: 16px; }
.brand small { display: block; margin-top: 4px; color: #6fa8bf; font-size: 8px; letter-spacing: 1px; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: #fff; background: linear-gradient(140deg, #36a9db, #0e4e76); box-shadow: 0 8px 24px #0007; font: italic 26px Georgia, serif; }
.sidebar-label { padding: 0 9px; color: #5e8ca2; font-size: 10px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; }
.sidebar nav { display: grid; gap: 6px; }
.nav-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 12px; border: 1px solid transparent; border-radius: 10px; color: #9fb7c2; text-decoration: none; transition: .18s ease; }
.nav-link:hover, .nav-link.active { color: #fff; background: #16364b; border-color: #27536b; }
.nav-link b { min-width: 25px; padding: 2px 7px; border-radius: 999px; color: #83cde8; background: #0e2738; font-size: 10px; text-align: center; }
.sidebar-footer { display: grid; gap: 18px; margin-top: auto; }
.privacy-note { padding: 18px 8px 0; border-top: 1px solid #284353; color: #7894a1; font-size: 11px; line-height: 1.55; }
.privacy-note span { display: block; margin-bottom: 7px; color: #6fc5e7; font-size: 9px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; }
.logout, .text-button { padding: 9px 8px; color: #8eafbd; text-align: left; border: 0; background: transparent; }
.logout:hover, .text-button:hover { color: #fff; }
main { width: min(1540px, 100%); margin: 0 auto; padding: 42px clamp(22px, 4vw, 70px) 76px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.eyebrow { margin: 0 0 7px; color: #5aa3c0; font-size: 10px; font-weight: 800; letter-spacing: 1.5px; }
.topbar h1, .panel h2 { margin: 0; color: #f4f8fa; letter-spacing: -.8px; }
.topbar h1 { font: 700 30px Georgia, serif; }
.topbar-subtitle, .panel-subtitle { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.connection { display: flex; align-items: center; gap: 9px; padding: 10px 13px; color: #abc0c9; background: #122738; border: 1px solid #294456; border-radius: 999px; font-size: 11px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #849aa5; }
.dot.live { background: var(--green); box-shadow: 0 0 0 4px #66d0a222; }
.dot.error { background: var(--red); box-shadow: 0 0 0 4px #f0787d1c; }
.refresh-button { display: flex; align-items: center; gap: 7px; padding: 10px 13px; color: #d8edf4; background: #173246; border: 1px solid #2a4c5f; border-radius: 9px; font-size: 11px; font-weight: 700; }
.refresh-button:hover { background: #1e465c; }
.refresh-button:disabled { opacity: .6; cursor: wait; }
.refresh-button span:first-child { color: var(--accent); font-size: 18px; line-height: 12px; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-bottom: 22px; }
.metric { min-height: 137px; padding: 20px; background: linear-gradient(145deg, #172b3d, #112231); border: 1px solid #294456; border-radius: 14px; box-shadow: 0 13px 28px #020d171c; }
.metric-label { display: flex; align-items: center; gap: 8px; color: #aac0cb; font-size: 12px; }
.metric-icon { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; font-size: 13px; font-weight: 800; }
.metric-icon.blue { color: #85d5f0; background: #1b526d; }
.metric-icon.green { color: #91e6ba; background: #1c5948; }
.metric-icon.red { color: #ff9da0; background: #5f2f3a; }
.metric-icon.amber { color: #ffd486; background: #604b2b; }
.metric strong { display: block; margin: 13px 0 4px; color: #f8fbfc; font-size: 35px; line-height: 1; letter-spacing: -1.5px; }
.metric small { color: #7996a4; font-size: 10px; }
.metric.danger strong { color: #ff9da0; }
.metric.warning strong { color: #ffd486; }
.panel { margin: 22px 0; overflow: hidden; background: linear-gradient(145deg, #142738, #102131); border: 1px solid #294456; border-radius: 15px; box-shadow: 0 16px 34px #020d1717; }
.panel-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; padding: 24px 25px 18px; }
.panel h2 { font-size: 20px; }
.result-count { color: #76a8b9; font-size: 11px; white-space: nowrap; }
.toolbar { display: flex; align-items: end; gap: 10px; padding: 0 25px 18px; }
.search { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 200px; padding: 0 12px; color: #78a2b3; background: #0d1d2d; border: 1px solid #2b475b; border-radius: 9px; }
.search:focus-within { border-color: #3c9bc0; box-shadow: 0 0 0 3px #3c9bc01c; }
.search input { width: 100%; padding: 11px 0; color: #e7f1f4; border: 0; outline: 0; background: transparent; }
.search input::placeholder { color: #698493; }
.select-wrap { display: grid; gap: 5px; min-width: 142px; color: #7897a5; font-size: 10px; font-weight: 700; }
select { width: 100%; padding: 10px 29px 10px 11px; color: #dbeaf0; border: 1px solid #2b475b; border-radius: 9px; outline: 0; background: #0d1d2d; }
select:focus { border-color: #3c9bc0; }
.table-wrap { overflow: auto; border-top: 1px solid #294456; }
table { width: 100%; min-width: 780px; border-collapse: collapse; }
th { padding: 12px 25px; color: #72909d; background: #102230; font-size: 10px; letter-spacing: .9px; text-align: left; text-transform: uppercase; }
td { padding: 16px 25px; color: #9db4be; border-top: 1px solid #223c4d; font-size: 12px; vertical-align: middle; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: #1a3547; }
.device-name { display: block; color: #e6f2f5; font-size: 13px; font-weight: 800; }
.device-meta { display: block; margin-top: 4px; color: #6f8b98; font-size: 10px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 999px; font-size: 10px; font-weight: 800; }
.badge.active { color: #8de4b7; background: #164636; }
.badge.blocked { color: #ff9da0; background: #512a35; }
.view-button { padding: 8px 11px; color: #94dcf4; background: #17394d; border: 1px solid #2d6a84; border-radius: 8px; font-size: 11px; font-weight: 700; }
.view-button:hover { color: #fff; background: #1c526b; }
.empty { padding: 36px 25px; color: #7794a2; text-align: center; }
.events-panel { padding-bottom: 7px; }
.event-heading-actions { display: flex; align-items: center; gap: 14px; }
.events-list { max-height: 590px; overflow: auto; border-top: 1px solid #294456; }
.event { display: grid; grid-template-columns: 20px minmax(0, 1fr) 125px; gap: 12px; padding: 16px 25px; border-bottom: 1px solid #223c4d; }
.event:hover { background: #172f40; }
.event-symbol { color: var(--accent); font-size: 21px; line-height: 16px; }
.event strong { display: block; color: #e5f1f4; font-size: 12px; }
.event p { margin: 4px 0 0; color: #829eaa; font-size: 11px; }
.event code { display: block; max-width: 100%; margin-top: 7px; overflow: hidden; color: #80a7b4; font: 10px ui-monospace, Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.event time { color: #76909b; font-size: 10px; text-align: right; }
.login-dialog, .client-dialog { width: min(440px, calc(100vw - 32px)); padding: 0; color: var(--ink); background: #142738; border: 1px solid #315267; border-radius: 16px; box-shadow: 0 25px 80px #000b; }
.login-dialog::backdrop, .client-dialog::backdrop { background: #020b14cc; backdrop-filter: blur(5px); }
.login-dialog form { display: grid; gap: 13px; padding: 34px; }
.login-dialog .brand-mark { margin-bottom: 7px; }
.login-dialog h2 { margin: 0; font: 700 25px Georgia, serif; }
.login-dialog p:not(.eyebrow):not(.form-error) { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
.login-dialog label, .access-control label { display: grid; gap: 7px; color: #a9c0c9; font-size: 11px; font-weight: 700; }
.login-dialog input, .access-control input { padding: 12px; color: #e8f3f5; background: #0d1d2d; border: 1px solid #2e4d60; border-radius: 8px; outline-color: #3b9fc5; }
.primary { padding: 13px; color: #fff; background: var(--accent-strong); border: 0; border-radius: 8px; font-weight: 800; }
.primary:hover { background: #1b99c9; }
.form-error { min-height: 17px; margin: 0; color: var(--red); font-size: 11px; }
.client-dialog { position: relative; width: min(800px, calc(100vw - 32px)); max-height: 86vh; overflow: auto; }
.close { position: absolute; z-index: 1; top: 10px; right: 15px; width: 32px; height: 32px; color: #9ebac5; background: #193548; border: 1px solid #315367; border-radius: 8px; font-size: 22px; line-height: 1; }
.close:hover { color: #fff; background: #25506a; }
.detail { padding: 31px; }
.detail h2 { margin: 0 42px 4px 0; font: 700 25px Georgia, serif; }
.detail-subtitle { margin: 0 0 24px; color: #7895a2; font-size: 11px; word-break: break-all; }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 25px; }
.detail-item { min-width: 0; padding: 12px; color: #819ca8; background: #102230; border: 1px solid #274455; border-radius: 9px; font-size: 10px; }
.detail-item strong { display: block; margin-top: 5px; color: #e3f0f3; font-size: 12px; overflow-wrap: anywhere; }
.access-control { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; padding-top: 20px; border-top: 1px solid #294456; }
.access-control label { flex: 1; min-width: 230px; }
.block-button { background: #aa414f; }
.block-button:hover { background: #c95361; }
.unblock-button { background: #17835c; }
.unblock-button:hover { background: #20a273; }
.detail-events { margin-top: 25px; border-top: 1px solid #294456; }
.detail-events h3 { margin: 20px 0 8px; font-size: 14px; }
.detail-events .event { padding-right: 0; padding-left: 0; grid-template-columns: 18px minmax(0, 1fr) 105px; }
@media (max-width: 1060px) { .shell { grid-template-columns: 215px minmax(0, 1fr); } .metrics { grid-template-columns: repeat(2, 1fr); } .sidebar { padding-right: 14px; padding-left: 14px; } }
@media (max-width: 780px) { .shell { display: block; } .sidebar { position: static; display: grid; grid-template-columns: auto 1fr; align-items: center; height: auto; padding: 14px 16px; gap: 10px 18px; } .sidebar-label, .sidebar-footer { display: none; } .sidebar nav { display: flex; grid-column: 1 / -1; overflow: auto; } .nav-link { flex: 0 0 auto; padding: 9px 10px; font-size: 12px; } main { padding: 28px 16px 54px; } }
@media (max-width: 560px) { .topbar, .panel-heading, .toolbar { align-items: stretch; flex-direction: column; } .topbar-actions { justify-content: space-between; } .metrics { grid-template-columns: 1fr; } .toolbar { gap: 12px; } .select-wrap { width: 100%; } .event-heading-actions { justify-content: space-between; } .event { grid-template-columns: 16px minmax(0, 1fr); padding-right: 16px; padding-left: 16px; } .event time { grid-column: 2; text-align: left; } .detail { padding: 25px 19px; } .detail-grid { grid-template-columns: 1fr 1fr; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
