* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, 'Amazon Ember', Helvetica, Arial, sans-serif; background: #f9fafb; color: #0f1111; font-size: 14px; min-height: 100vh; display: flex; flex-direction: column; }

/* Header */
.header { background: #232f3e; padding: 8px 16px; display: flex; align-items: center; justify-content: space-between; }
.header-left { display: flex; align-items: center; gap: 16px; }
.header-logo { color: #fff; font-size: 16px; font-weight: 400; }
.header-logo span { font-weight: 700; }
.header-right { display: flex; align-items: center; gap: 16px; color: #fff; font-size: 13px; }
.header-right .user-email { color: #adb5bd; font-size: 12px; }
.header-right .logout-btn { background: transparent; border: 1px solid #fff; color: #fff; padding: 4px 12px; border-radius: 3px; font-size: 12px; cursor: pointer; transition: background .15s; }
.header-right .logout-btn:hover { background: rgba(255,255,255,.1); }

/* Login screen */
.login-screen { display: flex; align-items: center; justify-content: center; flex: 1; padding: 24px; }
.login-box { background: #fff; border: 1px solid #d5d9d9; border-radius: 8px; padding: 40px; max-width: 400px; width: 100%; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.login-box h2 { font-size: 20px; margin-bottom: 8px; }
.login-box p { font-size: 14px; color: #565959; margin-bottom: 24px; }
.login-box .login-btn { background: #0073bb; color: #fff; border: none; padding: 12px 24px; border-radius: 4px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background .15s; width: 100%; }
.login-box .login-btn:hover { background: #005a8e; }
.login-box .login-icon { font-size: 48px; margin-bottom: 16px; }

/* Page header */
.page-header { background: #fff; border-bottom: 1px solid #d5d9d9; padding: 24px 32px; }
.page-header h1 { font-size: 24px; font-weight: 700; color: #0f1111; margin-bottom: 4px; }
.page-header .subtitle { font-size: 14px; color: #565959; }

/* Main content */
.main-content { flex: 1; padding: 24px 32px; width: 100%; }

/* Folder section */
.folder-section { background: #fff; border: 1px solid #d5d9d9; border-radius: 8px; margin-bottom: 16px; overflow: hidden; }
.folder-header { padding: 16px 20px; display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; transition: background .15s; }
.folder-header:hover { background: #f7fafa; }
.folder-header .folder-icon { font-size: 20px; }
.folder-header .folder-info { flex: 1; }
.folder-header .folder-label { font-size: 15px; font-weight: 600; color: #0f1111; }
.folder-header .folder-meta { display: flex; gap: 12px; margin-top: 4px; align-items: center; flex-wrap: wrap; }
.folder-header .badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; }
.folder-header .badge-format { background: #f0f4ff; color: #0073bb; border: 1px solid #d4e4f7; }
.folder-header .badge-size { background: #fef3e0; color: #8a6d00; border: 1px solid #f5e6c8; }
.folder-header .badge-required { background: #fff0f0; color: #b12704; border: 1px solid #ffcdd2; font-weight: 600; }
.folder-header .badge-optional { background: #f5f5f5; color: #565959; border: 1px solid #e3e6e6; }
.folder-header .file-count { font-size: 12px; color: #565959; }
.folder-header .chevron { font-size: 18px; color: #565959; transition: transform .2s; }
.folder-header .chevron.open { transform: rotate(180deg); }

/* Folder body */
.folder-body { display: none; border-top: 1px solid #e3e6e6; padding: 16px 20px; }
.folder-body.open { display: block; }

/* File grid */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-bottom: 16px; }
.file-card { border: 1px solid #e3e6e6; border-radius: 6px; overflow: hidden; background: #fff; transition: box-shadow .15s; cursor: pointer; }
.file-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.file-card .file-preview { width: 100%; height: 180px; background: #f5f5f5; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.file-card .file-preview .file-type-icon { font-size: 36px; color: #888; }
.file-card .file-details { padding: 10px 12px; }
.file-card .file-name { font-size: 12px; font-weight: 600; color: #0f1111; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.file-card .file-info { font-size: 11px; color: #565959; display: flex; justify-content: space-between; }

/* Drop zone */
.drop-zone { border: 2px dashed #d5d9d9; border-radius: 8px; padding: 24px; text-align: center; cursor: pointer; transition: border-color .2s, background .2s; }
.drop-zone:hover, .drop-zone.drag-over { border-color: #0073bb; background: #f0f8ff; }
.drop-zone .drop-icon { font-size: 32px; margin-bottom: 8px; color: #888; }
.drop-zone .drop-text { font-size: 13px; color: #565959; margin-bottom: 4px; }
.drop-zone .drop-link { color: #0073bb; font-weight: 600; cursor: pointer; }
.drop-zone .drop-hint { font-size: 11px; color: #888; margin-top: 4px; }

/* Empty state */
.empty-state { text-align: center; padding: 32px; }
.empty-state .empty-icon { font-size: 40px; margin-bottom: 8px; color: #ccc; }
.empty-state .empty-text { font-size: 14px; color: #565959; margin-bottom: 16px; }

/* Upload progress */
.upload-progress { margin-top: 12px; padding: 12px 16px; background: #f7fafa; border: 1px solid #d5d9d9; border-radius: 6px; display: none; }
.upload-progress.active { display: block; }
.upload-progress .progress-filename { font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.upload-progress .progress-bar-container { background: #e3e6e6; border-radius: 4px; height: 6px; overflow: hidden; }
.upload-progress .progress-bar { height: 100%; background: #0073bb; border-radius: 4px; width: 0%; transition: width .3s; }
.upload-progress .progress-text { font-size: 11px; color: #565959; margin-top: 4px; }

/* Inline error */
.inline-error { margin-top: 8px; padding: 10px 14px; background: #fff0f0; border: 1px solid #ffcdd2; border-radius: 6px; font-size: 12px; color: #b12704; display: none; }
.inline-error.active { display: flex; align-items: flex-start; gap: 8px; }
.inline-error .error-icon { font-size: 14px; flex-shrink: 0; }
.inline-error .error-dismiss { background: none; border: none; color: #b12704; font-size: 14px; cursor: pointer; margin-left: auto; padding: 0 4px; flex-shrink: 0; }
.inline-error .error-dismiss:hover { color: #0f1111; }

/* Toast */
.toast-container { position: fixed; top: 16px; right: 16px; z-index: 9999; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.toast { padding: 12px 20px; border-radius: 6px; font-size: 13px; font-weight: 500; box-shadow: 0 4px 12px rgba(0,0,0,.15); animation: slideIn .3s ease; display: inline-flex; align-items: center; gap: 8px; max-width: 500px; word-break: break-word; }
.toast.success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.toast.error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.toast-dismiss { background: none; border: none; color: #721c24; font-size: 14px; cursor: pointer; margin-left: 12px; padding: 0 4px; }
.toast-dismiss:hover { color: #0f1111; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

.hidden { display: none !important; }
.loading-text { color: rgba(0,0,0,.25) !important; }

/* Preview modal */
.preview-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.75); z-index: 10000; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .2s; }
.preview-overlay.active { opacity: 1; pointer-events: auto; }
.preview-modal { background: #fff; border-radius: 10px; max-width: 90vw; max-height: 90vh; width: 800px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 8px 32px rgba(0,0,0,.3); }
.preview-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid #e3e6e6; }
.preview-modal-header .modal-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 500px; }
.preview-modal-header .modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: #565959; padding: 4px 8px; border-radius: 4px; margin-left: auto; }
.preview-modal-header .modal-close:hover { background: #f0f0f0; }
.preview-modal-meta { text-align: center; padding: 8px 16px; font-size: 12px; color: #565959; }
.preview-modal-footer { display: flex; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid #e3e6e6; }
.preview-modal-footer .modal-delete { background: none; border: 1px solid #d5d9d9; color: #b12704; font-size: 12px; font-weight: 600; cursor: pointer; padding: 6px 14px; border-radius: 4px; }
.preview-modal-footer .modal-delete:hover { background: #fff0f0; border-color: #b12704; }
.preview-modal-body { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; overflow: auto; min-height: 300px; background: #f5f5f5; }
.preview-modal-body img { max-width: 100%; max-height: 70vh; object-fit: contain; border-radius: 4px; }
.preview-modal-body video { max-width: 100%; max-height: 70vh; border-radius: 4px; }
.preview-modal-body .no-preview { text-align: center; color: #565959; }
.preview-modal-body .no-preview .no-preview-icon { font-size: 48px; margin-bottom: 12px; }
.preview-modal-body .no-preview p { font-size: 14px; }

/* Page header row layout */
.page-header-row { display: flex; align-items: center; justify-content: space-between; }
.page-header-left { flex: 1; }
.page-header-right { flex-shrink: 0; margin-left: 16px; }

/* Switch dropdown */
.switch-dropdown { position: relative; }
.switch-btn { background: #fff; border: 1px solid #d5d9d9; color: #0f1111; padding: 8px 16px; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; transition: border-color .15s, box-shadow .15s; max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switch-btn:hover { border-color: #0073bb; box-shadow: 0 1px 4px rgba(0,115,187,.15); }
.switch-menu { position: absolute; top: calc(100% + 4px); right: 0; background: #fff; border: 1px solid #d5d9d9; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.12); min-width: 220px; max-height: min(300px, 60vh); overflow-y: auto; z-index: 1000; overflow-x: hidden; }
.switch-menu.open { display: block !important; }
.switch-menu-group { padding: 8px 0; }
.switch-menu-group:not(:last-child) { border-bottom: 1px solid #e3e6e6; }
.switch-menu-brand { padding: 6px 16px; font-size: 11px; font-weight: 700; color: #565959; text-transform: uppercase; letter-spacing: 0.5px; }
.switch-menu-item { padding: 8px 16px; font-size: 13px; color: #0f1111; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: background .1s; }
.switch-menu-item:hover { background: #f0f8ff; }
.switch-menu-item.active { color: #0073bb; font-weight: 600; }
.switch-menu-item .check { width: 16px; font-size: 12px; }

/* Load more button */
.load-more-btn { display: block; width: 100%; padding: 12px; margin-top: 16px; background: #fff; border: 1px solid #d5d9d9; border-radius: 6px; font-size: 14px; font-weight: 600; color: #0073bb; cursor: pointer; transition: background .15s, border-color .15s; }
.load-more-btn:hover { background: #f0f8ff; border-color: #0073bb; }
.load-more-btn:disabled { color: #565959; cursor: default; background: #f5f5f5; }

/* Help tab + panel */
.help-tab { position: fixed; top: 120px; right: 0; background: #232f3e; color: #fff; border: none; border-radius: 4px 0 0 4px; width: 32px; height: 32px; font-size: 16px; font-weight: 700; cursor: pointer; z-index: 999; display: none; align-items: center; justify-content: center; }
.help-tab.visible { display: flex; }
.help-tab:hover { background: #37475a; }
.help-panel { position: fixed; top: 0; right: 0; width: 25%; min-width: 320px; height: 100vh; background: #fff; box-shadow: -4px 0 16px rgba(0,0,0,.15); z-index: 10001; display: flex; flex-direction: column; transition: transform .25s ease, visibility .25s; }
.help-panel.hidden { transform: translateX(100%); visibility: hidden; }
.help-panel:not(.hidden) { transform: translateX(0); visibility: visible; }
.help-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid #e3e6e6; flex-shrink: 0; }
.help-panel-title { font-size: 16px; font-weight: 700; }
.help-panel-close { background: none; border: none; font-size: 20px; cursor: pointer; color: #565959; padding: 4px 8px; border-radius: 4px; }
.help-panel-close:hover { background: #f0f0f0; }
.help-panel-body { flex: 1; overflow-y: auto; padding: 20px; font-size: 14px; line-height: 1.6; color: #0f1111; }
.help-panel-body h1 { font-size: 20px; margin-bottom: 12px; }
.help-panel-body h2 { font-size: 17px; margin-top: 20px; margin-bottom: 8px; }
.help-panel-body h3 { font-size: 15px; margin-top: 16px; margin-bottom: 6px; }
.help-panel-body p { margin-bottom: 8px; }
.help-panel-body ul, .help-panel-body ol { margin: 8px 0 8px 20px; }
.help-panel-body li { margin-bottom: 4px; }
.help-panel-body hr { border: none; border-top: 1px solid #e3e6e6; margin: 16px 0; }
.help-panel-body code { background: #f5f5f5; padding: 2px 6px; border-radius: 3px; font-size: 12px; }
