* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #0a0e1a; color: #e2e8f0; }

.sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 220px; background: #0f1629; border-right: 1px solid #1e293b; padding: 20px 0; overflow-y: auto; display: flex; flex-direction: column; }
.sidebar .logo { padding: 0 20px 24px; font-size: 18px; font-weight: 700; color: #38bdf8; display: flex; align-items: center; gap: 10px; }
.sidebar .logo svg { width: 28px; height: 28px; }
.sidebar .nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 20px; color: #94a3b8; font-size: 14px; cursor: pointer; transition: all 0.15s; border-left: 3px solid transparent; }
.sidebar .nav-item:hover { background: #1e293b; color: #e2e8f0; }
.sidebar .nav-item.active { background: #1e293b; color: #38bdf8; border-left-color: #38bdf8; }
.sidebar .nav-item svg { width: 18px; height: 18px; opacity: 0.7; }
.sidebar .section-label { padding: 16px 20px 6px; font-size: 11px; font-weight: 600; color: #475569; text-transform: uppercase; letter-spacing: 1px; }

.main { margin-left: 220px; padding: 24px 32px; min-height: 100vh; }
.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }
.header h1 { font-size: 22px; font-weight: 600; }
.header .status-badge { display: flex; align-items: center; gap: 6px; background: #16a34a15; color: #22c55e; padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 500; }
.header .status-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: linear-gradient(135deg, #131b2e 0%, #0f1629 100%); border: 1px solid #1e293b; border-radius: 12px; padding: 20px; }
.stat-card .stat-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.stat-card .stat-num { font-size: 28px; font-weight: 700; color: #f8fafc; }
.stat-card .stat-label { font-size: 13px; color: #64748b; margin-top: 2px; }

.page { display: none; }
.page.active { display: block; }

.card { background: #0f1629; border: 1px solid #1e293b; border-radius: 12px; margin-bottom: 20px; overflow: hidden; }
.card-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid #1e293b; }
.card-header h2 { font-size: 15px; font-weight: 600; }
.card-header .badge { background: #38bdf815; color: #38bdf8; padding: 3px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 10px 16px; font-size: 11px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 0.5px; background: #0a0e1a; }
td { padding: 12px 16px; font-size: 13px; border-top: 1px solid #1e293b; }
tr:hover td { background: #131b2e; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.tag-green { background: #16a34a20; color: #22c55e; }
.tag-blue { background: #3b82f620; color: #60a5fa; }
.tag-yellow { background: #f59e0b20; color: #fbbf24; }
.tag-red { background: #ef444420; color: #f87171; }
.tag-purple { background: #a855f720; color: #c084fc; }

.empty-state { text-align: center; padding: 48px 20px; color: #475569; }
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.3; }
.empty-state p { font-size: 14px; }

.test-panel { background: #0f1629; border: 1px solid #1e293b; border-radius: 12px; padding: 20px; margin-bottom: 20px; }
.test-panel h2 { font-size: 15px; font-weight: 600; margin-bottom: 16px; }
.input-row { display: flex; gap: 10px; margin-bottom: 12px; }
.input-row input { flex: 1; background: #0a0e1a; border: 1px solid #1e293b; color: #e2e8f0; padding: 8px 14px; border-radius: 8px; font-size: 14px; outline: none; }
.input-row input:focus { border-color: #38bdf8; }
.btn { background: #38bdf8; color: #0a0e1a; border: none; padding: 8px 18px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; transition: background 0.15s; }
.btn:hover { background: #7dd3fc; }
.btn-outline { background: transparent; border: 1px solid #334155; color: #94a3b8; }
.btn-outline:hover { border-color: #38bdf8; color: #38bdf8; background: transparent; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
#output { background: #0a0e1a; border: 1px solid #1e293b; border-radius: 8px; padding: 14px; margin-top: 12px; font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px; white-space: pre-wrap; max-height: 280px; overflow-y: auto; display: none; color: #94a3b8; }

.loading { text-align: center; padding: 40px; color: #475569; }
.spinner { width: 32px; height: 32px; border: 3px solid #1e293b; border-top-color: #38bdf8; border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

.time-ago { color: #64748b; font-size: 12px; }
.email-cell { color: #38bdf8; }
.mono { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px; color: #94a3b8; }

.config-card { background: #0f1629; border: 1px solid #1e293b; border-radius: 12px; margin-bottom: 20px; overflow: hidden; }
.config-card .config-header { padding: 16px 20px; border-bottom: 1px solid #1e293b; display: flex; align-items: center; gap: 10px; }
.config-card .config-header h3 { font-size: 15px; font-weight: 600; color: #e2e8f0; }
.config-card .config-header .cat-badge { font-size: 11px; background: #38bdf815; color: #38bdf8; padding: 3px 10px; border-radius: 10px; font-weight: 600; }
.config-item { display: flex; align-items: center; gap: 16px; padding: 14px 20px; border-top: 1px solid #1e293b; }
.config-item:first-child { border-top: none; }
.config-item .config-label { min-width: 180px; }
.config-item .config-label .label-text { font-size: 14px; color: #e2e8f0; font-weight: 500; }
.config-item .config-label .label-key { font-size: 11px; color: #475569; font-family: 'SF Mono', 'Fira Code', monospace; margin-top: 2px; }
.config-item .config-input { flex: 1; display: flex; gap: 8px; align-items: center; }
.config-item input { flex: 1; background: #0a0e1a; border: 1px solid #1e293b; color: #e2e8f0; padding: 8px 14px; border-radius: 8px; font-size: 13px; font-family: 'SF Mono', 'Fira Code', monospace; outline: none; transition: border-color 0.15s; }
.config-item input:focus { border-color: #38bdf8; }
.config-item input.sensitive { color: #64748b; }
.btn-save { background: #16a34a; color: #fff; border: none; padding: 7px 16px; border-radius: 8px; cursor: pointer; font-size: 12px; font-weight: 600; transition: background 0.15s; }
.btn-save:hover { background: #22c55e; }
.btn-reveal { background: transparent; border: 1px solid #334155; color: #94a3b8; padding: 7px 10px; border-radius: 8px; cursor: pointer; font-size: 11px; transition: all 0.15s; }
.btn-reveal:hover { border-color: #38bdf8; color: #38bdf8; }

.form-input { width: 100%; background: #0a0e1a; border: 1px solid #1e293b; color: #e2e8f0; padding: 9px 14px; border-radius: 8px; font-size: 13px; outline: none; transition: border-color 0.15s; }
.form-input:focus { border-color: #38bdf8; }

.test-card { background: #0f1629; border: 1px solid #1e293b; border-radius: 12px; padding: 20px; margin-bottom: 12px; display: flex; align-items: center; gap: 16px; transition: border-color 0.2s; }
.test-card.online { border-color: #16a34a40; }
.test-card.offline { border-color: #ef444440; }
.test-status { width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.test-status.online { background: #16a34a20; }
.test-status.offline { background: #ef444420; }
.test-info { flex: 1; }
.test-info .test-name { font-size: 15px; font-weight: 600; color: #e2e8f0; }
.test-info .test-details { font-size: 12px; color: #64748b; margin-top: 4px; display: flex; gap: 16px; flex-wrap: wrap; }
.test-info .test-details span { display: flex; align-items: center; gap: 4px; }
.test-latency { text-align: right; min-width: 80px; }
.test-latency .latency-num { font-size: 22px; font-weight: 700; }
.test-latency .latency-unit { font-size: 12px; color: #64748b; }
.test-latency.good .latency-num { color: #22c55e; }
.test-latency.medium .latency-num { color: #f59e0b; }
.test-latency.bad .latency-num { color: #ef4444; }

.btn-delete { background: transparent; border: 1px solid #334155; color: #ef4444; padding: 5px 10px; border-radius: 6px; cursor: pointer; font-size: 11px; }
.btn-delete:hover { background: #ef444420; border-color: #ef4444; }
.btn-edit { background: transparent; border: 1px solid #334155; color: #38bdf8; padding: 5px 10px; border-radius: 6px; cursor: pointer; font-size: 11px; }
.btn-edit:hover { background: #38bdf815; border-color: #38bdf8; }
.btn-toggle { background: transparent; border: 1px solid #334155; color: #94a3b8; padding: 5px 10px; border-radius: 6px; cursor: pointer; font-size: 11px; }
.btn-toggle:hover { border-color: #f59e0b; color: #f59e0b; }

/* Login Screen */
.login-overlay { position: fixed; inset: 0; background: #0a0e1a; display: flex; align-items: center; justify-content: center; z-index: 1000; }
.login-card { background: #0f1629; border: 1px solid #1e293b; border-radius: 16px; padding: 40px; width: 100%; max-width: 380px; text-align: center; }
.login-logo { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 24px; }
.login-logo svg { width: 32px; height: 32px; }
.login-logo span { font-size: 20px; font-weight: 700; color: #38bdf8; }
.login-card h2 { font-size: 22px; font-weight: 600; color: #f8fafc; margin-bottom: 4px; }
.login-subtitle { font-size: 14px; color: #64748b; margin-bottom: 28px; }
.login-field { text-align: left; margin-bottom: 16px; }
.login-field label { display: block; font-size: 13px; font-weight: 500; color: #94a3b8; margin-bottom: 6px; }
.login-field input { width: 100%; background: #0a0e1a; border: 1px solid #1e293b; color: #e2e8f0; padding: 10px 14px; border-radius: 8px; font-size: 14px; outline: none; transition: border-color 0.15s; }
.login-field input:focus { border-color: #38bdf8; }
.login-error { color: #f87171; font-size: 13px; min-height: 20px; margin-bottom: 8px; }
.login-btn { width: 100%; padding: 11px; font-size: 15px; border-radius: 10px; margin-top: 4px; }
