:root {
    --sidebar-w: 250px;
    --brand: #2563eb;
    --brand-dark: #1e40af;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --ink: #1e293b;
    --muted: #64748b;
    --bg: #f1f5f9;
}

* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font-family: 'Segoe UI', Tahoma, sans-serif; margin: 0; }

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

/* Sidebar */
.app-sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: #cbd5e1;
    position: fixed; top: 0; bottom: 0; left: 0;
    overflow-y: auto;
    z-index: 1030;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 20px; font-size: 1.05rem; font-weight: 700; color: #fff;
    border-bottom: 1px solid #1e293b; position: sticky; top: 0; background: var(--sidebar-bg);
}
.brand-mark { color: var(--brand); font-size: 1.3rem; }
.sidebar-nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav .nav-link {
    color: #cbd5e1; padding: 9px 14px; border-radius: 8px; font-size: .92rem;
    display: flex; align-items: center; gap: 10px; text-decoration: none;
}
.sidebar-nav .nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--brand); color: #fff; }
.nav-ico { width: 20px; text-align: center; font-size: .95rem; }
.nav-group-label { color: #64748b; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; padding: 14px 14px 4px; font-weight: 700; }

/* Main */
.app-main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.topbar {
    background: #fff; height: 60px; display: flex; align-items: center; gap: 14px;
    padding: 0 22px; box-shadow: 0 1px 3px rgba(0,0,0,.06); position: sticky; top: 0; z-index: 1020;
}
.topbar-title { font-weight: 600; font-size: 1.05rem; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-icon { position: relative; text-decoration: none; font-size: 1.2rem; }
.topbar-icon .badge { position: absolute; top: -6px; right: -10px; font-size: .6rem; }
.app-content { padding: 22px; }

/* Cards / stats */
.stat-card { background: #fff; border-radius: 12px; padding: 18px 20px; box-shadow: 0 1px 3px rgba(0,0,0,.06); height: 100%; }
.stat-card .stat-label { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
.stat-card .stat-value { font-size: 1.7rem; font-weight: 700; margin-top: 4px; }
.stat-card .stat-sub { font-size: .8rem; color: var(--muted); }
.stat-accent-blue { border-left: 4px solid #2563eb; }
.stat-accent-green { border-left: 4px solid #16a34a; }
.stat-accent-amber { border-left: 4px solid #d97706; }
.stat-accent-red { border-left: 4px solid #dc2626; }
.stat-accent-violet { border-left: 4px solid #7c3aed; }

.card { border: none; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.card-header { background: #fff; border-bottom: 1px solid #eef2f7; font-weight: 600; border-radius: 12px 12px 0 0 !important; }
.table > :not(caption) > * > * { padding: .6rem .75rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.page-head h1 { font-size: 1.35rem; margin: 0; font-weight: 700; }

.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
a { color: var(--brand); }

.badge { font-weight: 600; }
.wa-badge { display: inline-block; background: #25d366; color: #fff !important; font-size: .62rem; font-weight: 700; padding: 1px 5px; border-radius: 4px; text-decoration: none; margin-left: 4px; vertical-align: middle; }
.wa-badge:hover { background: #1da851; color: #fff; }
.phone-cell a:first-child { text-decoration: none; }
.form-label { font-weight: 500; font-size: .88rem; }
.text-money { font-variant-numeric: tabular-nums; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0f172a, #1e3a8a); padding: 20px; }
.login-card { background: #fff; border-radius: 16px; padding: 38px; width: 100%; max-width: 400px; box-shadow: 0 20px 45px rgba(0,0,0,.25); }
.login-card h1 { font-size: 1.4rem; font-weight: 700; text-align: center; margin-bottom: 4px; }
.login-card .sub { text-align: center; color: var(--muted); margin-bottom: 24px; font-size: .9rem; }

@media (max-width: 992px) {
    .app-sidebar { left: calc(-1 * var(--sidebar-w)); transition: left .2s; }
    .app-sidebar.open { left: 0; }
    .app-main { margin-left: 0; }
}

@media print {
    .app-sidebar, .topbar, .no-print { display: none !important; }
    .app-main { margin-left: 0 !important; }
    .app-content { padding: 0 !important; }
    body { background: #fff !important; }
    .card, .stat-card { box-shadow: none !important; border: 1px solid #e2e8f0 !important; }
}
