:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --sidebar-w: 250px;
    --topbar-h: 60px;
    --bg: #f4f6fb;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --border: #e6e9f0;
    --radius: 14px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text-dark);
}

/* ===== TOPBAR ===== */
.topbar {
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1030;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text-dark); }
.brand-icon {
    width: 34px; height: 34px; border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 16px;
}
.brand-text { font-weight: 800; font-size: 16px; }
.btn-icon { border: none; background: transparent; font-size: 20px; color: var(--text-dark); }
.user-btn { background: var(--primary-light); border: none; color: var(--primary-dark); font-weight: 600; border-radius: 10px; padding: 6px 12px; }

/* ===== LAYOUT ===== */
.app-body { display: flex; margin-top: var(--topbar-h); min-height: calc(100vh - var(--topbar-h)); }

.sidebar {
    width: var(--sidebar-w);
    background: #fff;
    border-right: 1px solid var(--border);
    position: fixed;
    top: var(--topbar-h); bottom: 0; left: 0;
    padding: 18px 12px;
    display: flex; flex-direction: column; justify-content: space-between;
    z-index: 1020;
    transition: transform .25s ease;
    overflow-y: auto;
}
.sidebar .nav-link {
    display: flex; align-items: center; gap: 12px;
    color: var(--text-muted); font-weight: 600; font-size: 14.5px;
    padding: 11px 14px; border-radius: 10px; margin-bottom: 4px;
}
.sidebar .nav-link i { font-size: 17px; width: 20px; text-align: center; }
.sidebar .nav-link:hover { background: var(--primary-light); color: var(--primary-dark); }
.sidebar .nav-link.active { background: var(--primary); color: #fff; box-shadow: 0 4px 10px rgba(79,70,229,.3); }
.sidebar-footer { padding-top: 12px; }
.sidebar-overlay { display: none; }

.content {
    margin-left: var(--sidebar-w);
    padding: 24px;
    width: calc(100% - var(--sidebar-w));
}

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); box-shadow: 0 0 30px rgba(0,0,0,.15); }
    .content { margin-left: 0; width: 100%; }
    .sidebar-overlay.show {
        display: block; position: fixed; inset: 0; top: var(--topbar-h);
        background: rgba(15,23,42,.35); z-index: 1015;
    }
}

/* ===== CARDS ===== */
.card { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 1px 3px rgba(15,23,42,.04); }
.page-title { font-weight: 800; font-size: 22px; margin-bottom: 2px; }
.page-subtitle { color: var(--text-muted); font-size: 14px; }

.stat-card {
    border-radius: var(--radius); padding: 20px; color: #fff; position: relative; overflow: hidden;
    min-height: 108px;
}
.stat-card .stat-icon { font-size: 28px; opacity: .85; }
.stat-card .stat-value { font-size: 26px; font-weight: 800; margin-top: 6px; }
.stat-card .stat-label { font-size: 13px; opacity: .9; }
.stat-card.c1 { background: linear-gradient(135deg,#4f46e5,#7c3aed); }
.stat-card.c2 { background: linear-gradient(135deg,#0ea5e9,#0284c7); }
.stat-card.c3 { background: linear-gradient(135deg,#10b981,#059669); }
.stat-card.c4 { background: linear-gradient(135deg,#f59e0b,#d97706); }

.badge { font-weight: 600; font-size: 11.5px; padding: 5px 10px; border-radius: 8px; }

/* ===== TABLES ===== */
.table { font-size: 14px; }
.table thead th {
    background: #f8f9fc; color: var(--text-muted); font-weight: 700; font-size: 12px;
    text-transform: uppercase; letter-spacing: .04em; border-bottom: none; padding: 12px;
}
.table tbody td { padding: 12px; vertical-align: middle; border-color: var(--border); }
.table-hover tbody tr:hover { background: var(--primary-light); }

/* ===== FORMS ===== */
.form-control, .form-select { border-radius: 10px; border-color: var(--border); padding: 9px 12px; font-size: 14px; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.form-label { font-weight: 600; font-size: 13.5px; color: var(--text-dark); margin-bottom: 6px; }
.input-group-text { background: #f8f9fc; border-color: var(--border); }

.btn { border-radius: 10px; font-weight: 600; font-size: 14px; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

/* ===== LOGIN ===== */
.login-body { background: linear-gradient(135deg,#4f46e5,#7c3aed); min-height: 100vh; display: flex; align-items: center; }
.login-wrapper { width: 100%; display: flex; justify-content: center; padding: 20px; }
.login-card { background: #fff; border-radius: 18px; padding: 36px 32px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-brand { text-align: center; margin-bottom: 20px; }
.login-brand .brand-icon { margin: 0 auto 10px; width: 52px; height: 52px; font-size: 24px; }

/* ===== POS ===== */
.pos-cart-table th, .pos-cart-table td { font-size: 13.5px; }
.summary-box { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.summary-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.summary-row.total { font-size: 19px; font-weight: 800; border-top: 1px dashed var(--border); margin-top: 6px; padding-top: 12px; }
#yandexMap, #viewMap { width: 100%; height: 320px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }

.select2-container .select2-selection--single { height: 42px !important; border-radius: 10px !important; border-color: var(--border) !important; padding-top: 4px; }

.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty-state i { font-size: 42px; opacity: .35; }
