:root {
    --brand-navy: #0b1930;
    --brand-navy-light: #13284a;
    --brand-red: #dc2626;
    --brand-red-dark: #b91c1c;
    --brand-blue: #2563eb;
    --brand-blue-soft: #eff6ff;
    --brand-emerald: #059669;
    --bg-page: #f1f5f9;
    --bg-surface: #ffffff;
    --border-color: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #475569;
    --text-soft: #64748b;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 8px 24px -4px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 20px 40px -12px rgba(15, 23, 42, 0.16);
}

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-main);
    background-color: var(--bg-page);
    line-height: 1.6;
}

body {
    margin: 0;
    min-height: 100vh;
    background-color: var(--bg-page);
    color: var(--text-main);
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   1. LOADING SCREEN
   ========================================================================== */
.wiki-boot-loader {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: radial-gradient(circle at top right, #1e3a8a 0%, #0b1930 65%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    gap: 16px;
}

.wiki-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ef4444;
    border-radius: 50%;
    animation: wiki-spin 0.8s linear infinite;
}

@keyframes wiki-spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   2. LOGIN GATE SCREEN
   ========================================================================== */
.wiki-auth-screen {
    min-height: 100vh;
    background:
        radial-gradient(circle at 15% 15%, rgba(37, 99, 235, 0.25) 0%, transparent 45%),
        radial-gradient(circle at 85% 80%, rgba(220, 38, 38, 0.22) 0%, transparent 45%),
        linear-gradient(135deg, #071122 0%, #0b1930 55%, #13284a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 16px;
}

.wiki-auth-shell {
    width: 100%;
    max-width: 1080px;
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 28px 60px -15px rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.wiki-auth-Showcase {
    background: linear-gradient(155deg, #0b1930 0%, #13284a 60%, #1e3a8a 100%);
    color: #fff;
    padding: 44px 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.wiki-auth-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.wiki-auth-logo {
    height: 46px;
    width: auto;
    object-fit: contain;
    background: #fff;
    padding: 6px 10px;
    border-radius: 12px;
}

.wiki-auth-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(220, 38, 38, 0.22);
    border: 1px solid rgba(248, 113, 113, 0.45);
    color: #fecaca;
    margin-bottom: 16px;
}

.wiki-auth-Showcase h1 {
    font-size: 28px;
    line-height: 1.25;
    font-weight: 800;
    margin: 0 0 14px 0;
    color: #ffffff;
}

.wiki-auth-Showcase p {
    font-size: 14.5px;
    color: #cbd5e1;
    margin: 0 0 24px 0;
    line-height: 1.65;
}

.wiki-auth-features {
    display: grid;
    gap: 12px;
    margin-bottom: 28px;
}

.wiki-auth-feature-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 12px 14px;
}

.wiki-auth-feature-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: rgba(59, 130, 246, 0.25);
    color: #93c5fd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex-shrink: 0;
    font-size: 14px;
}

.wiki-auth-feature-item strong {
    display: block;
    font-size: 13.5px;
    color: #f8fafc;
    margin-bottom: 2px;
}

.wiki-auth-feature-item span {
    font-size: 12.5px;
    color: #cbd5e1;
}

.wiki-auth-foot-note {
    font-size: 12px;
    color: #94a3b8;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: space-between;
}

.wiki-auth-foot-note a {
    color: #93c5fd;
    text-decoration: none;
    font-weight: 600;
}

.wiki-auth-foot-note a:hover {
    text-decoration: underline;
}

.wiki-auth-form-pane {
    padding: 44px 38px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #ffffff;
}

.wiki-auth-form-pane h2 {
    margin: 0 0 6px 0;
    font-size: 22px;
    font-weight: 800;
    color: var(--brand-navy);
}

.wiki-auth-form-pane .wiki-auth-sub {
    margin: 0 0 24px 0;
    font-size: 13.5px;
    color: var(--text-muted);
}

.wiki-form-group {
    margin-bottom: 18px;
}

.wiki-form-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 6px;
}

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

.wiki-input {
    width: 100%;
    padding: 12px 14px;
    font-size: 14px;
    border: 1.5px solid #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
    color: #0f172a;
    transition: all 0.15s ease;
}

.wiki-input:focus {
    outline: none;
    border-color: var(--brand-blue);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.wiki-pw-toggle {
    position: absolute;
    right: 10px;
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 8px;
}

.wiki-pw-toggle:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.wiki-auth-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    padding: 11px 14px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 16px;
}

.wiki-btn-submit {
    width: 100%;
    padding: 13px 18px;
    background: linear-gradient(135deg, var(--brand-red) 0%, var(--brand-red-dark) 100%);
    color: #ffffff;
    font-size: 14.5px;
    font-weight: 800;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 8px 20px -4px rgba(220, 38, 38, 0.45);
    transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.wiki-btn-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px -4px rgba(220, 38, 38, 0.55);
}

.wiki-btn-submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.wiki-auth-info-box {
    margin-top: 20px;
    padding: 13px 14px;
    border-radius: 12px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    font-size: 12.5px;
    color: #475569;
    line-height: 1.55;
}

.wiki-auth-info-box strong {
    color: #0f172a;
}

.wiki-auth-links {
    margin-top: 18px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 12.5px;
}

.wiki-auth-links a {
    color: var(--brand-blue);
    font-weight: 700;
    text-decoration: none;
}

.wiki-auth-links a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   3. TOP HEADER BAR (AUTHENTICATED PORTAL)
   ========================================================================== */
.wiki-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--brand-navy);
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 16px rgba(11, 25, 48, 0.18);
}

.wiki-topbar-inner {
    max-width: 1560px;
    margin: 0 auto;
    height: 66px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.wiki-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.wiki-mobile-menu-btn {
    display: none;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    border-radius: 10px;
    padding: 8px 10px;
    cursor: pointer;
    font-weight: 700;
    font-size: 13px;
}

.wiki-brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #fff;
}

.wiki-brand-logo {
    height: 36px;
    width: auto;
    background: #fff;
    padding: 4px 8px;
    border-radius: 9px;
}

.wiki-brand-titles {
    display: flex;
    flex-direction: column;
}

.wiki-brand-name {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: #fff;
    line-height: 1.2;
}

.wiki-brand-sub {
    font-size: 11px;
    color: #93c5fd;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Search Box */
.wiki-search-container {
    position: relative;
    flex: 1;
    max-width: 480px;
}

.wiki-search-input {
    width: 100%;
    padding: 9px 14px 9px 36px;
    border-radius: 11px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.09);
    color: #ffffff;
    font-size: 13.5px;
    transition: all 0.15s ease;
}

.wiki-search-input::placeholder {
    color: #94a3b8;
}

.wiki-search-input:focus {
    outline: none;
    background: #ffffff;
    color: #0f172a;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.28);
}

.wiki-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 13px;
    pointer-events: none;
}

.wiki-search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #ffffff;
    color: #0f172a;
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    max-height: 420px;
    overflow-y: auto;
    z-index: 60;
    padding: 8px;
}

.wiki-search-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border: none;
    background: transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.12s ease;
}

.wiki-search-item:hover {
    background: #f1f5f9;
}

.wiki-search-item-mod {
    font-size: 11px;
    font-weight: 700;
    color: var(--brand-blue);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.wiki-search-item-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #0f172a;
    margin-top: 2px;
}

.wiki-search-item-snippet {
    font-size: 12px;
    color: #64748b;
    margin-top: 2px;
}

.wiki-topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wiki-user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    padding: 5px 12px 5px 8px;
    border-radius: 999px;
}

.wiki-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--brand-red);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wiki-user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.wiki-user-name {
    font-size: 12.5px;
    font-weight: 700;
    color: #f8fafc;
}

.wiki-user-role {
    font-size: 10.5px;
    color: #93c5fd;
    font-weight: 600;
}

.wiki-logout-btn {
    background: rgba(220, 38, 38, 0.2);
    border: 1px solid rgba(248, 113, 113, 0.4);
    color: #fecaca;
    font-size: 12px;
    font-weight: 700;
    padding: 7px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.wiki-logout-btn:hover {
    background: var(--brand-red);
    color: #ffffff;
}

/* ==========================================================================
   4. MAIN 3-COLUMN WORKSPACE LAYOUT
   ========================================================================== */
.wiki-workspace {
    max-width: 1560px;
    margin: 0 auto;
    padding: 24px 20px 64px;
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr) 260px;
    gap: 24px;
    align-items: start;
}

/* Left Sidebar */
.wiki-sidebar {
    position: sticky;
    top: 86px;
    max-height: calc(100vh - 104px);
    overflow-y: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.wiki-sidebar-section-label {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-soft);
    margin: 0 0 10px 4px;
}

.wiki-filter-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 16px;
}

.wiki-filter-tab {
    padding: 7px 10px;
    font-size: 11.5px;
    font-weight: 700;
    border-radius: 9px;
    border: 1px solid var(--border-color);
    background: #f8fafc;
    color: var(--text-muted);
    cursor: pointer;
    text-align: center;
    transition: all 0.12s ease;
}

.wiki-filter-tab:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.wiki-filter-tab.active {
    background: var(--brand-navy);
    color: #ffffff;
    border-color: var(--brand-navy);
}

.wiki-module-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wiki-module-btn {
    width: 100%;
    text-align: left;
    padding: 11px 12px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    transition: all 0.14s ease;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wiki-module-btn:hover {
    background: #f8fafc;
    border-color: #e2e8f0;
}

.wiki-module-btn.active {
    background: #eff6ff;
    border-color: #93c5fd;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}

.wiki-module-btn-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.wiki-module-code {
    font-size: 10.5px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 6px;
    background: #e2e8f0;
    color: #334155;
}

.wiki-module-btn.active .wiki-module-code {
    background: var(--brand-blue);
    color: #ffffff;
}

.wiki-module-audience {
    font-size: 10.5px;
    font-weight: 600;
    color: #64748b;
}

.wiki-module-name {
    font-size: 13.5px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.35;
}

.wiki-module-btn.active .wiki-module-name {
    color: #1d4ed8;
}

/* Center Main Content */
.wiki-main {
    min-width: 0;
}

.wiki-overview-strip {
    background: linear-gradient(135deg, #0b1930 0%, #172e54 100%);
    color: #fff;
    border-radius: 18px;
    padding: 22px 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
}

.wiki-overview-strip-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.wiki-overview-strip h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
}

.wiki-overview-strip p {
    margin: 4px 0 0 0;
    font-size: 13px;
    color: #cbd5e1;
}

.wiki-quick-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
    gap: 10px;
}

.wiki-quick-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    padding: 10px 12px;
    color: #fff;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
}

.wiki-quick-card:hover {
    background: rgba(255, 255, 255, 0.16);
    transform: translateY(-1px);
}

.wiki-quick-card.active {
    background: rgba(37, 99, 235, 0.38);
    border-color: #60a5fa;
}

.wiki-quick-card-code {
    font-size: 10px;
    font-weight: 800;
    color: #93c5fd;
    text-transform: uppercase;
}

.wiki-quick-card-title {
    font-size: 13px;
    font-weight: 700;
    margin-top: 2px;
    color: #ffffff;
}

/* Article Card */
.wiki-article-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 32px 36px;
    box-shadow: var(--shadow-sm);
}

.wiki-article-hero {
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 22px;
    margin-bottom: 28px;
}

.wiki-article-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.wiki-badge {
    font-size: 11px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.wiki-badge-code {
    background: var(--brand-navy);
    color: #ffffff;
}

.wiki-badge-audience {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.wiki-article-title {
    font-size: 26px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 10px 0;
    line-height: 1.28;
}

.wiki-article-summary {
    font-size: 14.5px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.65;
}

/* Typography inside article */
.wiki-h2 {
    font-size: 21px;
    font-weight: 800;
    color: #0f172a;
    margin: 36px 0 14px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
    scroll-margin-top: 90px;
}

.wiki-h3 {
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
    margin: 26px 0 10px 0;
    scroll-margin-top: 90px;
}

.wiki-h4 {
    font-size: 15px;
    font-weight: 700;
    color: #334155;
    margin: 20px 0 8px 0;
}

.wiki-p {
    font-size: 14.5px;
    color: #334155;
    margin: 0 0 14px 0;
    line-height: 1.7;
}

.wiki-divider {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 28px 0;
}

.wiki-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12.5px;
    background: #f1f5f9;
    color: #0f172a;
    padding: 2px 6px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.wiki-code-success {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
    font-weight: 700;
}

.wiki-code-role {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
    font-weight: 700;
}

.wiki-pre {
    background: #0f172a;
    color: #f8fafc;
    padding: 16px 18px;
    border-radius: 12px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.55;
    margin: 14px 0 20px;
}

.wiki-callout {
    background: #eff6ff;
    border-left: 4px solid var(--brand-blue);
    border-radius: 0 12px 12px 0;
    padding: 14px 18px;
    margin: 16px 0 20px;
    font-size: 14px;
    color: #1e3a8a;
}

/* Lists & Steps */
.wiki-ul {
    margin: 0 0 16px 0;
    padding-left: 22px;
    color: #334155;
    font-size: 14.5px;
}

.wiki-ul li {
    margin-bottom: 6px;
}

.wiki-checklist {
    list-style: none;
    padding: 0;
    margin: 0 0 18px 0;
    display: grid;
    gap: 8px;
}

.wiki-check-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
}

.wiki-check-box {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: #dbeafe;
    color: #1d4ed8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
    margin-top: 2px;
}

.wiki-steps {
    list-style: none;
    padding: 0;
    margin: 12px 0 20px 0;
    display: grid;
    gap: 10px;
}

.wiki-step-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 16px;
}

.wiki-step-num {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: var(--brand-navy);
    color: #ffffff;
    font-size: 12.5px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.wiki-step-text {
    font-size: 14.5px;
    color: #1e293b;
    flex: 1;
}

/* Tables */
.wiki-table-wrap {
    overflow-x: auto;
    margin: 14px 0 22px 0;
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.wiki-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    text-align: left;
}

.wiki-table th {
    background: #f8fafc;
    color: #0f172a;
    font-weight: 800;
    padding: 11px 14px;
    border-bottom: 1.5px solid #cbd5e1;
}

.wiki-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #e2e8f0;
    color: #334155;
    vertical-align: top;
}

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

.wiki-table tbody tr:hover td {
    background: #f8fafc;
}

/* ==========================================================================
   5. UI LAYOUT SCREENSHOT SHOWCASE CARDS
   ========================================================================== */
.wiki-ui-gallery {
    margin: 20px 0 28px 0;
    display: grid;
    gap: 18px;
}

.wiki-ui-grid-single {
    grid-template-columns: 1fr;
}

.wiki-ui-grid-multi {
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
}

.wiki-ui-card {
    margin: 0;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.wiki-ui-card-topbar {
    background: #0f172a;
    color: #f8fafc;
    padding: 9px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.wiki-ui-dots {
    display: flex;
    gap: 5px;
}

.wiki-ui-dots span {
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.wiki-ui-dots span:nth-child(1) { background: #ef4444; }
.wiki-ui-dots span:nth-child(2) { background: #f59e0b; }
.wiki-ui-dots span:nth-child(3) { background: #10b981; }

.wiki-ui-badge {
    font-size: 11px;
    font-weight: 700;
    color: #cbd5e1;
}

.wiki-ui-zoom-btn {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 7px;
    cursor: pointer;
}

.wiki-ui-zoom-btn:hover {
    background: var(--brand-blue);
    border-color: var(--brand-blue);
}

.wiki-ui-img-wrap {
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, #ffffff 0%, #f1f5f9 100%);
    cursor: zoom-in;
}

.wiki-ui-card-mobile .wiki-ui-img {
    max-height: 520px;
    width: auto;
    max-width: 100%;
    border-radius: 14px;
    box-shadow: 0 12px 28px -6px rgba(15, 23, 42, 0.25);
    border: 3px solid #1e293b;
}

.wiki-ui-card-admin .wiki-ui-img {
    width: 100%;
    max-height: 540px;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 24px -4px rgba(15, 23, 42, 0.18);
    border: 1px solid #cbd5e1;
}

.wiki-ui-caption {
    padding: 11px 16px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    text-align: center;
}

/* ==========================================================================
   6. INTERACTIVE MERMAID FLOWCHART CARDS
   ========================================================================== */
.wiki-mermaid-card {
    margin: 20px 0 28px 0;
    border: 1.5px solid #cbd5e1;
    border-radius: 16px;
    background: #ffffff;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.wiki-mermaid-header {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.wiki-mermaid-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 800;
    color: #0f172a;
}

.wiki-mermaid-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--brand-blue);
}

.wiki-mermaid-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.wiki-diagram-btn {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #0f172a;
    font-size: 12px;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 8px;
    cursor: pointer;
}

.wiki-diagram-btn:hover {
    background: #f1f5f9;
}

.wiki-diagram-btn-primary {
    background: var(--brand-navy);
    color: #ffffff;
    border-color: var(--brand-navy);
}

.wiki-diagram-btn-primary:hover {
    background: var(--brand-blue);
    border-color: var(--brand-blue);
}

.wiki-mermaid-viewport {
    overflow: auto;
    padding: 20px;
    max-height: 680px;
    background: #ffffff;
}

.wiki-mermaid-Stage {
    transform-origin: top left;
    transition: transform 0.15s ease;
    min-width: 100%;
    display: flex;
    justify-content: center;
}

.wiki-mermaid-footer {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 8px 16px;
    font-size: 12px;
    color: #64748b;
}

/* Prev / Next Module Navigation */
.wiki-prev-next {
    margin-top: 36px;
    padding-top: 24px;
    border-top: 2px solid #f1f5f9;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.wiki-nav-card {
    padding: 14px 18px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: #f8fafc;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
}

.wiki-nav-card:hover {
    border-color: var(--brand-blue);
    background: #eff6ff;
}

.wiki-nav-card.right {
    text-align: right;
}

.wiki-nav-card-dir {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
}

.wiki-nav-card-title {
    font-size: 14px;
    font-weight: 800;
    color: #0f172a;
    margin-top: 4px;
}

/* Right TOC Sidebar */
.wiki-toc-sidebar {
    position: sticky;
    top: 86px;
    max-height: calc(100vh - 104px);
    overflow-y: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.wiki-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wiki-toc-link {
    display: block;
    font-size: 12.5px;
    color: #475569;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 8px;
    line-height: 1.35;
    border-left: 2px solid transparent;
    transition: all 0.12s ease;
}

.wiki-toc-link:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.wiki-toc-link.level-3 {
    padding-left: 20px;
    font-size: 12px;
    color: #64748b;
}

.wiki-toc-link.active {
    background: #eff6ff;
    color: var(--brand-blue);
    font-weight: 700;
    border-left-color: var(--brand-blue);
}

/* ==========================================================================
   7. LIGHTBOX MODAL (UI SCREENSHOTS & FULLSCREEN DIAGRAMS)
   ========================================================================== */
.wiki-lightbox {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(11, 25, 48, 0.88);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.wiki-lightbox-topbar {
    width: 100%;
    max-width: 1280px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #ffffff;
    margin-bottom: 12px;
    gap: 12px;
}

.wiki-lightbox-caption {
    font-size: 14.5px;
    font-weight: 700;
}

.wiki-lightbox-close {
    background: var(--brand-red);
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.wiki-lightbox-body {
    width: 100%;
    max-width: 1280px;
    max-height: calc(100vh - 100px);
    overflow: auto;
    background: #ffffff;
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wiki-lightbox-body img {
    max-width: 100%;
    max-height: calc(100vh - 140px);
    object-fit: contain;
    border-radius: 8px;
}

/* ==========================================================================
   8. AI ASSISTANT DRAWER & FLOATING TRIGGER
   ========================================================================== */
.wiki-ai-top-btn {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border: 1px solid #60a5fa;
    color: #ffffff;
    font-size: 12.5px;
    font-weight: 800;
    padding: 7px 14px;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
    transition: all 0.15s ease;
}

.wiki-ai-top-btn:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    transform: translateY(-1px);
}

.wiki-ai-fab {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 65;
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.85);
    border-radius: 999px;
    padding: 13px 20px;
    font-size: 14px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 14px 32px -4px rgba(220, 38, 38, 0.55);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.wiki-ai-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 36px -4px rgba(220, 38, 38, 0.7);
}

.wiki-ai-fab-pulse {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.3);
}

.wiki-ai-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 75;
    background: rgba(11, 25, 48, 0.55);
    backdrop-filter: blur(2px);
}

.wiki-ai-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 480px;
    max-width: 100vw;
    z-index: 80;
    background: #f8fafc;
    box-shadow: -12px 0 40px rgba(15, 23, 42, 0.28);
    display: flex;
    flex-direction: column;
    border-left: 1px solid #cbd5e1;
}

.wiki-ai-header {
    background: linear-gradient(135deg, #0b1930 0%, #172e54 100%);
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.wiki-ai-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wiki-ai-avatar-badge {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, #2563eb 0%, #dc2626 100%);
    color: #ffffff;
    font-weight: 900;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.wiki-ai-header-title {
    font-size: 15px;
    font-weight: 800;
    margin: 0;
    line-height: 1.25;
}

.wiki-ai-header-sub {
    font-size: 11.5px;
    color: #93c5fd;
    margin: 2px 0 0 0;
}

.wiki-ai-close-btn {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border-radius: 9px;
    padding: 6px 11px;
    font-size: 12.5px;
    font-weight: 800;
    cursor: pointer;
}

.wiki-ai-close-btn:hover {
    background: var(--brand-red);
    border-color: var(--brand-red);
}

.wiki-ai-prompts-bar {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 16px;
}

.wiki-ai-prompts-label {
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin-bottom: 6px;
}

.wiki-ai-prompts-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.wiki-ai-chip {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
    font-size: 11.5px;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.12s ease;
    text-align: left;
}

.wiki-ai-chip:hover {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.wiki-ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.wiki-ai-msg {
    display: flex;
    flex-direction: column;
    max-width: 94%;
}

.wiki-ai-msg.user {
    align-self: flex-end;
    align-items: flex-end;
}

.wiki-ai-msg.bot {
    align-self: flex-start;
    align-items: flex-start;
}

.wiki-ai-bubble {
    padding: 13px 15px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.6;
    box-shadow: var(--shadow-sm);
}

.wiki-ai-msg.user .wiki-ai-bubble {
    background: var(--brand-navy);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    font-weight: 600;
}

.wiki-ai-msg.bot .wiki-ai-bubble {
    background: #ffffff;
    color: #0f172a;
    border: 1px solid #cbd5e1;
    border-bottom-left-radius: 4px;
    width: 100%;
}

.wiki-ai-ans-source {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 6px;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    margin-bottom: 6px;
}

.wiki-ai-ans-title {
    font-size: 15px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 8px 0;
}

.wiki-ai-ans-p {
    margin: 0 0 8px 0;
    color: #334155;
    font-size: 13px;
}

.wiki-ai-ans-steps {
    margin: 8px 0 10px 0;
    padding-left: 18px;
    color: #1e293b;
    font-size: 13px;
}

.wiki-ai-ans-steps li {
    margin-bottom: 5px;
}

.wiki-ai-ans-img-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    margin: 10px 0;
}

.wiki-ai-ans-img-card {
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    overflow: hidden;
    background: #f8fafc;
    cursor: zoom-in;
}

.wiki-ai-ans-img-card img {
    width: 100%;
    max-height: 180px;
    object-fit: contain;
    display: block;
    background: #0f172a;
}

.wiki-ai-ans-img-cap {
    font-size: 11px;
    color: #475569;
    padding: 5px 8px;
    font-weight: 600;
    text-align: center;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
}

.wiki-ai-jump-btn {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #0b1930;
    color: #ffffff;
    border: none;
    border-radius: 9px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.12s ease;
}

.wiki-ai-jump-btn:hover {
    background: var(--brand-blue);
}

.wiki-ai-related {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed #cbd5e1;
}

.wiki-ai-related-label {
    font-size: 11px;
    font-weight: 800;
    color: #64748b;
    margin-bottom: 6px;
}

.wiki-ai-related-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.wiki-ai-related-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #1e293b;
    font-size: 11.5px;
    font-weight: 700;
    padding: 5px 9px;
    border-radius: 8px;
    cursor: pointer;
}

.wiki-ai-related-btn:hover {
    background: #eff6ff;
    border-color: #60a5fa;
    color: #1d4ed8;
}

.wiki-ai-form {
    background: #ffffff;
    border-top: 1px solid #cbd5e1;
    padding: 12px 16px;
    display: flex;
    gap: 8px;
}

.wiki-ai-input {
    flex: 1;
    padding: 11px 14px;
    font-size: 13.5px;
    border: 1.5px solid #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
    color: #0f172a;
}

.wiki-ai-input:focus {
    outline: none;
    border-color: var(--brand-blue);
    background: #ffffff;
}

.wiki-ai-send-btn {
    background: var(--brand-red);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 0 18px;
    font-size: 13.5px;
    font-weight: 800;
    cursor: pointer;
}

.wiki-ai-send-btn:hover {
    background: var(--brand-red-dark);
}

/* ==========================================================================
   9. RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media (max-width: 1240px) {
    .wiki-workspace {
        grid-template-columns: 280px minmax(0, 1fr);
    }
    .wiki-toc-sidebar {
        display: none;
    }
}

@media (max-width: 920px) {
    .wiki-auth-shell {
        grid-template-columns: 1fr;
    }
    .wiki-auth-Showcase {
        padding: 28px 24px;
    }
    .wiki-auth-form-pane {
        padding: 28px 24px;
    }
    .wiki-mobile-menu-btn {
        display: inline-flex;
    }
    .wiki-workspace {
        grid-template-columns: 1fr;
        padding: 16px 12px 48px;
    }
    .wiki-sidebar {
        display: none;
        position: fixed;
        top: 66px;
        left: 0;
        bottom: 0;
        width: 300px;
        max-height: none;
        z-index: 50;
        border-radius: 0 18px 18px 0;
        box-shadow: var(--shadow-lg);
    }
    .wiki-sidebar.mobile-open {
        display: block;
    }
    .wiki-article-card {
        padding: 20px 18px;
    }
    .wiki-prev-next {
        grid-template-columns: 1fr;
    }
    .wiki-user-meta {
        display: none;
    }
}
