*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d0f17;
  --bg2: #13151f;
  --bg3: #1a1d2e;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --text: #e2e8f0;
  --text2: #94a3b8;
  --text3: #64748b;
  --accent: #6366f1;
  --accent2: #8b5cf6;
  --accent-glow: rgba(99,102,241,0.25);
  --green: #10b981;
  --yellow: #f59e0b;
  --red: #ef4444;
  --red-dim: rgba(239,68,68,0.12);
  --yellow-dim: rgba(245,158,11,0.12);
  --green-dim: rgba(16,185,129,0.12);
  --radius: 12px;
  --radius-sm: 8px;
}

html, body { height: 100%; font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }

/* ── Setup Screen ── */
.setup-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at 50% 0%, rgba(99,102,241,0.15) 0%, transparent 70%); padding: 24px; }
.setup-card { background: var(--bg2); border: 1px solid var(--border2); border-radius: 20px; padding: 40px; width: 100%; max-width: 440px; box-shadow: 0 24px 64px rgba(0,0,0,0.5); }
.setup-logo { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 28px; }
.setup-card h1 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.setup-desc { color: var(--text2); margin-bottom: 28px; font-size: 13px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.form-group input, .form-group select { width: 100%; background: var(--bg3); border: 1px solid var(--border2); border-radius: var(--radius-sm); padding: 11px 14px; color: var(--text); font-size: 14px; font-family: inherit; transition: border-color 0.2s; outline: none; }
.form-group input:focus, .form-group select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-group select { cursor: pointer; appearance: none; background-image: 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='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.hint { font-size: 11px; color: var(--text3); margin-top: 4px; display: block; }
.input-with-toggle { position: relative; }
.input-with-toggle input { padding-right: 44px; }
.toggle-vis { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text3); cursor: pointer; padding: 4px; display: flex; align-items: center; transition: color 0.2s; }
.toggle-vis:hover { color: var(--text); }
.btn-connect { width: 100%; background: linear-gradient(135deg, var(--accent), var(--accent2)); border: none; border-radius: var(--radius-sm); padding: 13px; color: white; font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 8px; }
.btn-connect:hover { transform: translateY(-1px); box-shadow: 0 8px 24px var(--accent-glow); }
.btn-connect:active { transform: translateY(0); }
.setup-error { background: var(--red-dim); border: 1px solid rgba(239,68,68,0.3); border-radius: var(--radius-sm); padding: 10px 14px; color: #fca5a5; font-size: 13px; margin-bottom: 12px; }
.setup-note { display: flex; align-items: center; gap: 6px; color: var(--text3); font-size: 12px; margin-top: 16px; justify-content: center; }
.btn-diag { width: 100%; background: transparent; border: 1px dashed var(--border2); border-radius: var(--radius-sm); padding: 9px; color: var(--text3); font-size: 12px; cursor: pointer; transition: all 0.15s; margin-top: 8px; font-family: inherit; }
.btn-diag:hover { border-color: var(--accent); color: var(--accent); }
.diag-output { background: var(--bg); border: 1px solid var(--border2); border-radius: var(--radius-sm); padding: 12px; font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--green); margin-top: 10px; max-height: 200px; overflow-y: auto; white-space: pre-wrap; word-break: break-all; }

/* ── Main App Layout ── */
.main-app { display: flex; height: 100vh; overflow: hidden; }
.hidden { display: none !important; }

/* ── Sidebar ── */
.sidebar { width: 230px; background: var(--bg2); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 20px 12px; flex-shrink: 0; }
.sidebar-logo { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; padding: 6px 10px; margin-bottom: 24px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: none; background: none; color: var(--text2); font-size: 13.5px; font-weight: 500; cursor: pointer; border-radius: var(--radius-sm); transition: all 0.15s; text-align: left; position: relative; font-family: inherit; }
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(139,92,246,0.1)); color: var(--accent); border: 1px solid rgba(99,102,241,0.2); }
.nav-item .badge { margin-left: auto; background: var(--red); color: white; border-radius: 20px; padding: 1px 7px; font-size: 11px; font-weight: 700; }
.sidebar-bottom { border-top: 1px solid var(--border); padding-top: 16px; }
.status-indicator { display: flex; align-items: center; gap: 8px; padding: 6px 10px; font-size: 12px; color: var(--text2); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 2s infinite; }
.status-dot.error { background: var(--red); box-shadow: 0 0 8px var(--red); animation: none; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }
.last-update { font-size: 11px; color: var(--text3); padding: 2px 10px 10px; }
.btn-logout { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 12px; background: none; border: none; color: var(--text3); font-size: 13px; cursor: pointer; border-radius: var(--radius-sm); transition: all 0.15s; font-family: inherit; }
.btn-logout:hover { background: var(--red-dim); color: var(--red); }

/* ── Content ── */
.content { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.content::-webkit-scrollbar { width: 6px; }
.content::-webkit-scrollbar-track { background: transparent; }
.content::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ── Topbar ── */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 18px 28px; border-bottom: 1px solid var(--border); background: var(--bg); position: sticky; top: 0; z-index: 10; }
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-left h2 { font-size: 18px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.refresh-badge { display: flex; align-items: center; gap: 6px; background: var(--green-dim); border: 1px solid rgba(16,185,129,0.25); border-radius: 20px; padding: 4px 12px; font-size: 12px; color: var(--green); }
.pulse-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: pulse 1.5s infinite; }
.search-box { display: flex; align-items: center; gap: 8px; background: var(--bg2); border: 1px solid var(--border2); border-radius: var(--radius-sm); padding: 8px 12px; }
.search-box svg { color: var(--text3); flex-shrink: 0; }
.search-box input { background: none; border: none; outline: none; color: var(--text); font-size: 13px; font-family: inherit; width: 180px; }
.search-box input::placeholder { color: var(--text3); }
.btn-refresh { display: flex; align-items: center; gap: 7px; background: var(--bg2); border: 1px solid var(--border2); border-radius: var(--radius-sm); padding: 8px 14px; color: var(--text2); font-size: 13px; cursor: pointer; transition: all 0.15s; font-family: inherit; }
.btn-refresh:hover { border-color: var(--accent); color: var(--accent); }
.btn-refresh.spinning svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Tab Content ── */
.tab-content { display: none; padding: 24px 28px; flex: 1; }
.tab-content.active { display: block; }

/* ── Stats Grid ── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: flex; align-items: center; gap: 16px; transition: border-color 0.2s, transform 0.2s; }
.stat-card:hover { border-color: var(--border2); transform: translateY(-1px); }
.danger-card { border-color: rgba(239,68,68,0.2); background: linear-gradient(135deg, var(--bg2), rgba(239,68,68,0.05)); }
.stat-icon { width: 46px; height: 46px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.users-icon { background: rgba(99,102,241,0.15); color: var(--accent); }
.active-icon { background: rgba(16,185,129,0.15); color: var(--green); }
.hwid-icon { background: rgba(245,158,11,0.15); color: var(--yellow); }
.suspect-icon { background: rgba(239,68,68,0.15); color: var(--red); }
.stat-value { font-size: 26px; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 12px; color: var(--text2); }

/* ── Panel Sections ── */
.panel-section { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 20px; overflow: hidden; }
.section-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.section-header h3 { font-size: 14px; font-weight: 600; }
.section-badge { background: var(--bg3); border: 1px solid var(--border); border-radius: 20px; padding: 2px 10px; font-size: 12px; color: var(--text2); }
.btn-sm { background: none; border: none; color: var(--accent); font-size: 13px; cursor: pointer; font-family: inherit; }
.btn-icon { width: 30px; height: 30px; border: 1px solid var(--border2); background: var(--bg3); color: var(--text2); border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.15s; }
.btn-icon:hover { border-color: var(--accent); color: var(--accent); }

/* ── Top HWID List ── */
.top-hwid-list { padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.top-hwid-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--bg3); border-radius: var(--radius-sm); border: 1px solid transparent; transition: all 0.15s; }
.top-hwid-item:hover { border-color: var(--border2); }
.rank-badge { width: 26px; height: 26px; border-radius: 6px; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--text3); flex-shrink: 0; }
.rank-badge.rank-1 { background: rgba(245,158,11,0.2); color: var(--yellow); }
.rank-badge.rank-2 { background: rgba(99,102,241,0.15); color: var(--accent); }
.rank-badge.rank-3 { background: rgba(16,185,129,0.12); color: var(--green); }
.user-name { font-weight: 600; font-size: 13px; flex: 1; }
.hwid-bar-wrap { flex: 2; display: flex; align-items: center; gap: 8px; }
.hwid-bar-bg { flex: 1; height: 4px; background: var(--bg); border-radius: 2px; overflow: hidden; }
.hwid-bar-fill { height: 100%; border-radius: 2px; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width 0.6s ease; }
.hwid-count-badge { font-size: 12px; font-weight: 700; color: var(--text); background: var(--bg); border-radius: 6px; padding: 2px 8px; border: 1px solid var(--border2); }
.hwid-count-badge.warn { color: var(--yellow); border-color: rgba(245,158,11,0.3); }
.hwid-count-badge.danger { color: var(--red); border-color: rgba(239,68,68,0.3); }

/* ── Sessions Grid ── */
.sessions-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.filter-chips { display: flex; gap: 6px; }
.chip { background: var(--bg2); border: 1px solid var(--border2); border-radius: 20px; padding: 5px 14px; color: var(--text2); font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.15s; font-family: inherit; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: rgba(99,102,241,0.15); border-color: rgba(99,102,241,0.4); color: var(--accent); }
.sort-select { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text2); }
.sort-select select { background: var(--bg2); border: 1px solid var(--border2); border-radius: var(--radius-sm); padding: 5px 10px; color: var(--text); font-size: 13px; outline: none; cursor: pointer; font-family: inherit; }
.sessions-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.session-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s; display: flex; flex-direction: column; gap: 12px; }
.session-card:hover { border-color: var(--border2); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.25); }
.session-card.suspicious { border-color: rgba(239,68,68,0.35); background: linear-gradient(135deg, var(--bg2), rgba(239,68,68,0.04)); }
.session-card.observation { border-color: rgba(245,158,11,0.3); background: linear-gradient(135deg, var(--bg2), rgba(245,158,11,0.03)); }
.session-card-top { display: flex; align-items: center; gap: 12px; }
.session-card-top .user-avatar { width: 40px; height: 40px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--accent2)); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; color: white; flex-shrink: 0; }
.session-card.suspicious .user-avatar { background: linear-gradient(135deg, #ef4444, #dc2626); }
.session-card.observation .user-avatar { background: linear-gradient(135deg, #f59e0b, #d97706); }
.session-card-info { flex: 1; min-width: 0; }
.session-card-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-card-sub { font-size: 11px; color: var(--text3); margin-top: 2px; }
.session-card-btn { width: 30px; height: 30px; border: 1px solid var(--border2); background: var(--bg3); color: var(--text2); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.15s; flex-shrink: 0; }
.session-card-btn:hover { border-color: var(--accent); color: var(--accent); }
.session-card-metrics { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.session-metric { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; text-align: center; }
.session-metric-val { font-size: 18px; font-weight: 800; line-height: 1.2; }
.session-metric-lbl { font-size: 10px; color: var(--text3); font-weight: 600; margin-top: 2px; }
.session-metric-val.warn { color: var(--yellow); }
.session-metric-val.danger { color: var(--red); }
.session-card-ips { display: flex; flex-wrap: wrap; gap: 5px; }
.session-ip-pill { display: inline-flex; align-items: center; gap: 4px; background: var(--bg3); border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; font-size: 11px; font-family: 'JetBrains Mono', monospace; color: var(--text2); }
.session-ip-pill .ip-geo { font-family: 'Inter', sans-serif; font-size: 9px; color: var(--text3); }
.session-card-risk { display: flex; align-items: center; gap: 8px; }
.risk-pill { display: inline-flex; align-items: center; gap: 4px; border-radius: 20px; padding: 3px 10px; font-size: 11px; font-weight: 700; }
.risk-pill.risk-high { background: var(--red-dim); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.risk-pill.risk-medium { background: var(--yellow-dim); border: 1px solid rgba(245,158,11,0.25); color: #fcd34d; }
.risk-pill.risk-low { background: rgba(100,116,139,0.1); border: 1px solid rgba(100,116,139,0.2); color: var(--text3); }
.suspect-tag { background: var(--red-dim); border: 1px solid rgba(239,68,68,0.3); border-radius: 20px; padding: 3px 10px; font-size: 11px; font-weight: 700; color: #fca5a5; }
.expand-arrow { transition: transform 0.2s; color: var(--text3); }
.expand-arrow.open { transform: rotate(180deg); }

/* ── HWID List ── */
.hwid-search-bar { margin-bottom: 16px; }
.hwid-search-bar input { width: 100%; background: var(--bg2); border: 1px solid var(--border2); border-radius: var(--radius-sm); padding: 10px 14px; color: var(--text); font-size: 14px; outline: none; font-family: inherit; transition: border-color 0.2s; }
.hwid-search-bar input:focus { border-color: var(--accent); }
.hwid-list { display: flex; flex-direction: column; gap: 10px; }
.hwid-user-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.hwid-user-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; cursor: pointer; }
.hwid-devices-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; padding: 0 18px 14px; }
.device-card { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; }
.device-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 9px; }
.device-kind { width: 32px; height: 32px; border-radius: 8px; background: rgba(59,130,246,0.12); color: #93c5fd; display: flex; align-items: center; justify-content: center; flex-shrink: 0; border: 1px solid rgba(59,130,246,0.18); }
.device-kind-tablet { background: rgba(20,184,166,0.12); color: #5eead4; border-color: rgba(20,184,166,0.2); }
.device-kind-unknown { background: rgba(148,163,184,0.1); color: var(--text2); border-color: rgba(148,163,184,0.16); }
.device-main { min-width: 0; }
.device-os { font-weight: 700; font-size: 13px; line-height: 1.25; color: var(--text); overflow-wrap: anywhere; }
.device-model { font-size: 12px; color: var(--text2); margin-top: 3px; }
.device-hwid { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--text3); word-break: break-all; background: rgba(15,23,42,0.45); border: 1px solid rgba(148,163,184,0.08); border-radius: 6px; padding: 5px 7px; margin-bottom: 7px; }
.device-date { font-size: 11px; color: var(--text3); }

/* ── Suspects ── */
.suspects-info { background: var(--yellow-dim); border: 1px solid rgba(245,158,11,0.25); border-radius: var(--radius-sm); padding: 10px 16px; font-size: 12px; color: #fcd34d; display: flex; align-items: flex-start; gap: 8px; margin-bottom: 16px; line-height: 1.5; }
.suspects-list { display: flex; flex-direction: column; gap: 12px; }
.suspect-card { background: var(--bg2); border: 1px solid rgba(239,68,68,0.3); border-radius: var(--radius); padding: 18px; }
.suspect-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.suspect-username { font-weight: 700; font-size: 15px; }
.suspect-reasons { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.reason-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text2); }
.reason-item svg { color: var(--red); flex-shrink: 0; }
.streak-badge { background: rgba(245,158,11,0.15); border: 1px solid rgba(245,158,11,0.3); border-radius: 20px; padding: 2px 10px; font-size: 11px; color: var(--yellow); font-weight: 600; }
.snaps-warning { font-size: 11px; color: var(--text3); background: var(--bg3); border-radius: 6px; padding: 5px 10px; margin-bottom: 4px; }
.snaps-ok { font-size: 11px; color: var(--green); background: var(--green-dim); border-radius: 6px; padding: 5px 10px; margin-bottom: 4px; }
.lastseen { font-size: 10px; border-radius: 4px; padding: 1px 5px; margin-left: 5px; font-weight: 600; }
.lastseen-hot  { background: rgba(239,68,68,0.2);   color: #fca5a5; }
.lastseen-warm { background: rgba(245,158,11,0.15); color: var(--yellow); }
.lastseen-cold { background: rgba(100,116,139,0.15); color: var(--text3); }
.lastseen-dead { background: transparent; color: var(--text3); opacity: 0.6; }
.ip-unstable { opacity: 0.5; border-style: dashed; }
.ip-stale { opacity: 0.55; border-style: dashed; }
.ip-fresh { border-color: rgba(16,185,129,0.25); }
.mini-pill { font-size: 11px; color: var(--text2); background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 2px 6px; margin-left: 3px; }

/* ── User Modal ── */
.modal-backdrop { position: fixed; inset: 0; z-index: 900; background: rgba(3,5,12,0.72); display: flex; justify-content: flex-end; backdrop-filter: blur(3px); }
.user-modal { width: min(920px, 100vw); height: 100vh; background: var(--bg); border-left: 1px solid var(--border2); box-shadow: -24px 0 70px rgba(0,0,0,0.52); overflow-y: auto; }
.user-card { padding: 0; }
.user-card-header { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 24px 28px; border-bottom: 1px solid var(--border); background: rgba(13,15,23,0.96); backdrop-filter: blur(12px); }
.user-card-heading { display: flex; align-items: center; gap: 14px; min-width: 0; }
.user-card-title { font-size: 22px; font-weight: 800; line-height: 1.2; }
.user-card-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--text3); margin-top: 5px; word-break: break-all; }
.user-card-id { font-family: 'JetBrains Mono', monospace; color: var(--text3); font-size: 12px; }
.danger-avatar { background: linear-gradient(135deg,#ef4444,#dc2626); }
.warning-avatar { background: linear-gradient(135deg,#f59e0b,#d97706); }
.modal-close { width: 38px; height: 38px; border: 1px solid var(--border2); background: var(--bg2); color: var(--text2); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.modal-close:hover { color: var(--red); border-color: rgba(239,68,68,0.35); }
.user-summary-strip { margin: 20px 28px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--green-dim); border: 1px solid rgba(16,185,129,0.24); color: var(--green); border-radius: var(--radius-sm); padding: 12px 16px; font-size: 14px; font-weight: 700; }
.user-summary-strip.is-suspect { background: var(--red-dim); border-color: rgba(239,68,68,0.28); color: #fca5a5; }
.user-summary-strip.is-watch { background: var(--yellow-dim); border-color: rgba(245,158,11,0.25); color: #fcd34d; }
.profile-status { border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 800; }
.profile-status.status-ok { color: var(--green); background: var(--green-dim); border: 1px solid rgba(16,185,129,0.24); }
.profile-status.status-muted { color: var(--text2); background: var(--bg3); border: 1px solid var(--border); }
.detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 28px 14px; }
.secondary-details { margin-bottom: 20px; }
.detail-tile { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; min-width: 0; }
.detail-tile.detail-ok { border-color: rgba(16,185,129,0.16); }
.detail-tile.detail-warn { border-color: rgba(245,158,11,0.28); background: linear-gradient(135deg, var(--bg2), rgba(245,158,11,0.05)); }
.detail-tile.detail-danger { border-color: rgba(239,68,68,0.32); background: linear-gradient(135deg, var(--bg2), rgba(239,68,68,0.06)); }
.detail-tile.detail-muted { opacity: 0.88; }
.detail-label { font-size: 12px; color: var(--text3); font-weight: 600; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.03em; }
.detail-value { font-size: 20px; font-weight: 800; color: var(--text); overflow-wrap: anywhere; line-height: 1.2; }
.detail-section { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin: 0 28px 14px; }
.detail-section-title { display: flex; align-items: center; justify-content: space-between; font-size: 15px; font-weight: 800; margin-bottom: 14px; }
.detail-section-title span { color: var(--text3); font-size: 13px; font-weight: 700; background: var(--bg3); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; }
.detail-empty { color: var(--text3); font-size: 13px; padding: 4px 0; }
.device-detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.ip-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.ip-tag { display: flex; align-items: center; gap: 6px; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 12px; font-size: 13px; font-family: 'JetBrains Mono', monospace; }
.lastseen { font-size: 11px; border-radius: 4px; padding: 2px 6px; margin-left: 5px; font-weight: 600; }
.raw-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
.raw-fields div { display: grid; grid-template-columns: minmax(120px, 0.42fr) minmax(0, 1fr); gap: 8px; align-items: start; font-size: 13px; }
.raw-fields span { color: var(--text3); overflow-wrap: anywhere; font-weight: 500; }
.raw-fields code { color: var(--text); font-family: 'JetBrains Mono', monospace; background: var(--bg3); border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; overflow-wrap: anywhere; font-size: 12px; }
.leak-risk { overflow: hidden; }
.risk-meter { height: 10px; background: var(--bg3); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin-bottom: 14px; }
.risk-meter-fill { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--green), var(--yellow), var(--red)); transition: width 0.25s ease; }
.risk-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.risk-summary div { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; min-width: 0; }
.risk-summary span { display: block; color: var(--text3); font-size: 11px; font-weight: 600; margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.03em; }
.risk-summary b { font-size: 18px; }
.risk-reasons { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.risk-reasons span { background: rgba(148,163,184,0.08); border: 1px solid rgba(148,163,184,0.14); border-radius: 999px; padding: 5px 12px; font-size: 13px; color: var(--text2); }
.leak-risk-high .risk-reasons span { background: var(--red-dim); border-color: rgba(239,68,68,0.24); color: #fca5a5; }
.leak-risk-medium .risk-reasons span,
.leak-risk-low .risk-reasons span { background: var(--yellow-dim); border-color: rgba(245,158,11,0.22); color: #fcd34d; }
.risk-muted { color: var(--text3); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }

@media (max-width: 860px) {
  .modal-backdrop { justify-content: center; }
  .user-modal { width: 100vw; }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .risk-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .raw-fields { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .user-card-header { padding: 16px; }
  .user-summary-strip, .detail-grid, .detail-section { margin-left: 16px; margin-right: 16px; }
  .detail-grid { grid-template-columns: 1fr; }
  .user-card-title { font-size: 17px; }
}

/* ── Helpers ── */
.loading-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px; color: var(--text3); gap: 16px; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 50px; color: var(--text3); gap: 12px; font-size: 13px; }
.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin 0.7s linear infinite; }
.spinner-large { width: 36px; height: 36px; border: 3px solid var(--border2); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
.skeleton-list { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.skeleton-item { height: 44px; background: linear-gradient(90deg, var(--bg3) 25%, var(--bg2) 50%, var(--bg3) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
.expand-arrow { transition: transform 0.2s; color: var(--text3); }
.expand-arrow.open { transform: rotate(180deg); }

/* ── Toast ── */
.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; }
.toast { background: var(--bg2); border: 1px solid var(--border2); border-radius: var(--radius-sm); padding: 12px 18px; font-size: 13px; display: flex; align-items: center; gap: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.4); animation: slideIn 0.3s ease; }
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.warning { border-left: 3px solid var(--yellow); }
@keyframes slideIn { from{transform:translateX(20px);opacity:0} to{transform:translateX(0);opacity:1} }
