:root {
    color-scheme: light;
    --accent: #7C3AED;
    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-muted: #f1f3f8;
    --border: #dfe3eb;
    --text: #111827;
    --text-muted: #667085;
    --sidebar: #11131a;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
}
html.dark {
    color-scheme: dark;
    --bg: #0b0d12;
    --surface: #12151d;
    --surface-muted: #191d27;
    --border: #292f3b;
    --text: #f4f6fa;
    --text-muted: #9ba4b5;
    --sidebar: #090b10;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 12%, transparent), transparent 28rem), var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }
.app-shell { min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40; width: 280px; display: flex; flex-direction: column;
    background: var(--sidebar); color: white; transform: translateX(0); transition: transform .2s ease;
}
.brand { height: 80px; display: flex; align-items: center; gap: 12px; padding: 0 20px; }
.brand-mark { width: 44px; height: 44px; border-radius: 16px; display: grid; place-items: center; background: var(--accent); font-size: 21px; font-weight: 900; box-shadow: 0 10px 25px rgba(124,58,237,.3); }
.brand-copy { min-width: 0; }
.brand-copy strong, .brand-copy small { display: block; }
.brand-copy strong { font-size: 16px; }
.brand-copy small { margin-top: 2px; color: rgba(255,255,255,.48); font-size: 12px; }
.server-chip { margin: 0 12px; padding: 12px 13px; border: 1px solid rgba(255,255,255,.1); border-radius: 12px; background: rgba(255,255,255,.05); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.server-chip strong { display:block; margin-top:4px; font-size:14px; }
.eyebrow { font-size: 10px; letter-spacing: .16em; color: rgba(255,255,255,.35); font-weight: 800; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,.12); }
.nav { flex: 1; overflow-y: auto; padding: 20px 12px; }
.nav-label { padding: 0 12px 10px; font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: rgba(255,255,255,.35); }
.nav-label.spaced { margin-top: 24px; }
.nav-item { display:flex; align-items:center; gap:12px; padding: 11px 12px; margin-bottom:6px; border-radius:12px; color: rgba(255,255,255,.62); transition: .15s ease; }
.nav-item:hover { background: rgba(255,255,255,.05); color:white; }
.nav-item.active { background: rgba(255,255,255,.1); color:white; }
.nav-icon { width:36px; height:36px; flex:0 0 36px; display:grid; place-items:center; border-radius:12px; background: rgba(255,255,255,.05); font-weight:800; }
.nav-item.active .nav-icon { background: var(--accent); }
.nav-copy { min-width:0; }
.nav-copy strong, .nav-copy small { display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.nav-copy strong { font-size:14px; }
.nav-copy small { margin-top:3px; color:rgba(255,255,255,.35); font-size:12px; }
.sidebar-footer { padding:16px; border-top:1px solid rgba(255,255,255,.1); }
.sidebar-note { padding:13px; border-radius:12px; background:rgba(255,255,255,.05); }
.sidebar-note strong { display:block; font-size:13px; }
.sidebar-note span { display:block; margin-top:5px; color:rgba(255,255,255,.42); font-size:11px; line-height:1.45; }
.main-wrap { min-height:100vh; margin-left:280px; display:flex; flex-direction:column; }
.topbar { position:sticky; top:0; z-index:20; min-height:76px; display:flex; align-items:center; gap:16px; padding:14px 32px; border-bottom:1px solid var(--border); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(18px); }
.page-heading { min-width:0; flex:1; }
.page-heading h1 { margin:0; font-size:24px; line-height:1.15; }
.page-heading p { margin:4px 0 0; font-size:14px; color:var(--text-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.header-search { width:min(390px,34vw); height:42px; display:flex; align-items:center; gap:9px; padding:0 11px; border:1px solid var(--border); border-radius:12px; background:var(--surface); }
.header-search input { width:100%; border:0; outline:0; color:var(--text); background:transparent; }
.header-search input::placeholder { color:var(--text-muted); }
kbd { padding:2px 6px; border:1px solid var(--border); border-bottom-width:2px; border-radius:6px; color:var(--text-muted); background:var(--surface-muted); font-size:11px; }
.icon-button { width:42px; height:42px; border:1px solid var(--border); border-radius:12px; color:var(--text-muted); background:var(--surface); cursor:pointer; }
.icon-button:hover { color:var(--text); background:var(--surface-muted); }
.mobile-menu { display:none; }
.content-wrap { flex:1; padding:28px 32px 36px; }
.content-inner { max-width:1600px; margin:0 auto; }
.footer { display:flex; justify-content:space-between; gap:16px; padding:20px 32px 28px; color:var(--text-muted); font-size:12px; }
.panel { border:1px solid var(--border); border-radius:16px; background:color-mix(in srgb, var(--surface) 96%, transparent); box-shadow:0 14px 40px rgba(15,23,42,.07); }
html.dark .panel { box-shadow:0 18px 50px rgba(0,0,0,.22); }
.panel-flush { overflow:hidden; }
.panel-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:18px 20px; border-bottom:1px solid var(--border); }
.panel-heading h3 { margin:0; font-size:16px; }
.panel-heading p { margin:4px 0 0; color:var(--text-muted); font-size:13px; }
.hero { min-height:270px; position:relative; overflow:hidden; display:flex; align-items:center; padding:34px 38px; }
.hero-copy { position:relative; z-index:2; width:min(760px,74%); }
.hero h2 { margin:14px 0 10px; font-size:clamp(30px,4vw,52px); line-height:1.03; letter-spacing:-.04em; }
.hero p { max-width:700px; margin:0; color:var(--text-muted); font-size:16px; line-height:1.65; }
.hero-symbol { position:absolute; right:5%; top:50%; transform:translateY(-50%); font-size:220px; font-weight:900; line-height:1; color:color-mix(in srgb, var(--accent) 10%, transparent); user-select:none; }
.hero-search { margin-top:24px; height:52px; max-width:680px; display:flex; align-items:center; gap:10px; padding:0 8px 0 16px; border:1px solid var(--border); border-radius:14px; background:var(--surface); box-shadow:0 10px 30px rgba(15,23,42,.06); }
.hero-search input { flex:1; min-width:0; border:0; outline:0; color:var(--text); background:transparent; }
.hero-search button, .button { border:0; border-radius:11px; padding:10px 14px; color:white; background:var(--accent); font-weight:800; cursor:pointer; }
.button.secondary { color:var(--text); background:var(--surface-muted); border:1px solid var(--border); }
.stats-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:16px; margin-top:18px; }
.stat-card { padding:20px; }
.stat-card > span { display:block; color:var(--text-muted); font-size:13px; font-weight:700; }
.stat-card strong { display:block; margin-top:9px; font-size:30px; letter-spacing:-.03em; }
.stat-card strong.date-value { font-size:24px; }
.stat-card small { display:block; margin-top:5px; color:var(--text-muted); font-size:12px; }
.two-column { display:grid; grid-template-columns:minmax(0,1.5fr) minmax(320px,1fr); gap:18px; margin-top:18px; }
.book-list.compact .book-row:last-child { border-bottom:0; }
.book-row { display:flex; align-items:center; gap:14px; padding:15px 20px; border-bottom:1px solid var(--border); transition:.15s ease; }
.book-row:hover { background:var(--surface-muted); }
.book-code { display:inline-grid; min-width:56px; place-items:center; padding:6px 9px; border-radius:9px; background:color-mix(in srgb, var(--accent) 12%, transparent); color:var(--accent); font-size:12px; font-weight:900; letter-spacing:.03em; }
.book-code.large { min-width:62px; padding:8px 10px; font-size:13px; }
.book-code.xlarge { min-width:76px; padding:10px 13px; font-size:15px; }
.book-row-copy { min-width:0; flex:1; }
.book-row-copy strong, .book-row-copy small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.book-row-copy strong { font-size:14px; }
.book-row-copy small { margin-top:4px; color:var(--text-muted); font-size:12px; }
.arrow { color:var(--text-muted); }
.timeline { padding:4px 0; }
.timeline-row { display:flex; gap:12px; padding:13px 20px; }
.timeline-row:hover { background:var(--surface-muted); }
.timeline-dot { width:8px; height:8px; margin-top:6px; border-radius:50%; background:var(--accent); box-shadow:0 0 0 4px color-mix(in srgb,var(--accent) 10%, transparent); }
.timeline-copy { min-width:0; }
.timeline-copy strong, .timeline-copy small { display:block; }
.timeline-copy strong { font-size:13px; line-height:1.35; }
.timeline-copy small { margin-top:3px; color:var(--text-muted); font-size:11px; line-height:1.45; }
.book-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:18px; }
.book-card { display:block; padding:22px; transition:.18s ease; }
.book-card:hover { transform:translateY(-2px); border-color:color-mix(in srgb,var(--accent) 45%, var(--border)); box-shadow:0 18px 46px rgba(15,23,42,.1); }
.book-card-top { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.book-card h2 { margin:18px 0 8px; font-size:20px; }
.book-card p { min-height:64px; margin:0; color:var(--text-muted); font-size:13px; line-height:1.6; }
.book-meta { display:flex; justify-content:space-between; gap:12px; margin-top:20px; padding-top:14px; border-top:1px solid var(--border); color:var(--text-muted); font-size:11px; }
.pill { display:inline-flex; align-items:center; gap:6px; width:max-content; padding:5px 8px; border-radius:999px; font-size:11px; font-weight:800; }
.pill.accent { color:var(--accent); background:color-mix(in srgb,var(--accent) 12%, transparent); }
.pill.success { color:var(--success); background:color-mix(in srgb,var(--success) 12%, transparent); }
.pill.warning { color:var(--warning); background:color-mix(in srgb,var(--warning) 12%, transparent); }
.pill.danger { color:var(--danger); background:color-mix(in srgb,var(--danger) 12%, transparent); }
.pill.neutral { color:var(--text-muted); background:var(--surface-muted); }
.search-panel { padding:18px; }
.big-search { min-height:56px; display:flex; align-items:center; gap:11px; padding:0 8px 0 16px; border:1px solid var(--border); border-radius:14px; background:var(--surface-muted); }
.big-search input { flex:1; min-width:0; border:0; outline:0; color:var(--text); background:transparent; font-size:16px; }
.big-search button { border:0; border-radius:11px; padding:11px 16px; color:white; background:var(--accent); font-weight:800; cursor:pointer; }
.search-hints { margin-top:12px; color:var(--text-muted); font-size:12px; }
.search-hints a { color:var(--accent); font-weight:700; }
.result-heading { display:flex; gap:7px; margin:18px 2px 12px; font-size:13px; }
.result-heading span { color:var(--text-muted); }
.result-list { display:grid; gap:12px; }
.result-card { display:block; padding:20px; }
.result-card:hover { border-color:color-mix(in srgb,var(--accent) 35%, var(--border)); }
.result-top { display:flex; justify-content:space-between; gap:12px; }
.result-card h2 { margin:13px 0 8px; font-size:18px; }
.result-card p { margin:0; color:var(--text-muted); font-size:13px; line-height:1.6; }
.result-meta { display:flex; flex-wrap:wrap; gap:12px; margin-top:14px; padding-top:12px; border-top:1px solid var(--border); color:var(--text-muted); font-size:11px; }
.empty-state { margin-top:18px; padding:42px 22px; text-align:center; }
.empty-state.hidden { display:none; }
.empty-icon { width:max-content; min-width:54px; height:54px; margin:0 auto 14px; padding:0 12px; display:grid; place-items:center; border-radius:16px; background:var(--surface-muted); color:var(--accent); font-weight:900; }
.empty-state h2 { margin:0; font-size:20px; }
.empty-state p { margin:8px auto 20px; max-width:560px; color:var(--text-muted); font-size:13px; line-height:1.6; }
.history-table-wrap { overflow:auto; }
.history-table { width:100%; border-collapse:collapse; }
.history-table th { padding:12px 18px; border-bottom:1px solid var(--border); color:var(--text-muted); text-align:left; font-size:11px; letter-spacing:.08em; text-transform:uppercase; }
.history-table td { padding:15px 18px; border-bottom:1px solid var(--border); font-size:13px; vertical-align:top; }
.history-table tbody tr:last-child td { border-bottom:0; }
.history-table tbody tr:hover { background:var(--surface-muted); }
.history-table td a strong, .history-table td a small { display:block; }
.history-table td a small { margin-top:4px; color:var(--text-muted); font-size:11px; }
.law-layout { display:grid; grid-template-columns:320px minmax(0,1fr); gap:18px; align-items:start; }
.toc { position:sticky; top:94px; max-height:calc(100vh - 116px); overflow:hidden; display:flex; flex-direction:column; }
.toc-head { display:flex; align-items:center; gap:12px; padding:16px; border-bottom:1px solid var(--border); }
.toc-head strong, .toc-head small { display:block; }
.toc-head strong { font-size:13px; }
.toc-head small { margin-top:3px; color:var(--text-muted); font-size:11px; }
.toc-filter { margin:12px 12px 8px; display:flex; align-items:center; gap:8px; padding:9px 10px; border:1px solid var(--border); border-radius:10px; background:var(--surface-muted); }
.toc-filter input { width:100%; border:0; outline:0; color:var(--text); background:transparent; font-size:12px; }
.toc-list { overflow:auto; padding:4px 8px 10px; scrollbar-width:thin; }
.toc-list a { display:grid; grid-template-columns:auto minmax(0,1fr); gap:9px; padding:9px 10px; border-radius:9px; }
.toc-list a:hover { background:var(--surface-muted); }
.toc-list a.hidden { display:none; }
.toc-list span { color:var(--accent); font-size:11px; font-weight:900; }
.toc-list strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:11px; }
.law-content { min-width:0; display:grid; gap:14px; }
.law-intro { padding:24px; }
.law-intro-top { display:flex; justify-content:space-between; gap:12px; }
.law-intro h2 { margin:16px 0 8px; font-size:28px; }
.law-intro > p { margin:0; color:var(--text-muted); line-height:1.65; }
.law-info-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; margin-top:22px; }
.law-info-grid div { padding:12px; border:1px solid var(--border); border-radius:12px; background:var(--surface-muted); }
.law-info-grid span, .law-info-grid strong { display:block; }
.law-info-grid span { color:var(--text-muted); font-size:10px; text-transform:uppercase; letter-spacing:.08em; }
.law-info-grid strong { margin-top:5px; font-size:12px; }
.law-section { scroll-margin-top:98px; overflow:hidden; }
.law-section.filtered-out { display:none; }
.law-section header { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; padding:20px 22px; border-bottom:1px solid var(--border); }
.section-code { color:var(--accent); font-size:12px; font-weight:900; }
.law-section h2 { margin:4px 0 0; font-size:20px; }
.copy-link { border:1px solid var(--border); border-radius:10px; padding:7px 9px; color:var(--text-muted); background:var(--surface-muted); font-size:11px; font-weight:800; cursor:pointer; }
.law-body { padding:22px; font-size:14px; line-height:1.75; white-space:normal; }
.law-section footer { display:flex; flex-wrap:wrap; align-items:center; gap:10px; padding:12px 22px; border-top:1px solid var(--border); color:var(--text-muted); background:color-mix(in srgb,var(--surface-muted) 60%, transparent); font-size:11px; }
.mobile-backdrop { display:none; }
@media (max-width:1180px) {
    .stats-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .book-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .law-layout { grid-template-columns:270px minmax(0,1fr); }
    .law-info-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:900px) {
    .sidebar { transform:translateX(-100%); }
    body.nav-open .sidebar { transform:translateX(0); }
    .mobile-backdrop { position:fixed; inset:0; z-index:35; background:rgba(0,0,0,.55); backdrop-filter:blur(3px); }
    body.nav-open .mobile-backdrop { display:block; }
    .main-wrap { margin-left:0; }
    .mobile-menu { display:block; }
    .topbar { padding:13px 18px; }
    .content-wrap { padding:22px 18px 28px; }
    .footer { padding:18px; }
    .header-search { display:none; }
    .law-layout { grid-template-columns:1fr; }
    .toc { position:relative; top:auto; max-height:none; }
    .toc-list { max-height:280px; }
}
@media (max-width:680px) {
    .page-heading h1 { font-size:19px; }
    .page-heading p { display:none; }
    .hero { padding:25px 20px; min-height:0; }
    .hero-copy { width:100%; }
    .hero h2 { font-size:34px; }
    .hero p { font-size:14px; }
    .hero-symbol { display:none; }
    .hero-search { height:auto; padding:10px; flex-wrap:wrap; }
    .hero-search input { min-width:180px; min-height:36px; }
    .hero-search button { width:100%; }
    .stats-grid, .book-grid, .two-column { grid-template-columns:1fr; }
    .law-info-grid { grid-template-columns:1fr 1fr; }
    .book-meta, .footer { flex-direction:column; }
    .big-search { flex-wrap:wrap; padding:10px; }
    .big-search input { min-height:36px; }
    .big-search button { width:100%; }
    .history-table { min-width:720px; }
}
