
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #1f2937;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --accent-light: #eff6ff;
  --card-bg: #ffffff;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-serif: "Noto Serif SC", "Source Han Serif SC", Georgia, serif;
  --sidebar-w: 320px;
}
[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #334155;
  --accent: #3b82f6;
  --accent-light: #1e3a8a;
  --card-bg: #1e293b;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  display: flex;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  padding: 1.5rem 1rem;
  flex-shrink: 0;
}
.side-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.25rem; }
.side-sub { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 1.25rem; }
.side-nav-group { margin-bottom: 1.5rem; }
.side-nav-head { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); font-weight: 600; margin-bottom: 0.5rem; padding-left: 0.5rem; }
.side-nav-link { display: block; padding: 0.45rem 0.65rem; border-radius: 6px; font-size: 0.9rem; color: var(--text); margin-bottom: 2px; }
.side-nav-link:hover { background: var(--accent-light); text-decoration: none; color: var(--accent); }
.side-nav-link.active { background: var(--accent); color: #fff !important; font-weight: 600; }

/* Main Content */
.content-wrap {
  flex-grow: 1;
  padding: 2.5rem 3.5rem;
  max-width: 1050px;
  margin: 0 auto;
}
.portal-hero {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}
.portal-hero h1 { font-size: 2.2rem; margin-bottom: 0.75rem; color: var(--text); }
.portal-hero p { font-size: 1.1rem; color: var(--text-muted); }

/* Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s, border-color 0.15s;
}
.card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  text-decoration: none;
}
.card-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.card-title { font-size: 1.2rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--text); }
.card-desc { font-size: 0.88rem; color: var(--text-muted); flex-grow: 1; margin-bottom: 1rem; }
.card-meta { font-size: 0.8rem; color: var(--accent); font-weight: 600; }

/* Markdown Typography */
.md-body h1 { font-size: 1.85rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
.md-body h2 { font-size: 1.45rem; margin-top: 1.75rem; margin-bottom: 0.75rem; color: var(--text); }
.md-body h3 { font-size: 1.15rem; margin-top: 1.25rem; margin-bottom: 0.5rem; }
.md-body p { margin-bottom: 1rem; }
.md-body ul, .md-body ol { margin-bottom: 1rem; padding-left: 1.5rem; }
.md-body li { margin-bottom: 0.35rem; }
.md-body blockquote {
  border-left: 4px solid var(--accent);
  padding: 0.75rem 1rem;
  background: var(--accent-light);
  margin-bottom: 1.25rem;
  border-radius: 0 6px 6px 0;
  color: var(--text);
}
.md-body img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin: 1rem 0;
  background: #fff;
  display: block;
}
.md-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}
.md-body th, .md-body td {
  border: 1px solid var(--border);
  padding: 0.65rem 0.85rem;
  text-align: left;
}
.md-body th { background: var(--surface); }

/* Table & Explorer Specific */
.filter-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.search-input {
  flex-grow: 1;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
}
.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  background: var(--accent-light);
  color: var(--accent);
}
.badge-pass { background: #dcfce7; color: #15803d; }
.badge-flagged { background: #fef3c7; color: #b45309; }
.badge-blocked { background: #fee2e2; color: #b91c1c; }

/* Responsive */
@media (max-width: 860px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .content-wrap { padding: 1.5rem 1rem; }
}
