:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #172033;
    --muted: #6b7280;
    --border: #e5eaf1;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #059669;
    --danger: #dc2626;
    --shadow: 0 10px 30px rgba(15, 23, 42, .07);
    --radius: 16px;
    --transition: 180ms ease;
}
[data-theme="dark"] {
    --bg: #0b1220;
    --surface: #111a2b;
    --surface-soft: #172235;
    --text: #f3f4f6;
    --muted: #9aa5b5;
    --border: #253249;
    --primary: #60a5fa;
    --primary-hover: #93c5fd;
    --success: #34d399;
    --danger: #f87171;
    --shadow: 0 14px 35px rgba(0,0,0,.22);
}
* { box-sizing: border-box; }
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; }
.container { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 32px 0 48px; }
.topbar, .header-actions { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:28px; }
.brand { display:flex; align-items:center; gap:12px; text-decoration:none; font-weight:800; font-size:20px; }
.brand-mark { width:40px; height:40px; display:grid; place-items:center; border-radius:12px; background:var(--primary); color:#fff; }
h1,h2,h3 { margin:0 0 8px; letter-spacing:-.02em; }
h1 { font-size: clamp(28px, 4vw, 40px); }
h2 { font-size: 21px; }
p { color:var(--muted); line-height:1.6; }
.subtitle { margin:0; }
.card {
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:var(--radius);
    box-shadow:var(--shadow);
}
.toolbar { display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.btn {
    display:inline-flex; align-items:center; justify-content:center; gap:8px;
    min-height:40px; padding:9px 14px; border-radius:10px;
    border:1px solid transparent; font:inherit; font-size:14px; font-weight:700;
    text-decoration:none; cursor:pointer; transition:all var(--transition);
}
.btn:hover { transform:translateY(-1px); }
.btn-primary { background:var(--primary); color:#fff; }
.btn-primary:hover { background:var(--primary-hover); }
.btn-secondary { background:var(--surface); border-color:var(--border); color:var(--text); }
.btn-success { background:var(--success); color:#fff; }
.btn-danger { background:var(--danger); color:#fff; }
.btn-ghost { background:transparent; color:var(--muted); }
.theme-toggle { width:40px; padding:0; }
.stats { display:grid; grid-template-columns:repeat(3,1fr); gap:14px; margin-bottom:22px; }
.stat { padding:18px; }
.stat-label { color:var(--muted); font-size:13px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; }
.stat-value { font-size:26px; font-weight:800; margin-top:6px; }
.grid { display:grid; grid-template-columns:320px 1fr; gap:22px; align-items:start; }
.panel { padding:22px; }
.file-list { display:flex; flex-direction:column; }
.file-row {
    display:flex; align-items:center; gap:14px; padding:15px 0;
    border-bottom:1px solid var(--border);
}
.file-row:last-child { border-bottom:0; }
.file-icon {
    width:44px; height:44px; flex:0 0 44px; border-radius:12px;
    display:grid; place-items:center; background:var(--surface-soft);
    border:1px solid var(--border); color:var(--primary); font-size:11px; font-weight:900;
}
.file-main { min-width:0; flex:1; }
.file-name { font-weight:750; overflow-wrap:anywhere; }
.file-meta { color:var(--muted); font-size:12px; margin-top:4px; }
.file-actions { display:flex; gap:7px; flex-wrap:wrap; justify-content:flex-end; }
.badge { display:inline-flex; padding:3px 8px; border-radius:999px; font-size:11px; font-weight:800; background:var(--surface-soft); color:var(--muted); }
.flash { padding:13px 15px; border-radius:12px; margin-bottom:18px; font-weight:650; border:1px solid var(--border); }
.flash-success { background:rgba(5,150,105,.10); color:var(--success); }
.flash-error { background:rgba(220,38,38,.10); color:var(--danger); }
.empty { text-align:center; padding:38px 18px; color:var(--muted); }
form { margin:0; }
.form-group { margin-bottom:15px; }
label { display:block; font-size:13px; font-weight:750; margin-bottom:7px; }
input[type="text"], input[type="password"], input[type="file"] {
    width:100%; border:1px solid var(--border); border-radius:10px;
    padding:11px 12px; background:var(--surface); color:var(--text); font:inherit;
}
input:focus { outline:2px solid color-mix(in srgb, var(--primary) 25%, transparent); border-color:var(--primary); }
.upload-note { font-size:12px; color:var(--muted); margin:10px 0 16px; }
.pagination { display:flex; gap:7px; flex-wrap:wrap; margin-top:20px; }
.page-link { min-width:38px; height:38px; padding:0 10px; display:inline-flex; align-items:center; justify-content:center; border:1px solid var(--border); border-radius:9px; text-decoration:none; font-size:13px; font-weight:700; }
.page-link.active { background:var(--primary); border-color:var(--primary); color:#fff; }
.footer-actions { margin-top:22px; display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.login-wrap { min-height:100vh; display:grid; place-items:center; padding:20px; }
.login-card { width:min(420px,100%); padding:28px; }
.login-card .brand { margin-bottom:24px; }
@media (max-width: 820px) {
    .grid { grid-template-columns:1fr; }
    .stats { grid-template-columns:1fr; }
}
@media (max-width: 620px) {
    .container { width:min(100% - 20px, 1180px); padding-top:18px; }
    .topbar, .header-actions { align-items:flex-start; flex-direction:column; }
    .file-row { align-items:flex-start; flex-wrap:wrap; }
    .file-actions { width:100%; justify-content:flex-start; margin-left:58px; }
}
