/* ==========================================================================
   Design Tokens & Root Setup
   ========================================================================== */
:root {
    /* Color Palette - Default (Dark) */
    --bg-primary: #0a0c10;
    --bg-surface: rgba(255, 255, 255, 0.03);
    --bg-surface-hover: rgba(255, 255, 255, 0.06);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(255, 255, 255, 0.15);
    
    --text-primary: #ffffff;
    --text-secondary: #8a8f98;
    --text-tertiary: #525866;
    
    /* Background Elements */
    --bg-header: rgba(10, 12, 16, 0.6);
    --bg-modal: rgba(20, 24, 33, 0.95);
    --bg-input: rgba(255, 255, 255, 0.03);
    
    /* Brand Accents */
    --accent-purple: #833ab4;
    --accent-indigo: #5d5fef;
    --accent-gradient: linear-gradient(135deg, #833ab4 0%, #fd1d1d 50%, #fcb045 100%);
    --purple-glow: rgba(131, 58, 180, 0.15);
    
    /* Core Action Colors */
    --color-blue: #007aff;
    --color-red: #ff3b30;
    --color-purple: #af52de;
    --color-green: #34c759;
    
    /* Fonts & Easing */
    --font-primary: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --ease-3d: cubic-bezier(0.25, 0.8, 0.25, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Light Theme Variables */
body.light-theme {
    --bg-primary: #f5f6f8;
    --bg-surface: rgba(255, 255, 255, 0.7);
    --bg-surface-hover: rgba(255, 255, 255, 0.9);
    --border-color: rgba(0, 0, 0, 0.09);
    --border-highlight: rgba(255, 255, 255, 0.95);
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    
    --bg-header: rgba(245, 246, 248, 0.65);
    --bg-modal: rgba(255, 255, 255, 0.96);
    --bg-input: rgba(0, 0, 0, 0.04);
    
    --purple-glow: rgba(131, 58, 180, 0.06);
}

/* ==========================================================================
   Reset & Document Settings
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ==========================================================================
   Animated Mesh Glows
   ========================================================================== */
.mesh-glow {
    position: fixed;
    width: 60vw;
    height: 60vw;
    border-radius: 50%;
    filter: blur(140px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.15;
    mix-blend-mode: screen;
}

.mesh-glow-1 {
    background: radial-gradient(circle, var(--accent-purple) 0%, rgba(0,0,0,0) 70%);
    top: -20%;
    left: -10%;
    animation: drift 25s infinite alternate ease-in-out;
}

.mesh-glow-2 {
    background: radial-gradient(circle, var(--accent-indigo) 0%, rgba(0,0,0,0) 70%);
    bottom: -20%;
    right: -10%;
    animation: drift 30s infinite alternate-reverse ease-in-out;
}

@keyframes drift {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(10vw, 8vh) scale(1.1); }
}

/* ==========================================================================
   Layout Containers
   ========================================================================== */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px 80px 24px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.main-header {
    height: 80px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    background: transparent;
    margin: 0 -24px 32px -24px;
    padding: 0 48px;
    border-bottom: 1px solid transparent;
    transform: translateY(0);
    opacity: 1;
    transition: transform 0.28s var(--ease-out), opacity 0.22s var(--ease-out), background 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease, backdrop-filter 0.22s ease;
    will-change: transform, opacity;
}

.main-header.header-compact {
    background: transparent;
    border-bottom-color: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.main-header.header-hidden {
    transform: translateY(calc(-100% - 16px));
    opacity: 0;
    pointer-events: none;
}

body.light-theme .main-header.header-compact {
    background: transparent;
    border-bottom-color: transparent;
    box-shadow: none;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.brand-logo {
    height: 32px;
    object-fit: contain;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Theme Toggle Button */
.btn-theme-toggle {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    box-shadow: 
        0 4px 12px rgba(0,0,0,0.1),
        inset 0 1px 0 var(--border-highlight);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s var(--ease-3d);
}

.btn-theme-toggle:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    transform: translateY(-1.5px) scale(1.05);
}

.btn-theme-toggle > svg,
.theme-icon {
    position: absolute;
    inset: 50% auto auto 50%;
    width: 18px;
    height: 18px;
    display: block;
    color: inherit;
    stroke: currentColor;
    transform: translate(-50%, -50%) rotate(0deg) scale(1);
    transform-origin: center;
    transition: opacity 0.24s var(--ease-out), transform 0.34s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-theme-toggle .icon-sun {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-90deg) scale(0.5);
}

.btn-theme-toggle .icon-moon {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(0deg) scale(1);
}

.btn-theme-toggle.theme-mode-light .icon-sun {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(0deg) scale(1);
}

.btn-theme-toggle.theme-mode-light .icon-moon {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(90deg) scale(0.5);
}

.btn-theme-toggle.theme-mode-dark .icon-moon {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(0deg) scale(1);
}

.btn-theme-toggle.theme-mode-dark .icon-sun {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-90deg) scale(0.5);
}

body.light-theme .btn-theme-toggle {
    background: #ffffff;
    color: #334155;
    border-color: rgba(15, 23, 42, 0.12);
}

body.light-theme .btn-theme-toggle:hover {
    color: #0f172a;
}

.btn-theme-toggle:active .theme-icon {
    transform: translate(-50%, -50%) rotate(20deg) scale(0.9);
}

/* Usage Ring Styles */
.usage-container {
    cursor: default;
    user-select: none;
}

.usage-ring-wrapper {
    position: relative;
    width: 38px;
    height: 38px;
    background: var(--bg-surface);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 
        0 4px 12px rgba(0,0,0,0.15),
        inset 0 1px 0 var(--border-highlight);
    border: 1px solid var(--border-color);
}

.usage-ring-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.usage-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.05);
    stroke-width: 3.5;
}

.usage-ring-bar {
    fill: none;
    stroke: url(#accent-grad-ring); /* Fallback to stroke color in JS if URL gradient fails */
    stroke-width: 3.5;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.6s var(--ease-out);
}

/* Fallback stroke for rings */
.usage-ring-bar {
    stroke: #833ab4;
}

.usage-text {
    font-size: 11px;
    font-weight: 800;
    color: var(--text-primary);
    z-index: 1;
}

.usage-text.infinite {
    font-size: 18px;
    line-height: 1;
    margin-top: -3px;
}

/* ==========================================================================
   Buttons (3D Treatment)
   ========================================================================== */
.btn {
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.2s var(--ease-3d);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:focus {
    outline: none;
}

.btn:focus-visible {
    outline: 2px solid rgba(131, 58, 180, 0.5);
    outline-offset: 2px;
}

.btn-auth {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 var(--border-highlight);
}

.btn-auth:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-highlight);
    transform: translateY(-1.5px);
}

.btn-primary {
    background: var(--accent-gradient);
    color: #ffffff;
    border: none;
    box-shadow: 
        0 6px 18px rgba(131, 58, 180, 0.35),
        inset 0 1.5px 0 rgba(255, 255, 255, 0.45),
        inset 0 -2px 3px rgba(0, 0, 0, 0.25);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 
        0 10px 24px rgba(131, 58, 180, 0.45),
        inset 0 1.5px 0 rgba(255, 255, 255, 0.55),
        inset 0 -2px 3px rgba(0, 0, 0, 0.25);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

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

/* ==========================================================================
   Profile Dropdown
   ========================================================================== */
.profile-dropdown-wrapper {
    position: relative;
}

.profile-avatar-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--accent-gradient);
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.45),
        inset 0 -1.5px 2px rgba(0, 0, 0, 0.25);
    transition: all 0.2s var(--ease-3d);
}

.profile-avatar-btn:hover {
    transform: translateY(-1.5px) scale(1.03);
}

.avatar-fallback {
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
}

.profile-dropdown {
    position: absolute;
    right: 0;
    top: 50px;
    width: 220px;
    background: var(--bg-modal);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 
        0 12px 40px rgba(0,0,0,0.25),
        inset 0 1px 0 var(--border-highlight);
    padding: 8px;
    display: none;
    transform-origin: top right;
    animation: scaleIn 0.2s var(--ease-out);
    z-index: 1000;
}

.profile-dropdown.show {
    display: block;
}

.dropdown-header {
    padding: 12px 14px;
}

.dropdown-email {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    color: #ffffff;
    background: var(--accent-gradient);
    padding: 2px 8px;
    border-radius: 8px;
    margin-top: 6px;
}

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

.dropdown-item {
    width: 100%;
    background: none;
    border: none;
    padding: 10px 14px;
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: left;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.15s ease;
}

.dropdown-item:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.dropdown-item.text-danger {
    color: #ff453a;
}

.dropdown-item.text-danger:hover {
    background: rgba(255, 69, 58, 0.08);
}

@keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   Hero & Intro Elements
   ========================================================================== */
.hero-section {
    text-align: center;
    margin-bottom: 40px;
    padding-top: 8px;
}

.hero-title {
    font-size: 52px;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.02;
    background: linear-gradient(180deg, #ffffff 0%, #a2a8b6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 12px;
    max-width: 980px;
    margin-left: auto;
    margin-right: auto;
}

.hero-subtitle {
    font-size: 17px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.5;
}

/* ==========================================================================
   Interactive Dropzone
   ========================================================================== */
.dropzone-section {
    margin-bottom: 48px;
    display: flex;
    justify-content: center;
}

.dropzone {
    width: 100%;
    max-width: 680px;
    height: 280px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 28px;
    border: 1px dashed var(--border-color);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 
        0 12px 30px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: all 0.3s var(--ease-3d);
}

.dropzone-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-purple) 0%, rgba(0,0,0,0) 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 1;
}

.dropzone:hover {
    border-color: var(--border-highlight);
    background: rgba(255, 255, 255, 0.03);
    box-shadow: 
        0 16px 40px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.dropzone:hover .dropzone-glow {
    opacity: 0.6;
}

.dropzone.dragover {
    border-color: var(--accent-indigo);
    background: rgba(93, 95, 239, 0.08);
    box-shadow: 
        0 0 40px rgba(93, 95, 239, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: scale(1.02);
}

.dropzone.dragover .upload-icon {
    transform: translateY(-6px) scale(1.1);
    color: var(--accent-indigo);
}

.dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 2;
}

.icon-container-3d {
    position: relative;
    margin-bottom: 20px;
    width: 64px;
    height: 64px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.icon-circle-glow {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--accent-gradient);
    opacity: 0.18;
    filter: blur(10px);
}

.dropzone-3d-img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    z-index: 2;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.12));
    transition: transform 0.3s var(--ease-3d);
}

.dropzone:hover .dropzone-3d-img {
    transform: scale(1.08) translateY(-2px);
}

.dropzone-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.dropzone-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.supported-formats {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    background: rgba(255, 255, 255, 0.04);
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.file-input {
    display: none;
}

/* ==========================================================================
   Presets Grid (3D Treatment)
   ========================================================================== */
.actions-grid-section {
    margin-bottom: 56px;
}

.presets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.preset-card {
    position: relative;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
    padding: 24px;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 
        0 10px 24px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: all 0.35s var(--ease-3d);
}

.card-glow {
    position: absolute;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0;
    transition: opacity 0.4s var(--ease-out);
    pointer-events: none;
    z-index: 1;
}

.preset-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 
        0 16px 36px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border-color: var(--border-highlight);
}

.preset-card:hover .card-glow {
    opacity: 0.15;
}

.card-content {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    z-index: 2;
}

.card-icon-container {
    width: 46px;
    height: 46px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s var(--ease-out);
}

.card-icon-3d {
    width: 44px;
    height: 44px;
    object-fit: contain;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.15));
    transition: transform 0.2s var(--ease-3d);
}

.preset-card:hover .card-icon-3d {
    transform: scale(1.08) translateY(-2px);
}

.card-text h3 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 2px;
    color: var(--text-primary);
}

.card-text p {
    font-size: 11px;
    color: var(--text-secondary);
}

/* ==========================================================================
   Tool Pages
   ========================================================================== */
.tool-view {
    animation: fadeIn 0.28s var(--ease-out);
}

.tool-page-shell {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto 80px auto;
}

.tool-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 14px;
    margin-bottom: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.tool-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 28px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-surface);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.16);
    margin-bottom: 22px;
}

.tool-title-group {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
}

.tool-hero-icon,
.tool-drop-icon {
    width: 58px;
    height: 58px;
    object-fit: contain;
    flex: 0 0 auto;
}

.tool-title-group h1 {
    font-size: 34px;
    line-height: 1.05;
    letter-spacing: 0;
    margin-bottom: 6px;
}

.tool-title-group p,
.tool-muted-copy {
    color: var(--text-secondary);
    line-height: 1.5;
}

.tool-workbench {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
    gap: 18px;
    margin-bottom: 18px;
}

.tool-workbench-convert {
    grid-template-columns: minmax(0, 1fr) 320px;
}

.tool-dropzone,
.tool-pdf-preview,
.tool-sort-panel,
.tool-page-grid-card,
.tool-settings-card,
.tool-upload-card,
.tool-queue-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-surface);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.14);
}

.tool-format-drop .tool-dropzone,
.tool-upload-card {
    min-height: 260px;
}

.tool-dropzone {
    height: 100%;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 28px;
    text-align: center;
    cursor: pointer;
    border-style: dashed;
}

.tool-dropzone:hover,
.tool-dropzone.dragover {
    border-color: var(--border-highlight);
    transform: translateY(-2px);
}

.tool-dropzone h3 {
    font-size: 21px;
    line-height: 1.2;
}

.tool-dropzone p,
.tool-dropzone span {
    color: var(--text-secondary);
    font-size: 13px;
}

.tool-settings-card {
    padding: 22px;
}

.tool-settings-card h3,
.tool-sort-panel h3 {
    font-size: 18px;
    margin-bottom: 16px;
}

.tool-field {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
}

.tool-field select {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-primary);
    padding: 11px 12px;
    font: inherit;
}

.tool-pdf-preview,
.tool-sort-panel,
.tool-page-grid-card {
    min-height: 320px;
    padding: 24px;
}

.tool-preview-page {
    width: min(240px, 80%);
    min-height: 260px;
    margin: 0 auto 18px auto;
    padding: 24px;
    border-radius: 8px;
    background: #ffffff;
    color: #111827;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

.tool-preview-page-real {
    display: grid;
    place-items: center;
    padding: 0;
    overflow: hidden;
}

.tool-preview-page-real .pdf-preview-tile,
.tool-preview-page-real .document-preview-tile,
.tool-large-preview-image {
    width: 100%;
    height: 100%;
    min-height: 260px;
    border-radius: inherit;
}

.tool-large-preview-image {
    object-fit: cover;
    display: block;
}

.preview-image-kind-pdf-rendered {
    object-fit: contain !important;
    background: #ffffff;
}

.tool-large-preview-icon {
    display: grid;
    place-items: center;
    width: 100%;
    min-height: 260px;
    color: #64748b;
}

.tool-large-preview-icon svg {
    width: 52px;
    height: 52px;
}

.tool-preview-line {
    display: block;
    height: 8px;
    width: 74%;
    background: #d7dde8;
    border-radius: 999px;
    margin-bottom: 12px;
}

.tool-preview-line.wide { width: 100%; }
.tool-preview-line.short { width: 48%; }

.tool-preview-chart {
    height: 72px;
    margin-top: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(131, 58, 180, 0.18), rgba(0, 122, 255, 0.14));
}

.tool-preview-meta {
    display: grid;
    gap: 4px;
    text-align: center;
}

.tool-preview-meta span,
.tool-sort-row small {
    color: var(--text-secondary);
}

.segmented-control {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 4px;
    border-radius: 8px;
    background: var(--bg-input);
    margin-bottom: 18px;
}

.segmented-control button {
    border: 0;
    border-radius: 6px;
    padding: 9px 6px;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-primary);
    font-weight: 700;
    font-size: 12px;
}

.segmented-control button.active {
    color: #ffffff;
    background: var(--accent-indigo);
}

.tool-savings-meter {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
}

.tool-savings-meter span {
    color: var(--text-secondary);
}

.meter-track {
    height: 8px;
    border-radius: 999px;
    background: var(--bg-input);
    overflow: hidden;
}

.meter-track span {
    display: block;
    height: 100%;
    background: var(--accent-gradient);
}

.tool-result-actions,
.tool-queue-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tool-sort-panel {
    display: grid;
    align-content: start;
    gap: 12px;
}

.tool-sort-row {
    display: grid;
    grid-template-columns: 28px 44px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
}

.tool-sort-row div {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.drag-handle {
    color: var(--text-tertiary);
    font-weight: 800;
}

.mini-doc-thumb {
    width: 38px;
    height: 46px;
    border-radius: 6px;
    background: linear-gradient(180deg, #ffffff, #dfe6f4);
}

.tool-add-more {
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    padding: 14px;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-weight: 700;
}

.merged-preview-strip {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.merged-preview-strip span,
.page-thumb-grid span {
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #ffffff;
    color: #111827;
    font-weight: 800;
    min-height: 72px;
}

.tool-toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.tool-toolbar button {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-primary);
    padding: 8px 10px;
    font-family: var(--font-primary);
    font-size: 12px;
    font-weight: 700;
}

.page-thumb-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.page-thumb-grid span {
    min-height: 108px;
}

.page-thumb-grid span.selected {
    outline: 3px solid var(--accent-indigo);
}

.tool-upload-card {
    grid-column: 1 / -1;
    padding: 0;
    overflow: hidden;
}

.tool-queue-card {
    padding: 22px;
}

.tool-queue-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.tool-queue-header h2 {
    font-size: 20px;
    margin-bottom: 4px;
}

.tool-queue-header p,
.tool-queue-empty {
    color: var(--text-secondary);
    line-height: 1.45;
}

.tool-queue-list {
    display: grid;
    gap: 10px;
}

.tool-queue-row {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
}

.tool-queue-thumb {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--bg-input);
    overflow: hidden;
}

.tool-queue-thumb svg {
    width: 20px;
    height: 20px;
}

.tool-queue-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tool-queue-copy {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.tool-queue-copy strong,
.tool-queue-copy span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tool-queue-copy span {
    color: var(--text-secondary);
    font-size: 12px;
}

.tool-file-input {
    display: none;
}

/* Card Accent Varieties */
.card-blue .card-glow {
    background: var(--color-blue);
    right: -40px;
    bottom: -40px;
}

.card-red .card-glow {
    background: var(--color-red);
    right: -40px;
    bottom: -40px;
}

.card-purple .card-glow {
    background: var(--color-purple);
    right: -40px;
    bottom: -40px;
}

.card-green .card-glow {
    background: var(--color-green);
    right: -40px;
    bottom: -40px;
}

/* ==========================================================================
   Active File List
   ========================================================================== */
.files-section {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    animation: fadeIn 0.4s var(--ease-out);
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
}

.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    width: 100%;
}

.section-title-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title-wrapper h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0;
}

.section-stats {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-surface);
    padding: 2px 8px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.file-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 16px;
    width: 100%;
}

.file-row {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 12px;
    display: grid;
    gap: 10px;
    align-items: start;
    box-shadow: 
        0 4px 14px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: slideUp 0.3s var(--ease-out);
}

.file-left {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.file-icon-box {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    overflow: hidden;
}

.file-icon-box svg {
    width: 28px;
    height: 28px;
    color: var(--text-secondary);
}

.file-thumb-img,
.doc-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.file-details {
    min-width: 0;
    flex: 1 1 auto;
}

.file-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 34px;
    line-height: 1.35;
    margin-bottom: 6px;
}

.file-meta {
    font-size: 10.5px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.format-flow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.03);
    padding: 2px 6px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

body.light-theme .format-flow {
    background: rgba(0, 0, 0, 0.02);
}

.format-badge {
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.flow-arrow-svg {
    width: 10px;
    height: 10px;
    color: var(--text-secondary);
    opacity: 0.5;
}

.format-select-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.format-select {
    background: rgba(139, 92, 246, 0.12);
    color: var(--accent-purple);
    border: none;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 18px 1px 6px;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    transition: all 0.15s ease;
}

.format-select:hover {
    background: rgba(139, 92, 246, 0.2);
}

.format-select-wrapper::after {
    content: "▼";
    font-size: 6px;
    color: var(--accent-purple);
    position: absolute;
    right: 6px;
    pointer-events: none;
}

/* Category Colors for File Icon Boxes */
.file-icon-box.category-image {
    background: rgba(168, 85, 247, 0.1);
    border-color: rgba(168, 85, 247, 0.2);
}
.file-icon-box.category-image svg { color: #a855f7; }

.file-icon-box.category-video {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.2);
}
.file-icon-box.category-video svg { color: #6366f1; }

.file-icon-box.category-audio {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
}
.file-icon-box.category-audio svg { color: #3b82f6; }

.file-icon-box.category-document {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.2);
}
.file-icon-box.category-document svg { color: #22c55e; }

.file-icon-box.category-ebook {
    background: rgba(249, 115, 22, 0.1);
    border-color: rgba(249, 115, 22, 0.2);
}
.file-icon-box.category-ebook svg { color: #f97316; }

.file-icon-box.category-archive {
    background: rgba(120, 113, 108, 0.1);
    border-color: rgba(120, 113, 108, 0.2);
}
.file-icon-box.category-archive svg { color: #78716c; }

.file-icon-box.category-spreadsheet {
    background: rgba(20, 184, 166, 0.1);
    border-color: rgba(20, 184, 166, 0.2);
}
.file-icon-box.category-spreadsheet svg { color: #14b8a6; }

.file-icon-box.category-presentation {
    background: rgba(236, 72, 153, 0.1);
    border-color: rgba(236, 72, 153, 0.2);
}
.file-icon-box.category-presentation svg { color: #ec4899; }

/* Progress bar inside file details */
.conversion-progress-container {
    margin-top: 8px;
    width: 100%;
    min-width: 240px;
    max-width: 320px;
}

.progress-bar-bg {
    width: 100%;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--accent-gradient);
    border-radius: 2px;
    transition: width 0.2s ease;
}

.progress-stage {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Error message styling */
.conversion-error-msg {
    margin-top: 8px;
    font-size: 11px;
    color: var(--color-red);
    background: rgba(255, 59, 48, 0.08);
    border: 1px solid rgba(255, 59, 48, 0.15);
    padding: 6px 12px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Queue Actions Bar at bottom */
.queue-actions-bar {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    width: 100%;
    margin-top: 0;
    padding-top: 16px;
    border-top: 1px dashed var(--border-color);
    animation: fadeIn 0.3s ease;
}

.btn-convert-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 700;
}

.btn-clear-queue {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 700;
}

.file-right {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.file-add-tile,
.tool-attachment-add {
    min-height: 132px;
    border: 1px dashed var(--border-color);
    border-radius: 12px;
    background: var(--bg-surface);
    color: var(--text-secondary);
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    font-family: var(--font-primary);
    cursor: pointer;
    transition: transform 0.2s var(--ease-out), border-color 0.2s, color 0.2s;
}

.file-add-tile:hover,
.tool-attachment-add:hover {
    transform: translateY(-2px);
    border-color: var(--border-highlight);
    color: var(--text-primary);
}

.file-add-tile span,
.tool-attachment-add span {
    font-size: 34px;
    line-height: 1;
    font-weight: 300;
}

.file-add-tile strong {
    font-size: 12px;
}

.status-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 8px;
}

.status-processing {
    background: rgba(93, 95, 239, 0.1);
    color: var(--accent-indigo);
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-success {
    background: rgba(52, 199, 89, 0.1);
    color: var(--color-green);
}

.status-failed {
    background: rgba(255, 59, 48, 0.1);
    color: var(--color-red);
}

.btn-file-action {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 6px;
    border-radius: 8px;
    transition: all 0.15s ease;
}

.btn-file-action:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

/* Spinner Icon */
.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: rotate 0.8s linear infinite;
}

/* ==========================================================================
   Auth Modal (Glassmorphism & Shadows)
   ========================================================================== */
.auth-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 6, 8, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.auth-modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.auth-modal-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    box-shadow: 
        0 24px 60px rgba(0,0,0,0.3),
        inset 0 1px 0 var(--border-highlight);
    padding: 40px;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s var(--ease-out);
}

.auth-modal-overlay.show .auth-modal-card {
    transform: translateY(0);
}

.btn-close-modal {
    position: absolute;
    right: 20px;
    top: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.15s ease;
}

.btn-close-modal:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.auth-card-icon-container {
    position: relative;
    width: 64px;
    height: 64px;
    margin: 0 auto 20px auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.auth-card-icon-container svg {
    width: 24px;
    height: 24px;
    color: #ffffff;
    z-index: 2;
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.auth-header p {
    font-size: 13.5px;
    color: var(--text-secondary);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-left: 2px;
}

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

.input-icon {
    position: absolute;
    left: 14px;
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    pointer-events: none;
}

.input-wrapper input {
    width: 100%;
    height: 48px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0 16px 0 42px;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 14px;
    transition: all 0.2s var(--ease-3d);
}

.input-wrapper input:focus {
    outline: none;
    border-color: rgba(131, 58, 180, 0.5);
    background: var(--bg-surface);
    box-shadow: 0 0 0 3px rgba(131, 58, 180, 0.15);
}

.btn-submit {
    height: 48px;
    width: 100%;
    margin-top: 10px;
}

.auth-toggle {
    margin-top: 24px;
    text-align: center;
}

.auth-secondary-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 14px;
    font-size: 12px;
}

.auth-secondary-actions a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
}

.auth-secondary-actions a:hover {
    color: var(--accent-purple);
}

.auth-toggle p {
    font-size: 13px;
    color: var(--text-secondary);
}

.auth-toggle a {
    color: var(--accent-indigo);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.15s ease;
}

.auth-toggle a:hover {
    color: var(--accent-purple);
}

.error-msg {
    color: #ff453a;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    background: rgba(255, 69, 58, 0.08);
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 69, 58, 0.15);
    display: none;
}

.error-msg.success {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.18);
}

/* ==========================================================================
   Animations & Media Queries
   ========================================================================== */
@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(12px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 768px) {
    .main-header {
        padding: 0 24px;
    }
    
    .hero-title {
        font-size: 38px;
    }

    .file-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .file-left,
    .file-right {
        width: 100%;
    }

    .file-right {
        justify-content: flex-end;
    }

    .queue-actions-bar {
        flex-direction: column;
    }

    .btn-convert-all,
    .btn-clear-queue {
        justify-content: center;
        width: 100%;
    }

    .tool-hero,
    .tool-queue-header {
        flex-direction: column;
        align-items: stretch;
    }

    .tool-title-group {
        align-items: flex-start;
    }

    .tool-title-group h1 {
        font-size: 28px;
    }

    .tool-workbench,
    .tool-workbench-convert {
        grid-template-columns: 1fr;
    }

    .tool-queue-row {
        grid-template-columns: 42px minmax(0, 1fr);
    }

    .tool-queue-row .status-badge {
        grid-column: 2;
        justify-self: start;
    }

    .segmented-control {
        grid-template-columns: 1fr;
    }
    
    .presets-grid {
        grid-template-columns: 1fr;
    }
    
    .auth-modal-card {
        padding: 24px;
    }
}

/* ==========================================================================
   Light Mode Overrides
   ========================================================================== */
body.light-theme .mesh-glow {
    opacity: 0.09;
    mix-blend-mode: multiply;
}

body.light-theme .hero-title {
    background: linear-gradient(180deg, #0f172a 0%, #3b4252 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.light-theme .preset-card, 
body.light-theme .dropzone,
body.light-theme .file-row {
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.03),
        inset 0 1px 0 var(--border-highlight);
}

body.light-theme .preset-card:hover,
body.light-theme .dropzone:hover {
    box-shadow: 
        0 12px 30px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 var(--border-highlight);
}

body.light-theme .auth-modal-overlay {
    background: rgba(245, 246, 248, 0.85);
}

body.light-theme .usage-ring-bg {
    stroke: rgba(0, 0, 0, 0.03);
}

body.light-theme .file-icon-box {
    background: rgba(0, 0, 0, 0.015);
}

/* ==========================================================================
   Sidebar & Desktop Layout
   ========================================================================== */
.main-viewport {
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.btn-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    margin-right: 12px;
}

.btn-menu-toggle:hover {
    background: var(--bg-surface-hover);
}

.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    background: rgba(10, 12, 16, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 999;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 24px 16px;
}

.app-sidebar.active {
    transform: translateX(0);
}

/* Sidebar Backdrop for Mobile */
.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.sidebar-header {
    margin-bottom: 32px;
    padding: 0 8px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.sidebar-item svg {
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.sidebar-item:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.sidebar-item:hover svg {
    color: var(--text-primary);
}

.sidebar-item.active {
    background: linear-gradient(135deg, rgba(93, 95, 239, 0.15) 0%, rgba(131, 58, 180, 0.15) 100%);
    color: #ffffff;
    border-color: rgba(131, 58, 180, 0.3);
    box-shadow: 0 4px 12px rgba(131, 58, 180, 0.15);
}

.sidebar-item.active svg {
    color: #5d5fef;
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

.sidebar-profile-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
}

.profile-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: bold;
    font-size: 14px;
}

.profile-meta-small {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.profile-email-small {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

body.light-theme .app-sidebar {
    background: rgba(255, 255, 255, 0.9) !important;
    border-right-color: var(--border-color);
}
body.light-theme .sidebar-profile-item {
    background: rgba(0, 0, 0, 0.03);
}

@media (min-width: 769px) {
    .app-container {
        max-width: 1440px;
        display: flex;
        flex-direction: row;
        padding: 0;
        gap: 0;
    }
    .main-viewport {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 100vh;
        padding: 0 40px 80px 40px;
        overflow-y: auto;
        position: relative;
    }
    .main-header {
        margin: 0 -40px 32px -40px !important;
        padding: 0 40px !important;
    }
    .app-sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        width: 260px;
        transform: translateX(0);
        background: rgba(10, 12, 16, 0.4);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
    .btn-menu-toggle {
        display: none !important;
    }
}

/* ==========================================================================
   Conversations (AI Chat with Documents) Styles
   ========================================================================== */
.view-panel {
    display: none;
    animation: fadeInView 0.3s ease-out forwards;
}

.view-panel.active {
    display: block !important;
}

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

.conversations-section {
    width: 100%;
}

.section-header-row {
    margin-bottom: 24px;
}

.section-title-wrapper h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.section-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

.conversations-container {
    display: grid;
    grid-template-columns: 1fr;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    overflow: hidden;
    min-height: 500px;
    height: calc(100vh - 220px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

@media (min-width: 769px) {
    .conversations-container {
        grid-template-columns: 280px 1fr;
    }
}

/* Documents Pane */
.chat-docs-pane {
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.1);
}

body.light-theme .chat-docs-pane {
    background: rgba(0, 0, 0, 0.01);
}

.chat-docs-pane .pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    min-height: 56px;
}

.chat-docs-pane .pane-header h3 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin: 0;
}

.btn-add-doc-chat {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--accent-gradient);
    border: none;
    color: #ffffff;
    font-family: var(--font-primary);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(168, 85, 247, 0.2);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s, background 0.3s;
}

.btn-add-doc-chat:hover {
    transform: translateY(-1.5px) scale(1.02);
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.35);
}

.btn-add-doc-chat:active {
    transform: translateY(0);
}

.btn-add-doc-chat svg {
    color: inherit;
}

.chat-docs-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.empty-docs-state {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 13px;
    line-height: 1.5;
}

/* Chat Document Row Item */
.chat-doc-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px !important;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
    border: 1px solid transparent;
}

.doc-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
}

.btn-chat-doc-queue,
.btn-chat-doc-delete {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.75;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-chat-doc-queue {
    width: auto;
    padding: 0 8px;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    color: var(--accent-purple);
}

.btn-chat-doc-queue:hover {
    opacity: 1;
    background: rgba(139, 92, 246, 0.14) !important;
    color: var(--accent-purple) !important;
}

.btn-chat-doc-delete:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.15) !important;
    color: #ef4444 !important;
}

.chat-doc-item:hover {
    background: var(--bg-surface-hover);
}

.chat-doc-item.active {
    background: rgba(93, 95, 239, 0.1);
    border-color: rgba(93, 95, 239, 0.3);
}

.chat-doc-item.converting-state {
    cursor: default;
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px dashed var(--border-color) !important;
    transition: none !important;
}

body.light-theme .chat-doc-item.converting-state {
    background: rgba(0, 0, 0, 0.02) !important;
}

.chat-doc-item.converting-state .doc-icon-wrapper {
    background: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-secondary) !important;
}

.doc-icon-wrapper {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(131, 58, 180, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-indigo);
    font-size: 16px;
    flex-shrink: 0;
    overflow: hidden;
}

body.light-theme .doc-icon-wrapper {
    background: rgba(93, 95, 239, 0.08);
}

.doc-meta {
    overflow: hidden;
}

.doc-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    margin-bottom: 2px;
}

.doc-size-date {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Chat Conversation Pane */
.chat-conversation-pane {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-conversation-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: row;
    align-items: center;
    background: rgba(0, 0, 0, 0.05);
}

.chat-header-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.btn-chat-back {
    display: none;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: none;
    color: var(--accent-purple);
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 10px 6px 0;
    margin-right: 12px;
    transition: transform 0.2s, color 0.2s;
}

.btn-chat-back:hover {
    transform: translateX(-3px);
    color: var(--color-primary-hover);
}

.btn-chat-back svg {
    color: inherit;
}

.active-doc-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.active-doc-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.chat-messages-box {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: rgba(0, 0, 0, 0.05);
}

/* Chat Message Bubbles */
.chat-message {
    max-width: 80%;
    padding: 14px 18px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    animation: messagePop 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes messagePop {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-message.message-ai {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

body.light-theme .chat-message.message-ai {
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.chat-message.message-user {
    background: var(--accent-gradient);
    color: #ffffff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(131, 58, 180, 0.15);
}

.message-time {
    font-size: 10px;
    color: var(--text-tertiary);
    margin-top: 6px;
    text-align: right;
}

.chat-message.message-user .message-time {
    color: rgba(255, 255, 255, 0.7);
}

/* Chat Input Bar */
.chat-input-bar {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.15);
}

body.light-theme .chat-input-bar {
    background: rgba(255, 255, 255, 0.4);
}

.chat-input-bar input {
    flex: 1;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    padding: 0 16px;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 14px;
    transition: all 0.2s ease;
}

.chat-input-bar input:focus {
    outline: none;
    border-color: var(--accent-indigo);
    box-shadow: 0 0 0 3px rgba(93, 95, 239, 0.15);
}

.chat-input-bar input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-send-message {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--accent-gradient);
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-send-message:hover {
    transform: scale(1.03);
}

.btn-send-message:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ==========================================================================
   Profile & Stats View Styles
   ========================================================================== */
.profile-layout-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 800px;
    margin: 0 auto;
}

/* User Card */
.profile-user-card {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 24px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.profile-avatar-large {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 28px;
    font-weight: 700;
}

.profile-user-details {
    flex: 1;
}

.profile-user-details h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.profile-user-details p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.badge-plan-status {
    display: inline-block;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 20px;
    background: rgba(0, 122, 255, 0.1);
    color: var(--color-blue);
    border: 1px solid rgba(0, 122, 255, 0.2);
}

body.light-theme .badge-plan-status {
    background: rgba(0, 122, 255, 0.08);
}

.btn-danger-outline {
    background: transparent;
    border: 1px solid rgba(255, 59, 48, 0.3);
    color: var(--color-red);
}

.btn-danger-outline:hover {
    background: rgba(255, 59, 48, 0.05);
    border-color: var(--color-red);
}

/* Stats Cards Grid */
.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

@media (min-width: 576px) {
    .profile-stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stat-card {
    padding: 20px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    text-align: center;
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.stat-hint {
    margin-top: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
}

/* Settings Group Card */
.settings-group-card {
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    overflow: hidden;
}

.settings-group-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0,0,0,0.05);
}

.settings-group-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.settings-rows-list {
    display: flex;
    flex-direction: column;
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
}

.settings-row:last-child {
    border-bottom: none;
}

.row-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.row-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.row-value {
    font-size: 14px;
    color: var(--text-primary);
}

.btn-secondary-small {
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary-small:hover {
    background: var(--bg-surface-hover);
    border-color: var(--text-secondary);
}

/* ==========================================================================
   Landing Mode Page Layout Overrides (Home Page)
   ========================================================================== */
@media (min-width: 1024px) {
    .app-container.landing-mode {
        flex-direction: column !important;
        max-width: 1200px !important;
        padding: 0 24px 80px 24px !important;
        margin: 0 auto !important;
    }
    
    .app-container.landing-mode .main-header {
        margin: 0 0 44px 0 !important;
        padding: 0 !important;
    }

    .app-container.landing-mode .hero-section {
        padding-top: 0;
        margin-bottom: 48px;
    }

    .app-container.landing-mode .files-section {
        max-width: 760px;
        margin-top: 72px;
    }

    .app-container.landing-mode .section-header-row {
        justify-content: center;
        text-align: center;
    }

    .app-container.landing-mode .section-title-wrapper {
        justify-content: center;
        flex-wrap: wrap;
    }

    .app-container.landing-mode .section-title-wrapper h2 {
        color: var(--text-primary);
        font-size: 32px;
        line-height: 1.05;
        letter-spacing: 0;
    }
}

@media (min-width: 1400px) {
    .hero-title {
        font-size: 60px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .main-header {
        transition: none;
    }
}

/* ==========================================================================
   Dashboard Layout & Collapsible Sidebar Styles
   ========================================================================== */
.app-sidebar {
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

@media (min-width: 1024px) {
    /* Dock container to screen edges by removing max-width on dashboard */
    .app-container:not(.landing-mode) {
        max-width: none !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Collapsed Sidebar State */
    .app-container.collapsed .app-sidebar {
        width: 80px !important;
        padding: 24px 8px !important;
    }
    
    /* Collapsed Brand Logo */
    .app-container.collapsed .brand-logo {
        display: none !important;
    }
    
    .app-container.collapsed .collapsed-logo-emblem {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        margin: 0 auto;
        background: linear-gradient(135deg, #a855f7 0%, #3b82f6 100%);
        border-radius: 10px;
        color: #fff;
        font-size: 20px;
        font-weight: 800;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
        box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
    }
    
    /* Collapsed Navigation Items */
    .app-container.collapsed .sidebar-item {
        justify-content: center !important;
        padding: 12px !important;
        margin: 6px 0 !important;
        width: 48px;
        height: 48px;
        margin-left: auto !important;
        margin-right: auto !important;
        border-radius: 12px;
    }
    
    .sidebar-item span {
        transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1), margin-left 0.3s ease;
        opacity: 1;
        max-width: 150px;
        display: inline-block;
        vertical-align: middle;
        overflow: hidden;
        white-space: nowrap;
    }

    .app-container.collapsed .sidebar-item span {
        opacity: 0 !important;
        max-width: 0 !important;
        margin-left: 0 !important;
        pointer-events: none !important;
    }
    
    .app-container.collapsed .sidebar-item svg {
        margin-right: 0 !important;
        width: 22px;
        height: 22px;
    }
    
    /* Collapsed Footer Profile */
    .app-container.collapsed .sidebar-profile-item {
        justify-content: center !important;
        padding: 8px 0 !important;
    }
    
    .profile-meta-small {
        transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        opacity: 1;
        max-width: 150px;
        overflow: hidden;
        white-space: nowrap;
    }

    .app-container.collapsed .profile-meta-small {
        opacity: 0 !important;
        max-width: 0 !important;
        pointer-events: none !important;
    }
    
    .app-container.collapsed .profile-avatar-small {
        margin-right: 0 !important;
    }
    
    /* Force menu toggle button visible on desktop dashboard for collapse feature */
    .app-container:not(.landing-mode) .btn-menu-toggle {
        display: flex !important;
        margin-left: 8px;
    }
}

/* ==========================================================================
   Workspace Converter Panel (Dashboard Only)
   ========================================================================== */
.workspace-header {
    margin-bottom: 24px;
}

.workspace-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.workspace-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

.dashboard-workspace-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    align-items: start;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 1024px) {
    .dashboard-workspace-container.has-files {
        grid-template-columns: 420px 1fr;
    }
}

.workspace-col-left {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Compact Dropzone */
.compact-dropzone {
    padding: 32px 20px !important;
    min-height: 200px !important;
    border-radius: 16px !important;
}

.compact-icon-3d {
    width: 60px !important;
    height: 60px !important;
    margin-bottom: 12px !important;
}

.compact-icon-3d .dropzone-3d-img {
    width: 44px !important;
    height: 44px !important;
}

/* Options Card */
.workspace-options-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.options-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.options-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.select-wrapper {
    position: relative;
}

.form-select {
    width: 100%;
    padding: 12px 16px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}

.form-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
}

.select-wrapper::after {
    content: '';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--text-secondary);
    border-bottom: 2px solid var(--text-secondary);
    transform: translateY(-70%) rotate(45deg);
    pointer-events: none;
    transition: border-color 0.2s;
}

.select-wrapper:hover::after {
    border-color: var(--text-primary);
}

/* Slider Wrapper */
.slider-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-range {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #a855f7 0%, #3b82f6 100%);
    box-shadow: 0 2px 6px rgba(168, 85, 247, 0.4);
    transition: transform 0.1s;
}

.form-range::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Light theme specific overrides */
body.light-theme .form-select {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.08);
}

body.light-theme .form-range {
    background: rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   Sidebar Collapse Button & Header Refinements
   ========================================================================== */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    padding: 0 8px;
    position: relative;
}

.btn-sidebar-collapse {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-sidebar-collapse:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.btn-sidebar-collapse svg {
    transition: transform 0.3s ease;
}

/* Hide header menu toggle button on desktop dashboard, since collapse is in the sidebar */
@media (min-width: 1024px) {
    .app-container:not(.landing-mode) #menuToggleBtn {
        display: none !important;
    }
}

/* Hide sidebar collapse button on mobile */
@media (max-width: 1023px) {
    #sidebarCollapseBtn {
        display: none !important;
    }
}

@media (min-width: 1024px) {
    .app-container.collapsed .btn-sidebar-collapse svg {
        transform: rotate(180deg);
    }
    
    .app-container.collapsed .sidebar-header {
        flex-direction: column !important;
        gap: 12px;
        justify-content: center !important;
        padding: 0 !important;
    }
    
    .app-container.collapsed #sidebarCollapseBtn {
        margin-top: 4px;
    }
}

/* ==========================================================================
   Persistent Queue Box & Empty State Card
   ========================================================================== */
.workspace-col-right.files-section {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    min-height: 480px;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.workspace-col-right .section-header-row {
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
    width: 100%;
}

.workspace-col-right .section-title-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.workspace-col-right .section-title-wrapper h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.queue-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    text-align: center;
    background: rgba(10, 12, 16, 0.2);
    margin-top: 10px;
    flex: 1;
    min-height: 280px;
}

.queue-empty-icon {
    width: 72px;
    height: 72px;
    background: rgba(168, 85, 247, 0.06);
    color: var(--color-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.1);
}

.queue-empty-state h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.queue-empty-state p {
    font-size: 13px;
    color: var(--text-secondary);
    max-width: 260px;
    line-height: 1.5;
}

@media (min-width: 1024px) {
    .dashboard-workspace-container {
        grid-template-columns: 1fr 1fr !important;
        min-height: 520px;
    }
}

body.light-theme .queue-empty-state {
    background: rgba(0, 0, 0, 0.02);
}

/* Option Help Text Under Select Inputs */
.option-help-text {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-top: 6px;
    display: block;
    opacity: 0.75;
}

/* ==========================================================================
   Premium 3D Edge Bevel Treatment Overrides
   ========================================================================== */
.dropzone,
.compact-dropzone,
.workspace-options-card,
.workspace-col-right.files-section,
.file-row,
.btn-sidebar-collapse {
    box-shadow: 
        0 12px 30px rgba(0, 0, 0, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        inset 0 -1px 0 rgba(0, 0, 0, 0.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* Make sure hover states retain beveled highlights */
.dropzone:hover,
.compact-dropzone:hover,
.file-row:hover,
.btn-sidebar-collapse:hover {
    box-shadow: 
        0 14px 35px rgba(0, 0, 0, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        inset 0 -1px 0 rgba(0, 0, 0, 0.3) !important;
}

/* Light Theme 3D Bevel Highlight */
body.light-theme .dropzone,
body.light-theme .compact-dropzone,
body.light-theme .workspace-options-card,
body.light-theme .workspace-col-right.files-section,
body.light-theme .file-row,
body.light-theme .btn-sidebar-collapse {
    box-shadow: 
        0 10px 24px rgba(10, 15, 30, 0.08),
        0 2px 5px rgba(10, 15, 30, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.95),
        inset 0 -2px 0 rgba(0, 0, 0, 0.05) !important;
    border: 1px solid rgba(15, 23, 42, 0.12) !important;
    background: #ffffff !important;
}

body.light-theme .dropzone:hover,
body.light-theme .compact-dropzone:hover,
body.light-theme .file-row:hover,
body.light-theme .btn-sidebar-collapse:hover {
    box-shadow: 
        0 14px 30px rgba(10, 15, 30, 0.12),
        0 4px 8px rgba(10, 15, 30, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.95),
        inset 0 -2px 0 rgba(0, 0, 0, 0.05) !important;
}

/* ==========================================================================
   Premium Website Animations & Micro-interactions
   ========================================================================== */

/* 1. Floating 3D image animation for dropzone & empty state icons */
@keyframes dropzone3DFloat {
    0% { transform: translateY(0) scale(1) rotate(0deg); }
    50% { transform: translateY(-8px) scale(1.03) rotate(2deg); }
    100% { transform: translateY(0) scale(1) rotate(0deg); }
}

.dropzone-3d-img {
    animation: dropzone3DFloat 6s ease-in-out infinite;
    transform-origin: center bottom;
    filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.15));
}

/* 2. Page entry animations for dashboard components */
@keyframes mainViewSlideUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes panelSlideInRight {
    from {
        opacity: 0;
        transform: translateX(-30px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes panelSlideInLeft {
    from {
        opacity: 0;
        transform: translateX(30px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.main-viewport {
    animation: mainViewSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.workspace-options-card {
    animation: panelSlideInRight 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.workspace-col-right.files-section {
    animation: panelSlideInLeft 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 3. Hover Micro-animations */
.sidebar-item {
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.25s, color 0.25s, border-color 0.25s !important;
}

.sidebar-item:hover {
    transform: translateX(6px) scale(1.02);
}

.app-container.collapsed .sidebar-item:hover {
    transform: scale(1.08) !important;
}

.file-row {
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s, border-color 0.25s !important;
}

.file-row:hover {
    transform: scale(1.012) translateY(-2px);
    border-color: rgba(168, 85, 247, 0.3) !important;
}

body.light-theme .file-row:hover {
    border-color: rgba(168, 85, 247, 0.4) !important;
}

/* Buttons interactivity and pulsing active click state */
.btn-primary, .btn-secondary, .btn-action {
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s, background 0.3s !important;
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 24px rgba(168, 85, 247, 0.3) !important;
}

.btn-primary:active {
    transform: translateY(-1px) scale(0.99);
}

/* 4. Theme Toggle rotation */
.btn-theme-toggle svg {
    transition: opacity 0.24s var(--ease-out), transform 0.34s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-theme-toggle.theme-mode-light:hover .icon-sun {
    transform: translate(-50%, -50%) rotate(45deg) scale(1.12);
}

.btn-theme-toggle.theme-mode-dark:hover .icon-moon {
    transform: translate(-50%, -50%) rotate(-14deg) scale(1.12);
}

/* 5. Smooth animated backgrounds */
@keyframes bgGlowPulse {
    0% { opacity: 0.15; }
    50% { opacity: 0.25; }
    100% { opacity: 0.15; }
}

.bg-glow-pulse {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.12) 0%, rgba(59, 130, 246, 0.05) 50%, rgba(0,0,0,0) 70%);
    top: -10%;
    right: -10%;
    pointer-events: none;
    z-index: 0;
    animation: bgGlowPulse 8s ease-in-out infinite;
}

body.light-theme .bg-glow-pulse {
    background: radial-gradient(circle, rgba(168, 85, 247, 0.04) 0%, rgba(59, 130, 246, 0.02) 50%, rgba(0,0,0,0) 70%);
}

/* ==========================================================================
   SVG Icon Motion Animations (Micro-interactions)
   ========================================================================== */

/* 1. Sidebar Nav Icons: Scale, rotate and light up on hover */
.sidebar-item svg {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.3s, filter 0.3s !important;
    transform-origin: center;
}

.sidebar-item:hover svg {
    transform: scale(1.22) rotate(-8deg);
    filter: drop-shadow(0 2px 8px rgba(168, 85, 247, 0.3));
}

.sidebar-item.active svg {
    filter: drop-shadow(0 2px 8px rgba(93, 95, 239, 0.4));
}

/* 2. File list row category icons: bounce and rotate slightly on row hover */
.file-icon-box svg {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s !important;
    transform-origin: center;
}

.file-row:hover .file-icon-box svg {
    transform: scale(1.2) rotate(8deg);
    filter: drop-shadow(0 2px 6px rgba(168, 85, 247, 0.25));
}

/* 3. Action icons (convert all, clear queue, checkmarks, delete buttons): swell on hover */
.btn-action svg, 
.file-right button svg {
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.btn-action:hover svg, 
.file-right button:hover svg {
    transform: scale(1.2);
}

/* 4. Dropdown selector arrow animations */
.select-wrapper::after {
    transition: border-color 0.2s, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.select-wrapper:hover::after {
    transform: translateY(-50%) rotate(45deg) scale(1.15) translate(1px, 1px);
}

.format-select-wrapper::after {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.2s !important;
}

.format-select-wrapper:hover::after {
    transform: translateY(2px) scale(1.1);
    color: var(--color-primary);
}

/* 5. Dropzone hover active image float/pulse */
@keyframes dropzoneHoverPulse {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(-10px) scale(1.05); }
}

.dropzone:hover .dropzone-3d-img {
    animation: dropzoneHoverPulse 0.8s cubic-bezier(0.25, 0.8, 0.25, 1) infinite alternate;
}

/* 6. Responsive Mobile AI Conversations View Toggle */
@media (max-width: 768px) {
    /* Reset main-viewport padding on mobile so content can go edge-to-edge */
    .app-container:not(.landing-mode) .main-viewport {
        padding: 0 !important;
    }
    
    /* Re-align main header on mobile for edge-to-edge dashboard layout */
    .app-container:not(.landing-mode) .main-header {
        padding: 0 16px !important;
        margin: 0 0 16px 0 !important;
        height: 64px !important;
        border-bottom: 1px solid var(--border-color);
        background: rgba(10, 12, 16, 0.6) !important;
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }
    
    body.light-theme .app-container:not(.landing-mode) .main-header {
        background: rgba(255, 255, 255, 0.8) !important;
    }
    
    /* Lock the body and HTML element to prevent viewport elastic scrolling on iOS/Android */
    body:has(#conversationsView.active) {
        position: fixed !important;
        width: 100vw !important;
        height: 100vh !important;
        overflow: hidden !important;
    }

    /* If conversationsView is active, prevent the main viewport from scrolling so only the chat list scrolls */
    .app-container:not(.landing-mode):has(#conversationsView.active) .main-viewport {
        overflow: hidden !important;
        height: calc(100vh - 64px) !important;
    }
    
    /* Remove margin from header when conversations are active */
    .app-container:not(.landing-mode):has(#conversationsView.active) .main-header {
        margin: 0 !important;
    }
    
    /* Keep padding on standard dashboard sections so they don't hit the screen edges */
    .converter-section,
    .profile-section {
        padding: 0 16px 80px 16px !important;
    }

    /* Conversations section goes completely edge-to-edge full page */
    .conversations-section {
        padding: 0 !important;
        height: 100% !important;
        display: flex;
        flex-direction: column;
        margin: 0 !important;
    }
    
    /* Hide the big desktop section headers to maximize chat area */
    .conversations-section .section-header-row {
        display: none !important;
    }

    .conversations-container {
        display: flex !important;
        flex-direction: column;
        flex: 1;
        height: 100% !important;
        min-height: 0 !important;
        border: none !important;
        border-radius: 0 !important;
        background: var(--bg-surface) !important;
        box-shadow: none !important;
        margin: 0 !important;
    }

    /* By default, show Docs Pane and hide Chat Pane */
    .conversations-container:not(.chat-active) .chat-docs-pane {
        display: flex !important;
        width: 100% !important;
        height: 100% !important;
        background: var(--bg-surface) !important;
    }

    .conversations-container:not(.chat-active) .chat-conversation-pane {
        display: none !important;
    }

    /* When a chat is active, hide Docs Pane and show Chat Pane */
    .conversations-container.chat-active .chat-docs-pane {
        display: none !important;
    }

    @keyframes slideInFromRightChat {
        from {
            opacity: 0;
            transform: translateX(20px);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }

    .conversations-container.chat-active .chat-conversation-pane {
        display: flex !important;
        width: 100% !important;
        height: 100% !important;
        flex: 1;
        animation: slideInFromRightChat 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    /* Display back button only in active chat on mobile */
    .btn-chat-back {
        display: flex !important;
    }
    
    /* Compact chat inputs and headers on mobile device screen sizes */
    .chat-conversation-header {
        padding: 12px 16px !important;
    }
    
    .chat-messages-box {
        padding: 16px !important;
        gap: 12px !important;
    }
    
    .chat-input-bar {
        padding: 12px 16px !important;
        background: var(--bg-surface) !important;
    }
    
    /* Style document list items as flat rows for native mobile canvas feel */
    .chat-docs-list {
        padding: 0 !important;
    }
    
    .chat-doc-item {
        border-radius: 0 !important;
        border: none !important;
        border-bottom: 1px solid var(--border-color) !important;
        margin: 0 !important;
        padding: 16px 20px !important;
        background: transparent !important;
    }
    
    .chat-doc-item.active {
        background: rgba(93, 95, 239, 0.08) !important;
    }
}

/* Canvas Toggle Button styling */
.btn-chat-canvas-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(168, 85, 247, 0.3);
    color: #a855f7;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: auto;
}

.btn-chat-canvas-toggle:hover {
    background: rgba(168, 85, 247, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.15);
}

.btn-chat-canvas-toggle svg {
    color: #a855f7;
    transition: transform 0.25s ease;
}

.btn-chat-canvas-toggle:hover svg {
    transform: rotate(15deg) scale(1.1);
}

/* Chat Canvas Pane layout and styles */
.chat-canvas-pane {
    display: none;
    flex-direction: column;
    background: var(--bg-surface-secondary);
    border-left: 1px solid var(--border-color);
    position: relative;
    height: 100%;
}

.conversations-container.canvas-active .chat-canvas-pane {
    display: flex;
}

.canvas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-surface);
}

.canvas-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    max-width: 70%;
}

.canvas-header-icon {
    color: #a855f7;
    flex-shrink: 0;
}

.canvas-word-count {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 6px;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
}

body.light-theme .canvas-word-count {
    background: rgba(0, 0, 0, 0.04);
}

.canvas-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-canvas-action {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-canvas-action:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

#btnCanvasSave {
    color: #a855f7;
    border-color: rgba(168, 85, 247, 0.2);
    background: rgba(168, 85, 247, 0.05);
}

#btnCanvasSave:hover {
    background: rgba(168, 85, 247, 0.15);
    border-color: rgba(168, 85, 247, 0.4);
}

.canvas-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: var(--bg-surface);
}

#canvasTextArea {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    resize: none;
    outline: none;
    color: var(--text-primary);
    font-family: 'Outfit', -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    padding: 0;
}

.canvas-composer-bar {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    gap: 12px;
}

#canvasInstructionField {
    flex: 1;
    height: 40px;
    padding: 0 16px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface-secondary);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
}

#canvasInstructionField:focus {
    border-color: rgba(168, 85, 247, 0.5);
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.15);
}

.btn-canvas-rewrite {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-gradient);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
}

.btn-canvas-rewrite:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(168, 85, 247, 0.5);
}

.btn-canvas-rewrite:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

@media (min-width: 992px) {
    .conversations-container.canvas-active {
        grid-template-columns: 280px 1fr 1.2fr;
    }
}

@media (min-width: 769px) and (max-width: 991px) {
    .conversations-container.canvas-active {
        grid-template-columns: 240px 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .conversations-container.canvas-active .chat-conversation-pane {
        display: none !important;
    }
    
    .conversations-container.canvas-active .chat-canvas-pane {
        display: flex !important;
        width: 100% !important;
        height: 100% !important;
    }
}

/* Unified Composer Rewrite Button styling */
.btn-chat-composer-rewrite {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(168, 85, 247, 0.3);
    color: #a855f7;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-chat-composer-rewrite:hover:not(:disabled) {
    background: rgba(168, 85, 247, 0.2);
    transform: scale(1.05);
}

.btn-chat-composer-rewrite:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-input-bar {
    display: flex;
    align-items: center;
    gap: 8px !important;
}

/* Force padding 0 to prevent icons from getting squished by general .btn styles */
.btn-send-message,
.btn-chat-composer-rewrite {
    padding: 0 !important;
}

/* Clear Chat Button styling */
.btn-chat-clear {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 8px;
}

.btn-chat-clear:hover {
    background: rgba(239, 68, 68, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

.btn-chat-clear svg {
    color: #ef4444;
}

/* ==========================================================================
   Tool App Shell + AskRue-style document tiles
   ========================================================================== */
body.tool-shell-active .app-container.landing-mode > .main-header {
    display: none;
}

html.tool-shell-active-root,
body.tool-shell-active {
    width: 100%;
    height: 100%;
    background: #f3f5fa;
    overflow: hidden !important;
}

body.tool-shell-active:not(.light-theme) {
    background: #0b0e17;
}

body.tool-shell-active .mesh-glow,
body.tool-shell-active .bg-glow-pulse {
    display: none;
}

body.tool-shell-active .app-container.landing-mode {
    width: 100vw;
    max-width: none !important;
    min-height: 100vh;
    margin: 0 !important;
    padding: 0 !important;
}

body.tool-shell-active .main-content {
    width: 100vw;
    min-height: 100vh;
    padding: 0 !important;
}

.tool-view,
.tool-page-shell {
    width: 100%;
    max-width: none;
    margin: 0;
    min-height: 100vh;
}

body.tool-shell-active .tool-view,
body.tool-shell-active .tool-page-shell {
    animation: none !important;
    transform: none !important;
    width: 100vw !important;
    max-width: none !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.tool-app-shell {
    position: fixed !important;
    inset: 0 !important;
    z-index: 1000;
    width: 100vw !important;
    min-height: 100vh;
    min-height: 100dvh;
    height: 100vh;
    height: 100dvh;
    margin: 0 !important;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: rgba(255, 255, 255, 0.92);
    color: #111827;
    box-shadow: none;
}

body:not(.light-theme) .tool-app-shell {
    background: rgba(14, 17, 27, 0.96);
    color: var(--text-primary);
}

.tool-app-sidebar {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 22px 16px;
    border-right: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(255, 255, 255, 0.74);
}

body:not(.light-theme) .tool-app-sidebar {
    background: rgba(8, 10, 18, 0.72);
}

.tool-side-logo {
    border: 0;
    background: transparent;
    padding: 0 4px 10px;
    cursor: pointer;
    text-align: left;
}

.tool-side-logo img {
    width: 150px;
    height: auto;
    display: block;
}

.tool-side-nav {
    display: grid;
    gap: 8px;
}

.tool-side-item {
    width: 100%;
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 0;
    border-radius: 8px;
    padding: 10px 12px;
    background: transparent;
    color: #475569;
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    transition: background 0.22s var(--ease-out), color 0.22s var(--ease-out), transform 0.22s var(--ease-out);
}

body:not(.light-theme) .tool-side-item {
    color: var(--text-secondary);
}

.tool-side-item:hover,
.tool-side-item.active {
    background: rgba(124, 92, 255, 0.12);
    color: #6d4aff;
}

.tool-side-item:hover {
    transform: translateX(3px);
}

.tool-side-item.active {
    transform: translateX(4px);
}

.tool-side-item svg {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
}

.tool-settings-link {
    margin-top: auto;
}

.tool-app-main {
    min-width: 0;
    display: grid;
    grid-template-rows: auto 1fr;
    overflow: hidden;
}

.tool-app-topbar {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 0 26px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(255, 255, 255, 0.56);
}

body:not(.light-theme) .tool-app-topbar {
    background: rgba(8, 10, 18, 0.44);
}

.tool-back-inline {
    border: 0;
    background: transparent;
    color: inherit;
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.tool-top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tool-theme-copy {
    width: 38px;
    height: 38px;
}

.tool-limit-pill {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 8px;
    background: rgba(124, 92, 255, 0.11);
    color: #6d4aff;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.tool-auth-copy {
    min-height: 38px;
    padding: 0 16px;
    border-radius: 8px;
}

.tool-app-content {
    min-width: 0;
    max-width: none;
    width: 100%;
    padding: 34px 36px 48px;
    overflow-y: auto;
    overflow-x: hidden;
    animation: toolContentMorph 0.32s var(--ease-out) both;
}

.tool-screen-heading {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 22px;
    animation: toolHeadingMorph 0.36s var(--ease-out) both;
}

.tool-screen-heading .tool-hero-icon {
    animation: toolIconMorph 0.42s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.tool-screen-heading h1 {
    margin: 0 0 4px;
    color: inherit;
    font-size: 30px;
    line-height: 1.05;
    letter-spacing: 0;
}

.tool-screen-heading p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.tool-workbench-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(270px, 320px);
    gap: 20px;
    align-items: start;
    animation: toolPanelsMorph 0.38s var(--ease-out) both;
}

.tool-convert-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(270px, 310px);
}

.tool-main-stack {
    min-width: 0;
    display: grid;
    gap: 18px;
}

.tool-upload-panel,
.tool-documents-card,
.tool-result-card,
.tool-settings-card,
.tool-pdf-preview,
.tool-page-grid-card {
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}

body:not(.light-theme) .tool-upload-panel,
body:not(.light-theme) .tool-documents-card,
body:not(.light-theme) .tool-result-card,
body:not(.light-theme) .tool-settings-card,
body:not(.light-theme) .tool-pdf-preview,
body:not(.light-theme) .tool-page-grid-card {
    background: rgba(255, 255, 255, 0.045);
}

.tool-upload-panel {
    min-height: 260px;
    overflow: hidden;
}

.tool-upload-panel .tool-dropzone {
    min-height: 260px;
    border: 2px dashed rgba(124, 92, 255, 0.35);
    box-shadow: none;
}

.tool-documents-card,
.tool-result-card,
.tool-settings-card {
    padding: 18px;
}

.tool-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
}

.tool-card-header h3,
.tool-settings-card h3 {
    margin: 0 0 5px;
    font-size: 17px;
    line-height: 1.2;
}

.tool-card-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.tool-attachment-tray {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 2px 2px 10px;
    scroll-snap-type: x proximity;
}

.tool-attachment-tile {
    width: 136px;
    flex: 0 0 136px;
    display: grid;
    gap: 8px;
    scroll-snap-align: start;
}

.tool-attachment-preview {
    position: relative;
    width: 136px;
    height: 136px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(148, 163, 184, 0.32);
    border-radius: 12px;
    background: rgba(248, 250, 252, 0.82);
    overflow: hidden;
}

body:not(.light-theme) .tool-attachment-preview {
    background: rgba(255, 255, 255, 0.05);
}

.tool-attachment-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pdf-preview-tile {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 100%;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 7px;
    padding: 18px 16px 14px;
    border-radius: inherit;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98)),
        radial-gradient(circle at 70% 20%, rgba(124, 92, 255, 0.16), transparent 34%);
    color: #475569;
    overflow: hidden;
}

.document-preview-tile {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 100%;
    display: grid;
    place-items: center;
    padding: 10px;
    border-radius: inherit;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 245, 249, 0.98)),
        radial-gradient(circle at 18% 18%, rgba(99, 102, 241, 0.11), transparent 36%);
    color: #334155;
    overflow: hidden;
}

.document-preview-fold {
    position: absolute;
    top: 0;
    right: 0;
    width: 26px;
    height: 26px;
    background: linear-gradient(135deg, rgba(226, 232, 240, 0) 0 50%, rgba(226, 232, 240, 0.95) 51% 100%);
}

.document-preview-sheet {
    min-width: 0;
    min-height: 0;
    width: auto;
    height: min(84%, 118px);
    max-width: 70%;
    aspect-ratio: 0.72 / 1;
    padding: 8px 7px;
    border-radius: 5px;
    background: #ffffff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
    overflow: hidden;
    display: grid;
    align-content: start;
    gap: 3px;
}

.document-preview-line {
    width: 74%;
    height: 4px;
    border-radius: 999px;
    background: rgba(100, 116, 139, 0.32);
}

.document-preview-line-wide {
    width: 88%;
}

.document-preview-line-short {
    width: 52%;
}

.document-preview-text-line {
    display: -webkit-box;
    max-width: 100%;
    color: rgba(15, 23, 42, 0.86);
    font-size: 3.4px;
    line-height: 1.28;
    font-weight: 700;
    white-space: normal;
    overflow: hidden;
    overflow-wrap: anywhere;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.document-preview-text-line-title {
    font-weight: 900;
}

.tool-attachment-preview .document-preview-text-line {
    color: rgba(15, 23, 42, 0.86);
    font-size: 3.4px;
    line-height: 1.28;
}

.document-preview-html {
    color: rgba(15, 23, 42, 0.88);
    font-size: 3.8px;
    line-height: 1.28;
    font-weight: 700;
}

.document-preview-html p,
.document-preview-html ul,
.document-preview-html ol {
    margin: 0 0 2px;
}

.document-preview-html ul,
.document-preview-html ol {
    padding-left: 10px;
}

.document-preview-html li {
    margin: 0 0 2px;
}

.document-preview-tile.file-thumb-img,
.document-preview-tile.doc-thumb-img,
.document-preview-tile.tool-document-thumb,
.document-preview-tile.tool-large-document-thumb {
    object-fit: initial;
}

.tool-large-document-thumb {
    border-radius: 12px;
    padding: 22px;
}

.tool-large-document-thumb .document-preview-text-line {
    font-size: 7px;
    line-height: 1.34;
}

.tool-large-document-thumb .document-preview-sheet {
    width: auto;
    height: min(86%, 300px);
    max-width: 68%;
    aspect-ratio: 0.72 / 1;
    padding: 18px 16px;
    border-radius: 8px;
    gap: 7px;
}

.tool-large-document-thumb .document-preview-html {
    font-size: 8px;
    line-height: 1.42;
}

.pdf-preview-tile.file-thumb-img,
.pdf-preview-tile.tool-pdf-thumb {
    object-fit: initial;
}

.pdf-preview-fold {
    position: absolute;
    top: 0;
    right: 0;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, rgba(226, 232, 240, 0) 0 50%, rgba(226, 232, 240, 0.95) 51% 100%);
}

.pdf-preview-line {
    width: 72%;
    height: 6px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.5);
}

.pdf-preview-line-wide {
    width: 82%;
}

.pdf-preview-line-short {
    width: 48%;
}

.pdf-preview-badge {
    margin-top: 6px;
    padding: 3px 7px;
    border-radius: 7px;
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0;
}

body:not(.light-theme) .pdf-preview-tile {
    background:
        linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(226, 232, 240, 0.98)),
        radial-gradient(circle at 70% 20%, rgba(124, 92, 255, 0.18), transparent 34%);
}

body:not(.light-theme) .document-preview-tile {
    background:
        linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(226, 232, 240, 0.98)),
        radial-gradient(circle at 18% 18%, rgba(99, 102, 241, 0.12), transparent 36%);
}

.tool-attachment-preview > svg {
    width: 38px;
    height: 38px;
}

.tool-attachment-preview .tool-attachment-remove {
    position: absolute;
    top: 7px;
    right: 7px;
    z-index: 3;
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
    padding: 0 !important;
    border: 0;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.82);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 0;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
    transition: transform 0.15s ease, background 0.15s ease;
    appearance: none;
    -webkit-appearance: none;
}

.tool-attachment-preview .tool-attachment-remove:hover {
    transform: scale(1.08);
    background: rgba(15, 23, 42, 0.96);
}

.tool-attachment-remove svg {
    width: 10px !important;
    height: 10px !important;
    display: block;
    pointer-events: none;
}

.tool-attachment-tile > strong {
    color: inherit;
    font-size: 12px;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 30px;
}

.tool-attachment-tile > span {
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.25;
}

.tool-attachment-empty {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 142px;
}

.tool-attachment-empty p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.tool-attachment-add {
    width: 136px;
    min-width: 136px;
    min-height: 136px;
    border-radius: 12px;
}

.tool-result-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.tool-result-file {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.tool-result-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.11);
    color: #ef4444;
}

.tool-result-icon-glyph {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
}

.tool-result-icon svg {
    width: 22px;
    height: 22px;
    display: block;
    margin: 0;
    transform: none;
}

.tool-result-file strong,
.tool-result-file span {
    display: block;
}

.tool-result-file strong {
    font-size: 13px;
    margin-bottom: 3px;
}

.tool-result-file span {
    color: var(--text-secondary);
    font-size: 12px;
}

.tool-result-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.compression-choice {
    display: grid;
    width: 100%;
    gap: 3px;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, 0.26);
    border-radius: 8px;
    margin-bottom: 8px;
    background: rgba(148, 163, 184, 0.05);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.18s var(--ease-out), background 0.18s var(--ease-out), transform 0.18s var(--ease-out);
}

.compression-choice.active {
    border-color: rgba(124, 92, 255, 0.65);
    background: rgba(124, 92, 255, 0.08);
}

.compression-choice:hover {
    transform: translateY(-1px);
    border-color: rgba(124, 92, 255, 0.45);
}

.compression-choice:focus-visible {
    outline: 2px solid rgba(124, 92, 255, 0.48);
    outline-offset: 2px;
}

.compression-choice strong {
    font-size: 13px;
}

.compression-choice span {
    color: var(--text-secondary);
    font-size: 12px;
}

.tool-settings-card .btn-primary,
.tool-add-more {
    width: 100%;
    justify-content: center;
    margin-top: 14px;
}

.tool-mini-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.tool-mini-actions button,
.tool-toolbar button,
.tool-add-more {
    border: 1px solid rgba(148, 163, 184, 0.26);
    border-radius: 8px;
    background: rgba(148, 163, 184, 0.08);
    color: inherit;
    font-family: var(--font-primary);
    font-size: 12px;
    font-weight: 800;
    padding: 9px 10px;
    cursor: pointer;
}

.tool-toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.page-thumb-grid {
    grid-template-columns: repeat(4, minmax(92px, 1fr));
}

.page-thumb-grid span,
.page-add-tile {
    min-height: 128px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.86);
    color: #0f172a;
    font-weight: 800;
}

body:not(.light-theme) .page-thumb-grid span,
body:not(.light-theme) .page-add-tile {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.page-add-tile {
    display: grid;
    place-items: center;
    gap: 4px;
    border-style: dashed;
    font: inherit;
    cursor: pointer;
}

.page-add-tile small {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
}

.tool-grid-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
}

.file-list {
    grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
}

.file-row {
    min-width: 0;
}

.file-right {
    justify-content: flex-start;
}

@keyframes toolContentMorph {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.992);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toolHeadingMorph {
    from {
        opacity: 0;
        transform: translateX(-12px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toolIconMorph {
    from {
        opacity: 0;
        transform: scale(0.78) rotate(-10deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

@keyframes toolPanelsMorph {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 980px) {
    .tool-app-shell {
        position: fixed;
        inset: 0;
        width: 100vw;
        min-height: 100vh;
        min-height: 100dvh;
        height: 100vh;
        height: 100dvh;
        margin: 0;
        border-radius: 0;
        grid-template-columns: 1fr;
    }

    .tool-app-sidebar {
        position: static;
        display: block;
        border-right: 0;
        border-bottom: 1px solid rgba(148, 163, 184, 0.22);
    }

    .tool-side-logo {
        display: none;
    }

    .tool-side-nav {
        display: flex;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .tool-side-item {
        width: auto;
        white-space: nowrap;
        flex: 0 0 auto;
    }

    .tool-settings-link {
        display: none;
    }

    .tool-workbench-grid,
    .tool-convert-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    body.tool-shell-active .main-content {
        padding: 0;
    }

    .tool-app-shell {
        position: fixed;
        inset: 0;
        width: 100vw;
        border-radius: 0;
    }

    .tool-app-content {
        padding: 20px 16px 24px;
    }

    .tool-app-topbar {
        height: auto;
        align-items: flex-start;
        flex-direction: column;
        padding: 14px 16px;
    }

    .tool-top-actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .tool-screen-heading {
        align-items: flex-start;
    }

    .tool-screen-heading h1 {
        font-size: 25px;
    }

    .tool-result-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .page-thumb-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
