/* ============================================================
   Keel — Docs, Examples & Tools pages
   Additional styles layered on top of style.css
   ============================================================ */

/* ---- Page header (hero for sub-pages) ---- */
.page-header {
    padding: calc(var(--nav-height) + 60px) 0 60px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(99,102,241,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99,102,241,0.04) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse at 60% 50%, black 20%, transparent 65%);
    -webkit-mask-image: radial-gradient(ellipse at 60% 50%, black 20%, transparent 65%);
    pointer-events: none;
}

.page-header-inner {
    position: relative;
    z-index: 1;
}

.page-header-tag {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    background: rgba(99,102,241,0.1);
    border: 1px solid rgba(99,102,241,0.2);
    padding: 4px 12px;
    border-radius: 100px;
    margin-bottom: 16px;
}

.page-header h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.15;
    margin-bottom: 16px;
}

.page-header p {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 540px;
}

/* ---- Active nav link ---- */
.nav-links a.nav-active {
    color: var(--accent) !important;
}

.nav-links a.nav-active::after {
    width: 100%;
}

/* ============================================================
   DOCS PAGE
   ============================================================ */
.docs-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 0;
    min-height: calc(100vh - var(--nav-height) - 180px);
    align-items: start;
}

/* ---- Sidebar ---- */
.docs-sidebar {
    position: sticky;
    top: calc(var(--nav-height) + 24px);
    height: calc(100vh - var(--nav-height) - 48px);
    overflow-y: auto;
    padding: 28px 0 28px 24px;
    border-right: 1px solid var(--border);
    scrollbar-width: thin;
}

.docs-sidebar::-webkit-scrollbar {
    width: 4px;
}

.docs-sidebar::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 2px;
}

.sidebar-search {
    position: relative;
    margin-bottom: 24px;
    padding-right: 24px;
}

.sidebar-search input {
    width: 100%;
    padding: 8px 12px 8px 34px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: var(--font-sans);
    outline: none;
    transition: border-color var(--transition-fast);
}

.sidebar-search input:focus {
    border-color: var(--accent);
}

.sidebar-search svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.sidebar-nav {
    padding-right: 24px;
}

.sidebar-group {
    margin-bottom: 24px;
}

.sidebar-group-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0 8px;
    margin-bottom: 6px;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    display: flex;
    flex-direction: column;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    border-left: 2px solid transparent;
}

.sidebar-nav a:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.sidebar-nav a.active {
    color: var(--accent);
    background: rgba(99,102,241,0.06);
    border-left-color: var(--accent);
    font-weight: 500;
}

.sidebar-nav a svg {
    flex-shrink: 0;
    opacity: 0.6;
}

.sidebar-nav a.active svg {
    opacity: 1;
}

/* Nested items */
.sidebar-nav .sub-items {
    margin-left: 16px;
    padding-left: 12px;
    border-left: 1px solid var(--border);
    margin-top: 4px;
    display: none;
}

.sidebar-nav li.expanded .sub-items {
    display: flex;
    flex-direction: column;
}

.sidebar-nav .sub-items a {
    font-size: 0.83rem;
    padding: 4px 8px;
}

/* Mobile sidebar toggle */
.sidebar-toggle {
    display: none;
    align-items: center;
    gap: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font-sans);
    margin-bottom: 16px;
    width: 100%;
}

.sidebar-toggle svg {
    transition: transform var(--transition-fast);
}

.sidebar-toggle.open svg {
    transform: rotate(180deg);
}

/* ---- Docs content area ---- */
.docs-content {
    padding: 40px 48px 80px;
    min-width: 0;
}

.docs-section {
    margin-bottom: 80px;
    scroll-margin-top: calc(var(--nav-height) + 24px);
}

.docs-section:last-child {
    margin-bottom: 0;
}

.docs-section h2 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.docs-section h2 .section-anchor {
    font-size: 1rem;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity var(--transition-fast);
    text-decoration: none;
}

.docs-section h2:hover .section-anchor {
    opacity: 1;
}

.docs-section h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 36px 0 12px;
}

.docs-section h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 24px 0 8px;
    color: var(--text-secondary);
}

.docs-section p {
    margin-bottom: 16px;
    line-height: 1.75;
    color: var(--text-secondary);
}

.docs-section p:last-child {
    margin-bottom: 0;
}

.docs-section ul,
.docs-section ol {
    margin: 12px 0 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.docs-section li {
    color: var(--text-secondary);
    line-height: 1.65;
}

.docs-section li code {
    font-size: 0.88em;
}

/* Docs callout boxes */
.callout {
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin: 24px 0;
    border-left: 3px solid;
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.callout-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.callout-body {
    flex: 1;
    min-width: 0;
}

.callout-body strong {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.callout-body p,
.callout-body li {
    font-size: 0.9rem;
    margin-bottom: 0;
}

.callout-info {
    background: rgba(6,182,212,0.07);
    border-color: var(--info);
}

.callout-info .callout-icon { color: var(--info); }

.callout-warning {
    background: rgba(245,158,11,0.07);
    border-color: var(--warning);
}

.callout-warning .callout-icon { color: var(--warning); }

.callout-tip {
    background: rgba(34,197,94,0.07);
    border-color: var(--success);
}

.callout-tip .callout-icon { color: var(--success); }

.callout-danger {
    background: rgba(239,68,68,0.07);
    border-color: var(--danger);
}

.callout-danger .callout-icon { color: var(--danger); }

/* Feature badge inline */
.badge-stable {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 100px;
    vertical-align: middle;
    margin-left: 8px;
}

.badge-stable { background: rgba(34,197,94,0.12); color: var(--success); border: 1px solid rgba(34,197,94,0.3); }
.badge-hardening { background: rgba(245,158,11,0.12); color: var(--warning); border: 1px solid rgba(245,158,11,0.3); }
.badge-experimental { background: rgba(239,68,68,0.12); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }

/* Docs table */
.docs-table-wrap {
    overflow-x: auto;
    margin: 24px 0;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.docs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.docs-table th {
    background: var(--bg-tertiary);
    padding: 12px 16px;
    text-align: left;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.docs-table td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    color: var(--text-secondary);
    line-height: 1.5;
}

.docs-table tr:last-child td {
    border-bottom: none;
}

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

.docs-table td code {
    font-size: 0.82em;
    white-space: nowrap;
}

/* Parameter type tag */
.param-type {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--info);
    background: rgba(6,182,212,0.08);
    padding: 1px 6px;
    border-radius: 3px;
    border: 1px solid rgba(6,182,212,0.2);
}

.param-default {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* ============================================================
   EXAMPLES PAGE
   ============================================================ */
.examples-page {
    padding: 48px 0 80px;
}

.examples-filter {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 36px;
    align-items: center;
}

.examples-filter-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-right: 4px;
}

.filter-btn {
    padding: 6px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 100px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-sans);
}

.filter-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
    margin-bottom: 48px;
}

.example-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-base);
    cursor: pointer;
}

.example-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
    transform: translateY(-3px);
}

.example-card-header {
    padding: 24px 24px 16px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.example-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.2rem;
}

.example-icon.pg    { background: rgba(99,102,241,0.12); color: var(--accent); }
.example-icon.mysql { background: rgba(6,182,212,0.12);  color: var(--info); }
.example-icon.k8s   { background: rgba(34,197,94,0.12);  color: var(--success); }
.example-icon.cloud { background: rgba(245,158,11,0.12); color: var(--warning); }
.example-icon.ops   { background: rgba(139,92,246,0.12); color: #a78bfa; }
.example-icon.hooks { background: rgba(239,68,68,0.12);  color: var(--danger); }

.example-card-meta {
    flex: 1;
    min-width: 0;
}

.example-tag {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.example-card-meta h3 {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
}

.example-card-body {
    padding: 0 24px 20px;
}

.example-card-body p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.65;
    margin-bottom: 16px;
}

.example-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.example-chip {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    padding: 3px 9px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
}

.example-card-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.example-difficulty {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.difficulty-dots {
    display: flex;
    gap: 3px;
}

.difficulty-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border);
}

.difficulty-dot.filled {
    background: var(--accent);
}

.example-expand-btn {
    font-size: 0.82rem;
    color: var(--accent);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-sans);
    padding: 0;
}

.example-expand-btn:hover {
    color: var(--accent-light);
}

/* Expanded example modal/drawer */
.example-detail {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 24px;
    overflow-y: auto;
}

.example-detail.open {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.example-detail-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 860px;
    margin: auto;
    overflow: hidden;
    position: relative;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.example-detail-header {
    padding: 24px 28px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--bg-primary);
}

.example-detail-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
}

.example-detail-close {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all var(--transition-fast);
    font-size: 1.1rem;
}

.example-detail-close:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.example-detail-body {
    padding: 28px;
}

.example-detail-body p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.75;
}

.example-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
    overflow-x: auto;
}

.example-tab-btn {
    padding: 8px 18px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: all var(--transition-fast);
    margin-bottom: -1px;
    white-space: nowrap;
}

.example-tab-btn:hover {
    color: var(--text-primary);
}

.example-tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.example-tab-panel {
    display: none;
    animation: fadeIn 0.2s ease;
}

.example-tab-panel.active {
    display: block;
}

/* ============================================================
   TOOLS PAGE
   ============================================================ */
.tools-page {
    padding: 48px 0 80px;
}

.tools-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 36px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.tools-tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: all var(--transition-fast);
    margin-bottom: -1px;
    white-space: nowrap;
}

.tools-tab-btn:hover {
    color: var(--text-primary);
}

.tools-tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tools-tab-btn svg {
    opacity: 0.7;
}

.tools-tab-btn.active svg {
    opacity: 1;
}

.tool-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tool-panel.active {
    display: block;
}

.tool-intro {
    max-width: 600px;
    margin-bottom: 40px;
}

.tool-intro h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.tool-intro p {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Calculator Tool */
.calc-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 32px;
    align-items: start;
}

.calc-inputs {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
}

.calc-inputs h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}

.form-label span:first-child {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: var(--font-mono);
    outline: none;
    transition: border-color var(--transition-fast);
    appearance: none;
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

input[type="range"].form-input {
    padding: 4px 0;
    background: transparent;
    border: none;
    accent-color: var(--accent);
    cursor: pointer;
}

.form-range-display {
    text-align: right;
    font-size: 0.85rem;
    font-family: var(--font-mono);
    color: var(--accent);
    margin-top: 4px;
}

select.form-input {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6b82' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.calc-results {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.calc-output-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
}

.calc-output-card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.result-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.result-metric {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
}

.result-metric-value {
    font-size: 1.8rem;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--accent);
    line-height: 1;
    margin-bottom: 6px;
}

.result-metric-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pool-bar-chart {
    margin-top: 8px;
}

.pool-bar-chart h4 {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.bar-row {
    display: grid;
    grid-template-columns: 100px 1fr 60px;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.83rem;
}

.bar-label {
    color: var(--text-secondary);
    text-align: right;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.bar-track {
    background: var(--bg-primary);
    border-radius: 4px;
    height: 18px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
    min-width: 2px;
}

.bar-fill.app-clients   { background: linear-gradient(90deg, #818cf8, #6366f1); }
.bar-fill.pool-max      { background: linear-gradient(90deg, #4ade80, #22c55e); }
.bar-fill.pool-min      { background: linear-gradient(90deg, #34d399, #10b981); }
.bar-fill.pool-active   { background: linear-gradient(90deg, #60a5fa, #3b82f6); }

.bar-value {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.calc-output-ini {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 0.83rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-top: 16px;
    overflow-x: auto;
}

.ini-comment { color: var(--text-muted); }
.ini-section { color: var(--accent); font-weight: 600; }
.ini-key     { color: var(--info); }
.ini-value   { color: var(--success); }
.ini-value-special { color: var(--warning); }

/* Config Builder */
.builder-layout {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 32px;
    align-items: start;
}

.builder-steps {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 32px;
}

.builder-step-indicator {
    display: flex;
    align-items: center;
    gap: 0;
}

.step-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: all var(--transition-base);
    cursor: pointer;
}

.step-dot.active {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.step-dot.done {
    border-color: var(--success);
    background: var(--success);
    color: #fff;
}

.step-connector {
    flex: 1;
    height: 2px;
    background: var(--border);
    transition: background var(--transition-base);
}

.step-connector.done {
    background: var(--success);
}

.builder-form-step {
    display: none;
    animation: fadeIn 0.3s ease;
}

.builder-form-step.active {
    display: block;
}

.builder-step-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.builder-step-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 28px;
    line-height: 1.6;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-radio-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 6px;
}

.form-radio-card {
    position: relative;
}

.form-radio-card input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.form-radio-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.form-radio-card input:checked + .form-radio-label {
    border-color: var(--accent);
    background: rgba(99,102,241,0.06);
}

.form-radio-label:hover {
    border-color: var(--border-light);
}

.radio-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.radio-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.builder-nav {
    display: flex;
    gap: 12px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.builder-nav .btn {
    flex: 1;
    justify-content: center;
}

/* Config preview pane */
.config-preview-pane {
    position: sticky;
    top: calc(var(--nav-height) + 24px);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.config-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.config-preview-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    display: flex;
    align-items: center;
    gap: 8px;
}

.config-preview-title::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s ease-in-out infinite;
}

.config-preview-copy {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
    font-family: var(--font-sans);
    transition: all var(--transition-fast);
}

.config-preview-copy:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.config-preview-content {
    padding: 20px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.7;
    color: var(--text-secondary);
    max-height: 70vh;
    overflow-y: auto;
    white-space: pre;
}

/* Router Simulator */
.router-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: start;
}

.router-input-panel,
.router-output-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.panel-header {
    padding: 14px 18px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-body {
    padding: 20px;
}

.sql-textarea {
    width: 100%;
    min-height: 160px;
    padding: 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.88rem;
    line-height: 1.65;
    resize: vertical;
    outline: none;
    transition: border-color var(--transition-fast);
    margin-bottom: 16px;
}

.sql-textarea:focus {
    border-color: var(--accent);
}

.router-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.route-result {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.route-decision {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.route-decision-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
}

.route-decision-icon.primary { background: rgba(99,102,241,0.15); }
.route-decision-icon.replica { background: rgba(34,197,94,0.15); }
.route-decision-icon.shard   { background: rgba(245,158,11,0.15); }

.route-decision-info {
    flex: 1;
}

.route-decision-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.route-decision-value {
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.route-reason-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.route-reason {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.route-reason-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.route-reason-dot.ok   { background: var(--success); }
.route-reason-dot.warn { background: var(--warning); }
.route-reason-dot.info { background: var(--info); }

.router-example-queries {
    margin-top: 20px;
}

.router-example-queries h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.example-query-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.example-query-btn {
    padding: 5px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.example-query-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .docs-layout {
        grid-template-columns: 220px 1fr;
    }

    .docs-content {
        padding: 32px 28px 60px;
    }

    .calc-layout,
    .builder-layout,
    .router-layout {
        grid-template-columns: 1fr;
    }

    .config-preview-pane {
        position: static;
    }
}

@media (max-width: 768px) {
    .docs-layout {
        grid-template-columns: 1fr;
    }

    .docs-sidebar {
        position: relative;
        top: 0;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 16px;
        display: none;
    }

    .docs-sidebar.open {
        display: block;
    }

    .sidebar-toggle {
        display: flex;
    }

    .docs-content {
        padding: 24px 16px 60px;
    }

    .examples-grid {
        grid-template-columns: 1fr;
    }

    .form-grid-2,
    .form-radio-group {
        grid-template-columns: 1fr;
    }

    .router-layout {
        grid-template-columns: 1fr;
    }

    .result-metrics {
        grid-template-columns: 1fr 1fr;
    }

    .bar-row {
        grid-template-columns: 80px 1fr 50px;
    }

    .example-detail {
        padding: 12px;
    }

    .example-detail-panel {
        border-radius: var(--radius-lg);
    }
}

@media (max-width: 480px) {
    .page-header {
        padding: calc(var(--nav-height) + 32px) 0 40px;
    }

    .tools-tab-btn {
        padding: 10px 14px;
        font-size: 0.875rem;
    }

    .result-metrics {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   Supplemental — classes for new multi-page HTML
   ============================================================ */

/* Radio cards (new variant used by tools.html) */
.radio-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: all .15s;
    flex: 1;
    min-width: 100px;
}
.radio-card input[type="radio"] { display: none; }
.radio-card:hover { border-color: var(--accent); }
.radio-card.active,
.radio-card:has(input:checked) {
    border-color: var(--accent);
    background: rgba(99,102,241,.08);
}
.radio-card.big { align-items: flex-start; padding: 14px 16px; gap: 14px; }
.radio-card-group { display: flex; gap: 10px; flex-wrap: wrap; }
.radio-card-group.vertical { flex-direction: column; }
.radio-card-icon {
    width: 36px; height: 36px;
    border-radius: 8px;
    background: rgba(99,102,241,.12);
    color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.radio-card-title {
    display: block;
    font-size: .875rem; font-weight: 600;
    color: var(--text-primary); margin-bottom: 2px;
    font-family: var(--font-mono);
}
.radio-card-desc {
    display: block;
    font-size: .78rem; color: var(--text-muted); line-height: 1.4;
}

/* Slider row */
.slider-row { display: flex; align-items: center; gap: 12px; }
.form-range {
    flex: 1; -webkit-appearance: none; appearance: none;
    height: 5px; background: var(--border); border-radius: 3px;
    outline: none; cursor: pointer;
}
.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px; height: 18px;
    background: var(--accent); border-radius: 50%; cursor: pointer;
    box-shadow: 0 0 0 3px rgba(99,102,241,.2);
}
.slider-val {
    font-family: var(--font-mono); font-size: .85rem; font-weight: 600;
    color: var(--accent); min-width: 48px; text-align: right;
}

/* Pool calculator cards */
.calc-result-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px; padding: 16px; text-align: center;
}
.calc-result-card.highlight {
    border-color: var(--accent);
    background: rgba(99,102,241,.06);
}
.result-title {
    font-size: .72rem; font-weight: 600; letter-spacing: .06em;
    text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px;
}
.result-value {
    font-size: 1.8rem; font-weight: 800; color: var(--text-primary);
    line-height: 1; font-variant-numeric: tabular-nums; margin-bottom: 4px;
}
.result-label { font-size: .75rem; color: var(--text-muted); }

/* Bar chart */
.calc-chart {
    grid-column: 1 / -1;
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: 12px; padding: 16px; margin-top: 4px;
}
.chart-label {
    font-size: .72rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: .06em; color: var(--text-muted); margin-bottom: 14px;
}
.chart-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.chart-row:last-child { margin-bottom: 0; }
.chart-row-label {
    font-size: .75rem; color: var(--text-muted);
    width: 110px; flex-shrink: 0; text-align: right;
}
.chart-bar-wrap {
    flex: 1; background: var(--bg-primary); border-radius: 4px;
    height: 28px; overflow: hidden;
}
.chart-bar {
    height: 100%; border-radius: 4px;
    display: flex; align-items: center; justify-content: flex-end;
    padding-right: 8px; font-size: .78rem; font-weight: 700; color: #fff;
    transition: width .4s cubic-bezier(.4,0,.2,1); min-width: 36px;
}
.bar-clients { background: linear-gradient(90deg, #6366f1, #818cf8); }
.bar-pool    { background: linear-gradient(90deg, #06b6d4, #22d3ee); }
.bar-min     { background: linear-gradient(90deg, #22c55e, #4ade80); }

/* Config snippet output */
.calc-config-output {
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: 12px; overflow: hidden;
}
.calc-config-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; border-bottom: 1px solid var(--border);
    font-size: .8rem; font-weight: 600; color: var(--text-muted);
}
.calc-copy-btn { font-size: .78rem; padding: 4px 10px; }
.calc-config-pre {
    margin: 0; padding: 16px; font-size: .82rem;
    font-family: var(--font-mono); color: var(--text-secondary);
    overflow-x: auto; line-height: 1.7; white-space: pre;
}
.ini-comment { color: var(--text-muted); font-style: italic; }
.ini-section  { color: #f59e0b; font-weight: 600; }
.ini-key      { color: #06b6d4; }
.ini-value    { color: #4ade80; }
.ini-equals   { color: var(--text-muted); }

/* Config builder extras */
.step-item {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    white-space: nowrap;
}
.step-item span {
    font-size: .72rem; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .05em;
}
.step-item.active span { color: var(--accent); }
.step-item.done  span { color: var(--text-secondary); }
.step-divider {
    flex: 1; height: 2px; background: var(--border);
    min-width: 24px; margin-bottom: 24px;
}
.wizard-nav {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border);
}
.backend-row {
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: 10px; padding: 14px; margin-bottom: 12px;
}
.backend-row-header {
    display: flex; align-items: center; justify-content: space-between;
    font-size: .8rem; font-weight: 600; color: var(--text-muted); margin-bottom: 12px;
}
.btn-sm { padding: 6px 14px; font-size: .8rem; }
.done-state {
    text-align: center; padding: 40px 20px;
    display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.done-icon {
    width: 56px; height: 56px; border-radius: 50%;
    background: rgba(34,197,94,.15); color: #22c55e;
    font-size: 1.5rem; display: flex; align-items: center; justify-content: center;
}
.done-state h3 { font-size: 1.1rem; color: var(--text-primary); margin: 0; }
.done-state p  { font-size: .875rem; color: var(--text-secondary); margin: 0; }
.config-preview-pane {
    position: sticky; top: calc(var(--nav-height) + 24px);
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: 12px; overflow: hidden;
}
.config-preview-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; border-bottom: 1px solid var(--border);
    font-size: .8rem; font-weight: 600; color: var(--text-muted);
}
.config-preview-pre {
    margin: 0; padding: 16px; font-size: .8rem;
    font-family: var(--font-mono); color: var(--text-secondary);
    overflow-x: auto; max-height: 520px; overflow-y: auto;
    line-height: 1.7; white-space: pre;
}
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row .form-group { min-width: 120px; }
.form-checkbox-label {
    display: flex; align-items: center; gap: 8px;
    font-size: .875rem; color: var(--text-secondary); cursor: pointer;
}
.form-checkbox-label input[type="checkbox"] {
    width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer;
}

/* Query router new classes */
.router-input-pane { display: flex; flex-direction: column; gap: 16px; }
.sql-examples { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.sql-example-btn {
    font-size: .75rem; font-weight: 500;
    background: var(--bg-secondary); border: 1px solid var(--border);
    color: var(--text-muted); padding: 4px 10px; border-radius: 6px;
    cursor: pointer; font-family: var(--font-mono); transition: all .15s;
}
.sql-example-btn:hover {
    border-color: var(--accent); color: var(--accent);
    background: rgba(99,102,241,.06);
}
.router-result-pane { position: sticky; top: calc(var(--nav-height) + 24px); }
.route-decision-wrap {
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: 14px; min-height: 280px; overflow: hidden;
    transition: border-color .2s;
}
.route-decision-idle {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 16px; color: var(--text-muted);
    text-align: center; padding: 48px 24px;
}
.route-decision-idle p { font-size: .875rem; line-height: 1.5; }
.route-result-inner { padding: 24px; }
.route-badge {
    display: inline-block; font-size: .85rem; font-weight: 700;
    letter-spacing: .06em; text-transform: uppercase;
    padding: 6px 16px; border-radius: 99px; margin-bottom: 16px;
}
.route-badge.primary {
    background: rgba(239,68,68,.12); color: #ef4444;
    border: 1px solid rgba(239,68,68,.3);
}
.route-badge.replica {
    background: rgba(34,197,94,.12); color: #22c55e;
    border: 1px solid rgba(34,197,94,.3);
}
.route-badge.scatter {
    background: rgba(245,158,11,.12); color: #f59e0b;
    border: 1px solid rgba(245,158,11,.3);
}
.route-badge.none {
    background: rgba(99,102,241,.12); color: var(--accent);
    border: 1px solid rgba(99,102,241,.25);
}
.route-target {
    font-size: 1rem; font-weight: 600; color: var(--text-primary); margin-bottom: 16px;
}
.route-reasons-label {
    font-size: .72rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .08em; color: var(--text-muted); margin-bottom: 8px;
}
.route-reason-list {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-direction: column; gap: 6px;
}
.route-reason-list li {
    display: flex; align-items: flex-start; gap: 8px;
    font-size: .82rem; color: var(--text-secondary); line-height: 1.4;
}
.route-reason-list li::before {
    content: '→'; color: var(--accent); flex-shrink: 0; margin-top: 1px;
}
