/* ==========================================================================
   WiFiScope — dark RF intelligence theme
   ========================================================================== */
:root {
  --bg: #060d12;
  --bg-deep: #04090d;
  --panel: #0b161e;
  --panel-2: #0f1d26;
  --panel-3: #13242e;
  --line: rgba(135, 177, 196, 0.13);
  --line-strong: rgba(135, 177, 196, 0.24);
  --text: #e9f3f6;
  --text-soft: #c4d5dc;
  --muted: #8299a7;
  --faint: #566b76;
  --accent: #44e3c4;
  --accent-bright: #77f5dd;
  --accent-dim: rgba(68, 227, 196, 0.12);
  --blue: #5aa8ff;
  --blue-dim: rgba(90, 168, 255, 0.12);
  --amber: #ffc65a;
  --amber-dim: rgba(255, 198, 90, 0.12);
  --danger: #ff6f83;
  --danger-dim: rgba(255, 111, 131, 0.12);
  --purple: #bd93f9;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --sidebar-w: 254px;
  --topbar-h: 92px;
  --font: "Segoe UI", Inter, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
[hidden] { display: none !important; }
body {
  background:
    radial-gradient(1000px 650px at 75% -10%, rgba(28, 112, 108, 0.15), transparent 60%),
    radial-gradient(700px 500px at 0% 100%, rgba(35, 82, 120, 0.09), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
  z-index: 0;
}
::selection { background: rgba(68, 227, 196, .28); color: #fff; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: .92em; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; display: inline-block; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; padding: 0;
  border: 1px solid transparent; border-radius: 9px;
  background: transparent; color: var(--muted); cursor: pointer;
  transition: .18s ease;
}
.icon-btn:hover { color: var(--text); background: rgba(255,255,255,.05); border-color: var(--line); }
.eyebrow {
  color: var(--accent);
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .17em;
}
.mono { font-family: var(--mono); letter-spacing: -.02em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.dot { width: 4px; height: 4px; border-radius: 50%; background: var(--faint); display: inline-block; }

/* ==========================================================================
   Boot + login
   ========================================================================== */
#boot-screen {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: var(--bg-deep); color: var(--faint);
  font-size: 11px; text-transform: uppercase; letter-spacing: .2em;
  transition: opacity .35s ease;
}
.boot-mark { color: var(--accent); animation: pulse 1.8s infinite; }
.boot-mark .icon { width: 52px; height: 52px; }
.login-view {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(420px, .82fr);
}
.login-visual {
  position: relative; overflow: hidden;
  padding: 42px 52px;
  display: flex; flex-direction: column;
  background:
    radial-gradient(600px 520px at 60% 44%, rgba(37, 158, 143, .16), transparent 65%),
    linear-gradient(155deg, #07131a 0%, #061015 55%, #040b0f 100%);
  border-right: 1px solid var(--line);
}
.login-visual::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(89, 223, 201, .035) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(89, 223, 201, .035) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 60% 45%, black, transparent 75%);
}
.login-visual::after {
  content: ""; position: absolute; width: 1px; height: 26%; left: 52px; top: 38%;
  background: linear-gradient(transparent, var(--accent), transparent); opacity: .3;
}
.login-brand, .brand {
  display: flex; align-items: center; gap: 12px;
  font-size: 19px; letter-spacing: .02em; font-weight: 600;
  position: relative; z-index: 3;
}
.brand b, .login-brand b { color: var(--accent); font-weight: 600; }
.brand-mark {
  width: 36px; height: 36px; display: grid; place-items: center;
  color: var(--accent);
  border: 1px solid rgba(68, 227, 196, .25);
  border-radius: 11px;
  background: linear-gradient(145deg, rgba(68, 227, 196, .12), rgba(68, 227, 196, .02));
  box-shadow: inset 0 0 18px rgba(68, 227, 196, .05);
}
.brand-mark .icon { width: 27px; height: 27px; }
.radar-stage {
  position: relative; z-index: 2;
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  min-height: 390px;
}
.radar {
  position: relative; width: min(30vw, 430px); aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(68, 227, 196, .16);
  background: radial-gradient(circle, rgba(68, 227, 196, .055) 0%, rgba(4, 13, 18, .2) 62%, transparent 63%);
  box-shadow: 0 0 100px rgba(68, 227, 196, .06), inset 0 0 80px rgba(68, 227, 196, .035);
}
.radar::before, .radar::after {
  content: ""; position: absolute; border-radius: 50%; border: 1px solid rgba(68, 227, 196, .13);
}
.radar::before { inset: 17%; }
.radar::after { inset: 34%; }
.radar-grid {
  position: absolute; inset: 0; border-radius: 50%;
  background-image:
    linear-gradient(90deg, transparent 49.8%, rgba(68, 227, 196, .12) 49.9%, rgba(68, 227, 196, .12) 50.1%, transparent 50.2%),
    linear-gradient(transparent 49.8%, rgba(68, 227, 196, .12) 49.9%, rgba(68, 227, 196, .12) 50.1%, transparent 50.2%);
}
.radar-sweep {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(68, 227, 196, .32), rgba(68, 227, 196, .04) 22%, transparent 40%, transparent 100%);
  -webkit-mask: radial-gradient(circle, transparent 0 3%, black 4% 100%);
  mask: radial-gradient(circle, transparent 0 3%, black 4% 100%);
  animation: sweep 6.5s linear infinite;
}
.radar-center {
  position: absolute; width: 10px; height: 10px; border-radius: 50%;
  left: calc(50% - 5px); top: calc(50% - 5px);
  background: var(--accent); box-shadow: 0 0 18px var(--accent);
}
.radar-dot {
  position: absolute; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-bright); box-shadow: 0 0 12px rgba(68, 227, 196, .9);
}
.radar-dot::after {
  content: ""; position: absolute; inset: -7px; border: 1px solid rgba(68, 227, 196, .4); border-radius: 50%;
  animation: ping 3s ease-out infinite;
}
.radar-dot.d1 { left: 66%; top: 24%; animation-delay: .3s; }
.radar-dot.d2 { left: 29%; top: 39%; background: var(--amber); box-shadow: 0 0 12px rgba(255, 198, 90, .8); animation-delay: 1.1s; }
.radar-dot.d2::after { border-color: rgba(255, 198, 90, .4); animation-delay: 1.1s; }
.radar-dot.d3 { left: 72%; top: 67%; animation-delay: 2s; }
.radar-dot.d4 { left: 43%; top: 78%; width: 4px; height: 4px; animation-delay: .7s; }
.radar-label {
  position: absolute; z-index: 3;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .16em; color: rgba(130, 153, 167, .65);
}
.radar-label.top { top: 18%; right: 3%; }
.radar-label.bottom { bottom: 14%; left: 3%; }
.visual-copy { position: relative; z-index: 3; max-width: 620px; padding-bottom: 32px; }
.visual-copy h1 {
  margin: 14px 0 18px;
  font-size: clamp(36px, 4.2vw, 64px);
  line-height: .99; letter-spacing: -.045em; font-weight: 600;
}
.visual-copy h1 em { font-style: normal; color: var(--accent); }
.visual-copy > p:last-child { max-width: 480px; color: var(--muted); font-size: 14.5px; line-height: 1.7; }
.login-visual-foot {
  position: relative; z-index: 3;
  display: flex; justify-content: space-between; gap: 20px;
  color: var(--faint); font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase;
  padding-top: 24px; border-top: 1px solid var(--line);
}
.login-visual-foot span { display: flex; align-items: center; gap: 8px; }
.login-visual-foot i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.login-panel {
  position: relative; z-index: 2;
  padding: 48px clamp(30px, 5vw, 78px) 28px;
  display: flex; flex-direction: column; justify-content: center;
  background: rgba(6, 13, 18, .72);
}
.login-box { width: 100%; max-width: 420px; margin: 0 auto; }
.mobile-brand { display: none; align-items: center; gap: 12px; font-size: 20px; margin-bottom: 48px; }
.mobile-brand b { color: var(--accent); }
.login-box h2 { font-size: clamp(30px, 3vw, 40px); letter-spacing: -.045em; margin: 10px 0 12px; font-weight: 600; }
.login-sub { color: var(--muted); font-size: 13.5px; line-height: 1.65; margin-bottom: 32px; }
.field-label { display: block; margin-bottom: 9px; color: var(--text-soft); font-size: 12px; font-weight: 600; }
.token-field {
  display: flex; align-items: center;
  border: 1px solid var(--line-strong); border-radius: 12px;
  background: rgba(11, 22, 30, .85);
  transition: .2s ease;
  overflow: hidden;
}
.token-field:focus-within { border-color: rgba(68, 227, 196, .65); box-shadow: 0 0 0 4px rgba(68, 227, 196, .08); }
.field-icon { display: grid; place-items: center; padding-left: 15px; color: var(--faint); }
.token-field input {
  flex: 1; width: 100%; height: 52px; padding: 0 12px;
  border: 0; outline: 0; background: transparent; color: var(--text);
  font-family: var(--mono); font-size: 13px; letter-spacing: .02em;
}
.token-field input::placeholder { color: var(--faint); font-family: var(--font); font-size: 13px; letter-spacing: 0; }
.token-eye { margin-right: 7px; }
.form-error {
  display: flex; gap: 9px; align-items: flex-start;
  margin: 12px 0 0; padding: 11px 12px;
  border-radius: 9px; border: 1px solid rgba(255, 111, 131, .24);
  color: #ffadb8; background: var(--danger-dim); font-size: 12.5px;
}
.form-error .icon { width: 15px; height: 15px; margin-top: 1px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 38px; padding: 0 15px;
  border: 1px solid var(--line-strong); border-radius: 9px;
  background: rgba(255, 255, 255, .025); color: var(--text-soft);
  font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: .18s ease;
}
.btn:hover { background: rgba(255, 255, 255, .055); border-color: rgba(135, 177, 196, .35); color: var(--text); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary {
  color: #04201b; border-color: transparent;
  background: linear-gradient(135deg, #5cebd0, #34c7af);
  box-shadow: 0 8px 28px rgba(68, 227, 196, .16);
}
.btn-primary:hover { color: #03201a; background: linear-gradient(135deg, #79f7e1, #45d6bf); border-color: transparent; }
.btn-ghost { background: transparent; }
.btn-danger { color: #ffb4be; border-color: rgba(255, 111, 131, .26); background: var(--danger-dim); }
.btn-danger:hover { color: #fff; background: rgba(255, 111, 131, .2); border-color: rgba(255, 111, 131, .45); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 11.5px; border-radius: 8px; }
.btn-block { width: 100%; height: 53px; margin-top: 20px; font-size: 13.5px; border-radius: 12px; justify-content: space-between; padding: 0 18px 0 20px; }
.btn-block .icon { width: 19px; height: 19px; }
.login-hint {
  display: flex; gap: 11px; margin-top: 28px; padding-top: 22px;
  border-top: 1px solid var(--line); color: var(--faint); font-size: 11.5px; line-height: 1.6;
}
.login-hint .icon { width: 16px; height: 16px; color: var(--accent); margin-top: 1px; }
.login-hint code { color: var(--muted); background: rgba(255,255,255,.04); padding: 1px 4px; border-radius: 4px; }
.login-foot {
  width: 100%; max-width: 420px; margin: auto auto 0; padding-top: 48px;
  display: flex; justify-content: space-between; gap: 16px;
  color: var(--faint); font-size: 10px; text-transform: uppercase; letter-spacing: .1em;
}

/* ==========================================================================
   Application shell
   ========================================================================== */
.app-shell {
  position: relative; z-index: 1;
  display: flex; height: 100vh; overflow: hidden;
}
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  height: 100%;
  display: flex; flex-direction: column;
  padding: 24px 15px 18px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(7, 16, 22, .92), rgba(5, 12, 17, .72));
  backdrop-filter: blur(16px);
  z-index: 40;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 0 9px 0 8px; }
.sidebar .brand { font-size: 18px; }
.sidebar .brand-mark { width: 34px; height: 34px; }
.sidebar-close { display: none; }
.workspace-chip {
  display: flex; align-items: center; gap: 11px;
  margin: 28px 3px 23px; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: rgba(255,255,255,.018);
}
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(68,227,196,.08), 0 0 12px rgba(68,227,196,.5); animation: softPulse 3s infinite; flex: 0 0 auto; }
.workspace-chip div { display: flex; flex-direction: column; gap: 1px; }
.workspace-chip strong { font-size: 11px; font-weight: 600; letter-spacing: .01em; }
.workspace-chip span { font-size: 10px; color: var(--faint); }
.main-nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; padding-right: 2px; }
.nav-caption {
  padding: 16px 12px 7px;
  color: var(--faint); font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .16em;
}
.nav-caption:first-child { padding-top: 0; }
.main-nav a {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  height: 39px; padding: 0 12px;
  color: #8fa4af; border-radius: 9px;
  font-size: 12.5px; font-weight: 500;
  transition: .16s ease;
}
.main-nav a .icon { width: 17px; height: 17px; color: #627985; transition: .16s ease; }
.main-nav a:hover { color: var(--text); background: rgba(255,255,255,.035); }
.main-nav a:hover .icon { color: var(--text-soft); }
.main-nav a.active {
  color: var(--accent-bright);
  background: linear-gradient(90deg, rgba(68, 227, 196, .12), rgba(68, 227, 196, .025));
}
.main-nav a.active::before {
  content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 2px;
  border-radius: 2px; background: var(--accent); box-shadow: 0 0 12px rgba(68, 227, 196, .55);
}
.main-nav a.active .icon { color: var(--accent); }
.sidebar-bottom { padding-top: 14px; border-top: 1px solid var(--line); margin-top: 14px; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 8px 5px; }
.user-avatar {
  width: 34px; height: 34px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 9px; border: 1px solid rgba(68, 227, 196, .23);
  background: linear-gradient(140deg, rgba(68, 227, 196, .18), rgba(68, 227, 196, .03));
  color: var(--accent); font-size: 10.5px; font-weight: 700; letter-spacing: .05em;
}
.user-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.user-meta strong { font-size: 11.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta span { font-size: 10px; color: var(--faint); }
.build-label { margin-top: 10px; padding-left: 6px; color: #40545e; font-family: var(--mono); font-size: 9px; letter-spacing: .05em; }
.build-label span { color: #5d747f; }
.workspace {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.topbar {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  padding: 0 clamp(22px, 3.2vw, 46px);
  display: flex; align-items: center; justify-content: space-between; gap: 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(6, 13, 18, .55);
  backdrop-filter: blur(18px);
  z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.page-eyebrow { color: var(--faint); font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .17em; margin-bottom: 5px; }
.page-title { font-size: clamp(21px, 2.3vw, 27px); line-height: 1.1; letter-spacing: -.035em; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.mobile-menu { display: none; }
.page {
  flex: 1; overflow-y: auto;
  padding: 28px clamp(22px, 3.2vw, 46px) 56px;
  scroll-behavior: smooth;
  position: relative;
}
.page > * { animation: rise .4s ease both; }
.page-inner { max-width: 1580px; margin: 0 auto; }
.page-section { margin-top: 30px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.section-head h2 { font-size: 15px; font-weight: 600; letter-spacing: -.015em; }
.section-head p { color: var(--faint); font-size: 11.5px; margin-top: 3px; }
.section-link { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11.5px; transition: .15s; }
.section-link:hover { color: var(--accent); }
.section-link .icon { width: 14px; height: 14px; }

/* ==========================================================================
   Cards / metrics
   ========================================================================== */
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(15, 29, 38, .86), rgba(8, 17, 23, .88));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
}
.stats-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.stat-card {
  position: relative; overflow: hidden;
  padding: 19px 20px 18px;
  min-height: 134px;
  display: flex; flex-direction: column;
}
.stat-card::after {
  content: ""; position: absolute; width: 150px; height: 150px;
  right: -70px; top: -80px; border-radius: 50%;
  background: radial-gradient(circle, var(--stat-glow, rgba(68,227,196,.12)), transparent 68%);
  pointer-events: none;
}
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; color: var(--muted); gap: 10px; }
.stat-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .13em; }
.stat-icon {
  width: 33px; height: 33px; display: grid; place-items: center;
  border-radius: 9px; border: 1px solid var(--line);
  background: rgba(255,255,255,.025); color: var(--stat-color, var(--accent));
}
.stat-icon .icon { width: 16px; height: 16px; }
.stat-value { margin-top: 12px; font-size: clamp(27px, 2.9vw, 38px); line-height: 1; font-weight: 600; letter-spacing: -.045em; }
.stat-foot { display: flex; align-items: center; gap: 7px; margin-top: auto; padding-top: 11px; color: var(--faint); font-size: 10.5px; }
.stat-delta { color: var(--accent); font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.stat-delta.neutral { color: var(--muted); }
.mini-stats {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px; margin-top: 14px;
}
.mini-stat {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border: 1px solid var(--line); border-radius: 11px;
  background: rgba(11, 22, 30, .55);
}
.mini-stat .icon { width: 17px; height: 17px; color: var(--faint); }
.mini-stat strong { font-size: 15px; font-weight: 600; }
.mini-stat span { color: var(--faint); font-size: 11px; }
.mini-stat .mini-label { margin-left: auto; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid-equal { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.chart-card { padding: 20px; min-width: 0; }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.chart-head h3 { font-size: 13px; font-weight: 600; }
.chart-head p { color: var(--faint); font-size: 10.5px; margin-top: 3px; }
.chart-legend { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 10px; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.chart-wrap { position: relative; height: 250px; }
.chart-wrap.tall { height: 300px; }
.chart-wrap.short { height: 210px; }
.no-chart { height: 100%; display: flex; align-items: center; justify-content: center; color: var(--faint); font-size: 12px; text-align: center; padding: 20px; }

/* Lists / tables */
.list-card { overflow: hidden; }
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 17px 19px 13px; }
.list-head h3 { font-size: 13px; font-weight: 600; }
.list-icon { color: var(--accent); }
.rank-list { padding: 3px 19px 13px; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.rank-row:first-child { border-top: 0; }
.rank-num { color: var(--faint); font-family: var(--mono); font-size: 10px; width: 16px; flex: 0 0 auto; }
.rank-main { min-width: 0; flex: 1; }
.rank-name { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-sub { color: var(--faint); font-size: 10px; margin-top: 2px; }
.rank-value { font-size: 11.5px; color: var(--text-soft); font-weight: 600; }
.rank-bar { height: 3px; border-radius: 2px; background: rgba(255,255,255,.055); margin-top: 7px; overflow: hidden; }
.rank-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), rgba(68,227,196,.25)); }
.empty-inline { padding: 30px 18px; text-align: center; color: var(--faint); font-size: 11.5px; }

.table-card { overflow: hidden; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th {
  padding: 11px 14px; text-align: left; white-space: nowrap;
  color: var(--faint); font-size: 9.5px; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 17, 23, .7);
}
.data-table td { padding: 12px 14px; border-bottom: 1px solid rgba(135,177,196,.075); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr { cursor: default; transition: background .13s; }
.data-table tbody tr[data-row] { cursor: pointer; }
.data-table tbody tr:hover { background: rgba(255,255,255,.022); }
.data-table .cell-main { display: flex; flex-direction: column; gap: 2px; min-width: 130px; }
.data-table .cell-main strong { font-size: 12px; font-weight: 550; color: var(--text); max-width: 270px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-table .cell-main span { color: var(--faint); font-family: var(--mono); font-size: 9.5px; white-space: nowrap; }
.data-table .num { font-family: var(--mono); font-size: 11.5px; color: var(--text-soft); white-space: nowrap; }
.data-table .muted-cell { color: var(--muted); font-size: 11px; }
.data-table .actions-cell { width: 1%; text-align: right; }
.row-arrow { color: var(--faint); }
.table-hover .row-arrow { opacity: 0; transition: .15s; }
.table-hover tr:hover .row-arrow { opacity: 1; color: var(--accent); }
.table-location { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10.5px; max-width: 190px; }
.table-location .icon { width: 12px; height: 12px; color: var(--faint); flex: 0 0 auto; }
.table-location span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-empty { padding: 65px 20px; text-align: center; color: var(--faint); }
.table-empty .icon { width: 30px; height: 30px; margin-bottom: 12px; color: var(--faint); opacity: .6; }
.table-empty h3 { color: var(--muted); font-size: 13px; margin-bottom: 5px; font-weight: 500; }
.table-empty p { font-size: 11.5px; max-width: 380px; margin: 0 auto; line-height: 1.6; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 21px; padding: 2px 7px;
  border-radius: 5px; border: 1px solid var(--line);
  background: rgba(255,255,255,.025);
  color: var(--muted); font-size: 9.5px; font-weight: 600;
  letter-spacing: .02em; white-space: nowrap;
}
.badge .icon { width: 10px; height: 10px; }
.badge-green { color: var(--accent); border-color: rgba(68,227,196,.2); background: var(--accent-dim); }
.badge-blue { color: var(--blue); border-color: rgba(90,168,255,.2); background: var(--blue-dim); }
.badge-amber { color: var(--amber); border-color: rgba(255,198,90,.2); background: var(--amber-dim); }
.badge-red { color: var(--danger); border-color: rgba(255,111,131,.2); background: var(--danger-dim); }
.badge-purple { color: var(--purple); border-color: rgba(189,147,249,.2); background: rgba(189,147,249,.1); }
.badge-neutral { color: var(--faint); }
.badge-row { display: flex; flex-wrap: wrap; gap: 5px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.status-dot.off { background: var(--faint); box-shadow: none; }

/* Signal */
.signal { display: inline-flex; align-items: flex-end; gap: 2px; height: 13px; vertical-align: middle; }
.signal i { width: 3px; border-radius: 1px; background: rgba(255,255,255,.09); }
.signal i:nth-child(1) { height: 4px; }
.signal i:nth-child(2) { height: 7px; }
.signal i:nth-child(3) { height: 10px; }
.signal i:nth-child(4) { height: 13px; }
.signal.s1 i:nth-child(1), .signal.s2 i:nth-child(-n+2), .signal.s3 i:nth-child(-n+3), .signal.s4 i { background: var(--accent); }
.signal.s1 i:nth-child(1), .signal.s2 i:nth-child(-n+2) { background: var(--danger); }
.signal.s3 i:nth-child(-n+3) { background: var(--amber); }
.signal-value { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-left: 6px; }

/* Toolbar */
.toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search-field { flex: 1 1 250px; max-width: 420px; }
.search-field { position: relative; display: flex; align-items: center; }
.search-field .icon { position: absolute; left: 12px; width: 15px; height: 15px; color: var(--faint); pointer-events: none; }
.search-field input {
  width: 100%; height: 38px; padding: 0 12px 0 36px;
  border: 1px solid var(--line); border-radius: 9px;
  background: rgba(11, 22, 30, .75); color: var(--text);
  outline: none; font-size: 12px; transition: .18s;
}
.search-field input::placeholder { color: var(--faint); }
.search-field input:focus { border-color: rgba(68,227,196,.4); box-shadow: 0 0 0 3px rgba(68,227,196,.055); }
.select {
  height: 38px; padding: 0 32px 0 12px;
  appearance: none;
  border: 1px solid var(--line); border-radius: 9px;
  background: rgba(11, 22, 30, .75) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238299a7' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 11px center;
  color: var(--text-soft); font-size: 11.5px; outline: none; cursor: pointer;
}
.select:focus { border-color: rgba(68,227,196,.4); }
.select option { background: #0b161e; }
.toolbar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.result-count { color: var(--faint); font-size: 10.5px; padding: 0 3px; white-space: nowrap; }
.result-count b { color: var(--muted); font-weight: 600; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 16px; border-top: 1px solid var(--line); }
.pagination-info { color: var(--faint); font-size: 10.5px; }
.pagination-controls { display: flex; align-items: center; gap: 5px; }
.page-btn {
  min-width: 30px; height: 30px; padding: 0 9px;
  border: 1px solid var(--line); border-radius: 7px;
  background: rgba(255,255,255,.018); color: var(--muted);
  font-size: 11px; cursor: pointer;
}
.page-btn:hover:not(:disabled) { color: var(--text); border-color: var(--line-strong); }
.page-btn:disabled { opacity: .35; cursor: default; }
.page-btn.current { color: var(--accent); border-color: rgba(68,227,196,.28); background: var(--accent-dim); }

/* Loading */
.skeleton { position: relative; overflow: hidden; background: rgba(255,255,255,.035); border-radius: 6px; }
.skeleton::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.045), transparent);
  animation: shimmer 1.4s infinite;
}
.loading-page { display: grid; gap: 14px; }
.loading-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.sk-card { height: 134px; border-radius: var(--radius); }
.sk-line { height: 12px; } .sk-line.w40 { width: 40%; } .sk-line.w60 { width: 60%; }
.spinner { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.15); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }

/* ==========================================================================
   Map
   ========================================================================== */
.map-layout {
  display: grid; grid-template-columns: 330px minmax(0, 1fr);
  height: calc(100vh - var(--topbar-h) - 84px);
  min-height: 560px;
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; background: var(--panel);
}
.map-panel { display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--line); background: rgba(8, 17, 23, .75); }
.map-panel-head { padding: 17px 17px 12px; border-bottom: 1px solid var(--line); }
.map-panel-head h2 { font-size: 14px; font-weight: 600; }
.map-panel-head p { color: var(--faint); font-size: 10.5px; margin-top: 3px; }
.map-tabs { display: flex; padding: 11px 14px 0; gap: 4px; border-bottom: 1px solid var(--line); }
.map-tab {
  flex: 1; height: 31px; border: 0; border-bottom: 2px solid transparent;
  background: transparent; color: var(--faint);
  font-size: 10.5px; font-weight: 600; cursor: pointer; transition: .16s;
}
.map-tab:hover { color: var(--text-soft); }
.map-tab.active { color: var(--accent); border-color: var(--accent); }
.map-search { padding: 11px 13px; border-bottom: 1px solid var(--line); }
.map-search .search-field input { height: 35px; font-size: 11px; }
.map-results { flex: 1; overflow-y: auto; padding: 6px 8px 10px; }
.map-item {
  width: 100%; display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 9px; border: 1px solid transparent; border-radius: 8px;
  background: transparent; text-align: left; cursor: pointer; transition: .15s;
}
.map-item:hover { background: rgba(255,255,255,.03); border-color: var(--line); }
.map-item.active { background: var(--accent-dim); border-color: rgba(68,227,196,.15); }
.map-item-icon {
  width: 27px; height: 27px; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 7px; border: 1px solid var(--line);
  background: rgba(255,255,255,.025); color: var(--accent);
}
.map-item-icon .icon { width: 14px; height: 14px; }
.map-item-body { min-width: 0; flex: 1; }
.map-item-title { display: block; font-size: 11.5px; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-item-sub { display: block; color: var(--faint); font-size: 9.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-item-count { color: var(--muted); font-family: var(--mono); font-size: 9.5px; padding-left: 4px; }
.map-results-foot { border-top: 1px solid var(--line); padding: 9px 13px; color: var(--faint); font-size: 9.5px; display: flex; justify-content: space-between; }
.map-canvas-wrap { position: relative; min-height: 0; }
#map-canvas { position: absolute; inset: 0; background: #0a1216; }
.map-overlay {
  position: absolute; z-index: 500; left: 50%; top: 50%; transform: translate(-50%, -50%);
  min-width: 220px; padding: 18px 22px; text-align: center;
  border: 1px solid var(--line); border-radius: 12px;
  background: rgba(7, 16, 22, .92); backdrop-filter: blur(8px);
  pointer-events: none;
}
.map-overlay .icon { color: var(--accent); width: 22px; height: 22px; margin-bottom: 8px; }
.map-overlay strong { display: block; font-size: 12px; font-weight: 500; }
.map-overlay span { display: block; color: var(--faint); font-size: 10.5px; margin-top: 4px; }
.map-legend {
  position: absolute; z-index: 500; left: 12px; bottom: 12px;
  display: flex; gap: 12px; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 7px;
  background: rgba(7, 16, 22, .88); backdrop-filter: blur(8px);
  font-size: 9.5px; color: var(--muted); pointer-events: none;
}
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.map-legend i { width: 6px; height: 6px; border-radius: 50%; }
.leaflet-container { font-family: var(--font) !important; background: #091115 !important; }
.leaflet-tile-pane { filter: saturate(.82) brightness(.9) contrast(1.04); }
.leaflet-control-zoom a {
  color: var(--text-soft) !important; background: rgba(10, 20, 26, .94) !important;
  border-color: var(--line) !important;
}
.leaflet-control-zoom a:hover { background: #12242e !important; color: #fff !important; }
.leaflet-control-attribution {
  background: rgba(7, 16, 22, .8) !important; color: #60727c !important;
  font-size: 8.5px !important; backdrop-filter: blur(4px);
}
.leaflet-control-attribution a { color: #7f96a5 !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #0c1a22 !important; color: var(--text) !important; border: 1px solid var(--line-strong); box-shadow: var(--shadow) !important; }
.leaflet-popup-content-wrapper { border-radius: 10px !important; }
.leaflet-popup-content { margin: 13px 15px !important; font-size: 11px; line-height: 1.55; min-width: 180px; }
.leaflet-popup-close-button { color: var(--muted) !important; }
.popup-title { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.popup-meta { color: var(--faint); font-family: var(--mono); font-size: 9.5px; margin-bottom: 7px; }
.popup-stats { display: flex; gap: 11px; color: var(--muted); font-size: 10px; border-top: 1px solid var(--line); padding-top: 7px; }
.popup-stats b { color: var(--text-soft); font-weight: 600; }
.map-marker-wrap { background: transparent; border: 0; }
.map-marker {
  display: grid; place-items: center; width: 25px; height: 25px;
  border-radius: 50%; border: 2px solid #081217;
  color: #041712; font-size: 8px; font-weight: 800;
  background: var(--marker, var(--accent));
  box-shadow: 0 0 0 3px rgba(68,227,196,.12), 0 3px 14px rgba(0,0,0,.55);
}
.map-marker.device { border-radius: 7px; }
.map-marker.network { background: var(--blue); box-shadow: 0 0 0 3px rgba(90,168,255,.12), 0 3px 14px rgba(0,0,0,.55); }
.map-marker.random { background: var(--amber); box-shadow: 0 0 0 3px rgba(255,198,90,.12), 0 3px 14px rgba(0,0,0,.55); }
.map-marker.scan { width: 28px; height: 28px; color: #05251f; }
.map-marker .icon { width: 13px; height: 13px; stroke-width: 2.2; }

/* ==========================================================================
   Modal, toast, misc
   ========================================================================== */
.modal {
  width: min(900px, calc(100vw - 32px));
  max-height: min(86vh, 900px);
  padding: 0; border: 0; background: transparent; color: var(--text);
  overflow: visible;
}
.modal::backdrop { background: rgba(2, 7, 10, .72); backdrop-filter: blur(5px); }
.modal-card {
  display: flex; flex-direction: column; max-height: min(86vh, 900px);
  border: 1px solid var(--line-strong); border-radius: 16px;
  background: linear-gradient(155deg, #0d1a22, #071117 70%);
  box-shadow: 0 35px 100px rgba(0,0,0,.6);
  animation: modalIn .22s ease;
  overflow: hidden;
}
.modal.modal-wide { width: min(1100px, calc(100vw - 32px)); }
.modal.modal-narrow { width: min(560px, calc(100vw - 32px)); }
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 22px 24px 17px; border-bottom: 1px solid var(--line);
}
.modal-head h2 { font-size: 20px; letter-spacing: -.03em; font-weight: 600; margin-top: 4px; }
.modal-body { padding: 22px 24px; overflow-y: auto; }
.modal-actions { display: none; padding: 15px 24px; gap: 9px; justify-content: flex-end; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal-actions.visible { display: flex; }
.detail-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.detail-avatar {
  width: 48px; height: 48px; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 12px; border: 1px solid var(--line-strong);
  background: rgba(68,227,196,.07); color: var(--accent);
}
.detail-avatar .icon { width: 23px; height: 23px; }
.detail-hero h3 { font-size: 17px; font-weight: 600; letter-spacing: -.02em; word-break: break-word; }
.detail-hero p { color: var(--muted); font-family: var(--mono); font-size: 11px; margin-top: 3px; }
.detail-hero .badge-row { margin-top: 6px; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 1px; margin-bottom: 22px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--line); }
.detail-metric { background: #0a161d; padding: 12px 14px; }
.detail-metric span { display: block; color: var(--faint); font-size: 9.5px; text-transform: uppercase; letter-spacing: .07em; }
.detail-metric strong { display: block; margin-top: 4px; font-size: 16px; font-weight: 600; letter-spacing: -.02em; }
.detail-metric strong.small { font-size: 12px; word-break: break-word; }
.detail-section { margin-top: 22px; }
.detail-section:first-child { margin-top: 0; }
.detail-section h4 {
  font-size: 10px; text-transform: uppercase; letter-spacing: .11em; color: var(--faint);
  margin-bottom: 9px; display: flex; justify-content: space-between; align-items: center;
}
.detail-section h4 .count { color: var(--muted); font-family: var(--mono); font-size: 9.5px; }
.mini-table { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.mini-row { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 12px; border-top: 1px solid var(--line); font-size: 11px; }
.mini-row:first-child { border-top: 0; background: rgba(255,255,255,.02); color: var(--faint); font-size: 9px; text-transform: uppercase; letter-spacing: .07em; }
.mini-row strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-row .sub { color: var(--faint); font-family: var(--mono); font-size: 9.5px; overflow: hidden; text-overflow: ellipsis; }
.mini-row .right { text-align: right; color: var(--muted); font-size: 10px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 5px; }
.ssid-chip { display: inline-flex; padding: 3px 8px; border: 1px solid var(--line); border-radius: 6px; background: rgba(255,255,255,.025); color: var(--text-soft); font-size: 10px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-box { border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.018); padding: 11px 13px; color: var(--muted); font-size: 11.5px; line-height: 1.65; }
.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.form-group label { display: block; color: var(--text-soft); font-size: 11px; font-weight: 600; margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; min-height: 39px; padding: 9px 11px;
  border: 1px solid var(--line-strong); border-radius: 9px;
  background: rgba(5, 12, 17, .65); color: var(--text);
  outline: none; font-size: 12px; transition: .18s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: rgba(68,227,196,.5); box-shadow: 0 0 0 3px rgba(68,227,196,.06); }
.form-group .hint { color: var(--faint); font-size: 10px; margin-top: 5px; line-height: 1.5; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.callout { display: flex; gap: 10px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.callout .icon { width: 15px; height: 15px; margin-top: 1px; color: var(--amber); }
.callout.danger { border-color: rgba(255,111,131,.24); background: var(--danger-dim); color: #ffb5bf; }
.callout.danger .icon { color: var(--danger); }
.token-reveal {
  display: flex; align-items: center; gap: 10px;
  padding: 14px; margin-top: 14px;
  border: 1px dashed rgba(68,227,196,.35); border-radius: 9px;
  background: rgba(68,227,196,.055);
}
.token-reveal code { flex: 1; color: var(--accent-bright); word-break: break-all; font-size: 12px; }
.modal-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }

.toast-stack { position: fixed; z-index: 200; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 40px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: rgba(10, 22, 29, .97); box-shadow: var(--shadow);
  color: var(--text-soft); font-size: 12px; line-height: 1.5;
  animation: toastIn .22s ease;
}
.toast .icon { width: 16px; height: 16px; margin-top: 1px; color: var(--accent); flex: 0 0 auto; }
.toast.error { border-color: rgba(255,111,131,.35); }
.toast.error .icon { color: var(--danger); }
.toast.removing { opacity: 0; transform: translateY(5px); transition: .2s; }

/* Scanner page */
.scanner-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .8fr); gap: 16px; align-items: start; }
.panel-card { padding: 21px 22px; }
.panel-card h2 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.panel-card > p.desc { color: var(--muted); font-size: 11.5px; line-height: 1.65; margin-bottom: 20px; }
.step-list { display: flex; flex-direction: column; gap: 0; }
.step { display: flex; gap: 13px; padding-bottom: 18px; position: relative; }
.step:last-child { padding-bottom: 0; }
.step::before { content: ""; position: absolute; left: 12px; top: 28px; bottom: 2px; width: 1px; background: var(--line); }
.step:last-child::before { display: none; }
.step-num { width: 25px; height: 25px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid rgba(68,227,196,.25); border-radius: 50%; background: var(--accent-dim); color: var(--accent); font-family: var(--mono); font-size: 9.5px; z-index: 1; }
.step-body { min-width: 0; flex: 1; }
.step-body strong { font-size: 12px; font-weight: 600; display: block; margin: 2px 0 4px; }
.step-body p { color: var(--muted); font-size: 11px; line-height: 1.6; }
.command-box { position: relative; margin-top: 9px; border: 1px solid var(--line); border-radius: 8px; background: #050b0f; overflow: hidden; }
.command-box pre { margin: 0; padding: 12px 44px 12px 13px; overflow-x: auto; color: #b6dfd8; font-family: var(--mono); font-size: 10.5px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.copy-btn { position: absolute; right: 6px; top: 6px; width: 28px; height: 28px; }
.code-inline { color: var(--accent); background: rgba(68,227,196,.08); border: 1px solid rgba(68,227,196,.15); border-radius: 4px; padding: 1px 5px; font-family: var(--mono); font-size: .9em; }
.scanner-output-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.scanner-field { min-width: 0; }
.scanner-field label { display: block; color: var(--faint); font-size: 9.5px; text-transform: uppercase; letter-spacing: .07em; margin-bottom: 5px; }
.scanner-field input { width: 100%; height: 37px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(5,12,17,.6); color: var(--text); outline: none; font-size: 11.5px; }
.scanner-field input:focus { border-color: rgba(68,227,196,.45); }
.scanner-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.scanner-form .full { grid-column: 1 / -1; }
.scanner-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.scanner-tabs { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 9px; background: rgba(5,12,17,.5); margin-bottom: 18px; }
.scanner-tab { flex: 1; height: 32px; border: 0; border-radius: 6px; background: transparent; color: var(--faint); font-size: 11px; font-weight: 600; cursor: pointer; }
.scanner-tab.active { background: rgba(68,227,196,.11); color: var(--accent); }
.role-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 14px; }
.role-card { padding: 13px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.015); }
.role-card strong { font-size: 11px; display: block; margin-bottom: 3px; }
.role-card p { color: var(--faint); font-size: 10px; line-height: 1.55; }
.role-card.admin strong { color: var(--accent); } .role-card.operator strong { color: var(--blue); } .role-card.viewer strong { color: var(--muted); }
.access-note { display: flex; align-items: flex-start; gap: 10px; padding: 13px 15px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.017); color: var(--muted); font-size: 11px; line-height: 1.6; }
.access-note .icon { width: 16px; height: 16px; color: var(--accent); margin-top: 1px; }
.token-role { display: flex; align-items: center; gap: 7px; }

/* Web scanner */
.scan-layout { grid-template-columns: minmax(0, 1.35fr) minmax(320px, .8fr); align-items: start; }
.scan-form { display: flex; flex-direction: column; gap: 15px; }
.scan-form .form-group { margin: 0; }
.scan-form .form-grid { gap: 13px; }
.scan-form .form-grid.two .form-group { min-width: 0; }
.scan-map-label { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.scan-map-label > span:first-child { color: var(--text-soft); font-size: 11px; font-weight: 600; }
.scan-map-hint { color: var(--faint); font-size: 9.5px; }
.scan-map-picker {
  position: relative; height: 250px; border: 1px solid var(--line-strong);
  border-radius: 10px; overflow: hidden; background: #091115; z-index: 1;
}
.scan-map-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.scan-coords { color: var(--faint); font-family: var(--mono); font-size: 9.5px; }
.scan-method-note { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; color: var(--faint); font-size: 10px; min-height: 20px; }
.scan-method-note .badge { font-size: 8.5px; min-height: 18px; }
.scan-run-hint {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px; border: 1px solid rgba(68,227,196,.13); border-radius: 8px;
  background: rgba(68,227,196,.035); color: var(--muted); font-size: 10.5px; line-height: 1.55;
}
.scan-run-hint .icon { width: 14px; height: 14px; color: var(--accent); margin-top: 1px; flex: 0 0 auto; }
.btn-scan-start { height: 48px; margin-top: 2px; font-size: 13px; border-radius: 11px; }
.btn-scan-start .icon { width: 19px; height: 19px; }
.scan-live-card { padding: 20px; min-height: 300px; }
.scan-status-head { display: flex; align-items: center; gap: 12px; margin-bottom: 17px; }
.scan-status-head .eyebrow { margin-bottom: 3px; }
.scan-status-head h2 { font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.scan-status-icon {
  width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center;
  border: 1px solid var(--line-strong); border-radius: 11px;
  background: rgba(255,255,255,.025); color: var(--muted);
}
.scan-status-icon .icon { width: 21px; height: 21px; }
.scan-status-icon.running { color: var(--accent); border-color: rgba(68,227,196,.24); background: var(--accent-dim); }
.scan-status-icon.completed { color: var(--accent); border-color: rgba(68,227,196,.24); background: var(--accent-dim); }
.scan-status-icon.failed { color: var(--danger); border-color: rgba(255,111,131,.24); background: var(--danger-dim); }
.scan-status-icon.cancelled { color: var(--amber); border-color: rgba(255,198,90,.24); background: var(--amber-dim); }
.scan-idle { min-height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px 15px; }
.scan-idle-orb {
  width: 54px; height: 54px; display: grid; place-items: center;
  border: 1px solid rgba(68,227,196,.2); border-radius: 50%;
  background: radial-gradient(circle, rgba(68,227,196,.12), transparent 70%);
  color: var(--accent); margin-bottom: 13px;
}
.scan-idle-orb .icon { width: 23px; height: 23px; }
.scan-idle h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.scan-idle p { max-width: 300px; color: var(--muted); font-size: 11px; line-height: 1.65; }
.scan-job-location { display: flex; align-items: center; gap: 6px; color: var(--text-soft); font-size: 12px; }
.scan-job-location .icon { width: 14px; height: 14px; color: var(--faint); }
.scan-job-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 8px; color: var(--faint); font-size: 10px; }
.scan-job-meta span { display: inline-flex; align-items: center; gap: 4px; }
.scan-job-meta .icon { width: 12px; height: 12px; }
.scan-progress { height: 6px; border-radius: 4px; overflow: hidden; background: rgba(255,255,255,.06); margin-top: 14px; }
.scan-progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #44e3c4, #5aa8ff); box-shadow: 0 0 12px rgba(68,227,196,.3); transition: width .7s ease; }
.scan-progress.indeterminate i { width: 34%; animation: scanSweep 1.7s ease-in-out infinite; }
.scan-progress-label { display: flex; justify-content: space-between; gap: 10px; margin-top: 7px; color: var(--faint); font-size: 10px; }
.scan-progress-label span:first-child { color: var(--muted); }
.scan-live-indicator { display: flex; align-items: center; gap: 8px; margin-top: 13px; color: var(--accent); font-size: 10px; }
.scan-live-indicator .pulse-dot { width: 6px; height: 6px; }
.scan-result-grid.live { margin-top: 13px; }
@keyframes scanSweep { 0% { transform: translateX(-120%); } 100% { transform: translateX(330%); } }
.scan-job-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 17px; }
.scan-result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.scan-result-grid > div { padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.02); text-align: center; }
.scan-result-grid strong { display: block; font-size: 20px; font-weight: 600; letter-spacing: -.03em; }
.scan-result-grid span { display: block; color: var(--faint); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; margin-top: 2px; }
.scan-log { margin-top: 16px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #050c10; }
.scan-log summary { padding: 9px 11px; color: var(--faint); font-size: 10px; cursor: pointer; user-select: none; }
.scan-log summary:hover { color: var(--muted); }
.scan-log pre { max-height: 210px; overflow: auto; margin: 0; padding: 10px 11px; border-top: 1px solid var(--line); color: #91b9b0; font-family: var(--mono); font-size: 9.5px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.scan-equipment-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.scan-equipment-head h2 { margin-bottom: 3px; }
.scan-equipment-head .desc { margin: 0; }
.equipment-list { display: flex; flex-direction: column; gap: 1px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--line); }
.equipment-row { display: flex; align-items: center; gap: 10px; padding: 10px 11px; background: #0a161d; }
.equipment-icon { width: 27px; height: 27px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 7px; }
.equipment-icon.online { color: var(--accent); border-color: rgba(68,227,196,.18); background: var(--accent-dim); }
.equipment-icon.offline { color: var(--faint); }
.equipment-icon .icon { width: 14px; height: 14px; }
.equipment-main { min-width: 0; flex: 1; }
.equipment-main strong { display: block; font-size: 11px; font-weight: 500; }
.equipment-main span { display: block; color: var(--faint); font-size: 9.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scan-equipment-section { margin-top: 12px; }
.form-label { display: block; color: var(--faint); font-size: 9px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 6px; }
.scan-equipment-hint { margin-top: 10px; color: var(--faint); font-size: 10px; line-height: 1.6; }
.prepare-monitor { margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line); }
.prepare-monitor p { color: var(--faint); font-size: 10px; line-height: 1.6; margin-bottom: 8px; }
.scan-tips h2 { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.scan-tip { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.scan-tip:first-of-type { border-top: 0; }
.scan-tip > span { color: var(--accent); font-family: var(--mono); font-size: 9px; padding-top: 2px; }
.scan-tip p { color: var(--muted); font-size: 10.5px; line-height: 1.55; }
.scan-privacy { display: flex; gap: 7px; align-items: flex-start; margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--faint); font-size: 9.5px; line-height: 1.55; }
.scan-privacy .icon { width: 13px; height: 13px; color: var(--accent); margin-top: 1px; }

/* Exchange / backup */
.exchange-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.exchange-card { padding: 24px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.exchange-head { display: flex; align-items: center; gap: 12px; }
.exchange-head h2 { font-size: 19px; letter-spacing: -.03em; font-weight: 600; margin-top: 3px; }
.exchange-head .badge { margin-left: auto; align-self: flex-start; }
.exchange-icon {
  width: 44px; height: 44px; flex: 0 0 auto; display: grid; place-items: center;
  border: 1px solid rgba(68,227,196,.22); border-radius: 11px;
  background: var(--accent-dim); color: var(--accent);
}
.exchange-icon.import { border-color: rgba(90,168,255,.22); background: var(--blue-dim); color: var(--blue); }
.exchange-icon .icon { width: 21px; height: 21px; }
.exchange-desc { color: var(--muted); font-size: 11.5px; line-height: 1.65; }
.exchange-stats { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--line); gap: 1px; }
.exchange-stats > div { background: #0a161d; padding: 11px 8px; text-align: center; }
.exchange-stats strong { display: block; font-size: 19px; font-weight: 600; letter-spacing: -.03em; }
.exchange-stats span { color: var(--faint); font-size: 8.5px; text-transform: uppercase; letter-spacing: .07em; }
.exchange-includes { display: flex; flex-direction: column; gap: 6px; }
.exchange-includes span { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10.5px; }
.exchange-includes .icon { width: 12px; height: 12px; color: var(--accent); }
.exchange-action { margin-top: auto; height: 42px; justify-content: center; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  min-height: 170px; padding: 20px; text-align: center;
  border: 1px dashed rgba(135,177,196,.28); border-radius: 11px;
  background: rgba(255,255,255,.015); color: var(--muted);
  cursor: pointer; transition: .18s ease;
}
.dropzone:hover, .dropzone.dragover { border-color: rgba(68,227,196,.6); background: rgba(68,227,196,.045); }
.dropzone-icon {
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 50%; background: rgba(68,227,196,.08); color: var(--accent); margin-bottom: 4px;
}
.dropzone-icon .icon { width: 20px; height: 20px; }
.dropzone strong { color: var(--text-soft); font-size: 12px; font-weight: 500; }
.dropzone span { color: var(--faint); font-size: 10.5px; }
.dropzone small { color: var(--faint); font-size: 9px; margin-top: 5px; }
.import-file {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid rgba(90,168,255,.25); border-radius: 9px;
  background: var(--blue-dim);
}
.import-file-icon { color: var(--blue); display: grid; place-items: center; }
.import-file-icon .icon { width: 17px; height: 17px; }
.import-file > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.import-file strong { font-size: 11px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-file span { color: var(--faint); font-size: 9.5px; }
.exchange-foot { display: flex; justify-content: space-between; gap: 15px; flex-wrap: wrap; margin-top: 16px; color: var(--faint); font-size: 9.5px; }
.import-result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.import-result-grid > div { padding: 12px 9px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.02); text-align: center; }
.import-result-grid strong { display: block; font-size: 22px; font-weight: 600; letter-spacing: -.03em; }
.import-result-grid span { display: block; color: var(--faint); font-size: 8.5px; line-height: 1.4; margin-top: 3px; }
@media (max-width: 980px) {
  .exchange-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .exchange-stats { grid-template-columns: repeat(2, 1fr); }
  .import-result-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Detail list */
.timeline-list { position: relative; margin-left: 6px; padding-left: 17px; border-left: 1px solid var(--line); }
.timeline-item { position: relative; padding: 0 0 15px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before { content: ""; position: absolute; left: -20.5px; top: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(68,227,196,.09); }
.timeline-item .t-time { color: var(--faint); font-size: 9.5px; font-family: var(--mono); }
.timeline-item .t-main { font-size: 11.5px; margin-top: 2px; }
.timeline-item .t-sub { color: var(--muted); font-size: 10px; margin-top: 2px; }
.filter-tabs { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.015); }
.filter-tab { height: 29px; padding: 0 11px; border: 0; border-radius: 5px; background: transparent; color: var(--faint); font-size: 10.5px; cursor: pointer; }
.filter-tab.active { background: rgba(68,227,196,.11); color: var(--accent); }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 70px 20px; text-align: center; }
.empty-state .empty-icon { width: 56px; height: 56px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 14px; color: var(--faint); background: rgba(255,255,255,.02); margin-bottom: 16px; }
.empty-state .empty-icon .icon { width: 24px; height: 24px; }
.empty-state h2 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.empty-state p { color: var(--muted); font-size: 12px; max-width: 440px; line-height: 1.65; }
.empty-state .btn { margin-top: 18px; }

/* Utility */
.stack { display: flex; flex-direction: column; gap: 14px; }
.flex { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.mt-3 { margin-top: 14px; } .mt-4 { margin-top: 20px; } .mb-3 { margin-bottom: 14px; }
.hidden { display: none !important; }
.narrow-page { max-width: 900px; margin: 0 auto; }

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(126, 160, 176, .18); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(126, 160, 176, .3); background-clip: content-box; border: 2px solid transparent; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1240px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-visual { padding: 34px 36px; }
}
@media (max-width: 1100px) {
  .scan-layout { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  :root { --topbar-h: 80px; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-102%);
    transition: transform .22s ease;
    width: 276px; flex-basis: 276px;
    background: #081218; box-shadow: 30px 0 80px rgba(0,0,0,.5);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .nav-scrim { position: fixed; inset: 0; z-index: 35; background: rgba(1,5,8,.65); opacity: 0; pointer-events: none; transition: .2s; }
  body.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }
  .sidebar-close { display: inline-grid; }
  .mobile-menu { display: inline-grid; margin-left: -8px; }
  .workspace { width: 100%; }
  .map-layout { grid-template-columns: 300px minmax(0, 1fr); }
  .login-view { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-panel { min-height: 100vh; background: radial-gradient(700px 500px at 70% 10%, rgba(37,158,143,.1), transparent 70%), var(--bg); }
  .mobile-brand { display: flex; }
  .login-foot { margin-top: auto; }
}
@media (max-width: 760px) {
  .page { padding: 20px 16px 44px; }
  .topbar { padding: 0 16px; gap: 10px; }
  .page-title { font-size: 20px; }
  .page-actions { gap: 5px; }
  .page-actions .btn span { display: none; }
  .page-actions .btn { width: 36px; padding: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat-card { min-height: 118px; padding: 14px 14px 13px; }
  .stat-value { font-size: 27px; }
  .stat-icon { width: 28px; height: 28px; }
  .mini-stats { grid-template-columns: 1fr; gap: 8px; }
  .mini-stat { padding: 10px 13px; }
  .grid-3, .grid-equal { grid-template-columns: 1fr; }
  .chart-card { padding: 15px; }
  .chart-wrap { height: 220px; }
  .section-head { margin-bottom: 11px; }
  .toolbar .search-field { max-width: none; flex-basis: 100%; }
  .toolbar-right { width: 100%; margin-left: 0; justify-content: flex-end; }
  .map-layout { display: flex; flex-direction: column; height: auto; min-height: 0; }
  .map-panel { order: 2; border-right: 0; border-top: 1px solid var(--line); }
  .map-canvas-wrap { order: 1; height: 420px; min-height: 420px; }
  .map-results { max-height: 300px; flex: none; }
  .map-panel-head p { display: none; }
  .modal { width: calc(100vw - 18px); max-height: 92vh; }
  .modal.modal-wide, .modal.modal-narrow { width: calc(100vw - 18px); }
  .modal-head { padding: 17px 17px 13px; }
  .modal-head h2 { font-size: 17px; }
  .modal-body { padding: 17px; }
  .modal-actions { padding: 12px 17px; }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
  .scanner-layout, .scanner-output-grid, .scanner-form, .form-grid.two { grid-template-columns: 1fr; }
  .scanner-form .full { grid-column: auto; }
  .scan-map-picker { height: 215px; }
  .scan-live-card { padding: 16px; }
  .scan-result-grid strong { font-size: 17px; }
  .role-grid { grid-template-columns: 1fr; }
  .login-panel { padding: 26px 22px 18px; }
  .login-box h2 { font-size: 30px; }
  .login-hint { display: none; }
  .page-actions .select { max-width: 110px; }
  .table-scroll { -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 680px; }
  .pagination { padding: 11px; }
}
@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { min-height: 108px; }
  .mini-stats { grid-template-columns: 1fr; }
  .page-actions .select { max-width: 98px; font-size: 10px; }
}

/* Animations */
@keyframes sweep { to { transform: rotate(360deg); } }
@keyframes ping { 0% { transform: scale(.5); opacity: .8; } 75%, 100% { transform: scale(1.7); opacity: 0; } }
@keyframes pulse { 0%,100% { opacity: .55; transform: scale(.96); } 50% { opacity: 1; transform: scale(1.04); } }
@keyframes softPulse { 0%,100% { box-shadow: 0 0 0 4px rgba(68,227,196,.07), 0 0 8px rgba(68,227,196,.35); } 50% { box-shadow: 0 0 0 5px rgba(68,227,196,.12), 0 0 16px rgba(68,227,196,.6); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { 100% { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
