:root {
  --bg: #fafafa;
  --bg-sidebar: #fff;
  --text: #1a1a2e;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --code-bg: #f1f5f9;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --bg-sidebar: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --code-bg: #1e293b;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}

.logo-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.nav-section {
  margin-bottom: 24px;
}

.nav-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.nav-links {
  list-style: none;
}

.nav-links a {
  display: block;
  padding: 8px 12px;
  color: var(--text);
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: background 0.15s;
}

.nav-links a:hover,
.nav-links a.active {
  background: var(--accent);
  color: #fff;
}

.main {
  padding: 48px 64px;
  max-width: 900px;
}

h1 {
  font-size: 2.25rem;
  font-weight: 700;
  margin-bottom: 16px;
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 40px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 24px 0 12px;
}

p { margin-bottom: 16px; }

.lead {
  font-size: 1.125rem;
  color: var(--text-muted);
  margin-bottom: 32px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 24px;
  font-size: 0.9rem;
}

th, td {
  text-align: left;
  padding: 12px;
  border: 1px solid var(--border);
}

th {
  background: var(--code-bg);
  font-weight: 600;
}

tr:hover { background: var(--code-bg); }

code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

pre {
  background: var(--code-bg);
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 16px 0;
}

pre code {
  background: none;
  padding: 0;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }

@media (prefers-color-scheme: dark) {
  .badge-success { background: #064e3b; color: #6ee7b7; }
  .badge-warning { background: #78350f; color: #fcd34d; }
  .badge-danger { background: #7f1d1d; color: #fca5a5; }
  .badge-info { background: #1e3a5f; color: #93c5fd; }
}

.card {
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin: 16px 0;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.stat {
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
}

.tier-badge::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.img-preview {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin: 16px 0;
}

.alert {
  padding: 16px 20px;
  border-radius: 8px;
  margin: 16px 0;
  border-left: 4px solid;
}

.alert-danger {
  background: #fee2e2;
  border-color: var(--danger);
  color: #991b1b;
}

.alert-warning {
  background: #fef3c7;
  border-color: var(--warning);
  color: #92400e;
}

.alert-success {
  background: #d1fae5;
  border-color: var(--success);
  color: #065f46;
}

@media (prefers-color-scheme: dark) {
  .alert-danger { background: #450a0a; color: #fca5a5; }
  .alert-warning { background: #451a03; color: #fcd34d; }
  .alert-success { background: #052e16; color: #6ee7b7; }
}

ul, ol {
  margin: 16px 0;
  padding-left: 24px;
}

li { margin: 8px 0; }

.footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .main {
    padding: 24px;
  }
}
