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

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #10b981;
    --warning: #f59e0b;
    --bg: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-secondary: #64748b;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* Navbar */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}
.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    padding: 0;
}
.nav-brand { font-size: 1.3rem; font-weight: 700; color: var(--primary); text-decoration: none !important; }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-user { font-weight: 600; color: var(--text); }

/* Main */
.main-content { padding: 24px 20px 40px; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 20px; border: 2px solid transparent; border-radius: var(--radius);
    font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: all .15s;
    line-height: 1.4; text-decoration: none !important;
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--bg); border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-upload { cursor: pointer; }

/* Storage bar */
.storage-bar { background: var(--surface); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 20px; box-shadow: var(--shadow); }
.storage-info { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 0.88rem; color: var(--text-secondary); }
.progress { height: 8px; background: #e2e8f0; border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 99px; transition: width .3s; }
.progress-fill.warning { background: var(--warning); }
.progress-fill.danger { background: var(--danger); }

/* Toolbar */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.upload-form { display: flex; align-items: center; gap: 10px; }
.upload-hint { font-size: 0.8rem; color: var(--text-secondary); }
.search-form { display: flex; gap: 8px; align-items: center; }
.search-form input { padding: 8px 14px; border: 2px solid var(--border); border-radius: var(--radius); font-size: 0.9rem; outline: none; width: 220px; transition: border-color .15s; }
.search-form input:focus { border-color: var(--primary); }

/* File Table */
.file-table-wrap { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
.file-table { width: 100%; border-collapse: collapse; }
.file-table th {
    text-align: left; padding: 14px 20px; font-size: 0.78rem; font-weight: 700; color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: .05em; background: var(--bg); border-bottom: 2px solid var(--border);
}
.file-table td { padding: 12px 20px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.file-table tr:last-child td { border-bottom: none; }
.file-table tr:hover td { background: #f1f5f9; }
.file-name { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.file-icon { font-size: 1.3rem; flex-shrink: 0; }
.file-size, .file-date { white-space: nowrap; color: var(--text-secondary); }
.file-actions { display: flex; gap: 8px; white-space: nowrap; }

/* Empty */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.empty-icon { font-size: 4rem; margin-bottom: 12px; }

/* Pagination */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 24px; }

/* Auth Pages */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 20px; }
.auth-container { width: 100%; max-width: 420px; }
.auth-card { background: var(--surface); border-radius: 16px; padding: 40px; box-shadow: var(--shadow-lg); }
.auth-header { text-align: center; margin-bottom: 28px; }
.auth-header h1 { font-size: 1.8rem; color: var(--primary); margin-bottom: 6px; }
.auth-header p { 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: 0.88rem; font-weight: 600; }
.form-group input {
    padding: 10px 14px; border: 2px solid var(--border); border-radius: var(--radius);
    font-size: 0.95rem; outline: none; transition: border-color .15s;
}
.form-group input:focus { border-color: var(--primary); }
.auth-footer { text-align: center; margin-top: 24px; font-size: 0.9rem; color: var(--text-secondary); }

/* Alerts */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 0.9rem; }
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }

/* Admin */
.admin-nav { display: flex; gap: 10px; margin-bottom: 24px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 30px; }
.stat-card {
    background: var(--surface); border-radius: var(--radius); padding: 24px;
    text-align: center; box-shadow: var(--shadow);
}
.stat-icon { font-size: 2.2rem; margin-bottom: 8px; }
.stat-value { font-size: 1.6rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 0.88rem; color: var(--text-secondary); margin-top: 4px; }
.quota-form { display: inline-flex; align-items: center; gap: 6px; }
.input-sm { padding: 6px 10px; border: 2px solid var(--border); border-radius: 6px; font-size: 0.85rem; outline: none; }
.input-sm:focus { border-color: var(--primary); }

@media (max-width: 768px) {
    .toolbar { flex-direction: column; align-items: stretch; }
    .search-form input { width: 100%; }
    .auth-card { padding: 28px 24px; }
    .file-table th, .file-table td { padding: 10px 12px; font-size: 0.82rem; }
    .file-actions { flex-direction: column; gap: 4px; }
}
