/* PCBChecking — mobile-first, CSS thuần. */
:root {
    --bg: #ffffff; --fg: #1a1a1a; --muted: #666; --border: #ddd;
    --accent: #0b6e4f; --accent-fg: #fff; --code-bg: #f6f8fa;
    --table-stripe: #f6f8fa; --alert-note: #0969da; --alert-tip: #1a7f37;
    --alert-important: #8250df; --alert-warning: #9a6700; --alert-caution: #cf222e;
    --mono: "Cascadia Mono", Consolas, "DejaVu Sans Mono", monospace;
}
[data-theme="dark"] {
    --bg: #0d1117; --fg: #e6edf3; --muted: #8b949e; --border: #30363d;
    --accent: #2da44e; --code-bg: #161b22; --table-stripe: #161b22;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0d1117; --fg: #e6edf3; --muted: #8b949e; --border: #30363d;
        --accent: #2da44e; --code-bg: #161b22; --table-stripe: #161b22;
    }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg);
    font-family: system-ui, "Segoe UI", Roboto, Arial, sans-serif; line-height: 1.65; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; gap: .5rem; align-items: center;
    padding: .6rem 1rem; background: var(--bg); border-bottom: 1px solid var(--border); }
.brand { font-weight: 700; color: var(--accent); text-decoration: none; white-space: nowrap; }
.board-code { font-family: var(--mono); background: var(--code-bg); border: 1px solid var(--border);
    border-radius: 6px; padding: 0 .5rem; white-space: nowrap; }
.board-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted);
    font-size: .9rem; flex: 1; min-width: 0; }
.icon-btn { margin-left: auto; background: none; border: 1px solid var(--border); border-radius: 6px;
    color: var(--fg); padding: .2rem .6rem; cursor: pointer; }
.container { max-width: 960px; margin: 0 auto; padding: 1rem; }
.muted { color: var(--muted); }
.notice { background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; }

/* Trang chủ */
.lookup { display: flex; gap: .5rem; margin: 1rem 0; }
.lookup input { flex: 1; min-width: 0; padding: .7rem .8rem; font-size: 1.05rem;
    border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--fg); }
.lookup button, .btn { padding: .7rem 1.2rem; font-size: 1rem; border-radius: 8px; cursor: pointer;
    border: 1px solid var(--accent); background: var(--accent); color: var(--accent-fg);
    text-decoration: none; display: inline-block; }
.btn:not(.primary) { background: transparent; color: var(--accent); }
.board-list { columns: 2; }
.board-list a { font-family: var(--mono); }

/* Tabs */
.tabs { display: flex; gap: .5rem; margin-bottom: 1rem; }
.tab { flex: 1; padding: .7rem; font-size: 1rem; border: 1px solid var(--border); border-radius: 8px;
    background: var(--bg); color: var(--fg); cursor: pointer; }
.tab.active { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }

/* Mục lục */
.toc-toggle { display: inline-block; margin-bottom: .5rem; padding: .4rem .9rem;
    border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--fg); }
.toc { border: 1px solid var(--border); border-radius: 8px; padding: .5rem 1rem; margin-bottom: 1rem;
    background: var(--bg); }
.toc ul { margin: .3rem 0; padding-left: 1.2rem; }
.toc-lvl3 { margin-left: 1rem; font-size: .93em; }
@media (min-width: 1100px) {
    .toc-toggle { display: none; }
    .toc { display: block !important; position: sticky; float: right; width: 260px;
        margin-left: 1rem; top: 70px; max-height: 70vh; overflow: auto; }
}

/* Nội dung readme */
.readme img { max-width: 100%; height: auto; }
.readme a { color: var(--accent); }
.table-scroll { overflow-x: auto; margin: 1rem 0; border: 1px solid var(--border); border-radius: 8px; }
.readme table { border-collapse: collapse; width: 100%; min-width: 560px; }
.readme th, .readme td { border: 1px solid var(--border); padding: .45rem .6rem; }
.readme thead th { position: sticky; top: 0; background: var(--code-bg); }
.readme tbody tr:nth-child(even) { background: var(--table-stripe); }
.readme pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px;
    padding: 1em; overflow-x: auto; position: relative; }
.readme pre code { font-family: var(--mono); font-size: .85rem; white-space: pre;
    word-break: normal; background: none; }
.readme :not(pre) > code { font-family: var(--mono); font-size: .88em; background: var(--code-bg);
    border: 1px solid var(--border); border-radius: 4px; padding: 0 .3em;
    word-break: break-all; } /* inline code chứa path Windows dài */
.copy-btn { position: absolute; top: .4rem; right: .4rem; font-size: .75rem; padding: .2rem .5rem;
    border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--fg);
    cursor: pointer; opacity: .8; }
/* Alert GitHub kiểu callout */
.markdown-alert { border: 1px solid var(--border); border-left: 4px solid var(--alert-note);
    border-radius: 8px; padding: .6rem 1rem; margin: 1rem 0; }
.markdown-alert-title { font-weight: 700; display: flex; gap: .4rem; align-items: center; }
.markdown-alert-note { border-left-color: var(--alert-note); }
.markdown-alert-tip { border-left-color: var(--alert-tip); }
.markdown-alert-important { border-left-color: var(--alert-important); }
.markdown-alert-warning { border-left-color: var(--alert-warning); }
.markdown-alert-caution { border-left-color: var(--alert-caution); }
.math { white-space: nowrap; }
hr { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* PDF */
.pdf-actions { display: flex; gap: .5rem; margin-bottom: .8rem; flex-wrap: wrap; }
.pdf-actions .btn { flex: 1; text-align: center; min-width: 140px; }
.pdf-frame { width: 100%; min-height: 80vh; border: 1px solid var(--border); border-radius: 8px; }
@media (max-width: 600px) {
    .pdf-frame { min-height: 50vh; }
}
.footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 1.5rem 1rem 2rem; }
.error-page { text-align: center; padding: 2rem 0; }

@media print {
    .topbar, .tabs, .toc-toggle, .toc, .copy-btn, .pdf-actions, .icon-btn { display: none !important; }
    .container { max-width: none; }
    body { background: #fff; color: #000; }
}
