:root {
  --bg: #0e1116;
  --panel: #161b22;
  --panel-2: #1c232d;
  --text: #e6edf3;
  --muted: #9aa7b4;
  --accent: #4ea1ff;
  --accent-2: #7c5cff;
  --ok: #2ea043;
  --off: #d1662b;
  --unknown: #6b7684;
  --border: #273039;
  --radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 20% -10%, #1a2330 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
}

.wrap { max-width: 920px; margin: 0 auto; padding: 32px 20px 64px; }

header.site {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  max-width: 920px;
  margin: 0 auto;
}
.logo {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tag { color: var(--muted); font-size: 13px; }

h1 { font-size: 30px; letter-spacing: -0.5px; margin: 0 0 8px; }
h2 { font-size: 18px; margin: 0 0 14px; }
p.lead { color: var(--muted); font-size: 16px; margin: 0 0 24px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin: 0 0 18px;
}

.btn {
  display: inline-block;
  border: none;
  cursor: pointer;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  text-decoration: none;
  margin-top: 8px;
}
.btn.secondary { background: var(--panel-2); border: 1px solid var(--border); }

.hidden { display: none !important; }

.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 8px 0 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

ul.devices { list-style: none; padding: 0; margin: 16px 0 0; }
.device {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 10px; margin-bottom: 8px; background: var(--panel-2);
}
.device-name { font-weight: 500; }
.badge { font-size: 12px; padding: 3px 10px; border-radius: 999px; font-weight: 600; }
.badge.online { background: rgba(46,160,67,.15); color: #4ac26b; }
.badge.offline { background: rgba(209,102,43,.15); color: #e0894f; }
.badge.unknown { background: rgba(107,118,132,.15); color: var(--unknown); }
.badge.cam { background: rgba(78,161,255,.15); color: var(--accent); margin-left: 8px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat { background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.stat .n { font-size: 28px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 4px; }
.trend-up { color: #4ac26b; } .trend-down { color: #e0894f; }

.bars { display: flex; align-items: flex-end; gap: 3px; height: 140px; margin-top: 10px; }
.bar { flex: 1 1 0; background: linear-gradient(180deg, var(--accent), var(--accent-2)); border-radius: 3px 3px 0 0; min-height: 2px; }
.bars-x { display: flex; gap: 3px; margin-top: 6px; color: var(--muted); font-size: 10px; }
.bars-x span { flex: 1 1 0; text-align: center; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
select, .pill {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px; font-size: 14px;
}
.muted { color: var(--muted); }
.upsell { border: 1px dashed var(--accent-2); background: rgba(124,92,255,.07); }

/* Account menu (top-right dropdown) */
.acct-menu { position: relative; margin-left: auto; }
.acct-btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 500;
}
.acct-btn .caret { color: var(--muted); font-size: 11px; }
.acct-email { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50;
  width: 300px; max-width: 86vw;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0,0,0,.45); overflow: hidden;
}
.acct-panel-head { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.acct-panel-email { font-weight: 600; margin-top: 2px; word-break: break-all; }
.acct-panel-section { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.menu-devices { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; }
.menu-devices li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.menu-devices li:last-child { border-bottom: none; }
.menu-dev-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-dev-sub { font-size: 11px; color: var(--muted); }
.acct-signout {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: none; border: none; color: #e0894f; font-size: 14px; font-weight: 600;
  padding: 14px 16px;
}
.acct-signout:hover { background: var(--panel-2); }
footer { color: var(--muted); font-size: 12px; text-align: center; padding: 24px; }
a { color: var(--accent); }
