:root {
  color-scheme: dark;
  --bg: #080a0d;
  --panel: #101319;
  --panel-2: #151920;
  --line: #252b34;
  --muted: #8c95a3;
  --text: #f4f6f8;
  --red: #ff4f48;
  --red-soft: rgba(255, 79, 72, .1);
  --violet: #9177ff;
  --amber: #ffbe3d;
  --green: #51df94;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled, select:disabled { cursor: not-allowed; opacity: .45; }
a { color: inherit; text-decoration: none; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 26px 20px; border-right: 1px solid var(--line); background: #0b0e12; display: flex; flex-direction: column; z-index: 10; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 26px; border-bottom: 1px solid var(--line); }
.brand strong { font-size: 15px; letter-spacing: .08em; }
.brand em, h1 em { color: var(--red); font-style: normal; }
.brandMark { width: 74px; height: 74px; display: grid; place-items: center; border: 1px solid rgba(255,79,72,.38); background: var(--red-soft); color: var(--red); font: 900 30px ui-monospace, monospace; box-shadow: inset 0 0 35px rgba(255,79,72,.08); }
.brandMark.small { width: 35px; height: 35px; font-size: 16px; flex: 0 0 auto; }
.nav { display: grid; gap: 6px; margin-top: 24px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border: 1px solid transparent; color: #8a939f; font-size: 12px; transition: .18s ease; }
.nav a:hover { color: white; border-color: var(--line); background: var(--panel); }
.nav span { color: #4e5763; font: 700 9px ui-monospace, monospace; }
.sidebarFoot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 14px 10px 0; border-top: 1px solid var(--line); }
.sidebarFoot strong, .sidebarFoot small { display: block; }
.sidebarFoot strong { font: 800 9px ui-monospace, monospace; letter-spacing: .12em; }
.sidebarFoot small { margin-top: 3px; color: #66707d; font-size: 9px; }
.liveDot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(81,223,148,.08), 0 0 15px rgba(81,223,148,.55); }

.main { min-width: 0; }
.topbar { min-height: 82px; padding: 17px 34px; border-bottom: 1px solid var(--line); background: rgba(8,10,13,.94); display: flex; align-items: center; justify-content: space-between; gap: 20px; position: sticky; top: 0; z-index: 8; backdrop-filter: blur(14px); }
.eyebrow, .sectionLabel { color: #727c8a; font: 800 9px ui-monospace, monospace; letter-spacing: .2em; }
.topbar h2 { margin: 5px 0 0; font-size: 18px; }
.content { width: min(1360px, 100%); margin: 0 auto; padding: 30px 34px 50px; }

.heroPanel { min-height: 310px; padding: 38px 42px; border: 1px solid var(--line); background: radial-gradient(circle at 80% 42%, rgba(255,79,72,.09), transparent 33%), linear-gradient(120deg, #10141a, #0c0f14); display: grid; grid-template-columns: 1fr 330px; align-items: center; overflow: hidden; }
.heroPanel h1 { max-width: 740px; margin: 13px 0 13px; font-size: clamp(34px, 5vw, 63px); line-height: .98; letter-spacing: -.045em; }
.heroPanel p { max-width: 720px; margin: 0; color: #9aa3af; font-size: 14px; line-height: 1.75; }
.heroPills { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 22px; }
.heroPills span { padding: 8px 10px; border: 1px solid var(--line); background: rgba(8,10,13,.55); color: #aab2bd; font: 700 8px ui-monospace, monospace; letter-spacing: .1em; }
.heroPills i { display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: var(--green); }
.radar { width: 255px; height: 255px; margin: auto; position: relative; border: 1px solid #313842; border-radius: 50%; background: repeating-radial-gradient(circle, transparent 0 39px, rgba(124,137,153,.14) 40px 41px), linear-gradient(90deg, transparent 49.7%, rgba(124,137,153,.15) 50%, transparent 50.3%), linear-gradient(transparent 49.7%, rgba(124,137,153,.15) 50%, transparent 50.3%); }
.radarSweep { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from -45deg, transparent 0 70%, rgba(255,79,72,.27) 93%, transparent); animation: sweep 4s linear infinite; }
@keyframes sweep { to { transform: rotate(360deg); } }
.radarCore { position: absolute; inset: 50% auto auto 50%; width: 43px; height: 43px; transform: translate(-50%,-50%); display: grid; place-items: center; border: 1px solid var(--red); color: var(--red); background: #151014; font: 900 21px ui-monospace, monospace; box-shadow: 0 0 30px rgba(255,79,72,.24); }
.blip { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 12px var(--red); }
.blip.one { top: 26%; left: 64%; }.blip.two { top: 62%; left: 27%; }.blip.three { top: 73%; left: 68%; }

.endpointManager, .events { margin-top: 20px; padding: 26px; border: 1px solid var(--line); background: var(--panel); }
.sectionHead { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.sectionHead h3 { margin: 6px 0 0; font-size: 21px; }
.sectionHead.compact h3 { font-size: 18px; }
.endpointAdd, .addForm { margin-top: 20px; display: grid; gap: 12px; }
.endpointAdd { grid-template-columns: minmax(0, 1fr) auto; align-items: end; padding: 16px; border: 1px dashed #303743; background: #0c0f13; }
label > span { display: block; margin-bottom: 7px; color: #798391; font: 800 9px ui-monospace, monospace; letter-spacing: .12em; }
input, select { width: 100%; height: 43px; padding: 0 13px; border: 1px solid #303743; outline: 0; background: #090c10; color: white; border-radius: 0; }
input:focus, select:focus { border-color: var(--red); box-shadow: 0 0 0 2px rgba(255,79,72,.08); }
.primaryButton, .ghostButton, .removeButton { min-height: 40px; padding: 0 14px; border-radius: 0; font: 800 9px ui-monospace, monospace; letter-spacing: .1em; text-transform: uppercase; display: inline-flex; align-items: center; justify-content: center; }
.primaryButton { border: 1px solid var(--red); background: var(--red); color: #120707; }
.primaryButton:hover { background: #ff6c66; }
.ghostButton { border: 1px solid #333b47; background: transparent; color: #c2c8d0; }
.ghostButton:hover { border-color: #657080; color: white; }
.removeButton { min-height: 32px; padding: 0 9px; border: 1px solid rgba(255,79,72,.25); background: transparent; color: #bf7774; }
.removeButton:hover { color: #ff8d88; border-color: rgba(255,79,72,.6); }
.endpointList { display: grid; gap: 14px; margin-top: 16px; }
.relayEndpoint { padding: 20px; border: 1px solid #2b323d; background: #0c0f14; }
.endpointTop { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.endpointTop h4 { margin: 7px 0 3px; font-size: 17px; }
.endpointTop small { color: #697381; font-size: 10px; }
.endpointState { color: var(--green); font: 800 8px ui-monospace, monospace; letter-spacing: .13em; }
.endpointState i { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--green); }
.secretUrl { margin-top: 17px; }
.secretUrl > span { display: block; margin-bottom: 7px; color: #697381; font: 800 8px ui-monospace, monospace; letter-spacing: .12em; }
.secretUrl > div { min-width: 0; display: grid; grid-template-columns: 1fr auto; border: 1px solid #2b323d; background: #07090c; }
.secretUrl code { min-width: 0; padding: 11px 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #c4cad2; font-size: 11px; }
.secretUrl button { border: 0; border-left: 1px solid #2b323d; padding: 0 13px; background: #131820; color: var(--red); font: 800 9px ui-monospace, monospace; }
.routeEditor { margin-top: 17px; padding: 16px; border-left: 2px solid #303743; background: #10141a; }
.modeSelect select { max-width: 520px; }
.routeEditor > p { margin: 9px 0 14px; color: #788391; font-size: 11px; }
.routeTargets { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.routeTarget { min-width: 0; display: grid; grid-template-columns: auto 28px 1fr; align-items: center; gap: 8px; padding: 10px; border: 1px solid #2b323d; background: #0a0d11; }
.routeTarget input { width: 15px; height: 15px; accent-color: var(--red); }
.routeTarget > span { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid rgba(145,119,255,.35); color: var(--violet); }
.routeTarget strong, .routeTarget small { min-width: 0; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.routeTarget strong { font-size: 11px; }.routeTarget small { margin-top: 2px; color: #626c79; font-size: 9px; }
.routeTarget.paused { opacity: .55; }
.routeActions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.emptyRoute { grid-column: 1 / -1; padding: 14px; border: 1px dashed #2b323d; color: #6f7987; font-size: 11px; }

.statGrid { margin-top: 20px; display: grid; gap: 18px; }
.statGrid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.statGrid article { padding: 22px; display: flex; align-items: center; gap: 17px; border: 1px solid var(--line); background: var(--panel); }
.statGrid small, .statGrid strong, .statGrid em { display: block; }
.statGrid small { color: var(--muted); font: 800 9px ui-monospace, monospace; letter-spacing: .12em; }
.statGrid strong { margin: 4px 0 2px; font-size: 30px; line-height: 1; }
.statGrid em { color: #707987; font-size: 9px; font-style: normal; }
.metricIcon { width: 46px; height: 46px; flex: 0 0 auto; display: grid; place-items: center; font: 900 18px ui-monospace, monospace; border: 1px solid; }
.metricIcon.red { color: #ff6d67; background: rgba(255,77,69,.09); border-color: rgba(255,77,69,.25); }
.metricIcon.violet { color: #aa91ff; background: rgba(125,89,255,.09); border-color: rgba(125,89,255,.25); }

.managerGrid { margin-top: 18px; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(330px, .8fr); gap: 18px; align-items: start; }
.managerCard { min-width: 0; padding: 24px; border: 1px solid var(--line); background: var(--panel); }
.addForm { padding-bottom: 19px; border-bottom: 1px solid var(--line); }
.targetList, .deviceList { margin-top: 17px; display: grid; gap: 8px; }
.targetRow, .deviceRow { min-width: 0; display: grid; grid-template-columns: 38px 1fr auto auto; align-items: center; gap: 10px; padding: 11px; border: 1px solid #29303a; background: #0b0e12; }
.targetRow > div, .deviceRow p { min-width: 0; margin: 0; }
.targetRow strong, .targetRow small, .deviceRow strong, .deviceRow small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.targetRow strong, .deviceRow strong { font-size: 11px; }.targetRow small, .deviceRow small { margin-top: 3px; color: #687280; font: 9px ui-monospace, monospace; }
.targetState { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid #353d49; color: #5f6874; }
.targetState.on { color: var(--violet); border-color: rgba(145,119,255,.45); background: rgba(145,119,255,.08); }
.switch { width: 39px; height: 22px; padding: 2px; border: 1px solid #353d49; background: #13171d; }
.switch i { display: block; width: 16px; height: 16px; background: #59616d; transition: .18s; }
.switch.on { border-color: rgba(81,223,148,.4); }.switch.on i { transform: translateX(15px); background: var(--green); }
.androidBadge { padding: 7px 9px; border: 1px solid rgba(81,223,148,.28); color: var(--green); font: 800 9px ui-monospace, monospace; }
.phoneVisual { width: 150px; height: 196px; margin: 22px auto; padding: 21px 12px 12px; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 2px solid #39414d; border-radius: 16px; background: radial-gradient(circle at 50% 54%, rgba(255,79,72,.2), transparent 48%), #080a0d; }
.phoneSpeaker { position: absolute; top: 9px; width: 34px; height: 3px; background: #39414d; border-radius: 2px; }
.phoneAlert { width: 49px; height: 49px; display: grid; place-items: center; border: 1px solid var(--red); color: var(--red); background: var(--red-soft); font: 900 24px ui-monospace, monospace; }
.phoneVisual strong { margin-top: 13px; color: #ff6e68; font: 900 12px ui-monospace, monospace; letter-spacing: .08em; }.phoneVisual small { margin-top: 6px; color: #6e7783; font-size: 8px; }
.deviceCard > p { color: #8993a0; font-size: 11px; line-height: 1.65; }
.deviceActions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.downloadButton { text-align: center; }
.pairingCode { margin-top: 14px; padding: 14px; border: 1px solid rgba(255,190,61,.3); background: rgba(255,190,61,.05); text-align: center; }
.pairingCode span, .pairingCode strong, .pairingCode small { display: block; }.pairingCode span { color: var(--amber); font: 800 8px ui-monospace, monospace; letter-spacing: .13em; }.pairingCode strong { margin: 6px 0; font: 900 25px ui-monospace, monospace; letter-spacing: .12em; }.pairingCode small { color: #817c70; font-size: 9px; }
.deviceRow { grid-template-columns: auto 1fr auto; }

.accountManager { scroll-margin-top: 100px; }
.accountIntro { max-width: 920px; margin: 14px 0 0; color: #8993a0; font-size: 11px; line-height: 1.7; }
.adminBadge { padding: 7px 9px; border: 1px solid rgba(255,190,61,.3); color: var(--amber); font: 800 8px ui-monospace, monospace; letter-spacing: .1em; }
.accountAdd { margin-top: 18px; padding: 16px; display: grid; grid-template-columns: minmax(150px,.75fr) minmax(210px,1fr) minmax(145px,.55fr) auto; gap: 10px; align-items: end; border: 1px dashed #303743; background: #0c0f13; }
.accountList { margin-top: 16px; display: grid; gap: 8px; }
.accountRow { min-width: 0; padding: 13px; display: grid; grid-template-columns: 46px minmax(170px,1fr) minmax(145px,.45fr) auto; align-items: center; gap: 12px; border: 1px solid #29303a; background: #0b0e12; }
.accountRow.disabled { opacity: .68; }
.accountState { width: 43px; height: 43px; display: grid; place-items: center; border: 1px solid #3a414b; color: #737d89; font: 900 8px ui-monospace, monospace; }
.accountState.on { color: var(--green); border-color: rgba(81,223,148,.35); background: rgba(81,223,148,.06); }
.accountIdentity { min-width: 0; }
.accountIdentity strong, .accountIdentity small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.accountIdentity strong { font-size: 12px; }.accountIdentity small { margin-top: 5px; color: #687280; font: 9px ui-monospace, monospace; }
.accountIdentity em { margin-left: 6px; padding: 3px 5px; color: var(--amber); border: 1px solid rgba(255,190,61,.25); font: 800 7px ui-monospace, monospace; font-style: normal; }
.roleControl span { margin-bottom: 4px; }.roleControl select { height: 36px; }
.accountActions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.accountActions .ghostButton { min-height: 32px; padding: 0 9px; }

.eventList { margin-top: 18px; display: grid; }
.eventList article { min-width: 0; padding: 13px 5px; display: grid; grid-template-columns: auto minmax(0,1fr) auto auto; align-items: center; gap: 12px; border-bottom: 1px solid #232933; }
.eventPulse { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 12px rgba(255,79,72,.55); }
.eventName { min-width: 0; }.eventName strong, .eventName small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.eventName strong { font-size: 12px; }.eventName small { margin-top: 4px; color: #727c89; font-size: 10px; }
.eventList time { color: #77818f; font: 9px ui-monospace, monospace; white-space: nowrap; }
.delivery { padding: 5px 7px; border: 1px solid rgba(81,223,148,.25); color: var(--green); font: 800 8px ui-monospace, monospace; }.delivery.warning { color: var(--amber); border-color: rgba(255,190,61,.25); }
.emptyState, .loadingState { padding: 22px; border: 1px dashed #2e3540; color: #6f7987; text-align: center; }
.emptyState strong, .emptyState span { display: block; }.emptyState strong { color: #a4acb6; font-size: 12px; }.emptyState span { margin-top: 5px; font-size: 10px; }
.footerNote { padding: 22px 0 0; color: #58616e; text-align: center; font-size: 9px; }

.toast { position: fixed; right: 22px; bottom: 22px; max-width: min(420px, calc(100vw - 44px)); padding: 13px 16px; z-index: 50; border: 1px solid transparent; background: #11161c; color: white; font-size: 11px; opacity: 0; pointer-events: none; transform: translateY(12px); transition: .2s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }.toast.good { border-color: rgba(81,223,148,.45); }.toast.bad { border-color: rgba(255,79,72,.55); }

.loginBody { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 22% 45%, rgba(255,79,72,.1), transparent 28%), #080a0d; }
.loginShell { width: min(920px, 100%); min-height: 530px; display: grid; grid-template-columns: 1.05fr .95fr; border: 1px solid var(--line); background: #0d1015; box-shadow: 0 25px 80px rgba(0,0,0,.45); }
.loginBrand { padding: 48px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; border-right: 1px solid var(--line); background: radial-gradient(circle at 30% 58%, rgba(255,79,72,.12), transparent 35%); }
.loginBrand h1 { margin: 20px 0 14px; font-size: 68px; line-height: .83; letter-spacing: -.06em; }.loginBrand p { max-width: 390px; color: #8e98a5; font-size: 13px; line-height: 1.7; }
.loginStatus { margin-top: 22px; color: #87919d; font: 800 8px ui-monospace, monospace; letter-spacing: .13em; }.loginStatus span { display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px rgba(81,223,148,.6); }
.loginCard { padding: 48px 42px; display: flex; flex-direction: column; justify-content: center; }.loginCard h2 { margin: 10px 0 8px; font-size: 25px; }.loginCard > p { margin: 0 0 22px; color: #818b98; font-size: 12px; }.loginCard form { display: grid; gap: 15px; }.loginCard .primaryButton { margin-top: 5px; min-height: 44px; }.loginCard > small { margin-top: 18px; color: #5f6874; font-size: 9px; line-height: 1.5; }.formError { margin-bottom: 15px; padding: 10px; border: 1px solid rgba(255,79,72,.4); background: var(--red-soft); color: #ff9793; font-size: 11px; }

@media (max-width: 1050px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; width: 100%; height: auto; padding: 15px 20px; flex-direction: row; align-items: center; }
  .brand { padding: 0; border: 0; }.nav { margin: 0 0 0 auto; display: flex; }.nav a { font-size: 0; padding: 10px; }.nav a span { font-size: 9px; }.sidebarFoot { display: none; }
  .topbar { top: 0; }.heroPanel { grid-template-columns: 1fr; }.radar { display: none; }
  .managerGrid { grid-template-columns: 1fr; }
  .accountAdd { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .accountRow { grid-template-columns: 46px minmax(160px,1fr) minmax(140px,.5fr); }.accountActions { grid-column: 2 / -1; }
}

@media (max-width: 700px) {
  .content { padding: 18px 14px 35px; }.topbar { padding: 13px 14px; }.topbar .ghostButton { padding: 0 9px; font-size: 7px; }
  .sidebar { overflow-x: auto; }.brand strong { display: none; }.nav { min-width: max-content; }
  .heroPanel { min-height: 0; padding: 28px 21px; }.heroPanel h1 { font-size: 38px; }
  .endpointManager, .events, .managerCard { padding: 18px 15px; }
  .endpointAdd, .statGrid.two, .routeTargets, .deviceActions { grid-template-columns: 1fr; }
  .secretUrl > div { grid-template-columns: minmax(0,1fr) auto; }.routeActions { flex-direction: column; }.routeActions button { width: 100%; }
  .eventList article { grid-template-columns: auto minmax(0,1fr) auto; }.eventList time { display: none; }.delivery { grid-column: 2; justify-self: start; }
  .targetRow { grid-template-columns: 34px minmax(0,1fr) auto; }.targetRow .removeButton { grid-column: 2 / -1; justify-self: end; }
  .accountAdd { grid-template-columns: 1fr; }.accountRow { grid-template-columns: 43px minmax(0,1fr); }.roleControl, .accountActions { grid-column: 2; }.accountActions { justify-content: flex-start; }
  .loginBody { padding: 10px; }.loginShell { grid-template-columns: 1fr; }.loginBrand { min-height: 260px; padding: 30px; border-right: 0; border-bottom: 1px solid var(--line); }.loginBrand .brandMark { width: 50px; height: 50px; font-size: 22px; }.loginBrand h1 { font-size: 48px; }.loginBrand p { margin-bottom: 0; }.loginCard { padding: 32px 24px; }
}
