:root {
    --primary: #d81e2c;
    --primary-dark: #a5121d;
    --sidebar-bg: #0d0d0d;
    --sidebar-hover: #241010;
    --bg-soft: #f5f5f5;
    --radius: 14px;

    /* Selaraskan warna bawaan Bootstrap (btn-primary, bg-primary, dll) dengan brand merah */
    --bs-primary: #d81e2c;
    --bs-primary-rgb: 216, 30, 44;
    --bs-link-color: #d81e2c;
    --bs-link-hover-color: #a5121d;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-soft);
    margin: 0;
}

h1, h2, h3, h4, h5, h6, .brand-text strong { font-family: 'Poppins', sans-serif; }

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

.sidebar {
    width: 250px;
    background: var(--sidebar-bg);
    color: #fff;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform .25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: 1.4rem 1.2rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-logo { width: 100%; max-width: 190px; height: auto; display: block; }

.brand-icon {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, var(--primary), #000);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
}

.brand-text strong { display: block; font-size: 1rem; letter-spacing: .5px; }
.brand-text small { color: rgba(255,255,255,.55); font-size: .72rem; }

.sidebar-nav { padding: 1rem .8rem; flex-grow: 1; overflow-y: auto; }

.nav-link {
    display: flex; align-items: center; gap: .8rem;
    color: rgba(255,255,255,.75);
    padding: .7rem .9rem;
    border-radius: 10px;
    margin-bottom: .2rem;
    font-size: .92rem;
    text-decoration: none;
    transition: all .15s ease;
}

.nav-link i { font-size: 1.05rem; width: 20px; text-align: center; }
.nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.nav-link.active { background: linear-gradient(135deg, var(--primary), #000); color: #fff; }
.nav-divider { border-top: 1px solid rgba(255,255,255,.08); margin: .8rem 0; }

.overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 999;
}

.main-content { margin-left: 250px; flex-grow: 1; width: 100%; }

.topbar {
    display: flex; align-items: center; gap: 1rem;
    background: #fff;
    padding: 1rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
    position: sticky; top: 0; z-index: 900;
}
.topbar h4 { margin: 0; flex-grow: 1; font-weight: 700; }
.btn-toggle { border: none; background: none; font-size: 1.4rem; display: none; }
.topbar-user { display: flex; align-items: center; gap: .5rem; font-size: .9rem; color: #444; }
.topbar-user i { font-size: 1.6rem; color: var(--primary); }

.content-body { padding: 1.5rem; }

/* ===================== CARDS ===================== */
.card-box {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.2rem 1.4rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.card-box-title { font-weight: 700; margin-bottom: 1rem; }

.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.1rem 1.3rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    height: 100%;
}
.stat-card i { font-size: 1.8rem; padding: .7rem; border-radius: 12px; color: #fff; }
.stat-card h5 { margin: 0; font-weight: 700; font-size: 1.15rem; }
.stat-card small { color: #888; }
.stat-blue i { background: linear-gradient(135deg,#d81e2c,#ef4444); }
.stat-green i { background: linear-gradient(135deg,#1a1a1a,#404040); }
.stat-purple i { background: linear-gradient(135deg,#7a0c14,#a5121d); }
.stat-orange i { background: linear-gradient(135deg,#000000,#3f3f46); }

.table-thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 8px; background: #eee; }

/* ===================== LOGIN ===================== */
.login-body {
    font-family: 'Inter', sans-serif;
    background: url('../img/bgloginpapia.png') center center / cover no-repeat fixed #0d0d0d;
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    margin: 0;
    position: relative;
}
.login-bg-overlay {
    position: fixed; inset: 0;
    background: linear-gradient(135deg, rgba(13,13,13,.75), rgba(168,18,29,.55));
    z-index: 0;
}
.login-card {
    background: #fff;
    padding: 2.5rem 2.2rem;
    border-radius: 18px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0,0,0,.35);
    position: relative;
    z-index: 1;
}
.login-brand { text-align: center; margin-bottom: 1.5rem; }
.login-logo { max-width: 240px; width: 100%; height: auto; margin: 0 auto .8rem; display: block; }
.login-icon {
    width: 64px; height: 64px; margin: 0 auto .8rem;
    background: linear-gradient(135deg, var(--primary), #000);
    border-radius: 16px; display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem; color: #fff;
}
.login-brand h1 { font-size: 1.4rem; font-weight: 800; margin: 0; color: #0d0d0d; letter-spacing: 1px; }
.login-brand p { color: #888; font-size: .85rem; margin: .2rem 0 0; }
.login-hint { text-align: center; margin-top: 1rem; font-size: .78rem; color: #999; }

/* ===================== KASIR (POS) ===================== */
.kasir-layout { display: flex; gap: 1.2rem; align-items: flex-start; }
.kasir-produk { flex: 1 1 65%; min-width: 0; }
.kasir-keranjang { flex: 1 1 35%; max-width: 400px; position: sticky; top: 90px; }

.produk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}
.produk-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    transition: transform .15s ease;
}
.produk-card:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(0,0,0,.1); }
.produk-card img { width: 100%; height: 100px; object-fit: cover; background: #f0f0f0; }
.produk-card-body { padding: .6rem .7rem; }
.produk-nama { font-size: .85rem; font-weight: 600; line-height: 1.2; margin-bottom: .2rem; }
.produk-harga { color: var(--primary); font-weight: 700; font-size: .85rem; }
.produk-stok { font-size: .72rem; }

.keranjang-list { max-height: 45vh; overflow-y: auto; }
.keranjang-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: .6rem 0; border-bottom: 1px solid #f0f0f0;
}
.btn-qty {
    border: 1px solid #ddd; background: #fff; border-radius: 6px;
    width: 26px; height: 26px; font-size: .85rem; line-height: 1;
}
.keranjang-total { border-top: 1px dashed #ddd; padding-top: .8rem; margin-top: .5rem; }

/* ===================== GALERI PROMOSI ===================== */
.galeri-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.2rem;
}
.galeri-card {
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.galeri-img-wrap { position: relative; }
.galeri-img-wrap img { width: 100%; height: 180px; object-fit: cover; }
.galeri-badge { position: absolute; top: 8px; right: 8px; }
.galeri-body { padding: 1rem; }

.btn-share { color: #fff; border: none; font-size: .78rem; }
.btn-wa { background: #25D366; }
.btn-fb { background: #1877F2; }
.btn-tw { background: #000; }
.btn-ig { background: linear-gradient(135deg,#f58529,#dd2a7b,#8134af); }
.btn-share:hover { opacity: .88; color: #fff; }

.nav-badge { margin-left: auto; font-size: .62rem; padding: .25em .5em; }

.promo-banner {
    background: linear-gradient(135deg, var(--primary), #000);
    color: #fff;
    border-radius: var(--radius);
    padding: 1.1rem 1.4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.promo-banner h5 { margin: 0 0 .2rem; font-weight: 700; font-size: 1rem; }
.promo-banner p { margin: 0; font-size: .85rem; opacity: .9; }
.promo-banner .btn-light { white-space: nowrap; }

.growth-badge { font-size: .72rem; display: block; margin-top: .15rem; }

.insight-item {
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    padding: .7rem .9rem;
    border-radius: 10px;
    margin-bottom: .6rem;
    font-size: .87rem;
    line-height: 1.4;
}
.insight-item i { font-size: 1.1rem; margin-top: 1px; }
.insight-item:last-child { margin-bottom: 0; }
.insight-success { background: #ecfdf5; color: #065f46; }
.insight-danger  { background: #fef2f2; color: #991b1b; }
.insight-warning { background: #fffbeb; color: #92400e; }
.insight-info    { background: #eff6ff; color: #1e40af; }
.insight-secondary { background: #f4f4f5; color: #3f3f46; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .overlay.show { display: block; }
    .main-content { margin-left: 0; }
    .btn-toggle { display: block; }
    .kasir-layout { flex-direction: column; }
    .kasir-keranjang { max-width: 100%; position: static; }
}

@media print {
    .sidebar, .topbar, .btn, form, .modal-footer button:not(.d-print-inline) { display: none !important; }
    .main-content { margin-left: 0 !important; }
}
