:root {
  --bg: #f5f6f8;
  --sidebar-bg: #ffffff;
  --panel-bg: #ffffff;
  --text: #1a1d23;
  --text-muted: #6b7280;
  --text-dim: #9ca3af;
  --border: #e5e7eb;
  --border-light: #f1f2f4;
  --accent: #f6821f;
  --accent-hover: #e5741a;
  --accent-soft: #fef3e7;
  --purple: #8b5cf6;
  --purple-soft: #f3eeff;
  --green: #10b981;
  --green-soft: #e6f7f1;
  --blue: #3b82f6;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.06);
}

[data-theme="dark"] {
  --bg: #0f1115;
  --sidebar-bg: #161920;
  --panel-bg: #1a1e26;
  --text: #e5e7eb;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  --border: #2a2f3a;
  --border-light: #232832;
  --accent-soft: #3a2410;
  --purple-soft: #2a2140;
  --green-soft: #13332a;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 6px 18px;
}
.brand-logo {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--accent);
  display: grid; place-items: center;
}
.brand-logo svg { width: 16px; height: 16px; }
.brand-name { font-weight: 700; font-size: 15px; flex: 1; }
.theme-toggle {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); width: 28px; height: 28px;
  border-radius: 6px; cursor: pointer;
  display: grid; place-items: center;
}
.theme-toggle:hover { color: var(--text); border-color: var(--text-muted); }

.nav-section {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
  padding: 14px 10px 6px;
  font-weight: 600;
}
.nav-group { display: flex; flex-direction: column; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s;
}
.nav-item:hover { background: var(--border-light); color: var(--text); }
.nav-item.active { color: var(--text); font-weight: 600; }
.nav-item.active .dot { background: var(--accent); }
.nav-item .icon { font-size: 14px; }
.nav-item .dot {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--text-dim);
}
.nav-item .check { color: var(--accent); font-weight: 700; font-size: 11px; }
.nav-item .count {
  margin-left: auto;
  background: var(--border-light);
  color: var(--text-muted);
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}

.sidebar-footer { margin-top: auto; padding-top: 16px; }
.mini-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 6px; margin-bottom: 10px;
  background: var(--border-light);
  padding: 10px 6px;
  border-radius: 8px;
}
.mini-stats div { text-align: center; }
.mini-stats strong { display: block; font-size: 14px; font-weight: 700; }
.mini-stats span { font-size: 9px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; }

/* Main */
.main {
  flex: 1;
  padding: 36px 48px;
  max-width: 1180px;
}

.hero h1 {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.hero .accent { color: var(--accent); }
.hero p {
  color: var(--text-muted);
  max-width: 620px;
  margin-bottom: 20px;
}
.hero-actions { display: flex; gap: 10px; margin-bottom: 32px; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 9px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.btn-secondary:hover { border-color: var(--text-muted); }
.btn-block { width: 100%; }

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 24px;
}
.stat {
  padding: 18px 20px;
  border-right: 1px solid var(--border);
  text-align: left;
}
.stat:last-child { border-right: none; }
.stat-val { font-size: 22px; font-weight: 700; }
.stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}
.panel { display: flex; flex-direction: column; gap: 16px; }
.panel-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--accent); font-weight: 700;
}

.card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 22px 18px;
  transition: transform .15s, box-shadow .15s, border-color .15s;
  position: relative;
}
.card.featured { border-top: 3px solid var(--accent); }
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}
.card-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.pv {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  display: flex; align-items: baseline; gap: 4px;
}
.pv-label { font-size: 9px; color: var(--text-dim); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.card-id {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: .02em;
}
.card-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.35;
  letter-spacing: -0.005em;
  color: var(--text);
  word-break: break-word;
}
.card-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.7;
  word-break: break-word;
}
.card-desc .feat {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: grid;
  gap: 6px;
}
.card-desc .feat li {
  position: relative;
  padding-left: 14px;
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--text-muted);
}
.card-desc .feat li::before {
  content: "";
  position: absolute;
  left: 2px; top: 8px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent);
}
.card-desc .feat b {
  color: var(--text);
  font-weight: 600;
}
.card-desc code {
  background: var(--border-light);
  color: var(--text);
  font-family: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 4px;
}
.card-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 14px; padding-top: 12px; border-top: 1px dashed var(--border-light); }
.chip {
  background: var(--border-light);
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 500;
  padding: 4px 9px;
  border-radius: 5px;
  letter-spacing: .01em;
}
.chip-link {
  text-decoration: none;
  transition: background .15s, color .15s;
}
.chip-link:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.card-open {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.card-open:hover { text-decoration: underline; }

/* Type breakdown */
.type-breakdown {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
}
.type-title {
  font-size: 10px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-dim); font-weight: 600; margin-bottom: 12px;
}
.bar-row {
  display: grid;
  grid-template-columns: 70px 1fr 24px;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text);
}
.bar-row > span:last-child { color: var(--text-dim); text-align: right; font-size: 11px; }
.bar {
  height: 4px; background: var(--border-light); border-radius: 2px; overflow: hidden;
}
.bar-fill { height: 100%; background: var(--purple); border-radius: 2px; }
.bar-orange { background: var(--accent); }
.bar-blue { background: var(--blue); }

/* Info cards */
.info-card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
}
.info-icon { font-size: 20px; margin-bottom: 10px; }
.info-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.info-card p { font-size: 12.5px; color: var(--text-muted); margin-bottom: 12px; line-height: 1.6; }
.link-orange {
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--accent);
  padding: 5px 12px;
  border-radius: 6px;
  display: inline-block;
  transition: background .15s;
}
.link-orange:hover { background: var(--accent); color: #fff; }

/* Intro card */
.intro-card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px 24px;
  margin-bottom: 28px;
  max-width: 820px;
}
.intro-card .info-icon { font-size: 22px; margin-bottom: 10px; }
.intro-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.intro-card p { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; line-height: 1.6; }

/* Registry */
.registry { margin-bottom: 40px; }
.registry-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.registry-header h2 { font-size: 18px; font-weight: 700; }
.search input {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  width: 280px;
  outline: none;
  font-family: inherit;
}
.search input:focus { border-color: var(--accent); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

/* Footer */
.foot {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text-dim);
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

@media (max-width: 960px) {
  .sidebar { display: none; }
  .main { padding: 24px; }
  .grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat { border-right: none; border-bottom: 1px solid var(--border); }
}
