/* =========================================================
   Cloud Server Admin — Component Library
   在 visionOS Liquid Glass 设计系统之上，为全站各页补充组件。
   依赖 app.css 的令牌（--primary / --glass-* / --radius-* 等）。
   ========================================================= */

/* ---------- 通用布局 ---------- */
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.muted { color: var(--text-3); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 9px;
  font-size: 13px; font-weight: 600; font-family: var(--font-sans);
  cursor: pointer; border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.06); color: var(--text);
  transition: background .18s ease, border-color .18s ease, transform .12s ease, box-shadow .18s ease;
  text-decoration: none; user-select: none;
}
.btn:hover { background: rgba(255, 255, 255, 0.10); border-color: var(--glass-border-strong); }
.btn:active { transform: translateY(1px); }
.btn .icon { width: 16px; height: 16px; }
.btn-primary {
  background: linear-gradient(155deg, var(--primary), #0891b2); color: #04201d; border-color: transparent;
  box-shadow: 0 8px 22px rgba(45, 212, 191, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.btn-primary:hover { background: linear-gradient(155deg, #7df3df, #0bb6cf); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 7px 12px; font-size: 12px; border-radius: 7px; }
.btn-danger { color: var(--error); border-color: rgba(251, 113, 133, 0.34); background: var(--error-soft); }
.btn-danger:hover { background: rgba(251, 113, 133, 0.24); }

/* ---------- 表单字段 ---------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-size: 12px; color: var(--text-2); font-weight: 600; }
.field-hint { font-size: 11px; color: var(--text-3); }
.input, .select, .textarea {
  width: 100%; padding: 11px 13px; border-radius: 8px; font-size: 13px; font-family: var(--font-sans);
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--glass-border); color: var(--text);
  outline: none; transition: border-color .18s ease, box-shadow .18s ease;
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary-line); box-shadow: 0 0 0 3px var(--primary-faint); }
.textarea { resize: vertical; min-height: 84px; font-family: var(--font-mono); line-height: 1.6; }
.select {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 36px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239aa3b2' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 13px center; background-size: 14px;
}
.select option { background: #0c0d16; color: var(--text); }

/* ---------- 开关 ---------- */
.switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 44px; height: 25px; border-radius: 999px; background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--glass-border); transition: background .2s ease; position: relative;
}
.switch .track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4); transition: transform .2s ease;
}
.switch input:checked + .track { background: linear-gradient(155deg, var(--primary), #0891b2); border-color: transparent; }
.switch input:checked + .track::after { transform: translateX(19px); }
.switch-label { font-size: 13px; color: var(--text); margin-left: 11px; }

/* ---------- 徽章 / 标签 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600; border: 1px solid transparent; white-space: nowrap;
}
.badge-success { background: var(--success-soft); color: var(--success); border-color: rgba(74, 222, 128, 0.30); }
.badge-warning { background: var(--warning-soft); color: var(--warning); border-color: rgba(251, 191, 36, 0.30); }
.badge-error { background: var(--error-soft); color: var(--error); border-color: rgba(251, 113, 133, 0.30); }
.badge-info { background: var(--info-soft); color: var(--info); border-color: rgba(96, 165, 250, 0.30); }
.badge-neutral { background: rgba(255, 255, 255, 0.07); color: var(--text-2); border-color: var(--glass-border); }
.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600; background: rgba(255, 255, 255, 0.06); color: var(--text-2);
  border: 1px solid var(--glass-border);
}

/* ---------- 分段控件 ---------- */
.seg { display: inline-flex; padding: 4px; gap: 3px; border-radius: 8px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--glass-border); }
.seg-btn {
  padding: 7px 14px; border-radius: 7px; font-size: 12px; font-weight: 600; color: var(--text-2);
  background: transparent; border: none; cursor: pointer; transition: all .15s ease;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: rgba(255, 255, 255, 0.12); color: var(--text); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12); }

/* ---------- 数据表格 ---------- */
.table-wrap { overflow: auto; border-radius: var(--radius-md); }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.data-table thead th {
  text-align: left; padding: 12px 14px; font-size: 11px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .08em; border-bottom: 1px solid var(--glass-border); white-space: nowrap;
}
.data-table tbody td { padding: 13px 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); color: var(--text); vertical-align: middle; }
.data-table tbody tr { transition: background .15s ease; }
.data-table tbody tr:hover { background: rgba(255, 255, 255, 0.05); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .mono { font-size: 12.5px; }
.data-table .actions { display: flex; gap: 6px; justify-content: flex-end; }
.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable::after { content: '↕'; margin-left: 6px; opacity: 0.5; font-size: 10px; }
.data-table th.sort-asc::after { content: '↑'; opacity: 1; }
.data-table th.sort-desc::after { content: '↓'; opacity: 1; }

/* ---------- 进度条 ---------- */
.progress { width: 100%; height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), #0891b2); transition: width .9s cubic-bezier(0.22, 1, 0.36, 1); }
.progress-fill.warn { background: linear-gradient(90deg, #fbbf24, #f97316); }
.progress-fill.err { background: linear-gradient(90deg, #fb7185, #e11d48); }
.progress-fill.info { background: linear-gradient(90deg, #60a5fa, #3b82f6); }

/* ---------- 工具栏 ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.toolbar .search-box { width: auto; }

/* =========================================================
   服务器状态页
   ========================================================= */
.ring-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.ring-card { display: flex; flex-direction: column; align-items: center; padding: 26px 20px 22px; border-radius: var(--radius); position: relative; }
.ring { position: relative; width: 150px; height: 150px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.ring-track { fill: none; stroke: rgba(255, 255, 255, 0.08); stroke-width: 11; }
.ring-fill { fill: none; stroke-width: 11; stroke-linecap: round; transition: stroke-dashoffset 1.1s cubic-bezier(0.22, 1, 0.36, 1); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-value { font-size: 32px; font-weight: 800; font-family: var(--font-mono); line-height: 1; }
.ring-unit { font-size: 14px; color: var(--text-2); margin-top: 4px; }
.ring-label { font-size: 13px; color: var(--text-2); margin-top: 14px; font-weight: 600; }
.ring-sub { font-size: 11px; color: var(--text-3); margin-top: 3px; }

.info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.info-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 15px; border-radius: var(--radius-md); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--glass-border); }
.info-key { font-size: 12px; color: var(--text-2); }
.info-val { font-size: 12.5px; font-weight: 600; font-family: var(--font-mono); color: var(--text); text-align: right; }

.net-list { display: flex; flex-direction: column; gap: 13px; }
.net-row { display: flex; align-items: center; gap: 12px; }
.net-name { width: 92px; font-size: 12px; color: var(--text-2); flex-shrink: 0; }
.net-bar { flex: 1; }
.net-val { width: 92px; text-align: right; font-size: 12px; font-family: var(--font-mono); flex-shrink: 0; }
.net-val .up { color: var(--success); }
.net-val .down { color: var(--info); }

/* =========================================================
   防火墙页
   ========================================================= */
.firewall-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 22px; align-items: start; }
.ban-list { display: flex; flex-direction: column; gap: 11px; }
.ban-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 15px; border-radius: var(--radius-md); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--glass-border); }
.ban-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ban-avatar { width: 34px; height: 34px; border-radius: 7px; display: grid; place-items: center; background: var(--error-soft); color: var(--error); flex-shrink: 0; }
.ban-avatar .icon { width: 16px; height: 16px; }
.ban-ip { font-size: 13px; font-weight: 600; font-family: var(--font-mono); }
.ban-reason { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.ban-meta { text-align: right; flex-shrink: 0; }
.ban-countdown { font-size: 12px; font-family: var(--font-mono); color: var(--warning); }
.ban-countdown .lbl { display: block; font-size: 10px; color: var(--text-3); font-family: var(--font-sans); }
.form-card .field { margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 0; border-bottom: 1px solid var(--glass-border); }
.setting-row:last-child { border-bottom: none; }
.setting-row .sr-title { font-size: 13px; font-weight: 600; }
.setting-row .sr-desc { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }

/* =========================================================
   告警日志页
   ========================================================= */
.timeline { display: flex; flex-direction: column; gap: 12px; }
.alert-item {
  display: flex; gap: 14px; padding: 16px 18px; border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--glass-border); position: relative;
  transition: background .15s ease; cursor: pointer;
}
.alert-item:hover { background: rgba(255, 255, 255, 0.08); }
.alert-rail { width: 4px; border-radius: 999px; flex-shrink: 0; align-self: stretch; }
.alert-rail.critical { background: var(--error); box-shadow: 0 0 12px var(--error); }
.alert-rail.warning { background: var(--warning); box-shadow: 0 0 12px var(--warning); }
.alert-rail.info { background: var(--info); box-shadow: 0 0 12px var(--info); }
.alert-body { flex: 1; min-width: 0; }
.alert-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.alert-title { font-size: 13.5px; font-weight: 700; }
.alert-meta { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }
.alert-detail { font-size: 12.5px; color: var(--text-2); line-height: 1.65; margin-top: 11px; padding-top: 11px; border-top: 1px dashed var(--glass-border); display: none; }
.alert-item.open .alert-detail { display: block; animation: fadeIn .25s ease; }
.alert-actions { display: flex; gap: 8px; margin-top: 11px; flex-wrap: wrap; }
.alert-empty { text-align: center; padding: 40px; color: var(--text-3); font-size: 13px; }

/* =========================================================
   系统设置页
   ========================================================= */
.settings-layout { display: grid; grid-template-columns: 212px 1fr; gap: 22px; align-items: start; }
.tab-nav { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: var(--radius); position: relative; }
.tab-link {
  display: flex; align-items: center; gap: 11px; padding: 11px 14px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; text-decoration: none; transition: background .15s ease, color .15s ease;
}
.tab-link:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.tab-link.active { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-line); }
.tab-link .icon { width: 17px; height: 17px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn .25s ease; }
.save-bar { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--glass-border); }
.form-section { display: flex; flex-direction: column; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* =========================================================
   软件管理页
   ========================================================= */
.software-list { display: flex; flex-direction: column; gap: 16px; }
.software-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.sw-category { font-size: 11px; color: var(--text-3); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.06em; }
.sw-meta { display: flex; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.meta-item { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-3); }
.meta-item .icon { width: 12px; height: 12px; }
.resource-row { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
.resource-row .r-label { width: 44px; font-size: 12px; color: var(--text-2); }
.resource-row .progress { flex: 1; }
.resource-row .r-val { width: 54px; text-align: right; font-size: 12px; font-family: var(--font-mono); }

.toast-container { position: fixed; bottom: 22px; right: 22px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 9px;
  background: rgba(12, 14, 24, 0.82); border: 1px solid var(--glass-border);
  backdrop-filter: blur(24px); box-shadow: var(--glass-shadow);
  font-size: 13px; color: var(--text); animation: fadeIn .25s ease;
}
.toast.success { border-color: rgba(74, 222, 128, 0.35); }
.toast.error { border-color: rgba(251, 113, 133, 0.35); }
.toast.info { border-color: rgba(96, 165, 250, 0.35); }
.toast.fade-out { opacity: 0; transform: translateY(8px); transition: opacity .25s ease, transform .25s ease; }
.empty-state { grid-column: 1 / -1; text-align: center; padding: 48px; color: var(--text-3); font-size: 13px; }
.software-card { border-radius: var(--radius); position: relative; overflow: hidden; }
.sw-head { display: flex; align-items: center; gap: 14px; padding: 18px 20px; }
.sw-icon { width: 46px; height: 46px; border-radius: 9px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.07); color: var(--primary); flex-shrink: 0; }
.sw-icon .icon { width: 21px; height: 21px; }
.sw-name { font-size: 15px; font-weight: 700; }
.sw-desc { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.sw-head .spacer { flex: 1; }
.sw-toggle {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--glass-border); color: var(--text-2);
  cursor: pointer; transition: transform .25s ease, background .15s ease, color .15s ease; flex-shrink: 0;
}
.sw-toggle:hover { background: rgba(255, 255, 255, 0.10); color: var(--text); }
.software-card.open .sw-toggle { transform: rotate(180deg); color: var(--primary); }
.sw-details { display: none; padding: 0 20px 20px; }
.software-card.open .sw-details { display: block; animation: fadeIn .25s ease; }
.config-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 14px; }
.config-item { padding: 12px 14px; border-radius: var(--radius-md); background: rgba(255, 255, 255, 0.04); border: 1px solid var(--glass-border); }
.config-key { font-size: 11px; color: var(--text-3); }
.config-val { font-size: 12.5px; font-family: var(--font-mono); margin-top: 3px; word-break: break-all; }
.log-box {
  background: rgba(0, 0, 0, 0.32); border: 1px solid var(--glass-border); border-radius: var(--radius-md);
  padding: 14px; font-family: var(--font-mono); font-size: 11.5px; line-height: 1.75; color: var(--text-2);
  overflow: auto; max-height: 210px;
}
.log-line { white-space: pre-wrap; }
.log-line .t { color: var(--text-3); }
.log-line .ok { color: var(--success); }
.log-line .warn { color: var(--warning); }
.log-line .err { color: var(--error); }
.log-line .info { color: var(--info); }

/* =========================================================
   IP 访问地图页
   ========================================================= */
.map-layout { display: grid; grid-template-columns: 1.7fr 1fr; gap: 22px; align-items: start; }
.map-panel { padding: 0; overflow: hidden; position: relative; }
.map-canvas { width: 100%; height: 472px; position: relative; }
.map-canvas svg { width: 100%; height: 100%; display: block; }
.map-legend { position: absolute; bottom: 16px; left: 18px; display: flex; gap: 16px; font-size: 11px; color: var(--text-2); background: rgba(8, 10, 18, 0.55); padding: 8px 13px; border-radius: 8px; border: 1px solid var(--glass-border); backdrop-filter: blur(20px); }
.map-legend .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.rank-list { display: flex; flex-direction: column; gap: 13px; }
.rank-row { display: flex; align-items: center; gap: 12px; }
.rank-flag { width: 28px; height: 28px; border-radius: 6px; background: rgba(255, 255, 255, 0.08); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.rank-name { width: 96px; font-size: 12.5px; flex-shrink: 0; }
.rank-bar { flex: 1; }
.rank-val { width: 56px; text-align: right; font-size: 12px; font-family: var(--font-mono); flex-shrink: 0; }
.threat-list { display: flex; flex-direction: column; gap: 12px; }
.threat-row { display: flex; align-items: center; gap: 12px; }
.threat-name { width: 72px; font-size: 12px; color: var(--text-2); flex-shrink: 0; }
.threat-bar { flex: 1; }
.threat-val { width: 48px; text-align: right; font-size: 12px; font-family: var(--font-mono); flex-shrink: 0; }
.feed-list { display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow: auto; }
.feed-item { display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: var(--radius-md); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--glass-border); }
.feed-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.feed-text { font-size: 12px; flex: 1; min-width: 0; }
.feed-time { font-size: 11px; color: var(--text-3); font-family: var(--font-mono); flex-shrink: 0; }
.sec-ring-wrap { display: flex; align-items: center; gap: 20px; }
.sec-ring-wrap .ring { width: 116px; height: 116px; }

/* =========================================================
   动画 / 响应式
   ========================================================= */
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (max-width: 1320px) {
  .main-grid { grid-template-columns: 1fr; }
  .two-col, .firewall-grid, .map-layout { grid-template-columns: 1fr; }
  .sec-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1120px) {
  .stats-grid, .ring-grid, .three-col { grid-template-columns: repeat(2, 1fr); }
  .settings-layout { grid-template-columns: 1fr; }
  .tab-nav { flex-direction: row; flex-wrap: wrap; }
  .config-grid, .form-grid, .form-row, .info-grid { grid-template-columns: 1fr; }
}

/* ============ Alerts ============ */
.flex-1 { flex: 1; }
.filter-tabs { display: flex; gap: 4px; position: relative; background: rgba(255,255,255,0.05); padding: 5px; border-radius: 999px; border: 1px solid var(--glass-border); }
.filter-tab { border: none; background: transparent; color: var(--text-2); font-size: 12.5px; font-weight: 600; padding: 7px 14px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: color .2s, background .2s, box-shadow .2s; }
.filter-tab .count { font-size: 11px; opacity: .7; font-family: var(--font-mono); }
.filter-tab:hover { color: var(--text); }
.filter-tab.active { background: rgba(255,255,255,0.12); color: var(--text); box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 2px 10px rgba(0,0,0,.28); }

.alert-timeline { position: relative; padding: 4px 0; }
.alert-rail { position: absolute; left: 19px; top: 14px; bottom: 14px; width: 2px; background: linear-gradient(var(--glass-border-strong), rgba(255,255,255,0)); }

.alert-item { position: relative; padding-left: 46px; margin-bottom: 14px; }
.alert-item::before { content: ''; position: absolute; left: 12px; top: 26px; width: 15px; height: 15px; border-radius: 50%; background: var(--bg-1); border: 2px solid var(--text-2); box-shadow: 0 0 0 4px rgba(255,255,255,.04); }
.alert-item.sev-critical::before { border-color: var(--error); box-shadow: 0 0 0 4px rgba(251,113,133,.16); }
.alert-item.sev-warning::before { border-color: var(--warning); box-shadow: 0 0 0 4px rgba(251,191,36,.16); }
.alert-item.sev-info::before { border-color: var(--info); box-shadow: 0 0 0 4px rgba(56,189,248,.16); }
.alert-item.resolved::before { border-color: var(--success); box-shadow: 0 0 0 4px rgba(74,222,128,.16); }

.alert-card { border-radius: var(--radius-md); overflow: hidden; transition: border-color .2s; }
.alert-card:hover { border-color: var(--glass-border-strong); }
.alert-head { width: 100%; text-align: left; background: transparent; border: none; cursor: pointer; display: flex; align-items: flex-start; gap: 14px; padding: 16px 18px; color: var(--text); font-family: inherit; }
.alert-icon { flex: none; width: 40px; height: 40px; border-radius: 8px; display: grid; place-items: center; background: rgba(255,255,255,.08); border: 1px solid var(--glass-border); }
.alert-icon .icon { width: 20px; height: 20px; }
.alert-item.sev-critical .alert-icon { background: rgba(251,113,133,.14); border-color: rgba(251,113,133,.30); color: var(--error); }
.alert-item.sev-warning .alert-icon { background: rgba(251,191,36,.14); border-color: rgba(251,191,36,.30); color: var(--warning); }
.alert-item.sev-info .alert-icon { background: rgba(56,189,248,.14); border-color: rgba(56,189,248,.30); color: var(--info); }
.alert-body { flex: 1; min-width: 0; }
.alert-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; }
.sev-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 999px; }
.sev-badge .icon { width: 13px; height: 13px; }
.sev-badge.critical { background: rgba(251,113,133,.16); color: var(--error); }
.sev-badge.warning { background: rgba(251,191,36,.16); color: var(--warning); }
.sev-badge.info { background: rgba(56,189,248,.16); color: var(--info); }
.alert-source, .alert-time { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text-2); }
.alert-source .icon, .alert-time .icon { width: 13px; height: 13px; }
.status-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.status-badge .dot { width: 7px; height: 7px; border-radius: 50%; }
.status-badge.active { background: rgba(251,113,133,.14); color: var(--error); }
.status-badge.active .dot { background: var(--error); animation: pulse 1.4s infinite; }
.status-badge.resolved { background: rgba(74,222,128,.14); color: var(--success); }
.status-badge.resolved .dot { background: var(--success); }
.alert-title { font-size: 14.5px; font-weight: 700; margin-bottom: 4px; letter-spacing: -.2px; }
.alert-desc { font-size: 12.5px; color: var(--text-2); line-height: 1.55; }
.alert-chevron { flex: none; color: var(--text-2); transition: transform .25s ease; margin-top: 2px; }
.alert-chevron .icon { width: 18px; height: 18px; }
.alert-item.expanded .alert-chevron { transform: rotate(180deg); }

.alert-detail { max-height: 0; overflow: hidden; transition: max-height .32s ease; }
.alert-item.expanded .alert-detail { max-height: 560px; }
.alert-detail-inner { padding: 0 18px 18px 18px; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; padding-top: 14px; border-top: 1px solid var(--glass-border); }
.detail-item { display: flex; flex-direction: column; gap: 4px; }
.detail-label { font-size: 11px; color: var(--text-2); }
.detail-value { font-size: 13px; font-weight: 600; font-family: var(--font-mono); }
.alert-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.alert-actions .btn .icon { width: 15px; height: 15px; }

.alert-empty { text-align: center; padding: 44px 20px; color: var(--text-2); display: none; flex-direction: column; align-items: center; gap: 10px; }
.alert-empty .icon { width: 34px; height: 34px; opacity: .45; }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(74,222,128,.18); animation: pulse 1.6s infinite; }

/* ============ Settings detail ============ */
.card-desc { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.settings-layout .card { padding: 22px; }
.setting-list { display: flex; flex-direction: column; }
.setting-item { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 16px 4px; border-bottom: 1px solid var(--glass-border); }
.setting-item:last-child { border-bottom: none; }
.setting-info { flex: 1; min-width: 0; }
.setting-label { font-size: 13.5px; font-weight: 600; color: var(--text); }
.setting-desc { font-size: 11.5px; color: var(--text-2); margin-top: 3px; line-height: 1.5; }
.setting-control { flex: none; display: flex; align-items: center; }
.setting-control .input, .setting-control .select { min-width: 240px; }
.info-list { display: flex; flex-direction: column; gap: 2px; }
.info-row { display: flex; align-items: center; justify-content: space-between; padding: 13px 4px; border-bottom: 1px solid var(--glass-border); }
.info-row:last-child { border-bottom: none; }
.info-label { font-size: 13px; color: var(--text-2); }
.info-value { font-size: 13px; font-weight: 600; font-family: var(--font-mono); color: var(--text); }
.save-hint { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2); margin-right: auto; }
.save-hint .icon { width: 15px; height: 15px; color: var(--success); }
.save-actions { display: flex; gap: 10px; }
.spin .icon { animation: spin 1s linear infinite; transform-origin: center; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ IP Map ============ */
.main-row { display: grid; grid-template-columns: 1fr 360px; gap: 22px; align-items: stretch; }
.map-card { display: flex; flex-direction: column; padding: 18px; overflow: hidden; }
.map-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.map-title-wrap { display: flex; align-items: center; gap: 9px; }
.map-title-wrap .icon { width: 18px; height: 18px; color: var(--primary); }
.map-title-wrap h2 { font-size: 15px; font-weight: 700; }
.map-live { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--text-2); }
.map-stage { flex: 1; min-height: 460px; position: relative; overflow: hidden; border-radius: var(--radius-md); background: radial-gradient(120% 120% at 50% 30%, rgba(94,234,212,0.05), transparent 60%); }
.map-stage svg { display: block; width: 100%; height: 100%; }
.map-coords { position: absolute; top: 12px; left: 14px; font-size: 11px; font-family: var(--font-mono); color: var(--text-2); letter-spacing: .5px; pointer-events: none; }
.tooltip { position: absolute; pointer-events: none; opacity: 0; transition: opacity .15s; z-index: 5; min-width: 170px; padding: 11px 13px; border-radius: 9px; background: rgba(12,13,22,0.92); border: 1px solid var(--glass-border-strong); box-shadow: 0 12px 30px rgba(0,0,0,.45); backdrop-filter: blur(14px); }
.tooltip .ip { font-family: var(--font-mono); font-weight: 700; font-size: 13px; }
.tooltip .loc { font-size: 11.5px; color: var(--text-2); margin-top: 2px; }
.tooltip .intent { font-size: 11.5px; font-weight: 600; margin-top: 5px; }
.tooltip .stat-row { display: flex; justify-content: space-between; gap: 16px; font-size: 11px; color: var(--text-2); margin-top: 3px; }
.tooltip .stat-row b { color: var(--text); font-family: var(--font-mono); }
.map-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--glass-border); font-size: 11.5px; color: var(--text-2); }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

.country { fill: rgba(255,255,255,0.045); stroke: rgba(255,255,255,0.09); stroke-width: 0.5px; transition: fill .2s; }
.country:hover { fill: rgba(94,234,212,0.16); }
.connection-base { fill: none; stroke-width: 1; opacity: .16; stroke-dasharray: 4 4; }
.connection-flow { fill: none; stroke-width: 1.6; stroke-dasharray: 6 10; opacity: .9; animation: dashFlow 1.4s linear infinite; }
@keyframes dashFlow { to { stroke-dashoffset: -32; } }
.marker-core { transition: r .15s; }
.marker-ring { transform-box: fill-box; transform-origin: center; animation: ringPulse 2s ease-out infinite; }
@keyframes ringPulse { 0% { transform: scale(.7); opacity: .9; } 100% { transform: scale(1.9); opacity: 0; } }
.server-ring { transform-box: fill-box; transform-origin: center; animation: serverPulse 2.4s ease-out infinite; }
.server-ring.delay { animation-delay: 1.2s; }
@keyframes serverPulse { 0% { transform: scale(.55); opacity: .8; } 100% { transform: scale(1.9); opacity: 0; } }

.side-col { display: flex; flex-direction: column; min-width: 0; }
.side-card { padding: 18px; display: flex; flex-direction: column; }
.side-card .head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.side-card .title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.side-card .title .icon { width: 16px; height: 16px; color: var(--primary); }
.count-tag { font-size: 11px; color: var(--text-2); padding: 4px 9px; border-radius: 999px; background: rgba(255,255,255,0.06); border: 1px solid var(--glass-border); }

.ip-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.ip-chip { font-size: 11.5px; font-weight: 600; padding: 6px 11px; border-radius: 999px; background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border); color: var(--text-2); cursor: pointer; transition: .18s; }
.ip-chip:hover { color: var(--text); }
.ip-chip.active { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-line); }
.ip-list-body { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.ip-row { display: flex; align-items: center; gap: 11px; padding: 10px; border-radius: 9px; background: rgba(255,255,255,0.04); border: 1px solid var(--glass-border); transition: .15s; }
.ip-row:hover { background: rgba(255,255,255,0.07); border-color: var(--glass-border-strong); }
.ip-row .flag { font-size: 18px; width: 28px; height: 28px; display: grid; place-items: center; flex: none; }
.ip-row-main { flex: 1; min-width: 0; }
.ip-row-main .ip { font-family: var(--font-mono); font-weight: 700; font-size: 13px; }
.ip-row-main .meta { font-size: 11px; color: var(--text-2); }
.ip-row-main .time { font-size: 10.5px; color: var(--text-3); }
.ip-row .side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.ip-row .side .count { font-family: var(--font-mono); font-weight: 700; font-size: 13px; }
.threat-badge { font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; border: 1px solid transparent; }
.threat-safe { background: rgba(74,222,128,0.14); color: var(--success); border-color: rgba(74,222,128,0.2); }
.threat-suspicious { background: rgba(251,191,36,0.14); color: var(--warning); border-color: rgba(251,191,36,0.2); }
.threat-malicious { background: rgba(251,113,133,0.16); color: var(--error); border-color: rgba(251,113,133,0.25); animation: pulse 2s infinite; }
.threat-banned { background: rgba(255,255,255,0.06); color: var(--text-2); border-color: var(--glass-border); }

.sec-card { align-items: center; text-align: center; }
.security-ring { position: relative; width: 150px; height: 150px; margin: 6px auto 0; }
.security-ring svg { transform: rotate(-90deg); filter: drop-shadow(0 0 12px rgba(94,234,212,0.25)); }
.security-ring .score { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.score-num { font-size: 38px; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }
.score-lab { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.sec-note { font-size: 11.5px; color: var(--text-2); margin-top: 12px; }

.threat-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.threat-bar:last-child { margin-bottom: 0; }
.threat-bar .name { font-size: 12px; color: var(--text-2); min-width: 60px; }
.threat-bar .track { flex: 1; height: 8px; border-radius: 999px; background: rgba(255,255,255,0.07); overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,0.3); }
.threat-bar .fill { height: 100%; border-radius: 999px; box-shadow: 0 0 12px currentColor; }
.threat-bar .count { font-size: 13px; font-weight: 700; font-family: var(--font-mono); min-width: 34px; text-align: right; }

.country-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--glass-border); }
.country-row:last-child { border-bottom: none; }
.crow-left { display: flex; align-items: center; gap: 10px; }
.country-row .rank { width: 24px; height: 24px; border-radius: 5px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; background: rgba(255,255,255,0.07); color: var(--text-2); }
.country-row .rank.top { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #0b0b0f; box-shadow: 0 0 12px rgba(255,184,0,0.35); }
.country-row .flag { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; background: rgba(255,255,255,0.07); }
.country-row .name { font-size: 13px; color: var(--text); }
.country-row .count { font-size: 13px; font-weight: 700; font-family: var(--font-mono); }

.bottom-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: 22px; }

/* ============ IP Map ============ */
.main-row { display: grid; grid-template-columns: 1fr 360px; gap: 22px; align-items: stretch; }
.map-card { display: flex; flex-direction: column; padding: 18px; overflow: hidden; }
.map-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.map-title-wrap { display: flex; align-items: center; gap: 9px; }
.map-title-wrap .icon { width: 18px; height: 18px; color: var(--primary); }
.map-title-wrap h2 { font-size: 15px; font-weight: 700; }
.map-live { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--text-2); }
.map-stage { flex: 1; min-height: 460px; position: relative; overflow: hidden; border-radius: var(--radius-md); background: radial-gradient(120% 120% at 50% 30%, rgba(94,234,212,0.05), transparent 60%); }
.map-stage svg { display: block; width: 100%; height: 100%; }
.map-coords { position: absolute; top: 12px; left: 14px; font-size: 11px; font-family: var(--font-mono); color: var(--text-2); letter-spacing: .5px; pointer-events: none; }
.tooltip { position: absolute; pointer-events: none; opacity: 0; transition: opacity .15s; z-index: 5; min-width: 170px; padding: 11px 13px; border-radius: 9px; background: rgba(12,13,22,0.92); border: 1px solid var(--glass-border-strong); box-shadow: 0 12px 30px rgba(0,0,0,.45); backdrop-filter: blur(14px); }
.tooltip .ip { font-family: var(--font-mono); font-weight: 700; font-size: 13px; }
.tooltip .loc { font-size: 11.5px; color: var(--text-2); margin-top: 2px; }
.tooltip .intent { font-size: 11.5px; font-weight: 600; margin-top: 5px; }
.tooltip .stat-row { display: flex; justify-content: space-between; gap: 16px; font-size: 11px; color: var(--text-2); margin-top: 3px; }
.tooltip .stat-row b { color: var(--text); font-family: var(--font-mono); }
.map-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--glass-border); font-size: 11.5px; color: var(--text-2); }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

.country { fill: rgba(255,255,255,0.045); stroke: rgba(255,255,255,0.09); stroke-width: 0.5px; transition: fill .2s; }
.country:hover { fill: rgba(94,234,212,0.16); }
.connection-base { fill: none; stroke-width: 1; opacity: .16; stroke-dasharray: 4 4; }
.connection-flow { fill: none; stroke-width: 1.6; stroke-dasharray: 6 10; opacity: .9; animation: dashFlow 1.4s linear infinite; }
@keyframes dashFlow { to { stroke-dashoffset: -32; } }
.marker-core { transition: r .15s; }
.marker-ring { transform-box: fill-box; transform-origin: center; animation: ringPulse 2s ease-out infinite; }
@keyframes ringPulse { 0% { transform: scale(.7); opacity: .9; } 100% { transform: scale(1.9); opacity: 0; } }
.server-ring { transform-box: fill-box; transform-origin: center; animation: serverPulse 2.4s ease-out infinite; }
.server-ring.delay { animation-delay: 1.2s; }
@keyframes serverPulse { 0% { transform: scale(.55); opacity: .8; } 100% { transform: scale(1.9); opacity: 0; } }

.side-col { display: flex; flex-direction: column; min-width: 0; }
.side-card { padding: 18px; display: flex; flex-direction: column; }
.side-card .head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.side-card .title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.side-card .title .icon { width: 16px; height: 16px; color: var(--primary); }
.count-tag { font-size: 11px; color: var(--text-2); padding: 4px 9px; border-radius: 999px; background: rgba(255,255,255,0.06); border: 1px solid var(--glass-border); }

.ip-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.ip-chip { font-size: 11.5px; font-weight: 600; padding: 6px 11px; border-radius: 999px; background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border); color: var(--text-2); cursor: pointer; transition: .18s; }
.ip-chip:hover { color: var(--text); }
.ip-chip.active { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-line); }
.ip-list-body { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.ip-row { display: flex; align-items: center; gap: 11px; padding: 10px; border-radius: 9px; background: rgba(255,255,255,0.04); border: 1px solid var(--glass-border); transition: .15s; }
.ip-row:hover { background: rgba(255,255,255,0.07); border-color: var(--glass-border-strong); }
.ip-row .flag { font-size: 18px; width: 28px; height: 28px; display: grid; place-items: center; flex: none; }
.ip-row-main { flex: 1; min-width: 0; }
.ip-row-main .ip { font-family: var(--font-mono); font-weight: 700; font-size: 13px; }
.ip-row-main .meta { font-size: 11px; color: var(--text-2); }
.ip-row-main .time { font-size: 10.5px; color: var(--text-3); }
.ip-row .side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.ip-row .side .count { font-family: var(--font-mono); font-weight: 700; font-size: 13px; }
.threat-badge { font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; border: 1px solid transparent; }
.threat-safe { background: rgba(74,222,128,0.14); color: var(--success); border-color: rgba(74,222,128,0.2); }
.threat-suspicious { background: rgba(251,191,36,0.14); color: var(--warning); border-color: rgba(251,191,36,0.2); }
.threat-malicious { background: rgba(251,113,133,0.16); color: var(--error); border-color: rgba(251,113,133,0.25); animation: pulse 2s infinite; }
.threat-banned { background: rgba(255,255,255,0.06); color: var(--text-2); border-color: var(--glass-border); }

.sec-card { align-items: center; text-align: center; }
.security-ring { position: relative; width: 150px; height: 150px; margin: 6px auto 0; }
.security-ring svg { transform: rotate(-90deg); filter: drop-shadow(0 0 12px rgba(94,234,212,0.25)); }
.security-ring .score { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.score-num { font-size: 38px; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }
.score-lab { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.sec-note { font-size: 11.5px; color: var(--text-2); margin-top: 12px; }

.threat-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.threat-bar:last-child { margin-bottom: 0; }
.threat-bar .name { font-size: 12px; color: var(--text-2); min-width: 60px; }
.threat-bar .track { flex: 1; height: 8px; border-radius: 999px; background: rgba(255,255,255,0.07); overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,0.3); }
.threat-bar .fill { height: 100%; border-radius: 999px; box-shadow: 0 0 12px currentColor; }
.threat-bar .count { font-size: 13px; font-weight: 700; font-family: var(--font-mono); min-width: 34px; text-align: right; }

.country-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--glass-border); }
.country-row:last-child { border-bottom: none; }
.crow-left { display: flex; align-items: center; gap: 10px; }
.country-row .rank { width: 24px; height: 24px; border-radius: 5px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; background: rgba(255,255,255,0.07); color: var(--text-2); }
.country-row .rank.top { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #0b0b0f; box-shadow: 0 0 12px rgba(255,184,0,0.35); }
.country-row .flag { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; background: rgba(255,255,255,0.07); }
.country-row .name { font-size: 13px; color: var(--text); }
.country-row .count { font-size: 13px; font-weight: 700; font-family: var(--font-mono); }

.bottom-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: 22px; }
