*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f5f5f7; color: #1d1d1f; line-height: 1.6; }

.header { background: #fff; border-bottom: 1px solid #e5e5e5; padding: 0 1.5rem; height: 56px; display: flex; align-items: center; }
.header-inner { max-width: 960px; margin: 0 auto; width: 100%; display: flex; justify-content: space-between; align-items: center; }
.header-brand { font-weight: 600; font-size: 1.1rem; color: #1d1d1f; }
.header-nav { display: flex; align-items: center; gap: 1rem; font-size: 0.875rem; }
.header-user { color: #636366; }
.header-link { color: #0066cc; text-decoration: none; background: none; border: none; cursor: pointer; font: inherit; }
.header-link:hover { text-decoration: underline; }
.header-logout-form { display: inline; }

.main-content { max-width: 960px; margin: 2rem auto; padding: 0 1.5rem; }
.footer { text-align: center; padding: 2rem; color: #5c5c61; font-size: 0.8rem; }

.login-body { background: #f5f5f7; display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-container { width: 100%; max-width: 400px; padding: 1.5rem; }
.login-card { background: #fff; border-radius: 12px; padding: 2rem; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.login-card h1 { font-size: 1.5rem; margin-bottom: 1.5rem; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.25rem; color: #424245; }
.form-group input { width: 100%; padding: 0.6rem 0.75rem; border: 1px solid #d2d2d7; border-radius: 8px; font-size: 0.95rem; transition: border-color 0.15s; }
.form-group input:focus { outline: none; border-color: #0066cc; box-shadow: 0 0 0 3px rgba(0,102,204,0.15); }

.btn { display: inline-block; padding: 0.6rem 1.25rem; border: none; border-radius: 8px; font-size: 0.95rem; font-weight: 500; cursor: pointer; text-decoration: none; transition: background 0.15s; }
.btn-primary { background: #0066cc; color: #fff; width: 100%; text-align: center; }
.btn-primary:hover { background: #0055b3; }
.btn-link { background: none; color: #0066cc; padding: 0.4rem; font-size: 0.875rem; }
.btn-link:hover { text-decoration: underline; }

.alert { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.875rem; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

.upload-section { margin-bottom: 2rem; }
.drop-zone { border: 2px dashed #d2d2d7; border-radius: 12px; padding: 2rem; text-align: center; cursor: pointer; transition: border-color 0.15s, background 0.15s; background: #fff; }
.drop-zone:hover, .drop-zone.drag-over { border-color: #0066cc; background: #f0f7ff; }
.drop-zone-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.drop-zone-text-mobile { display: none; }
.drop-zone-hint { font-size: 0.8rem; color: #5c5c61; margin-top: 0.25rem; }

.progress-container { background: #e5e5e5; border-radius: 8px; height: 24px; margin-top: 1rem; position: relative; overflow: hidden; }
.progress-bar { height: 100%; background: #0066cc; border-radius: 8px; transition: width 0.2s; width: 0%; }
.progress-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 0.75rem; font-weight: 600; color: #1d1d1f; }

#uploadMessage { margin-top: 0.75rem; padding: 0.75rem 1rem; border-radius: 8px; font-size: 0.875rem; }
#uploadMessage.msg-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
#uploadMessage.msg-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

.documents-section { background: #fff; border-radius: 12px; padding: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.documents-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.documents-header h2 { font-size: 1.2rem; }

.documents-table { width: 100%; border-collapse: collapse; }
.documents-table th { text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: #6e6e73; padding: 0.5rem 0.75rem; border-bottom: 1px solid #e5e5e5; }
.documents-table td { padding: 0.75rem; border-bottom: 1px solid #f0f0f0; font-size: 0.9rem; }
.documents-table tr:last-child td { border-bottom: none; }

.documents-cards { display: none; }
.doc-card { background: #f9fafb; border-radius: 8px; padding: 0.75rem 1rem; margin-bottom: 0.5rem; }
.doc-card-name { font-weight: 500; font-size: 0.9rem; word-break: break-all; }
.doc-card-meta { font-size: 0.8rem; color: #5c5c61; margin: 0.25rem 0; }

.empty-state { text-align: center; padding: 3rem 1rem; color: #5c5c61; }
.empty-state-hint { font-size: 0.85rem; margin-top: 0.5rem; }

.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 6px; font-size: 0.75rem; font-weight: 600; }
.status-processing { background: #fef3c7; color: #92400e; animation: pulse 2s ease-in-out infinite; }
.status-failed { background: #fef2f2; color: #991b1b; }
.status-ready { background: #f0fdf4; color: #166534; }
.status-downloaded { background: #eff6ff; color: #1e40af; }
.status-confirmed { background: #ecfdf5; color: #065f46; }
.status-deleting { background: #f3f4f6; color: #4b5563; }
.status-unknown { background: #f3f4f6; color: #4b5563; }

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

.setup2fa-container { max-width: 480px; }
.qr-container { text-align: center; margin: 1.5rem 0; }
.qr-container img { max-width: 200px; border-radius: 8px; }

.upload-fallback { margin-top: 1rem; }

@media (prefers-reduced-motion: reduce) {
    .status-processing { animation: none; }
}

@media (max-width: 768px) {
    .drop-zone-text-desktop { display: none; }
    .drop-zone-text-mobile { display: block; }
    .documents-table-wrapper { display: none; }
    .documents-cards { display: block; }
    .main-content { padding: 0 1rem; margin: 1rem auto; }
}
