:root {
  --blue: #24578f;
  --blue2: #173f6b;
  --blue-soft: #eaf2fb;
  --green: #087443;
  --orange: #c95d0b;
  --red: #b42318;
  --line: #dce5ef;
  --text: #1d2d43;
  --muted: #64748b;
  --bg: #f3f5f7;
  --panel: #fff;
  --paper: #fbfaf6;
  --shadow: 0 10px 28px rgba(30, 58, 90, .08);
  --radius: 12px;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 'Roboto', sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid rgba(36, 87, 143, .32); outline-offset: 2px; }

.topbar { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; position: sticky; top: 0; z-index: 30; padding: 10px 22px; background: rgba(255, 255, 255, .94); border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 rgba(30, 58, 90, .05); backdrop-filter: saturate(1.3) blur(8px); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 10px; object-fit: contain; }
.topbar h1 { margin: 0; color: var(--blue); font-size: 17px; font-weight: 800; line-height: 1.25; }
.topbar .links { display: flex; gap: 8px; flex-wrap: wrap; }
.topbar a, .topbar .lang { display: inline-flex; height: 38px; align-items: center; gap: 6px; padding: 0 15px; color: #fff; background: var(--blue); border: 1px solid var(--blue); border-radius: 9px; font-size: 13px; font-weight: 700; text-decoration: none; cursor: pointer; }
.topbar a.ghost, .topbar .lang { color: var(--blue); background: #fff; border-color: #cbd9e8; }

.container { max-width: 1800px; margin: 0 auto; padding: 18px 18px 40px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.tabs a { display: inline-flex; min-height: 38px; align-items: center; padding: 0 16px; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 9px; font-size: 13px; font-weight: 800; text-decoration: none; }
.tabs a.active { color: #fff; background: var(--blue); border-color: var(--blue); }
.disclaimer { margin-bottom: 14px; padding: 11px 14px; color: #81410d; background: #fff8eb; border: 1px solid #f4d5a7; border-left: 4px solid var(--orange); border-radius: 9px; font-size: 13px; }

.filterbar { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-bottom: 14px; padding: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.filter-field { display: grid; gap: 5px; }
.filter-field > span:first-child { color: #53657c; font-size: 11px; font-weight: 800; letter-spacing: .45px; text-transform: uppercase; }
select, input[type=search] { min-width: 160px; min-height: 42px; padding: 9px 11px; color: var(--text); background: var(--panel); border: 1px solid #cbd6e3; border-radius: 8px; }
.filterbar button { min-height: 42px; align-self: end; padding: 0 17px; color: #fff; background: var(--blue); border: 1px solid var(--blue); border-radius: 8px; font-weight: 700; cursor: pointer; }
.filterbar a.clear { display: inline-flex; height: 42px; align-items: center; align-self: end; padding: 0 14px; color: var(--blue); background: var(--blue-soft); border: 1px solid #cbd9e8; border-radius: 8px; font-weight: 700; text-decoration: none; }
.count { margin-left: auto; align-self: center; color: var(--muted); font-size: 13px; font-weight: 600; }
.count b { color: var(--blue); }
.chips { display: flex; width: 100%; gap: 6px; align-items: center; flex-wrap: wrap; padding-top: 2px; }
.chips .chips-label { color: var(--muted); font-size: 12px; font-weight: 700; }
a.chip { display: inline-flex; min-height: 28px; align-items: center; padding: 0 10px; color: var(--blue); background: var(--blue-soft); border: 1px solid #cbd9e8; border-radius: 999px; font-size: 12px; font-weight: 700; text-decoration: none; }
a.chip:hover { background: #dceafb; }
.search-wrap { position: relative; }
.vbpl-suggest { position: absolute; top: 100%; right: 0; left: 0; z-index: 40; max-height: 320px; margin-top: 4px; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 14px 30px rgba(30, 58, 90, .18); }
.vbpl-suggest .sg-item { display: flex; width: 100%; gap: 8px; align-items: baseline; padding: 9px 12px; color: var(--text); background: none; border: 0; text-align: left; cursor: pointer; }
.vbpl-suggest .sg-item + .sg-item { border-top: 1px solid var(--line); }
.vbpl-suggest .sg-item:hover, .vbpl-suggest .sg-item.sg-active { background: var(--blue-soft); }
.vbpl-suggest code, .vbpl-record code, .vbpl-detail-code code { color: var(--blue); background: #edf3fa; border-radius: 5px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.vbpl-suggest code { padding: 1px 6px; }

.vbpl-library { display: grid; grid-template-columns: minmax(190px, 230px) minmax(340px, 520px) minmax(340px, 1fr); min-height: 680px; overflow: clip; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.vbpl-library-nav, .vbpl-library-results, .vbpl-detail { min-width: 0; }
.vbpl-library-nav { max-height: calc(100vh - 112px); padding: 14px 10px 18px; overflow-y: auto; background: #f7f9fb; border-right: 1px solid var(--line); }
.vbpl-library-nav-head { display: grid; gap: 4px; margin: 0 4px 12px; padding: 4px 4px 12px; border-bottom: 1px solid var(--line); }
.vbpl-library-nav-head strong { color: var(--blue); font-size: 15px; }
.vbpl-eyebrow { display: block; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; }
.vbpl-library-nav h2 { margin: 16px 8px 7px; color: #52647a; font-size: 10px; font-weight: 800; letter-spacing: .7px; text-transform: uppercase; }
.vbpl-nav-filter { display: flex; min-height: 38px; gap: 10px; align-items: center; justify-content: space-between; margin: 2px 0; padding: 7px 9px; color: var(--text); border: 1px solid transparent; border-radius: 7px; font-size: 12.5px; font-weight: 650; text-decoration: none; }
.vbpl-nav-filter b { display: inline-flex; min-width: 24px; height: 22px; align-items: center; justify-content: center; color: #52647a; background: #e8edf3; border-radius: 999px; font-size: 11px; }
.vbpl-nav-filter:hover { background: #edf3f9; }
.vbpl-nav-filter.active { color: #fff; background: var(--blue); border-color: var(--blue); }
.vbpl-nav-filter.active b { color: var(--blue); background: #fff; }

.vbpl-library-results { display: flex; max-height: calc(100vh - 112px); flex-direction: column; background: #f4f1e9; border-right: 1px solid var(--line); }
.vbpl-results-head { display: flex; min-height: 70px; gap: 14px; align-items: center; justify-content: space-between; padding: 13px 15px; background: rgba(255, 255, 255, .92); border-bottom: 1px solid var(--line); }
.vbpl-results-head h2 { margin: 2px 0 0; color: var(--blue2); font-size: 17px; }
.vbpl-results-count { color: var(--muted); font-size: 12px; white-space: nowrap; }
.vbpl-results-count b { color: var(--blue); }
.vbpl-record-list { padding: 9px; overflow-y: auto; }
.vbpl-record { position: relative; margin-bottom: 8px; overflow: hidden; background: var(--panel); border: 1px solid #d8dedf; border-radius: 9px; box-shadow: 0 2px 8px rgba(34, 48, 60, .05); }
.vbpl-record:hover { border-color: #aebfd0; }
.vbpl-record.selected { border-color: var(--blue); box-shadow: inset 4px 0 var(--blue), 0 7px 18px rgba(36, 87, 143, .12); }
.vbpl-record-select { display: grid; width: 100%; gap: 7px; padding: 12px 12px 9px; color: inherit; background: none; border: 0; text-align: left; cursor: pointer; }
.vbpl-record-top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.vbpl-type { display: inline-flex; min-height: 20px; align-items: center; padding: 0 7px; color: #fff; background: var(--blue); border-radius: 4px; font-size: 10px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase; }
.vbpl-record code, .vbpl-detail-code code { padding: 2px 6px; }
.vbpl-record-title { color: var(--blue2); font-size: 14px; font-weight: 800; line-height: 1.35; }
.vbpl-record-meta { color: var(--muted); font-size: 11.5px; }
.vbpl-record-topics { display: flex; gap: 3px; flex-wrap: wrap; }
.vbpl-record-actions { display: flex; gap: 5px; padding: 0 12px 10px; }
.vbpl-record[hidden] { display: none; }
.vb-flash { animation: vbFlash 1.5s ease-out; }
@keyframes vbFlash { 0%, 35% { background: #fff2c4; } 100% { background: var(--panel); } }

.vbpl-detail { max-height: calc(100vh - 112px); padding: 22px 26px 30px; overflow-y: auto; background: var(--paper); }
.vbpl-detail-code { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0 12px; }
.vbpl-detail-title { max-width: 900px; margin: 0 0 12px; color: var(--blue2); font-size: clamp(20px, 2vw, 28px); line-height: 1.3; }
.vbpl-detail-meta { display: grid; grid-template-columns: minmax(130px, .35fr) 1fr; margin: 22px 0 0; border-top: 1px solid #ddd9cf; }
.vbpl-detail-meta dt, .vbpl-detail-meta dd { margin: 0; padding: 10px 0; border-bottom: 1px solid #e4e0d7; }
.vbpl-detail-meta dt { color: var(--muted); font-size: 12px; font-weight: 800; }
.vbpl-detail-meta dd { color: var(--text); font-weight: 600; }
.vbpl-detail-note { display: grid; gap: 4px; margin-top: 18px; padding: 12px 14px; color: #075e40; background: #ecfdf3; border-left: 4px solid var(--green); border-radius: 8px; white-space: pre-line; }
.vbpl-citation { margin-top: 18px; padding: 14px; background: #fff8df; border: 1px solid #e7c76d; border-radius: 8px; }
.vbpl-citation-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; color: #6c4c04; }
.vbpl-citation p { margin: 10px 0; color: #4b3a13; line-height: 1.65; }
.vbpl-citation small { color: #806b35; }
.vbpl-detail-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.vbpl-detail-empty { display: grid; min-height: 420px; place-items: center; align-content: center; gap: 10px; color: var(--muted); text-align: center; }
.vbpl-detail-empty span { font-size: 34px; }

.badge { display: inline-flex; min-height: 22px; gap: 5px; align-items: center; margin: 1px 2px 1px 0; padding: 0 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; line-height: 1; white-space: nowrap; }
.badge.red { color: #991b1b; background: #fee2e2; }
.badge.orange { color: #8f3c0d; background: #ffedd5; }
.badge.green { color: #166534; background: #dcfce7; }
.badge.blue { color: #075985; background: #e0f2fe; }
.badge.unknown { color: #374151; background: #e5e7eb; }
.badge.dot::before { width: 7px; height: 7px; flex: 0 0 auto; background: currentColor; border-radius: 999px; content: ''; }
.dl, .src { display: inline-flex; min-height: 30px; align-items: center; justify-content: center; padding: 0 10px; border-radius: 7px; font-size: 12px; font-weight: 700; text-decoration: none; cursor: pointer; }
.dl { color: #fff; background: var(--green); border: 1px solid var(--green); }
.src { color: var(--blue); background: var(--blue-soft); border: 1px solid #cbd9e8; }
.muted { color: var(--muted); font-size: 12.5px; }
.empty { padding: 34px; color: var(--muted); background: var(--panel); border: 1px dashed #bdcad8; border-radius: var(--radius); text-align: center; }

.vbpl-modal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 18px; background: rgba(17, 32, 58, .45); }
.vbpl-modal[hidden] { display: none; }
.vbpl-modal-box { width: 100%; max-width: 360px; padding: 22px 22px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 18px 48px rgba(30, 58, 90, .25); text-align: center; }
.vbpl-modal-box p { margin: 0 0 16px; color: var(--text); font-size: 15px; font-weight: 700; }
.vbpl-modal-actions { display: flex; gap: 8px; justify-content: center; }

.tn-block { margin-bottom: 22px; }
.tn-title { margin: 0 0 10px; color: var(--blue); font-size: 16px; font-weight: 800; }
.cc-card { margin-bottom: 12px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: var(--radius); box-shadow: var(--shadow); }
.cc-summary { display: flex; gap: 13px; align-items: center; padding: 14px 18px; list-style: none; cursor: pointer; }
.cc-summary::-webkit-details-marker { display: none; }
.cc-summary:hover { background: #f6f9ff; }
.cc-toggle { position: relative; width: 22px; height: 22px; flex: 0 0 auto; background: var(--blue-soft); border-radius: 7px; }
.cc-toggle::before { position: absolute; top: 7px; left: 7px; width: 7px; height: 7px; border-right: 2px solid var(--blue); border-bottom: 2px solid var(--blue); content: ''; transform: rotate(-45deg); }
.cc-card[open] .cc-toggle::before { transform: rotate(45deg) translate(-1px, -1px); }
.cc-title { color: var(--blue); font-size: 15px; font-weight: 800; }
.cc-body { padding: 4px 18px 18px; }
.cc-content { padding-top: 10px; border-top: 1px solid var(--line); line-height: 1.65; white-space: pre-line; }
.cc-note { margin-top: 12px; padding: 11px 13px; color: #075e40; background: #ecfdf3; border-left: 4px solid var(--green); border-radius: 9px; white-space: pre-line; }
.cc-note b { display: block; margin-bottom: 4px; }
.cc-links { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.cc-links a { display: inline-flex; min-height: 26px; align-items: center; padding: 0 10px; color: var(--blue); background: var(--blue-soft); border: 1px solid #cbd9e8; border-radius: 999px; font-size: 12px; font-weight: 700; text-decoration: none; }

body.theme-dark .topbar, body.theme-dark :is(.filterbar, .vbpl-library, .vbpl-results-head, .vbpl-record, .cc-card, .empty, .vbpl-modal-box) { background: var(--panel); border-color: var(--line); }
body.theme-dark .vbpl-library-nav { background: rgba(148, 163, 184, .06); }
body.theme-dark .vbpl-library-results { background: rgba(120, 105, 75, .09); }
body.theme-dark .vbpl-detail { background: rgba(120, 105, 75, .06); }
body.theme-dark select, body.theme-dark input[type=search] { color: var(--text); background: var(--panel); border-color: var(--line); }
body.theme-dark .vbpl-citation { background: rgba(245, 190, 65, .12); border-color: rgba(245, 190, 65, .38); }
body.theme-dark .vbpl-citation :is(b, p, small) { color: var(--text); }
body.theme-dark .vbpl-detail-meta, body.theme-dark .vbpl-detail-meta :is(dt, dd) { border-color: var(--line); }

@media (max-width: 1250px) {
  .vbpl-library { grid-template-columns: minmax(180px, 220px) minmax(330px, 1fr); }
  .vbpl-detail { grid-column: 1 / -1; max-height: none; border-top: 1px solid var(--line); }
  .vbpl-library-nav, .vbpl-library-results { max-height: 640px; }
}

@media (max-width: 760px) {
  .topbar { padding: 10px 14px; }
  .topbar h1 { font-size: 15px; }
  .container { padding: 14px 10px 30px; }
  .filterbar { align-items: stretch; }
  .filter-field, .search-wrap, select, input[type=search] { width: 100%; min-width: 0; }
  .filterbar button, .filterbar a.clear { flex: 1; justify-content: center; }
  .count { width: 100%; margin-left: 0; }
  .vbpl-library { display: block; min-height: 0; overflow: visible; }
  .vbpl-library-nav, .vbpl-library-results, .vbpl-detail { max-height: none; border: 0; border-bottom: 1px solid var(--line); }
  .vbpl-library-nav { display: flex; gap: 6px; padding: 10px; overflow-x: auto; }
  .vbpl-library-nav-head, .vbpl-library-nav h2 { display: none; }
  .vbpl-nav-filter { min-width: max-content; }
  .vbpl-record-list { max-height: 560px; }
  .vbpl-detail { padding: 20px 16px 26px; }
  .vbpl-detail-meta { grid-template-columns: 1fr; }
  .vbpl-detail-meta dt { padding-bottom: 2px; border-bottom: 0; }
  .vbpl-detail-meta dd { padding-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
