/* ═══ 优引GEO AI监测控制台 · 主题 ═══ */
:root {
  --bg: #0a0a16;
  --bg-soft: #0d0d1c;
  --sidebar: #0d0d1c;
  --card: #131324;
  --card-hover: #191933;
  --border: #24243c;
  --border-soft: #1c1c30;
  --text: #e4e4ef;
  --text-2: #9a9ab4;
  --text-3: #636380;
  --accent: #8B5CF6;
  --accent-2: #6366F1;
  --indigo: #6366F1;
  --pink: #EC4899;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --accent-glow: rgba(139, 92, 246, 0.16);
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
  --mono: "SF Mono", "Fira Code", "JetBrains Mono", monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  line-height: 1.55; min-height: 100vh; display: flex; overflow-x: hidden;
}
::selection { background: var(--accent); color: #fff; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #34345c; }

/* ── Sidebar ── */
.sidebar {
  width: 232px; flex: 0 0 232px; background: var(--sidebar);
  border-right: 1px solid var(--border-soft); height: 100vh;
  position: sticky; top: 0; display: flex; flex-direction: column;
  z-index: 30; transition: transform 0.3s ease;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; padding: 18px 16px;
  border-bottom: 1px solid var(--border-soft);
}
.brand-mark {
  width: 38px; height: 38px; flex: 0 0 38px; border-radius: 10px;
  display: block; object-fit: contain;
  box-shadow: 0 0 0 1px rgba(94, 234, 212, 0.22), 0 8px 22px rgba(56, 189, 248, 0.14);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 0.98rem; letter-spacing: 0.5px; }
.brand-text span { font-size: 0.7rem; color: var(--text-3); }

.side-nav { flex: 1; overflow-y: auto; padding: 10px 8px 16px; }
.nav-group { margin-bottom: 8px; }
.nav-group-title {
  font-size: 0.66rem; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--text-3); padding: 12px 10px 6px; font-family: var(--mono);
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin-bottom: 2px; border-radius: 8px;
  color: var(--text-2); font-size: 0.86rem; cursor: pointer;
  transition: all 0.18s ease; border: 1px solid transparent;
}
.nav-item:hover { background: var(--card); color: var(--text); }
.nav-item.active {
  background: var(--accent-glow); color: var(--text);
  border-color: rgba(139, 92, 246, 0.25);
}
.nav-item .nav-icon {
  width: 18px; text-align: center; color: var(--text-3); font-size: 0.9rem;
  transition: color 0.18s;
}
.nav-item.active .nav-icon { color: var(--accent); }

.sidebar-footer { padding: 12px 14px; border-top: 1px solid var(--border-soft); }
.sys-status { display: flex; align-items: center; gap: 7px; font-size: 0.78rem; color: var(--text-2); }
.sys-meta { font-size: 0.68rem; color: var(--text-3); margin-top: 4px; font-family: var(--mono); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: var(--text-3); }
.dot.on { background: var(--green); box-shadow: 0 0 6px rgba(34,197,94,0.7); }
.dot.warn { background: var(--amber); box-shadow: 0 0 6px rgba(245,158,11,0.7); }

/* ── Main ── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 58px; flex: 0 0 58px; display: flex; align-items: center; gap: 14px;
  padding: 0 24px; border-bottom: 1px solid var(--border-soft);
  background: rgba(10,10,22,0.85); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 20;
}
.crumb { font-size: 0.86rem; color: var(--text-2); }
.crumb b { color: var(--text); font-weight: 600; }
.icon-btn {
  display: none; background: none; border: 1px solid var(--border); color: var(--text-2);
  border-radius: 8px; width: 36px; height: 36px; font-size: 1.05rem; cursor: pointer;
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.live-badge {
  font-size: 0.72rem; font-family: var(--mono); letter-spacing: 1px;
  color: var(--green); display: flex; align-items: center; gap: 6px;
  border: 1px solid rgba(34,197,94,0.3); padding: 4px 10px; border-radius: 999px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  font-size: 0.84rem; padding: 8px 14px; border-radius: 8px; cursor: pointer;
  transition: all 0.18s ease; font-family: var(--font);
}
.btn:hover { border-color: var(--accent); color: var(--text); }
.btn-primary { background: linear-gradient(120deg, var(--indigo), var(--accent)); border: none; color: #fff; font-weight: 600; }
.btn-primary:hover { filter: brightness(1.1); color: #fff; }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.btn-danger { border-color: rgba(239,68,68,0.4); color: var(--red); }
.btn-danger:hover { border-color: var(--red); }

/* ── Content ── */
.content { flex: 1; padding: 24px; max-width: 1200px; width: 100%; margin: 0 auto; }
.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: 1.45rem; font-weight: 650; letter-spacing: -0.3px; }
.page-head p { color: var(--text-2); font-size: 0.88rem; margin-top: 4px; }
.page-head .sub-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

/* ── Stat tiles ── */
.tile-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.tile {
  background: var(--card); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 16px 18px; position: relative; overflow: hidden;
}
.tile .tile-label { font-size: 0.72rem; color: var(--text-3); font-family: var(--mono); letter-spacing: 0.5px; }
.tile .tile-value { font-size: 1.7rem; font-weight: 700; margin-top: 6px; line-height: 1.1; }
.tile .tile-value.grad { background: linear-gradient(120deg, var(--indigo), var(--accent), var(--pink)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.tile .tile-delta { font-size: 0.75rem; margin-top: 4px; font-family: var(--mono); }
.tile .tile-delta.up { color: var(--green); }
.tile .tile-delta.down { color: var(--red); }
.tile .tile-bar { height: 3px; border-radius: 2px; margin-top: 12px; background: linear-gradient(90deg, var(--indigo), var(--accent), var(--pink)); opacity: 0.7; }

/* ── Cards ── */
.card {
  background: var(--card); border: 1px solid var(--border-soft); border-radius: var(--radius);
  margin-bottom: 18px; overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
}
.card-head h3 { font-size: 0.95rem; font-weight: 600; }
.card-head .hint { font-size: 0.72rem; color: var(--text-3); margin-left: auto; font-family: var(--mono); }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }

/* ── Charts ── */
.chart-wrap { position: relative; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; font-size: 0.75rem; color: var(--text-2); }
.chart-legend .lg { display: flex; align-items: center; gap: 6px; }
.chart-legend .lg i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.tbl th {
  text-align: left; padding: 10px 14px; font-size: 0.72rem; font-weight: 500;
  color: var(--text-3); font-family: var(--mono); letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: rgba(255,255,255,0.015); }
.tbl .mono { font-family: var(--mono); font-size: 0.8rem; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 0.72rem; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-2); white-space: nowrap; }
.badge.green { color: var(--green); border-color: rgba(34,197,94,0.35); background: rgba(34,197,94,0.08); }
.badge.red { color: var(--red); border-color: rgba(239,68,68,0.35); background: rgba(239,68,68,0.08); }
.badge.amber { color: var(--amber); border-color: rgba(245,158,11,0.35); background: rgba(245,158,11,0.08); }
.badge.violet { color: var(--accent); border-color: rgba(139,92,246,0.35); background: var(--accent-glow); }
.badge.pink { color: var(--pink); border-color: rgba(236,72,153,0.35); background: rgba(236,72,153,0.08); }

/* progress bars */
.pbar { background: var(--border-soft); height: 6px; border-radius: 3px; overflow: hidden; min-width: 90px; }
.pbar > i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--indigo), var(--accent)); }
.pbar > i.pink { background: linear-gradient(90deg, var(--accent), var(--pink)); }
.pbar > i.green { background: linear-gradient(90deg, var(--green), #4ade80); }

/* ── Grid layouts ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }

/* engine chips */
.engine-row { display: flex; flex-wrap: wrap; gap: 8px; }
.engine-chip {
  font-family: var(--mono); font-size: 0.78rem; padding: 6px 12px;
  border: 1px solid var(--border); border-radius: 999px; color: var(--text-2);
  display: inline-flex; align-items: center; gap: 6px;
}
.engine-chip.ok { border-color: rgba(34,197,94,0.3); color: var(--green); }
.engine-chip.fail { border-color: rgba(239,68,68,0.3); color: var(--red); }

/* scenario cards */
.scenario-card { border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--card); padding: 16px; }
.scenario-card h4 { font-size: 0.92rem; margin-bottom: 10px; }
.scenario-card .q { font-size: 0.8rem; color: var(--text-3); margin-bottom: 12px; font-style: italic; }

/* mention list */
.mention-list { display: flex; flex-direction: column; gap: 10px; }
.mention-item {
  border: 1px solid var(--border-soft); border-radius: 8px; padding: 12px 14px;
  background: rgba(255,255,255,0.01);
}
.mention-item .mi-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.mention-item .mi-src { font-size: 0.8rem; font-weight: 600; }
.mention-item .mi-text { font-size: 0.82rem; color: var(--text-2); line-height: 1.55; }

/* forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 0.78rem; color: var(--text-2); }
.form-group .req { color: var(--pink); }
input[type=text], input[type=url], input[type=number], input[type=password], select, textarea {
  background: var(--bg-soft); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 9px 12px; font-size: 0.85rem; font-family: var(--font);
  outline: none; transition: border-color 0.18s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
select { cursor: pointer; }
textarea { resize: vertical; min-height: 80px; }

/* toggle switch */
.switch { position: relative; width: 40px; height: 22px; flex: 0 0 40px; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .sl {
  position: absolute; inset: 0; background: var(--border); border-radius: 999px; transition: 0.2s;
}
.switch .sl::before {
  content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  left: 3px; top: 3px; background: #fff; transition: 0.2s;
}
.switch input:checked + .sl { background: var(--accent); }
.switch input:checked + .sl::before { transform: translateX(18px); }

/* task list */
.task-item { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--border-soft); }
.task-item:last-child { border-bottom: none; }
.task-item .ti-name { font-size: 0.88rem; font-weight: 500; }
.task-item .ti-type { font-size: 0.72rem; color: var(--text-3); font-family: var(--mono); }
.task-item .ti-meta { margin-left: auto; text-align: right; display: flex; flex-direction: column; gap: 3px; }
.task-item .ti-next { font-size: 0.72rem; color: var(--text-3); font-family: var(--mono); }

/* empty / loading */
.empty { text-align: center; padding: 48px 20px; color: var(--text-3); font-size: 0.88rem; }
.loading { text-align: center; padding: 60px; color: var(--text-3); }
.spinner {
  width: 26px; height: 26px; border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.9s linear infinite; margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* toast */
.toast-wrap { position: fixed; top: 70px; right: 24px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--card); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 8px; padding: 11px 16px; font-size: 0.84rem; color: var(--text);
  box-shadow: 0 10px 30px rgba(0,0,0,0.4); animation: toast-in 0.25s ease;
  max-width: 340px;
}
.toast.good { border-left-color: var(--green); }
.toast.warn { border-left-color: var(--amber); }
.toast.err { border-left-color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* scrim (mobile) */
.scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 25; }
.scrim.show { display: block; }

/* ── Responsive ── */
@media (max-width: 1100px) {
  .tile-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); box-shadow: 0 0 40px rgba(0,0,0,0.5); }
  .sidebar.open { transform: none; }
  .icon-btn { display: inline-flex; }
  .grid-2, .grid-2-1 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; }
  .content { padding: 16px; }
}
@media (max-width: 560px) {
  .tile-grid, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .live-badge { display: none; }
}
