:root {
    /* Colors - Light Theme (vibrant but professional) */
    --color-bg-primary: #ffffff;
    --color-bg-secondary: #f8fafc;
    --color-bg-tertiary: #e2e8f0;
    --color-accent-primary: #dc2626;
    --color-accent-success: #10b981;
    --color-accent-warning: #f59e0b;
    --color-accent-info: #0ea5e9;
    --color-text-primary: #0f172a;
    --color-text-muted: #64748b;
    --color-border: #cbd5e1;

    /* Spacing */
    --spacing-sm: 4px;
    --spacing-md: 8px;
    --spacing-lg: 12px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.2s ease;

    /* Layout */
    --sidebar-width: 300px;
    --panel-width: 400px;
}

* {
    box-sizing: border-box;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Top Bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 48px;
    background: var(--color-bg-primary);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}
.app-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-accent-primary);
    text-decoration: none;
    letter-spacing: -0.3px;
}
.app-title:hover {
    opacity: 0.8;
}
/* Top Bar Right Section */
.top-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.user-email {
    font-size: 12px;
    color: var(--color-text-muted);
    padding: 6px 12px;
    background: var(--color-bg-secondary);
    border-radius: 16px;
}
/* Top bar actions dropdown styling */
.top-bar .actions-trigger {
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    background: var(--color-accent-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.top-bar .actions-trigger:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}
.top-bar .actions-trigger .dropdown-arrow {
    margin-left: 4px;
    font-size: 10px;
}
.top-bar .dropdown-menu {
    min-width: 180px;
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.login-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.login-container {
    background: var(--color-bg-primary);
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.login-container h2 {
    margin: 0 0 30px 0;
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    color: var(--color-text-primary);
}
.login-field {
    margin-bottom: 16px;
}
.login-field input {
    width: 100%;
    padding: 12px 14px;
    font-size: 14px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.login-field input:focus {
    outline: none;
    border-color: var(--color-accent-primary);
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.15);
}
.login-field input::placeholder {
    color: var(--color-text-muted);
}
.login-error {
    background: rgba(233, 69, 96, 0.1);
    border: 1px solid var(--color-accent-primary);
    color: var(--color-accent-primary);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
}
.login-submit-btn {
    width: 100%;
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
    background: var(--color-accent-primary);
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}
.login-submit-btn:hover {
    background: #d63651;
}
.login-submit-btn:active {
    transform: scale(0.98);
}
.login-submit-btn:disabled {
    background: var(--color-text-muted);
    cursor: not-allowed;
}

/* App Container */
.app-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-bg-secondary);
    padding: 0;
    overflow: visible;
    border-right: 1px solid var(--color-border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

/* Sidebar Edge Toggle */
.sidebar-toggle {
    position: absolute;
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 20px;
    height: 56px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-left: none;
    color: var(--color-text-muted);
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
}
.sidebar-toggle:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    border-color: var(--color-accent-info);
    width: 24px;
}

.sidebar.collapsed {
    width: 0;
    min-width: 0;
    overflow: hidden;
    border-right: none;
}
.sidebar.collapsed .tree-view,
.sidebar.collapsed .status,
.sidebar.collapsed .controls,
.sidebar.collapsed .prompts-drawer-container,
.sidebar.collapsed .sidebar-toggle {
    opacity: 0;
    pointer-events: none;
}

.sidebar-expand-btn {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    z-index: 10;
    width: 20px;
    height: 56px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-left: none;
    color: var(--color-text-muted);
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    font-size: 12px;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
}
.sidebar-expand-btn:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    border-color: var(--color-accent-info);
    width: 24px;
}
.sidebar.collapsed ~ .main-content .sidebar-expand-btn {
    display: flex;
}

/* Tree View */
.tree-view {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.tree-section {
    margin-bottom: 2px;
}

.tree-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    background: rgba(0,0,0,0.04);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 11px;
    user-select: none;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    color: var(--color-text-muted);
    transition: all 0.15s ease;
}

.tree-header:hover {
    background: rgba(0,0,0,0.08);
    color: var(--color-text-primary);
}

.section-icon {
    font-size: 12px;
}

.section-title {
    flex: 1;
}

.tree-header .add-btn {
    width: 22px;
    height: 22px;
    padding: 0;
    background: var(--color-bg-tertiary);
    border: none;
    color: var(--color-text-primary);
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.tree-header:hover .add-btn {
    opacity: 1;
}

.tree-header .add-btn:hover {
    background: var(--color-accent-primary);
}

.tree-header .add-btn.folder-btn {
    margin-left: 4px;
    font-size: 12px;
}

.tree-content {
    margin-left: 6px;
    padding-left: 6px;
    border-left: 1px solid var(--color-border);
    margin-top: 4px;
}

.tree-children {
    margin-left: 12px;
    padding-left: 6px;
    border-left: 1px solid var(--color-border);
    margin-top: 1px;
}

.tree-item {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 6px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    user-select: none;
    margin: 1px 0;
    transition: all 0.12s ease;
    border-left: 2px solid transparent;
}

.tree-item:hover {
    background: rgba(0,0,0,0.05);
    border-left-color: rgba(0,0,0,0.2);
}

.tree-item.selected {
    background: rgba(233, 69, 96, 0.15);
    border-left-color: var(--color-accent-primary);
    color: var(--color-accent-primary);
}

.tree-item.folder-item {
    color: #555;
}

.tree-item.folder-item:hover {
    color: #222;
}

.tree-item.run-item {
    font-size: 11px;
    color: #666;
    padding: 2px 6px;
}

.tree-item.run-item:hover {
    color: var(--color-text-primary);
}

.tree-item.run-item.selected {
    color: var(--color-accent-primary);
}

.tree-item.shared-item {
    border-left: 2px solid var(--color-accent-info);
    margin-left: 0;
    padding-left: 10px;
}

.tree-item.prompt-tree-item {
    border-left: 2px solid var(--color-accent-warning);
    margin-left: 0;
    padding-left: 10px;
}

.tree-item.prompt-tree-item:hover {
    background: rgba(249, 168, 38, 0.15);
}

.expand-icon {
    width: 14px;
    min-width: 14px;
    text-align: center;
    font-size: 9px;
    color: var(--color-text-muted);
}

.expand-spacer {
    width: 8px;
    min-width: 8px;
}

.item-icon {
    font-size: 12px;
}

.item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-count {
    font-size: 10px;
    color: #666;
    background: var(--color-bg-tertiary);
    padding: 2px 6px;
    border-radius: 10px;
}

.item-meta {
    font-size: 10px;
    color: #666;
    white-space: nowrap;
}

.tree-empty {
    color: #666;
    font-size: 12px;
    padding: 10px;
    font-style: italic;
}

/* Run button in tree */
.run-btn-inline {
    padding: 2px 6px;
    background: var(--color-accent-primary);
    border: none;
    color: white;
    border-radius: 3px;
    font-size: 10px;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.tree-item:hover .run-btn-inline {
    opacity: 1;
}

.run-btn-inline:hover {
    background: #d63651;
}

/* Status badges */
.status-badge {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 8px;
    text-transform: uppercase;
    white-space: nowrap;
    letter-spacing: 0.5px;
}
.status-badge.pending {
    background: var(--color-accent-warning);
    color: var(--color-bg-primary);
    font-weight: 600;
}
.status-badge.processing {
    background: var(--color-accent-info);
    color: var(--color-bg-primary);
    font-weight: 600;
    animation: pulse 1.5s infinite;
}
.status-badge.ready {
    background: var(--color-accent-success);
    color: var(--color-bg-primary);
    font-weight: 600;
}
.status-badge.error {
    background: var(--color-accent-primary);
    color: #fff;
}

/* Prompts Drawer */
.prompts-drawer-container {
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}

.prompts-drawer {
    background: rgba(0,0,0,0.02);
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    user-select: none;
}

.drawer-header:hover {
    background: rgba(0,0,0,0.04);
}

.drawer-toggle {
    font-size: 10px;
    color: var(--color-text-muted);
}

.drawer-content {
    max-height: 180px;
    overflow-y: auto;
    padding: 0 10px 10px 10px;
}

.prompt-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    margin-bottom: 4px;
}

.prompt-item:hover {
    background: rgba(0,0,0,0.06);
}

.prompt-item.selected {
    background: rgba(233, 69, 96, 0.2);
}

.prompt-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.default-badge {
    font-size: 9px;
    background: var(--color-accent-primary);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 8px;
}

.tree-subsection-header {
    font-size: 10px;
    color: #666;
    padding: 8px 8px 4px 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.shared-prompt-item {
    border-left: 2px solid var(--color-accent-info);
    margin-left: 0;
    padding-left: 8px !important;
}

.shared-from {
    font-size: 9px;
    color: #666;
    margin-left: 8px;
}

.share-btn {
    background: var(--color-accent-info) !important;
    color: white !important;
}
.share-btn:hover {
    background: #0891b2 !important;
}

.modal-small {
    max-width: 400px;
}

.modal-wide {
    width: 600px;
    max-width: 90%;
}

/* Run History Modal */
.run-history-content {
    padding: 15px 20px;
    max-height: 400px;
    overflow-y: auto;
}

.run-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.run-history-table th,
.run-history-table td {
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.run-history-table th {
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 11px;
    text-transform: uppercase;
}

.run-history-table tr:hover {
    background: rgba(0, 0, 0, 0.04);
}

.run-history-table .prompt-cell {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--color-text-muted);
    cursor: help;
}

.run-history-table .prompt-cell-full {
    max-width: 300px;
    white-space: pre-wrap;
    word-break: break-word;
    color: #444;
    font-size: 12px;
    line-height: 1.4;
    font-size: 11px;
}

.run-history-table .action-btn {
    padding: 4px 10px;
    background: var(--color-bg-tertiary);
    border: none;
    color: var(--color-text-primary);
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    margin-right: 4px;
}

.run-history-table .action-btn:hover {
    background: var(--color-accent-primary);
}

.run-history-table .action-btn.danger {
    background: transparent;
    color: var(--color-accent-primary);
    border: 1px solid var(--color-accent-primary);
}

.run-history-table .action-btn.danger:hover {
    background: var(--color-accent-primary);
    color: white;
}

.add-prompt-btn {
    width: 100%;
    margin-top: 4px;
    padding: 8px;
    background: transparent;
    border: 1px dashed #bbb;
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
    transition: all var(--transition-normal);
}

.add-prompt-btn:hover {
    border-color: var(--color-accent-primary);
    color: var(--color-accent-primary);
}

/* Prompt preview in run modal */
.prompt-preview-container {
    margin-top: 10px;
}
.prompt-preview {
    padding: 12px;
    background: var(--color-bg-tertiary);
    border-radius: 6px;
    font-size: 12px;
    color: #444;
    white-space: pre-wrap;
    max-height: 150px;
    overflow-y: auto;
    border-left: 3px solid var(--color-accent-warning);
}
.copy-prompt-btn {
    margin-top: 8px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--color-accent-warning);
    color: var(--color-accent-warning);
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}
.copy-prompt-btn:hover {
    background: rgba(249, 168, 38, 0.1);
}

/* Controls */
.controls {
    padding: 14px 18px;
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}
.controls label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 13px;
    cursor: pointer;
}
.controls input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--color-accent-primary);
}
.controls input[type="range"] {
    width: 100%;
    height: 6px;
    accent-color: var(--color-accent-primary);
}

/* Status */
.status {
    font-size: 11px;
    color: var(--color-accent-success);
    padding: 5px 15px;
    flex-shrink: 0;
}
.status.error { color: var(--color-accent-primary); }

/* Main content */
.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}
.toolbar {
    background: var(--color-bg-secondary);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--color-border);
    flex-wrap: wrap;
    flex-shrink: 0;
}
.toolbar button {
    background: var(--color-bg-tertiary);
    border: 1px solid transparent;
    color: var(--color-text-primary);
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 12px;
}
.toolbar button:hover {
    background: rgba(0,0,0,0.08);
    border-color: rgba(0,0,0,0.1);
    transform: scale(1.02);
}
.toolbar button:active {
    transform: scale(0.96);
}

/* Zoom Controls */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-btn {
    width: 32px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.zoom-slider {
    width: 100px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--color-border);
    border-radius: 2px;
    cursor: pointer;
}

.zoom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--color-accent-info);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s ease;
}

.zoom-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.zoom-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--color-accent-info);
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

.zoom-label {
    font-size: 12px;
    color: var(--color-text-muted);
    min-width: 40px;
    text-align: right;
}

/* Toolbar Dropdowns */
.toolbar-dropdown {
    position: relative;
}

.dropdown-trigger {
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--color-text-primary);
    transition: all 0.15s ease;
}

.dropdown-trigger:hover {
    background: rgba(0,0,0,0.08);
    border-color: rgba(0,0,0,0.15);
    transform: scale(1.02);
}
.dropdown-trigger:active {
    transform: scale(0.96);
}

.dropdown-trigger.open {
    background: var(--color-bg-tertiary);
    border-color: var(--color-accent-info);
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.15);
}

.dropdown-arrow {
    font-size: 10px;
    color: var(--color-text-muted);
    transition: transform 0.15s ease;
}

.dropdown-trigger.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    min-width: 140px;
    z-index: 100;
    padding: 4px;
    animation: dropdownFadeIn 0.15s ease;
}

.dropdown-menu.open {
    display: block;
}

.dropdown-menu-right {
    left: auto;
    right: 0;
}

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

.dropdown-item {
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.12s ease;
}

.dropdown-item:hover {
    background: var(--color-bg-tertiary);
}

.dropdown-item.active {
    background: rgba(6, 182, 212, 0.1);
    color: var(--color-accent-info);
}

.dropdown-item-icon {
    font-size: 12px;
    width: 16px;
    text-align: center;
}

.dropdown-divider {
    height: 1px;
    background: var(--color-border);
    margin: 4px 0;
}

/* Actions dropdown trigger styling */
.actions-trigger {
    background: var(--color-accent-info);
    border-color: var(--color-accent-info);
    color: white;
    font-weight: 500;
}

.actions-trigger:hover {
    background: #0891b2;
    border-color: #0891b2;
}

.actions-trigger.open {
    background: #0891b2;
    border-color: #0e7490;
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
}

.actions-trigger .dropdown-arrow {
    color: rgba(255,255,255,0.8);
}

/* Run action in dropdown */
.dropdown-item.run-action {
    color: var(--color-accent-primary);
    font-weight: 500;
}

.dropdown-item.run-action:hover {
    background: rgba(233, 69, 96, 0.1);
}

/* Doc info styling - removed, no longer used */

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.toast {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 12px 16px;
    min-width: 280px;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.success {
    border-color: var(--color-accent-success);
}

.toast.error {
    border-color: var(--color-accent-primary);
}

.toast.processing {
    border-color: var(--color-accent-info);
}

.toast-icon {
    font-size: 18px;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 12px;
    color: var(--color-text-muted);
}

.toast-close {
    background: rgba(0,0,0,0.08);
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 4px;
    margin-left: 8px;
}

.toast-close:hover {
    background: rgba(0,0,0,0.15);
    color: var(--color-text-primary);
}

@keyframes slideIn {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-100%);
        opacity: 0;
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.toolbar span {
    font-size: 13px;
}
.page-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}
.doc-name-display {
    flex: 1;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
    margin: 0 auto;
}
.doc-name-display:empty {
    display: none;
}
.view-area {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Viewer section - wrapper for toolbar + viewer container */
.viewer-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    position: relative;
}
.viewer-container {
    flex: 1;
    overflow: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #f0f0f0;
    background-image: radial-gradient(rgba(0,0,0,0.04) 1px, transparent 1px);
    background-size: 20px 20px;
}
.pages-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}
.page-wrapper {
    position: relative;
    scroll-margin-top: 10px;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
}
.page-wrapper:not(:last-child)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--color-accent-primary);
    opacity: 0.4;
}
.page-wrapper canvas {
    display: block;
}

/* Page placeholder for lazy loading */
.page-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface-secondary, #f5f5f5);
    border: 1px dashed var(--color-border, #ddd);
}
.page-placeholder-text {
    color: var(--color-text-muted, #888);
    font-size: 14px;
}

.page-label {
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: var(--color-text-muted);
    white-space: nowrap;
}
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--color-text-muted);
}

/* Viewer Loading Spinner */
.viewer-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px 32px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}
.viewer-loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--color-bg-tertiary);
    border-top-color: var(--color-accent-info);
    border-radius: 50%;
    animation: viewer-spin 0.8s linear infinite;
}
.viewer-loading-text {
    font-size: 13px;
    color: var(--color-text-muted);
}
@keyframes viewer-spin {
    to { transform: rotate(360deg); }
}
.viewer-container.is-loading {
    pointer-events: none;
    opacity: 0.6;
}

/* Markdown panel */
.markdown-panel {
    width: 400px;
    background: var(--color-bg-secondary);
    border-left: 1px solid var(--color-border);
    overflow-y: auto;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}
.markdown-panel.hidden {
    display: none;
}
.markdown-tabs {
    display: flex;
    background: var(--color-bg-tertiary);
    border-bottom: 1px solid var(--color-bg-primary);
    flex-shrink: 0;
}
.tab-btn {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.15s ease;
    position: relative;
}
.tab-btn:hover {
    color: var(--color-text-primary);
    background: rgba(0,0,0,0.04);
}
.tab-btn.active {
    color: var(--color-accent-info);
    background: rgba(6, 182, 212, 0.08);
    border-bottom: 2px solid var(--color-accent-info);
}
.tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
}
.tab-content.active {
    display: flex;
    flex-direction: column;
    position: relative;
}
.page-badge {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: var(--color-accent-primary);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    box-shadow: 0 4px 12px rgba(233, 69, 96, 0.4);
    z-index: 10;
    pointer-events: none;
}
.page-badge:empty {
    display: none;
}
.markdown-content {
    padding: 15px;
    font-size: 13px;
    line-height: 1.6;
    flex: 1;
    overflow-y: auto;
}
.markdown-content h1, .markdown-content h2, .markdown-content h3,
.markdown-content h4, .markdown-content h5, .markdown-content h6 {
    margin-top: 0.5em;
    margin-bottom: 0.3em;
}
.markdown-content h1 { font-size: 1.4em; }
.markdown-content h2 { font-size: 1.25em; }
.markdown-content h3 { font-size: 1.1em; }
.markdown-content h4 { font-size: 1em; }
.markdown-content p { margin: 0.8em 0; }
.markdown-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
    font-size: 12px;
    display: block;
    overflow-x: auto;
}
.markdown-content th, .markdown-content td {
    border: 1px solid var(--color-border);
    padding: 6px 8px;
    text-align: left;
}
.markdown-content th { background: var(--color-bg-tertiary); }
.markdown-content code {
    background: var(--color-bg-tertiary);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}
.markdown-content pre {
    background: var(--color-bg-tertiary);
    padding: 10px;
    border-radius: 4px;
    overflow-x: auto;
}
.markdown-content ul, .markdown-content ol { padding-left: 1.5em; }
.markdown-content li { margin: 0.3em 0; }
.markdown-content a { color: var(--color-accent-success); }

/* Outline */
.outline-content {
    padding: 15px;
    font-size: 13px;
    overflow-y: auto;
}
.outline-item {
    padding: 8px 10px;
    margin: 4px 0;
    border-radius: 4px;
    cursor: pointer;
    border-left: 3px solid;
    background: rgba(0,0,0,0.02);
    transition: background 0.2s;
}
.outline-item:hover { background: rgba(0,0,0,0.06); }
.outline-item .header-level {
    font-family: monospace;
    opacity: 0.5;
    margin-right: 8px;
    font-size: 11px;
}
.outline-item .header-text { font-size: 13px; }
.outline-item .header-meta {
    font-size: 10px;
    color: #666;
    margin-top: 3px;
}
.outline-item.h1 { padding-left: 10px; font-weight: 600; }
.outline-item.h2 { padding-left: 20px; }
.outline-item.h3 { padding-left: 30px; }
.outline-item.h4 { padding-left: 40px; }
.outline-item.h5 { padding-left: 50px; }
.outline-item.h6 { padding-left: 60px; }

/* Chunk blocks */
.chunk-block {
    margin: 6px 0;
    padding: 10px 12px;
    border-radius: 8px;
    border-left: 3px solid;
    transition: all 0.15s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    cursor: pointer;
}
.chunk-block .chunk-meta {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}
.chunk-block .chunk-content h1,
.chunk-block .chunk-content h2,
.chunk-block .chunk-content h3,
.chunk-block .chunk-content h4,
.chunk-block .chunk-content h5,
.chunk-block .chunk-content h6 {
    color: var(--section-color, #e94560);
    font-weight: bold;
    margin: 0.5em 0;
}
.chunk-block .chunk-content h1 {
    font-size: 1.5em;
    border-bottom: 1px solid rgba(0,0,0,0.15);
    padding-bottom: 0.3em;
}
.chunk-block .chunk-content h2 {
    font-size: 1.3em;
}
.chunk-block .chunk-content h3 {
    font-size: 1.15em;
}
.chunk-block .chunk-content h4 {
    font-size: 1.05em;
}
.chunk-block .chunk-content h5,
.chunk-block .chunk-content h6 {
    font-size: 1em;
    font-style: italic;
}
.chunk-block:first-child { margin-top: 0; }

/* Grounding overlay */
.grounding-overlay {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 10;
}
.grounding-box {
    position: absolute;
    border: 2px solid;
    pointer-events: auto;
    cursor: pointer;
    transition: border-width 0.2s, box-shadow 0.2s;
}
.grounding-box:hover {
    border-width: 3px;
    box-shadow: 0 0 8px currentColor;
}
.grounding-box.highlighted {
    border-width: 3px;
    box-shadow: 0 0 12px currentColor;
}

/* Tooltip */
.tooltip {
    position: fixed;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    padding: 10px;
    border-radius: 6px;
    max-width: 400px;
    font-size: 12px;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.tooltip .chunk-type {
    color: var(--color-accent-primary);
    font-weight: 600;
    margin-bottom: 4px;
}
.tooltip .chunk-text {
    color: #444;
    max-height: 150px;
    overflow: hidden;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
}
.modal.active {
    opacity: 1;
    visibility: visible;
}
.modal-content {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    width: 400px;
    max-width: 90%;
    box-shadow: 0 16px 48px rgba(0,0,0,0.5);
    transform: translateY(-20px) scale(0.95);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal.active .modal-content {
    transform: translateY(0) scale(1);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--color-border);
}
.modal-header h3 { margin: 0; font-size: 16px; }
.close-btn {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}
.close-btn:hover { color: var(--color-accent-primary); }
.form-group {
    padding: 15px 20px;
}
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--color-text-muted);
}
.form-group input[type="text"],
.form-group input[type="file"],
.form-group input[type="email"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-bg-primary);
    color: var(--color-text-primary);
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-group textarea {
    resize: vertical;
    min-height: 60px;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-accent-primary);
}
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid var(--color-border);
}
.form-actions button {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 13px;
}
.form-actions button[type="submit"] {
    background: var(--color-accent-primary);
    color: white;
}
.form-actions button[type="button"] {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}
.form-actions button.danger-btn {
    background: var(--color-accent-primary);
    color: white;
}
.form-actions button:hover {
    opacity: 0.9;
    transform: scale(1.02);
}
.form-actions button:active {
    transform: scale(0.96);
}

/* Save prompt option in run modal */
.save-prompt-option {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--color-text-muted);
}
.save-prompt-option input[type="checkbox"] {
    accent-color: var(--color-accent-primary);
}

/* Context menu */
.context-menu {
    position: fixed;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    min-width: 180px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1001;
}
.menu-item {
    padding: 10px 15px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}
.menu-item:hover { background: rgba(0,0,0,0.08); }
.menu-item.danger { color: var(--color-accent-primary); }
.menu-item.danger:hover { background: rgba(233, 69, 96, 0.2); }
.menu-divider {
    height: 1px;
    background: var(--color-border);
    margin: 5px 0;
}

/* Focus-visible states */
button:focus-visible,
.tree-item:focus-visible,
.tab-btn:focus-visible,
.menu-item:focus-visible {
    outline: 2px solid var(--color-accent-info);
    outline-offset: 2px;
}

/* Empty state */
.empty-state {
    color: #666;
    font-size: 12px;
    text-align: center;
    padding: 20px;
}

/* Drag and drop */
.tree-item[draggable="true"] {
    cursor: grab;
    -webkit-user-drag: element;
}

.tree-item[draggable="true"]:active {
    cursor: grabbing;
}

.tree-item.dragging {
    opacity: 0.5;
    background: rgba(233, 69, 96, 0.15) !important;
}

.drop-zone {
    transition: background 0.15s, border 0.15s;
}

.drop-zone.drag-over {
    background: rgba(22, 199, 154, 0.2) !important;
    outline: 2px dashed var(--color-accent-success);
    outline-offset: -2px;
}

.tree-header.drop-zone.drag-over {
    background: rgba(22, 199, 154, 0.15) !important;
}

/* Sharing Filter Tabs */
.sharing-filters {
    display: flex;
    gap: 4px;
    padding: 8px 10px;
    background: rgba(0,0,0,0.04);
    border-radius: 4px;
    margin-bottom: 8px;
}

.filter-btn {
    flex: 1;
    padding: 6px 8px;
    font-size: 11px;
    background: transparent;
    border: 1px solid rgba(0,0,0,0.15);
    color: #666;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.filter-btn:hover {
    background: rgba(0,0,0,0.06);
    color: #333;
}

.filter-btn.active {
    background: var(--color-bg-tertiary);
    border-color: var(--color-accent-success);
    color: var(--color-accent-success);
}

/* Outgoing Shares */
.outgoing-share-item {
    background: rgba(0,0,0,0.02);
}

.recipient-item {
    font-size: 11px;
    padding-left: 24px !important;
}

.recipient-item .item-name {
    color: var(--color-text-muted);
}

.revoke-btn {
    width: 18px;
    height: 18px;
    padding: 0;
    margin-left: auto;
    background: transparent;
    border: none;
    color: var(--color-accent-primary);
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--transition-fast);
    border-radius: 4px;
}

.recipient-item:hover .revoke-btn {
    opacity: 1;
}

.revoke-btn:hover {
    background: rgba(233, 69, 96, 0.2);
}

/* Folder Drag Indicators */
.folder-item.dragging {
    opacity: 0.5;
    background: rgba(124, 58, 237, 0.2) !important;
}

.folder-item[draggable="true"] {
    cursor: grab;
}

.folder-item[draggable="true"]:active {
    cursor: grabbing;
}

/* ==================== New Features Styles ==================== */

/* Page Input */
.page-input {
    width: 50px;
    padding: 4px 6px;
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-bg-primary);
    color: var(--color-text-primary);
    border-radius: 4px;
    font-size: 13px;
    text-align: center;
    -moz-appearance: textfield;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.page-input::-webkit-outer-spin-button,
.page-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.page-input:focus {
    outline: none;
    border-color: var(--color-accent-primary);
}

/* Resize Handle */
.resize-handle {
    width: 6px;
    background: var(--color-border);
    cursor: col-resize;
    flex-shrink: 0;
    transition: background 0.2s;
    position: relative;
}
.resize-handle:hover,
.resize-handle.dragging {
    background: var(--color-accent-primary);
}
.resize-handle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 30px;
    background: rgba(0,0,0,0.2);
    border-radius: 1px;
}

/* Drop Overlay */
.drop-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 52, 96, 0.95);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.drop-overlay.active {
    display: flex;
    pointer-events: auto;
}
.drop-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: var(--color-text-primary);
    font-size: 24px;
    font-weight: 500;
}
.drop-icon {
    font-size: 64px;
    animation: bounce 1s ease infinite;
}
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Cell Popover */
.cell-popover {
    position: fixed;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 0;
    min-width: 300px;
    max-width: 450px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 1001;
}
.popover-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-secondary);
    border-radius: 8px 8px 0 0;
}
.popover-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--color-accent-primary);
}
.popover-close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}
.popover-close:hover {
    color: var(--color-accent-primary);
}
.popover-content {
    padding: 12px;
}
.popover-row {
    font-size: 12px;
    margin-bottom: 6px;
    color: #444;
}
.popover-row strong {
    color: var(--color-text-muted);
    margin-right: 6px;
}
.popover-markdown {
    background: var(--color-bg-tertiary);
    padding: 12px;
    border-radius: 6px;
    margin-top: 10px;
    max-height: 250px;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.5;
}
.popover-markdown h1, .popover-markdown h2, .popover-markdown h3,
.popover-markdown h4, .popover-markdown h5, .popover-markdown h6 {
    margin: 0.5em 0 0.3em;
    font-size: 1.1em;
}
.popover-markdown p { margin: 0.5em 0; }
.popover-markdown table {
    border-collapse: collapse;
    width: 100%;
    font-size: 11px;
    margin: 0.5em 0;
    display: block;
    overflow-x: auto;
}
.popover-markdown th, .popover-markdown td {
    border: 1px solid var(--color-border);
    padding: 4px 6px;
    text-align: left;
}
.popover-markdown th { background: var(--color-bg-secondary); }
.popover-markdown code {
    background: var(--color-bg-secondary);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 11px;
}
.popover-details {
    margin-top: 10px;
}
.popover-details summary {
    cursor: pointer;
    font-size: 11px;
    color: var(--color-text-muted);
    padding: 4px 0;
}
.popover-details summary:hover {
    color: var(--color-text-primary);
}
.popover-json {
    background: var(--color-bg-tertiary);
    padding: 10px;
    border-radius: 4px;
    font-size: 10px;
    max-height: 200px;
    overflow: auto;
    margin-top: 6px;
    color: #555;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Tables Tab Content */
.tables-content {
    padding: 15px;
    font-size: 13px;
    overflow-y: auto;
}
.table-section {
    margin-bottom: 16px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s;
}
.table-section:hover {
    border-color: var(--color-accent-info);
}
.table-section.highlighted {
    border-color: var(--color-accent-primary);
    box-shadow: 0 0 8px rgba(233, 69, 96, 0.3);
}
.table-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    color: #fff;
}
.table-section-header:hover {
    filter: brightness(1.1);
}
.table-section-meta {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.85);
}
.table-section-content {
    padding: 12px;
    background: var(--color-bg-secondary);
    overflow-x: auto;
}
.table-section-content table {
    border-collapse: collapse;
    width: 100%;
    font-size: 11px;
}
.table-section-content th,
.table-section-content td {
    border: 1px solid var(--color-border);
    padding: 6px 8px;
    text-align: left;
}
.table-section-content th {
    background: var(--color-bg-tertiary);
    font-weight: 600;
}

/* Merged chunks indicator in table headers */
.merged-chunks-indicator {
    display: block;
    font-size: 10px;
    color: var(--color-text-muted);
    font-weight: normal;
    margin-top: 2px;
}

/* Inline Edit */
.inline-edit {
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-accent-primary);
    color: var(--color-text-primary);
    padding: 2px 6px;
    font-size: 12px;
    border-radius: 3px;
    outline: none;
    width: 100%;
    max-width: 200px;
}

/* Table Cell Grounding Box */
.grounding-box.cell-box {
    border-style: solid;
    border-width: 0.5px;
    /* Inherits color from parent table chunk */
}
.grounding-box.cell-box:hover {
    border-width: 1.5px;
}

/* Loading skeleton */
.skeleton {
    background: linear-gradient(90deg, var(--color-bg-tertiary) 25%, var(--color-bg-secondary) 50%, var(--color-bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-line {
    height: 14px;
    margin: 8px 0;
}

.skeleton-line.short {
    width: 60%;
}

/* Custom scrollbars */
.tree-view::-webkit-scrollbar,
.markdown-content::-webkit-scrollbar,
.drawer-content::-webkit-scrollbar {
    width: 8px;
}
.tree-view::-webkit-scrollbar-track,
.markdown-content::-webkit-scrollbar-track,
.drawer-content::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.04);
}
.tree-view::-webkit-scrollbar-thumb,
.markdown-content::-webkit-scrollbar-thumb,
.drawer-content::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
    border-radius: 4px;
}
.tree-view::-webkit-scrollbar-thumb:hover,
.markdown-content::-webkit-scrollbar-thumb:hover,
.drawer-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.25);
}

/* Button press effects */
.toolbar button:active {
    transform: scale(0.98);
}

/* Responsive breakpoints */
@media (max-width: 900px) {
    .sidebar { width: 220px; }
    .markdown-panel { width: 300px; }
}

@media (max-width: 768px) {
    .app-container { flex-direction: column; }
    .sidebar { width: 100%; max-height: 40vh; }
    .markdown-panel { width: 100%; height: 40vh; }
    .resize-handle { display: none; }
}

/* Word-Match Tab Content */
.wordbbox-content {
    padding: 15px;
    font-size: 13px;
    overflow-y: auto;
}

/* Summary stats at top of Word-Match tab */
.wordbbox-summary {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--color-bg-tertiary);
    border-radius: 8px;
    margin-bottom: 16px;
}

.wordbbox-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wordbbox-stat .stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text-primary);
}

.wordbbox-stat .stat-label {
    font-size: 10px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wordbbox-stat-breakdown {
    display: flex;
    gap: 8px;
    font-size: 11px;
    margin-left: auto;
}

.wordbbox-stat-breakdown .conf-high {
    color: #4caf50;
}

.wordbbox-stat-breakdown .conf-med {
    color: #ff9800;
}

.wordbbox-stat-breakdown .conf-low {
    color: #f44336;
}

/* Page sections in Word-Match tab */
.wordbbox-page-section {
    margin-bottom: 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
}

.wordbbox-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--color-bg-tertiary);
    font-weight: 500;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s;
}

.wordbbox-page-header:hover {
    background: var(--color-border);
}

.wordbbox-page-count {
    font-size: 11px;
    color: var(--color-text-muted);
    font-weight: normal;
}

/* Words container - flex wrap for word flow */
.wordbbox-words-container {
    padding: 10px 12px;
    background: var(--color-bg-secondary);
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    line-height: 1.8;
}

/* Individual word styling */
.wordbbox-word {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

.wordbbox-word:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.wordbbox-word.selected {
    outline: 2px solid var(--color-accent-primary);
    outline-offset: 1px;
}

/* Confidence-based word colors */
.wordbbox-word.conf-high {
    background: rgba(76, 175, 80, 0.15);
    border-color: rgba(76, 175, 80, 0.3);
    color: #2e7d32;
}

.wordbbox-word.conf-high:hover {
    background: rgba(76, 175, 80, 0.25);
}

.wordbbox-word.conf-medium {
    background: rgba(255, 152, 0, 0.15);
    border-color: rgba(255, 152, 0, 0.3);
    color: #e65100;
}

.wordbbox-word.conf-medium:hover {
    background: rgba(255, 152, 0, 0.25);
}

.wordbbox-word.conf-low {
    background: rgba(244, 67, 54, 0.15);
    border-color: rgba(244, 67, 54, 0.3);
    color: #c62828;
}

.wordbbox-word.conf-low:hover {
    background: rgba(244, 67, 54, 0.25);
}

/* Legacy wordmatch section styles (keep for compatibility) */
.wordbbox-section {
    margin-bottom: 16px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
}

.wordbbox-section-header {
    padding: 10px 12px;
    background: var(--color-bg-tertiary);
    font-weight: 500;
    font-size: 13px;
}

.wordbbox-section-content {
    padding: 12px;
    background: var(--color-bg-secondary);
}

/* Word-match overlay on PDF */
.word-bbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 15;
}

.word-bbox-box {
    position: absolute;
    border: 1px solid;
    background: transparent;
    pointer-events: auto;
    cursor: pointer;
    transition: background 0.15s, border-width 0.15s;
}

.word-bbox-box:hover {
    border-width: 2px;
}

.word-bbox-box.highlighted {
    border-width: 2px;
    box-shadow: 0 0 8px currentColor;
}

/* Confidence-based box colors */
.word-bbox-box.high-confidence {
    border-color: #4caf50;
    background: rgba(76, 175, 80, 0.12);
}

.word-bbox-box.high-confidence:hover,
.word-bbox-box.high-confidence.highlighted {
    background: rgba(76, 175, 80, 0.25);
}

.word-bbox-box.medium-confidence {
    border-color: #ff9800;
    background: rgba(255, 152, 0, 0.12);
}

.word-bbox-box.medium-confidence:hover,
.word-bbox-box.medium-confidence.highlighted {
    background: rgba(255, 152, 0, 0.25);
}

.word-bbox-box.low-confidence {
    border-color: #f44336;
    background: rgba(244, 67, 54, 0.12);
}

.word-bbox-box.low-confidence:hover,
.word-bbox-box.low-confidence.highlighted {
    background: rgba(244, 67, 54, 0.25);
}

/* ========================================
   HIDDEN: Run/Prompt functionality disabled
   ======================================== */

/* Hide inline run buttons on tree items */
.run-btn-inline {
    display: none !important;
}

/* Hide run items in document tree */
.tree-item.run-item {
    display: none !important;
}

/* Hide any remaining prompts drawer styling */
.prompts-drawer-container,
.prompts-drawer {
    display: none !important;
}
