:root {
    --sidebar-w: 256px;
    --sidebar-bg: #1f2937;
    --sidebar-fg: #cbd5e1;
    --sidebar-fg-active: #ffffff;
    --sidebar-active: #2563eb;
    --topbar-h: 56px;
    --content-bg: #f3f4f6;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--content-bg);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- App shell ---------- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--sidebar-bg);
    color: var(--sidebar-fg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    overflow-y: auto;
}

.sidebar-brand {
    font-size: 1.15rem;
    font-weight: 600;
    color: #fff;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    white-space: nowrap;
}

.sidebar-brand i {
    margin-right: 8px;
    color: #60a5fa;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 10px 0;
}

.sidebar-nav .nav-link {
    color: var(--sidebar-fg);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-left: 3px solid transparent;
    text-decoration: none;
    font-size: .95rem;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255, 255, 255, .06);
    color: var(--sidebar-fg-active);
}

.sidebar-nav .nav-link.active {
    background: rgba(37, 99, 235, .18);
    border-left-color: var(--sidebar-active);
    color: var(--sidebar-fg-active);
    font-weight: 500;
}

.sidebar-nav .nav-link i {
    width: 18px;
    text-align: center;
}

/* ---------- Main area ---------- */
.app-main {
    flex: 1 1 auto;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-title {
    font-weight: 600;
    font-size: 1.05rem;
    color: #111827;
}

.topbar-user {
    color: #374151;
    font-size: .9rem;
    display: flex;
    align-items: center;
}

.topbar-user i {
    margin-right: 6px;
    font-size: 1.1rem;
}

.content {
    padding: 24px;
    flex: 1 1 auto;
}

/* ---------- Auth screen ---------- */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    padding: 20px;
}

.auth-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
    padding: 32px;
    width: 100%;
    max-width: 380px;
}

.auth-card h1 {
    font-size: 1.4rem;
    margin: 0 0 4px;
    text-align: center;
}

.auth-card .sub {
    text-align: center;
    color: #6b7280;
    margin-bottom: 22px;
    font-size: .9rem;
}

/* ---------- Helpers ---------- */
.stat-card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    padding: 18px 20px;
    height: 100%;
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.1;
}

.stat-card .stat-label {
    color: #6b7280;
    font-size: .85rem;
    margin-top: 4px;
}

.card-panel {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
}

.thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    background: #f3f4f6;
}

.gallery-img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .85rem;
}

@media (max-width: 768px) {
    .sidebar {
        position: static;
        width: 100%;
        flex-basis: auto;
    }

    .app-main {
        margin-left: 0;
    }

    .app-shell {
        flex-direction: column;
    }
}

/* ---- File-upload wizard ---- */
.wizard-steps { display: flex; flex-wrap: wrap; gap: .5rem; }
.wizard-steps .step {
    padding: .35rem .75rem; border-radius: 999px; font-size: .85rem;
    background: #eef1f5; color: #6b7280; border: 1px solid #e3e7ee;
}
.wizard-steps .step.active { background: #0d6efd; color: #fff; border-color: #0d6efd; }
.wizard-steps .step.done { background: #e7f5ec; color: #198754; border-color: #cdeBD8; }

.stat-num { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }

.dropzone {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 100%; min-height: 180px; padding: 1.5rem; cursor: pointer; text-align: center;
    border: 2px dashed #c4ccd8; border-radius: 12px; background: #f8fafc;
    transition: border-color .15s, background .15s;
}
.dropzone:hover { border-color: #0d6efd; background: #f1f6ff; }
.dropzone.dragover { border-color: #0d6efd; background: #e7f1ff; }
.dropzone.has-file { border-color: #198754; background: #f1fbf4; }
.dropzone-icon { font-size: 2.4rem; color: #6b7280; margin-bottom: .25rem; }
.dropzone-text { font-weight: 600; color: #374151; }
.dropzone-hint { font-size: .8rem; color: #9aa3b2; margin-top: .15rem; }
.dropzone-file { margin-top: .5rem; font-size: .9rem; color: #198754; font-weight: 600; word-break: break-all; }

.preview-table { font-size: .8rem; white-space: nowrap; }
.preview-table td { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.preview-table thead th { position: sticky; top: 0; background: #fff; z-index: 1; }

/* ============================================================
   THEME REFRESH — closer to a SaaS / CRM dashboard
   (appended overrides; cascade wins over earlier rules)
   ============================================================ */
:root {
    --sidebar-active: #6366f1;     /* indigo accent */
    --content-bg: #f1f5f9;         /* slate-100 */
}

body { color: #1e293b; }

/* Sidebar: graphite gradient + indigo brand */
.sidebar {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    box-shadow: 2px 0 12px rgba(2, 6, 23, .18);
}
.sidebar-brand { letter-spacing: .2px; padding: 20px; }
.sidebar-brand i { color: #818cf8; }
.sidebar-nav .nav-link { border-radius: 0 22px 22px 0; margin-right: 12px; transition: background .12s, color .12s; }
.sidebar-nav .nav-link.active {
    background: linear-gradient(90deg, rgba(99,102,241,.25), rgba(99,102,241,.10));
    border-left-color: var(--sidebar-active);
    color: #fff;
}

/* Topbar: white, soft shadow, sticky */
.topbar {
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(15, 23, 42, .06);
    position: sticky; top: 0; z-index: 20;
    border-bottom: 1px solid #e8edf3;
}
.topbar-title { font-weight: 600; color: #0f172a; }

.content { padding: 22px 26px; }

/* Cards: white, rounded, soft shadow */
.card-panel {
    background: #fff;
    border: 1px solid #e8edf3;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .05);
}

/* Stat cards with left accent bar */
.stat-card {
    background: #fff;
    border: 1px solid #e8edf3;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .05);
    padding: 16px 18px;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    background: var(--sidebar-active);
}
.stat-num { font-size: 1.7rem; font-weight: 700; color: #0f172a; }
.stat-label { color: #64748b; font-size: .82rem; }

/* Tables a touch softer */
.table > :not(caption) > * > * { border-color: #eef2f7; }
thead th { color: #475569; font-weight: 600; }

/* Buttons / badges polish */
.btn-primary { background: #4f46e5; border-color: #4f46e5; }
.btn-primary:hover { background: #4338ca; border-color: #4338ca; }
.btn { border-radius: 9px; }
.badge { font-weight: 600; letter-spacing: .2px; }

/* Toast stack (top-right) */
.toast-stack {
    position: fixed; top: 16px; right: 16px; z-index: 1080;
    display: flex; flex-direction: column; gap: 10px;
}

/* Indeterminate upload progress bar */
.upload-progress { height: 8px; border-radius: 6px; overflow: hidden; background: #e2e8f0; }
.upload-progress .bar {
    height: 100%; width: 40%; border-radius: 6px;
    background: linear-gradient(90deg, #6366f1, #818cf8);
    animation: upload-slide 1.1s ease-in-out infinite;
}
@keyframes upload-slide {
    0%   { margin-left: -40%; }
    100% { margin-left: 100%; }
}
