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

:root {
  --bg: #0f1117; --bg2: #1a1d27; --bg3: #222536;
  --accent: #5865f2; --accent2: #4752c4;
  --green: #2ecc71; --orange: #e67e22; --red: #e74c3c;
  --text: #e2e8f0; --text2: #94a3b8;
  --border: #2d3148; --sidebar-w: 240px; --radius: 12px;
}

body { font-family: 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* ── Auth ── */
.auth-page { display: flex; align-items: center; justify-content: center; }
.auth-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px; width: 100%; max-width: 420px; margin: 20px; }
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo .logo-icon { font-size: 48px; }
.auth-logo h1 { font-size: 22px; margin: 8px 0 4px; }
.auth-logo p { color: var(--text2); font-size: 13px; }

.auth-tabs { display: flex; background: var(--bg3); border-radius: 8px; padding: 4px; margin-bottom: 24px; gap: 4px; }
.auth-tab { flex: 1; padding: 8px; background: transparent; border: none; border-radius: 6px; color: var(--text2); font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.auth-tab.active { background: var(--accent); color: white; }
.auth-tab:hover:not(.active) { background: var(--border); color: var(--text); }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 6px; }
.form-group input { width: 100%; padding: 10px 14px; background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 14px; outline: none; transition: border-color 0.2s; }
.form-group input:focus { border-color: var(--accent); }

.btn-primary { display: block; width: 100%; padding: 12px; background: var(--accent); color: white; border: none; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; transition: background 0.2s; text-align: center; text-decoration: none; margin-top: 4px; }
.btn-primary:hover { background: var(--accent2); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary { padding: 8px 16px; background: var(--bg3); color: var(--text); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-size: 13px; transition: background 0.2s; }
.btn-secondary:hover { background: var(--border); }

.error-msg   { color: var(--red);   font-size: 13px; margin-top: 8px; text-align: center; min-height: 20px; }
.success-msg { color: var(--green); font-size: 13px; margin-top: 8px; text-align: center; min-height: 20px; }
.auth-hint { text-align: center; color: var(--text2); font-size: 13px; margin-top: 20px; }
.auth-hint code { background: var(--bg3); padding: 2px 6px; border-radius: 4px; }

/* ── Dashboard ── */
.dashboard-page { display: flex; }

.sidebar { width: var(--sidebar-w); background: var(--bg2); border-right: 1px solid var(--border); height: 100vh; position: fixed; left: 0; top: 0; display: flex; flex-direction: column; z-index: 100; transition: transform 0.3s; }
.sidebar-header { display: flex; align-items: center; gap: 10px; padding: 20px 16px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 15px; }
.sidebar-header .logo-icon { font-size: 22px; }
.sidebar-nav { padding: 12px 8px; flex: 1; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--text2); text-decoration: none; font-size: 14px; font-weight: 500; transition: all 0.15s; margin-bottom: 2px; }
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: var(--accent); color: white; }
.nav-icon { font-size: 16px; }

.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); }
.user-info { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.user-avatar { font-size: 28px; }
.user-name { font-size: 13px; font-weight: 600; }
.user-email { font-size: 11px; color: var(--text2); }

.btn-logout { width: 100%; padding: 8px; background: transparent; color: var(--red); border: 1px solid var(--red); border-radius: 8px; cursor: pointer; font-size: 13px; transition: all 0.2s; }
.btn-logout:hover { background: var(--red); color: white; }

.sidebar-toggle { display: none; position: fixed; top: 16px; left: 16px; z-index: 200; background: var(--accent); color: white; border: none; border-radius: 8px; padding: 8px 12px; font-size: 18px; cursor: pointer; }

.main-content { margin-left: var(--sidebar-w); flex: 1; padding: 32px; min-height: 100vh; }

.page { display: none; }
.page.active { display: block; }
.page-header { margin-bottom: 24px; }
.page-header h2 { font-size: 22px; font-weight: 700; }
.page-header p { color: var(--text2); font-size: 14px; margin-top: 4px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: flex; align-items: center; gap: 16px; }
.stat-icon { font-size: 32px; }
.stat-value { font-size: 20px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text2); margin-top: 2px; }

.storage-bar-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 24px; }
.storage-bar-header { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 14px; }
.storage-bar { background: var(--bg3); border-radius: 99px; height: 10px; overflow: hidden; }
.storage-bar-fill { height: 100%; border-radius: 99px; background: var(--accent); transition: width 0.5s; }
.storage-bar-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--text2); margin-top: 8px; }

.provider-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.provider-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.provider-card h4 { font-size: 13px; margin-bottom: 8px; }
.mini-bar { background: var(--bg3); border-radius: 99px; height: 6px; overflow: hidden; margin: 6px 0; }
.mini-bar-fill { height: 100%; border-radius: 99px; background: var(--green); transition: width 0.5s; }

.upload-zone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 60px 20px; text-align: center; transition: all 0.2s; margin-bottom: 24px; }
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--accent); background: rgba(88,101,242,0.05); }
.upload-icon { font-size: 48px; margin-bottom: 12px; }
.upload-hint { color: var(--text2); font-size: 13px; margin: 8px 0; }

.upload-progress { margin-bottom: 20px; }
.progress-bar { background: var(--bg3); border-radius: 99px; height: 8px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.3s; }
.hidden { display: none !important; }

.search-bar { margin-bottom: 16px; }
.search-bar input { width: 100%; padding: 10px 16px; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 14px; outline: none; }
.search-bar input:focus { border-color: var(--accent); }

.files-list { display: flex; flex-direction: column; gap: 10px; }
.file-item { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 12px; color: var(--text2); margin-top: 4px; }
.file-actions { display: flex; gap: 8px; flex-shrink: 0; }
.btn-download, .btn-delete { padding: 6px 12px; border-radius: 6px; font-size: 13px; cursor: pointer; border: none; transition: opacity 0.2s; }
.btn-download { background: var(--accent); color: white; }
.btn-delete   { background: var(--red);    color: white; }
.btn-download:hover, .btn-delete:hover { opacity: 0.8; }

.loading     { text-align: center; color: var(--text2); padding: 40px; }
.empty-state { text-align: center; color: var(--text2); padding: 60px; font-size: 14px; line-height: 2; }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: block; }
  .main-content { margin-left: 0; padding: 20px; padding-top: 60px; }
}