* { box-sizing: border-box; margin: 0; padding: 0; }

/* Theme Variables */
:root {
    --bg-primary: #fafafa;
    --bg-secondary: #fff;
    --bg-tertiary: #f6f8fa;
    --bg-hover: #ebeef1;
    --text-primary: #24292e;
    --text-secondary: #586069;
    --text-muted: #8b949e;
    --border-color: #e1e4e8;
    --link-color: #0969da;
    --accent: #58a6ff;
    --header-bg: #1a1a2e;
    --header-text: #e1e4e8;
    --positive: #22863a;
    --negative: #cb2431;
}

[data-theme="dark"] {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-hover: #30363d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --border-color: #30363d;
    --link-color: #58a6ff;
    --accent: #58a6ff;
    --header-bg: #010409;
    --header-text: #e6edf3;
    --positive: #3fb950;
    --negative: #f85149;
}

body {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 12px;
    line-height: 1.4;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: background 0.2s ease, color 0.2s ease;
}

/* Header */
header {
    background: var(--header-bg);
    color: var(--header-text);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.breadcrumb { font-size: 14px; font-weight: 600; }
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

.nav-links { margin-left: 24px; }
.nav-links a {
    color: var(--header-text);
    text-decoration: none;
    margin-left: 16px;
    font-size: 12px;
    opacity: 0.7;
}
.nav-links a:hover, .nav-links a.active { opacity: 1; }

.header-right { display: flex; align-items: center; gap: 12px; }
.meta { font-size: 11px; opacity: 0.7; }

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--header-text);
    padding: 4px;
}
.theme-toggle svg { width: 16px; height: 16px; }
[data-theme="dark"] .sun { display: none; }
[data-theme="light"] .moon, :root .moon { display: none; }

/* Main content */
main { padding: 16px; max-width: 1400px; margin: 0 auto; }

.container { padding: 16px 0; }
.container h1 { font-size: 20px; margin-bottom: 8px; }

/* Footer */
footer {
    text-align: center;
    padding: 16px;
    font-size: 11px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
}

/* Buttons */
.btn-logout {
    color: var(--header-text);
    text-decoration: none;
    font-size: 11px;
    opacity: 0.7;
    padding: 4px 8px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
}
.btn-logout:hover { opacity: 1; }

.btn-small {
    font-size: 11px;
    padding: 4px 10px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.btn-small:hover { opacity: 0.9; }

/* Login Page */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--bg-primary);
}

.login-container { width: 100%; max-width: 400px; padding: 16px; }

.login-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 32px;
}

.login-header { text-align: center; margin-bottom: 24px; }
.login-header h1 { font-size: 24px; }

.login-error {
    background: #ffeef0;
    border: 1px solid #ffc1c9;
    color: #cb2431;
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 12px;
}

[data-theme="dark"] .login-error {
    background: #2d1115;
    border-color: #f85149;
    color: #f85149;
}

.login-form .form-group { margin-bottom: 16px; }
.login-form label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-secondary);
}
.login-form input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 13px;
    background: var(--bg-primary);
    color: var(--text-primary);
}
.login-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.15);
}

.btn-login {
    width: 100%;
    padding: 10px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.btn-login:hover { opacity: 0.9; }

/* Cards */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 12px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

/* KPI Cards */
.kpi { text-align: center; }
.kpi-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-value { font-size: 28px; font-weight: 700; margin: 4px 0; }
.kpi-detail { font-size: 10px; color: var(--text-secondary); }

/* Badges */
.badge {
    display: inline-block;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.badge-covered { background: #dcfce7; color: #166534; }
.badge-not-covered { background: #fde2e2; color: #991b1b; }
.badge-conditionally-covered { background: #fef3c7; color: #92400e; }
.badge-not-determined { background: #f3e8ff; color: #6b21a8; }
.badge-pending-review, .badge-pending { background: #e0e7ff; color: #3730a3; }
.badge-not_started { background: var(--bg-tertiary); color: var(--text-muted); }

.badge-open { background: #fef3c7; color: #92400e; }
.badge-resolved { background: #dcfce7; color: #166534; }
.badge-running { background: #dbeafe; color: #1e40af; }
.badge-completed { background: #dcfce7; color: #166534; }
.badge-failed { background: #fde2e2; color: #991b1b; }
.badge-uploaded { background: #e0e7ff; color: #3730a3; }
.badge-processing { background: #dbeafe; color: #1e40af; }
.badge-processed { background: #dcfce7; color: #166534; }
.badge-error { background: #fde2e2; color: #991b1b; }

[data-theme="dark"] .badge-covered { background: #052e16; color: #86efac; }
[data-theme="dark"] .badge-not-covered { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .badge-conditionally-covered { background: #451a03; color: #fde68a; }
[data-theme="dark"] .badge-not-determined { background: #3b0764; color: #d8b4fe; }
[data-theme="dark"] .badge-pending-review, [data-theme="dark"] .badge-pending { background: #1e1b4b; color: #a5b4fc; }
[data-theme="dark"] .badge-open { background: #451a03; color: #fde68a; }
[data-theme="dark"] .badge-resolved { background: #052e16; color: #86efac; }
[data-theme="dark"] .badge-running { background: #172554; color: #93c5fd; }
[data-theme="dark"] .badge-completed { background: #052e16; color: #86efac; }
[data-theme="dark"] .badge-failed { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .badge-uploaded { background: #1e1b4b; color: #a5b4fc; }
[data-theme="dark"] .badge-processed { background: #052e16; color: #86efac; }
[data-theme="dark"] .badge-processing { background: #172554; color: #93c5fd; }
[data-theme="dark"] .badge-error { background: #450a0a; color: #fca5a5; }

.badge-record-count { background: #e0f2fe; color: #075985; }
.badge-conflict-count { background: #fef3c7; color: #92400e; }
[data-theme="dark"] .badge-record-count { background: #0c4a6e; color: #7dd3fc; }
[data-theme="dark"] .badge-conflict-count { background: #451a03; color: #fde68a; }

/* Data Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.data-table th {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 2px solid var(--border-color);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.data-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-color);
}

.data-table tr:hover { background: var(--bg-hover); }

/* Filter Controls */
.filter-btn {
    display: inline-block;
    font-size: 11px;
    padding: 4px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-secondary);
    background: var(--bg-secondary);
}
.filter-btn:hover { background: var(--bg-hover); }
.filter-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.filter-select {
    font-size: 11px;
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Bar Chart */
.bar-chart { margin: 8px 0; }
.bar-row { display: flex; align-items: center; margin: 4px 0; gap: 8px; }
.bar-label { font-size: 11px; width: 160px; text-align: right; color: var(--text-secondary); }
.bar-track { flex: 1; height: 20px; background: var(--bg-tertiary); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s ease; }
.bar-count { font-size: 11px; width: 40px; color: var(--text-secondary); }

.bar-covered { background: #22863a; }
.bar-not-covered { background: #cb2431; }
.bar-conditionally-covered { background: #d29922; }
.bar-not-determined { background: #9333ea; }
.bar-pending-review { background: #6366f1; }

[data-theme="dark"] .bar-covered { background: #3fb950; }
[data-theme="dark"] .bar-not-covered { background: #f85149; }
[data-theme="dark"] .bar-conditionally-covered { background: #d29922; }
[data-theme="dark"] .bar-not-determined { background: #a855f7; }
[data-theme="dark"] .bar-pending-review { background: #818cf8; }

/* Conflict signals */
.conflict-signals {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}
.signal { display: flex; align-items: center; gap: 4px; }
.signal-label { color: var(--text-muted); font-weight: 600; }

/* Coverage Hierarchy */
.hierarchy {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.hierarchy-item {
    padding: 4px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}
.hierarchy-arrow { color: var(--text-muted); font-weight: 700; }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 16px;
    color: var(--text-secondary);
}
.empty-state p { margin: 4px 0; }

/* Clickable KPI Cards */
.kpi-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.kpi-link:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(88, 166, 255, 0.12);
}

/* Clickable Task Cards */
.task-card {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.task-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(88, 166, 255, 0.12);
    transform: translateY(-1px);
}

/* Progress Bars */
.progress-track {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}
.progress-fill-positive { background: var(--positive); }
[data-theme="dark"] .progress-fill-positive { background: #3fb950; }

/* Donut Chart — dark mode overrides */
[data-theme="dark"] .donut-covered { stroke: #3fb950; }
[data-theme="dark"] .donut-not-covered { stroke: #f85149; }
[data-theme="dark"] .donut-conditionally-covered { stroke: #d29922; }
[data-theme="dark"] .donut-not-determined { stroke: #8b949e; }
[data-theme="dark"] .donut-pending-review { stroke: #f0883e; }

/* Legend Dots */
.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
[data-theme="dark"] .legend-dot-covered { background: #3fb950 !important; }
[data-theme="dark"] .legend-dot-not-covered { background: #f85149 !important; }
[data-theme="dark"] .legend-dot-conditionally-covered { background: #d29922 !important; }
[data-theme="dark"] .legend-dot-not-determined { background: #8b949e !important; }
[data-theme="dark"] .legend-dot-pending-review { background: #f0883e !important; }

/* Document Links */
.doc-link {
    color: var(--link-color);
    text-decoration: none;
}
.doc-link:hover { text-decoration: underline; }

/* Code */
code {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 11px;
    background: var(--bg-tertiary);
    padding: 1px 4px;
    border-radius: 3px;
}

/* Sortable Table Headers */
.sortable-header {
    cursor: pointer;
    user-select: none;
    position: relative;
}
.sortable-header:hover {
    background: rgba(115, 30, 227, 0.05);
}
[data-theme="dark"] .sortable-header:hover {
    background: rgba(88, 166, 255, 0.08);
}
.th-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}
.sort-icon {
    font-size: 0.75rem;
    opacity: 0.4;
    flex-shrink: 0;
}
.sort-icon.active {
    opacity: 1;
    color: var(--accent);
}
.column-filter {
    width: 100%;
    margin-top: 4px;
    padding: 2px 4px;
    font-size: 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
}
.column-filter::placeholder {
    color: var(--text-muted);
    font-size: 0.65rem;
}
.column-filter:focus {
    outline: none;
    border-color: var(--accent);
}
.table-status {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Alpine.js cloak */
[x-cloak] { display: none !important; }

/* Escalate badge */
.badge-escalate { background: #fde2e2; color: #991b1b; }
[data-theme="dark"] .badge-escalate { background: #450a0a; color: #fca5a5; }

/* ------------------------------------------------------------------ */
/* Code Lookup Widget                                                  */
/* ------------------------------------------------------------------ */
.code-lookup { position: relative; }

.code-lookup-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.code-lookup-input {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 4px;
    color: var(--header-text);
    font-family: inherit;
    font-size: 11px;
    padding: 4px 52px 4px 8px;
    width: 180px;
    outline: none;
    transition: width 0.2s ease, border-color 0.2s ease;
}
.code-lookup-input::placeholder { color: rgba(255,255,255,0.4); }
.code-lookup-input:focus {
    width: 240px;
    border-color: var(--accent);
    background: rgba(255,255,255,0.12);
}

.code-lookup-kbd {
    position: absolute;
    right: 6px;
    font-size: 9px;
    color: rgba(255,255,255,0.35);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 3px;
    padding: 1px 4px;
    pointer-events: none;
}

.code-lookup-spinner {
    position: absolute;
    right: 8px;
    width: 14px;
    height: 14px;
}
.code-lookup-spinner svg { width: 14px; height: 14px; stroke: var(--accent); }

/* Popover */
.code-lookup-popover {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 380px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    z-index: 9999;
    padding: 12px;
    font-size: 12px;
    color: var(--text-primary);
}

.code-lookup-empty {
    color: var(--text-muted);
    text-align: center;
    padding: 8px;
}

.code-lookup-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.code-lookup-code {
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.5px;
}

.code-lookup-badge {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 3px;
    letter-spacing: 0.5px;
}
.badge-cpt { background: #dbeafe; color: #1e40af; }
.badge-hcpcs { background: #fef3c7; color: #92400e; }
.badge-icd10 { background: #d1fae5; color: #065f46; }
.badge-unknown { background: var(--bg-tertiary); color: var(--text-secondary); }
.badge-xwalk { background: var(--bg-tertiary); color: var(--text-secondary); font-size: 8px; }

[data-theme="dark"] .badge-cpt { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .badge-hcpcs { background: #451a03; color: #fcd34d; }
[data-theme="dark"] .badge-icd10 { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .badge-xwalk { background: var(--bg-tertiary); color: var(--text-muted); }

.code-lookup-desc {
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.5;
}

.code-lookup-meta, .code-lookup-lcd {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 4px;
    color: var(--text-secondary);
    font-size: 11px;
}

.code-lookup-label {
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 9px;
    min-width: 52px;
}

.code-lookup-lcd-count {
    color: var(--text-muted);
    margin-left: 4px;
}

.code-lookup-xwalk {
    margin-top: 8px;
    border-top: 1px solid var(--border-color);
    padding-top: 8px;
}
.code-lookup-xwalk > .code-lookup-label { display: block; margin-bottom: 4px; }

.code-lookup-xwalk-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    margin-bottom: 3px;
}
.code-lookup-xwalk-desc {
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

/* ── Nav Guide Link ─────────────────────────────────────── */
.nav-guide {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid var(--header-text);
    font-size: 12px;
    font-weight: 700;
    opacity: 0.6;
    transition: opacity 0.15s;
}
.nav-guide:hover, .nav-guide.active { opacity: 1; }

/* ── User Guide ─────────────────────────────────────────── */
/* Typography override: guide uses sans-serif, not monospace */
.guide-layout,
.guide-layout * {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
.guide-layout code,
.guide-layout .guide-table td code {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.85em;
    background: var(--bg-tertiary);
    padding: 1px 5px;
    border-radius: 3px;
}

/* -- Flex layout: content left, TOC right -- */
.guide-layout {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    min-height: calc(100vh - 80px);
}

.guide-body {
    flex: 1;
    min-width: 0;
    max-width: 780px;
    padding: 24px 0;
}

/* -- TOC sidebar (right) -- */
.guide-toc {
    width: 220px;
    flex-shrink: 0;
    position: sticky;
    top: 60px;                       /* approx header height + gap */
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    padding-top: 24px;
}

.toc-label {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
    padding-left: 10px;
}

.toc-link {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 4px 10px;
    border-left: 2px solid transparent;
    border-radius: 0 4px 4px 0;
    line-height: 1.4;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.toc-link:hover {
    color: var(--accent);
}
.toc-link.active {
    color: var(--accent);
    border-left-color: var(--accent);
    font-weight: 600;
    background: rgba(88,166,255,0.07);
}
[data-theme="light"] .toc-link.active {
    background: rgba(9,105,218,0.06);
}
.toc-hidden { display: none !important; }

.guide-search {
    padding: 0 0 12px;
}
.guide-search-input {
    width: 100%;
    padding: 6px 10px;
    font-size: 0.8125rem;
    font-family: inherit;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    outline: none;
}
.guide-search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.15);
}
.guide-search-input::placeholder {
    color: var(--text-muted);
}

.guide-toc-footer {
    padding: 16px 10px 0;
    font-size: 0.6875rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    margin-top: 12px;
}
.guide-toc-footer code {
    font-weight: 600;
    color: var(--text-secondary);
}

/* -- Hero -- */
.guide-hero {
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}
.guide-hero h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}
.guide-hero-sub {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.guide-hidden { display: none !important; }

/* -- Feature Section -- */
.guide-feature {
    margin-bottom: 40px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border-color);
    scroll-margin-top: 64px;
}
.guide-feature:last-child { border-bottom: none; }

.guide-feature-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 4px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}
.guide-feature-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}
.guide-feature-file {
    font-size: 0.6875rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

/* Description: italic callout with purple left border */
.guide-feature-desc {
    margin: 12px 0 16px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border-left: 3px solid var(--accent);
}
.guide-feature-desc p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.65;
    font-style: italic;
    margin: 0;
}
.guide-feature-desc p + p {
    margin-top: 4px;
}

/* -- Background / Prerequisites -- */
.guide-background {
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border-left: 3px solid var(--text-muted);
}
.guide-background-title {
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}

/* -- Scenario cards -- */
.guide-scenario {
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}
.guide-scenario-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    cursor: pointer;
    background: var(--bg-secondary);
    transition: background 0.12s;
}
.guide-scenario-header:hover {
    background: var(--bg-hover);
}
.guide-toggle {
    font-size: 0.625rem;
    color: var(--text-muted);
    width: 14px;
    text-align: center;
    flex-shrink: 0;
    transition: transform 0.15s;
}
.guide-scenario-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.guide-scenario-body {
    padding: 14px 16px 16px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
}

/* -- Steps with keyword pills -- */
.guide-step {
    display: flex;
    align-items: baseline;
    padding: 3px 0;
    font-size: 0.875rem;
    line-height: 1.55;
}

.guide-keyword {
    display: inline-block;
    font-weight: 700;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 1px 8px;
    border-radius: 10px;
    margin-right: 10px;
    flex-shrink: 0;
    text-align: center;
    min-width: 48px;
    line-height: 1.6;
}

/* Keyword pill colors — dark theme (default) */
.guide-kw-given  { background: rgba(59,130,246,0.15); color: #60a5fa; }
.guide-kw-when   { background: rgba(245,158,11,0.15); color: #fbbf24; }
.guide-kw-then   { background: rgba(16,185,129,0.15); color: #34d399; }
.guide-kw-and    { background: rgba(107,114,128,0.15); color: #9ca3af; }
.guide-kw-but    { background: rgba(107,114,128,0.15); color: #9ca3af; }
.guide-kw-\*     { background: rgba(107,114,128,0.15); color: #9ca3af; }

/* Light theme keyword pills */
[data-theme="light"] .guide-kw-given  { background: rgba(59,130,246,0.12); color: #2563eb; }
[data-theme="light"] .guide-kw-when   { background: rgba(245,158,11,0.12); color: #d97706; }
[data-theme="light"] .guide-kw-then   { background: rgba(16,185,129,0.12); color: #059669; }
[data-theme="light"] .guide-kw-and    { background: rgba(107,114,128,0.10); color: #6b7280; }
[data-theme="light"] .guide-kw-but    { background: rgba(107,114,128,0.10); color: #6b7280; }
[data-theme="light"] .guide-kw-\*     { background: rgba(107,114,128,0.10); color: #6b7280; }

.guide-step-text {
    color: var(--text-primary);
    font-size: 0.875rem;
}

/* -- Divider (comment lines) -- */
.guide-divider {
    margin: 12px 0 6px;
    padding: 4px 0;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

/* -- Tables inside steps -- */
.guide-table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0 12px;
    font-size: 0.8125rem;
}
.guide-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    text-align: left;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}
.guide-table td {
    padding: 5px 12px;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}
.guide-table tbody tr:hover {
    background: var(--bg-hover);
}

/* -- Examples -- */
.guide-examples {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color);
}
.guide-examples-title {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

/* -- No Results -- */
.guide-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
    font-size: 0.9375rem;
}

/* -- Responsive: hide sidebar below 1100px -- */
@media (max-width: 1100px) {
    .guide-toc {
        display: none;
    }
    .guide-body {
        max-width: 100%;
    }
}

/* Guide live stats */
.guide-live-stats {
    background: rgba(115, 30, 227, 0.05);
    border: 1px solid rgba(115, 30, 227, 0.15);
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 24px;
}
.guide-live-stats h3 {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
    opacity: 0.8;
}
.guide-stat-card {
    background: rgba(255,255,255,0.05);
    border-radius: 6px;
    padding: 10px 12px;
    text-align: center;
}
.guide-stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #731ee3;
}
.guide-stat-label {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 2px;
}
