:root {
    --teal-dark: #0e4f5c; --teal: #1a7d8f; --teal-light: #e6f3f5;
    --accent: #00b8d4; --ink: #1a1f2e; --ink-soft: #4a5568;
    --muted: #718096; --bg: #ffffff; --bg-soft: #f7fafc; --border: #e2e8f0;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--ink); background: var(--bg); line-height: 1.6; font-size: 16px; -webkit-font-smoothing: antialiased; }
a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--teal-dark); text-decoration: underline; }
.topbar { position: sticky; top: 0; z-index: 100; background: var(--bg);
    border-bottom: 1px solid var(--border); padding: 14px 32px;
    display: flex; align-items: center; gap: 24px; }
.topbar .brand { display: flex; align-items: center; }
.topbar .brand-logo { height: 28px; width: auto; display: block; }
.topbar .kb-tag { background: var(--teal-light); color: var(--teal-dark);
    padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; letter-spacing: 0.3px; }
.topbar .spacer { flex: 1; }
.topbar .search-wrap { position: relative; width: 360px; max-width: 100%; }
.topbar input[type=search] { width: 100%; padding: 8px 12px 8px 36px;
    border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
    background: var(--bg-soft) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23718096' stroke-width='2'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") no-repeat 12px center;
    transition: border-color 0.15s, background 0.15s; }
.topbar input[type=search]:focus { outline: none; border-color: var(--teal); background-color: var(--bg); }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0;
    background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08); max-height: 420px; overflow-y: auto; display: none; }
.search-results.show { display: block; }
.search-results .sr-item { padding: 10px 14px; border-bottom: 1px solid var(--border);
    cursor: pointer; display: block; color: var(--ink); }
.search-results .sr-item:last-child { border-bottom: none; }
.search-results .sr-item:hover { background: var(--bg-soft); text-decoration: none; }
.search-results .sr-title { font-weight: 600; font-size: 14px; color: var(--ink); }
.search-results .sr-cat { font-size: 12px; color: var(--muted); margin-top: 2px; }
.search-results .sr-empty { padding: 16px; color: var(--muted); font-size: 14px; text-align: center; }
.layout { display: grid; grid-template-columns: 280px 1fr; min-height: calc(100vh - 60px); }
.sidebar { background: var(--bg-soft); border-right: 1px solid var(--border);
    padding: 24px 0; overflow-y: auto; max-height: calc(100vh - 60px); position: sticky; top: 60px; }
.sidebar h4 { text-transform: uppercase; font-size: 11px; letter-spacing: 0.6px;
    color: var(--muted); margin: 18px 24px 8px; font-weight: 700; }
.sidebar a.cat-link { display: flex; align-items: center; gap: 10px;
    padding: 8px 24px; color: var(--ink-soft); font-size: 14px;
    border-left: 3px solid transparent; transition: background 0.12s, color 0.12s, border-color 0.12s; }
.sidebar a.cat-link:hover { background: var(--teal-light); color: var(--teal-dark); text-decoration: none; }
.sidebar a.cat-link.active { background: var(--teal-light); color: var(--teal-dark);
    border-left-color: var(--teal); font-weight: 600; }
.sidebar .cat-icon { font-size: 16px; width: 20px; }
.sidebar .cat-count { margin-left: auto; font-size: 12px; color: var(--muted);
    background: var(--bg); padding: 1px 8px; border-radius: 10px; }
.main { padding: 40px 56px; max-width: 1100px; }
.main.article-main { max-width: 820px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 18px;
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--teal); }
.crumbs .sep { color: var(--border); }
.hero { background: linear-gradient(135deg, var(--teal-dark) 0%, var(--teal) 100%);
    color: white; padding: 56px 56px 48px; margin: -40px -56px 40px; }
.hero h1 { font-size: 36px; margin-bottom: 12px; line-height: 1.2; }
.hero p { font-size: 17px; opacity: 0.92; max-width: 640px; }
.hero .hero-search { margin-top: 28px; max-width: 560px; position: relative; }
.hero .hero-search input { width: 100%; padding: 14px 18px 14px 46px;
    border: none; border-radius: 10px; font-size: 15px;
    background: white url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%230e4f5c' stroke-width='2'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") no-repeat 16px center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
.hero .hero-search input:focus { outline: 2px solid var(--accent); }
.hero .hero-search .search-results { color: var(--ink); }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px; margin-top: 12px; }
.cat-card { border: 1px solid var(--border); border-radius: 12px;
    padding: 22px; background: white;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    display: block; color: inherit; }
.cat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(14, 79, 92, 0.10);
    border-color: var(--teal); text-decoration: none; }
.cat-card .icon { font-size: 28px; margin-bottom: 10px; }
.cat-card h3 { font-size: 17px; color: var(--ink); margin-bottom: 6px; }
.cat-card .count { color: var(--muted); font-size: 13px; }
.article-list { display: grid; grid-template-columns: 1fr; gap: 4px; margin-top: 8px; }
.article-list a.art-item { display: flex; align-items: center; gap: 12px;
    padding: 14px 18px; border: 1px solid var(--border); border-radius: 8px;
    color: var(--ink); background: white;
    transition: border-color 0.12s, background 0.12s, transform 0.12s; }
.article-list a.art-item:hover { border-color: var(--teal); background: var(--teal-light);
    text-decoration: none; transform: translateX(2px); }
.article-list .art-arrow { margin-left: auto; color: var(--muted); }
.article-list a.art-item:hover .art-arrow { color: var(--teal-dark); }
.page-title { font-size: 30px; margin-bottom: 8px; color: var(--ink); }
.page-desc { color: var(--muted); margin-bottom: 28px; }
.article-header { margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.article-header h1 { font-size: 32px; color: var(--ink); margin-bottom: 12px; line-height: 1.25; }
.article-meta { display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
    font-size: 13px; color: var(--muted); }
.article-meta .src-link { color: var(--teal); }
.keywords { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.keywords .kw { background: var(--bg-soft); color: var(--ink-soft);
    padding: 3px 9px; border-radius: 10px; font-size: 11px; border: 1px solid var(--border); }
.article-body { font-size: 16px; color: var(--ink); }
.article-body h1, .article-body h2, .article-body h3, .article-body h4 {
    margin-top: 28px; margin-bottom: 12px; line-height: 1.3; color: var(--ink); }
.article-body h1 { font-size: 24px; }
.article-body h2 { font-size: 21px; }
.article-body h3 { font-size: 18px; }
.article-body h4 { font-size: 16px; }
.article-body p { margin-bottom: 14px; }
.article-body ul, .article-body ol { margin: 0 0 16px 22px; }
.article-body li { margin-bottom: 6px; }
.article-body code { background: var(--bg-soft); padding: 1px 6px; border-radius: 4px;
    font-size: 0.92em; border: 1px solid var(--border); }
.article-body pre { background: var(--bg-soft); padding: 14px 16px; border-radius: 8px;
    overflow-x: auto; border: 1px solid var(--border); margin-bottom: 16px; }
.article-body pre code { border: none; padding: 0; background: transparent; }
.article-body blockquote { border-left: 3px solid var(--teal); padding: 6px 14px;
    background: var(--teal-light); color: var(--ink-soft); margin-bottom: 16px; border-radius: 0 6px 6px 0; }
.article-body img { max-width: 100%; height: auto; border-radius: 6px; margin: 10px 0; }
.article-body a { word-break: break-word; }
.article-body table { border-collapse: collapse; margin: 14px 0; width: 100%; }
.article-body th, .article-body td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.article-body th { background: var(--bg-soft); font-weight: 600; }
.article-nav { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border);
    display: flex; gap: 12px; flex-wrap: wrap; }
.article-nav a { flex: 1; min-width: 200px; border: 1px solid var(--border);
    border-radius: 8px; padding: 14px 16px; color: var(--ink);
    transition: border-color 0.12s, background 0.12s; }
.article-nav a:hover { border-color: var(--teal); background: var(--teal-light); text-decoration: none; }
.article-nav .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.article-nav .title { font-weight: 600; margin-top: 4px; color: var(--ink); }
.article-nav .next { text-align: right; }
.footer { border-top: 1px solid var(--border); padding: 28px 56px;
    color: var(--muted); font-size: 13px; background: var(--bg-soft); text-align: center; }
@media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar { position: static; max-height: none; border-right: none; border-bottom: 1px solid var(--border); }
    .main { padding: 24px; }
    .hero { padding: 36px 24px; margin: -24px -24px 24px; }
    .hero h1 { font-size: 26px; }
    .topbar { padding: 12px 16px; gap: 12px; }
    .topbar .search-wrap { width: auto; flex: 1; }
    .topbar .kb-tag { display: none; }
    .footer { padding: 20px 24px; }
}
