/* ══════════════════════════════════════════════════════════════
   Insait Web Workspace — Styles for all modules
   Orange-Purple Dark Theme (self-contained)
   ══════════════════════════════════════════════════════════════ */

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

:root {
    --orange:        #ff6b00;
    --orange-light:  #ff8c00;
    --orange-dark:   #cc5500;
    --purple:        #6a0dad;
    --purple-light:  #9b30d0;
    --purple-dark:   #450a7d;
    --bg-dark:       #1a0a2e;
    --bg-card:       #2a1050;
    --text-light:    #f0e6ff;
    --text-muted:    #c4a8e8;
    --border:        rgba(255,107,0,0.3);
    --shadow:        0 4px 24px rgba(106,13,173,0.4);
}

body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: var(--bg-dark); color: var(--text-light); min-height: 100vh; line-height: 1.6; }

/* ── Shared base styles (moved from ../assets/style.css) ── */
.btn {
    display: inline-block;
    padding: 0.65rem 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: filter 0.2s, transform 0.1s;
}
.btn:hover { filter: brightness(1.15); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
    background: linear-gradient(90deg, var(--orange), var(--orange-dark));
    color: #fff;
}
.btn-secondary {
    background: linear-gradient(90deg, var(--purple), var(--purple-dark));
    color: #fff;
}
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.82rem; }
main {
    max-width: 960px;
    margin: 2.5rem auto;
    padding: 0 1.5rem 4rem;
}
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}
.card h2 {
    font-size: 1.5rem;
    color: var(--orange-light);
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
}
.card h3 {
    color: var(--purple-light);
    margin: 1rem 0 0.5rem;
}
.card p, .card li { color: var(--text-muted); margin-bottom: 0.5rem; }
.card ul { padding-left: 1.4rem; }
body.ws-module { overflow: hidden; display: flex; flex-direction: column; height: 100vh; }
body.ws-home { display: flex; flex-direction: column; }

/* ── TOP BAR (shared) ───────────────────────────────────── */
.ws-topbar {
    background: linear-gradient(90deg, var(--purple-dark) 0%, var(--purple) 50%, var(--orange-dark) 100%);
    padding: 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 48px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.5);
    z-index: 1000;
    flex-shrink: 0;
}

.ws-topbar .brand {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}
.ws-topbar .brand span { color: var(--orange-light); }
.ws-topbar .brand-icon { font-size: 1.2rem; line-height: 1; height: 22px; width: auto; vertical-align: middle; }
.ws-topbar .brand-icon img { height: 22px; width: auto; display: block; }
.ws-topbar-spacer { flex: 1; }

.ws-topbar-nav {
    display: flex;
    gap: 0.25rem;
    margin-left: 1rem;
}

.ws-topbar-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    color: var(--text-light);
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.ws-topbar-btn:hover { background: rgba(255,107,0,0.25); color: var(--orange-light); }
.ws-topbar-btn.active { background: rgba(255,107,0,0.2); color: var(--orange-light); border-color: var(--orange); }

.ws-topbar-lang { display: flex; gap: 0.15rem; }
.ws-topbar-lang a {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    color: var(--text-light);
    padding: 0.15rem 0.35rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
}
.ws-topbar-lang a:hover { background: rgba(255,107,0,0.3); }
.ws-topbar-lang a.active { background: linear-gradient(90deg, var(--orange), var(--orange-dark)); border-color: var(--orange); color: #fff; }

.ws-module-actions { display: flex; gap: 0.3rem; }

/* ── HOME PAGE ───────────────────────────────────────────── */
.ws-home main { max-width: none; margin: 0; padding: 0; flex: 1; }

.ws-hero-alt {
    background: linear-gradient(135deg, var(--purple-dark) 0%, var(--bg-dark) 60%, var(--orange-dark) 100%);
    text-align: center;
    padding: 3rem 2rem 2rem;
}

.ws-hero-alt h1 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 800;
    background: linear-gradient(90deg, var(--orange-light), var(--purple-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.4rem;
}

.ws-hero-alt h1 .hero-icon {
    display: inline-block;
    -webkit-text-fill-color: initial;
    background: none;
    -webkit-background-clip: initial;
    background-clip: initial;
    height: 40px;
    width: auto;
    vertical-align: middle;
}
.ws-hero-alt h1 .hero-icon img { height: 40px; width: auto; display: block; }

.ws-hero-alt p { color: var(--text-muted); font-size: 0.95rem; max-width: 520px; margin: 0 auto; }

.ws-preview-badge {
    display: inline-block;
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background: var(--orange);
    color: #fff;
    vertical-align: super;
    -webkit-text-fill-color: initial;
    background: var(--orange);
    background-clip: initial;
    -webkit-background-clip: initial;
    line-height: 1.4;
}

.ws-apps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    max-width: 960px;
    margin: 2rem auto;
    padding: 0 1.5rem 3rem;
}

.ws-app-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 2rem 1.5rem 1.5rem;
    text-decoration: none;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ws-app-card:hover { transform: translateY(-4px); box-shadow: 0 8px 28px rgba(106,13,173,0.5); }

.ws-app-icon { font-size: 2.8rem; line-height: 1; }
.ws-app-name { font-size: 1.15rem; font-weight: 700; color: var(--orange-light); }
.ws-app-desc { font-size: 0.85rem; color: var(--text-muted); }
.ws-app-btn { margin-top: 0.5rem; }

.ws-footer {
    text-align: center;
    padding: 1rem 1.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    background: var(--purple-dark);
}
.ws-footer a { color: var(--orange-light); text-decoration: none; }

/* ══════════════════════════════════════════════════════════════
   WORD MODULE — Ribbon toolbar
   ══════════════════════════════════════════════════════════════ */

.ws-ribbon {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.ws-ribbon-tabs {
    display: flex;
    gap: 0;
    padding: 0 1rem;
    border-bottom: 1px solid var(--border);
}

.ws-ribbon-tab {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 0.4rem 0.9rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

.ws-ribbon-tab:hover { color: var(--text-light); }
.ws-ribbon-tab.active { color: var(--orange-light); border-bottom-color: var(--orange-light); }

.ws-ribbon-panels {
    position: relative;
}

.ws-ribbon-panel {
    display: none;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 1rem;
    flex-wrap: wrap;
}

.ws-ribbon-panel.active { display: flex; }

.ws-ribbon-panel button {
    background: rgba(255,255,255,0.06);
    border: 1px solid transparent;
    border-radius: 5px;
    color: var(--text-light);
    padding: 0.3rem 0.5rem;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
    white-space: nowrap;
}

.ws-ribbon-panel button:hover { background: rgba(255,107,0,0.18); border-color: var(--border); color: var(--orange-light); }

.ws-tb-sep {
    width: 1px;
    height: 22px;
    background: var(--border);
    display: inline-block;
    margin: 0 0.15rem;
}

.ws-tb-label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.ws-tb-label select {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-light);
    padding: 0.2rem 0.3rem;
    font-size: 0.75rem;
    cursor: pointer;
}

.ws-tb-label select option { background: var(--bg-card); }

.ws-tb-color {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 0.82rem;
    color: var(--text-light);
    position: relative;
    cursor: pointer;
}

.ws-tb-color input[type="color"] {
    width: 18px;
    height: 18px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 3px;
    cursor: pointer;
    background: none;
}

/* ── editor ────────────────────────────────────────────── */
.ws-editor-container {
    flex: 1;
    display: flex;
    flex-direction: row;
    overflow: hidden;
}
.ws-editor-wrap {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #1e1e2e;
}

.ws-editor {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    outline: none;
    padding-bottom: 2rem;
}
.ws-editor > .ws-page {
    margin-bottom: 2.5rem;
}

.ws-editor .ws-page {
    width: 100%;
    max-width: 900px;
    min-height: 1000px;
    background: #fff;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 3px;
    padding: 0;
    color: #000;
    font-size: 1rem;
    line-height: 1.7;
    outline: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4), 0 4px 16px rgba(0,0,0,0.25);
    flex-shrink: 0;
    transition: box-shadow 0.2s;
    position: relative;
    overflow: hidden;
    overflow-x: auto;
}
.ws-editor .ws-page:focus {
    box-shadow: 0 1px 3px rgba(0,0,0,0.4), 0 4px 20px rgba(0,0,0,0.35);
}
.ws-editor .ws-page.ws-canvas-page { overflow-x: auto; overflow-y: hidden; padding: 0; }

.ws-editor .ws-page h1 { color: #1a1a2e; font-size: 2rem; margin-bottom: 0.5rem; }
.ws-editor .ws-page h2 { color: #2a1050; font-size: 1.5rem; margin-bottom: 0.4rem; }
.ws-editor .ws-page h3 { color: #555; font-size: 1.2rem; margin-bottom: 0.3rem; }
.ws-editor .ws-page p { margin-bottom: 0.6rem; }
.ws-editor .ws-page ul,
.ws-editor .ws-page ol { padding-left: 1.5rem; margin-bottom: 0.6rem; }
.ws-editor .ws-page li { margin-bottom: 0.2rem; }
.ws-editor .ws-page a { color: #0563c1; text-decoration: underline; }
.ws-editor .ws-page table { border-collapse: collapse; width: 100%; margin: 0.5rem 0; }
.ws-editor .ws-page th,
.ws-editor .ws-page td { border: 1px solid #999; padding: 6px 10px; }
.ws-editor .ws-page th { background: #f0f0f0; color: #000; font-weight: 700; }
.ws-editor .ws-page td { color: #000; }
.ws-editor .ws-page img { max-width: 100%; border-radius: 6px; margin: 0.5rem 0; }

.ws-page-btn { font-size: 0.75rem !important; }
.ws-page-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 900px;
    padding: 0.8rem;
    border: 2px dashed rgba(255,255,255,0.15);
    border-radius: 6px;
    background: rgba(255,255,255,0.03);
    color: var(--text-muted);
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    flex-shrink: 0;
}
.ws-page-add-btn:hover {
    background: rgba(255,107,0,0.1);
    border-color: var(--orange);
    color: var(--orange-light);
}

/* ── status bar ───────────────────────────────────────── */
.ws-statusbar {
    display: flex;
    gap: 1rem;
    padding: 0.35rem 1rem;
    background: var(--purple-dark);
    border-top: 1px solid var(--border);
    font-size: 0.78rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ── Modal ─────────────────────────────────────────────── */
.ws-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.ws-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    min-width: 320px;
    max-width: 440px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

.ws-modal h3 {
    font-size: 1.05rem;
    color: var(--orange-light);
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.ws-modal-form label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    margin-top: 0.6rem;
}

.ws-modal-form input[type="text"],
.ws-modal-form input[type="url"],
.ws-modal-form input[type="file"] {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-light);
    padding: 0.5rem 0.7rem;
    font-size: 0.85rem;
    outline: none;
}

.ws-modal-form input:focus { border-color: var(--orange-light); }

.ws-modal-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    justify-content: flex-end;
}

/* ── Table picker ──────────────────────────────────────── */
.ws-table-picker { text-align: center; }

.ws-tp-grid {
    display: inline-grid;
    grid-template-columns: repeat(10, 20px);
    gap: 2px;
    margin-bottom: 0.5rem;
}

.ws-tp-cell {
    width: 20px;
    height: 20px;
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--border);
    border-radius: 2px;
    cursor: pointer;
    transition: background 0.1s;
}

.ws-tp-cell.hover { background: var(--orange); border-color: var(--orange-light); }

.ws-tp-info { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; }

/* ══════════════════════════════════════════════════════════════
   SHEETS MODULE
   ══════════════════════════════════════════════════════════════ */

.ws-sheets { overflow: hidden; }

.ws-sheets-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 1rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.ws-sheets-label { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }
#wsActiveCell { color: var(--orange-light); font-weight: 600; }

.ws-formula-input {
    flex: 1;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text-light);
    padding: 0.25rem 0.5rem;
    font-size: 0.82rem;
    font-family: 'Consolas', 'Courier New', monospace;
    outline: none;
}
.ws-formula-input:focus { border-color: var(--orange-light); }

.ws-sheets-container {
    flex: 1;
    overflow: auto;
    padding: 0;
}

.ws-sheets-grid {
    display: grid;
    grid-template-columns: 45px repeat(26, 100px);
    gap: 0;
    min-width: fit-content;
}

.ws-scorner {
    background: var(--purple-dark);
    border: 1px solid var(--border);
    position: sticky;
    top: 0;
    left: 0;
    z-index: 3;
    height: 28px;
}

.ws-scol-head {
    background: var(--purple-dark);
    border: 1px solid var(--border);
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    padding: 0.3rem 0;
    position: sticky;
    top: 0;
    z-index: 2;
    height: 28px;
}

.ws-srow-head {
    background: var(--purple-dark);
    border: 1px solid var(--border);
    text-align: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    padding: 0.2rem 0;
    position: sticky;
    left: 0;
    z-index: 1;
    height: 28px;
    line-height: 24px;
}

.ws-scell {
    border: 1px solid var(--border);
    padding: 0.2rem 0.4rem;
    font-size: 0.82rem;
    color: var(--text-light);
    background: var(--bg-dark);
    min-height: 28px;
    outline: none;
    cursor: cell;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ws-scell:focus { border-color: var(--orange); background: rgba(255,107,0,0.08); z-index: 1; position: relative; }

.ws-scell-selected {
    background: rgba(255,107,0,0.15) !important;
    outline: 2px solid var(--orange-light);
    outline-offset: -1px;
    z-index: 1;
    position: relative;
}

/* ══════════════════════════════════════════════════════════════
   PRESENTATION MODULE
   ══════════════════════════════════════════════════════════════ */

.ws-slides { overflow: hidden; }

.ws-slides-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.ws-slides-sidebar {
    width: 120px;
    min-width: 120px;
    background: linear-gradient(180deg, var(--purple-dark) 0%, var(--bg-dark) 100%);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 0.5rem;
}

.ws-slides-sidebar-header {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 0.3rem 0.5rem 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.5rem;
}

.ws-slide-thumb {
    background: var(--bg-card);
    border: 2px solid transparent;
    border-radius: 6px;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ws-slide-thumb:hover { background: rgba(255,107,0,0.1); }
.ws-slide-thumb.active { border-color: var(--orange); background: rgba(255,107,0,0.12); }

.ws-thumb-num {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-muted);
}

.ws-slides-canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ws-slide-toolbar {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 1rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.ws-slide-toolbar button {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text-light);
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s;
}

.ws-slide-toolbar button:hover { background: rgba(255,107,0,0.2); }

.ws-slide-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    overflow: auto;
    background: radial-gradient(ellipse at center, var(--bg-card), var(--bg-dark));
}

.ws-slide {
    width: 100%;
    max-width: 1280px;
    aspect-ratio: 16 / 9;
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.15);
    position: relative;
    overflow: hidden;
    overflow-x: auto;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.ws-slide-el:focus { border-color: var(--orange-light) !important; background: rgba(255,107,0,0.05); }
.ws-slide-el { touch-action: none; }
.ws-slide-el [contenteditable] { touch-action: manipulation; }

/* ── top bar actions (present mode controls) ──────────── */
.ws-top-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: 0.75rem;
}
.ws-top-actions:empty { display: none; }

.ws-slide-nav-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 5px;
    color: #fff;
    padding: 0.3rem 0.55rem;
    font-size: 0.9rem;
    cursor: pointer;
    line-height: 1;
    transition: background 0.15s;
}
.ws-slide-nav-btn:hover { background: rgba(255,107,0,0.3); border-color: var(--orange); }

.ws-nav-slide-num {
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 4rem;
    text-align: center;
}

/* ── presentation mode: hide all chrome, show overlay ──── */
.ws-presenting .ws-tabbar { display: none !important; }
.ws-presenting .ws-topbar { display: none !important; }
.ws-presenting .ws-slides-sidebar { display: none !important; }
.ws-presenting .ws-ribbon { display: none; }
.ws-presenting .ws-statusbar { display: none; }
.ws-presenting .ws-slide-stage {
    padding: 0;
    background: #000;
    position: fixed;
    inset: 0;
    z-index: 9999;
}
.ws-presenting .ws-slide {
    border: none;
    border-radius: 0;
    box-shadow: none;
    width: 100vw;
    height: 100vh;
    max-width: none;
}

/* ── Present overlay (floating controls) ───────────────── */
.ws-present-overlay {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    padding: 0.5rem 0.8rem;
    z-index: 10000;
    opacity: 1;
    transition: opacity 0.3s ease;
}
.ws-present-overlay.ws-present-overlay-hide {
    opacity: 0;
    pointer-events: none;
}

.ws-present-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    color: #fff;
    padding: 0.4rem 0.6rem;
    font-size: 1rem;
    cursor: pointer;
    line-height: 1;
    transition: background 0.15s;
}
.ws-present-btn:hover { background: rgba(255,107,0,0.4); border-color: var(--orange); }

.ws-present-sep {
    width: 1px;
    height: 20px;
    background: rgba(255,255,255,0.15);
}

.ws-present-num {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.7);
    white-space: nowrap;
    min-width: 4rem;
    text-align: center;
}

/* ── fullscreen + presenting (F11): same layout as ws-presenting, class added by JS for fullscreen detection */

/* ── responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
    .ws-topbar { flex-wrap: wrap; height: auto; min-height: 48px; padding: 0.5rem 0.75rem; gap: 0; }
    .ws-topbar .brand { order: 1; }
    .ws-topbar-spacer { order: 2; }
    .ws-topbar-lang { order: 3; }
    .ws-topbar-nav { order: 4; width: 100%; justify-content: center; margin-left: 0; margin-top: 0.3rem; flex-wrap: wrap; }
    .ws-topbar-btn { font-size: 0.72rem; padding: 0.2rem 0.45rem; }
    .ws-apps { grid-template-columns: repeat(2, 1fr); gap: 1rem; padding: 0 1rem 2rem; }
    .ws-app-card { padding: 1.5rem 1rem; }
    .ws-editor { padding: 0; }
    .ws-editor .ws-page { padding: 1.2rem; min-height: 400px; max-width: 100%; }
    .ws-editor-wrap { padding: 1rem; overflow-x: auto; }
    .ws-slides-sidebar { width: 80px; min-width: 80px; }
    .ws-sheets-grid { grid-template-columns: 30px repeat(26, 55px); }
    .ws-module-actions { flex-wrap: wrap; }
    .ws-module-actions .btn { font-size: 0.7rem; padding: 0.3rem 0.5rem; }
    .card { padding: 1.25rem; }
    .ws-hero-alt { padding: 2rem 1rem 1.5rem; }
    .ws-hero-alt p { font-size: 0.85rem; }
}

@media (max-width: 480px) {
    .ws-topbar { padding: 0.4rem 0.5rem; }
    .ws-topbar .brand { font-size: 0.85rem; }
    .ws-topbar-btn { font-size: 0.65rem; padding: 0.15rem 0.35rem; }
    .ws-topbar-lang a { font-size: 0.55rem; padding: 0.1rem 0.25rem; }
    .ws-apps { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; padding: 0 0.75rem 2rem; }
    .ws-app-card { padding: 1rem 0.75rem; }
    .ws-app-icon { font-size: 2rem; }
    .ws-app-name { font-size: 1rem; }
    .ws-app-desc { font-size: 0.75rem; }
    .ws-slides-sidebar { display: none; }
    .ws-sheets-grid { grid-template-columns: 28px repeat(26, 42px); }
    .ws-ribbon-tabs { overflow-x: auto; scrollbar-width: none; }
    .ws-ribbon-panel { gap: 0.15rem; padding: 0.25rem 0.5rem; }
    .ws-ribbon-panel button { font-size: 0.68rem; padding: 0.2rem 0.35rem; }
    .ws-ribbon-tab { font-size: 0.7rem; padding: 0.3rem 0.5rem; white-space: nowrap; }
    .ws-tb-label { font-size: 0.65rem; }
    .ws-tb-label select { font-size: 0.65rem; padding: 0.15rem 0.2rem; }
    .ws-tb-sep { margin: 0 0.1rem; }
    .ws-slide-toolbar { gap: 0.2rem; padding: 0.25rem 0.5rem; flex-wrap: wrap; }
    .ws-slide-toolbar button { font-size: 0.68rem; padding: 0.2rem 0.4rem; }
    .ws-slide-stage { padding: 0.5rem; overflow: auto; }
    .ws-slide { max-width: 100%; }
    .ws-hero-alt { padding: 1.5rem 0.75rem 1rem; }
    .ws-hero-alt h1 { font-size: clamp(1.2rem, 5vw, 1.8rem); }
    .ws-toolbar { gap: 0.2rem; }
    .ws-toolbar button { font-size: 0.7rem; padding: 0.2rem 0.4rem; min-width: 26px; }
    .ws-editor .ws-page { min-height: 300px; }
    section[style*="max-width: 720px"] { padding: 0 0.75rem 2rem !important; }
    .ws-statusbar { font-size: 0.7rem; padding: 0.25rem 0.5rem; gap: 0.5rem; }
    .ws-slide-nav-btn { font-size: 0.75rem; padding: 0.2rem 0.4rem; }
    .ws-nav-slide-num { font-size: 0.7rem; min-width: 2.5rem; }
}

@media (max-width: 380px) {
    .ws-topbar-nav { justify-content: flex-start; }
    .ws-topbar-btn { font-size: 0.6rem; padding: 0.12rem 0.3rem; }
    .ws-apps { grid-template-columns: 1fr; }
    .ws-sheets-grid { grid-template-columns: 25px repeat(26, 35px); }
    .ws-editor .ws-page { min-height: 250px; }
    .ws-ribbon-panel button { font-size: 0.62rem; padding: 0.15rem 0.25rem; }
    .ws-addtab-grid { grid-template-columns: 1fr 1fr; }
}

/* ══════════════════════════════════════════════════════════════
   TOOLBAR EXTENSIONS — Zoom, Font Buttons, Ruler, Sidebar
   ══════════════════════════════════════════════════════════════ */

.ws-zoom-group { gap: 2px !important; }
.ws-zbtn {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-light);
    padding: 0.15rem 0.4rem;
    font-size: 0.75rem;
    cursor: pointer;
    line-height: 1.2;
    min-width: 24px;
    text-align: center;
}
.ws-zbtn:hover { background: rgba(255,107,0,0.18); color: var(--orange-light); }
.ws-zoom-level {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--orange-light);
    min-width: 36px;
    text-align: center;
    display: inline-block;
}

.ws-fmt-btn { font-size: 0.85rem !important; min-width: 28px; text-align: center; }
.ws-fmt-btn b, .ws-fmt-btn i, .ws-fmt-btn u, .ws-fmt-btn s { font-size: 0.85rem; }

/* ── Ruler ────────────────────────────────────────────── */
.ws-ruler {
    display: none;
    height: 20px;
    background: var(--purple-dark);
    border-bottom: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}
.ws-ruler-mark {
    position: absolute;
    top: 0;
    width: 1px;
    height: 6px;
    background: var(--text-muted);
}
.ws-ruler-mark-major { height: 10px; }
.ws-ruler-mark-full { height: 16px; }
.ws-ruler-label {
    position: absolute;
    top: 2px;
    left: 3px;
    font-size: 0.6rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ── Read mode ────────────────────────────────────────── */
.ws-readmode .ws-ribbon { display: none; }
.ws-readmode .ws-editor-wrap { padding: 2rem; background: transparent; }
.ws-readmode .ws-statusbar { display: none; }
.ws-readmode .ws-editor .ws-page { border: none; box-shadow: none; }
.ws-readonly { pointer-events: none; opacity: 0.9; }

/* ── Object menu popup ────────────────────────────────── */
.ws-obj-menu { min-width: 220px; }
.ws-obj-type {
    font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.8rem; text-transform: uppercase; letter-spacing: 1px;
}
.ws-obj-actions { display: flex; flex-direction: column; gap: 0.3rem; }
.ws-obj-btn {
    background: rgba(255,255,255,0.06); border: 1px solid var(--border); border-radius: 6px;
    color: var(--text-light); padding: 0.5rem 0.8rem; font-size: 0.85rem; cursor: pointer;
    text-align: left; transition: background 0.12s, border-color 0.12s;
}
.ws-obj-btn:hover { background: rgba(255,107,0,0.15); border-color: var(--orange); color: var(--orange-light); }
.ws-obj-btn-danger:hover { background: rgba(255,50,50,0.15); border-color: #ff4444; color: #ff6666; }
.ws-obj-sep { border: none; border-top: 1px solid var(--border); margin: 0.4rem 0; }
.ws-readonly .ws-resize-handle { display: none; }

/* ── Sidebar ──────────────────────────────────────────── */
.ws-sidebar {
    display: none;
    width: 180px;
    min-width: 180px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    flex-shrink: 0;
    overflow-y: auto;
}
.ws-sidebar-header {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 0.6rem 0.7rem;
    border-bottom: 1px solid var(--border);
}
.ws-sidebar-item {
    padding: 0.5rem 0.7rem;
    font-size: 0.82rem;
    color: var(--text-light);
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.12s;
}
.ws-sidebar-item:hover { background: rgba(255,107,0,0.1); }
.ws-sidebar-item.active { background: rgba(255,107,0,0.15); color: var(--orange-light); border-left: 3px solid var(--orange); }

/* ── Document stats ───────────────────────────────────── */
.ws-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    margin: 1rem 0;
}
.ws-stat-item {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.ws-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.ws-stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--orange-light);
}

/* ── Spacing modal buttons ────────────────────────────── */
#modal-spacing .ws-modal-form button { min-width: 70px; }

/* ── Editor wrap zoom ─────────────────────────────────── */
.ws-editor-wrap { transform-origin: top center; }

/* ── Canvas element styles ────────────────────────────── */
.ws-el {
    position: absolute;
    cursor: move;
    min-width: 20px;
    min-height: 20px;
    user-select: none;
    border: 1px solid transparent;
    transition: box-shadow 0.12s;
    overflow: hidden;
    touch-action: none;
}
.ws-el-text { touch-action: manipulation; user-select: text; }
.ws-el:hover { border-color: rgba(255,107,0,0.3); }
.ws-el.selected { border-color: var(--orange-light); box-shadow: 0 0 0 2px rgba(255,107,0,0.25), 0 4px 16px rgba(0,0,0,0.3); z-index: 10; }
.ws-el.active-el { z-index: 30; }
.ws-el.active-el .ws-el-text { cursor: text; }
.ws-rubber-band { position: absolute; border: 1.5px dashed var(--orange-light); background: rgba(255,107,0,0.08); pointer-events: none; z-index: 999; }
.ws-el-text { padding: 6px 10px; cursor: move; outline: none; user-select: text; min-height: 1em; white-space: pre-wrap; overflow-wrap: break-word; }
.ws-el-text:focus { cursor: text; }
.ws-el-image { cursor: move; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.ws-el-image img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; user-select: none; }
.ws-el-table { overflow: auto; cursor: move; }
.ws-el-table table { border-collapse: collapse; }
.ws-el-table td, .ws-el-table th { border: 1px solid #999; padding: 4px 8px; font-size: 0.85rem; color: #000; cursor: text; outline: none; min-width: 30px; }
.ws-el-table td:focus, .ws-el-table th:focus { background: rgba(255,107,0,0.07); box-shadow: inset 0 0 0 2px rgba(255,107,0,0.4); }
.ws-chart-svg { background: rgba(0,0,0,0.15); border-radius: 4px; margin-bottom: 4px; min-height: 80px; }
.ws-chart-data table { width: 100%; border-collapse: collapse; font-size: 0.75rem; }
.ws-chart-data td, .ws-chart-data th { border: 1px solid #666; padding: 2px 4px; color: #fff; outline: none; cursor: text; }
.ws-chart-editor-table { width: 100%; border-collapse: collapse; }
.ws-chart-editor-table th { background: rgba(106,13,173,0.3); border: 1px solid #555; padding: 6px 8px; color: #fff; font-size: 0.85rem; text-align: left; }
.ws-chart-editor-table td { border: 1px solid #555; padding: 2px; }

.ws-el-link { cursor: move; display: flex; align-items: center; overflow: hidden; }
.ws-el-link a { display: block; width: 100%; height: 100%; padding: 6px 10px; color: #1a73e8; text-decoration: underline; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; box-sizing: border-box; border-radius: 4px; pointer-events: auto; user-select: text; }
.ws-el-link a:hover { background: rgba(26,115,232,0.06); }
.ws-el-line { cursor: move; overflow: visible; }
.ws-el-line .ws-line-inner { width: 100%; height: 100%; border-radius: 2px; pointer-events: none; }

.ws-resize-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--orange-light);
    border: 2px solid #fff;
    border-radius: 50%;
    z-index: 20;
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
    touch-action: none;
}
.ws-resize-handle.nw { top: -5px; left: -5px; cursor: nw-resize; }
.ws-resize-handle.ne { top: -5px; right: -5px; cursor: ne-resize; }
.ws-resize-handle.sw { bottom: -5px; left: -5px; cursor: sw-resize; }
.ws-resize-handle.se { bottom: -5px; right: -5px; cursor: se-resize; }
.ws-resize-handle.n { top: -5px; left: 50%; margin-left: -5px; cursor: n-resize; }
.ws-resize-handle.s { bottom: -5px; left: 50%; margin-left: -5px; cursor: s-resize; }
.ws-resize-handle.e { right: -5px; top: 50%; margin-top: -5px; cursor: e-resize; }
.ws-resize-handle.w { left: -5px; top: 50%; margin-top: -5px; cursor: w-resize; }

.ws-page { position: relative; overflow: hidden; }
.ws-page.ws-canvas-page { overflow: hidden; }
.ws-group-box { position: absolute; border: 2px dashed var(--orange-light); background: rgba(255,107,0,0.04); pointer-events: auto; z-index: 15; }
.ws-group-handle { position: absolute; width: 12px; height: 12px; background: var(--orange-light); border: 2px solid #fff; border-radius: 50%; z-index: 25; box-shadow: 0 1px 4px rgba(0,0,0,0.4); pointer-events: auto; }
.ws-group-handle.nw { top: -7px; left: -7px; cursor: nw-resize; }
.ws-group-handle.ne { top: -7px; right: -7px; cursor: ne-resize; }
.ws-group-handle.sw { bottom: -7px; left: -7px; cursor: sw-resize; }
.ws-group-handle.se { bottom: -7px; right: -7px; cursor: se-resize; }

/* ── Print styles ─────────────────────────────────────── */
@page { margin: 0; size: landscape; }
@media print {
    body.ws-module { overflow: visible; height: auto; display: block; }
    .ws-topbar, .ws-ribbon, .ws-statusbar, .ws-tabbar, .ws-modal-overlay, .ws-sidebar,
    .ws-slides-sidebar, .ws-sheets-sidebar, .ws-sheets-bar, .ws-page-add-btn,
    .ws-present-overlay, .ws-slide-resize-handle, .ws-slide-group-box,
    .ws-slide-group-handle, .ws-slide-grid { display: none !important; }
    .ws-slides-body { overflow: visible !important; display: block !important; }
    .ws-slides-canvas-area { overflow: visible !important; display: block !important; }
    .ws-slide-stage { overflow: visible !important; padding: 0 !important; background: none !important; display: block !important; }
    .ws-slide { width: 100vw !important; height: 100vh !important; max-width: none !important; aspect-ratio: auto !important; box-shadow: none !important; border: none !important; border-radius: 0 !important; overflow: visible !important; page-break-after: always; break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .ws-slide:last-child { page-break-after: auto; }
    .ws-slide-el { overflow: visible !important; }
    .ws-editor-wrap { overflow: visible !important; transform: none !important; padding: 0 !important; background: none !important; }
    .ws-editor { gap: 0 !important; display: block !important; }
    .ws-editor .ws-page { box-shadow: none !important; border: none !important; max-width: 100% !important; min-height: auto !important; padding: 0 !important; break-inside: avoid; page-break-after: always; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .ws-ruler { display: none !important; }
    /* Sheets print: hide grid and container to avoid blank page */
    body.ws-sheets .ws-sheets-container,
    body.ws-sheets .ws-sheets-grid,
    body.ws-sheets .ws-scorner,
    body.ws-sheets .ws-scol-head,
    body.ws-sheets .ws-srow-head,
    body.ws-sheets .ws-scell { display: none !important; }
}

/* ══════════════════════════════════════════════════════════════
   PRESENTATION MODULE — Enhanced
   ══════════════════════════════════════════════════════════════ */

.ws-slide-el.ws-selected {
    outline: 2px solid var(--orange-light);
    outline-offset: 1px;
    box-shadow: 0 0 12px rgba(255,107,0,0.3);
}

.ws-el-image { border: 1px dashed rgba(255,107,0,0.2); border-radius: 4px; overflow: hidden; }

.ws-slide-grid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255,107,0,0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,107,0,0.08) 1px, transparent 1px);
    background-size: 20px 20px;
    z-index: 9999;
}

/* ── Sorter view ──────────────────────────────────────── */
.ws-sorter-view {
    flex: 1;
    display: none;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 1rem;
    padding: 1.5rem;
    overflow-y: auto;
    background: radial-gradient(ellipse at center, var(--bg-card), var(--bg-dark));
}

.ws-sorter-card {
    width: 180px;
    height: 110px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: border-color 0.15s, transform 0.15s;
    position: relative;
    padding: 0.5rem;
}

.ws-sorter-card:hover { border-color: var(--orange); transform: translateY(-2px); }
.ws-sorter-card.active { border-color: var(--orange-light); box-shadow: 0 0 16px rgba(255,107,0,0.25); }

.ws-sorter-preview {
    width: 100%;
    flex: 1;
    border-radius: 4px;
    min-height: 60px;
}

.ws-sorter-num {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
}

/* ── Background presets ───────────────────────────────── */
.ws-bg-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.5rem 0;
}

.ws-bg-preset {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: border-color 0.12s, transform 0.12s;
}

.ws-bg-preset:hover { border-color: var(--orange-light); transform: scale(1.1); }

/* ── Status bar right ─────────────────────────────────── */
.ws-status-right { margin-left: auto; color: var(--orange-light); font-weight: 600; }

/* ── Slide transition animations ──────────────────────── */
.ws-slide { transition: opacity 0.4s ease, transform 0.4s ease; }

/* ── Presentation resize handles & group box ───────────── */
.ws-slide-resize-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--orange-light);
    border: 2px solid #fff;
    border-radius: 50%;
    z-index: 20;
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
    display: none;
    touch-action: none;
}
.ws-slide-el.ws-selected .ws-slide-resize-handle { display: block; }
.ws-slide-resize-handle.nw { top: -5px; left: -5px; cursor: nw-resize; }
.ws-slide-resize-handle.ne { top: -5px; right: -5px; cursor: ne-resize; }
.ws-slide-resize-handle.sw { bottom: -5px; left: -5px; cursor: sw-resize; }
.ws-slide-resize-handle.se { bottom: -5px; right: -5px; cursor: se-resize; }

.ws-slide-group-box {
    position: absolute;
    border: 2px dashed var(--orange-light);
    background: rgba(255,107,0,0.04);
    pointer-events: auto;
    z-index: 15;
}
.ws-slide-group-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--orange-light);
    border: 2px solid #fff;
    border-radius: 50%;
    z-index: 25;
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
    pointer-events: auto;
    display: block;
}
.ws-slide-group-handle.nw { top: -7px; left: -7px; cursor: nw-resize; }
.ws-slide-group-handle.ne { top: -7px; right: -7px; cursor: ne-resize; }
.ws-slide-group-handle.sw { bottom: -7px; left: -7px; cursor: sw-resize; }
.ws-slide-group-handle.se { bottom: -7px; right: -7px; cursor: se-resize; }

/* ══════════════════════════════════════════════════════════════
    SHEETS MODULE — Enhanced Ribbon + Sidebar
    ══════════════════════════════════════════════════════════════ */

/* ── Body layout ── */
.ws-sheets-body {
    flex: 1;
    display: flex;
    flex-direction: row;
    overflow: hidden;
}

.ws-sheets-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* ── Container zoom ── */
#wsSheetsContainer {
    flex: 1;
    overflow: auto;
    padding: 0;
    transform-origin: top left;
}

/* ── Grid lines toggle ── */
.ws-scell-nogrid { border-color: transparent !important; }

/* ── Freeze panes ── */
.ws-freeze .ws-scol-head:first-of-type { position: sticky; top: 0; z-index: 3; }
.ws-freeze .ws-srow-head:first-of-type { position: sticky; left: 0; z-index: 3; }

/* ── Filter indicator ── */
.ws-scol-head.ws-filter-active { cursor: pointer; }
.ws-scol-head.ws-filter-active:hover { background: rgba(255,107,0,0.15); }
.ws-scol-head.ws-filter-on { background: rgba(255,107,0,0.25); color: var(--orange-light); }
.ws-scol-head.ws-filter-on::after { content: ' ▼'; font-size: 0.6rem; }

.ws-filter-dropdown label:hover { background: rgba(255,255,255,0.05); }
.ws-filter-dropdown input[type="checkbox"] { accent-color: var(--orange-light); }

/* ── Smart chip ── */
.ws-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: rgba(255,107,0,0.12);
    border: 1px solid var(--orange);
    border-radius: 12px;
    padding: 1px 8px;
    font-size: 0.78rem;
    color: var(--orange-light);
    white-space: nowrap;
}

/* ── Right sidebar ── */
.ws-sheets-sidebar {
    width: 0;
    min-width: 0;
    overflow: hidden;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    transition: width 0.25s ease, min-width 0.25s ease;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.ws-sheets-sidebar--open {
    width: 260px;
    min-width: 260px;
}

.ws-sheets-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.8rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--orange-light);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.ws-sidebar-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.15rem 0.3rem;
    border-radius: 4px;
    line-height: 1;
}

.ws-sidebar-close:hover { background: rgba(255,107,0,0.15); color: var(--orange-light); }

.ws-sheets-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.ws-sb-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    padding: 0.4rem 0.3rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.4rem;
}

/* ── Template items ── */
.ws-sb-template {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s;
    margin-bottom: 0.2rem;
}

.ws-sb-template:hover { background: rgba(255,107,0,0.1); }

.ws-sb-template-icon { font-size: 1.3rem; line-height: 1; flex-shrink: 0; }

.ws-sb-template-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-light);
}

.ws-sb-template-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

/* ── Smart chip items ── */
.ws-sb-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text-light);
    transition: background 0.12s;
}

.ws-sb-chip:hover { background: rgba(255,107,0,0.1); }

.ws-sb-chip small {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-left: auto;
}

/* ── Formula bar toggle ── */
.ws-sheets-bar { flex-shrink: 0; }

/* ── Status bar for sheets ── */
.ws-statusbar .ws-status-right { margin-left: auto; }

/* ══════════════════════════════════════════════════════════════
   TAB SYSTEM — Across all modules
   ══════════════════════════════════════════════════════════════ */
.ws-tabbar {
    display: flex;
    align-items: center;
    background: linear-gradient(90deg, rgba(106,13,173,0.6) 0%, rgba(26,10,46,1) 100%);
    border-bottom: 1px solid var(--border);
    height: 32px;
    flex-shrink: 0;
    padding: 0 0.5rem;
    gap: 0.25rem;
    z-index: 999;
}
.ws-tabbar-tabs {
    display: flex;
    gap: 0.15rem;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}
.ws-tabbar-tab {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 4px 4px 0 0;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    border-bottom: none;
    min-width: 0;
    flex-shrink: 0;
}
.ws-tabbar-tab:hover { background: rgba(255,107,0,0.12); color: var(--text-light); }
.ws-tabbar-tab.active { background: var(--bg-card); color: var(--orange-light); border-color: var(--border); border-bottom-color: var(--bg-card); }
.ws-tabbar-icon { font-size: 0.8rem; line-height: 1; }
.ws-tabbar-label { overflow: hidden; text-overflow: ellipsis; max-width: 90px; }
.ws-tabbar-add {
    background: linear-gradient(135deg, var(--purple) 0%, var(--orange) 100%);
    border: none;
    border-radius: 50%;
    color: #fff;
    width: 24px;
    height: 24px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
    line-height: 1;
    box-shadow: 0 0 6px rgba(255,107,0,0.3);
    position: relative;
}
.ws-tabbar-add::before {
    content: '+';
    display: block;
    line-height: 1;
}
.ws-tabbar-add:hover {
    transform: scale(1.15);
    box-shadow: 0 0 12px rgba(255,107,0,0.6);
    background: linear-gradient(135deg, var(--orange) 0%, var(--purple) 100%);
}

.ws-addtab-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.6rem;
    margin: 1rem 0;
}
.ws-addtab-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 1rem 0.5rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
    text-align: center;
}
.ws-addtab-option:hover { background: rgba(255,107,0,0.1); border-color: var(--orange); }
.ws-addtab-icon { font-size: 1.8rem; line-height: 1; }
.ws-addtab-name { font-size: 0.8rem; font-weight: 600; color: var(--text-light); }

.ws-tabbar-close {
    font-size: 1rem;
    line-height: 1;
    margin-left: 0.2rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.12s;
    padding: 0 1px;
    opacity: 0.6;
    user-select: none;
}
.ws-tabbar-tab:hover .ws-tabbar-close { opacity: 1; }
.ws-tabbar-close:hover { color: #ff4444; opacity: 1; }

/* ══════════════════════════════════════════════════════════════
   SHEETS — Google Sheets style override
   ══════════════════════════════════════════════════════════════ */
body.ws-sheets .ws-sheets-container {
    background: #e8eaed;
}
body.ws-sheets .ws-sheets-grid {
    background: #fff;
}
body.ws-sheets .ws-scorner {
    background: #f8f9fa;
    border-color: #d4d4d4;
}
body.ws-sheets .ws-scol-head {
    background: #f8f9fa;
    border-color: #d4d4d4;
    color: #5f6368;
    font-weight: 600;
}
body.ws-sheets .ws-srow-head {
    background: #f8f9fa;
    border-color: #d4d4d4;
    color: #5f6368;
    font-weight: 600;
}
body.ws-sheets .ws-scell {
    background: #fff;
    border-color: #d4d4d4;
    color: #000;
    min-height: 28px;
}
body.ws-sheets .ws-scell:focus {
    border-color: #1a73e8;
    background: #fff;
    outline: 2px solid #1a73e8;
    outline-offset: -1px;
    z-index: 2;
}
body.ws-sheets .ws-scell-selected {
    background: #e8f0fe !important;
    outline: 2px solid #1a73e8;
    outline-offset: -1px;
}
body.ws-sheets .ws-tabbar {
    background: linear-gradient(90deg, rgba(106,13,173,0.6) 0%, rgba(26,10,46,1) 100%);
    border-bottom: 1px solid var(--border);
}
body.ws-sheets .ws-tabbar-tab {
    color: var(--text-muted);
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
}
body.ws-sheets .ws-tabbar-tab.active {
    background: var(--bg-card);
    color: var(--orange-light);
    border-color: var(--border);
    border-bottom-color: var(--bg-card);
}
body.ws-sheets .ws-tabbar-tab:hover {
    background: rgba(255,107,0,0.12);
    color: var(--text-light);
}
body.ws-sheets .ws-statusbar {
    background: #f8f9fa;
    border-top-color: #d4d4d4;
    color: #5f6368;
}


/* ── Filter styles ── */
.ws-scol-head.ws-filter-active { cursor: pointer; }
.ws-scol-head.ws-filter-active::after { content: ' ▾'; font-size: 0.7em; opacity: 0.7; }
.ws-scol-head.ws-filter-on { color: var(--orange-light, #ff8c00) !important; }
.ws-scol-head.ws-filter-on::after { content: ' ▾'; font-size: 0.7em; color: var(--orange-light, #ff8c00); }

/* ══════════════════════════════════════════════════════════════
   FUNCTION DICTIONARY POPUP
   ══════════════════════════════════════════════════════════════ */
.ws-modal-wide { max-width: 640px !important; min-width: 480px !important; }
#modal-function-dictionary { max-width: 620px; min-width: 480px; }
.ws-fn-dict { display: flex; flex-direction: column; max-height: 70vh; }
.ws-fn-dict h3 { flex-shrink: 0; }
.ws-fn-dict-search { flex-shrink: 0; margin-bottom: 0.5rem; }
.ws-fn-dict-search input {
  width: 100%; background: var(--bg-dark); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text-light); padding: 0.45rem 0.7rem; font-size: 0.85rem; outline: none;
}
.ws-fn-dict-search input:focus { border-color: var(--orange-light); }
.ws-fn-dict-body {
  flex: 1; overflow-y: auto; padding-right: 0.3rem;
}
.ws-fn-dict-group { margin-bottom: 0.6rem; }
.ws-fn-dict-group-title {
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--purple-light); padding: 0.3rem 0; border-bottom: 1px solid rgba(255,255,255,0.06); margin-bottom: 0.3rem;
}
.ws-fn-dict-item {
  display: grid; grid-template-columns: 100px 1fr; gap: 0.3rem 0.6rem;
  padding: 0.4rem 0.5rem; border-radius: 5px; cursor: pointer;
  transition: background 0.12s; align-items: baseline;
}
.ws-fn-dict-item:hover { background: rgba(255,107,0,0.1); }
.ws-fn-dict-fn {
  font-family: 'Consolas', 'Courier New', monospace; font-size: 0.85rem; font-weight: 700;
  color: var(--orange-light); grid-column: 1; grid-row: 1;
}
.ws-fn-dict-syntax {
  font-family: 'Consolas', 'Courier New', monospace; font-size: 0.72rem; color: var(--text-muted); grid-column: 1; grid-row: 2;
}
.ws-fn-dict-desc {
  font-size: 0.78rem; color: var(--text-light); grid-column: 2; grid-row: 1 / span 2; line-height: 1.4;
}

/* ── Touch delete button ── */
.ws-touch-del {
    position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
    background: #ff4444; color: #fff; border: none; border-radius: 10px;
    padding: 0.6rem 1.2rem; font-size: 1rem; font-weight: 700;
    cursor: pointer; z-index: 9999; box-shadow: 0 4px 20px rgba(255,68,68,0.5);
    display: none; touch-action: manipulation; user-select: none;
    opacity: 0.95;
}
.ws-touch-del:active { transform: translateX(-50%) scale(0.95); }
