/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Snail icon palette */
    --snail-brown: #45413c;
    --snail-red: #c62828;
    --snail-gold: #e8d29a;
    --snail-gold-hover: #dcc67e;
    --snail-shell: #dea47a;
    --snail-shell-deep: #c17a4e;
    --snail-shell-hover: #a8663d;
    --snail-blush: #f0c2a1;
    --snail-cream: #f7e5c6;
    --snail-cream-light: #fff5e3;

    /* Font Stacks */
    --font-family-default: 'Calibri', 'Google Sans', 'Product Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --font-family-gmail: 'Google Sans', Roboto, RobotoDraft, Helvetica, Arial, sans-serif;
    --font-family-gemini: "Google Sans", "Helvetica Neue", sans-serif;
    --font-family-google: "Google Sans", "Roboto", "Helvetica Neue", Arial, sans-serif;
    --font-family-uisans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", Helvetica, "Apple Color Emoji", "Noto Sans Arabic", "Noto Sans Hebrew", Arial, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
    --font-family-cascadiacode: 'Cascadia Code', 'Cascadia Mono', Consolas, 'Courier New', monospace;
    
    /* Gemini Font Variables */
    --gemini-font-weight-regular: 400;
    --gemini-font-weight-medium: 500;
    --gemini-font-opsz: 14;
    
    /* Text Sizing */
    --text-size-body: 1rem;
    --text-size-label: 0.875rem;
    --line-height-comfortable: 1.6;
    --line-height-gemini: clamp(1.4, 1.5, 1.6);
    
    /* Accent Colors */
    --accent-cyan: #00d4ff;
    --accent-purple: #9333ea;
    
    /* Material Design System Colors - Light Mode */
    --md-sys-color-surface: #F8F9FA;
    --md-sys-color-primary: #0B57D0;
    --md-sys-color-on-surface: #1F1F1F;
    --md-sys-color-outline: #747775;
    
    /* Material Design System Colors - Dark Mode */
    --md-sys-color-surface-dark: #131314;
    --md-sys-color-primary-dark: #A8C7FA;
    --md-sys-color-on-surface-dark: #E3E3E3;
    --md-sys-color-outline-dark: #8E918F;
    
    /* Active font (defaults to font1) */
    --active-font-family: var(--font-family-default);
    --active-line-height: 1.6;

    --edit-btn-bg: var(--snail-gold);
    --edit-btn-hover: var(--snail-gold-hover);
    --edit-btn-text: var(--snail-brown);
    --view-btn-bg: var(--edit-btn-bg);
    --view-btn-hover: var(--edit-btn-hover);
    --view-btn-text: var(--edit-btn-text);
    --app-hover: #f0f0f0;
    --app-active: #e8e8e8;
    --accent-bar: var(--snail-shell);

    --mark-ink: #45413c;
    --mark-body: #f7e5c6;
    --mark-body-hi: #fff5e3;
    --mark-shell: #dea47a;
    --mark-shell-hi: #f0c2a1;
    --mark-eye: #fff;
    --edit-focus-ring: #0B57D0;

    --icon-fg: #4a4a4a;
    --overlay-bg: #ffffff;
    --popover-bg: #ffffff;
    --popover-text: #1f1f1f;
    --input-bg: #ffffff;
    --input-text: #1f1f1f;
    --avatar-bg: #9ca3af;
    --avatar-fg: #fff;
    --list-row-bg: #ffffff;
}

/* Blue theme — the pre-snail palette, recovered from git history */
html[data-theme="blue"] {
    --snail-brown: #2c3e50;
    --snail-red: #36A0F4;
    --snail-gold: #a8d4f0;
    --snail-gold-hover: #8fc9ed;
    --snail-shell: #36A0F4;
    --snail-shell-deep: #1876b5;
    --snail-shell-hover: #146494;
    --snail-blush: #bdc1c6;
    --snail-cream: #e8f0fe;
    --snail-cream-light: #f6fafe;
    --edit-btn-bg: #a8d4f0;
    --edit-btn-hover: #8fc9ed;
    --edit-btn-text: #174ea6;
    --view-btn-bg: var(--edit-btn-bg);
    --view-btn-hover: var(--edit-btn-hover);
    --view-btn-text: var(--edit-btn-text);
    --app-hover: #f0f0f0;
    --app-active: #D7DBEF;
    --accent-bar: #36A0F4;
    --edit-focus-ring: #1876b5;
}

/* Dark theme — layered greys (VS Code style depth), never pure black */
html[data-theme="dark"] {
    color-scheme: dark;

    --dk-0: #141414;   /* window / gutter, deepest layer */
    --dk-1: #1b1b1b;   /* header, system folder bar */
    --dk-2: #202020;   /* pane surfaces (tree, subtopics) */
    --dk-3: #262626;   /* document page, editor */
    --dk-4: #2d2d2d;   /* dropdowns, dialogs, inputs */
    --dk-5: #353535;   /* hover */
    --dk-6: #3f3f3f;   /* selected row */
    --dk-line: #303030;
    --dk-line-strong: #474747;
    --dk-text: #cfcfcf;
    --dk-text-bright: #f2f2f2;
    --dk-text-dim: #9a9a9a;
    --dk-accent: #d9a066;
    --dk-btn: #0e639c;
    --dk-btn-hover: #1177bb;

    --snail-brown: var(--dk-text);
    --snail-red: var(--dk-accent);
    --snail-gold: #4a3f33;
    --snail-gold-hover: #57493a;
    --snail-shell: var(--dk-accent);
    --snail-shell-deep: #e0b183;
    --snail-shell-hover: #ecc39a;
    --snail-blush: var(--dk-line-strong);
    --snail-cream: var(--dk-4);
    --snail-cream-light: var(--dk-3);
    --md-sys-color-surface: var(--dk-0);
    --md-sys-color-on-surface: var(--dk-text);
    --md-sys-color-primary: #7cb7f0;
    --md-sys-color-outline: var(--dk-line-strong);
    --edit-btn-bg: var(--dk-btn);
    --edit-btn-hover: var(--dk-btn-hover);
    --edit-btn-text: #ffffff;
    --view-btn-bg: var(--edit-btn-bg);
    --view-btn-hover: var(--edit-btn-hover);
    --view-btn-text: var(--edit-btn-text);
    --app-hover: var(--dk-5);
    --app-active: var(--dk-6);
    --accent-bar: var(--dk-line-strong);
    --edit-focus-ring: #3794ff;
    --icon-fg: var(--dk-text-bright);
    --overlay-bg: var(--dk-0);
    --popover-bg: var(--dk-4);
    --popover-text: var(--dk-text-bright);
    --input-bg: var(--dk-3);
    --input-text: var(--dk-text-bright);
    --avatar-bg: var(--dk-accent);
    --avatar-fg: #1b1b1b;
    --list-row-bg: var(--dk-2);
}

body {
    font-family: var(--active-font-family);
    line-height: var(--active-line-height);
    color: var(--md-sys-color-on-surface);
    font-size: var(--text-size-body);
    background-color: var(--md-sys-color-surface);
}

/* Gradient text utility class */
.aura {
    -webkit-text-fill-color: transparent;
    /* background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple)); */
    background: #086dd6;
    -webkit-background-clip: text;
    background-clip: text;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Font Theme Classes */
body.font-theme-font1 {
    --active-font-family: var(--font-family-default);
    --active-line-height: 1.6;
}

body.font-theme-gmail {
    --active-font-family: var(--font-family-gmail);
    --active-line-height: 1.5;
}

body.font-theme-gemini {
    --active-font-family: var(--font-family-gemini);
    --active-line-height: 1.5;
}

body.font-theme-gemini * {
    font-weight: var(--gemini-font-weight-regular);
    font-optical-sizing: var(--gemini-font-opsz);
}

body.font-theme-google {
    --active-font-family: var(--font-family-google);
    --active-line-height: 1.5;
}

body.font-theme-uisans {
    --active-font-family: var(--font-family-uisans);
    --active-line-height: 1.5;
    color: #2c2c2b;
    font-size: 16px;
}

body.font-theme-cascadiacode {
    --active-font-family: var(--font-family-cascadiacode);
    --active-line-height: 1.6;
}

/* Login Page */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #E5EDFF;
}

.login-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
}

.login-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container h1 {
    margin: 0;
    font-size: 1.125rem;
    color: #2c3e50;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="text"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-group select,
.form-group .font-select-dropdown {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #999;
    border-radius: 4px;
    font-size: 0.875rem;
    background: #f5f5f5;
    color: #2c3e50;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.form-group select:hover,
.form-group .font-select-dropdown:hover {
    background: #e8e8e8;
}

.form-group select:focus,
.form-group .font-select-dropdown:focus {
    outline: none;
    background: #e8e8e8;
    border-color: #0B57D0;
}

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

.login-container button {
    width: 100%;
    padding: 0.75rem;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 9999px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
}

.login-container button:hover {
    background: #2980b9;
}

/* App Page */
.app-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background-color: #EEEEEE;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 2rem 8px 1rem;
    background: #eeeeee;
    color: #2c3e50;
}

.theme-menu-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    margin-right: 4px;
}

.theme-menu-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--icon-fg);
    border-radius: 50%;
    transition: background-color 0.2s;
}

.theme-menu-btn:hover {
    background-color: #E0E0E0;
}

.theme-menu-btn svg {
    width: 18px;
    height: 18px;
}

.theme-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 168px;
    z-index: 10000;
    flex-direction: column;
    padding: 0.25rem 0;
}

.theme-menu.show {
    display: flex;
}

.theme-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    color: #1f1f1f;
    font-family: inherit;
    font-size: 14px;
    transition: background-color 0.15s;
}

.theme-menu-item:hover {
    background-color: #f5f5f5;
}

.theme-menu-name {
    flex: 1;
}

.theme-menu-dot {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.18);
    box-sizing: border-box;
    background: #dea47a;
}

.theme-menu-dot[data-theme-value="blue"] {
    background: #36A0F4;
}

/* Two-tone dot hints that dark is layered greys, not black */
.theme-menu-dot[data-theme-value="dark"] {
    background: linear-gradient(135deg, #3f3f3f 0%, #3f3f3f 50%, #1b1b1b 50%, #1b1b1b 100%);
}

.theme-menu-check {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    visibility: hidden;
    color: var(--snail-shell-deep);
}

.theme-menu-item[aria-checked="true"] .theme-menu-check {
    visibility: visible;
}

.theme-menu-item[aria-checked="true"] .theme-menu-name {
    font-weight: 600;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Font Selector Dropdowns in Header */
.font-selector-dropdowns {
    display: flex;
    gap: 0.5rem;
    margin-right: 0.5rem;
    align-items: center;
}

.page-margin-wrapper {
    display: flex;
    align-items: center;
    position: relative;
}

.page-margin-icon {
    width: 14px;
    height: 14px;
    color: #666;
    flex-shrink: 0;
    position: absolute;
    left: 0.35rem;
    z-index: 1;
    pointer-events: none;
}

#pageMarginSelect {
    width: 90px !important;
    min-width: 90px !important;
    max-width: 90px !important;
    padding-left: 25px !important;
}

/* Tab space wrapper and icon */
.tab-space-wrapper {
    display: flex;
    align-items: center;
    position: relative;
}

.tab-space-icon {
    width: 14px;
    height: 14px;
    color: #666;
    flex-shrink: 0;
    position: absolute;
    left: 0.35rem;
    z-index: 1;
    pointer-events: none;
}

/* Tab space select styling */
#tabSpaceSelect {
    width: 70px !important;
    min-width: 70px !important;
    max-width: 70px !important;
    padding-left: 1.75rem !important;
}

/* Override font-select-dropdown width for page margin select */
#pageMarginSelect.font-select-dropdown {
    width: 90px !important;
    min-width: 90px !important;
    max-width: 90px !important;
}

.font-select-dropdown {
    padding: 0.35rem 0.75rem;
    border: 1px solid #999;
    border-radius: 4px;
    font-size: 0.875rem;
    background: #f5f5f5;
    color: #2c3e50;
    cursor: pointer;
    min-width: 90px;
    max-width: 90px;
    transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

/* Specifically target the font dropdown in doc header */
#regularFontSelect,
.font-selector-dropdowns .font-select-dropdown {
    min-width: 100px !important;
    max-width: 100px !important;
    width: 100px !important;
}

.font-select-dropdown:hover {
    background: #e8e8e8;
}

.font-select-dropdown:focus {
    outline: none;
    background: #e8e8e8;
}

/* Fonts Tab Layout */
.fonts-tab-layout {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 1rem;
    height: 100%;
    max-height: 400px;
    overflow: hidden;
}

.fonts-list-column {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Create New Font Button */
.create-font-btn {
    background: #45a049;
    color: white;
    border: none;
    padding: 0.625rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(69, 160, 73, 0.2);
    flex-shrink: 0;
    margin-bottom: 0.75rem;
}

.create-font-btn:hover {
    background: #3d8b40;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(69, 160, 73, 0.3);
}

.create-font-btn:active {
    transform: translateY(0);
}

/* Scrollable container for font sections */
.fonts-list-scrollable {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0 1rem 0 0;
    min-height: 0;
}

/* Font Sections */
.font-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.font-section-title {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.fonts-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-height: 0;
}

.font-template-item {
    padding: 0.375rem 0.625rem;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.font-template-item:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.font-template-item.selected {
    border-color: #3b82f6;
    background: #dbeafe;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* System Font Template Styling */
.font-template-item.system {
    background: #f5f5f4;
    border-color: #d6d3d1;
}

.font-template-item.system:hover {
    background: #e7e5e4;
    border-color: #a8a29e;
}

.font-template-item.system.selected {
    background: #e7e5e4;
    border-color: #78716c;
    box-shadow: 0 0 0 3px rgba(120, 113, 108, 0.1);
}

.font-template-name {
    font-weight: 500;
    color: #1f2937;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.font-template-item.system .font-template-name {
    color: #57534e;
}

.font-maker-column {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Font Editor Header */
.font-editor-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e5e7eb;
}

.font-editor-header h4 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
}

.system-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    background: #78716c;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.font-maker-column h3 {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

.font-maker-form {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    min-height: 0; /* Allow flex shrinking */
    gap: 0.75rem;
    padding: 0 1rem 0 0;
}

.font-maker-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.font-maker-row label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.font-maker-row input[type="text"],
.font-maker-row select.font-base-select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.875rem;
    font-family: monospace;
    transition: border-color 0.2s;
}

.font-maker-row input[type="text"]:focus,
.font-maker-row select.font-base-select:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
}

.font-maker-row input[type="text"]:disabled,
.font-maker-row select.font-base-select:disabled {
    background: #f3f4f6;
    color: #374151;
    cursor: not-allowed;
}

.font-maker-row input[type="checkbox"] {
    margin-right: 0.5rem;
}

.font-maker-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid #eee;
}

.save-template-btn,
.reset-template-btn,
.duplicate-template-btn,
.delete-template-btn {
    flex: 1;
    min-width: 120px;
    padding: 0.5rem;
    border: none;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.save-template-btn {
    background-color: #1A73E8;
    color: white;
}

.save-template-btn:hover {
    background-color: #1557b0;
}

.duplicate-template-btn {
    background-color: #3b82f6;
    color: white;
}

.duplicate-template-btn:hover {
    background-color: #2563eb;
}

.delete-template-btn {
    background-color: #ef4444;
    color: white;
}

.delete-template-btn:hover {
    background-color: #dc2626;
}

.reset-template-btn {
    background-color: #f5f5f5;
    color: #666;
}

.reset-template-btn:hover {
    background-color: #e0e0e0;
}

/* Font Context Menu */
.font-context-menu {
    position: fixed;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    min-width: 120px;
    padding: 0.2rem 0;
}

.font-context-menu .context-menu-item {
    display: block;
    width: 100%;
    padding: 0.35rem 1rem;
    border: none;
    background: transparent;
    text-align: left;
    font-size: 0.875rem;
    color: #2c3e50;
    cursor: pointer;
    transition: background-color 0.2s;
}

.context-menu-item:hover {
    background-color: #f5f5f5;
}

.context-menu-item:disabled {
    color: #999;
    cursor: not-allowed;
}

.header-search-wrapper {
    position: relative;
    display: inline-block;
    margin-left: 20px;
}

.header-search {
    padding: 0.58rem 2.25rem 0.58rem 3rem;
    border: 1px solid #D5D5D5;
    border-radius: 20px;
    font-size: 1rem;
    font-family: 'Google Sans', Arial, sans-serif;
    width: 370px;
    max-width: 400px;
    background: #D5D5D5;
    color: #2c3e50;
}

.header-search:focus {
    outline: none;
    background: white;
    border: 1px solid #D5D5D5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    padding: 0.58rem 2.25rem 0.58rem 3rem;
}

.header-search::placeholder {
    color: #999;
}

.clear-search-btn {
    position: absolute;
    right: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.clear-search-btn:hover {
    background-color: #d0d0d0;
}

.clear-search-btn svg {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    min-height: 18px !important;
    fill: #4A4A4A !important;
    filter: none !important;
    opacity: 1 !important;
}

.clear-search-btn svg path {
    fill: #4A4A4A !important;
    stroke: none !important;
}

.clear-search-btn:hover svg {
    fill: #4A4A4A !important;
    opacity: 1 !important;
}

.clear-search-btn:hover svg path {
    fill: #4A4A4A !important;
}

.pending-sync-indicator {
    position: absolute;
    right: 1.75rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: #ff6b6b;
    cursor: help;
    z-index: 10;
}

.pending-sync-indicator svg {
    width: 20px;
    height: 20px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.pending-sync-indicator:hover svg {
    opacity: 1;
}

.search-icon-btn {
    position: absolute;
    left: 0.3rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: background-color 0.15s ease;
}

.search-icon-btn:hover {
    background-color: #c8c8c8;
}

.search-icon-btn svg {
    width: 20px;
    height: 20px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo img {
    width: 2rem;
    height: 2rem;
    object-fit: contain;
}

.logo .app-mark {
    width: 46px;
    height: 46px;
    margin-right: 0.25rem;
    flex-shrink: 0;
    display: block;
    object-fit: contain;
}

.logo .app-mark .mark-shadow {
    fill: var(--mark-ink);
    opacity: 0.15;
}

.logo .app-mark .mark-ink {
    fill: var(--mark-ink);
}

.logo .app-mark .mark-body {
    fill: var(--mark-body);
}

.logo .app-mark .mark-body-hi {
    fill: var(--mark-body-hi);
}

.logo .app-mark .mark-line {
    fill: none;
    stroke: var(--mark-ink);
    stroke-linecap: round;
    stroke-linejoin: round;
}

.logo .app-mark .mark-eye {
    fill: var(--mark-eye);
    stroke: var(--mark-ink);
    stroke-linecap: round;
    stroke-linejoin: round;
}

.logo .app-mark .mark-shell {
    fill: var(--mark-shell);
}

.logo .app-mark .mark-shell-hi {
    fill: var(--mark-shell-hi);
}

.app-title,
.app-header h1.app-title {
    font-size: 1.4rem;
    margin: 0;
    line-height: 1;
    font-weight: 500;
    font-family: Outfit, sans-serif;
    font-style: normal;
    color: #111827;
    letter-spacing: -0.03em;
}

.brand-lockup {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1;
}

.brand-lockup .brand-name {
    font-family: Outfit, sans-serif;
    font-size: 1.5rem;
    font-weight: 500;
    letter-spacing: -0.03em;
    color: #111827;
}

.brand-lockup .brand-sub {
    font-family: Outfit, sans-serif;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    color: #64748b;
    margin-top: 3px;
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.archive-btn {
    background: white;
    color: #333;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 0;
    cursor: pointer;
    font-size: 0.9rem;
    width: 100%;
    text-align: left;
    transition: background 0.2s;
    display: block;
}

.archive-btn:hover {
    background: #f5f5f5;
    color: #333;
}

.settings-icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--icon-fg);
    margin-left: 0.35rem;
    border-radius: 50%;
    transition: background-color 0.2s;
    overflow: hidden;
}

.settings-icon-btn:hover {
    background-color: #E0E0E0;
}

.settings-icon-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.admin-icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--icon-fg);
    border-radius: 50%;
    transition: all 0.2s ease;
    margin-right: 0.5rem;
}

.admin-icon-btn:hover {
    background-color: #E0E0E0;
    transform: scale(1.05);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
}

.admin-icon-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

/* Archive button hidden on desktop - now in profile dropdown */
.archive-icon-btn.desktop-only {
    display: none !important;
}

.archive-icon-btn {
    background: #e0e0e0;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--icon-fg);
    margin-left: 0.35rem;
    border-radius: 50%;
    transition: transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

.archive-icon-btn:hover {
    background-color: #c4c4c4;
    transform: scale(1.05);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
}

.archive-icon-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

.help-icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--icon-fg);
    margin-left: 0.35rem;
    border-radius: 50%;
    transition: background-color 0.2s;
    overflow: hidden;
}

.help-icon-btn:hover {
    background-color: #E0E0E0;
}

.help-icon-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.report-issue-icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--icon-fg);
    margin-left: 0.35rem;
    border-radius: 50%;
    transition: background-color 0.2s;
    overflow: hidden;
}

.report-issue-icon-btn:hover {
    background-color: #E0E0E0;
}

.report-issue-icon-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

/* Google / account avatar — same 2rem hit target as other header icons, smaller disc */
.user-profile-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--icon-fg);
    margin-left: 0.35rem;
    border-radius: 50%;
    position: relative;
    z-index: 1;
    overflow: hidden;
    transition: background-color 0.2s;
}

.user-profile-btn:hover {
    background-color: #E0E0E0;
}

.user-profile-btn .profile-picture {
    width: 22px;
    height: 22px;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.user-profile-btn .profile-initials {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--avatar-fg);
    background: var(--avatar-bg);
}

/* Sign out button hidden on desktop - now in profile dropdown */
.signoff-icon-btn.desktop-only {
    display: none !important;
}

.signoff-icon-btn {
    background: #e0e0e0;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--icon-fg);
    margin-left: 0.35rem;
    border-radius: 50%;
    position: relative;
    z-index: 1;
    transition: transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

.signoff-icon-btn:hover {
    background-color: #c4c4c4;
    transform: scale(1.05);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
}

.signoff-icon-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
}

.user-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    overflow: hidden;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-icon-btn:hover {
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.3);
}

.user-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 150px;
    z-index: 1000;
    overflow: hidden;
    animation: fadeInDown 0.2s ease-out;
}

.user-menu.show {
    display: block;
}

.user-menu-item {
    display: block;
    padding: 0.4rem 1rem;
    color: #333;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s;
    text-align: left;
}

.user-menu-item:hover {
    background: #f5f5f5;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* App Container */
.app-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    padding-left: 10px;
    position: relative;
    background-color: #eeeeee;
}

/* Left gutter: #eeeeee strip straight down, aligned with row 2 and panels */
.app-container::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 10px;
    height: 100%;
    background: #eeeeee;
    pointer-events: none;
    z-index: 0;
}

/* Accent line under row 2 (toolbar), starts flush with white pane-headers and panel 1 (after 10px strip); panels 1–3 sit below */
.app-container::after {
    content: '';
    position: absolute;
    top: calc(3.5rem - 2px);
    left: 10px;
    width: calc(100% - 10px);
    height: 5px;
    background: var(--accent-bar);
    pointer-events: none;
    z-index: 1;
}

/* Panes */
.pane {
    display: flex;
    flex-direction: column;
    border-right: 1px solid #d3d3d3;
    overflow: hidden;
}

/* Reduce border width to minimize spacing between panes */
.left-pane {
    border-right: 1px solid #d3d3d3;
    transition: width 0.2s ease-out, min-width 0.2s ease-out;
    container-type: inline-size;
    container-name: left-pane;
}

@container left-pane (max-width: 215px) {
    .actions-btn-label {
        display: none;
    }
}

.left-pane .pane-header {
    transition: opacity 0.1s ease-out;
}

.middle-pane {
    border-right: 1px solid #d3d3d3;
    box-shadow: none; /* Removed right shadow */
    transition: width 0.2s ease-out, min-width 0.2s ease-out;
    overflow: hidden;
    opacity: 1;
    position: relative;
    z-index: 1;
}

.middle-pane .pane-header {
    transition: opacity 0.1s ease-out;
}

/* Disable transitions during initial load to prevent layout shifts */
.left-pane.no-transition,
.middle-pane.no-transition,
.main-pane.no-transition,
.pane.no-transition,
.app-container.no-transition .left-pane,
.app-container.no-transition .middle-pane,
.app-container.no-transition .main-pane,
.app-container.no-transition .pane {
    transition: none !important;
}

.middle-pane.hiding {
    width: 0 !important;
    min-width: 0 !important;
    opacity: 0;
    margin: 0;
    padding: 0;
    border: none;
    box-shadow: none;
}

.pane:last-child {
    border-right: none;
}

.pane-header {
    padding: 8px 1rem;
    background: white;
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 2px 2px 0 0;
}

/* Topic header (left pane) */
.left-pane .pane-header {
    min-height: 3.5rem;
    padding-left: 0.25rem;
    padding-right: 0.5rem;
    border-radius: 12px 0 0 0;
    overflow: visible;
}

/* Sub-topic header (middle pane) */
.middle-pane .pane-header {
    min-height: 3.5rem;
    border-radius: 2px 0 0 0;
}

/* Docs header (main pane) */
.main-pane .pane-header {
    min-height: 3.5rem;
    justify-content: flex-start;
    padding-left: 3px;
}

.header-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

.header-buttons-left {
    display: flex;
    gap: 0;
    align-items: center;
    flex-wrap: nowrap;
    overflow: visible;
}

/* Microsoft Word style toolbar groups */
.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.125rem;
    padding-right: 0.5rem;
    border-right: 1px solid #d0d0d0;
    position: relative;
    overflow: visible;
}

.toolbar-group:last-child {
    border-right: none;
    padding-right: 0;
    margin-left: auto;
    overflow: visible;
}

/* Remove border from new toolbar groups - they use dividers instead */
.new-toolbar {
    border-right: none !important;
    padding-right: 0 !important;
}

/* Bullet List Dropdown */
.bullet-list-wrapper {
    position: relative;
    display: inline-block;
    margin-right: 2px;
}

.bullet-list-btn {
    display: flex;
    align-items: center;
    gap: 0;
    width: auto;
    min-width: 40px;
    padding: 0 4px !important;
}

.bullet-list-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0.25rem 0;
    z-index: 10000;
    min-width: 180px;
    flex-direction: column;
}

.bullet-list-dropdown.show {
    display: flex !important;
}

.bullet-list-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 8px 0.4rem 1rem;
    border: none;
    background: transparent;
    color: #333;
    font-size: 0.875rem;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: background-color 0.15s ease;
}

.bullet-list-item:hover {
    background: #f5f5f5;
}

.bullet-list-item span {
    color: #333;
}

.bullet-list-icon-slot {
    width: 26px;
    min-width: 26px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
}

.bullet-list-item[data-action="header"] .bullet-list-icon-slot {
    font-weight: 600;
}

.bullet-list-item-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: inherit;
    stroke: currentColor;
}

/* Format style: split Bold + caret (Italic / Underline / Strikethrough) */
.format-style-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-right: 2px;
}

.format-style-btn,
.math-btn {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0 4px !important;
}

.format-style-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0.25rem 0;
    z-index: 10000;
    min-width: 180px;
    flex-direction: column;
}

.format-style-dropdown.show {
    display: flex !important;
}

.format-style-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 8px 0.4rem 1rem;
    border: none;
    background: transparent;
    color: #333;
    font-size: 0.875rem;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: background-color 0.15s ease;
}

.format-style-item:hover {
    background: #f5f5f5;
}

.format-style-dropdown-divider {
    height: 1px;
    background: #eee;
    margin: 0.25rem 0.5rem;
}

/* Math dropdown: ∑ + Superscript, Subscript, Square root, symbols */
.math-wrapper {
    position: relative;
    display: inline-block;
    margin-right: 2px;
}

.math-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0.25rem 0;
    z-index: 10000;
    min-width: 160px;
    max-height: 70vh;
    overflow-y: auto;
    flex-direction: column;
}

.math-dropdown.show {
    display: flex !important;
}

.math-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 8px 0.4rem 1rem;
    border: none;
    background: transparent;
    color: #333;
    font-size: 0.875rem;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: background-color 0.15s ease;
}

.math-item:hover {
    background: #f5f5f5;
}

.math-dropdown-divider {
    height: 1px;
    background: #eee;
    margin: 0.25rem 0.5rem;
}

/* Image dropdown: Image from http, Image from upload */
.image-wrapper {
    position: relative;
    display: inline-block;
    margin-right: 2px;
}

.image-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0.25rem 0;
    z-index: 10000;
    min-width: 160px;
    flex-direction: column;
}

.image-dropdown.show {
    display: flex !important;
}

.image-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 8px 0.4rem 1rem;
    border: none;
    background: transparent;
    color: #333;
    font-size: 0.875rem;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: background-color 0.15s ease;
}

.image-item:hover {
    background: #f5f5f5;
}

/* Highlight dropdown: color swatches */
.highlight-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0.35rem;
    z-index: 10000;
    min-width: 140px;
    flex-direction: column;
}

.highlight-dropdown.show {
    display: flex !important;
}

.highlight-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 8px 0.35rem 0.5rem;
    border: none;
    background: transparent;
    color: #333;
    font-size: 0.875rem;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: background-color 0.15s ease;
}

.highlight-item:hover {
    background: #f5f5f5;
}

.highlight-swatch {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.15);
    flex-shrink: 0;
}

/* Table picker: grid to choose columns × rows, header checkbox */
.table-picker {
    display: none;
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0.5rem;
    z-index: 10000;
    flex-direction: column;
    gap: 0.35rem;
}
.table-picker.show {
    display: flex !important;
}
.table-picker-header-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    font-size: 0.8125rem;
    color: #333;
    cursor: pointer;
    user-select: none;
}
.table-picker-header-row input { margin: 0; }
.table-picker-grid {
    display: grid;
    grid-template-columns: repeat(10, 17px);
    grid-template-rows: repeat(5, 17px);
    gap: 1px;
}
.table-picker-cell {
    width: 17px;
    height: 17px;
    border: 1px solid #ccc;
    border-radius: 2px;
    background: #e0e0e0; /* grey: buffer/unselected */
    pointer-events: auto;
}
.table-picker-cell.selected {
    background: #b3e5fc; /* blue: body / all when no header */
}
.table-picker-cell.selected.header {
    background: #FFF59D; /* yellow: header row when "Header row" checked */
}
.table-picker-size {
    font-size: 0.75rem;
    color: #666;
}
.table-picker-cancel {
    margin-top: 0.2rem;
    height: 28px;
    padding: 0 0.75rem;
    font-size: 0.75rem;
    border: 1px solid var(--snail-blush);
    border-radius: 8px;
    background: #fff;
    color: var(--snail-brown);
    cursor: pointer;
}
.table-picker-cancel:hover {
    background: #eee;
}

.highlight-btn {
    overflow: visible;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background-color: #d0d0d0;
    flex-shrink: 0;
    margin-right: 0.5rem;
}

.header-buttons-right {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    position: relative;
    flex-shrink: 0;
    position: relative;
}

.pane-header h2 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #2c3e50;
}

/* Topics/Search Tabs — underline icons, no track */
.topics-tabs {
    display: flex;
    align-items: center;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    gap: 2px;
}

.topics-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 4px 8px 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b6560;
    cursor: pointer;
    transition: color 0.15s ease;
    margin-bottom: 0;
    position: relative;
}

.topics-tab.active {
    background: transparent !important;
    color: var(--snail-brown) !important;
    font-weight: 500;
    border-radius: 0;
    padding: 4px 8px 6px;
}

.topics-tab.active::after {
    content: '';
    display: block;
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 0;
    height: 2px;
    border-radius: 1px;
    background: var(--snail-red);
}

.topics-tab:hover {
    background: transparent;
    color: var(--snail-brown);
    opacity: 1;
}

.topics-tab-home-icon {
    width: 0.95rem;
    height: 0.95rem;
    display: block;
}

.topics-tab-search-icon {
    width: 1.22rem;
    height: 1.22rem;
    display: block;
    stroke: currentColor;
    stroke-width: 2.1;
    stroke-linecap: round;
    stroke-linejoin: round;
    color: #3d3834;
}

.topics-tab.active .topics-tab-search-icon,
.topics-tab:hover .topics-tab-search-icon {
    color: var(--snail-brown);
}

.topics-tab-search-icon .search-result-line-accent {
    stroke: #0b57d0;
}

/* Actions Dropdown */
.actions-dropdown {
    position: relative;
}

/* + Create button */
.actions-btn-wrapper {
    position: relative;
    display: inline-flex;
    margin-right: 0.4rem;
}

.actions-btn {
    background: #fff;
    border: 1px solid #b8b8b8;
    font-size: 0.875rem;
    cursor: pointer;
    padding: 0 8px 0 12px;
    height: 34px;
    border-radius: 8px;
    transition: box-shadow 0.15s ease, background 0.15s ease;
    color: var(--snail-brown);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 2px 5px rgba(0, 0, 0, 0.1);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    white-space: nowrap;
}

.actions-btn-plus {
    line-height: 1;
    flex-shrink: 0;
    font-size: 1rem;
    font-weight: 600;
}

.actions-btn-label {
    flex-shrink: 1;
    font-size: 0.875rem;
    font-weight: 500;
    overflow: hidden;
}

.actions-btn-caret {
    flex-shrink: 0;
    margin-left: 2px;
    opacity: 0.95;
}

.actions-btn:hover {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14), 0 3px 8px rgba(0, 0, 0, 0.16);
}

.actions-btn:active {
    background: #f7f7f7;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* Dropdown: match format-style-dropdown, math-dropdown, bullet-list-dropdown */
.create-dropdown {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    background: #eeeeee;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 4px;
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.08),
        0 8px 24px rgba(0, 0, 0, 0.16);
    padding: 0.25rem 0;
    z-index: 10000;
    min-width: 160px;
    width: max-content;
    max-width: 200px;
    flex-direction: column;
}

.create-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.4rem 8px 0.4rem 1rem;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    font-size: 0.875rem;
    color: #333;
    transition: background-color 0.15s ease;
}

.create-dropdown .dropdown-item:hover {
    background: #e0e0e0;
}

.create-dropdown .dropdown-item:first-child {
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

.create-dropdown .dropdown-item:last-child {
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}


/* Icon slot for create dropdown items (match bullet-list-icon-slot) */
.create-dropdown-icon-slot {
    width: 26px;
    min-width: 26px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
}

.create-dropdown-item-icon {
    flex-shrink: 0;
    color: var(--snail-brown);
}

/* Folder tree items - same font and padding as .topic-item for unified list */
.folder-tree-item {
    display: flex;
    align-items: center;
    padding: 2px 12px 2px 8px;
    margin-bottom: 0.0625rem;
    font-family: var(--active-font-family);
    font-size: 14px;
    font-weight: 500;
    color: #1f1f1f;
    line-height: 1.75rem;
    letter-spacing: 0;
    cursor: pointer;
    position: relative;
    background: white;
    border: none;
    border-radius: 0;
    transition: background 0.3s, border-radius 0.3s;
    overflow: hidden;
}

/* Indent: +20px per level so subfolder +/- aligns with parent's folder icon (20px slot) */
.folder-tree-item.indent-1 { padding-left: 28px; }
.folder-tree-item.indent-2 { padding-left: 48px; }
.folder-tree-item.indent-3 { padding-left: 68px; }

.topic-item.indent-1 { padding-left: 28px; }
.topic-item.indent-2 { padding-left: 48px; }
.topic-item.indent-3 { padding-left: 68px; }

.folder-tree-item:hover {
    background: #f0f0f0;
}

/* +/- slot: 20px so folder icon and doc icon align. Same width for expand or spacer. */
.folder-expand-icon {
    width: 16px;
    height: 16px;
    margin-right: 4px;
    flex-shrink: 0;
    cursor: pointer;
    /* Ensure expand receives clicks (e.g. if a parent ever uses pointer-events) */
    pointer-events: auto;
}

/* Same effective width as .folder-expand-icon (16px + 4px margin) so icons/text align */
.folder-expand-spacer {
    flex: 0 0 20px;
}

.folder-icon {
    width: 18px;
    height: 18px;
    margin-right: 6px;
    flex-shrink: 0;
    display: block; /* avoid inline SVG extra space so trash aligns with folder/draft */
    color: #FFC107;
}

.folder-tree-item-trash > .folder-icon,
.folder-tree-item-shared > .folder-icon {
    color: #1a1a1a;
}

/* Shared topic icon (message/shield) in Shared folder - same size as .doc-icon for alignment */
.topic-item .shared-topic-icon {
    width: 18px;
    height: 18px;
    margin-right: 6px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.topic-item .shared-topic-icon svg {
    width: 100%;
    height: 100%;
}

/* Document icon for topic/documents list - same size and spacing as .folder-icon for alignment */
.topic-item .doc-icon {
    width: 18px;
    height: 18px;
    margin-right: 6px;
    flex-shrink: 0;
    display: block;
}

/* Default doc icon (overrides inline SVG attributes so sticky/shared can override) */
.topic-item .doc-icon rect {
    fill: #fff !important;
    stroke: #555 !important;
}
.topic-item .doc-icon line {
    stroke: #555 !important;
}

/* Sticky: yellow doc icon – designate sticky (Y5 Cream) */
.topic-item.sticky-topic .doc-icon rect {
    fill: #FFECB3 !important;
    stroke: #FF8F00 !important;
}
.topic-item.sticky-topic .doc-icon line {
    stroke: #FF8F00 !important;
}

/* Shared: blue doc icon – designate shared doc (B2 Light) */
.topic-item.shared-topic:not(.admin-shared-topic) .doc-icon rect {
    fill: #BBDEFB !important;
    stroke: #0D47A1 !important;
}
.topic-item.shared-topic:not(.admin-shared-topic) .doc-icon line {
    stroke: #0D47A1 !important;
}

/* Admin-shared: purple doc icon (replaces left bar) */
.topic-item.shared-topic.admin-shared-topic .doc-icon rect {
    fill: #9C27B0 !important;
    stroke: #7B1FA2 !important;
}
.topic-item.shared-topic.admin-shared-topic .doc-icon line {
    stroke: #7B1FA2 !important;
}

.folder-name {
    flex: 1;
    min-width: 0; /* Allow flex item to shrink so ellipsis follows available panel width */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-item-count {
    color: #888;
    font-size: 0.9em;
}

.folder-tree-item.selected {
    background: #D7DBEF;
}

.folder-tree-item.draggable {
    cursor: default;
    position: relative;
}

/* No padding-right on .folder-name: drag-handle is in flex flow, so no "… + white space" gap */

.folder-tree-item.draggable .drag-handle {
    flex-shrink: 0;
    min-width: 1rem;
    padding: 0 4px;
    font-size: 0.7rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    cursor: grab;
    color: #888;
    user-select: none;
}
.folder-tree-item.draggable:hover .drag-handle {
    opacity: 1;
    pointer-events: auto;
}

.folder-tree-item.draggable.dragging {
    opacity: 0.5;
}

/* Line above: insert-before (folder reorder among siblings) */
.folder-tree-item.drag-over {
    border-top: 2px solid #0B57D0;
}

/* Highlight whole row: drop document inside this folder */
.folder-tree-item.drag-over-inside {
    background: rgba(11, 87, 208, 0.1);
    box-shadow: inset 0 0 0 2px #0B57D0;
    border-radius: 4px;
}

.toggle-subtopics-btn {
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 8px;
    transition: all 0.1s;
    color: #333;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: calc(0.15rem + 1px);
    padding-bottom: calc(0.2rem + 1px);
}

.toggle-subtopics-btn svg {
    width: 14px;
    height: 18px;
    transform: translateY(1px);
    stroke: #333;
}

.toggle-subtopics-btn:hover {
    background: #e1e1e1;
    border-color: #b8b8b8;
}

.toggle-subtopics-btn.active {
    background: transparent;
    border-color: transparent;
    color: #333;
}

.toggle-subtopics-btn.active:hover {
    background: #e1e1e1;
    border-color: #b8b8b8;
}

.toggle-subtopics-btn.active svg {
    stroke: #333;
}

/* Hamburger menu button (YouTube style) */
.hamburger-menu-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    margin-right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
    color: #030303;
}

.hamburger-menu-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.hamburger-menu-btn:active {
    background: rgba(0, 0, 0, 0.1);
}

/* Doc icon buttons (same style as actions-btn) */
.doc-icon-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 9999px;
    transition: background 0.3s;
    color: #555;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.doc-icon-btn:hover:not(:disabled) {
    background: #e9ecef;
}

.doc-icon-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.doc-icon-btn.active {
    background: #d0d7de;
}

.actions-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.25rem;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 160px;
    z-index: 1000;
    overflow: hidden;
}

.actions-menu.show {
    display: block;
}

.action-item {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: white;
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
    color: #333;
    transition: background 0.2s;
}

.action-item:hover {
    background: #f5f5f5;
}

.action-item:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.action-item:last-child {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.edit-btn {
    padding: 0.35rem 1.25rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: 'Google Sans', Arial, sans-serif;
    font-size: 12px;
    font-weight: 500;
    line-height: 20px;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
    color: #001d35;
    display: flex;
    align-items: center;
    justify-content: center;
}

.images-btn,
.mono-btn,
/* New Toolbar Format Buttons */
.new-toolbar .format-btn {
    padding: 0;
    border: 1px solid transparent !important;
    border-radius: 4px;
    font-family: 'Google Sans', Arial, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: #333;
    transition: background-color 0.15s ease;
    background: transparent;
    cursor: pointer;
    position: relative;
    box-shadow: none !important;
}

.new-toolbar .format-btn.bullet-list-btn,
.new-toolbar .format-btn.code-insert-btn {
    width: auto;
    min-width: 40px;
    padding: 0 1px 0 4px !important;
}

.new-toolbar .format-btn.format-style-btn {
    width: 28px;
    min-width: 28px;
    border-radius: 4px 0 0 4px;
}

.new-toolbar .format-btn.format-style-caret {
    width: auto;
    min-width: 32px;
    padding: 0 3px 0 4px !important;
    border-radius: 0 4px 4px 0;
    gap: 1px;
}

.new-toolbar .format-style-aa {
    font-family: Arial, sans-serif;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
}

.new-toolbar .format-btn.math-btn {
    width: auto;
    min-width: 40px;
}

.new-toolbar .format-btn:hover:not(:disabled) {
    background: #f0f0f0;
    box-shadow: none;
    border-color: transparent !important;
}

.new-toolbar .format-btn:active:not(:disabled) {
    background: #e0e0e0;
    box-shadow: none;
    border-color: transparent !important;
}

.new-toolbar .format-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: transparent !important;
}

.new-toolbar .format-btn > svg:not(.toolbar-caret) {
    width: 18px;
    height: 18px;
}

.new-toolbar .format-btn:not(.format-style-btn) > svg:not(.toolbar-caret) {
    stroke: currentColor;
    stroke-width: 2;
}

.new-toolbar .format-btn.format-style-btn svg {
    width: 19px;
    height: 19px;
}

.new-toolbar .format-btn .toolbar-caret,
.new-toolbar .format-btn.format-style-caret svg {
    width: 10px;
    height: 10px;
    stroke: currentColor;
    stroke-width: 2;
}

/* Legacy button styles (kept for compatibility) */
.format-style-btn,
.math-btn,
.url-btn,
.table-btn,
.image-btn,
.emoji-btn,
/* Save and Cancel buttons - match new toolbar style */
.save-btn {
    padding: 0;
    border: 1px solid transparent !important;
    border-radius: 4px;
    font-family: 'Google Sans', Arial, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: #333;
    transition: background-color 0.15s ease;
    background: transparent;
    cursor: pointer;
    position: relative;
    box-shadow: none !important;
}

.cancel-btn {
    padding: 0;
    border: 1px solid transparent !important;
    border-radius: 4px;
    font-family: 'Google Sans', Arial, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: #333;
    transition: background-color 0.15s ease;
    background: transparent;
    cursor: pointer;
    position: relative;
    box-shadow: none !important;
    font-size: 12px;
    font-weight: 500;
}

/* Legacy button styles (kept for compatibility) */
.fullpage-btn,
.unformat-btn,
.header-btn,
.bullet-list-btn {
    padding: 0;
    border: 1px solid transparent;
    border-radius: 0;
    font-family: 'Google Sans', Arial, sans-serif;
    font-size: 12px;
    font-weight: 500;
    line-height: 20px;
    cursor: pointer;
    transition: all 0.1s;
    background: transparent;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
}


.view-btn {
    padding: 0.35rem 1.25rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: 'Google Sans', Arial, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    color: #333;
    transition: all 0.1s;
    background: transparent;
    cursor: pointer;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
    color: #001d35;
    white-space: nowrap;
}

/* Save and Cancel buttons - match new toolbar style */
.save-btn:hover:not(:disabled) {
    background: #f0f0f0;
    box-shadow: none;
    border-color: transparent !important;
}

.cancel-btn:hover:not(:disabled) {
    background: #f0f0f0;
    box-shadow: none;
    border-color: transparent !important;
}

/* Legacy hover styles (kept for compatibility) */
.images-btn:hover,
.edit-btn:hover:not(:disabled),
.mono-btn:hover:not(:disabled),
.format-style-btn:hover:not(:disabled),
.math-btn:hover:not(:disabled),
.url-btn:hover:not(:disabled),
.table-btn:hover:not(:disabled),
.image-btn:hover:not(:disabled),
.emoji-btn:hover:not(:disabled),
.fullpage-btn:hover:not(:disabled),
.unformat-btn:hover:not(:disabled),
.header-btn:hover:not(:disabled),
.bullet-list-btn:hover:not(:disabled) {
    background: #e1e1e1;
    border-color: #b8b8b8;
}

/* Tooltip Styles */
.format-btn[data-tooltip],
.doc-mode-btn[data-tooltip],
.save-btn[data-tooltip],
.cancel-btn[data-tooltip] {
    position: relative;
    overflow: visible;
}

/* Tooltip display - no shadow, clean style */
.format-btn[data-tooltip]:hover::after,
.new-toolbar .format-btn[data-tooltip]:hover::after,
.doc-mode-btn[data-tooltip]:hover::after,
.save-btn[data-tooltip]:hover::after,
.cancel-btn[data-tooltip]:hover::after {
    content: attr(data-tooltip) !important;
    position: absolute !important;
    bottom: calc(100% + 8px) !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background: #333 !important;
    color: white !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    font-size: 0.75rem !important;
    white-space: nowrap !important;
    z-index: 10000 !important;
    pointer-events: none !important;
    box-shadow: none !important;
    border: none !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Tooltip arrow - optional, can be removed if not needed */
.format-btn[data-tooltip]:hover::before,
.new-toolbar .format-btn[data-tooltip]:hover::before,
.doc-mode-btn[data-tooltip]:hover::before,
.save-btn[data-tooltip]:hover::before,
.cancel-btn[data-tooltip]:hover::before {
    content: '' !important;
    position: absolute !important;
    bottom: calc(100% + 4px) !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    border: 4px solid transparent !important;
    border-top-color: #333 !important;
    z-index: 10001 !important;
    pointer-events: none !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Tooltip for truncated folder/doc names - ensure overflow visible on all parent elements */
#fancytree ul.fancytree-container,
#fancytree ul.fancytree-container li,
#fancytree span.fancytree-title,
#fancytree span.fancytree-node,
#fancytree span.fancytree-node.fancytree-active,
#fancytree span.fancytree-node.fancytree-active span.fancytree-title {
    overflow: visible !important;
}

.fancytree-title-text[data-tooltip] {
    position: relative;
    overflow: visible !important;
}

.fancytree-title-text[data-tooltip]:hover::after {
    content: attr(data-tooltip) !important;
    position: absolute !important;
    bottom: calc(100% + 8px) !important;
    left: 0 !important;
    background: #333 !important;
    color: white !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    font-size: 0.75rem !important;
    white-space: nowrap !important;
    z-index: 99999 !important;
    pointer-events: none !important;
    box-shadow: none !important;
    border: none !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.fancytree-title-text[data-tooltip]:hover::before {
    content: '' !important;
    position: absolute !important;
    bottom: calc(100% + 4px) !important;
    left: 8px !important;
    border: 4px solid transparent !important;
    border-top-color: #333 !important;
    z-index: 100000 !important;
    pointer-events: none !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Show tooltip below when item is near top */
.fancytree-title-text.tooltip-below[data-tooltip]:hover::after {
    bottom: auto !important;
    top: calc(100% + 8px) !important;
}

.fancytree-title-text.tooltip-below[data-tooltip]:hover::before {
    bottom: auto !important;
    top: calc(100% + 4px) !important;
    border-top-color: transparent !important;
    border-bottom-color: #333 !important;
}

/* Emoji picker: JS-driven fixed tooltip (not clipped by overflow) */
.emoji-picker-tooltip {
    display: none;
    position: fixed;
    left: 0;
    bottom: 0;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 10050;
    pointer-events: none;
}
.emoji-picker-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #333;
}

.images-btn:active,
.mono-btn:active:not(:disabled),
.format-style-btn:active:not(:disabled),
.math-btn:active:not(:disabled),
.url-btn:active:not(:disabled),
.table-btn:active:not(:disabled),
.highlight-btn:active:not(:disabled),
.image-btn:active:not(:disabled),
.emoji-btn:active:not(:disabled),
/* Save and Cancel buttons - match new toolbar style */
.save-btn:active:not(:disabled) {
    background: #e0e0e0;
    box-shadow: none;
    border-color: transparent !important;
}

.cancel-btn:active:not(:disabled) {
    background: #e0e0e0;
    box-shadow: none;
    border-color: transparent !important;
}

.fullpage-btn:active:not(:disabled),
.unformat-btn:active:not(:disabled),
.header-btn:active:not(:disabled) {
    background: #d0d0d0;
}

.view-btn:hover:not(:disabled) {
    background: #f8f9fa;
}

.view-btn.active {
    background: white;
    color: #001d35;
    border-color: #ddd;
}

.view-btn svg,
.url-btn svg,
.image-btn svg,
.table-btn svg,
.save-btn svg,
.cancel-btn svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

#saveCheckmarkIcon {
    width: 18px !important;
    height: 18px !important;
}
.emoji-btn .emoji-toolbar-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    display: block;
}

.mono-btn svg,
.fullpage-btn svg,
.unformat-btn svg,
.header-btn svg,
.bullet-list-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
}
/* format-style B uses 19px and flex-shrink:0; excluded from 14px above */

.bullet-list-btn svg circle {
    fill: currentColor;
}

.bullet-list-btn svg:last-child {
    width: 10px;
    height: 10px;
    stroke: currentColor !important;
}

.edit-btn.active {
    background: #A3C5FF;
    color: #001d35;
    border-color: #A3C5FF;
}

/* Doc Mode Buttons (View/Edit) */
.doc-mode-buttons-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 0.5rem;
    padding-left: 0.5rem;
}

.doc-mode-btn {
    background: #fff;
    border: 1px solid var(--snail-blush);
    font-size: 0.875rem;
    cursor: pointer;
    padding: 0 1rem;
    border-radius: 8px;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    color: var(--snail-brown);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    font-family: 'Google Sans', Arial, sans-serif;
    font-weight: 500;
    height: 34px;
    min-width: 34px;
}

.doc-mode-btn:hover {
    background: var(--snail-cream-light);
    border-color: var(--snail-shell);
    color: var(--snail-brown);
}

.doc-mode-btn:disabled {
    cursor: not-allowed;
    background: #f8f9fa;
    border-color: #dadce0;
    color: #9aa0a6;
}

.doc-mode-btn.active:not(#editModeBtn) {
    background: var(--snail-cream) !important;
    border-color: var(--snail-shell) !important;
    color: var(--snail-brown) !important;
}

.doc-mode-btn.active:hover:not(#editModeBtn) {
    background: var(--snail-blush) !important;
    border-color: var(--snail-shell-deep) !important;
}

#viewModeBtn.active:not(:disabled) {
    background: var(--view-btn-bg) !important;
    border: none !important;
    border-color: transparent !important;
    color: var(--view-btn-text) !important;
    box-shadow: none !important;
}

#viewModeBtn.active:hover:not(:disabled) {
    background: var(--view-btn-hover) !important;
}

#editModeBtn {
    background: var(--edit-btn-bg);
    border: none;
    border-color: transparent;
    color: var(--edit-btn-text);
    box-shadow: none;
    transition: none;
}

#editModeBtn:hover:not(:disabled) {
    background: var(--edit-btn-hover);
    border: none;
    border-color: transparent;
    color: var(--edit-btn-text);
    box-shadow: none;
}

#editModeBtn.active,
#editModeBtn.active:hover {
    background: var(--edit-btn-bg) !important;
    border: none !important;
    border-color: transparent !important;
    color: var(--edit-btn-text) !important;
    box-shadow: none !important;
}

#viewModeBtn:disabled,
#editModeBtn:disabled {
    background: #f8f9fa !important;
    border: 1px solid #d8d8d8 !important;
    color: #9aa0a6 !important;
    box-shadow: none;
}

#editModeBtn:disabled {
    border: none !important;
    border-color: transparent !important;
}

/* Cloud icon states (Google Docs style) - for autoSaveIcon next to cancel button */
#autoSaveIcon.saving {
    stroke: #1a73e8 !important; /* Google blue */
    animation: pulse 1.5s ease-in-out infinite;
}

#autoSaveIcon.saved {
    stroke: #34a853 !important; /* Google green */
}

#autoSaveIcon.error {
    stroke: #ea4335 !important; /* Google red */
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

.mode-btn-label {
    display: inline;
}

.view-dirty-mark {
    display: none;
    font-weight: 700;
    line-height: 1;
    color: inherit;
}

#viewModeBtn.is-dirty .view-dirty-mark {
    display: inline;
}


.view-btn:disabled,
.save-btn:disabled,
.cancel-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.edit-btn:disabled,
.mono-btn:disabled,
.images-btn:disabled,
.format-style-btn:disabled,
.math-btn:disabled,
.url-btn:disabled,
.table-btn:disabled,
.image-btn:disabled,
.emoji-btn:disabled,
.fullpage-btn:disabled,
.unformat-btn:disabled,
.header-btn:disabled,
.bullet-list-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: transparent !important;
    color: #6c757d;
}

/* Image Gallery Dialog */
.image-gallery-dialog {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90vw;
    max-width: 900px;
    height: 85vh;
    max-height: 85vh;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 1002;
    animation: fadeIn 0.3s ease-out;
    overflow: hidden;
}

.image-gallery-dialog.show {
    display: block;
}

.gallery-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 85vh;
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #ddd;
}

.gallery-header h2 {
    margin: 0;
    color: #2c3e50;
}

.gallery-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Gallery Tabs */
.gallery-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    background: #f8f9fa;
}

.gallery-tab {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    color: #666;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s;
    border-bottom: 2px solid transparent;
}

.gallery-tab:hover {
    background: #e9ecef;
    color: #2c3e50;
}

.gallery-tab.active {
    color: #3498db;
    border-bottom-color: #3498db;
    background: white;
}

.gallery-tab-content {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.close-gallery-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 2rem;
    height: 2rem;
    line-height: 1;
    transition: color 0.3s;
}

.close-gallery-btn:hover {
    color: #333;
}

/* Emoji Picker Dialog */
.emoji-picker-dialog {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1002;
    align-items: center;
    justify-content: center;
}
.emoji-picker-dialog.show {
    display: flex;
}
.emoji-picker-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 640px;
    width: 90%;
    max-height: 70vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.emoji-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e0e0e0;
}
.emoji-picker-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
}
.emoji-picker-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 2rem;
    height: 2rem;
    line-height: 1;
}
.emoji-picker-close:hover {
    color: #333;
}
.emoji-picker-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(44px, 1fr));
    gap: 4px;
    padding: 1rem;
    overflow-y: auto;
    max-height: 50vh;
}
.emoji-picker-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border: none;
    background: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}
.emoji-picker-item:hover {
    background: #f0f0f0;
}
.emoji-picker-item img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.gallery-upload-section {
    padding: 1rem;
    flex: 1;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    min-height: 0;
}

.upload-area {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    background: #f8f9fa;
    transition: all 0.3s;
    cursor: pointer;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-area:hover {
    border-color: #3498db;
    background: #e3f2fd;
}

.upload-area.drag-over {
    border-color: #27ae60;
    background: #d4edda;
    border-style: solid;
}

.upload-area.upload-success {
    border-color: #27ae60;
    background: #d4edda;
    border-style: solid;
}

.upload-message {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 4px;
    font-size: 0.9rem;
    text-align: center;
}

.upload-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.upload-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.upload-content {
    pointer-events: none;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.upload-text {
    margin: 0.5rem 0;
    color: #666;
    font-size: 0.95rem;
}

.upload-text-small {
    margin: 0.25rem 0;
    color: #999;
    font-size: 0.85rem;
}

.upload-btn {
    margin-top: 0.5rem;
    height: 34px;
    padding: 0 1.25rem;
    border: none;
    border-radius: 8px;
    background: var(--edit-btn-bg);
    color: var(--edit-btn-text);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.2s;
    pointer-events: auto;
}

.upload-btn:hover {
    background: var(--edit-btn-hover);
}

.gallery-grid {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    min-height: 0;
}

.gallery-item {
    position: relative;
    cursor: pointer;
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s;
    aspect-ratio: 1;
}

.gallery-item:hover {
    border-color: #3498db;
    transform: scale(1.05);
}

.gallery-item-checkbox {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    width: 1.5rem;
    height: 1.5rem;
    z-index: 10;
    cursor: pointer;
    accent-color: #3498db;
}

.gallery-item.selected {
    border-color: #3498db;
    border-width: 3px;
}

.delete-selected-btn {
    height: 34px;
    padding: 0 1rem;
    border: 1px solid var(--snail-blush);
    border-radius: 8px;
    background: #fff;
    color: var(--snail-red);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.2s, border-color 0.2s;
}

.delete-selected-btn:hover {
    background: var(--snail-cream-light);
    border-color: var(--snail-shell);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-preview {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    overflow-y: auto;
}

.back-to-gallery-btn {
    height: 34px;
    padding: 0 1rem;
    border: 1px solid var(--snail-blush);
    border-radius: 8px;
    background: #fff;
    color: var(--snail-brown);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.2s, border-color 0.2s;
}

.back-to-gallery-btn:hover {
    background: #f8f9fa;
    border-color: #3498db;
}

.preview-image-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
    min-height: 300px;
}

.preview-image-container img {
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.preview-code {
    border-top: 1px solid #ddd;
    padding-top: 1rem;
}

.preview-code label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.code-container {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.code-container code {
    flex: 1;
    padding: 0.75rem;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #2c3e50;
    word-break: break-all;
}

/* Image gallery code buttons - standard blue button style */
.copy-code-btn,
.insert-code-btn {
    height: 34px;
    padding: 0 1rem;
    border: none;
    border-radius: 8px;
    background: var(--edit-btn-bg);
    color: var(--edit-btn-text);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Google Sans', Arial, sans-serif;
    white-space: nowrap;
}

.copy-code-btn:hover:not(:disabled),
.insert-code-btn:hover:not(:disabled) {
    background: var(--edit-btn-hover);
}

.copy-code-btn:active:not(:disabled),
.insert-code-btn:active:not(:disabled) {
    background: #0d47a1;
    border-color: #0d47a1;
}


/* Gallery Pagination */
.gallery-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-top: 1px solid #ddd;
    background: #f8f9fa;
}

.pagination-btn {
    height: 34px;
    padding: 0 1rem;
    border: 1px solid var(--snail-blush);
    border-radius: 8px;
    background: #fff;
    color: var(--snail-brown);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.2s, border-color 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    background: #f8f9fa;
    border-color: #3498db;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

.pane-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.125rem 0.5rem;
    margin-top: 5px;
    background: white;
    border-radius: 0 0 2px 2px;
}


/* Add padding to main pane content to accommodate editor focus outline */
.main-pane .pane-content {
    padding-top: 0;
    padding-bottom: 0;
    padding-left: 0;
    padding-right: 0;
    background: transparent; /* Override white background from base .pane-content */
    box-shadow: none; /* Remove shadow from main pane content */
    display: flex;
    flex-direction: column;
    position: relative;
}

.docs-content-wrapper {
    flex: 1;
    overflow-y: hidden;
    background-color: #f0f0f0; /* Grey background like Word/WordPad */
    padding: 1.5rem 1rem 0 1rem;
    display: flex;
    justify-content: center;
    align-items: stretch;
    position: relative;
}

.main-pane .docs-content-wrapper.no-padding,
.pane-content .docs-content-wrapper.no-padding,
#docsContent .docs-content-wrapper.no-padding,
.docs-content-wrapper.no-padding {
    background-color: transparent !important;
    padding: 0 !important;
    padding-top: 0 !important;
    padding-right: 0 !important;
    padding-bottom: 0 !important;
    padding-left: 0 !important;
}

/* Add more top padding to left and middle panes */
.left-pane .pane-content,
.middle-pane .pane-content {
    padding-top: 0.25rem;
    min-height: 0;
    min-width: 0; /* allow flex child to size to pane width */
    /* do not use contain: layout — it can make the list (and thus text) size too narrow, causing early ellipsis */
}

/* Constrain left-pane list to panel width so folder/doc names truncate at panel edge */
.left-pane .pane-content {
    overflow-x: hidden;
    padding-left: 0.25rem;
}

/* Topic list items */
.topic-item {
    padding: 2px 12px 2px 8px; /* left 8px, same as folder-tree-item; ::before 20px = expand slot */
    margin-bottom: 0.0625rem;
    background: var(--list-row-bg);
    border: none;
    border-radius: 0;
    cursor: pointer;
    transition: background 0.3s, border-radius 0.3s;
    line-height: 1.75rem;
    font-family: 'Google Sans Flex', 'Google Sans', 'Helvetica Neue', sans-serif;
    font-size: 14px;
    color: #1f1f1f;
    font-weight: 500;
    letter-spacing: 0;
    display: flex;
    align-items: center;
    overflow: hidden;
}

/* Lead slot: 20px, same as folder expand/spacer; icon and name align (folder: 8+20; topic: 8+20) */
.topic-item::before {
    content: '';
    display: block;
    width: 20px;
    flex-shrink: 0;
}

.topic-item:hover {
    background: var(--app-hover);
    border-radius: 8px;
}

/* Regular topics - active background (left pane) */
.topic-item.active {
    background: var(--app-active) !important;
    color: var(--snail-brown) !important;
    border: none !important;
    border-radius: 8px !important;
}

/* Sticky topics - yellow active background (doc icon colored via .topic-item.sticky-topic .doc-icon) */
.topic-item.sticky-topic.active {
    background: #FFF9C4 !important; /* Light yellow background */
    color: #2c3e50 !important;
    border: none !important; /* Reset border from .topic-item.active */
    border-radius: 12px !important;
}

/* Shared topics - light blue active background (doc icon colored via .topic-item.shared-topic .doc-icon) */
.topic-item.shared-topic.active {
    background: #E8F0FE !important; /* Light blue background */
    color: #2c3e50 !important;
    border: none !important; /* Reset border from .topic-item.active */
    border-radius: 12px !important;
}

.topic-item.draggable {
    cursor: move;
    position: relative;
    display: flex;
    align-items: center;
}

/* Fancytree active node styling - selected document in panel 1 */
span.fancytree-node.fancytree-active {
    background: var(--app-active) !important;
    border-radius: 8px !important;
}
span.fancytree-node.fancytree-active span.fancytree-title {
    background: transparent !important;
    color: var(--snail-brown) !important;
    border-radius: 0 !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Fancytree hover: row grey is on the node; keep title transparent */
span.fancytree-node:hover span.fancytree-title {
    background: transparent;
    border-radius: 0;
}

/* Active sticky doc: yellow background, no indent (overrides green above) */
#fancytree li.fancytree-active > span.fancytree-node.sticky-doc-node,
#fancytree span.fancytree-node.fancytree-active.sticky-doc-node,
#fancytree span.fancytree-node[data-sticky="true"].fancytree-active {
    background: #FFF9C4 !important;
}
#fancytree li.fancytree-active > span.fancytree-node.sticky-doc-node span.fancytree-title,
#fancytree span.fancytree-node.fancytree-active.sticky-doc-node span.fancytree-title,
#fancytree span.fancytree-node[data-sticky="true"].fancytree-active span.fancytree-title {
    background: #FFF9C4 !important;
    color: #2c3e50 !important;
    border-radius: 0 !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Active shared doc: blue background, no indent (overrides green above) */
#fancytree li.fancytree-active > span.fancytree-node.shared-doc-node,
#fancytree span.fancytree-node.fancytree-active.shared-doc-node,
#fancytree span.fancytree-node[data-shared="true"].fancytree-active {
    background: #E8F0FE !important;
}
#fancytree li.fancytree-active > span.fancytree-node.shared-doc-node span.fancytree-title,
#fancytree span.fancytree-node.fancytree-active.shared-doc-node span.fancytree-title,
#fancytree span.fancytree-node[data-shared="true"].fancytree-active span.fancytree-title {
    background: #E8F0FE !important;
    color: #2c3e50 !important;
    border-radius: 0 !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Active admin-shared doc: purple tint, no indent (overrides green above) */
#fancytree li.fancytree-active > span.fancytree-node.admin-shared-doc-node,
#fancytree span.fancytree-node.fancytree-active.admin-shared-doc-node {
    background: #F3E5F5 !important;
}
#fancytree li.fancytree-active > span.fancytree-node.admin-shared-doc-node span.fancytree-title,
#fancytree span.fancytree-node.fancytree-active.admin-shared-doc-node span.fancytree-title {
    background: #F3E5F5 !important;
    color: #2c3e50 !important;
    border-radius: 0 !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Active sticky/shared/admin doc: keep doc icon colored (override Fancytree active icon styling) */
#fancytree li.fancytree-active > span.fancytree-node.sticky-doc-node .doc-icon rect,
#fancytree span.fancytree-node.fancytree-active.sticky-doc-node .doc-icon rect {
    fill: #FFECB3 !important;
    stroke: #FF8F00 !important;
}
#fancytree li.fancytree-active > span.fancytree-node.sticky-doc-node .doc-icon line,
#fancytree span.fancytree-node.fancytree-active.sticky-doc-node .doc-icon line {
    stroke: #FF8F00 !important;
}
#fancytree li.fancytree-active > span.fancytree-node.shared-doc-node .doc-icon rect,
#fancytree span.fancytree-node.fancytree-active.shared-doc-node .doc-icon rect {
    fill: #BBDEFB !important;
    stroke: #0D47A1 !important;
}
#fancytree li.fancytree-active > span.fancytree-node.shared-doc-node .doc-icon line,
#fancytree span.fancytree-node.fancytree-active.shared-doc-node .doc-icon line {
    stroke: #0D47A1 !important;
}
#fancytree li.fancytree-active > span.fancytree-node.admin-shared-doc-node .doc-icon rect,
#fancytree span.fancytree-node.fancytree-active.admin-shared-doc-node .doc-icon rect {
    fill: #E1BEE7 !important;
    stroke: #7B1FA2 !important;
}
#fancytree li.fancytree-active > span.fancytree-node.admin-shared-doc-node .doc-icon line,
#fancytree span.fancytree-node.fancytree-active.admin-shared-doc-node .doc-icon line {
    stroke: #7B1FA2 !important;
}

/* Hover sticky/shared: no indent (overrides default hover above) */
#fancytree span.fancytree-node.sticky-doc-node:hover span.fancytree-title,
#fancytree span.fancytree-node.shared-doc-node:hover span.fancytree-title,
#fancytree span.fancytree-node.admin-shared-doc-node:hover span.fancytree-title {
    margin-left: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    border-radius: 0 !important;
}

.topic-item-text {
    flex: 1;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0; /* Required for flex items to allow shrinking */
}

.topic-item.renaming {
    cursor: default;
}

.topic-rename-input {
    flex: 1;
    min-width: 0;
    margin: 0 4px 0 0;
    padding: 0 6px;
    height: 1.5rem;
    border: 1px solid #1a73e8;
    border-radius: 2px;
    background: #fff;
    color: #1f1f1f;
    font: inherit;
    line-height: 1.5rem;
    outline: none;
}

.sticky-star {
    flex-shrink: 0; /* Prevent star from shrinking */
    margin-right: 0.25rem;
}

.topic-item.draggable .topic-item-text {
    flex: 1;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0; /* Required for flex items to allow shrinking */
    /* No padding-right: drag-handle is in flex flow, so no "… + white space" gap */
}

.topic-item.draggable .drag-handle {
    flex-shrink: 0;
    min-width: 1rem;
    padding: 0 4px;
    font-size: 0.7rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    color: #000;
    cursor: grab;
    user-select: none;
}
.topic-item.draggable:hover .drag-handle {
    opacity: 1;
    pointer-events: auto;
}

/* Mobile menu icon (3 dots) for topic context menu */
.topic-mobile-menu-icon {
    display: none; /* Hidden by default (desktop) */
    flex-shrink: 0;
    background: transparent;
    border: none;
    padding: 0.5rem;
    margin-left: auto;
    margin-right: 0.25rem;
    cursor: pointer;
    color: #666;
    font-size: 1.25rem;
    line-height: 1;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
}

.topic-mobile-menu-icon:active {
    color: #333;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

/* Disabled - using breakpoint classes instead */
/* @media (max-width: 768px) {
    .topic-mobile-menu-icon {
        display: flex;
    }
    
    /* Ensure topic text doesn't overlap with icon */
    /* .topic-item:has(.topic-mobile-menu-icon) .topic-item-text {
        padding-right: 0.5rem;
    }
} */

/* Show 3-dot icons only in mobile breakpoint */
body.app-page.breakpoint-mobile .topic-mobile-menu-icon {
    display: flex !important;
}

body.app-page.breakpoint-mobile .topic-item:has(.topic-mobile-menu-icon) .topic-item-text {
    padding-right: 0.5rem;
}

.topic-item.draggable.dragging {
    opacity: 0.5;
    pointer-events: none; /* Allow drag events to pass through to folders underneath */
}

.topic-item.drag-over {
    border-top: 2px solid #0B57D0;
}

.topic-item.drag-invalid {
    opacity: 0.5;
    border-top: 2px solid #dc3545;
    background: #f8d7da;
}

.topic-item.shared-topic {
    margin-top: 0.25rem;
}

.topic-item.shared-topic:hover {
    background: #e0efff;
}

/* Note: Main .topic-item.shared-topic.active rule is defined earlier with full styling */

/* Admin shared topics override regular shared topic styles */
.topic-item.shared-topic.admin-shared-topic {
    background: #faf5fc !important; /* Very light purple background - override blue */
    border-top: 1px solid #e0e0e0;
    margin-top: 0.25rem;
}

.topic-item.shared-topic.admin-shared-topic:hover {
    background: #f3e5f5 !important; /* Slightly darker purple on hover */
}

.topic-item.shared-topic.admin-shared-topic.active {
    background: #e1bee7 !important; /* Light purple for active state */
    border-radius: 12px !important; /* Match regular topics active style */
}

.shared-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #0B57D0;
    border-radius: 50%;
    transition: all 0.3s ease;
    background: transparent;
}

.shared-icon svg {
    width: 100%;
    height: 100%;
}

/* Animate shared icon to circle when topic is active (but NOT admin shared icons) */
/* Exclude topic-share-icon from this rule */
/* DISABLED: Keep icon as blue outline, no circle background
.topic-item.shared-topic.active .shared-icon:not(.admin-shared-icon):not(.topic-share-icon) {
    background: #0B57D0;
    color: white;
    border-radius: 50%;
}
*/

/* Keep shared icon as blue outline even when active - no background circle */
.topic-item.shared-topic.active .shared-icon:not(.admin-shared-icon) {
    background: transparent !important;
    color: #0B57D0 !important;
    border-radius: 0 !important;
}

.topic-item.shared-topic.active .shared-icon:not(.admin-shared-icon) svg {
    color: #0B57D0 !important;
    stroke: #0B57D0 !important;
    fill: none !important;
}

/* Admin shared icon - purple color (must override .shared-icon) */
.topic-item.admin-shared-topic .admin-shared-icon,
.admin-shared-icon {
    color: #9C27B0 !important; /* Purple color for admin shared topics - force override */
    border-radius: 0 !important; /* Keep shield shape, no circle */
    transition: color 0.3s ease; /* Only transition color, not shape */
    background: transparent !important; /* No background, keep original shield */
}

.topic-item.admin-shared-topic .admin-shared-icon svg,
.admin-shared-icon svg {
    width: 100%;
    height: 100%;
    color: #9C27B0 !important; /* Ensure SVG inherits purple */
}

/* Admin shared icon should NOT animate to circle when active - keep it as shield */
/* Removed circle animation for admin shared topics */

/* Admin topics label - purple border */
.admin-topics-label {
    border-top-color: #9C27B0;
}

/* Admin shared topic item styling */
.admin-shared-topic {
    border-left: 2px solid #9C27B0;
    background: #f3e5f5; /* Light purple background */
}

.admin-shared-topic:hover {
    background: #e1bee7; /* Slightly darker purple on hover */
}

.admin-shared-topic.active {
    background: #ce93d8; /* Medium purple for active state */
    border-left: 2px solid #9C27B0;
}

.topics-separator {
    height: 1px;
    background: #e0e0e0;
    margin: 0.75rem 0 0.5rem 0;
    border: none;
}

.shared-topics-label {
    font-size: 0.75rem;
    color: #666;
    font-weight: 500;
    padding: 0.25rem 0.75rem 0.15rem 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: auto;
    display: block; /* Ensure label is always visible */
    font-family: 'Google Reg Sans', Arial, sans-serif; /* Match font used in admin topics */
}

/* Sticky topics section label (at top, no margin-top: auto) */
.sticky-topics-label {
    margin-top: 0.25rem; /* Add small top margin for spacing */
    margin-bottom: 0.25rem;
    border-top: none !important; /* Remove top border */
    /* Ensure font styles match admin-topics-label exactly */
    font-size: 0.75rem;
    color: #666;
    font-weight: 500;
    padding: 0.25rem 0.75rem 0.15rem 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: 'Google Reg Sans', Arial, sans-serif; /* Match font used in admin topics */
}

/* Separator line after sticky topics section, before regular topics */
.topic-item.sticky-topic:last-of-type {
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
}

/* Alternative: separator line before first regular topic */
.topic-item.sticky-topic:last-of-type + .topic-item:not(.sticky-topic) {
    border-top: 1px solid #e0e0e0;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
}

/* Search results section label */
.search-results-label {
    font-size: 0.75rem;
    color: #666;
    font-weight: 500;
    padding: 0.25rem 0.75rem 0.15rem 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-top: 1px solid #e0e0e0;
    margin-top: 0;
    margin-bottom: 0.25rem;
    display: block;
}

.shared-topics-footer {
    margin-top: auto;
    padding: 0.25rem 0.5rem; /* Match .pane-content left/right padding (0.5rem) */
    border-top: 1px solid #e0e0e0;
    background: #fafafa;
    min-height: 0; /* No minimum height - only show when there's content */
}

.shared-topics-container {
    display: flex;
    flex-direction: column;
}

.left-pane {
    display: flex;
    flex-direction: column;
    min-height: 0; /* Allow flex children to shrink */
}

.left-pane .pane-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

/* System folders (Shared, Draft, Trash) fixed at bottom of left panel; background #eeeeee */
.system-folders-bar {
    flex-shrink: 0;
    background: #eeeeee;
    border-top: 1px solid #e0e0e0;
    overflow-y: auto;
    max-height: 35vh;
    padding: 0.25rem 0.5rem;
}
.system-folders-bar .folder-tree-item,
.system-folders-bar .topic-item {
    background: #eeeeee;
}
.system-folders-bar .folder-tree-item:hover,
.system-folders-bar .topic-item:hover {
    background: #e2e2e2;
}

/* Slightly darker count on #eee background for better contrast */
.system-folders-bar .folder-item-count {
    color: #666;
}

/* Shared folder docs: same look as regular docs (doc icon + name, no blue/purple left indicator) */
#systemFoldersBar .topic-item.shared-topic,
#systemFoldersBar .topic-item.shared-topic.admin-shared-topic {
    border-left: none !important;
    box-shadow: none !important;
    margin-top: 0;
    background: #eeeeee !important;
}
#systemFoldersBar .topic-item.shared-topic:hover,
#systemFoldersBar .topic-item.shared-topic.admin-shared-topic:hover {
    background: #e2e2e2 !important;
}
#systemFoldersBar .topic-item.shared-topic.active,
#systemFoldersBar .topic-item.shared-topic.admin-shared-topic.active {
    background: #D4EDDA !important;
    border-left: none !important;
    box-shadow: none !important;
}

.custom-sort-info {
    margin: 0.5rem 0 0 0;
    padding: 0.75rem;
    background-color: #f0f7ff;
    border-left: 3px solid #0B57D0;
    color: #555;
    font-size: 0.9rem;
    line-height: 1.5;
    border-radius: 4px;
}

/* Sub-topic list items */
.subtopic-item {
    padding: 2px 12px 2px 8px; /* Match .topic-item padding exactly */
    margin-bottom: 0.0625rem; /* Match .topic-item spacing */
    background: var(--list-row-bg);
    border: none;
    border-radius: 0;
    cursor: pointer;
    transition: background 0.3s, border-radius 0.3s;
    line-height: 1.75rem;
    font-family: 'Google Sans Flex', 'Google Sans', 'Helvetica Neue', sans-serif;
    font-size: 14px;
    color: #1f1f1f;
    font-weight: 500;
    letter-spacing: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Link inside subtopic-item needs ellipsis too */
.subtopic-item a {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.subtopic-item:hover {
    background: #f0f0f0;
}

.subtopic-item.active {
    background: #D7DBEF; /* Default active for regular topics */
    border: none;
    border-radius: 12px;
    font-weight: 500;
}

/* Active subtopic when parent is sticky topic (yellow) – override default green */
.subtopic-item.subtopic-sticky-parent.active {
    background: #FFF9C4 !important; /* Light yellow to match sticky topic active */
}

/* Tooltip for truncated subtopic names */
.middle-pane .pane-content {
    overflow-y: auto !important;
    overflow-x: visible !important;
}

.subtopic-item[data-tooltip] {
    position: relative;
    overflow: visible !important;
}

.subtopic-item[data-tooltip]:hover::after {
    content: attr(data-tooltip) !important;
    position: absolute !important;
    bottom: calc(100% + 8px) !important;
    left: 0 !important;
    background: #333 !important;
    color: white !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    font-size: 0.75rem !important;
    white-space: nowrap !important;
    z-index: 99999 !important;
    pointer-events: none !important;
    box-shadow: none !important;
    border: none !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.subtopic-item[data-tooltip]:hover::before {
    content: '' !important;
    position: absolute !important;
    bottom: calc(100% + 4px) !important;
    left: 8px !important;
    border: 4px solid transparent !important;
    border-top-color: #333 !important;
    z-index: 100000 !important;
    pointer-events: none !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Show tooltip below when item is near top */
.subtopic-item.tooltip-below[data-tooltip]:hover::after {
    bottom: auto !important;
    top: calc(100% + 8px) !important;
}

.subtopic-item.tooltip-below[data-tooltip]:hover::before {
    bottom: auto !important;
    top: calc(100% + 4px) !important;
    border-top-color: transparent !important;
    border-bottom-color: #333 !important;
}

/* Active subtopic when parent is shared topic (light blue) */
.subtopic-item.subtopic-shared-parent.active {
    background: #E8F0FE !important; /* Light blue to match shared topic active */
}

/* Active subtopic when parent is admin shared topic (purple) */
.subtopic-item.subtopic-admin-shared-parent.active {
    background: #ce93d8 !important; /* Medium purple to match admin shared topic active */
}

/* Subtopic anchors in documents - bold and bigger font */
.subtopic-anchor {
    display: block;
    font-weight: bold;
    font-size: 18px;
    margin-top: 3px;
    margin-bottom: 0px;
    font-family: "Google Sans", "Product Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.7;
    color: #1f1f1f;
    letter-spacing: 0;
}

/* Mono text styling ([mono], [code]) – Consolas smaller than body */
.mono-text {
    font-family: Consolas, 'Courier New', monospace;
    font-size: 0.90rem;
}

/* Comment block: [comment]...[/comment] – indent, left bar, lighter color */
.view-comment {
    padding-left: 1rem;
    margin: 0.5rem 0;
    border-left: 3px solid #b0b0b0;
    color: #888;
}

/* Code boxed: [codebox]...[/codebox] – rounded grey box, monospace */
.view-codebox {
    font-family: Consolas, 'Courier New', monospace;
    font-size: 0.90rem;
    background: #e8e8e8;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin: 0.5rem 0;
}

/* View-mode checkboxes: rounded square, subtle shadow, white check (see checkboxes.jpeg) */
.view-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
    margin: 0.35rem 0;
}

.view-checkbox-label input[type="checkbox"] {
    display: none;
}

.view-checkbox-mark {
    display: inline-block;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    background-color: #f5f5f5;
    border: 1.5px solid #d0d0d0;
    border-radius: 5px;
    position: relative;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.view-checkbox-label:hover .view-checkbox-mark {
    background-color: #ebebeb;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
}

/* Checkmark when checked: L-shape, white on colored background */
.view-checkbox-label input:checked + .view-checkbox-mark::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Checked: solid fill + same subtle shadow */
.view-checkbox-label input:checked + .view-checkbox-mark {
    border-color: transparent;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* Default (no color): blue, white check */
.view-checkbox-label input:checked + .view-checkbox-mark {
    background-color: #2196F3;
}

/* Color variants: -[x=color] / -[=color]. Checkmark white unless white/yellow. */
.view-checkbox-black input:checked + .view-checkbox-mark { background-color: #2c2c2c; }
.view-checkbox-black input:checked + .view-checkbox-mark::after { border-color: #fff; }

.view-checkbox-grey input:checked + .view-checkbox-mark { background-color: #6b6b6b; }
.view-checkbox-grey input:checked + .view-checkbox-mark::after { border-color: #fff; }

.view-checkbox-white input:checked + .view-checkbox-mark { background-color: #fff; border-color: #d0d0d0; }
.view-checkbox-white input:checked + .view-checkbox-mark::after { border-color: #2c2c2c; }

.view-checkbox-blue input:checked + .view-checkbox-mark { background-color: #2196F3; }
.view-checkbox-blue input:checked + .view-checkbox-mark::after { border-color: #fff; }

.view-checkbox-green input:checked + .view-checkbox-mark { background-color: #4CAF50; }
.view-checkbox-green input:checked + .view-checkbox-mark::after { border-color: #fff; }

.view-checkbox-red input:checked + .view-checkbox-mark { background-color: #f44336; }
.view-checkbox-red input:checked + .view-checkbox-mark::after { border-color: #fff; }

.view-checkbox-orange input:checked + .view-checkbox-mark { background-color: #ff9800; }
.view-checkbox-orange input:checked + .view-checkbox-mark::after { border-color: #fff; }

.view-checkbox-yellow input:checked + .view-checkbox-mark { background-color: #ffeb3b; border-color: #e6d32a; }
.view-checkbox-yellow input:checked + .view-checkbox-mark::after { border-color: #333; }

.view-checkbox-purple input:checked + .view-checkbox-mark { background-color: #9c27b0; }
.view-checkbox-purple input:checked + .view-checkbox-mark::after { border-color: #fff; }

.view-checkbox-aqua input:checked + .view-checkbox-mark { background-color: #00bcd4; }
.view-checkbox-aqua input:checked + .view-checkbox-mark::after { border-color: #fff; }

.view-checkbox-cyan input:checked + .view-checkbox-mark { background-color: #00bcd4; }
.view-checkbox-cyan input:checked + .view-checkbox-mark::after { border-color: #fff; }

.view-checkbox-pink input:checked + .view-checkbox-mark { background-color: #e91e63; }
.view-checkbox-pink input:checked + .view-checkbox-mark::after { border-color: #fff; }

.view-checkbox-brown input:checked + .view-checkbox-mark { background-color: #795548; }
.view-checkbox-brown input:checked + .view-checkbox-mark::after { border-color: #fff; }

/* BBCode table styling */
.bbcode-table {
    width: auto;
    table-layout: fixed;
    border-collapse: collapse;
    margin: 1rem 0;
}

.bbcode-table-auto {
    width: 100%;
    table-layout: auto;
}

.bbcode-table-consolas {
    font-family: Consolas, 'Courier New', monospace;
}

.bbcode-table-title {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    text-align: left;
    color: #1f1f1f;
}

.bbcode-table thead {
    background-color: #f5f5f5;
}

.bbcode-table th {
    padding: 0.25rem 0.75rem;
    text-align: left;
    font-weight: bold;
    border-bottom: 2px solid #bbb;
}

.bbcode-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #ccc;
}

.bbcode-table img {
    max-width: 4rem;
    max-height: 4rem;
    width: auto;
    height: auto;
    display: block;
}

.bbcode-table tbody tr:hover {
    background-color: #f9f9f9;
}

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

/* Docs viewer and editor */
.docs-viewer {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Google Sans Flex', 'Google Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.75rem;
    font-size: 14px;
    color: #1f1f1f;
    font-weight: 500;
    letter-spacing: 0;
    padding: 0.25rem 1rem 1rem 1rem;
    background-color: white;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 95%;
    margin: 0 auto 0 auto;
    min-height: auto;
    padding-bottom: 1.5rem;
}

.docs-viewer h3 {
    font-size: 18px;
    font-weight: 500;
    margin: 1.5rem 0 0.75rem 0;
    color: #202124;
    line-height: 1.4;
}

.docs-viewer h3:first-child {
    margin-top: 0;
}

.docs-editor {
    width: 100%;
    min-height: auto;
    padding: 1rem;
    padding-bottom: 1.5rem;
    border: none;
    border-radius: 0;
    font-family: 'Google Sans Flex', 'Google Sans', 'Helvetica Neue', sans-serif;
    font-size: 14px;
    line-height: 1.75rem;
    font-weight: 500;
    letter-spacing: 0;
    resize: none;
    color: #1f1f1f;
    background-color: #f5e6d3;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.1);
    max-width: 95%;
    margin: 0 auto 0 auto;
    overflow-y: auto;
    overflow-x: hidden;
}

.docs-editor:focus,
.sceditor-container:focus-within {
    outline: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.1), 0 0 0 2px var(--edit-focus-ring) !important;
}


/* Find Controls */
.find-controls {
    display: flex;
    align-items: center;
    justify-content: center; /* Center the buttons in the middle of the doc panel */
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid #e0e0e0;
    background: #fafafa;
    position: sticky;
    bottom: 0;
    z-index: 10;
    flex-shrink: 0;
}

.find-btn {
    background: var(--edit-btn-bg);
    color: var(--edit-btn-text);
    border: none;
    height: 34px;
    padding: 0 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    font-family: 'Google Sans', Arial, sans-serif;
}

.find-btn:hover {
    background: var(--edit-btn-hover);
}

.find-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.find-counter {
    font-size: 0.875rem;
    color: #666;
    font-family: 'Google Sans', Arial, sans-serif;
}

/* Search highlight */
.search-highlight {
    background-color: #FFF3C2;
    padding: 2px 0;
    border-radius: 2px;
}

.search-highlight.active {
    background-color: #D4C4FB;
    color: #1a1a1a;
    padding: 2px 0;
    border-radius: 2px;
}

.docs-viewer.search-marks-off .search-highlight,
.docs-viewer.search-marks-off .search-highlight.active {
    background-color: transparent;
    color: inherit;
    padding: 0;
    border-radius: 0;
    border: none;
}

/* Default pane widths (will be overridden by JavaScript) */
.left-pane {
    width: 18%;
    min-width: 240px;
}

.middle-pane {
    width: 12%;
    min-width: 200px;
}

.main-pane {
    width: 70%;
    min-width: 300px;
    /* No transition - expands instantly when side panels hide */
}

/* Context Menu */
.context-menu {
    display: none;
    position: fixed;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1002;
    min-width: 120px;
    overflow: hidden;
    font-family: 'Google Reg Sans', Arial, sans-serif;
}

/* Folder tree context menu (Fancytree) - compact like topic menu */
.folder-context-menu.context-menu {
    padding: 0.2rem 0;
}

.context-menu.show {
    display: block;
}

.context-menu .context-menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.4rem 1rem;
    border: none;
    background: white;
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
    color: #2c3e50;
    transition: background 0.2s;
}

.context-menu .ctx-icon-slot {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: currentColor;
}

.context-menu .ctx-icon-slot svg {
    display: block;
    width: 16px;
    height: 16px;
}

.context-menu .context-menu-item:hover {
    background: #f8f9fa;
}

.context-menu .context-menu-item:disabled {
    color: #888;
    cursor: not-allowed;
    opacity: 0.85;
}

.context-menu .context-menu-item:disabled:hover {
    background: white;
    cursor: not-allowed;
}

.context-menu .context-menu-item:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.context-menu .context-menu-item:last-child {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* Yellow ball indicator for context menu items */
.context-menu-item .yellow-ball,
.context-menu-item span.yellow-ball,
#toggleStickyContext .yellow-ball,
#ctxSticky .yellow-ball,
button.context-menu-item .yellow-ball,
button#toggleStickyContext .yellow-ball,
button#ctxSticky .yellow-ball,
#toggleStickyContext span.yellow-ball,
#ctxSticky span.yellow-ball,
button#toggleStickyContext span.yellow-ball,
button#ctxSticky span.yellow-ball {
    display: inline-block !important;
    width: 8px !important;
    height: 8px !important;
    min-width: 8px !important;
    min-height: 8px !important;
    background-color: #FFC107 !important;
    background: #FFC107 !important;
    border-radius: 50% !important;
    margin-right: 6px !important;
    vertical-align: middle !important;
    border: none !important;
    flex-shrink: 0 !important;
    box-shadow: none !important;
    color: transparent !important;
    opacity: 1 !important;
}

/* Blue ball indicator for Share It */
.context-menu-item .blue-ball,
.context-menu-item span.blue-ball,
#shareTopicContext .blue-ball,
#ctxShare .blue-ball,
button.context-menu-item .blue-ball,
button#shareTopicContext .blue-ball,
button#ctxShare .blue-ball {
    display: inline-block !important;
    width: 8px !important;
    height: 8px !important;
    background-color: #0B57D0 !important;
    background: #0B57D0 !important;
    border-radius: 50% !important;
    margin-right: 6px !important;
    vertical-align: middle !important;
    border: none !important;
    flex-shrink: 0 !important;
    box-shadow: none !important;
    color: transparent !important;
    opacity: 1 !important;
}

/* Create Topic Dialog */
/* Light toast message (folder delete, etc.) - like docs, non-intrusive */
.app-light-message {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 18px;
    font-size: 14px;
    color: #fff;
    background: rgba(50, 50, 50, 0.92);
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    max-width: 90vw;
}
.app-light-message.show {
    opacity: 1;
    visibility: visible;
}

.create-dialog,
.delete-dialog,
.rename-dialog,
.archive-dialog,
.dialog {
    display: none;
    position: fixed;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 320px;
    max-width: 90vw;
    background: white !important;
    border-radius: 6px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    animation: fadeIn 0.3s ease-out;
    bottom: auto !important;
    right: auto !important;
    overflow: hidden;
}

/* Confirm, Alert, Delete dialogs – slightly wider for comfortable button spacing */
.delete-dialog {
    width: 360px;
}

/* Share List Dialog - larger size */
#shareListDialog {
    width: 550px;
    max-width: 90vw;
}

.create-dialog.show,
.delete-dialog.show,
.archive-dialog.show,
.rename-dialog.show,
.dialog.show {
    display: block;
}

/* Dialog backdrop overlay */
.create-dialog::before,
.delete-dialog::before,
.rename-dialog::before,
.archive-dialog::before,
.dialog::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
    display: none;
}

.create-dialog.show::before,
.delete-dialog.show::before,
.rename-dialog.show::before,
.archive-dialog.show::before,
.dialog.show::before {
    display: block;
}

.dialog-content {
    padding: 0;
    background: white !important;
}

.dialog-content h2 {
    margin: 0;
    padding: 0.75rem 1rem;
    background-color: #F2F2F2;
    color: #2c3e50;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 6px 6px 0 0;
}

.dialog-content form {
    padding: 0.5rem 1rem 1rem;
}

.dialog-content p {
    padding: 0.75rem 1rem 0;
}

.dialog-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
    padding: 0;
    justify-content: flex-end;
}

#draftChoiceDialog .dialog-content {
    padding: 1.5rem;
}

#draftChoiceDialog .dialog-buttons {
    margin-left: 0;
    margin-right: 0;
}

.dialog-buttons-stack {
    flex-direction: column;
    align-items: stretch;
    margin-top: 0;
}

.dialog-buttons button {
    height: 34px;
    padding: 0 1rem;
    border: 1px solid var(--snail-blush);
    border-radius: 8px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    background: #fff;
    color: var(--snail-brown);
    font-weight: 500;
    font-family: 'Google Sans', Arial, sans-serif;
}

.dialog-buttons button:hover {
    background: var(--snail-cream-light);
    border-color: var(--snail-shell);
}

.dialog-buttons button.btn-primary {
    background: var(--edit-btn-bg);
    color: var(--edit-btn-text);
    border: none;
}

.dialog-buttons button.btn-primary:hover {
    background: var(--edit-btn-hover);
    border: none;
    color: var(--edit-btn-text);
}

.dialog-buttons button.btn-destructive {
    background: #fff;
    color: var(--snail-red);
    border: 1px solid var(--snail-blush);
}

.dialog-buttons button.btn-destructive:hover {
    background: var(--snail-cream-light);
    border-color: var(--snail-shell);
}

/* Draft choice link style */
.draft-choice-link {
    padding: 0.5rem 0;
    text-align: center;
    color: #1a73e8;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 400;
    cursor: pointer;
    transition: color 0.2s;
}

.draft-choice-link:hover {
    color: #1557b0;
    text-decoration: underline;
}

#deleteConfirmBtn,
#deleteFolderConfirmBtn,
#confirmDialogConfirmBtn {
    background: #fff !important;
    color: var(--snail-red) !important;
    border: 1px solid var(--snail-blush) !important;
}

#deleteConfirmBtn:hover,
#deleteFolderConfirmBtn:hover,
#confirmDialogConfirmBtn:hover {
    background: var(--snail-cream-light) !important;
    border-color: var(--snail-shell) !important;
}

#createCancelBtn {
    background: #fff;
    border: 1px solid var(--snail-blush);
    color: var(--snail-brown);
}

#createCancelBtn:hover {
    background: var(--snail-cream-light);
    border-color: var(--snail-shell);
}

#createSaveBtn,
#renameSaveBtn,
#createFolderSaveBtn {
    background: var(--edit-btn-bg);
    border: none;
    color: var(--edit-btn-text);
}

#createSaveBtn:hover,
#renameSaveBtn:hover,
#createFolderSaveBtn:hover {
    background: var(--edit-btn-hover);
    border: none;
    color: var(--edit-btn-text);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Settings Dialog */
.settings-dialog {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 440px;
    max-width: 95vw;
    background: white;
    border-radius: 6px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.settings-dialog.show {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

.settings-content {
    padding: 0;
    height: auto; /* Let it size based on content */
    display: flex;
    flex-direction: column;
}

.settings-content h2 {
    margin: 0;
    padding: 0.75rem 1rem;
    background-color: #F2F2F2;
    color: #2c3e50;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 6px 6px 0 0;
}

.settings-content .settings-tabs {
    padding: 1rem 1rem 0 1rem;
    flex-shrink: 0;
}

.settings-content form {
    padding: 0.75rem 1rem 1rem;
    display: flex;
    flex-direction: column;
}

.settings-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #ddd;
}

.settings-tab {
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 0.9rem;
    color: #666;
    transition: all 0.3s;
}

.settings-tab:hover {
    color: #2c3e50;
}

.settings-tab.active {
    color: #0B57D0;
    border-bottom-color: #0B57D0;
    font-weight: 500;
}

.settings-tab-content {
    display: block;
    overflow: visible;
}

.settings-tab-content:not(.active) {
    display: none;
}

.settings-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: 'Google Sans', Arial, sans-serif;
}

.settings-group select:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.6;
}

.settings-group {
    margin-bottom: 0.75rem; /* Reduced spacing to fit more content in fixed height */
}

.settings-group label {
    display: block;
    margin-bottom: 0.4rem; /* Reduced spacing */
    font-weight: 500;
    color: #555;
    font-size: 0.9rem; /* Slightly smaller */
}

.settings-checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    margin-bottom: 0 !important;
    font-weight: 400;
    color: #333;
}

.settings-checkbox-label input[type="checkbox"] {
    width: auto !important;
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.settings-checkbox-label span {
    flex: 1;
    user-select: none;
}

.settings-group input {
    width: 100%;
    padding: 0.4rem 0.5rem; /* Slightly reduced vertical padding */
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95rem; /* Slightly smaller font */
    transition: border-color 0.3s, background-color 0.3s;
    box-sizing: border-box; /* Ensure padding is included in width */
}

.settings-group input:focus {
    outline: none;
    border: 2px solid #1a73e8;
    padding: calc(0.4rem - 1px) calc(0.5rem - 1px); /* Adjust padding to maintain size when border increases */
}

.settings-group input.error {
    border-color: #e74c3c;
    background-color: #ffeaea;
}

.input-with-auto {
    display: flex;
    gap: 0.4rem; /* Slightly reduced gap */
    align-items: center;
    overflow: visible; /* Ensure focus outline is not clipped */
}

.input-with-auto input {
    flex: 1;
    min-width: 0; /* Allow flex item to shrink below content size */
    box-sizing: border-box; /* Ensure padding is included in width */
}

.input-with-auto input:focus {
    outline: none;
    border: 2px solid #1a73e8;
    padding: calc(0.4rem - 1px) calc(0.5rem - 1px); /* Adjust padding to maintain size when border increases */
}

.auto-btn {
    height: 34px;
    padding: 0 1rem;
    border: 1px solid var(--snail-blush);
    border-radius: 8px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    background: #fff;
    color: var(--snail-brown);
    font-weight: 500;
    font-family: 'Google Sans', Arial, sans-serif;
    white-space: nowrap;
}

.auto-btn:hover:not(:disabled) {
    background: var(--snail-cream-light);
    border-color: var(--snail-shell);
}

.auto-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #e9ecef;
    color: #6c757d;
}

.settings-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    flex-wrap: nowrap;
    justify-content: flex-end;
    flex-shrink: 0;
}

.settings-buttons button {
    height: 34px;
    padding: 0 1rem;
    border: 1px solid var(--snail-blush);
    border-radius: 8px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    background: #fff;
    color: var(--snail-brown);
    font-weight: 500;
    font-family: 'Google Sans', Arial, sans-serif;
}

.settings-buttons button:hover:not(:disabled) {
    background: var(--snail-cream-light);
    border-color: var(--snail-shell);
}

.settings-buttons button.btn-primary,
#saveCloseBtn {
    background: var(--edit-btn-bg);
    border: none;
    color: var(--edit-btn-text);
}

.settings-buttons button.btn-primary:hover:not(:disabled),
#saveCloseBtn:hover:not(:disabled) {
    background: var(--edit-btn-hover);
    border: none;
    color: var(--edit-btn-text);
}

.settings-buttons button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #e9ecef;
    color: #6c757d;
}

/* ============================================
   HOMEPAGE STYLES
   ============================================ */

.homepage {
    min-height: 100vh !important;
    display: flex !important;
    flex-direction: column !important;
    background: #ffffff !important;
}

body.homepage {
    background: #ffffff !important;
    height: auto !important;
    display: block !important;
    justify-content: normal !important;
}

/* Navigation */
.homepage-nav {
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    margin-bottom: 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    display: flex;
    align-items: flex-end;
    text-decoration: none;
}

.nav-logo-text {
    font-size: 2rem !important;
    font-weight: 500 !important;
    color: #1f1f1f !important;
    letter-spacing: 2px !important;
    font-family: 'Roboto', sans-serif !important;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: #5e5e5e;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
    padding: 0.5rem 0;
}

.nav-link:hover {
    color: #2c3e50;
}

.nav-link-active {
    color: #0B57D0;
}

.nav-link-secondary {
    color: #5e5e5e;
}

.nav-link-primary {
    background: #1a73e8;
    color: white;
    padding: 0.5rem 1.25rem;
    border-radius: 9999px;
    font-weight: 500;
}

.nav-link-primary:hover {
    background: #1557b0;
    color: white;
}

/* Homepage Main */
.homepage-main {
    margin-top: 0;
    padding-top: 0;
}

/* Hero Section */
.hero {
    padding: 2rem 2rem 4rem 2rem;
    text-align: center;
    background: linear-gradient(135deg, #E5EDFF 0%, #f8f9ff 100%) !important;
    margin-top: 0;
}

.hero-section {
    padding: 4rem 2rem;
    text-align: center;
    background: linear-gradient(135deg, #E5EDFF 0%, #f8f9ff 100%) !important;
    margin-top: 0;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

/* Announcement Banner */
.announcement-banner {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background-color: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    color: #0c4a6e;
}

/* Announce Box */
.announce-box {
    background-color: #FCEAC5 !important;
    border: 2px solid #2E1D00 !important;
    border-radius: 8px !important;
    padding: 1.5rem !important;
    margin: 2rem auto !important;
    max-width: 800px !important;
    display: flex !important;
    align-items: flex-start !important;
    gap: 1rem !important;
    text-align: left !important;
}

.announce-icon {
    flex-shrink: 0 !important;
    margin-top: 0.125rem !important;
    color: #2E1D00 !important;
    stroke: #2E1D00 !important;
}

.announce-content {
    flex: 1;
}

.announce-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #2E1D00;
    margin: 0 0 0.5rem 0;
    line-height: 1.4;
}

.announce-text {
    font-size: 0.95rem;
    color: #2E1D00;
    margin: 0;
    line-height: 1.6;
}

.announcement-icon {
    flex-shrink: 0;
    margin-top: 0.125rem;
    color: #0284c7;
}

.announcement-content {
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.6;
}

.announcement-content strong {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #0c4a6e;
}

.announcement-content p {
    margin: 0;
    color: #075985;
}

html[data-theme="dark"] .announcement-banner {
    background-color: #0c1e2e;
    border-color: #1e3a52;
    color: #7dd3fc;
}

html[data-theme="dark"] .announcement-icon {
    color: #38bdf8;
}

html[data-theme="dark"] .announcement-content strong {
    color: #7dd3fc;
}

html[data-theme="dark"] .announcement-content p {
    color: #7dd3fc;
}

.hero-title {
    font-size: 3rem;
    font-weight: 600;
    color: #1f1f1f;
    margin-bottom: 1.5rem;
    line-height: 1.2;
    font-family: 'Google Sans Flex', 'Google Sans', 'Helvetica Neue', sans-serif;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: #5e5e5e;
    margin-bottom: 2.5rem;
    line-height: 1.6;
}

.hero-cta {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Features Section */
.features-section {
    padding: 5rem 2rem;
    background: #ffffff;
}

.features-container {
    max-width: 1200px;
    margin: 0 auto;
}

.features-title {
    font-size: 2.5rem;
    font-weight: 600;
    text-align: center;
    color: #1f1f1f;
    margin-bottom: 3rem;
    font-family: 'Google Sans Flex', 'Google Sans', 'Helvetica Neue', sans-serif;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.feature-card {
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 12px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f1f1f;
    margin-bottom: 0.75rem;
    font-family: 'Google Sans Flex', 'Google Sans', 'Helvetica Neue', sans-serif;
}

.feature-description {
    color: #5e5e5e;
    line-height: 1.6;
}

/* CTA Section */
.cta-section {
    padding: 5rem 2rem;
    background: linear-gradient(135deg, #E5EDFF 0%, #f8f9ff 100%) !important;
    text-align: center;
}

.cta-content {
    max-width: 600px;
    margin: 0 auto;
}

.cta-title {
    font-size: 2.5rem;
    font-weight: 600;
    color: #1f1f1f;
    margin-bottom: 1rem;
    font-family: 'Google Sans Flex', 'Google Sans', 'Helvetica Neue', sans-serif;
}

.cta-subtitle {
    font-size: 1.125rem;
    color: #5e5e5e;
    margin-bottom: 2rem;
}

/* Footer */
.homepage-footer {
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    padding: 2rem;
    margin-top: auto;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-link {
    text-decoration: none;
    color: #5e5e5e;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.footer-link:hover {
    color: #2c3e50;
}

.footer-copyright {
    color: #5e5e5e;
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: none;
    font-size: 1rem;
    transition: all 0.2s;
    font-family: 'Google Sans Flex', 'Google Sans', 'Helvetica Neue', sans-serif;
}

.btn-primary {
    background: #1a73e8;
    color: white;
}

.btn-primary:hover {
    background: #1557b0;
}

.btn-secondary {
    background: white;
    color: #0B57D0;
    border: 1px solid #0B57D0;
}

.btn-secondary:hover {
    background: #f8f9fa;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-full {
    width: 100%;
}

/* ============================================
   AUTH PAGES (SIGNIN/REGISTER)
   ============================================ */

.auth-page {
    min-height: 100vh;
    background: #E5EDFF;
    display: flex;
    flex-direction: column;
}

.auth-nav {
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    padding: 1rem 0;
}

.auth-nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.auth-nav-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #2c3e50;
    font-size: 1.125rem;
    font-weight: 600;
    font-family: 'Google Sans Flex', 'Google Sans', 'Helvetica Neue', sans-serif;
}

.auth-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-container {
    background: white;
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 450px;
}

.auth-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.auth-title {
    font-size: 2rem;
    font-weight: 600;
    color: #1f1f1f;
    margin-bottom: 0.5rem;
    font-family: 'Google Sans Flex', 'Google Sans', 'Helvetica Neue', sans-serif;
}

.auth-subtitle {
    font-size: 1rem;
    color: #5e5e5e;
    line-height: 1.5;
}

.auth-form {
    margin-bottom: 2rem;
}

.auth-form .form-group {
    margin-bottom: 1.5rem;
}

.auth-form .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #2c3e50;
    font-size: 0.95rem;
}

.auth-form .form-group input {
    width: 100%;
    padding: 0.875rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: 'Google Sans Flex', 'Google Sans', 'Helvetica Neue', sans-serif;
}

.auth-form .form-group input:focus {
    outline: none;
    border-color: #0B57D0;
    box-shadow: 0 0 0 3px rgba(11, 87, 208, 0.1);
}

.form-group-checkbox {
    margin-bottom: 1.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.95rem;
    color: #5e5e5e;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
    cursor: pointer;
}

.form-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #5e5e5e;
}

.auth-footer {
    text-align: center;
}

.auth-footer-text {
    margin: 0.5rem 0;
    color: #5e5e5e;
    font-size: 0.95rem;
}

.auth-link {
    color: #0B57D0;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.auth-link:hover {
    color: #0a4db8;
    text-decoration: underline;
}

/* ============================================
   ABOUT PAGE
   ============================================ */

.about-page {
    min-height: 100vh;
    display: flex !important;
    flex-direction: column !important;
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
    height: auto !important;
    justify-content: normal !important;
}

.about-page .homepage-nav {
    position: static !important;
    display: block !important;
    visibility: visible !important;
    height: auto !important;
    min-height: auto !important;
    overflow: visible !important;
    opacity: 1 !important;
    background: #ffffff !important;
    border-bottom: 1px solid #e0e0e0 !important;
    padding: 1rem 0 !important;
}

.about-page .homepage-nav .nav-container {
    display: flex !important;
    visibility: visible !important;
}

.about-main {
    flex: 1;
    padding: 3rem 2rem;
}

.about-container {
    max-width: 900px;
    margin: 0 auto;
}

.about-hero {
    text-align: center;
    margin-bottom: 4rem;
    padding: 2rem 0;
    margin-top: 0;
}

.about-title {
    font-family: 'Product Sans', 'Google Reg Sans', Arial;
    font-size: 26px;
    line-height: 1.2;
    color: #333;
    font-weight: 600;
    margin-bottom: 1rem;
}

.about-lead {
    font-size: 1.25rem;
    color: #5e5e5e;
    line-height: 1.6;
}

.about-content {
    line-height: 1.8;
}

.about-section {
    margin-bottom: 3rem;
}

.about-section-title {
    font-family: 'Product Sans', 'Google Reg Sans', Arial;
    font-size: 26px;
    line-height: 1.2;
    color: #333;
    font-weight: 600;
    margin-bottom: 1rem;
}

.about-text {
    font-size: 1.0625rem;
    color: #5e5e5e;
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

.about-features-list {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
}

.about-features-list li {
    padding: 0.75rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: #5e5e5e;
    font-size: 1.0625rem;
    line-height: 1.8;
}

.about-features-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #0B57D0;
    font-weight: 600;
}

.about-features-list li strong {
    color: #2c3e50;
}

.about-cta {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ============================================
   REGISTER PAGE (SLASH2 STYLE) - FROM REFERENCE
   ============================================ */

/* Only apply these styles when NOT on homepage */
body:not(.homepage):not(.about-page) {
    padding: 0;
    margin: 0;
    background: #F7F7F5;
    height: 100vh;
    display: flex;
    justify-content: center;
    font-family: 'Google Reg Sans', Arial;
}

.box {
    width: 370px;
    min-width: 270px;
    height: 520px;
    background-color: #fff;
    border-radius: 24px;
    margin-top: 110px;
    padding: 35px;
}

.title {
    font-size: 26px;
    line-height: 1.2;
    padding-top: 10px;
    color: #333;
    padding-bottom: 5px;
}

.title2 {
    font-size: 16px;
    color: #666;
}

.pane {
    width: 50%;
    height: 100%;
    float: left;
}

.account-input-wrapper.active {
    height: 32px;
    width: 300px;
    border: 2px solid #1a73e8;
    border-radius: 4px;
    position: relative;
    padding: 0px;
}

.account-input-wrapper {
    width: 302px;
    border: 1px solid #aaa;
    border-radius: 4px;
    position: relative;
    padding: 2px 1px;
}

.account-input-wrapper input {
    border: none;
    outline: 0;
    font-size: 15px;
    color: #202124;
    height: 32px;
    width: 279px;
    padding: 0px 10px;
    border-radius: 4px;
}

.account-input-wrapper2.active {
    height: 32px;
    width: 300px;
    border: 2px solid #1a73e8;
    border-radius: 4px;
    position: relative;
    padding: 0px;
}

.account-input-wrapper2 {
    width: 302px;
    border: 1px solid #aaa;
    border-radius: 4px;
    position: relative;
    padding: 2px 1px;
    display: inline-block;
}

.account-input-wrapper2 input {
    border: none;
    outline: 0;
    font-size: 15px;
    color: #202124;
    height: 32px;
    width: 279px;
    padding: 0px 10px;
    border-radius: 4px;
}

.account-input-wrapper3.active {
    height: 32px;
    width: 300px;
    border: 2px solid #1a73e8;
    border-radius: 4px;
    position: relative;
    padding: 0px;
}

.account-input-wrapper3 {
    width: 302px;
    border: 1px solid #aaa;
    border-radius: 4px;
    position: relative;
    padding: 2px 1px;
    display: inline-block;
}

.account-input-wrapper3 input {
    border: none;
    outline: 0;
    font-size: 15px;
    color: #202124;
    height: 32px;
    width: 279px;
    padding: 0px 10px;
    border-radius: 4px;
}

label.reg-label {
    position: absolute;
    transform-origin: top left;
    padding: 0px;
    transform: translate(0, 16px) scale(1);
    transition: transform 150ms cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Roboto Reg';
    font-size: 15px;
    color: #797E84;
    top: -8px;
    left: 10px;
    pointer-events: none;
    cursor: text;
}

.account-input-wrapper.active label {
    transform: translate(-6px, 1px) scale(.80);
    color: #1973e8;
    background: #fff;
    padding: 0px 5px;
}

.account-input-wrapper.done label {
    transform: translate(-6px, 1px) scale(.80);
    color: #5f6368;
    background: #fff;
    padding: 0px 5px;
}

.account-input-wrapper2.active label {
    transform: translate(-6px, 1px) scale(.80);
    color: #1973e8;
    background: #fff;
    padding: 0px 5px;
}

.account-input-wrapper2.done label {
    transform: translate(-6px, 1px) scale(.80);
    color: #5f6368;
    background: #fff;
    padding: 0px 5px;
}

.account-input-wrapper3.active label {
    transform: translate(-6px, 1px) scale(.80);
    color: #1973e8;
    background: #fff;
    padding: 0px 5px;
}

.account-input-wrapper3.done label {
    transform: translate(-6px, 1px) scale(.80);
    color: #5f6368;
    background: #fff;
    padding: 0px 5px;
}

.account-register-check-availability {
    color: #1a73e8;
    cursor: pointer;
}

.google-button {
    cursor: pointer;
    border: #B0B9C1 1px solid;
    border-radius: 40px;
    color: #232a31;
    font-size: 17px;
    font-weight: 500;
    padding: 8px;
    text-align: center;
}

.google-button:hover {
    border: #5B636A 1px solid;
}

/* Form group styles for our labels and inputs */
.box .form-group {
    margin-bottom: 1rem;
}

.box .form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: #2c3e50;
    font-size: 0.95rem;
}

.box .form-group input {
    width: 100%;
    height: 32px;
    padding: 0px 10px;
    border: 1px solid #aaa;
    border-radius: 4px;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: 'Google Sans Flex', 'Google Sans', 'Helvetica Neue', sans-serif;
    color: #202124;
    box-sizing: border-box;
}

.box .form-group input:focus {
    outline: none;
    border: 2px solid #1a73e8;
    padding: 0px 9px;
}

.box .form-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #555;
}

.reg-blue-text {
    color: #333;
}

.reg-blue-text a {
    color: #1a73e8;
    text-decoration: none;
}

.reg-blue-text a:hover {
    text-decoration: underline;
}

.btn-blue {
    background: #1a73e8;
    box-shadow: none;
    border-radius: 40px;
    font-size: 17px;
    line-height: 20px;
    min-width: 88px;
    transition: box-shadow .28s cubic-bezier(0.4,0.0,0.2,1);
    border: 0;
    display: inline-block;
    cursor: pointer;
    outline: none;
    text-align: center;
    color: #fff;
    padding: 11px 8px;
    position: relative;
    box-sizing: content-box;
}

.btn-blue:hover {
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

.right {
    float: right;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1.125rem;
    }

    .features-title,
    .cta-title {
        font-size: 2rem;
    }

    .about-title {
        font-size: 2rem;
    }

    .nav-links {
        gap: 1rem;
    }

    .nav-link-primary {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .auth-container {
        padding: 2rem;
    }

    .auth-title {
        font-size: 1.75rem;
    }

    .footer-container {
        flex-direction: column;
        text-align: center;
    }

    .register-box {
        width: 90%;
        max-width: 370px;
        margin: 0 1rem;
    }

    .register-main {
        padding-top: 50px;
    }
}

/* Font Settings Menu Button */
.font-settings-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    color: #2c3e50;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
}

.font-settings-menu-btn:hover {
    background: #f5f5f5;
}

.font-settings-menu-btn svg {
    width: 14px;
    height: 14px;
}

/* Font Settings Menu Dropdown */
.font-settings-menu-dropdown {
    display: none !important;
    position: absolute;
    top: calc(100% + 0.25rem);
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0.75rem;
    z-index: 10000;
    min-width: 200px;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0;
}

.font-settings-menu-dropdown.show {
    display: flex !important;
}

.font-settings-menu-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.font-settings-menu-item label {
    font-size: 0.75rem;
    color: #666;
    font-weight: 500;
}

/* Toolbar menu items in hamburger dropdown (tablet breakpoint) */
.doc-toolbar-hamburger-dropdown .toolbar-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 1rem;
    border: none;
    background: transparent;
    color: #333;
    font-size: 0.875rem;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: background-color 0.15s ease;
}

.doc-toolbar-hamburger-dropdown .toolbar-menu-item:hover {
    background: #f5f5f5;
}

.doc-toolbar-hamburger-dropdown .toolbar-menu-item span:first-child {
    min-width: 20px;
    text-align: center;
    font-weight: 700;
}

.font-settings-menu-item .font-select-dropdown {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
}

/* Doc Toolbar Hamburger Button (always visible, to the right of Full Doc button) */
.doc-toolbar-hamburger-wrapper {
    position: relative;
    display: inline-block;
}

/* Hamburger button should match format-btn style when inside new-toolbar */
.new-toolbar .doc-toolbar-hamburger-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 4px;
    margin-left: 0;
}

.doc-toolbar-hamburger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    color: #333;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    margin-left: 0;
    transition: background-color 0.15s ease;
}

.doc-toolbar-hamburger-btn:hover:not(:disabled) {
    background: #f0f0f0;
}

.doc-toolbar-hamburger-btn:active:not(:disabled) {
    background: #e0e0e0;
}

.doc-toolbar-hamburger-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.doc-toolbar-hamburger-btn svg {
    width: 18px;
    height: 18px;
}

/* Doc Toolbar Hamburger Dropdown */
.doc-toolbar-hamburger-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0.75rem;
    z-index: 10000;
    min-width: 250px;
    flex-direction: column;
    gap: 0.75rem;
    white-space: nowrap;
}

.doc-toolbar-hamburger-dropdown.show {
    display: flex !important;
}

.doc-toolbar-hamburger-dropdown .font-settings-menu-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.doc-toolbar-hamburger-dropdown .font-settings-menu-item label {
    font-size: 0.75rem;
    color: #666;
    font-weight: 500;
}

.doc-toolbar-hamburger-dropdown .font-select-dropdown {
    width: 100%;
    padding: 0.375rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.875rem;
    background: white;
}

/* Hide mobile menu by default (desktop) */
.mobile-menu-btn {
    display: none !important;
}

.mobile-menu-dropdown {
    display: none !important;
}

/* Allow dropdown to show when .show class is added (mobile only) */
@media (max-width: 768px) {
    /* Hide font settings hamburger on mobile - use mobile menu instead */
    .font-settings-menu-btn {
        display: none !important;
    }
    
    /* Show mobile menu button */
    .mobile-menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        padding: 0.25rem;
        background: transparent;
        border: 1px solid #ddd;
        border-radius: 20px;
        cursor: pointer;
        color: #2c3e50;
        width: 34px;
        height: 34px;
        min-width: 34px;
        min-height: 34px;
    }
    
    .mobile-menu-btn:hover {
        background: #f5f5f5;
    }
    
    .mobile-menu-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .mobile-menu-dropdown.show {
        display: flex !important;
    }
    
    .mobile-menu-divider {
        height: 1px;
        background: #e0e0e0;
        margin: 0.5rem 0;
    }
    
    .mobile-menu-section {
        display: flex;
        flex-direction: column;
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }
    
    .mobile-menu-section label {
        font-size: 12px;
        font-weight: 500;
        color: #666;
    }
    
    .mobile-menu-select {
        padding: 0.5rem;
        border: 1px solid #ddd;
        border-radius: 4px;
        font-size: 14px;
        font-family: 'Google Sans', Arial, sans-serif;
        background: white;
        color: #1f1f1f;
        cursor: pointer;
    }
    
    .mobile-menu-select:hover {
        border-color: #bbb;
    }
    
    .mobile-menu-select:focus {
        outline: none;
        border-color: #5A9FD4;
    }
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    /* Header adjustments */
    .app-title,
    .logo h1 {
        font-size: 1.3rem !important;
        font-weight: 500 !important;
    }
    
    /* Make search bar stretch to available space */
    .header-search-wrapper {
        flex: 1;
        max-width: none;
        margin-left: 0.5rem;
        margin-right: 0.5rem;
    }
    
    .header-search {
        width: 100% !important;
        max-width: 100% !important;
        font-size: 0.85rem;
        padding: 0.6rem 2rem 0.6rem 2.5rem;
    }
    
    .header-search:focus {
        padding: calc(0.6rem - 1px) calc(2rem - 1px) calc(0.6rem - 1px) calc(2.5rem - 1px);
    }
    
    .header-left {
        gap: 2px;
        flex: 1;
        min-width: 0;
    }
    
    .app-header {
        padding: 6px 1rem 6px 0.75rem;
    }
    
    /* Hide middle pane on mobile - DISABLED TO PREVENT LAYOUT SHIFT */
    /* .middle-pane {
        display: none !important;
    }
    
    /* Make panes full width when visible */
    /* .left-pane {
        width: 100% !important;
        min-width: 0 !important;
    }
    
    /* .main-pane {
        width: 100% !important;
        min-width: 0 !important;
        display: none;
    }
    
    /* Show left pane by default on mobile */
    /* .left-pane {
        display: flex !important;
    } */
    
    /* Back to topics button - DISABLED TO PREVENT LAYOUT SHIFT */
    /* .back-to-topics-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        gap: 0.2rem;
        padding: 0 0.5rem;
        background: white;
        border: 1px solid #ddd;
        border-radius: 4px;
        color: #001d35;
        font-size: 0.875rem;
        font-family: 'Google Sans', Arial, sans-serif;
        font-weight: 500;
        cursor: pointer;
        margin-right: 0.75rem;
        transition: all 0.2s;
        height: 28px;
        min-width: 28px;
    }
    
        min-width: 28px;
    }
    
    .back-to-topics-btn:hover:not(:disabled) {
        background: #f8f9fa;
        border-color: #bbb;
    }
    
    .back-to-topics-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }
    
    .back-to-topics-btn svg {
        width: 16px;
        height: 16px;
    } */
    
    /* Sub topics button - show on mobile - DISABLED */
    /* .sub-topics-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        padding: 0.35rem 0.75rem;
        background: white;
        border: 1px solid #ddd;
        border-radius: 9999px;
        color: #2c3e50;
        font-size: 12px;
        font-family: 'Google Sans', Arial, sans-serif;
        font-weight: 500;
        cursor: pointer;
        margin-right: 0.75rem;
        transition: all 0.2s;
    }
    
    .sub-topics-btn:hover:not(:disabled) {
        background: #f5f5f5;
        border-color: #bbb;
    }
    
    .sub-topics-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    } */
    
    /* Sub topics dropdown - below Sub button, flush left, half screen width */
    .sub-topics-dropdown {
        position: absolute;
        top: calc(100% + 0.25rem);
        left: 0;
        width: 50vw;
        max-height: calc(100vh - 120px);
        background: #f5f5f5;
        border: 1px solid #ddd;
        border-radius: 4px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        z-index: 1000;
        display: none;
        flex-direction: column;
        overflow-y: auto;
    }
    
    .sub-topics-dropdown.show {
        display: flex !important;
    }
    
    .sub-topics-dropdown-item {
        padding: 0.4rem 1rem;
        text-align: left;
        background: white;
        border: none;
        border-bottom: 1px solid #f0f0f0;
        color: #2c3e50;
        font-size: 0.9rem;
        cursor: pointer;
        transition: background 0.2s;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .sub-topics-dropdown-item:last-child {
        border-bottom: none;
    }
    
    .sub-topics-dropdown-item:hover {
        background: #f5f5f5;
    }
    
    .sub-topics-dropdown-item:active {
        background: #e0e0e0;
    }
    
    /* Adjust pane header for back button */
    .main-pane .pane-header {
        flex-wrap: wrap;
        gap: 0.5rem;
        position: relative;
    }
    
    .main-pane .header-buttons {
        flex: 1;
        min-width: 0;
    }
    
    /* Make topic items more touch-friendly - DISABLED TO PREVENT SPACING CHANGE */
    /* .topic-item {
        min-height: 44px;
        padding: 0.75rem 0.5rem;
    } */
    
    /* Hide icon buttons on mobile, show hamburger menu */
    .mono-btn,
    .format-style-btn,
    .format-style-caret,
    .math-btn,
    .url-btn,
    .image-btn,
    .emoji-btn,
    .table-btn,
    .fullpage-btn,
    .save-btn,
    .cancel-btn,
    .header-btn,
    .unformat-btn,
    .bullet-list-btn,
    .code-insert-btn {
        display: none !important;
    }
    
    /* Hide toolbar divider and groups after View/Edit buttons in mobile doc view */
    .header-buttons-left .toolbar-divider,
    .header-buttons-left .toolbar-group {
        display: none !important;
    }
    
    .mobile-menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        padding: 0.5rem;
        background: transparent;
        border: 1px solid #ddd;
        border-radius: 20px;
        cursor: pointer;
        color: #2c3e50;
    }
    
    .mobile-menu-btn:hover {
        background: #f5f5f5;
    }
    
    .mobile-menu-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .mobile-menu-dropdown {
        position: absolute;
        top: calc(100% + 0.25rem);
        right: 0;
        left: auto;
        min-width: 180px;
        max-width: 90vw;
        background: white;
        border: 1px solid #ddd;
        border-radius: 4px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        z-index: 1000;
        display: none;
        flex-direction: column;
    }
    
    .mobile-menu-dropdown.show {
        display: flex !important;
    }
    
    .mobile-menu-item {
        padding: 0.4rem 1rem;
        text-align: left;
        background: white;
        border: none;
        border-bottom: 1px solid #f0f0f0;
        color: #2c3e50;
        font-size: 0.9rem;
        cursor: pointer;
        transition: background 0.2s;
    }
    
    .mobile-menu-item:last-child {
        border-bottom: none;
    }
    
    .mobile-menu-item:hover {
        background: #f5f5f5;
    }
    
    .mobile-menu-item:active {
        background: #e0e0e0;
    }
    
    /* Keep View and Edit buttons visible on mobile */
    .view-btn,
    .edit-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    /* Hide Archive option on mobile */
    .archive-btn {
        display: none !important;
    }
    
    /* Make logo clickable on mobile */
    .logo {
        cursor: pointer;
    }
    
    /* Position header buttons relative for dropdown */
    .main-pane .header-buttons-right {
        position: relative;
    }
    
    /* Adjust search icon button position */
    .search-icon-btn {
        right: 0.5rem !important;
    }
    
    .clear-search-btn {
        right: 2.25rem !important;
    }
    
    /* Hide pane widths tab in settings dialog on mobile */
    #paneWidthsTab {
        display: none !important;
    }
    
    #paneWidthsContent {
        display: none !important;
    }
    
    /* Make topic order tab active by default on mobile */
    #topicOrderTab {
        display: block !important;
    }
    
    /* If only one tab is visible, make it full width */
    .settings-tabs {
        justify-content: center;
    }
    
    .settings-tabs button:only-of-type,
    .settings-tabs button:last-of-type:not(:first-of-type) {
        width: 100%;
    }
}

/* Responsive: Hide font dropdowns and show hamburger menu when toolbar wraps */
/* This is now controlled by JavaScript to detect actual wrapping */

/* Share icon styling - blue outline icon, no background, doesn't change on active */
.topic-share-icon {
    color: #0B57D0 !important;
    background-color: transparent !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
}

.topic-share-icon svg {
    color: #0B57D0 !important;
    fill: none !important;
    stroke: #0B57D0 !important;
    transform: translateY(1px);
}

/* Keep icon blue outline even when topic is active - no background circle */
/* Must override the .shared-icon.active rule which adds blue circle - use same specificity */
.topic-item.shared-topic.active .topic-share-icon:not(.admin-shared-icon),
.topic-item.active.shared-topic .topic-share-icon:not(.admin-shared-icon),
.topic-item.active .topic-share-icon {
    color: #0B57D0 !important;
    background-color: transparent !important;
    background: transparent !important;
    border-radius: 0 !important;
}

.topic-item.shared-topic.active .topic-share-icon:not(.admin-shared-icon) svg,
.topic-item.active.shared-topic .topic-share-icon:not(.admin-shared-icon) svg,
.topic-item.active .topic-share-icon svg {
    color: #0B57D0 !important;
    stroke: #0B57D0 !important;
    fill: none !important;
    transform: translateY(1px);
}

/* Dark mode for home2 page - white title */
html[data-theme="dark"] .site-title {
    color: #ffffff !important;
}

/* User Menu Dropdown for Mobile */
.user-menu-wrapper {
    position: relative;
}

.user-menu-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 10000;
    flex-direction: column;
    padding: 0.25rem 0;
}

.user-menu-dropdown.show {
    display: flex !important;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 1rem;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    color: #1f1f1f;
    font-size: 14px;
    width: 100%;
    transition: background-color 0.15s;
}

.user-menu-item:hover {
    background-color: #f5f5f5;
}

.user-menu-item svg {
    flex-shrink: 0;
    color: currentColor;
    stroke: currentColor;
}

.user-menu-item span {
    flex: 1;
}

/* Mobile: Hide desktop buttons, show dropdown */
@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }
    
    .user-menu-dropdown {
        display: none;
    }
    
    .user-menu-dropdown.show {
        display: flex !important;
    }
}

/* Desktop: Show dropdown when toggled */
@media (min-width: 769px) {
    .user-menu-dropdown {
        display: none;
    }
    
    .user-menu-dropdown.show {
        display: flex !important;
    }
}

/* Divider in user menu */
.user-menu-divider {
    height: 1px;
    background-color: #e0e0e0;
    margin: 0.25rem 0;
}

/* Topic Swipe Actions for Mobile */
.topic-item.swipeable {
    position: relative;
    transition: transform 0.3s ease;
    overflow: hidden;
}

.topic-swipe-actions {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    display: none;
    align-items: center;
    gap: 0;
    background: #f5f5f5;
    padding: 0 0.25rem;
    z-index: 10;
    border-left: 1px solid #e0e0e0;
}

.topic-swipe-actions.visible {
    display: flex;
}

.swipe-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 100%;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    color: var(--icon-fg);
    transition: background-color 0.15s;
}

.swipe-action-btn:hover {
    background-color: #e0e0e0;
}

.swipe-action-btn svg {
    width: 18px;
    height: 18px;
}

.swipe-delete {
    color: #d32f2f;
}

.swipe-edit {
    color: #1976d2;
}

.swipe-share {
    color: #388e3c;
}

.swipe-rename {
    color: #f57c00;
}

.swipe-sticky {
    color: #7b1fa2;
}

.swipe-unshare {
    color: #d32f2f;
}

/* Disable drag on mobile */
@media (max-width: 768px) {
    .topic-item.draggable .drag-handle {
        display: none;
    }
    
    .topic-item.draggable {
        cursor: default;
    }
    
    /* Hide sub-topics button on mobile */
    .sub-topics-btn {
        display: none !important;
    }
}

/* ═══════════════════════════════════════════════════════
   Responsive — 2 modes only: Web (≥ 768px) / Phone (< 768px)
   Body class added in phone mode: breakpoint-mobile
   ═══════════════════════════════════════════════════════ */

/* ── Web mode: all 3 panes visible, no back button ── */
body.app-page:not(.breakpoint-mobile) #leftPane,
body.app-page:not(.breakpoint-mobile) #middlePane,
body.app-page:not(.breakpoint-mobile) #mainPane {
    display: flex !important;
}

body.app-page:not(.breakpoint-mobile) .back-to-topics-btn {
    display: none !important;
}

/* ── Phone mode: single-pane switching ── */
body.app-page.breakpoint-mobile #middlePane {
    display: none !important;
    width: 0 !important;
    min-width: 0 !important;
}

/* Topics view: leftPane full width */
body.app-page.breakpoint-mobile #leftPane {
    width: 100% !important;
    min-width: 0 !important;
}

/* Document view: leftPane hidden, mainPane full width */
body.app-page.breakpoint-mobile #leftPane[style*="display: none"],
body.app-page.breakpoint-mobile #leftPane[style*="display:none"] {
    width: 0 !important;
    min-width: 0 !important;
}

body.app-page.breakpoint-mobile #mainPane[style*="display: flex"],
body.app-page.breakpoint-mobile #mainPane[style*="display:flex"] {
    width: 100% !important;
    min-width: 0 !important;
    flex: 1 !important;
}

body.app-page.breakpoint-mobile .hamburger-menu-btn {
    display: none !important;
}

body.app-page.breakpoint-mobile .topic-mobile-menu-icon {
    display: flex !important;
}

body.app-page.breakpoint-mobile .topic-item:has(.topic-mobile-menu-icon) .topic-item-text {
    max-width: calc(100% - 60px);
}

body.app-page.breakpoint-mobile .docs-content-wrapper,
body.app-page.breakpoint-mobile #docsContent .docs-content-wrapper,
body.app-page.breakpoint-mobile .pane-content .docs-content-wrapper {
    background-color: transparent !important;
    padding: 0 !important;
}

body.app-page.breakpoint-mobile .docs-viewer,
body.app-page.breakpoint-mobile .docs-editor {
    max-width: 100% !important;
}

/* Back button – same light blue as Edit / View-Save */
body.app-page.breakpoint-mobile .back-to-topics-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    padding: 0 0.75rem;
    background: #a8d4f0;
    border: 1px solid #7eb8e0;
    border-radius: 20px;
    color: #174ea6;
    font-size: 0.875rem;
    font-family: 'Google Sans', Arial, sans-serif;
    font-weight: 500;
    cursor: pointer;
    margin-right: 0.75rem;
    transition: background 0.2s, border-color 0.2s;
    height: 34px;
    min-width: 34px;
}

body.app-page.breakpoint-mobile .back-to-topics-btn:hover:not(:disabled) {
    background: #8fc9ed;
    border-color: #5aa3d9;
}

body.app-page.breakpoint-mobile .back-to-topics-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #d2e3fc;
    border-color: #d2e3fc;
}

body.app-page.breakpoint-mobile .back-to-topics-btn svg {
    width: 16px;
    height: 16px;
    stroke: #174ea6;
}

/* Mobile: same underline tabs as desktop */
body.app-page.breakpoint-mobile .topics-tab {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 4px 8px 6px;
    margin-bottom: 0;
    color: #6b6560;
}

body.app-page.breakpoint-mobile .topics-tab.active {
    background: transparent;
    color: var(--snail-brown);
}

body.app-page.breakpoint-mobile .topics-tab:hover {
    opacity: 1;
    background: transparent;
    color: var(--snail-brown);
}

body.app-page.breakpoint-mobile .topics-tab.active:hover {
    background: transparent;
}

/* Toaster Styles */
.toaster-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    pointer-events: none;
}

.toaster {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 300px;
    max-width: 500px;
    pointer-events: auto;
    animation: toasterSlideIn 0.3s ease-out;
    font-family: var(--font-family-default);
    font-size: 14px;
    line-height: 1.5;
}

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

.toaster.toaster-hiding {
    animation: toasterSlideOut 0.3s ease-in forwards;
}

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

.toaster-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.toaster-message {
    flex: 1;
}

.toaster-dismiss {
    color: #8EB9FF;
    text-decoration: underline;
    cursor: pointer;
    font-size: 13px;
    opacity: 0.9;
    transition: opacity 0.2s;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font-family: inherit;
}

.toaster-dismiss:hover {
    opacity: 1;
}

/* Toaster Color Variants */
.toaster-red {
    background-color: #323232;
    border: 2px solid #000000;
    color: white;
}

.toaster-green {
    background-color: #323232;
    border: 2px solid #000000;
    color: white;
}

.toaster-orange {
    background-color: #323232;
    border: 2px solid #000000;
    color: white;
}

.toaster-white {
    background-color: #323232;
    border: 2px solid #000000;
    color: white;
}

.toaster-purple {
    background-color: #323232;
    border: 2px solid #000000;
    color: white;
}

.toaster-blue {
    background-color: #323232;
    border: 2px solid #000000;
    color: white;
}

/* Log in / Sign up dialog (editor overlay; /signin and /register stay as pages) */
.auth-dialog {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000001;
}

.auth-dialog.show {
    display: block;
}

.auth-dialog-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(69, 65, 60, 0.45);
}

.auth-dialog-card {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 420px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
    overflow: auto;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    padding: 28px 24px 24px;
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.08),
        0 12px 32px rgba(0, 0, 0, 0.18);
    box-sizing: border-box;
}

.auth-dialog-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #6b6560;
    cursor: pointer;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.auth-dialog-close:hover {
    background: #f4f1ea;
    color: var(--snail-brown);
}

.auth-dialog-card h2 {
    margin: 0 0 6px;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--snail-brown);
}

.auth-dialog-sub {
    margin: 0 0 18px;
    font-size: 0.95rem;
    color: #6b6560;
}

.auth-dialog .error-message {
    display: none;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 16px;
}

.auth-dialog .error-message.show {
    display: block;
}

.auth-dialog .success-message {
    display: none;
    background: #e6f4ea;
    border: 1px solid #c6e7d0;
    color: #1e8e3e;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 16px;
}

.auth-dialog .success-message.show {
    display: block;
}

.auth-dialog label.reg-label {
    position: static;
    display: block;
    transform: none;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--snail-brown);
    margin-bottom: 6px;
    top: auto;
    left: auto;
    pointer-events: auto;
    cursor: default;
}

.auth-dialog .account-input-wrapper,
.auth-dialog .account-input-wrapper2 {
    width: auto;
    display: block;
    border: none;
    border-radius: 0;
    padding: 0;
    margin-bottom: 14px;
}

.auth-dialog .account-input-wrapper input,
.auth-dialog .account-input-wrapper2 input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid #d4cfc6;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--snail-brown);
    background: #fff;
    box-sizing: border-box;
}

.auth-dialog .account-input-wrapper input:focus,
.auth-dialog .account-input-wrapper2 input:focus {
    outline: none;
    border-color: var(--snail-shell-deep);
    box-shadow: 0 0 0 3px rgba(193, 122, 78, 0.2);
}

.auth-dialog .account-input-wrapper.error input,
.auth-dialog .account-input-wrapper2.error input {
    border-color: #dc2626;
}

.auth-dialog .field-password {
    position: relative;
}

.auth-dialog .field-password input {
    padding-right: 44px;
}

.auth-dialog .secret-masked {
    -webkit-text-security: disc;
}

.auth-dialog .password-toggle-btn {
    position: absolute;
    right: 8px;
    bottom: 6px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    color: #6b6560;
    cursor: pointer;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.auth-dialog .password-toggle-btn:hover {
    color: var(--snail-brown);
    background: #f4f1ea;
}

.auth-dialog .password-toggle-eye-off {
    display: none;
}

.auth-dialog .password-toggle-btn.is-showing .password-toggle-eye {
    display: none;
}

.auth-dialog .password-toggle-btn.is-showing .password-toggle-eye-off {
    display: block;
}

.auth-dialog-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 4px 0 18px;
}

.auth-dialog .reg-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--snail-brown);
    cursor: pointer;
    user-select: none;
}

.auth-dialog .reg-checkbox-input {
    width: 16px;
    height: 16px;
    accent-color: var(--snail-shell-deep);
}

.auth-dialog .signin-forgot-password {
    font-size: 0.875rem;
    color: var(--snail-shell-deep);
    text-decoration: none;
}

.auth-dialog .signin-forgot-password:hover {
    text-decoration: underline;
}

.auth-dialog-hint {
    margin: -8px 0 14px;
    font-size: 0.8rem;
    color: #6b6560;
}

.auth-dialog-legal {
    margin: 0 0 16px;
    font-size: 0.8rem;
    color: #6b6560;
}

.auth-dialog-legal a {
    color: var(--snail-shell-deep);
}

.auth-dialog-submit {
    width: 100%;
    height: 44px;
    border: 0;
    border-radius: 8px;
    background: var(--snail-shell-deep);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    position: relative;
}

.auth-dialog-submit:hover {
    background: var(--snail-shell-hover);
}

.auth-dialog-submit-gold {
    background: var(--snail-gold);
    border: 1px solid transparent;
    color: var(--snail-brown);
}

.auth-dialog-submit-gold:hover {
    background: var(--snail-gold-hover);
    border-color: transparent;
}

.auth-dialog-submit-gold.loading::after {
    border-color: var(--snail-brown);
    border-top-color: transparent;
}

.auth-dialog-submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.auth-dialog-submit.loading {
    pointer-events: none;
    color: transparent !important;
}

.auth-dialog-submit.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: auth-dialog-spinner 0.6s linear infinite;
}

@keyframes auth-dialog-spinner {
    to { transform: rotate(360deg); }
}

.auth-dialog-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: #94a3b8;
    font-size: 0.8rem;
}

.auth-dialog-divider::before,
.auth-dialog-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e8e4dc;
}

.auth-google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 44px;
    border: 1px solid #d4cfc6;
    border-radius: 8px;
    background: #fff;
    color: var(--snail-brown);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    box-sizing: border-box;
}

.auth-google-btn:hover {
    background: #fff5e3;
    border-color: var(--snail-shell);
}

.auth-google-btn img {
    width: 20px;
    height: 20px;
}

.auth-dialog-switch {
    margin: 18px 0 0;
    text-align: center;
    font-size: 0.9rem;
    color: #6b6560;
}

.auth-dialog-text-btn {
    border: none;
    background: none;
    padding: 0;
    color: var(--snail-shell-deep);
    font-size: inherit;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}

.auth-dialog-text-btn:hover {
    text-decoration: underline;
}

/* ============================================================
   BLUE THEME — component overrides
   Variables above cover most of the app; these are the pieces
   whose colours are hardcoded in the default (snail) rules.
   ============================================================ */

/* Create button: green, as it was before the snail rebrand */
html[data-theme="blue"] .actions-btn {
    background: #c8e6c9;
    border-color: transparent;
    color: #1b5e20;
    box-shadow: none;
}

html[data-theme="blue"] .actions-btn:hover {
    background: #b9debb;
    box-shadow: none;
}

html[data-theme="blue"] .actions-btn:active {
    background: #a5d6a7;
    box-shadow: none;
}


/* ============================================================
   DARK THEME — layered surfaces
   dk-0 window · dk-1 header · dk-2 panes · dk-3 document
   dk-4 popovers/inputs · dk-5 hover · dk-6 selected
   ============================================================ */

html[data-theme="dark"] body,
html[data-theme="dark"] .app-container,
html[data-theme="dark"] .app-container::before,
html[data-theme="dark"] #page-loading-overlay {
    background: var(--dk-0);
    color: var(--dk-text);
}

html[data-theme="dark"] .app-header {
    background: var(--dk-1);
    color: var(--dk-text);
}

html[data-theme="dark"] .app-title,
html[data-theme="dark"] .app-header h1.app-title,
html[data-theme="dark"] .brand-lockup .brand-name {
    color: var(--dk-text-bright);
}

/* --- Header search --- */
html[data-theme="dark"] .header-search {
    background: var(--dk-4);
    border-color: var(--dk-line-strong);
    color: var(--dk-text);
}

html[data-theme="dark"] .header-search::placeholder {
    color: var(--dk-text-dim);
}

html[data-theme="dark"] .header-search:focus {
    background: var(--dk-5);
    border-color: var(--dk-line-strong);
    color: var(--dk-text-bright);
}

html[data-theme="dark"] .search-icon-btn,
html[data-theme="dark"] .clear-search-btn {
    color: var(--dk-text-dim);
}

/* --- Header icon buttons --- */
html[data-theme="dark"] .settings-icon-btn,
html[data-theme="dark"] .admin-icon-btn,
html[data-theme="dark"] .user-profile-btn,
html[data-theme="dark"] .hamburger-menu-btn,
html[data-theme="dark"] .help-icon-btn,
html[data-theme="dark"] .report-issue-icon-btn,
html[data-theme="dark"] .archive-icon-btn,
html[data-theme="dark"] .signoff-icon-btn,
html[data-theme="dark"] .theme-menu-btn {
    color: var(--dk-text-bright) !important;
}

html[data-theme="dark"] .settings-icon-btn:hover,
html[data-theme="dark"] .admin-icon-btn:hover,
html[data-theme="dark"] .user-profile-btn:hover,
html[data-theme="dark"] .hamburger-menu-btn:hover {
    background-color: var(--dk-5);
}

html[data-theme="dark"] .header-right svg,
html[data-theme="dark"] .settings-icon-btn svg,
html[data-theme="dark"] .admin-icon-btn svg,
html[data-theme="dark"] .user-profile-btn svg,
html[data-theme="dark"] .hamburger-menu-btn svg,
html[data-theme="dark"] .help-icon-btn svg,
html[data-theme="dark"] .report-issue-icon-btn svg,
html[data-theme="dark"] .archive-icon-btn svg,
html[data-theme="dark"] .signoff-icon-btn svg,
html[data-theme="dark"] .theme-menu-btn svg,
html[data-theme="dark"] .user-menu-item svg {
    color: var(--dk-text-bright) !important;
    stroke: var(--dk-text-bright) !important;
}

html[data-theme="dark"] .user-profile-btn .profile-initials {
    background: var(--dk-accent) !important;
    color: #1b1b1b !important;
}

html[data-theme="dark"] .theme-menu-btn {
    color: var(--dk-text-bright) !important;
}

html[data-theme="dark"] .theme-menu-btn:hover {
    background-color: var(--dk-5);
}

html[data-theme="dark"] .theme-menu {
    background: var(--dk-4);
    border-color: var(--dk-line-strong);
}

html[data-theme="dark"] .theme-menu-item {
    color: var(--dk-text);
}

html[data-theme="dark"] .theme-menu-item:hover {
    background-color: var(--dk-5);
}

html[data-theme="dark"] .theme-menu-item[aria-checked="true"] .theme-menu-name {
    color: var(--dk-text-bright);
}

html[data-theme="dark"] .theme-menu-check {
    color: #3794ff;
}

html[data-theme="dark"] .theme-menu-dot {
    border-color: rgba(255, 255, 255, 0.35);
}

html[data-theme="dark"] .demo-auth-link {
    color: var(--dk-text);
    border-color: var(--dk-line-strong);
    background: transparent;
}

html[data-theme="dark"] .demo-auth-link:hover {
    background: var(--dk-5);
    border-color: var(--dk-line-strong);
    color: var(--dk-text-bright);
}

html[data-theme="dark"] .demo-auth-link-primary,
html[data-theme="dark"] .demo-auth-link-primary:hover {
    background: var(--dk-btn);
    border-color: var(--dk-btn);
    color: #fff;
}

html[data-theme="dark"] .demo-auth-link-primary:hover {
    background: var(--dk-btn-hover);
    border-color: var(--dk-btn-hover);
}

/* --- Panes --- */
html[data-theme="dark"] .pane,
html[data-theme="dark"] .left-pane,
html[data-theme="dark"] .middle-pane {
    border-color: var(--dk-line);
}

html[data-theme="dark"] .pane-header,
html[data-theme="dark"] .left-pane .pane-header,
html[data-theme="dark"] .middle-pane .pane-header,
html[data-theme="dark"] .main-pane .pane-header {
    background: var(--dk-2) !important;
    color: var(--dk-text);
}

html[data-theme="dark"] .left-pane .pane-content,
html[data-theme="dark"] .middle-pane .pane-content {
    background: var(--dk-2) !important;
    color: var(--dk-text);
}

html[data-theme="dark"] .system-folders-bar {
    background: var(--dk-1);
    border-top-color: var(--dk-line);
}

html[data-theme="dark"] .system-folders-bar .folder-tree-item,
html[data-theme="dark"] .system-folders-bar .topic-item {
    background: var(--dk-1);
}

html[data-theme="dark"] .system-folders-bar .folder-tree-item:hover,
html[data-theme="dark"] .system-folders-bar .topic-item:hover {
    background: var(--dk-5);
}

/* --- Tree rows --- */
html[data-theme="dark"] span.fancytree-node,
html[data-theme="dark"] .folder-tree-item {
    background: var(--dk-2);
}

html[data-theme="dark"] span.fancytree-node:hover,
html[data-theme="dark"] .folder-tree-item:hover,
html[data-theme="dark"] .topic-item:hover,
html[data-theme="dark"] .subtopic-item:hover {
    background: var(--app-hover) !important;
}

html[data-theme="dark"] span.fancytree-node.fancytree-active,
html[data-theme="dark"] .topic-item.active,
html[data-theme="dark"] .subtopic-item.active {
    background: var(--app-active) !important;
    color: var(--dk-text-bright) !important;
}

html[data-theme="dark"] #systemFoldersBar .topic-item.shared-topic,
html[data-theme="dark"] #systemFoldersBar .topic-item.shared-topic.admin-shared-topic {
    background: var(--dk-1) !important;
}

html[data-theme="dark"] #systemFoldersBar .topic-item.shared-topic:hover,
html[data-theme="dark"] #systemFoldersBar .topic-item.shared-topic.admin-shared-topic:hover {
    background: var(--dk-5) !important;
}

html[data-theme="dark"] #systemFoldersBar .topic-item.shared-topic.active,
html[data-theme="dark"] #systemFoldersBar .topic-item.shared-topic.admin-shared-topic.active {
    background: var(--dk-6) !important;
    color: var(--dk-text-bright) !important;
}

html[data-theme="dark"] #fancytree li.fancytree-active > span.fancytree-node.shared-doc-node,
html[data-theme="dark"] #fancytree span.fancytree-node.fancytree-active.shared-doc-node,
html[data-theme="dark"] #fancytree span.fancytree-node[data-shared="true"].fancytree-active,
html[data-theme="dark"] #fancytree li.fancytree-active > span.fancytree-node.shared-doc-node span.fancytree-title,
html[data-theme="dark"] #fancytree span.fancytree-node.fancytree-active.shared-doc-node span.fancytree-title {
    background: #1e3a54 !important;
    color: var(--dk-text-bright) !important;
}

html[data-theme="dark"] #fancytree li.fancytree-active > span.fancytree-node.sticky-doc-node,
html[data-theme="dark"] #fancytree span.fancytree-node.fancytree-active.sticky-doc-node,
html[data-theme="dark"] #fancytree li.fancytree-active > span.fancytree-node.sticky-doc-node span.fancytree-title,
html[data-theme="dark"] #fancytree span.fancytree-node.fancytree-active.sticky-doc-node span.fancytree-title {
    background: #3d3820 !important;
    color: var(--dk-text-bright) !important;
}

html[data-theme="dark"] #fancytree li.fancytree-active > span.fancytree-node.admin-shared-doc-node,
html[data-theme="dark"] #fancytree span.fancytree-node.fancytree-active.admin-shared-doc-node,
html[data-theme="dark"] #fancytree li.fancytree-active > span.fancytree-node.admin-shared-doc-node span.fancytree-title,
html[data-theme="dark"] #fancytree span.fancytree-node.fancytree-active.admin-shared-doc-node span.fancytree-title {
    background: #3a2a42 !important;
    color: var(--dk-text-bright) !important;
}

html[data-theme="dark"] .topic-item.shared-topic.active {
    background: var(--dk-6) !important;
    color: var(--dk-text-bright) !important;
}

html[data-theme="dark"] .topic-item.shared-topic.admin-shared-topic {
    background: #2a2430 !important;
    color: var(--dk-text) !important;
}

html[data-theme="dark"] .topic-item.shared-topic.admin-shared-topic:hover {
    background: #3a2a42 !important;
}

html[data-theme="dark"] .topic-item.shared-topic.admin-shared-topic.active {
    background: #3a2a42 !important;
    color: var(--dk-text-bright) !important;
}

html[data-theme="dark"] span.fancytree-title,
html[data-theme="dark"] .topic-item,
html[data-theme="dark"] .subtopic-item,
html[data-theme="dark"] .topics-tab,
html[data-theme="dark"] .folder-tree-item {
    color: var(--dk-text) !important;
}

html[data-theme="dark"] .topic-item,
html[data-theme="dark"] .subtopic-item,
html[data-theme="dark"] .folder-tree-item {
    background: var(--dk-2) !important;
}

html[data-theme="dark"] .search-results-label {
    color: var(--dk-text-dim);
    border-top-color: var(--dk-line);
}

html[data-theme="dark"] .topic-rename-input {
    background: var(--dk-3);
    border-color: #1a73e8;
    color: var(--dk-text);
}

html[data-theme="dark"] .topics-tab:hover,
html[data-theme="dark"] .topics-tab.active {
    color: var(--dk-text-bright) !important;
}

html[data-theme="dark"] .topics-tab.active::after {
    background: var(--dk-text-bright);
}

html[data-theme="blue"] .topics-tab-search-icon .search-result-line-accent {
    stroke: #36A0F4;
}

html[data-theme="dark"] .topics-tab-search-icon {
    color: var(--dk-text);
}

html[data-theme="dark"] .topics-tab.active .topics-tab-search-icon,
html[data-theme="dark"] .topics-tab:hover .topics-tab-search-icon {
    color: var(--dk-text-bright);
}

html[data-theme="dark"] .topics-tab-search-icon .search-result-line-accent {
    stroke: var(--dk-text-bright);
}

/* Expander +/- circles: light stroke so they read on dark rows */
html[data-theme="dark"] span.fancytree-expander:before {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6" fill="none" stroke="%239a9a9a" stroke-width="1.5"/><line x1="5" y1="8" x2="11" y2="8" stroke="%239a9a9a" stroke-width="1.5"/><line x1="8" y1="5" x2="8" y2="11" stroke="%239a9a9a" stroke-width="1.5"/></svg>');
}

html[data-theme="dark"] span.fancytree-expanded > span.fancytree-expander:before {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6" fill="none" stroke="%239a9a9a" stroke-width="1.5"/><line x1="5" y1="8" x2="11" y2="8" stroke="%239a9a9a" stroke-width="1.5"/></svg>');
}

html[data-theme="dark"] #fancytree span.fancytree-node .fancytree-drag-handle {
    color: var(--dk-text-dim);
}

html[data-theme="dark"] .folder-tree-item-trash > .folder-icon,
html[data-theme="dark"] .folder-tree-item-shared > .folder-icon {
    color: var(--dk-text);
}

html[data-theme="dark"] #tree::-webkit-scrollbar-track {
    background: var(--dk-2);
}

html[data-theme="dark"] #tree::-webkit-scrollbar-thumb {
    background: var(--dk-line-strong);
}

html[data-theme="dark"] div.fancytree-drag-helper {
    background: var(--dk-4);
    color: var(--dk-text);
}

html[data-theme="dark"] span.fancytree-drag-source > span.fancytree-node {
    background: var(--dk-5);
}

/* --- Create / View / Edit buttons --- */
html[data-theme="dark"] .actions-btn,
html[data-theme="dark"] .doc-mode-btn {
    background: var(--dk-4) !important;
    border-color: var(--dk-line-strong) !important;
    color: var(--dk-text) !important;
}

html[data-theme="dark"] .actions-btn:hover {
    background: var(--dk-5) !important;
}

html[data-theme="dark"] #editModeBtn,
html[data-theme="dark"] #editModeBtn.active,
html[data-theme="dark"] #editModeBtn.active:hover {
    background: var(--edit-btn-bg) !important;
    color: var(--edit-btn-text) !important;
}

html[data-theme="dark"] #viewModeBtn:disabled,
html[data-theme="dark"] #editModeBtn:disabled,
html[data-theme="dark"] .doc-mode-btn:disabled {
    background: var(--dk-2) !important;
    border-color: var(--dk-line) !important;
    color: var(--dk-text-dim) !important;
    box-shadow: none !important;
}


/* --- Editor toolbar --- */
html[data-theme="dark"] .new-toolbar .format-btn,
html[data-theme="dark"] .save-btn,
html[data-theme="dark"] .cancel-btn,
html[data-theme="dark"] .sub-topics-btn,
html[data-theme="dark"] .back-to-topics-btn,
html[data-theme="dark"] .doc-toolbar-hamburger-btn,
html[data-theme="dark"] .font-settings-menu-btn {
    color: var(--dk-text);
}

html[data-theme="dark"] .new-toolbar .format-btn svg,
html[data-theme="dark"] .save-btn svg:not(#saveCheckmarkIcon),
html[data-theme="dark"] .cancel-btn svg,
html[data-theme="dark"] #saveFloppyIcon {
    color: var(--dk-text-bright);
    stroke: var(--dk-text-bright);
}

html[data-theme="dark"] .save-btn {
    background: transparent !important;
    color: var(--dk-text-bright) !important;
}

html[data-theme="dark"] .new-toolbar .format-btn:hover:not(:disabled),
html[data-theme="dark"] .save-btn:hover,
html[data-theme="dark"] .cancel-btn:hover,
html[data-theme="dark"] .sub-topics-btn:hover,
html[data-theme="dark"] .back-to-topics-btn:hover {
    background: var(--dk-5) !important;
}

html[data-theme="dark"] .new-toolbar .format-btn:active:not(:disabled) {
    background: var(--dk-6) !important;
}

html[data-theme="dark"] .toolbar-divider {
    background-color: var(--dk-line-strong);
}

/* --- Document surface --- */
html[data-theme="dark"] .docs-content-wrapper {
    background-color: var(--dk-0);
}

html[data-theme="dark"] .docs-viewer {
    background-color: var(--dk-3);
    color: var(--dk-text) !important;
}

html[data-theme="dark"] .docs-viewer h3,
html[data-theme="dark"] .docs-viewer h1,
html[data-theme="dark"] .docs-viewer h2,
html[data-theme="dark"] .docs-viewer h4,
html[data-theme="dark"] .docs-viewer .subtopic-anchor {
    color: var(--dk-text-bright) !important;
}

/* Editor keeps a warm tint so edit mode still reads differently from view */
html[data-theme="dark"] .docs-editor {
    background-color: #2b2620;
    color: var(--dk-text) !important;
}

html[data-theme="dark"] .docs-viewer a {
    color: #7cb7f0;
}

html[data-theme="dark"] .find-controls {
    background: var(--dk-1);
    border-top-color: var(--dk-line);
    color: var(--dk-text);
}

html[data-theme="dark"] .find-btn,
html[data-theme="dark"] .find-counter {
    background: var(--dk-4);
    border-color: var(--dk-line-strong);
    color: var(--dk-text);
}

/* --- Rendered BBCode --- */
html[data-theme="dark"] .bbcode-table-title {
    color: var(--dk-text-bright);
}

html[data-theme="dark"] .bbcode-table thead {
    background-color: var(--dk-4);
}

html[data-theme="dark"] .bbcode-table th {
    border-bottom-color: var(--dk-line-strong);
}

html[data-theme="dark"] .bbcode-table td {
    border-bottom-color: var(--dk-line);
}

html[data-theme="dark"] .bbcode-table tbody tr:hover {
    background-color: var(--dk-4);
}

/* --- Popovers: dropdowns, context menus --- */
html[data-theme="dark"] .create-dropdown,
html[data-theme="dark"] .bullet-list-dropdown,
html[data-theme="dark"] .format-style-dropdown,
html[data-theme="dark"] .math-dropdown,
html[data-theme="dark"] .image-dropdown,
html[data-theme="dark"] .highlight-dropdown,
html[data-theme="dark"] .user-menu-dropdown,
html[data-theme="dark"] .sub-topics-dropdown,
html[data-theme="dark"] .context-menu,
html[data-theme="dark"] .mobile-menu-dropdown,
html[data-theme="dark"] .font-settings-menu {
    background: var(--dk-4);
    color: var(--dk-text);
    border-color: var(--dk-line-strong);
}

html[data-theme="dark"] .dropdown-item,
html[data-theme="dark"] .bullet-list-item,
html[data-theme="dark"] .format-style-item,
html[data-theme="dark"] .math-item,
html[data-theme="dark"] .image-item,
html[data-theme="dark"] .highlight-item,
html[data-theme="dark"] .user-menu-item,
html[data-theme="dark"] .context-menu-item,
html[data-theme="dark"] .mobile-menu-item {
    color: var(--dk-text) !important;
    background: transparent;
}

html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .bullet-list-item:hover,
html[data-theme="dark"] .format-style-item:hover,
html[data-theme="dark"] .math-item:hover,
html[data-theme="dark"] .image-item:hover,
html[data-theme="dark"] .highlight-item:hover,
html[data-theme="dark"] .user-menu-item:hover,
html[data-theme="dark"] .context-menu-item:hover,
html[data-theme="dark"] .mobile-menu-item:hover {
    background: var(--dk-5) !important;
}

html[data-theme="dark"] .user-menu-divider,
html[data-theme="dark"] .mobile-menu-divider,
html[data-theme="dark"] .math-dropdown-divider,
html[data-theme="dark"] .format-style-dropdown-divider {
    background: var(--dk-line-strong);
    border-color: var(--dk-line-strong);
}

/* --- Dialogs --- */
html[data-theme="dark"] .dialog,
html[data-theme="dark"] .create-dialog,
html[data-theme="dark"] .delete-dialog,
html[data-theme="dark"] .rename-dialog,
html[data-theme="dark"] .archive-dialog,
html[data-theme="dark"] .settings-dialog,
html[data-theme="dark"] .image-gallery-dialog,
html[data-theme="dark"] .emoji-picker-content,
html[data-theme="dark"] .dialog-content,
html[data-theme="dark"] .auth-dialog-panel {
    background: var(--dk-4) !important;
    color: var(--dk-text);
}

html[data-theme="dark"] .dialog-content h2,
html[data-theme="dark"] .settings-content h2,
html[data-theme="dark"] .gallery-header,
html[data-theme="dark"] .emoji-picker-header {
    background-color: var(--dk-2) !important;
    color: var(--dk-text-bright);
    border-bottom-color: var(--dk-line);
}

html[data-theme="dark"] .dialog label,
html[data-theme="dark"] .form-group label,
html[data-theme="dark"] .settings-group label,
html[data-theme="dark"] .font-section-title {
    color: var(--dk-text);
}

html[data-theme="dark"] .custom-sort-info {
    background-color: var(--dk-3);
    border-left-color: #3794ff;
    color: var(--dk-text-bright);
}

html[data-theme="dark"] .settings-tabs,
html[data-theme="dark"] .gallery-tabs {
    border-bottom-color: var(--dk-line-strong);
}

html[data-theme="dark"] .settings-tab,
html[data-theme="dark"] .gallery-tab {
    color: var(--dk-text-dim);
}

html[data-theme="dark"] .settings-tab.active,
html[data-theme="dark"] .gallery-tab.active {
    color: var(--dk-text-bright);
}

/* --- Inputs --- */
html[data-theme="dark"] input[type="text"]:not(.header-search),
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .font-select-dropdown,
html[data-theme="dark"] .font-base-select,
html[data-theme="dark"] .mobile-menu-select,
html[data-theme="dark"] .settings-group select,
html[data-theme="dark"] .settings-group select:disabled {
    background: var(--dk-3);
    background-color: var(--dk-3);
    border-color: var(--dk-line-strong);
    color: var(--dk-text-bright);
    color-scheme: dark;
}

html[data-theme="dark"] .settings-group select:disabled {
    opacity: 0.75;
    cursor: not-allowed;
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
    color: var(--dk-text-dim);
}

html[data-theme="dark"] .btn-secondary,
html[data-theme="dark"] .auto-btn,
html[data-theme="dark"] .pagination-btn,
html[data-theme="dark"] .upload-btn,
html[data-theme="dark"] .save-template-btn,
html[data-theme="dark"] .duplicate-template-btn,
html[data-theme="dark"] .reset-template-btn,
html[data-theme="dark"] .create-font-btn {
    background: var(--dk-3);
    border-color: var(--dk-line-strong);
    color: var(--dk-text);
}

html[data-theme="dark"] .upload-area {
    background: var(--dk-3);
    border-color: var(--dk-line-strong);
}

html[data-theme="dark"] .upload-text,
html[data-theme="dark"] .upload-text-small,
html[data-theme="dark"] .pagination-info {
    color: var(--dk-text-dim);
}

/* --- Scrollbars --- */
html[data-theme="dark"] ::-webkit-scrollbar-track {
    background: var(--dk-2);
}

html[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: var(--dk-line-strong);
}

html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #565656;
}

html[data-theme="dark"] .auth-dialog-backdrop {
    background: rgba(0, 0, 0, 0.55);
}

html[data-theme="dark"] .auth-dialog-card {
    background: var(--dk-4) !important;
    border-color: var(--dk-line-strong);
    color: var(--dk-text);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

html[data-theme="dark"] .auth-dialog-card h2 {
    color: var(--dk-text-bright);
}

html[data-theme="dark"] .auth-dialog-sub,
html[data-theme="dark"] .auth-dialog-hint,
html[data-theme="dark"] .auth-dialog-legal,
html[data-theme="dark"] .auth-dialog-switch,
html[data-theme="dark"] .auth-dialog label.reg-label {
    color: var(--dk-text-dim);
}

html[data-theme="dark"] .auth-dialog-close {
    color: var(--dk-text-dim);
}

html[data-theme="dark"] .auth-dialog-close:hover {
    background: var(--dk-5);
    color: var(--dk-text-bright);
}

html[data-theme="dark"] .auth-dialog .account-input-wrapper input,
html[data-theme="dark"] .auth-dialog .account-input-wrapper2 input {
    background: var(--dk-3);
    border-color: var(--dk-line-strong);
    color: var(--dk-text);
}

html[data-theme="dark"] .auth-dialog .account-input-wrapper input:focus,
html[data-theme="dark"] .auth-dialog .account-input-wrapper2 input:focus {
    border-color: #3794ff;
}

html[data-theme="dark"] .auth-dialog .password-toggle-btn {
    color: var(--dk-text-dim);
}

html[data-theme="dark"] .auth-dialog .password-toggle-btn:hover {
    background: var(--dk-5);
    color: var(--dk-text-bright);
}

html[data-theme="dark"] .auth-dialog .signin-forgot-password,
html[data-theme="dark"] .auth-dialog-legal a,
html[data-theme="dark"] .auth-dialog-text-btn {
    color: #7cb7f0;
}

html[data-theme="dark"] .auth-dialog-divider {
    color: var(--dk-text-dim);
}

html[data-theme="dark"] .auth-dialog-divider::before,
html[data-theme="dark"] .auth-dialog-divider::after {
    background: var(--dk-line-strong);
}

html[data-theme="dark"] .auth-google-btn {
    background: var(--dk-3);
    border-color: var(--dk-line-strong);
    color: var(--dk-text);
}

html[data-theme="dark"] .auth-google-btn:hover {
    background: var(--dk-5);
    border-color: var(--dk-line-strong);
}

html[data-theme="dark"] .auth-dialog .error-message {
    background: #3a2020;
    border-color: #6b3030;
    color: #f0a0a0;
}

html[data-theme="dark"] .auth-dialog .success-message {
    background: #1e3324;
    border-color: #2d5a3a;
    color: #8fd4a2;
}

html[data-theme="dark"] .auth-dialog-submit,
html[data-theme="dark"] .auth-dialog-submit-gold {
    background: var(--dk-btn);
    border-color: var(--dk-btn);
    color: #fff;
}

html[data-theme="dark"] .auth-dialog-submit:hover,
html[data-theme="dark"] .auth-dialog-submit-gold:hover {
    background: var(--dk-btn-hover);
    border-color: var(--dk-btn-hover);
    color: #fff;
}

/* --- Dark mode: popovers, native selects, leftover light text --- */
html[data-theme="dark"] {
    color-scheme: dark;
}

html[data-theme="dark"] .doc-toolbar-hamburger-dropdown,
html[data-theme="dark"] .font-settings-menu-dropdown,
html[data-theme="dark"] .table-picker,
html[data-theme="dark"] .folder-context-menu,
html[data-theme="dark"] .font-context-menu {
    background: var(--dk-4) !important;
    color: var(--dk-text-bright) !important;
    border-color: var(--dk-line-strong) !important;
}

html[data-theme="dark"] .doc-toolbar-hamburger-dropdown .font-settings-menu-item label,
html[data-theme="dark"] .font-settings-menu-item label,
html[data-theme="dark"] .table-picker-header-row,
html[data-theme="dark"] .table-picker-size,
html[data-theme="dark"] .table-picker-cancel {
    color: var(--dk-text-bright) !important;
}

html[data-theme="dark"] .table-picker-cancel {
    background: var(--dk-3) !important;
    border-color: var(--dk-line-strong) !important;
}

html[data-theme="dark"] .font-select-dropdown,
html[data-theme="dark"] .doc-toolbar-hamburger-dropdown .font-select-dropdown,
html[data-theme="dark"] #docToolbarFontSelect,
html[data-theme="dark"] #docToolbarTabSpaceSelect,
html[data-theme="dark"] #docToolbarPageMarginSelect,
html[data-theme="dark"] #regularFontSelect,
html[data-theme="dark"] #regularFontSelectMobile,
html[data-theme="dark"] #tabSpaceSelectMobile,
html[data-theme="dark"] #pageMarginSelectMobile,
html[data-theme="dark"] select {
    background: var(--dk-3) !important;
    background-color: var(--dk-3) !important;
    color: var(--dk-text-bright) !important;
    border-color: var(--dk-line-strong) !important;
}

html[data-theme="dark"] .font-select-dropdown:hover,
html[data-theme="dark"] .font-select-dropdown:focus {
    background: var(--dk-5) !important;
    color: var(--dk-text-bright) !important;
}

html[data-theme="dark"] .bullet-list-item,
html[data-theme="dark"] .bullet-list-item span,
html[data-theme="dark"] .format-style-item,
html[data-theme="dark"] .format-style-item span,
html[data-theme="dark"] .math-item,
html[data-theme="dark"] .math-item span,
html[data-theme="dark"] .image-item,
html[data-theme="dark"] .image-item span,
html[data-theme="dark"] .highlight-item,
html[data-theme="dark"] .highlight-item span,
html[data-theme="dark"] .create-dropdown .dropdown-item,
html[data-theme="dark"] .create-dropdown .dropdown-item span,
html[data-theme="dark"] .doc-toolbar-hamburger-dropdown .toolbar-menu-item,
html[data-theme="dark"] .doc-toolbar-hamburger-dropdown .toolbar-menu-item span,
html[data-theme="dark"] .sub-topics-dropdown-item,
html[data-theme="dark"] .user-menu-item,
html[data-theme="dark"] .user-menu-item span {
    color: var(--dk-text-bright) !important;
}

html[data-theme="dark"] .doc-toolbar-hamburger-dropdown .toolbar-menu-item:hover {
    background: var(--dk-5) !important;
}

html.theme-booting .doc-mode-btn,
html.theme-booting #editModeBtn,
html.theme-booting #viewModeBtn {
    transition: none !important;
}

#page-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-bg);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.15s ease-out;
    pointer-events: none;
}

#page-loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.demo-auth-link {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--snail-brown);
    text-decoration: none;
    margin-right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid var(--snail-blush);
    background: transparent;
    box-sizing: border-box;
}

.demo-auth-link:hover {
    text-decoration: none;
    background: var(--snail-cream-light);
    border-color: var(--snail-shell);
}

.demo-auth-link-primary {
    background: var(--snail-shell-deep);
    color: #fff;
    border-color: var(--snail-shell-deep);
    margin-right: 12px;
}

.demo-auth-link-primary:hover {
    background: var(--snail-shell-hover);
    border-color: var(--snail-shell-hover);
}

#demoFullOverlay {
    position: fixed;
    inset: 0;
    z-index: 1000000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(247, 229, 198, 0.92);
    padding: 24px;
}

#demoFullOverlay[hidden] {
    display: none;
}

.demo-full-card {
    max-width: 28rem;
    background: var(--snail-cream-light);
    border: 1px solid var(--snail-blush);
    border-radius: 8px;
    padding: 1.5rem 1.75rem;
    color: var(--snail-brown);
}

.demo-full-card p {
    margin-bottom: 1rem;
    line-height: 1.5;
}

.demo-full-card a {
    color: var(--snail-shell-deep);
    font-weight: 600;
}

#settingsDialog {
    width: 440px;
}

#settingsDialog .settings-content form,
#settingsDialog .settings-tab-content,
#settingsDialog #paneWidthsContent,
#settingsDialog #topicOrderContent {
    min-height: 0;
    height: auto;
}

html[data-theme="dark"] #settingsDialog {
    color-scheme: dark;
}

html[data-theme="dark"] #settingsDialog .settings-group select,
html[data-theme="dark"] #settingsDialog .settings-group select:disabled,
html[data-theme="dark"] #settingsDialog .settings-group input {
    background: var(--input-bg);
    color: var(--input-text);
    border-color: var(--dk-line-strong);
}

html[data-theme="dark"] #settingsDialog .custom-sort-info {
    background-color: var(--dk-3);
    border-left-color: #3794ff;
    color: var(--dk-text-bright);
}

html[data-theme="dark"] .dialog-buttons button,
html[data-theme="dark"] #settingsDialog .settings-buttons button,
html[data-theme="dark"] #settingsDialog .auto-btn,
html[data-theme="dark"] .dialog-buttons button.btn-destructive,
html[data-theme="dark"] #deleteConfirmBtn,
html[data-theme="dark"] #deleteFolderConfirmBtn,
html[data-theme="dark"] #confirmDialogConfirmBtn {
    background: var(--dk-4);
    color: var(--dk-text);
    border: 1px solid var(--dk-line-strong);
}

html[data-theme="dark"] .dialog-buttons button:hover,
html[data-theme="dark"] #settingsDialog .settings-buttons button:hover:not(:disabled),
html[data-theme="dark"] #settingsDialog .auto-btn:hover:not(:disabled) {
    background: var(--dk-5);
    border-color: var(--dk-line-strong);
}

html[data-theme="dark"] .dialog-buttons button.btn-primary,
html[data-theme="dark"] #settingsDialog .settings-buttons button.btn-primary,
html[data-theme="dark"] #settingsDialog #saveCloseBtn,
html[data-theme="dark"] #createSaveBtn,
html[data-theme="dark"] #renameSaveBtn,
html[data-theme="dark"] #createFolderSaveBtn,
html[data-theme="dark"] #archiveExportBtn {
    background: var(--edit-btn-bg);
    border: none;
    color: var(--edit-btn-text);
}

html[data-theme="dark"] #demoFullOverlay {
    background: rgba(20, 20, 20, 0.92);
}

/* Leftover light surfaces that only appear in some modes (search, Shared, menus, editor) */
.list-empty {
    padding: 1rem;
    text-align: center;
    color: #555;
}

html[data-theme="dark"] #topicsList,
html[data-theme="dark"] #fancytree,
html[data-theme="dark"] ul.fancytree-container,
html[data-theme="dark"] .shared-topics-footer,
html[data-theme="dark"] .shared-topics-container,
html[data-theme="dark"] .main-pane .pane-content {
    background: var(--dk-2) !important;
    color: var(--dk-text);
}

html[data-theme="dark"] .shared-topics-label,
html[data-theme="dark"] .sticky-topics-label,
html[data-theme="dark"] .admin-topics-label,
html[data-theme="dark"] .search-results-label,
html[data-theme="dark"] .system-folders-bar .folder-item-count {
    color: var(--dk-text-dim) !important;
    border-color: var(--dk-line) !important;
}

html[data-theme="dark"] .topics-separator {
    background: var(--dk-line) !important;
}

html[data-theme="dark"] .actions-menu,
html[data-theme="dark"] .action-item {
    background: var(--dk-4) !important;
    color: var(--dk-text-bright) !important;
    border-color: var(--dk-line-strong) !important;
}

html[data-theme="dark"] .action-item:hover {
    background: var(--dk-5) !important;
}

html[data-theme="dark"] .list-empty {
    color: var(--dk-text-dim) !important;
}

html[data-theme="dark"] .dialog p,
html[data-theme="dark"] .dialog small,
html[data-theme="dark"] .create-dialog p,
html[data-theme="dark"] .create-dialog small,
html[data-theme="dark"] .delete-dialog p,
html[data-theme="dark"] .rename-dialog p,
html[data-theme="dark"] .archive-dialog p,
html[data-theme="dark"] .settings-dialog p,
html[data-theme="dark"] .settings-dialog small {
    color: var(--dk-text-dim) !important;
}

html[data-theme="dark"] .view-btn.active {
    background: var(--dk-4) !important;
    color: var(--dk-text-bright) !important;
    border-color: var(--dk-line-strong) !important;
}

html[data-theme="dark"] .delete-selected-btn {
    background: var(--dk-3) !important;
    color: var(--dk-text) !important;
}

html[data-theme="dark"] .sceditor-container,
html[data-theme="dark"] .sceditor-container iframe {
    background: #2b2620 !important;
}

html[data-theme="dark"] .topic-item.drag-invalid {
    background: #3a2020 !important;
}

html[data-theme="dark"] .view-codebox {
    background: var(--dk-4);
    color: var(--dk-text);
}

html[data-theme="dark"] .view-comment {
    border-left-color: var(--dk-line-strong);
    color: var(--dk-text-dim);
}

html[data-theme="dark"] .bbcode-table,
html[data-theme="dark"] .bbcode-table caption,
html[data-theme="dark"] .bbcode-table th,
html[data-theme="dark"] .bbcode-table td {
    color: var(--dk-text) !important;
}

html[data-theme="dark"] .fancytree-title-text,
html[data-theme="dark"] #fancytree span.fancytree-node .fancytree-drag-handle {
    color: var(--dk-text) !important;
}

html[data-theme="dark"] div.fancytree-drag-helper {
    background: var(--dk-4) !important;
    color: var(--dk-text-bright) !important;
}
