:root {
  --primary: #4F46E5;
  --primary-dark: #4338CA;
  --text: #1F2937;
  --text-light: #6B7280;
  --bg: #F9FAFB;
  --card-bg: #FFFFFF;
  --border: #E5E7EB;
  --danger: #DC2626;
  --warning: #F59E0B;
  --success: #10B981;
  --radius: 12px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); line-height: 1.7; }
.header { background: var(--card-bg); border-bottom: 1px solid var(--border); padding: 1rem 2rem; position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow); }
.header-container { max-width: 1280px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; }
.logo { font-size: 1.5rem; font-weight: 800; color: var(--primary); text-decoration: none; }
.nav-links { display: flex; gap: 1.5rem; }
.nav-links a { color: var(--text); text-decoration: none; font-weight: 500; font-size: 0.95rem; transition: color 0.2s; }
.nav-links a:hover { color: var(--primary); }
.container { max-width: 1280px; margin: 2rem auto; padding: 0 1.5rem; display: flex; gap: 3rem; }
.toc-desktop { width: 260px; flex-shrink: 0; position: sticky; top: 100px; align-self: flex-start; max-height: calc(100vh - 120px); overflow-y: auto; }
.toc-desktop h3 { font-size: 0.9rem; text-transform: uppercase; color: var(--text-light); margin-bottom: 1rem; letter-spacing: 0.05em; }
.toc-desktop ul { list-style: none; }
.toc-desktop li { margin-bottom: 0.5rem; }
.toc-desktop a { color: var(--text-light); text-decoration: none; font-size: 0.9rem; display: block; padding: 0.25rem 0.5rem; border-left: 2px solid transparent; transition: all 0.2s; }
.toc-desktop a:hover, .toc-desktop a.active { color: var(--primary); border-left-color: var(--primary); background: rgba(79, 70, 229, 0.05); }
.main-content { flex-grow: 1; max-width: 850px; }
.toc-mobile { display: none; margin-bottom: 2rem; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.toc-mobile summary { font-weight: 600; cursor: pointer; color: var(--primary); }
.hero { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; margin-bottom: 2rem; box-shadow: var(--shadow); }
.hero h1 { font-size: 2.25rem; margin-bottom: 0.5rem; color: var(--text); }
.hero p { color: var(--text-light); font-size: 1.1rem; }
.meta { font-size: 0.85rem; color: var(--text-light); margin-top: 1rem; display: flex; gap: 1.5rem; flex-wrap: wrap; }
.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: var(--shadow); }
.card h2 { font-size: 1.5rem; margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); color: var(--primary-dark); }
.card h3 { font-size: 1.1rem; margin: 1rem 0 0.5rem; color: var(--text); }
.card p, .card li { margin-bottom: 0.75rem; color: var(--text); }
.card ul, .card ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.mini-card { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; text-align: center; }
.mini-card strong { display: block; color: var(--primary); margin-bottom: 0.25rem; }
.mini-card span { font-size: 0.85rem; color: var(--text-light); }
.alert { padding: 1rem 1.5rem; border-radius: 8px; margin-bottom: 1.5rem; border-left: 4px solid; }
.alert-danger { background: #FEF2F2; border-color: var(--danger); color: #991B1B; }
.alert-warning { background: #FFFBEB; border-color: var(--warning); color: #92400E; }
.alert-info { background: #EFF6FF; border-color: #3B82F6; color: #1E40AF; }
.steps { display: flex; justify-content: space-between; margin: 2rem 0; position: relative; }
.steps::before { content: ''; position: absolute; top: 15px; left: 0; width: 100%; height: 2px; background: var(--border); z-index: 0; }
.step { position: relative; z-index: 1; text-align: center; background: var(--bg); padding: 0 0.5rem; }
.step-num { width: 32px; height: 32px; background: var(--primary); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 0.5rem; font-weight: bold; font-size: 0.9rem; }
.step-text { font-size: 0.85rem; font-weight: 600; }
.footer { background: var(--card-bg); border-top: 1px solid var(--border); padding: 3rem 2rem; margin-top: 4rem; }
.footer-container { max-width: 1280px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem; }
.footer h4 { font-size: 1rem; margin-bottom: 1rem; color: var(--text); }
.footer ul { list-style: none; }
.footer li { margin-bottom: 0.5rem; }
.footer a { color: var(--text-light); text-decoration: none; font-size: 0.9rem; }
.footer a:hover { color: var(--primary); }
.footer-bottom { max-width: 1280px; margin: 2rem auto 0; padding-top: 1.5rem; border-top: 1px solid var(--border); text-align: center; color: var(--text-light); font-size: 0.85rem; }
@media (max-width: 1024px) {
  .toc-desktop { display: none; }
  .toc-mobile { display: block; }
  .container { flex-direction: column; }
}
@media (max-width: 640px) {
  .nav-links { display: none; }
  .hero h1 { font-size: 1.75rem; }
  .steps { flex-direction: column; gap: 1rem; }
  .steps::before { display: none; }
}

/* --- Improvements v2 --- */
.card h2, .card h3 {
  scroll-margin-top: 100px;
}
.footer a, .card a {
  overflow-wrap: break-word;
  word-wrap: break-word;
}
@media print {
  .header, .footer, .toc-desktop, .toc-mobile {
    display: none !important;
  }
  .container {
    display: block;
    max-width: 100%;
  }
  .card {
    box-shadow: none;
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }
}
