:root {
  --app-sidebar-width: 258px;
  --app-navbar-height: 66px;
  --app-bg: #f5f7fb;
  --app-navy: #102a43;
  --app-primary: #2563eb;
  --app-muted: #64748b;
}

html, body { min-height: 100%; }
body {
  background: var(--app-bg);
  color: #172033;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.page-loading {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-content: center;
  text-align: center;
  background: #f8fafc;
}

.auth-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 10%, rgba(37, 99, 235, .12), transparent 32%),
    radial-gradient(circle at 90% 90%, rgba(14, 165, 233, .10), transparent 34%),
    #f8fafc;
}

.auth-card { border-radius: 1.25rem; }
.brand-mark {
  width: 54px;
  height: 54px;
  display: inline-grid;
  place-items: center;
  border-radius: 16px;
  color: #fff;
  font-weight: 800;
  letter-spacing: -.04em;
  background: linear-gradient(135deg, #1d4ed8, #0ea5e9);
  box-shadow: 0 12px 28px rgba(37, 99, 235, .25);
}
.brand-mark-sm { width: 36px; height: 36px; border-radius: 11px; font-size: .78rem; box-shadow: none; }

.app-navbar { height: var(--app-navbar-height); z-index: 1040; }
.app-sidebar {
  --bs-offcanvas-width: var(--app-sidebar-width);
  width: var(--app-sidebar-width);
  top: var(--app-navbar-height);
  bottom: 0;
  background: #fff;
  border-right: 1px solid #e8edf5;
  z-index: 1035;
}
.app-sidebar .offcanvas-body { overflow-y: auto; }
.sidebar-caption { letter-spacing: .08em; font-size: .7rem; }
.app-sidebar .nav-link {
  color: #536178;
  font-weight: 600;
  padding: .72rem .9rem;
  border-radius: .7rem;
}
.app-sidebar .nav-link:hover { color: #1d4ed8; background: #f1f5ff; }
.app-sidebar .nav-link.active { color: #fff; background: linear-gradient(135deg, #2563eb, #3b82f6); box-shadow: 0 8px 20px rgba(37, 99, 235, .18); }
.nav-symbol { width: 1.7rem; display: inline-block; text-align: center; font-size: 1.1rem; }
.sidebar-source { background: #f7f9fc; border: 1px solid #e8edf5; }

.app-main { min-height: 100vh; padding-top: var(--app-navbar-height); }
.page-title { font-size: 1.45rem; font-weight: 750; letter-spacing: -.025em; }
.page-subtitle { color: var(--app-muted); }
.content-card { border: 0; border-radius: 1rem; box-shadow: 0 3px 18px rgba(15, 23, 42, .055); }
.stat-card { overflow: hidden; position: relative; }
.stat-card::after { content: ""; position: absolute; width: 90px; height: 90px; border-radius: 50%; right: -32px; top: -38px; background: var(--stat-glow, rgba(37, 99, 235, .10)); }
.stat-label { color: var(--app-muted); font-size: .83rem; font-weight: 600; }
.stat-value { font-size: 1.72rem; font-weight: 760; letter-spacing: -.04em; }
.metric-note { color: var(--app-muted); font-size: .76rem; }
.chart-wrap { position: relative; height: 292px; }
.chart-wrap canvas { width: 100%; height: 100%; }
.breakdown-bar { height: 7px; border-radius: 999px; background: #edf2f9; overflow: hidden; }
.breakdown-bar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2563eb, #38bdf8); }
.table { --bs-table-bg: transparent; }
.table thead th { color: #718096; text-transform: uppercase; font-size: .7rem; letter-spacing: .045em; white-space: nowrap; border-bottom-width: 1px; }
.table tbody td { vertical-align: middle; font-size: .86rem; }
.table-clickable tbody tr { cursor: pointer; }
.table-clickable tbody tr:hover { --bs-table-hover-bg: #f7f9fd; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: .78rem; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .12); }
.status-dot.warning { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .12); }
.status-dot.danger { background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, .12); }
.ip-proxy { color: #b45309; }
.filter-bar .form-control, .filter-bar .form-select { min-height: 40px; }
.empty-state { padding: 4rem 1rem; text-align: center; color: var(--app-muted); }
.empty-symbol { display: block; font-size: 2.2rem; margin-bottom: .75rem; opacity: .45; }
.heatmap-grid { display: grid; grid-template-columns: 42px repeat(24, minmax(18px, 1fr)); gap: 3px; min-width: 760px; }
.heat-cell { aspect-ratio: 1; min-height: 18px; border-radius: 4px; background: #eef2f7; }
.heat-label { font-size: .66rem; color: #77849a; display: grid; place-items: center; }
.behavior-badge { min-width: 86px; }
.progress-thin { height: 6px; }
.scan-progress-bar { height: 10px; border-radius: 999px; background: #e7eefb; }
.scan-progress-bar .progress-bar { border-radius: inherit; background-color: var(--app-primary); }
.scan-progress-banner { border: 1px solid rgba(37, 99, 235, .16); background: linear-gradient(135deg, #fff, #f4f8ff); }
.scan-progress-box { padding: 1rem; border: 1px solid rgba(37, 99, 235, .14); border-radius: .85rem; background: #f7faff; }
.detail-grid { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: .75rem 1rem; font-size: .88rem; }
.detail-grid dt { color: var(--app-muted); font-weight: 600; }
.detail-grid dd { margin: 0; overflow-wrap: anywhere; }
.app-toast-container { z-index: 1090; margin-top: 68px; }
.skeleton { position: relative; overflow: hidden; background: #e9edf3; border-radius: .45rem; min-height: 1rem; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.75), transparent); animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

@media (min-width: 992px) {
  .app-sidebar { position: fixed; transform: none !important; visibility: visible !important; }
  .app-main { margin-left: var(--app-sidebar-width); }
}

@media (max-width: 767.98px) {
  .chart-wrap { height: 230px; }
  .detail-grid { grid-template-columns: 1fr; gap: .2rem; }
  .detail-grid dd { margin-bottom: .7rem; }
  .page-title { font-size: 1.25rem; }
  .stat-value { font-size: 1.45rem; }
}
