/***************************************************************
 *  VOYNICH WORKBENCH - COMPLETE THEME (LIGHT + DARK)
 *  Full AI-Studio style, mobile responsive, WP fullscreen-safe.
 ***************************************************************/


/* ============================================================
   THEME TOKENS (default = DARK mode)
   ============================================================ */

/* DARK THEME (default) */
.voynich-workbench[data-vw-theme="dark"] {
    --accent-primary: #646cff;
    --accent-hover: #7b83ff;

    --bg-darkest: #0b0b0d;
    --bg-dark: #141417;
    --bg-medium: #23232a;
    --border-color: #2f2f37;

    --text-primary: #f3f4f6;
    --text-secondary: #cbd5f5;
}

/* LIGHT THEME */
.voynich-workbench[data-vw-theme="light"] {
    --accent-primary: #646cff;
    --accent-hover: #7b83ff;

    --bg-darkest: #f4f4f5;
    --bg-dark: #ffffff;
    --bg-medium: #eaeaeb;
    --border-color: #d1d1d1;

    --text-primary: #111111;
    --text-secondary: #555555;
}



/* ============================================================
   CORE LAYOUT
   ============================================================ */

.voynich-workbench {
    background-color: var(--bg-darkest);
    padding: 1.5rem 2rem;
    border-radius: 10px;
}

.voynich-workbench .vw-layout {
    display: flex;
    min-height: 70vh;
    background-color: var(--bg-dark);
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}



/* ============================================================
   SIDEBAR (AI-STUDIO STYLE)
   ============================================================ */

.voynich-workbench .vw-sidebar {
    width: 260px;
    flex-shrink: 0;
    background-color: var(--bg-dark);
    border-right: 1px solid var(--border-color);
    padding: 1rem 0;
    overflow-y: auto;
}

.voynich-workbench .sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 0;
}


/* Base item style */
.voynich-workbench .nav-item-header,
.voynich-workbench .nav-item-page,
.voynich-workbench .nav-item-child-link {
    width: 100%;
    padding: 0.6rem 1.5rem;
    background: transparent;
    border: none;
    outline: none;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}


/* Group header */
.voynich-workbench .nav-item-header {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.voynich-workbench .nav-item-header .arrow {
    transition: transform 0.2s ease;
    font-size: 0.9rem;
}

.voynich-workbench .nav-item-header .arrow.expanded {
    transform: rotate(90deg);
}


/* Top-level pages */
.voynich-workbench .nav-item-page:hover {
    background-color: var(--bg-medium);
    color: var(--text-primary);
}

.voynich-workbench .nav-item-page.active {
    background-color: var(--accent-primary);
    color: #ffffff;
    font-weight: 600;
}


/* Submenu list */
.voynich-workbench .nav-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    background-color: rgba(255,255,255,0.03);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.voynich-workbench .nav-submenu.expanded {
    max-height: 1000px;
}


/* Child items */
.voynich-workbench .nav-item-child-link {
    padding-left: 2.5rem;
    font-size: 0.85rem;
}

.voynich-workbench .nav-item-child-link:hover {
    background-color: var(--bg-medium);
    color: var(--text-primary);
}

.voynich-workbench .nav-item-child-link.active {
    background-color: var(--accent-primary);
    color: #ffffff;
    font-weight: 600;
}

/* ============================================================
   RIGHT-HAND PANEL AREA
   ============================================================ */

.voynich-workbench .vw-panels {
    flex: 1;
    /*padding: 2rem 2.5rem;*/
    overflow-y: auto;
    background-color: var(--bg-darkest);
    border-left: 1px solid var(--border-color);
    /*border-radius: 0 8px 8px 0;*/
}

.voynich-workbench .vw-panel {
    display: none;
}

.voynich-workbench .vw-panel.is-active {
    display: block;
}


/* Panel text */
.voynich-workbench .vw-panel h1,
.voynich-workbench .vw-panel h2,
.voynich-workbench .vw-panel h3 {
    color: var(--text-primary);
}

.voynich-workbench .vw-panel p,
.voynich-workbench .vw-panel li,
.voynich-workbench .vw-panel ol,
.voynich-workbench .vw-panel ul {
    color: var(--text-secondary);
}



/* ============================================================
   HEADER AREA
   ============================================================ */

.voynich-workbench .vw-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
}

.voynich-workbench .vw-header h1 {
    font-size: 1.6rem;
    margin-bottom: 0.2rem;
    color: var(--text-primary);
}

.voynich-workbench .vw-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}



/* ============================================================
   INTRO PAGE (AI STUDIO STYLE)
   ============================================================ */

.voynich-workbench .vw-intro {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 2rem;
}

.voynich-workbench .vw-intro-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-top: -1rem;
    margin-bottom: 2rem;
    font-weight: 300;
}

.voynich-workbench .vw-intro-banner {
    background-color: rgba(179, 133, 33, 0.15);
    border: 1px solid rgba(179, 133, 33, 0.4);
    padding: 1rem 1.5rem;
    border-radius: 4px;
    margin: 2rem 0;
}

.voynich-workbench .vw-intro-banner-title {
    margin-top: 0;
    color: #e6c891;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.voynich-workbench .vw-intro-section {
    margin-bottom: 2.5rem;
}

.voynich-workbench .vw-intro-list {
    color: var(--text-secondary);
    line-height: 1.7;
    padding-left: 1.5rem;
}

.voynich-workbench .vw-intro-list li {
    margin-bottom: 0.75rem;
}

/* Intro paragraph styling (optional; keep or adjust) */
.voynich-workbench .vw-intro-paragraph {
    /* e.g. max-width: 60rem; line-height: 1.6; */
}

/* ============================================================
   MOBILE LAYOUT
   ============================================================ */

@media (max-width: 768px) {

    .voynich-workbench .vw-layout {
        flex-direction: column;
        min-height: auto;
    }

    .voynich-workbench .vw-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        max-height: 50vh;
        overflow-y: auto;
    }

    .voynich-workbench .nav-item-header,
    .voynich-workbench .nav-item-page,
    .voynich-workbench .nav-item-child-link {
        padding: 0.5rem 1rem;
    }

    .voynich-workbench .vw-panels {
        border-left: none;
        border-top: 1px solid var(--border-color);
        border-radius: 0;
        padding: 1.25rem 1rem 1.5rem;
    }

    @media (max-width: 768px) {
        .voynich-workbench .vw-panels {
            padding: 0;
        }
    }


    .voynich-workbench .vw-header h1 {
        font-size: 1.3rem;
    }

    .voynich-workbench .vw-header {
        padding-bottom: 0.5rem;
        margin-bottom: 0.5rem;
    }
}

/* ============================================================
   SETTINGS PAGE LAYOUT — AI-STUDIO DARK MODE
   ============================================================ */

.voynich-workbench .vw-settings {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
}

.voynich-workbench[data-vw-theme="dark"] .vw-settings h1,
.voynich-workbench[data-vw-theme="dark"] .vw-settings h2 {
    color: #eaeaea; /* bright headers */
}

.voynich-workbench .vw-settings-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-top: -1rem;
    margin-bottom: 2rem;
    font-weight: 300;
}

.voynich-workbench .vw-settings-section {
    margin-bottom: 2.5rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

/* Row */
.voynich-workbench .vw-settings-row {
    display: flex;
    align-items: center;
    margin-bottom: 1.1rem;
    flex-wrap: wrap;
}

/* LABELS */
.voynich-workbench .vw-settings-label {
    flex: 1 1 300px;
    min-width: 250px;
    color: var(--text-primary);
    opacity: 0.88;               /* much better contrast */
    font-size: 0.95rem;
}

/* Control container */
.voynich-workbench .vw-settings-control {
    flex: 1 1 300px;
}

/* SELECT */
.voynich-workbench .vw-settings-select {
    box-sizing: border-box;
    background-color: var(--bg-medium);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.55rem;
    border-radius: 4px;
    width: 100%;
}

/* CHECKBOXES */
.voynich-workbench .vw-settings-checkboxLabel {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.voynich-workbench .vw-settings-checkbox {
    margin-right: 0.75rem;
    width: 17px;
    height: 17px;
    accent-color: var(--accent-primary);
}

/* FOOTER BUTTON */
.voynich-workbench .vw-settings-button {
    padding: 0.6rem 1.15rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-medium);
    color: var(--text-primary);
    cursor: pointer;
    margin-right: 1rem;
}

.voynich-workbench .vw-settings-button:hover {
    background: var(--bg-darkest);
}

.voynich-workbench .vw-settings-footer {
    display: flex;
    align-items: center;
}

.voynich-workbench .vw-settings-message {
    color: var(--accent-primary);
    font-weight: 500;
    height: 1.5em;
    display: flex;
    align-items: center;
}

/* MOBILE STACK */
@media (max-width: 768px) {
    .voynich-workbench .vw-settings-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .voynich-workbench .vw-settings-label,
    .voynich-workbench .vw-settings-control {
        flex: 1 1 auto;
        width: 100%;
    }

    .voynich-workbench .vw-settings-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .voynich-workbench .vw-settings-message {
        margin-top: 0.5rem;
    }
}

/* ============================================================
   UI SCALE (compact / normal / large)
   ============================================================ */

/* Base (normal) – keep existing sizing, just make this explicit */
.voynich-workbench[data-vw-scale="normal"] {
    font-size: 15px;
}

/* Compact: slightly smaller fonts + tighter padding */
.voynich-workbench[data-vw-scale="compact"] {
    font-size: 13px;
}

.voynich-workbench[data-vw-scale="compact"] .vw-header h1 {
    font-size: 1.4rem;
}

.voynich-workbench[data-vw-scale="compact"] .vw-layout {
    min-height: 60vh;
}

.voynich-workbench[data-vw-scale="compact"] .nav-item-header,
.voynich-workbench[data-vw-scale="compact"] .nav-item-page,
.voynich-workbench[data-vw-scale="compact"] .nav-item-child-link {
    padding: 0.4rem 1.1rem;
    font-size: 0.8rem;
}

.voynich-workbench[data-vw-scale="compact"] .vw-panels {
    padding: 1.4rem 1.6rem;
}

.voynich-workbench[data-vw-scale="compact"] .vw-intro,
.voynich-workbench[data-vw-scale="compact"] .vw-settings {
    padding: 0 0.75rem;
}

/* Large: bigger fonts + roomier padding */
.voynich-workbench[data-vw-scale="large"] {
    font-size: 17px;
}

.voynich-workbench[data-vw-scale="large"] .vw-header h1 {
    font-size: 1.9rem;
}

.voynich-workbench[data-vw-scale="large"] .nav-item-header,
.voynich-workbench[data-vw-scale="large"] .nav-item-page,
.voynich-workbench[data-vw-scale="large"] .nav-item-child-link {
    padding: 0.75rem 1.8rem;
    font-size: 0.95rem;
}

.voynich-workbench[data-vw-scale="large"] .vw-panels {
    padding: 2.4rem 3rem;
}

.voynich-workbench[data-vw-scale="large"] .vw-intro,
.voynich-workbench[data-vw-scale="large"] .vw-settings {
    padding: 0 2.25rem;
}


/* ============================================================
   WORDPRESS FULLSCREEN CLEANUP
   (kept minimal + safe)
   ============================================================ */

body {
    background-color: #0b0b0d !important;
}

.page-id-2 .entry-title,
.page-id-2 .page-title,
.page-id-2 footer.entry-footer,
.page-id-2 .edit-link,
.page-id-2 .post-edit-link {
    display: none !important;
}

.page-id-2 .site,
.page-id-2 .site-content,
.page-id-2 .content-area,
.page-id-2 main#primary,
.page-id-2 .site-main,
.page-id-2 article,
.page-id-2 .entry-content {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: none !important;
    box-shadow: none !important;
}

.page-id-2 .voynich-workbench {
    margin: 0 !important;
    padding: 24px !important;
    width: 100% !important;
    box-sizing: border-box;
}

.page-id-2 .entry-content > *:first-child {
    margin-top: 0 !important;
}

.page-id-2 .wrap,
.page-id-2 .container {
    padding: 0 !important;
    margin: 0 !important;
}

.site-footer {
    display: none !important;
}

.site-header {
    visibility: hidden;
    display: none !important;
}


/* ============================================================
   VIEWER: EVA / PLAIN FONT HOOKS
   ============================================================ */

/* Optional EVA font – replace src URL with your actual EVA font file. */
@font-face {
    font-family: 'VoynichEVA';
    src: url('../../assets/fonts/Voynich_EVA.woff') format('woff2');
    font-weight: normal;
    font-style: normal;
}

/* EVA / v101 tab text */
.voynich-workbench .vw-viewer-text-panel-eva .vw-viewer-token{
    font-family: 'VoynichEVA', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0.03em;
}

/* Plain tab text – explicitly keep normal UI font */
.voynich-workbench .vw-viewer-text-panel-plain .vw-viewer-token {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}


.voynich-workbench [data-eva-text] {
    font-family: 'VoynichEVA', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0.03em;
}
/* ============================================================
   V101 / EVA FONT SUPPORT
   Applies ONLY to the EVA/v101 transcription panel
   ============================================================ */

/* 1. Load the TTF font */
@font-face {
    font-family: 'VoynichV101';
    src: url('../../assets/fonts/101-font.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* 2. EVA/v101 panel root */
.vw-viewer-text[data-mode="eva"] {
    font-family: 'VoynichV101', monospace;
    font-size: 1.25rem;      /* adjust as needed */
    line-height: 1.9rem;     /* helps for ascenders/descenders */
    letter-spacing: 0.03em;  /* slight spacing improves readability */
}

/* 3. EVA line-level text */
.vw-viewer-text[data-mode="eva"] .vw-line-text {
    font-family: 'VoynichV101', monospace;
}

/* 4. EVA individual tokens */
.vw-viewer-text[data-mode="eva"] .vw-token {
    font-family: 'VoynichV101', monospace;
    padding: 0 0.15rem;
}

/* 5. Make the highlighting boxes compatible with variable glyph width */
.vw-viewer-text[data-mode="eva"] .vw-token.highlight-red,
.vw-viewer-text[data-mode="eva"] .vw-token.highlight-yellow {
    padding: 0 0.2rem;
    border-radius: 4px;
}
/* Global Workbench loading overlay */
.vw-loading-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    z-index: 9999;
}

.vw-loading-spinner {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: #ffffff;
    animation: vw-spinner-rotate 0.9s linear infinite;
}

/* Show spinner whenever the root has data-vw-busy="1" */
#voynich-workbench-root[data-vw-busy="1"] .vw-loading-overlay {
    display: flex;
}

@keyframes vw-spinner-rotate {
    to {
        transform: rotate(360deg);
    }
}


/* =============================================
   Basic Text & Token Statistics panel
   (moved from inline PHP)
   ============================================= */
.vw-basic-stats-root {
    background: #0f111c;
    /*border-radius: 10px;*/
    padding: 16px 18px 18px;
    border: 1px solid #24263a;
    color: #f4f5ff;
    font-size: 0.9rem;
}
.vw-basic-stats-header {
    margin-bottom: 8px;
}
.vw-basic-stats-header h2 {
    margin: 0 0 4px;
    font-size: 1.4rem;
}
.vw-basic-stats-header p {
    margin: 0;
    color: #c3c6dd;
    font-size: 0.9rem;
}
.vw-basic-stats-controls {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #151827;
    border: 1px solid #262a3d;
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 3fr) minmax(0, 3fr);
    gap: 12px;
}
@media (max-width: 980px) {
    .vw-basic-stats-controls {
        grid-template-columns: 1fr;
    }
}
.vw-basic-stats-control-label {
    display: block;
    font-size: 0.78rem;
    margin-bottom: 3px;
    color: #d7d9ea;
}
.vw-basic-stats-select,
.vw-basic-stats-scope-select {
    width: 100%;
    padding: 5px 8px;
    border-radius: 4px;
    border: 1px solid #42465c;
    background: #181b2a;
    color: #f3f4ff;
    font-size: 0.86rem;
}
.vw-basic-stats-scope-modes {
    display: inline-flex;
    border-radius: 999px;
    border: 1px solid #30364a;
    overflow: hidden;
}
.vw-basic-stats-scope-button {
    border: none;
    padding: 4px 12px;
    font-size: 0.8rem;
    background: transparent;
    color: #c3c6dd;
    cursor: pointer;
}
.vw-basic-stats-scope-button.is-active {
    background: #2e3a62;
    color: #fff;
}

.vw-basic-stats-summary {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #141624;
    border: 1px solid #24273a;
    font-size: 0.82rem;
    color: #c8cae0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
}
.vw-basic-stats-summary-item {
    min-width: 140px;
}
.vw-basic-stats-summary-label {
    display: block;
    opacity: 0.75;
}
.vw-basic-stats-summary-value {
    font-weight: 600;
}

.vw-basic-stats-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.2fr) minmax(0, 1.2fr);
    gap: 12px;
}
.vw-basic-stats-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.vw-basic-stats-chart-card canvas {
    width: 100%;
    height: 260px;
}
@media (max-width: 900px) {
    .vw-basic-stats-grid {
        grid-template-columns: 1fr;
    }
}
.vw-basic-stats-card {
    background: #151827;
    border-radius: 8px;
    border: 1px solid #262a3d;
    padding: 10px 12px;
}
.vw-basic-stats-card h3 {
    margin: 0 0 6px;
    font-size: 1.0rem;
}
.vw-basic-stats-stat-row {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    font-size: 0.84rem;
    border-bottom: 1px solid #23263a;
}
.vw-basic-stats-stat-label {
    opacity: 0.82;
}
.vw-basic-stats-stat-value {
    font-weight: 600;
}

.vw-basic-stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}
.vw-basic-stats-table th,
.vw-basic-stats-table td {
    padding: 2px 4px;
    border-bottom: 1px solid #23263a;
}

.vw-basic-stats-table-compact th,
.vw-basic-stats-table-compact td {
    padding: 1px 1px;
    border-bottom: 1px solid #23263a;
    font-size: 0.7rem;
}

.vw-basic-stats-table th {
    text-align: left;
    font-weight: 600;
    opacity: 0.9;
}
.vw-basic-stats-footer {
    margin-top: 10px;
    font-size: 0.8rem;
    color: #c5c7de;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.vw-basic-stats-download {
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid #3a4a7a;
    background: #202849;
    color: #f4f5ff;
    font-size: 0.8rem;
    cursor: pointer;
}
.vw-basic-stats-download[disabled] {
    opacity: 0.4;
    cursor: default;
}

.vw-basic-stats-chart-toggles {
    display: inline-flex;
    gap: 6px;
    margin-bottom: 8px;
}

.vw-basic-stats-chart-toggle {
    border: 1px solid #3a4460;
    background: #181c2a;
    color: #d6daff;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    cursor: pointer;
}

.vw-basic-stats-chart-toggle.is-active {
    background: #3a5bd6;
    border-color: #3a5bd6;
    color: #ffffff;
}

.vw-basic-stats-chart-wrapper {
    position: relative;
    width: 100%;
    min-height: 300px;   /* keep a nice default for other charts */
}

.vw-basic-stats-chart-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
}

/* =========================================================
 * Light mode overrides
 * Triggered by:
 *   - global: .voynich-workbench[data-vw-theme="light"]
 *   - local:  .vw-basic-stats-root.vw-light-mode
 * ========================================================= */

.voynich-workbench[data-vw-theme="light"] .vw-basic-stats-root,
.vw-basic-stats-root.vw-light-mode {
    background: #f7f7fb;
    border-color: #d3d5e4;
    color: #1a1a26;
}

.voynich-workbench[data-vw-theme="light"] .vw-basic-stats-root .vw-basic-stats-header h2,
.vw-basic-stats-root.vw-light-mode .vw-basic-stats-header h2 {
    color: #111320;
}

.voynich-workbench[data-vw-theme="light"] .vw-basic-stats-root .vw-basic-stats-header p,
.vw-basic-stats-root.vw-light-mode .vw-basic-stats-header p {
    color: #555972;
}

.voynich-workbench[data-vw-theme="light"] .vw-basic-stats-root .vw-basic-stats-controls,
.vw-basic-stats-root.vw-light-mode .vw-basic-stats-controls {
    background: #ffffff;
    border-color: #d3d5e4;
}

.voynich-workbench[data-vw-theme="light"] .vw-basic-stats-root .vw-basic-stats-control-label,
.vw-basic-stats-root.vw-light-mode .vw-basic-stats-control-label {
    color: #3b3f59;
}

.voynich-workbench[data-vw-theme="light"] .vw-basic-stats-root .vw-basic-stats-select,
.voynich-workbench[data-vw-theme="light"] .vw-basic-stats-root .vw-basic-stats-scope-select,
.vw-basic-stats-root.vw-light-mode .vw-basic-stats-select,
.vw-basic-stats-root.vw-light-mode .vw-basic-stats-scope-select {
    background: #ffffff;
    border-color: #c3c7dd;
    color: #222435;
}

.voynich-workbench[data-vw-theme="light"] .vw-basic-stats-root .vw-basic-stats-scope-modes,
.vw-basic-stats-root.vw-light-mode .vw-basic-stats-scope-modes {
    border-color: #c3c7dd;
}

.voynich-workbench[data-vw-theme="light"] .vw-basic-stats-root .vw-basic-stats-scope-button,
.vw-basic-stats-root.vw-light-mode .vw-basic-stats-scope-button {
    color: #444863;
    background: transparent;
}

.voynich-workbench[data-vw-theme="light"] .vw-basic-stats-root .vw-basic-stats-scope-button.is-active,
.vw-basic-stats-root.vw-light-mode .vw-basic-stats-scope-button.is-active {
    background: #4b6ce6;
    color: #ffffff;
}

/* Summary bar */

.voynich-workbench[data-vw-theme="light"] .vw-basic-stats-root .vw-basic-stats-summary,
.vw-basic-stats-root.vw-light-mode .vw-basic-stats-summary {
    background: #ffffff;
    border-color: #d3d5e4;
    color: #40435a;
}

.voynich-workbench[data-vw-theme="light"] .vw-basic-stats-root .vw-basic-stats-summary-label,
.vw-basic-stats-root.vw-light-mode .vw-basic-stats-summary-label {
    color: #757895;
}

.voynich-workbench[data-vw-theme="light"] .vw-basic-stats-root .vw-basic-stats-summary-value,
.vw-basic-stats-root.vw-light-mode .vw-basic-stats-summary-value {
    color: #242842;
}

/* Cards + tables */

.voynich-workbench[data-vw-theme="light"] .vw-basic-stats-root .vw-basic-stats-card,
.vw-basic-stats-root.vw-light-mode .vw-basic-stats-card {
    background: #ffffff;
    border-color: #d3d5e4;
}

.voynich-workbench[data-vw-theme="light"] .vw-basic-stats-root .vw-basic-stats-card h3,
.vw-basic-stats-root.vw-light-mode .vw-basic-stats-card h3 {
    color: #272a3f;
}

.voynich-workbench[data-vw-theme="light"] .vw-basic-stats-root .vw-basic-stats-stat-label,
.vw-basic-stats-root.vw-light-mode .vw-basic-stats-stat-label {
    color: #767a93;
}

.voynich-workbench[data-vw-theme="light"] .vw-basic-stats-root .vw-basic-stats-stat-value,
.vw-basic-stats-root.vw-light-mode .vw-basic-stats-stat-value {
    color: #242842;
}

.voynich-workbench[data-vw-theme="light"] .vw-basic-stats-root .vw-basic-stats-table th,
.voynich-workbench[data-vw-theme="light"] .vw-basic-stats-root .vw-basic-stats-table td,
.vw-basic-stats-root.vw-light-mode .vw-basic-stats-table th,
.vw-basic-stats-root.vw-light-mode .vw-basic-stats-table td {
    border-bottom-color: #e1e3f0;
    color: #2c3046;
}

.voynich-workbench[data-vw-theme="light"] .vw-basic-stats-root .vw-basic-stats-table th,
.vw-basic-stats-root.vw-light-mode .vw-basic-stats-table th {
    color: #444864;
}

/* Footer + buttons */

.voynich-workbench[data-vw-theme="light"] .vw-basic-stats-root .vw-basic-stats-footer,
.vw-basic-stats-root.vw-light-mode .vw-basic-stats-footer {
    color: #5b5f7a;
}

.voynich-workbench[data-vw-theme="light"] .vw-basic-stats-root .vw-basic-stats-download,
.vw-basic-stats-root.vw-light-mode .vw-basic-stats-download {
    background: #f2f3ff;
    border-color: #b4bbed;
    color: #283067;
}

.voynich-workbench[data-vw-theme="light"] .vw-basic-stats-root .vw-basic-stats-download[disabled],
.vw-basic-stats-root.vw-light-mode .vw-basic-stats-download[disabled] {
    opacity: 0.5;
}

/* Chart toggles */

.voynich-workbench[data-vw-theme="light"] .vw-basic-stats-root .vw-basic-stats-chart-toggle,
.vw-basic-stats-root.vw-light-mode .vw-basic-stats-chart-toggle {
    background: #f4f5ff;
    border-color: #c2c6e3;
    color: #38406f;
}

.voynich-workbench[data-vw-theme="light"] .vw-basic-stats-root .vw-basic-stats-chart-toggle.is-active,
.vw-basic-stats-root.vw-light-mode .vw-basic-stats-chart-toggle.is-active {
    background: #4b6ce6;
    border-color: #4b6ce6;
    color: #ffffff;
}

/* =========================================
* UI SCALE – basic stats panel
* compact | normal | large
* ======================================= */

.voynich-workbench[data-vw-scale="compact"] .vw-panels,
.voynich-workbench[data-vw-scale="large"] .vw-panels {
    padding: 0 !important;
}

/* Compact – everything a bit tighter/smaller */
.voynich-workbench[data-vw-scale="compact"] .vw-basic-stats-root {
    font-size: 0.80rem;
}
.voynich-workbench[data-vw-scale="compact"] .vw-basic-stats-header h2 {
    font-size: 1.20rem;
}
.voynich-workbench[data-vw-scale="compact"] .vw-basic-stats-controls,
.voynich-workbench[data-vw-scale="compact"] .vw-basic-stats-card,
.voynich-workbench[data-vw-scale="compact"] .vw-basic-stats-summary {
    padding: 8px 10px;
}

/* Large – give it some breathing room */
.voynich-workbench[data-vw-scale="large"] .vw-basic-stats-root {
    font-size: 1.05rem;
}
.voynich-workbench[data-vw-scale="large"] .vw-basic-stats-header h2 {
    font-size: 1.55rem;
}
.voynich-workbench[data-vw-scale="large"] .vw-basic-stats-controls,
.voynich-workbench[data-vw-scale="large"] .vw-basic-stats-card,
.voynich-workbench[data-vw-scale="large"] .vw-basic-stats-summary {
    padding: 14px 16px;
}



/* =============================================
   Viewer panel
   (moved from inline PHP)
   ============================================= */
.vw-panel[data-panel="viewer"] {
    /* NO display here! */
    padding: 16px;
    background: #111320;
    color: #f2f3ff;
}
.vw-viewer-header {
    margin-bottom: 14px;
}
.vw-viewer-header h1 {
    margin: 0 0 4px;
    font-size: 1.4rem;
}
.vw-viewer-header p {
    margin: 0;
    font-size: 0.9rem;
    color: #c2c5d8;
}
.vw-viewer-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 16px;
}
@media (max-width: 900px) {
    .vw-viewer-layout {
        grid-template-columns: 1fr;
    }
}

.vw-viewer-sidebar {
    background: #151728;
    border-radius: 8px;
    padding: 10px;
    border: 1px solid #25283a;
}
.vw-viewer-main {
    background: #151728;
    border-radius: 8px;
    padding: 10px;
    border: 1px solid #25283a;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vw-viewer-control-group {
    margin-bottom: 10px;
}
.vw-viewer-label {
    display: block;
    font-size: 0.78rem;
    margin-bottom: 2px;
    color: #d7d9e4;
}
.vw-viewer-select {
    width: 100%;
    padding: 4px 8px;
    font-size: 0.85rem;
    background: #181a22;
    border-radius: 4px;
    border: 1px solid #454a58;
    color: #f2f3ff;
}
.vw-viewer-nav {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
}
.vw-viewer-button {
    padding: 4px 10px;
    font-size: 0.85rem;
    background: #262a3d;
    color: #f2f3ff;
    border: 1px solid #404664;
    border-radius: 4px;
    cursor: pointer;
}
.vw-viewer-button:hover {
    background: #30374e;
}

.vw-viewer-image-shell {
    position: relative;
    background: #111320;
    border-radius: 8px;
    border: 1px solid #25283a;
    padding: 6px;
    overflow: hidden;
    min-height: 280px;
}
.vw-viewer-image-viewport {
    width: 100%;
    height: 100%;
    min-height: 260px;
    overflow: hidden;
    cursor: grab;
}
.vw-viewer-image-viewport:active {
    cursor: grabbing;
}
.vw-viewer-image {
    display: block;
    max-width: 100%;
    transform-origin: 0 0;
    transition: transform 0.05s ease-out;
}
.vw-viewer-image-zoom-controls {
    position: absolute;
    right: 8px;
    bottom: 8px;
    display: flex;
    gap: 4px;
}
.vw-viewer-zoom-btn {
    width: 45px;
    height: 28px;
    border-radius: 20%;
    border: 1px solid #404664;
    background: #262a3d;
    color: #f2f3ff;
    font-size: 1rem;
    cursor: pointer;
}

.vw-viewer-tabs {
    display: flex;
    margin-top: 8px;
    border-bottom: 1px solid #25283a;
}
.vw-viewer-tab-button {
    padding: 4px 10px;
    font-size: 0.8rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: #c2c5d8;
    cursor: pointer;
}
.vw-viewer-tab-button.is-active {
    border-bottom-color: #6f9cff;
    color: #f2f3ff;
}

.vw-viewer-text-panel {
    margin-top: 6px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.86rem;
    line-height: 1.3;
    max-height: 380px;
    overflow: auto;
    padding-right: 4px;
}
.vw-viewer-text-panel[hidden] {
    display: none;
}

.vw-viewer-line {
    display: flex;
    gap: 6px;
    padding: 2px 0;
    border-bottom: 1px dashed #24273a;
}
.vw-viewer-line-meta {
    width: 80px;
    flex-shrink: 0;
    text-align: right;
    font-size: 0.8rem;
    color: #9ea2b8;
    padding-right: 4px;
}
.vw-viewer-line-text {
    flex: 1;
}

.vw-viewer-token {
    display: inline-block;
    margin-right: 0.25em;
    padding: 0 2px;
    border-radius: 3px;
}
.vw-viewer-token-splat-strong {
    background: rgba(190, 40, 40, 0.75);
    color: #fff;
}
.vw-viewer-token-splat-soft {
    background: rgba(210, 180, 40, 0.9);
    color: #111;
}

.vw-viewer-line-marker {
    display: inline-block;
    margin-left: 0.25em;
    font-weight: 600;
    opacity: 0.8;
}

.vw-viewer-line-marker-line,
.vw-viewer-line-marker-para {
    /* inherits text color; no extra colors so we don't fight your theme */
}

/* ============================
Generic Reusable Tabs System
============================ */
/* TAB STRIP – generic, reusable */

.vw-tabs {
    display: flex;
    align-items: flex-end;
    gap: 0;
    border-bottom: 1px solid #242938;  /* line that the tabs sit on */
    margin: 10px 0 14px;
}

/* “folder tab” */
.vw-tab {
    position: relative;
    border: 1px solid transparent;
    border-bottom: none;              /* so it looks attached to strip */
    border-radius: 6px 6px 0 0;       /* rounded top only */
    padding: 6px 18px;
    margin: 2px;
    background: #151826;              /* same as panel bg, but a bit lighter is fine */
    color: #aeb5d8;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    white-space: nowrap;
    transition:
        background-color 120ms ease-out,
        color 120ms ease-out,
        border-color 120ms ease-out,
        transform 80ms ease-out;
}

/* first tab can have a tiny left offset to hide the joint */
.vw-tab:first-child {
    margin-left: 0;
}

/* hover – subtle, not rainbow */
.vw-tab:hover {
    background: #1b1f33;
    color: #d6dbff;
}

/* active tab: looks like front folder tab */
.vw-tab.is-active {
    background: #2f48c5;             /* your existing accent blue */
    color: #ffffff;
    border-color: #2f48c5;
    transform: translateY(1px);      /* sits slightly “over” the strip */
}

/* keep inactive tabs visually behind the active one */
.vw-tab:not(.is-active) {
    border-color: transparent;
}

/* ensure tab panels line up right under the strip */
.vw-tab-panel,
[data-char-tab-panel] {
    /* panels themselves; content cards already handle padding */
    margin-top: 0;
}


/* =========================================================
 * Light mode overrides (viewer)
 * Triggered by:
 *   - global: .voynich-workbench[data-vw-theme="light"]
 *   - local:  .vw-panel[data-panel="viewer"].vw-light-mode
 * ========================================================= */

.voynich-workbench[data-vw-theme="light"] .vw-panel[data-panel="viewer"],
.vw-panel[data-panel="viewer"].vw-light-mode {
    background: #f7f7fb;
    color: #1a1a26;
}

.voynich-workbench[data-vw-theme="light"] .vw-panel[data-panel="viewer"] .vw-viewer-header h1,
.vw-panel[data-panel="viewer"].vw-light-mode .vw-viewer-header h1 {
    color: #111320;
}

.voynich-workbench[data-vw-theme="light"] .vw-panel[data-panel="viewer"] .vw-viewer-header p,
.vw-panel[data-panel="viewer"].vw-light-mode .vw-viewer-header p {
    color: #555972;
}

.voynich-workbench[data-vw-theme="light"] .vw-panel[data-panel="viewer"] .vw-viewer-sidebar,
.voynich-workbench[data-vw-theme="light"] .vw-panel[data-panel="viewer"] .vw-viewer-main,
.vw-panel[data-panel="viewer"].vw-light-mode .vw-viewer-sidebar,
.vw-panel[data-panel="viewer"].vw-light-mode .vw-viewer-main {
    background: #ffffff;
    border-color: #d3d5e4;
}

.voynich-workbench[data-vw-theme="light"] .vw-panel[data-panel="viewer"] .vw-viewer-label,
.vw-panel[data-panel="viewer"].vw-light-mode .vw-viewer-label {
    color: #3b3f59;
}

.voynich-workbench[data-vw-theme="light"] .vw-panel[data-panel="viewer"] .vw-viewer-select,
.vw-panel[data-panel="viewer"].vw-light-mode .vw-viewer-select {
    background: #ffffff;
    border-color: #c3c7dd;
    color: #222435;
}

.voynich-workbench[data-vw-theme="light"] .vw-panel[data-panel="viewer"] .vw-viewer-button,
.vw-panel[data-panel="viewer"].vw-light-mode .vw-viewer-button,
.voynich-workbench[data-vw-theme="light"] .vw-panel[data-panel="viewer"] .vw-viewer-zoom-btn,
.vw-panel[data-panel="viewer"].vw-light-mode .vw-viewer-zoom-btn {
    background: #ffffff;
    border-color: #c3c7dd;
    color: #242842;
}

.voynich-workbench[data-vw-theme="light"] .vw-panel[data-panel="viewer"] .vw-viewer-button:hover,
.vw-panel[data-panel="viewer"].vw-light-mode .vw-viewer-button:hover,
.voynich-workbench[data-vw-theme="light"] .vw-panel[data-panel="viewer"] .vw-viewer-zoom-btn:hover,
.vw-panel[data-panel="viewer"].vw-light-mode .vw-viewer-zoom-btn:hover {
    background: #e5e8ff;
}

.voynich-workbench[data-vw-theme="light"] .vw-panel[data-panel="viewer"] .vw-viewer-tabs,
.vw-panel[data-panel="viewer"].vw-light-mode .vw-viewer-tabs {
    border-bottom-color: #d3d5e4;
}

.voynich-workbench[data-vw-theme="light"] .vw-panel[data-panel="viewer"] .vw-viewer-tab-button,
.vw-panel[data-panel="viewer"].vw-light-mode .vw-viewer-tab-button {
    color: #6b6f8c;
}

.voynich-workbench[data-vw-theme="light"] .vw-panel[data-panel="viewer"] .vw-viewer-tab-button.is-active,
.vw-panel[data-panel="viewer"].vw-light-mode .vw-viewer-tab-button.is-active {
    border-bottom-color: #4b6ce6;
    color: #242842;
}

.voynich-workbench[data-vw-theme="light"] .vw-panel[data-panel="viewer"] .vw-viewer-image-shell,
.vw-panel[data-panel="viewer"].vw-light-mode .vw-viewer-image-shell {
    background: #ffffff;
    border-color: #d3d5e4;
}

.voynich-workbench[data-vw-theme="light"] .vw-panel[data-panel="viewer"] .vw-viewer-line {
    border-bottom-color: #d3d5e4;
}

.voynich-workbench[data-vw-theme="light"] .vw-panel[data-panel="viewer"] .vw-viewer-line-meta,
.vw-panel[data-panel="viewer"].vw-light-mode .vw-viewer-line-meta {
    color: #757895;
}

/* =========================================================
* UI scale: COMPACT
* Tighten spacing & slightly shrink fonts for the viewer
* Triggered by:
*   .voynich-workbench[data-vw-scale="compact"]
* =======================================================*/

.voynich-workbench[data-vw-scale="compact"] .vw-panel[data-panel="viewer"] {
    padding: 10px;
}

.voynich-workbench[data-vw-scale="compact"] .vw-panel[data-panel="viewer"] .vw-viewer-header h1 {
    font-size: 1.2rem;
}

.voynich-workbench[data-vw-scale="compact"] .vw-panel[data-panel="viewer"] .vw-viewer-header p {
    font-size: 0.8rem;
}

.voynich-workbench[data-vw-scale="compact"] .vw-panel[data-panel="viewer"] .vw-viewer-layout {
    gap: 10px;
}

.voynich-workbench[data-vw-scale="compact"] .vw-panel[data-panel="viewer"] .vw-viewer-sidebar,
.voynich-workbench[data-vw-scale="compact"] .vw-panel[data-panel="viewer"] .vw-viewer-main {
    padding: 8px;
    border-radius: 6px;
}

.voynich-workbench[data-vw-scale="compact"] .vw-panel[data-panel="viewer"] .vw-viewer-label {
    font-size: 0.72rem;
}

.voynich-workbench[data-vw-scale="compact"] .vw-panel[data-panel="viewer"] .vw-viewer-select {
    padding: 3px 6px;
    font-size: 0.8rem;
}

.voynich-workbench[data-vw-scale="compact"] .vw-panel[data-panel="viewer"] .vw-viewer-button {
    padding: 3px 8px;
    font-size: 0.78rem;
}

.voynich-workbench[data-vw-scale="compact"] .vw-panel[data-panel="viewer"] .vw-viewer-zoom-btn {
    width: 24px;
    height: 24px;
    font-size: 0.9rem;
}

.voynich-workbench[data-vw-scale="compact"] .vw-panel[data-panel="viewer"] .vw-viewer-text-panel {
    font-size: 0.8rem;
    max-height: 340px;
}

/* =========================================================
 * UI scale: LARGE
 * Looser spacing & slightly larger fonts for the viewer
 * Triggered by:
 *   .voynich-workbench[data-vw-scale="large"]
 * =======================================================*/

.voynich-workbench[data-vw-scale="large"] .vw-panel[data-panel="viewer"] {
    padding: 22px;
}

.voynich-workbench[data-vw-scale="large"] .vw-panel[data-panel="viewer"] .vw-viewer-header h1 {
    font-size: 1.6rem;
}

.voynich-workbench[data-vw-scale="large"] .vw-panel[data-panel="viewer"] .vw-viewer-header p {
    font-size: 0.95rem;
}

.voynich-workbench[data-vw-scale="large"] .vw-panel[data-panel="viewer"] .vw-viewer-layout {
    gap: 20px;
}

.voynich-workbench[data-vw-scale="large"] .vw-panel[data-panel="viewer"] .vw-viewer-sidebar,
.voynich-workbench[data-vw-scale="large"] .vw-panel[data-panel="viewer"] .vw-viewer-main {
    padding: 14px;
    border-radius: 10px;
}

.voynich-workbench[data-vw-scale="large"] .vw-panel[data-panel="viewer"] .vw-viewer-label {
    font-size: 0.85rem;
}

.voynich-workbench[data-vw-scale="large"] .vw-panel[data-panel="viewer"] .vw-viewer-select {
    padding: 6px 10px;
    font-size: 0.9rem;
}

.voynich-workbench[data-vw-scale="large"] .vw-panel[data-panel="viewer"] .vw-viewer-button {
    padding: 6px 12px;
    font-size: 0.9rem;
}

.voynich-workbench[data-vw-scale="large"] .vw-panel[data-panel="viewer"] .vw-viewer-zoom-btn {
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
}

.voynich-workbench[data-vw-scale="large"] .vw-panel[data-panel="viewer"] .vw-viewer-text-panel {
    font-size: 0.92rem;
    max-height: 420px;
}

.voynich-workbench .vw-panels {
    padding: 0 !important;
}

/* Also ensure light mode cannot reintroduce padding */
.voynich-workbench[data-vw-theme="light"] .vw-panels {
    padding: 0 !important;
}


