:root {
    --bg-main: hsl(222, 47%, 7%);
    --bg-gradient: linear-gradient(135deg, hsl(222, 47%, 7%) 0%, hsl(224, 71%, 4%) 100%);
    --bg-card: rgba(15, 23, 42, 0.65);
    --bg-card-hover: rgba(30, 41, 59, 0.8);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-active: rgba(99, 102, 241, 0.4);
    
    --primary: hsl(239, 84%, 67%);
    --primary-hover: hsl(239, 84%, 60%);
    --primary-glow: rgba(99, 102, 241, 0.15);
    
    --success: hsl(162, 76%, 41%);
    --success-hover: hsl(162, 76%, 36%);
    
    --danger: hsl(348, 89%, 60%);
    --danger-hover: hsl(348, 89%, 52%);
    
    --text-main: hsl(210, 40%, 98%);
    --text-muted: hsl(215, 25%, 68%);
    --text-dark: hsl(215, 15%, 50%);
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg-main);
    background-image: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* App container */
#app {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* 1. LOGIN SCREEN */
.screen {
    flex: 1;
    display: flex;
    height: 100%;
    width: 100%;
}

#login-screen {
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, rgba(99, 102, 241, 0.1) 0%, transparent 60%);
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    animation: fadeIn 0.4s ease-out;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    background: var(--primary-glow);
    color: var(--primary);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.login-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(to right, #fff, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-header p {
    color: var(--text-muted);
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: #fff;
    font-size: 14px;
    transition: var(--transition);
    outline: none;
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: rgba(0, 0, 0, 0.35);
}

/* Buttons */
.btn-primary {
    width: 100%;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    transform: translateY(-1px);
}

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

.error-msg {
    margin-top: 16px;
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.2);
    color: var(--danger);
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    text-align: center;
}

/* 2. DASHBOARD SCREEN & SIDEBAR */
#dashboard-screen {
    display: flex;
    overflow: hidden;
}

.sidebar-resizer {
    width: 10px;
    background: transparent;
    cursor: col-resize;
    position: relative;
    z-index: 20;
    margin-left: -5px;
    margin-right: -5px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.sidebar-resizer::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border-color);
    transition: background-color 0.2s, width 0.2s, left 0.2s;
}

.sidebar-resizer:hover::after,
.sidebar-resizer.resizing::after {
    background: var(--primary);
    width: 2px;
    left: 4px;
}

.sidebar {
    width: 280px;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    height: 100%;
    z-index: 10;
    flex-shrink: 0;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 17px;
    color: #fff;
}

.btn-toggle-sidebar {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    margin: -6px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.btn-toggle-sidebar:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.app-logo svg {
    color: var(--primary);
}

.logo-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Desktop Collapsed Sidebar */
.sidebar.collapsed {
    width: 58px !important;
    min-width: 58px !important;
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .btn-secondary span,
.sidebar.collapsed .btn-upload span,
.sidebar.collapsed .file-list-container,
.sidebar.collapsed .user-info {
    display: none !important;
}

.sidebar.collapsed .sidebar-header {
    padding: 18px 8px;
    justify-content: center;
}

.sidebar.collapsed .app-logo {
    justify-content: center;
    width: 100%;
}

.sidebar.collapsed .sidebar-actions {
    padding: 12px 6px;
    align-items: center;
}

.sidebar.collapsed .action-row {
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.sidebar.collapsed .btn-secondary,
.sidebar.collapsed .btn-upload {
    width: 42px;
    height: 42px;
    padding: 0;
    justify-content: center;
}

.sidebar.collapsed .sidebar-footer {
    padding: 12px 6px;
    justify-content: center;
}

.sidebar.collapsed + .sidebar-resizer {
    display: none;
}

.sidebar-actions {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
}

.btn-secondary, .btn-upload {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-upload {
    background: var(--primary-glow);
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: var(--primary);
}

.btn-upload:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: var(--primary);
}

.file-list-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.file-list-container h3 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dark);
    margin-bottom: 12px;
    font-weight: 600;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    border: 1px solid transparent;
}

.file-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.file-item {
    position: relative;
}

.file-item-actions {
    margin-left: auto;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.file-item:hover .file-item-actions {
    opacity: 1;
}

.btn-item-rename {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-item-rename:hover {
    color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
}

.file-item.active {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.15);
    color: #fff;
}

.file-icon {
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.file-item.active .file-icon {
    color: var(--primary);
}

.file-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.file-name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.file-meta-sub {
    font-size: 11px;
    color: var(--text-dark);
}

.loading-placeholder, .empty-placeholder {
    text-align: center;
    color: var(--text-dark);
    font-size: 13px;
    padding: 20px 0;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.1);
}

.user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-email {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 170px;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--danger);
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    height: 100%;
    background: transparent;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.content-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow: hidden;
    animation: fadeIn 0.2s ease-out;
}

/* Welcome Hero */
.welcome-panel {
    align-items: center;
    justify-content: center;
}

.welcome-hero {
    text-align: center;
    max-width: 480px;
    padding: 40px;
}

.welcome-hero svg {
    color: var(--text-dark);
    margin-bottom: 24px;
    opacity: 0.5;
}

.welcome-hero h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 10px;
}

.welcome-hero p {
    color: var(--text-muted);
    font-size: 14px;
}

/* Shared Header for Panels */
.panel-header {
    padding: 20px 40px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(15, 23, 42, 0.3);
    min-height: 80px;
}

.file-title {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}

.file-info {
    font-size: 12px;
    color: var(--text-dark);
}

.panel-actions {
    display: flex;
    gap: 8px;
}

/* Small Buttons in Action Bar */
.btn-primary-sm, .btn-secondary-sm, .btn-danger-sm, .btn-success-sm {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.btn-primary-sm {
    background: var(--primary);
    color: #fff;
}
.btn-primary-sm:hover {
    background: var(--primary-hover);
}

.btn-secondary-sm {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}
.btn-secondary-sm:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-danger-sm {
    background: rgba(244, 63, 94, 0.12);
    color: var(--danger);
    border: 1px solid rgba(244, 63, 94, 0.2);
}
.btn-danger-sm:hover {
    background: var(--danger);
    color: #fff;
}

.btn-success-sm {
    background: var(--success);
    color: #fff;
}
.btn-success-sm:hover {
    background: var(--success-hover);
}

/* Markdown Viewer Panel */
.markdown-body {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    line-height: 1.62;
    font-size: 15px;
    color: hsl(210, 20%, 90%);
}

.markdown-body h1, .markdown-body h2, .markdown-body h3 {
    color: #fff;
    font-weight: 600;
    margin-top: 24px;
    margin-bottom: 12px;
}

.markdown-body h1 { font-size: 28px; border-bottom: 1px solid var(--border-color); padding-bottom: 8px; }
.markdown-body h2 { font-size: 20px; }
.markdown-body h3 { font-size: 16px; }

.markdown-body p, .markdown-body ul, .markdown-body ol {
    margin-bottom: 16px;
}

.markdown-body ul, .markdown-body ol {
    padding-left: 24px;
}

.markdown-body li {
    margin-bottom: 4px;
}

.markdown-body code {
    font-family: var(--font-mono);
    background: rgba(255, 255, 255, 0.08);
    padding: 2.5px 5px;
    border-radius: 4px;
    font-size: 0.9em;
    color: hsl(340, 80%, 75%);
}

.markdown-body pre {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin-bottom: 16px;
}

.markdown-body pre code {
    background: transparent;
    padding: 0;
    color: var(--text-main);
    font-size: 13.5px;
}

.markdown-body blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 16px;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 16px;
    background: rgba(99, 102, 241, 0.03);
    padding-top: 8px;
    padding-bottom: 8px;
}

.markdown-body a {
    color: var(--primary);
    text-decoration: none;
}

.markdown-body a:hover {
    text-decoration: underline;
}

/* Edit Panel Details */
.edit-filename-input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    padding: 8px 12px;
    outline: none;
    width: 280px;
    transition: var(--transition);
}

.edit-filename-input:focus {
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.35);
}

.editor-container {
    flex: 1;
    display: flex;
    overflow: hidden;
}

#editor-textarea {
    flex: 1;
    background: rgba(10, 15, 30, 0.3);
    border: none;
    resize: none;
    padding: 30px 40px;
    color: hsl(210, 20%, 95%);
    font-family: var(--font-mono);
    font-size: 14.5px;
    line-height: 1.6;
    outline: none;
    overflow-y: auto;
}

#editor-textarea::placeholder {
    color: var(--text-dark);
}

/* TOAST NOTIFICATIONS */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1e293b;
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.1);
    color: hsl(162, 76%, 50%);
}

.toast.error {
    border-color: rgba(244, 63, 94, 0.4);
    background: rgba(244, 63, 94, 0.1);
    color: hsl(348, 89%, 65%);
}

/* UTILS */
.hidden {
    display: none !important;
}

.btn-loader {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.99); }
    to { opacity: 1; transform: scale(1); }
}

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

/* EXPLORER ADDITIONS */
.action-row {
    display: flex;
    gap: 8px;
    width: 100%;
}
.action-row button {
    flex: 1;
}

.breadcrumbs-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 16px;
    width: 100%;
}

.breadcrumbs {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 0;
    font-size: 12.5px;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.15);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.btn-share-folder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 33px;
    height: 33px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-share-folder:hover {
    background: var(--primary-glow);
    color: var(--primary);
    border-color: var(--border-color-active);
}
.breadcrumb-item {
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}
.breadcrumb-item:hover {
    color: var(--primary);
}
.breadcrumb-item.active {
    color: #fff;
    cursor: default;
}
.breadcrumb-separator {
    color: var(--text-dark);
    user-select: none;
}

/* Directory item color */
.file-item.directory .file-icon {
    color: hsl(40, 90%, 55%) !important;
}

/* Preview layouts */
.preview-body-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.image-body {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    max-height: calc(100vh - 120px);
    overflow: auto;
    flex: 1;
}
.image-body img {
    max-width: 100%;
    max-height: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.text-body {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
}
.text-body pre {
    font-family: var(--font-mono);
    font-size: 13.5px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: var(--text-main);
}

.binary-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.pdf-body, .html-body {
    flex: 1;
    display: flex;
    overflow: hidden;
    height: 100%;
}
.pdf-body iframe, .html-body iframe {
    flex: 1;
    width: 100%;
    height: 100%;
    border: none;
    background: #ffffff;
    border-radius: 6px;
}

/* Side Notes Panel */
.preview-workspace {
    flex: 1;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    height: 100%;
}

.notes-panel {
    width: 320px;
    border-left: 1px solid var(--border-color);
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.notes-header h3 {
    font-size: 13px;
    font-weight: 600;
    margin: 0;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#notes-textarea {
    flex: 1;
    padding: 20px;
    border: none;
    resize: none;
    background: transparent;
    color: var(--text-main);
    font-family: inherit;
    font-size: 13.5px;
    line-height: 1.6;
    outline: none;
}

#notes-textarea::placeholder {
    color: var(--text-muted);
}

/* Drag and drop visual feedback */
.file-item[draggable="true"] {
    cursor: grab;
}
.file-item.dragging {
    opacity: 0.45;
}
.file-item.drag-over {
    background: rgba(59, 130, 246, 0.18) !important;
    outline: 2px dashed #3b82f6 !important;
    outline-offset: -2px;
}
.breadcrumb-item.drag-over {
    background: rgba(59, 130, 246, 0.25) !important;
    color: #3b82f6 !important;
    border-radius: 4px;
}

/* DOCX Viewer styles */
.docx-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    height: 100%;
    padding: 24px 16px;
    background: rgba(10, 15, 30, 0.65);
}

.docx-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.docx-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

.docx-loading .btn-loader {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.docx-wrapper {
    background: transparent !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 24px !important;
    width: 100% !important;
}

.docx-wrapper > section.docx {
    background: #ffffff !important;
    color: #1e293b !important;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.45) !important;
    border-radius: 6px !important;
    margin-bottom: 24px !important;
    box-sizing: border-box !important;
    font-family: var(--font-sans) !important;
}

.docx-wrapper > section.docx img {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 4px;
}

.docx-wrapper > section.docx table {
    border-collapse: collapse !important;
    max-width: 100% !important;
}

/* ==========================================================================
   RESPONSIVE & MOBILE (GEMINI-STYLE COLLAPSIBLE SIDEBAR & CLEAN READING VIEW)
   ========================================================================== */

/* Mobile / Desktop Visibility Helpers */
.mobile-only {
    display: none !important;
}
.desktop-only {
    display: inline-flex !important;
}

/* Sidebar Backdrop for Mobile Drawer */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 990;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

/* Mobile Header Hamburger Button */
.btn-mobile-menu-header {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    cursor: pointer;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 500;
    transition: var(--transition);
}
.btn-mobile-menu-header:hover {
    background: var(--primary-glow);
    border-color: var(--primary);
    color: var(--primary);
}

/* Desktop Notes Toggle */
.notes-panel.collapsed {
    display: none !important;
}

/* On mobile / tablet screens (<= 900px), completely hide Notes & Comments as requested */
@media (max-width: 900px) {
    .notes-panel {
        display: none !important;
    }
    .notes-toggle-btn {
        display: none !important;
    }
}

/* Mobile Screens (<= 768px): Narrow Strip + Drawer + Full Screen Reading */
@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }
    .mobile-only {
        display: inline-flex !important;
    }
    .sidebar-resizer {
        display: none !important;
    }

    /* Left Sidebar in narrow rail mode on mobile */
    .sidebar {
        width: 52px !important;
        min-width: 52px !important;
        position: relative;
        z-index: 50;
        background: rgba(10, 15, 30, 0.95);
        border-right: 1px solid var(--border-color);
        transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .sidebar .logo-text,
    .sidebar .btn-secondary span,
    .sidebar .btn-upload span,
    .sidebar .file-list-container,
    .sidebar .user-info {
        display: none !important;
    }
    .sidebar .sidebar-header {
        padding: 14px 6px;
        justify-content: center;
    }
    .sidebar .app-logo {
        justify-content: center;
        width: 100%;
    }
    .sidebar .sidebar-actions {
        padding: 10px 4px;
        align-items: center;
    }
    .sidebar .action-row {
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }
    .sidebar .btn-secondary,
    .sidebar .btn-upload {
        width: 38px;
        height: 38px;
        padding: 0;
        justify-content: center;
    }
    .sidebar .sidebar-footer {
        padding: 10px 4px;
        justify-content: center;
    }
    .sidebar .btn-icon#btn-logout {
        width: 38px;
        height: 38px;
        padding: 0;
        justify-content: center;
    }

    /* Left Sidebar expanded overlay drawer on mobile */
    .sidebar.mobile-open {
        position: fixed !important;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(320px, 86vw) !important;
        min-width: min(320px, 86vw) !important;
        z-index: 1000 !important;
        background: hsl(222, 47%, 9%) !important;
        box-shadow: 0 0 50px rgba(0, 0, 0, 0.85);
        transform: translateX(0);
    }
    .sidebar.mobile-open .logo-text,
    .sidebar.mobile-open .btn-secondary span,
    .sidebar.mobile-open .btn-upload span,
    .sidebar.mobile-open .file-list-container,
    .sidebar.mobile-open .user-info {
        display: flex !important;
    }
    .sidebar.mobile-open .sidebar-header {
        padding: 18px 16px;
        justify-content: flex-start;
    }
    .sidebar.mobile-open .app-logo {
        justify-content: flex-start;
        width: auto;
    }
    .sidebar.mobile-open .sidebar-actions {
        padding: 14px 16px;
        align-items: stretch;
    }
    .sidebar.mobile-open .action-row {
        flex-direction: row;
        gap: 8px;
        width: 100%;
    }
    .sidebar.mobile-open .btn-secondary,
    .sidebar.mobile-open .btn-upload {
        width: auto;
        height: auto;
        padding: 10px 14px;
        justify-content: center;
    }
    .sidebar.mobile-open .file-list-container {
        display: flex !important;
        flex-direction: column;
        padding: 14px 16px;
    }
    .sidebar.mobile-open .sidebar-footer {
        padding: 14px 16px;
        justify-content: space-between;
    }

    /* Responsive Main Content Layout */
    .panel-header {
        padding: 10px 12px;
        min-height: auto;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .file-meta {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
    }
    .file-titles-wrap {
        flex: 1;
        min-width: 0;
        overflow: hidden;
    }
    .file-title {
        font-size: 14px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-bottom: 2px;
    }
    .file-info {
        font-size: 11px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .panel-actions {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 3px;
        gap: 6px;
        flex-wrap: nowrap;
    }
    .panel-actions::-webkit-scrollbar {
        display: none;
    }
    .btn-primary-sm, .btn-secondary-sm, .btn-danger-sm, .btn-success-sm {
        padding: 6px 10px;
        font-size: 12px;
        flex-shrink: 0;
    }

    /* Viewer Bodies */
    .markdown-body {
        padding: 16px 12px;
        font-size: 14px;
    }
    .markdown-body h1 {
        font-size: 20px;
    }
    .markdown-body h2 {
        font-size: 17px;
    }
    .markdown-body h3 {
        font-size: 15px;
    }
    .markdown-body table {
        display: block;
        overflow-x: auto;
        width: 100%;
        -webkit-overflow-scrolling: touch;
        font-size: 13px;
    }
    .markdown-body pre {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 10px;
        font-size: 12px;
    }
    .text-body {
        padding: 16px 12px;
    }
    .text-body pre {
        font-size: 12px;
    }
    .image-body {
        padding: 16px 12px;
    }
    .docx-body {
        padding: 10px 6px;
    }
    .docx-wrapper > section.docx {
        padding: 16px 12px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    .editor-container {
        padding: 0;
    }
    #editor-textarea {
        padding: 14px 12px;
        font-size: 13px;
    }
    .welcome-top-bar {
        width: 100%;
        padding: 10px 12px;
        border-bottom: 1px solid var(--border-color);
        display: flex;
        justify-content: flex-start;
    }
    .welcome-hero {
        padding: 24px 16px;
    }
    .welcome-hero svg {
        width: 44px;
        height: 44px;
        margin-bottom: 14px;
    }
    .welcome-hero h2 {
        font-size: 17px;
    }
    .welcome-hero p {
        font-size: 13px;
    }
    .toast {
        bottom: 16px;
        right: 16px;
        left: 16px;
        font-size: 12.5px;
        padding: 10px 16px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 28px 18px;
        margin: 16px;
        max-width: calc(100vw - 32px);
    }
    .login-header h1 {
        font-size: 20px;
    }
}


