:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-text: #cbd5e1;
    --content-bg: #f1f5f9;
    --border: #e2e8f0;
}

* { box-sizing: border-box; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--content-bg); margin: 0; }

/* ---- Layout ---- */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: 250px; background: var(--sidebar-bg); color: var(--sidebar-text);
    display: flex; flex-direction: column; position: fixed; height: 100vh;
    top: 0; left: 0; z-index: 1040; transition: transform .25s;
}
.sidebar-brand {
    padding: 18px 20px; font-size: 1.1rem; font-weight: 700; color: #fff;
    display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--sidebar-hover);
}
.sidebar-brand i { color: var(--primary); font-size: 1.4rem; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.sidebar-nav .nav-link {
    color: var(--sidebar-text); padding: 11px 20px; display: flex; align-items: center;
    gap: 12px; text-decoration: none; font-size: .92rem; transition: all .15s; border-left: 3px solid transparent;
}
.sidebar-nav .nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--sidebar-hover); color: #fff; border-left-color: var(--primary); }
.sidebar-nav .nav-link i { font-size: 1.05rem; width: 20px; }
.nav-section { padding: 14px 20px 6px; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: #64748b; font-weight: 600; }
.sidebar-footer { padding: 14px 20px; border-top: 1px solid var(--sidebar-hover); color: #64748b; font-size: .7rem; }
.sidebar-close { display: none; margin-left: auto; background: transparent; border: none; color: #94a3b8; font-size: 1.1rem; cursor: pointer; }
.sidebar-close:hover { color: #fff; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1035; }
.topbar-toggle { display: none; }

.main-area { flex: 1; margin-left: 250px; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    background: #fff; border-bottom: 1px solid var(--border); padding: 12px 24px;
    display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 1020;
}
.topbar .page-title { font-size: 1.15rem; margin: 0; flex: 1; font-weight: 600; }
.topbar-right .btn { display: flex; align-items: center; gap: 8px; }
.content { padding: 24px; flex: 1; }
.footer { padding: 14px 24px; color: #94a3b8; border-top: 1px solid var(--border); background: #fff; }

/* ---- Cards & tables ---- */
.card { border: 1px solid var(--border); box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.card-header { background: #fff; border-bottom: 1px solid var(--border); font-weight: 600; }
.table > :not(caption) > * > * { padding: .7rem .75rem; }
.table thead th { background: #f8fafc; font-size: .82rem; text-transform: uppercase; letter-spacing: .02em; color: #64748b; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

/* ---- Stat cards (dashboard) ---- */
.stat-card { border-radius: 12px; padding: 20px; color: #fff; }
.stat-card .stat-icon { font-size: 1.8rem; opacity: .85; }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; }
.stat-card .stat-label { font-size: .85rem; opacity: .9; }
.bg-grad-blue { background: linear-gradient(135deg,#3b82f6,#2563eb); }
.bg-grad-green { background: linear-gradient(135deg,#22c55e,#16a34a); }
.bg-grad-orange { background: linear-gradient(135deg,#f59e0b,#d97706); }
.bg-grad-purple { background: linear-gradient(135deg,#a855f7,#7c3aed); }
.bg-grad-red { background: linear-gradient(135deg,#ef4444,#dc2626); }

/* ---- Auth ---- */
.auth-body { background: linear-gradient(135deg,#1e293b,#0f172a); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { background: #fff; border-radius: 16px; padding: 36px; width: 100%; max-width: 400px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 1.4rem; font-weight: 700; margin-bottom: 24px; color: var(--sidebar-bg); }
.auth-brand i { color: var(--primary); }
.auth-title { font-weight: 600; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    body.sidebar-open .sidebar { transform: translateX(0); }
    body.sidebar-open .sidebar-overlay { display: block; }
    .main-area { margin-left: 0; }
    .sidebar-close { display: inline-block; }
    .topbar-toggle { display: inline-flex; }
}

/* ---- Print (fatura) ---- */
@media print {
    .no-print, .sidebar, .topbar, .footer { display: none !important; }
    .main-area { margin: 0 !important; }
    .content { padding: 0 !important; }
    body { background: #fff; }
}
