
/* ahelp — contextual help panel (droide visual standards) */
.ahelp-panel {
    position: fixed;
    top: 0;
    right: -26.67rem;
    width: 25.56rem;
    height: 100vh;
    background: var(--bg-card, #111518);
    border-left: 3px solid var(--accent-blue, #818cf8);
    z-index: 1000;
    transition: right 0.25s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -0.67rem 0 2.22rem rgba(0,0,0,0.5);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.ahelp-panel.open { right: 0; }

.ahelp-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 2px solid var(--accent-blue, #818cf8);
    flex-shrink: 0;
    background: var(--bg, #0c1014);
}
.ahelp-panel-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-bright, #ffffff);
}

.ahelp-btn-close {
    background: none;
    border: 1px solid transparent;
    color: var(--text-subtle, #8a9aa8);
    cursor: pointer;
    padding: 0.33rem;
    border-radius: 0.33rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    min-height: 2rem;
}
.ahelp-btn-close:hover {
    color: var(--text, #e8edf2);
    background: var(--bg-hover, #1c2428);
    border-color: var(--border-bright, #2a3640);
}
.ahelp-btn-close:focus-visible {
    outline: 2px solid var(--accent-blue, #818cf8);
    outline-offset: 2px;
}

.ahelp-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1.25rem;
    font-size: 1.06rem;
    line-height: 1.7;
    color: var(--text, #e8edf2);
}
.ahelp-panel-body::-webkit-scrollbar { width: 0.33rem; }
.ahelp-panel-body::-webkit-scrollbar-track { background: transparent; }
.ahelp-panel-body::-webkit-scrollbar-thumb { background: var(--border-bright, #2a3640); border-radius: 0.17rem; }

.ahelp-panel-body h1,
.ahelp-panel-body h2,
.ahelp-panel-body h3 {
    color: var(--text-bright, #ffffff);
    font-weight: 700;
    line-height: 1.3;
}
.ahelp-panel-body h1 {
    font-size: 1.25rem;
    margin: 1.5rem 0 0.75rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--accent-blue, #818cf8);
}
.ahelp-panel-body h2 {
    font-size: 1.1rem;
    margin: 1.5rem 0 0.5rem 0;
    padding-bottom: 0.375rem;
    border-bottom: 1px solid var(--border, #1c2428);
    color: var(--accent-blue, #818cf8);
}
.ahelp-panel-body h3 {
    font-size: 1rem;
    margin: 1.25rem 0 0.5rem 0;
}
.ahelp-panel-body h1:first-child,
.ahelp-panel-body h2:first-child { margin-top: 0; }

.ahelp-panel-body p { margin: 0.5rem 0; }
.ahelp-panel-body ul, .ahelp-panel-body ol { padding-left: 1.25rem; margin: 0.5rem 0; }
.ahelp-panel-body li { margin: 0.375rem 0; }

.ahelp-panel-body code {
    background: rgba(129,140,248,0.15);
    color: var(--accent-blue, #818cf8);
    padding: 0.125rem 0.375rem;
    border-radius: 0.22rem;
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
    font-size: 0.9em;
}
.ahelp-panel-body pre {
    background: var(--bg-surface, #161b22);
    border: 1px solid var(--border, #1c2428);
    border-radius: 0.44rem;
    padding: 1rem;
    overflow-x: auto;
    margin: 0.75rem 0;
}
.ahelp-panel-body pre code {
    background: none;
    padding: 0;
    font-size: 0.94rem;
    line-height: 1.6;
    color: var(--text, #e8edf2);
}
.ahelp-panel-body strong { color: var(--text-bright, #ffffff); font-weight: 600; }
.ahelp-panel-body a { color: var(--accent-blue, #818cf8); text-decoration: none; }
.ahelp-panel-body a:hover { text-decoration: underline; }

.ahelp-panel-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75rem 0;
    font-size: 0.94rem;
}
.ahelp-panel-body th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 2px solid var(--border-bright, #2a3640);
    color: var(--text-bright, #ffffff);
    font-weight: 600;
    white-space: nowrap;
}
.ahelp-panel-body td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border, #1c2428);
    color: var(--text, #e8edf2);
}
.ahelp-panel-body tr:last-child td { border-bottom: none; }

.ahelp-panel-body blockquote {
    border-left: 3px solid var(--accent-gold, #daa04a);
    margin: 0.75rem 0;
    padding: 0.75rem 1rem;
    background: rgba(218,160,74,0.08);
    border-radius: 0 0.44rem 0.44rem 0;
    color: var(--text, #e8edf2);
    font-size: 1rem;
}

/* ? trigger button */
.ahelp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(129,140,248,0.12);
    border: 1px solid rgba(129,140,248,0.25);
    color: var(--accent-blue, #818cf8);
    font-size: 0.81rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    width: 1.11rem;
    height: 1.11rem;
    border-radius: 50%;
    vertical-align: middle;
    margin-left: 0.375rem;
    line-height: 1;
    font-family: system-ui, -apple-system, sans-serif;
}
.ahelp-btn:hover {
    background: rgba(129,140,248,0.25);
    border-color: var(--accent-blue, #818cf8);
    color: var(--text-bright, #ffffff);
}
.ahelp-btn:focus-visible {
    outline: 2px solid var(--accent-blue, #818cf8);
    outline-offset: 2px;
}

/* Standalone help page layout */
.ahelp-page-layout {
    display: grid;
    grid-template-columns: 12.22rem 1fr;
    gap: 2rem;
    max-width: 61.11rem;
    margin: 0 auto;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.ahelp-toc {
    position: sticky;
    top: 4.44rem;
    align-self: start;
    max-height: calc(100vh - 5.56rem);
    overflow-y: auto;
    padding-right: 1rem;
    border-right: 1px solid var(--border, #1c2428);
}
.ahelp-toc a {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--text-subtle, #8a9aa8);
    text-decoration: none;
    font-size: 0.94rem;
    border-radius: 0.33rem;
}
.ahelp-toc a:hover { color: var(--text, #e8edf2); background: var(--bg-hover, #1c2428); }
.ahelp-toc a.active { color: var(--accent-blue, #818cf8); background: rgba(129,140,248,0.1); }
.ahelp-toc .ahelp-toc-child { padding-left: 1.5rem; font-size: 0.88rem; }

/* Mobile */
@media (max-width: 768px) {
    .ahelp-panel { width: 100vw; right: -100vw; }
    .ahelp-page-layout { grid-template-columns: 1fr; }
    .ahelp-toc { position: static; border-right: none; border-bottom: 1px solid var(--border, #1c2428); padding-bottom: 1rem; margin-bottom: 1rem; }
    .ahelp-btn { width: 1.56rem; height: 1.56rem; font-size: 0.94rem; }
}

/* Print: hide panel and buttons */
@media print { .ahelp-panel, .ahelp-btn { display: none !important; } }

/* pubdoc content rendering */
/* PubDoc content styles — dark theme, scoped to .pubdoc-content */

.pubdoc-content h1 {
    color: #e8edf2;
    font-size: 2rem;
    font-weight: 800;
    margin: 0 0 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #818cf8;
    letter-spacing: -0.01em;
}

.pubdoc-content h2 {
    color: #818cf8;
    font-size: 1.55rem;
    font-weight: 700;
    margin: 2.5rem 0 1rem;
    padding-bottom: 0.375rem;
    border-bottom: 1px solid #1c2428;
}

.pubdoc-content h3 {
    color: #e8edf2;
    font-size: 1.3rem;
    font-weight: 700;
    margin: 1.75rem 0 0.75rem;
}

.pubdoc-content h4 {
    color: #a3b3c2;
    font-size: 1.1rem;
    font-weight: 700;
    margin: 1.5rem 0 0.5rem;
}

.pubdoc-content h5,
.pubdoc-content h6 {
    color: #8a9aa8;
    font-size: 1rem;
    font-weight: 600;
    margin: 1.25rem 0 0.5rem;
}

.pubdoc-content p {
    margin-bottom: 1.25rem;
    color: #e8edf2;
    font-size: 1rem;
    line-height: 1.8;
}

.pubdoc-content strong {
    color: #f0f4f8;
    font-weight: 600;
}

.pubdoc-content hr {
    border: none;
    border-top: 1px solid #1c2428;
    margin: 2.5rem 0;
}

.pubdoc-content pre:not(.mermaid) {
    background: #111518;
    border: 1px solid #1c2428;
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
    font-size: 0.9375rem;
    line-height: 1.5;
    margin: 1.25rem 0;
    white-space: pre;
}

.pubdoc-content code {
    background: rgba(129, 140, 248, 0.12);
    color: #a5b4fc;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
    font-size: 0.9em;
}

.pubdoc-content pre code {
    background: none;
    padding: 0;
}

.pubdoc-content ul,
.pubdoc-content ol {
    margin: 0.75rem 0 0.75rem 1.75rem;
}

.pubdoc-content li {
    margin: 0.5rem 0;
    font-size: 1rem;
    line-height: 1.8;
}

.pubdoc-content a {
    color: #818cf8;
    text-decoration: none;
    font-weight: 500;
}

.pubdoc-content a:hover {
    color: #f59e0b;
}

.pubdoc-content blockquote {
    border-left: 3px solid #818cf8;
    padding: 0.5rem 0 0.5rem 1.25rem;
    margin: 1.25rem 0;
    color: #e8edf2;
    background: rgba(129, 140, 248, 0.03);
    border-radius: 0 6px 6px 0;
}

.pubdoc-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1.25rem 0;
}

.pubdoc-content th,
.pubdoc-content td {
    border: 1px solid #1c2428;
    padding: 0.625rem 0.875rem;
    text-align: left;
    font-size: 0.95rem;
}

.pubdoc-content th {
    background: #070a0d;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 2px solid #818cf8;
}

.pubdoc-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.pubdoc-content input[type="checkbox"] {
    margin-right: 0.5rem;
}