:root {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #0f172a;
    --border: #334155;
    --text: #e2e8f0;
    --text-dim: #94a3b8;
    --text-muted: #64748b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-2: #6366f1;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --radius: 10px;
    --sidebar-w: 240px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }
body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
code { background: rgba(255,255,255,.06); padding: 2px 6px; border-radius: 4px; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
h1 { font-size: 22px; font-weight: 600; margin: 0; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 14px; color: var(--text); text-transform: uppercase; letter-spacing: .4px; }
hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* Layout */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    padding: 18px 0;
    overflow-y: auto;
}
.sidebar .brand { padding: 0 18px 18px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.sidebar .brand a { font-size: 18px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.sidebar .brand span { color: var(--accent); }
.sidebar nav { display: flex; flex-direction: column; padding: 0 10px; flex: 1; }
.sidebar nav a {
    display: block; padding: 9px 14px; border-radius: 8px;
    color: var(--text-dim); font-weight: 500; margin-bottom: 2px;
    transition: background .15s, color .15s;
}
.sidebar nav a:hover { background: rgba(255,255,255,.04); color: var(--text); }
.nav-sep {
    font-size: 11px; color: var(--text-muted); text-transform: uppercase;
    letter-spacing: .7px; padding: 16px 14px 6px; font-weight: 600;
}
.sidebar-footer {
    margin-top: auto; padding: 14px 16px; border-top: 1px solid var(--border); font-size: 13px;
    display: flex; flex-direction: column; gap: 4px;
}
.sidebar-footer a { color: var(--text); font-weight: 500; }
.sidebar-footer .role { color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.sidebar-footer .logout button {
    background: transparent; border: 1px solid var(--border); color: var(--text-dim);
    padding: 6px 12px; border-radius: 6px; font-size: 12px; cursor: pointer; margin-top: 6px;
}
.sidebar-footer .logout button:hover { background: rgba(255,255,255,.04); color: var(--text); }

main {
    margin-left: var(--sidebar-w);
    padding: 28px 32px;
    max-width: 1240px;
}

body.centered { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
body.centered main { margin: 0; padding: 0; }

/* Page header */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.page-header .actions { display: flex; gap: 8px; align-items: center; }

/* Cards */
.card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
    padding: 20px 22px; margin-bottom: 18px;
}
.card h2 { margin-top: 0; border-bottom: 1px solid var(--border); padding-bottom: 10px; }

/* Grids */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 960px) { .grid-2 { grid-template-columns: 1fr; } }

/* Forms */
label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 5px; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=url], input[type=search], input[type=date], select, textarea {
    width: 100%; padding: 9px 12px; background: var(--bg-input);
    border: 1px solid var(--border); border-radius: 8px; color: var(--text);
    font-size: 14px; font-family: inherit; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
input[disabled] { opacity: .5; }
textarea { resize: vertical; min-height: 70px; }
.field { margin-bottom: 14px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .row { grid-template-columns: 1fr; } }
.muted { color: var(--text-muted); font-size: 13px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input, .inline-form select { flex: 1; min-width: 140px; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(255,255,255,.06); color: var(--text); border: 1px solid var(--border);
    padding: 8px 14px; border-radius: 8px; font-size: 13.5px; font-weight: 500;
    cursor: pointer; transition: background .15s, border-color .15s, transform .1s;
    font-family: inherit; text-decoration: none; line-height: 1;
}
.btn:hover { background: rgba(255,255,255,.1); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: none; color: #fff; padding: 9px 16px; }
.btn-primary:hover { opacity: .92; color: #fff; }
.btn-danger { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.3); color: #fca5a5; }
.btn-danger:hover { background: rgba(239,68,68,.2); color: #fecaca; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: rgba(255,255,255,.06); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; padding: 11px; }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table thead th {
    text-align: left; padding: 10px 12px; color: var(--text-muted); font-weight: 500;
    font-size: 12px; text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--border);
}
.table tbody td { padding: 11px 12px; border-bottom: 1px solid rgba(255,255,255,.04); vertical-align: middle; }
.table tbody tr:hover { background: rgba(255,255,255,.02); }
.table tbody tr:last-child td { border-bottom: none; }

/* Flash */
.flash {
    padding: 11px 16px; border-radius: 8px; margin-bottom: 14px; font-size: 13.5px;
    display: flex; align-items: center; gap: 8px;
}
.flash-success { background: rgba(34,197,94,.12); border: 1px solid rgba(34,197,94,.3); color: #86efac; }
.flash-error { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.3); color: #fca5a5; }
.flash-info { background: rgba(59,130,246,.12); border: 1px solid rgba(59,130,246,.3); color: #93c5fd; }

/* Auth */
.auth-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px;
    padding: 36px 32px; width: 100%; max-width: 400px; box-shadow: 0 20px 50px rgba(0,0,0,.3);
}
.auth-card h1 { font-size: 24px; text-align: center; margin-bottom: 4px;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.auth-card .muted { text-align: center; margin-bottom: 24px; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; }
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; font-weight: 500; }
.stat-value { font-size: 26px; font-weight: 600; color: var(--text); }

/* Pills / tags */
.pill {
    display: inline-block; padding: 2px 8px; border-radius: 999px;
    background: rgba(255,255,255,.08); color: var(--text-dim);
    font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .4px;
}
.pill-ok { background: rgba(34,197,94,.14); color: #86efac; }
.pill-off { background: rgba(148,163,184,.14); color: var(--text-muted); }
.tag {
    display: inline-block; padding: 1px 7px; border-radius: 4px; margin-left: 6px;
    background: rgba(99,102,241,.15); color: #a5b4fc; font-size: 11px;
}

/* Mime badges */
.mime-badge {
    display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: middle;
}
.mime-image { background: #22c55e; }
.mime-video { background: #ef4444; }
.mime-audio { background: #f59e0b; }
.mime-pdf { background: #dc2626; }
.mime-doc, .mime-sheet, .mime-slides { background: #3b82f6; }
.mime-archive { background: #a855f7; }
.mime-text { background: #64748b; }
.mime-file { background: #94a3b8; }

/* File preview */
.file-preview { max-width: 100%; max-height: 480px; border-radius: 10px; background: #000; display: block; margin: 0 auto; }
.file-preview-frame { width: 100%; height: 480px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.file-icon-big {
    width: 140px; height: 180px; background: rgba(255,255,255,.05); border: 2px dashed var(--border);
    border-radius: 12px; display: flex; align-items: center; justify-content: center;
    color: var(--text-dim); font-size: 16px; font-weight: 600; letter-spacing: 1px; margin: 0 auto;
}

/* Meta list */
.meta { margin: 0; display: grid; grid-template-columns: 120px 1fr; gap: 6px 14px; font-size: 13.5px; }
.meta dt { color: var(--text-muted); font-weight: 500; }
.meta dd { margin: 0; word-break: break-word; }

/* Copy rows */
.copy-row { display: flex; gap: 6px; }
.copy-row input { flex: 1; font-size: 12.5px; font-family: ui-monospace, Menlo, monospace; }
.copy-variants { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

/* Dropzone */
.dropzone {
    position: relative; border: 2px dashed var(--border); border-radius: 12px; padding: 40px 20px;
    text-align: center; transition: border-color .15s, background .15s; cursor: pointer;
    background: rgba(255,255,255,.02);
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: rgba(59,130,246,.06); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dz-icon { font-size: 40px; color: var(--text-muted); line-height: 1; margin-bottom: 10px; }
.dz-text { font-size: 15px; color: var(--text); margin-bottom: 6px; font-weight: 500; }
.dz-hint { font-size: 12px; color: var(--text-muted); }
.selected-file {
    margin-top: 14px; padding: 10px 14px; background: rgba(59,130,246,.08);
    border: 1px solid rgba(59,130,246,.25); border-radius: 8px; font-size: 13px;
}
.progress { margin-top: 14px; height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; }
.progress .bar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .2s; }

/* Filters */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filters input, .filters select { flex: 0 1 auto; min-width: 120px; width: auto; }
.filters input[type=search] { flex: 1 1 220px; }

/* Pagination */
.pagination { display: flex; gap: 4px; justify-content: center; margin: 18px 0; }
.pagination a {
    padding: 6px 12px; border-radius: 6px; background: rgba(255,255,255,.04);
    color: var(--text-dim); font-size: 13px;
}
.pagination a:hover { background: rgba(255,255,255,.08); color: var(--text); }
.pagination a.active { background: var(--accent); color: #fff; }

/* Mobile */
@media (max-width: 800px) {
    .sidebar { position: static; width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
    main { margin-left: 0; padding: 18px; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
}
