:root {
    --sidebar-width: 250px;
    --sidebar-collapsed: 72px;
    --topbar-height: 60px;
    --brand: #2563eb;
}

* { box-sizing: border-box; }
body { background: #f1f5f9; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }

/* ---------------- App shell ---------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: #0f172a;
    color: #cbd5e1;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    transition: width .2s ease, transform .2s ease;
    z-index: 1040;
    overflow-x: hidden;
}
.sidebar-brand {
    height: var(--topbar-height);
    display: flex; align-items: center; gap: .6rem;
    padding: 0 1rem;
    color: #fff; font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,.08);
    white-space: nowrap;
}
.sidebar-brand i { font-size: 1.4rem; color: var(--brand); }
.sidebar-nav { padding: .75rem .5rem; display: flex; flex-direction: column; gap: .25rem; }
.sidebar-nav .nav-link {
    color: #cbd5e1; border-radius: .5rem; padding: .6rem .8rem;
    display: flex; align-items: center; gap: .75rem; white-space: nowrap;
}
.sidebar-nav .nav-link i { font-size: 1.1rem; min-width: 20px; text-align: center; }
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--brand); color: #fff; }

.main-wrap {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left .2s ease;
    min-width: 0;
}

.topbar {
    height: var(--topbar-height);
    background: #fff;
    display: flex; align-items: center; gap: .75rem;
    padding: 0 1rem;
    position: sticky; top: 0; z-index: 1030;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.topbar-title { font-weight: 600; }
.content { padding: 1.25rem; }

/* Collapsed state (desktop) */
.app-shell.collapsed .sidebar { width: var(--sidebar-collapsed); }
.app-shell.collapsed .sidebar .brand-text,
.app-shell.collapsed .sidebar .nav-text { display: none; }
.app-shell.collapsed .main-wrap { margin-left: var(--sidebar-collapsed); }

/* Mobile: sidebar slides in */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); width: var(--sidebar-width); }
    .app-shell.mobile-open .sidebar { transform: translateX(0); }
    .main-wrap { margin-left: 0 !important; }
    .app-shell.collapsed .sidebar { width: var(--sidebar-width); }
}

/* ---------------- Stat cards ---------------- */
.stat-card .stat-icon {
    width: 52px; height: 52px; border-radius: .75rem;
    display: flex; align-items: center; justify-content: center; font-size: 1.5rem;
}
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat-label { color: #64748b; font-size: .85rem; }

/* ---------------- Folder cards ---------------- */
.folder-card .folder-link { text-decoration: none; color: inherit; display: flex; align-items: center; gap: .6rem; }
.folder-card .folder-link i { font-size: 1.5rem; }
.folder-card .folder-name { font-weight: 500; word-break: break-word; }

/* ---------------- Gallery ---------------- */
.gallery-item { position: relative; overflow: hidden; }
.gallery-item img { width: 100%; height: 150px; object-fit: cover; display: block; }
.gallery-delete { position: absolute; top: .4rem; right: .4rem; padding: .1rem .4rem; opacity: .85; }

.upload-zone {
    border: 2px dashed #cbd5e1; border-radius: .75rem;
    padding: 1.5rem; text-align: center; cursor: pointer;
    transition: border-color .15s, background .15s;
}
.upload-zone.dragover { border-color: var(--brand); background: #eff6ff; }
.upload-inner { pointer-events: none; }

/* ---------------- Login ---------------- */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #1e3a8a, #2563eb);
    padding: 1rem;
}
.login-card { width: 100%; max-width: 420px; border-radius: 1rem; }
.login-logo {
    width: 68px; height: 68px; border-radius: 50%;
    background: #eff6ff; color: var(--brand);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 2rem;
}
