* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

body {
    background-color: #fff5f8; /* Latar belakang sedikit bernuansa soft pink */
    color: #0f172a;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR DENGAN BORDER PINK */
.sidebar {
    width: 265px;
    background: #ffffff;
    border-right: 2px solid #fbcfe8; /* Garis pembatas pinggir warna pink lembut */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 24px 18px;
    position: fixed;
    height: 100vh;
    box-shadow: 4px 0 20px rgba(236, 72, 153, 0.03);
}

.brand-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px;
    margin-bottom: 32px;
}

.brand-logo {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #ec4899, #db2777);
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.25);
}

.brand-box h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #831843;
}

.brand-box small {
    color: #9d174d;
    font-size: 0.78rem;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    color: #475569;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.nav-item i { width: 18px; height: 18px; }

.nav-item:hover {
    background-color: #fdf2f8;
    color: #db2777;
    border-color: #fbcfe8;
}

.nav-item.active {
    background-color: #fce7f3;
    color: #9d174d;
    font-weight: 700;
    border: 1px solid #f472b6; /* Border pink aktif */
    box-shadow: 0 2px 8px rgba(236, 72, 153, 0.15);
}

.sidebar-footer {
    background: #fff1f2;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid #fbcfe8;
}

.db-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: #831843;
}

.badge-db {
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 20px;
    background: #dcfce7;
    color: #166534;
    font-weight: 600;
}

/* MAIN AREA */
.main-content {
    margin-left: 265px;
    flex-grow: 1;
    padding: 32px 40px;
    max-width: 1400px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

.page-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #831843;
}

/* STATS CARDS DENGAN BORDER PINK TIPIS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: #ffffff;
    padding: 22px;
    border-radius: 16px;
    border: 1.5px solid #fbcfe8; /* Beri border pink agar manis */
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.04);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(236, 72, 153, 0.1);
}

.stat-label {
    font-size: 0.85rem;
    color: #9d174d;
    font-weight: 600;
}

.stat-card h3 {
    font-size: 1.55rem;
    font-weight: 700;
    color: #831843;
    margin: 8px 0;
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.stat-icon i { width: 20px; height: 20px; }
.stat-icon.pink { background: #fce7f3; color: #db2777; }
.stat-icon.blue { background: #e0f2fe; color: #0284c7; }
.stat-icon.purple { background: #f3e8ff; color: #7e22ce; }
.stat-icon.orange { background: #ffedd5; color: #ea580c; }

/* CARDS & TABLES */
.card {
    background: #ffffff;
    padding: 24px;
    border-radius: 16px;
    border: 1.5px solid #fbcfe8;
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.04);
    margin-bottom: 24px;
}

.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #831843;
}

.link-pink {
    color: #db2777;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
}
.link-pink:hover { text-decoration: underline; }

.badge-count {
    background: #fce7f3;
    color: #db2777;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.data-table th {
    text-align: left;
    padding: 12px 14px;
    color: #9d174d;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    border-bottom: 2px solid #fbcfe8;
    background-color: #fff1f2;
}

.data-table td {
    padding: 14px;
    border-bottom: 1px solid #fdf2f8;
    color: #334155;
}

.data-table tr:hover { background-color: #fff5f8; }

/* POS & BUTTONS */
.pos-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.grid-produk {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.item-card {
    border: 1.5px solid #fbcfe8;
    border-radius: 12px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
}

.item-card:hover {
    border-color: #ec4899;
    background: #fdf2f8;
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.15);
}

.item-card h4 { font-size: 0.92rem; margin: 6px 0 4px; color: #831843; }
.item-card p { font-size: 0.88rem; color: #db2777; font-weight: 700; }
.item-card.no-stock small { display: none; }

.badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 0.7rem;
    border-radius: 6px;
    font-weight: 600;
}
.badge.skincare { background: #dcfce7; color: #15803d; }
.badge.treatment { background: #e0f2fe; color: #0369a1; }

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1.5px solid #fbcfe8;
    padding: 9px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #831843;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.btn-secondary:hover { background: #fdf2f8; }

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, #ec4899, #db2777);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(219, 39, 119, 0.25);
}

.btn-primary:hover { opacity: 0.95; }
.btn-primary:disabled { background: #cbd5e1; box-shadow: none; cursor: not-allowed; }

.form-group { margin-top: 14px; }
.form-group label { display: block; font-size: 0.82rem; font-weight: 600; color: #831843; margin-bottom: 6px; }
.form-group input, .form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #fbcfe8;
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
}
.form-group input:focus, .form-group select:focus { border-color: #ec4899; }

.keranjang-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #fdf2f8;
    font-size: 0.88rem;
}

.total-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.05rem;
    margin: 14px 0;
    color: #831843;
    font-weight: 700;
}

.text-muted { color: #64748b; font-size: 0.82rem; }
.text-success { color: #16a34a; font-size: 0.8rem; font-weight: 600; }
.text-center { text-align: center; }
.mt-4 { margin-top: 20px; }

@media print {
    body * { visibility: hidden; }
    #print-area, #print-area * { visibility: visible; }
    #print-area { display: block !important; position: absolute; left: 0; top: 0; width: 100%; }
}

/* ======================================================== */
/* --- PENGATURAN RESPONSIF UTAMA KHUSUS LAYAR HP (MOBILE) --- */
/* ======================================================== */
@media screen and (max-width: 768px) {
    /* 1. Layout & Hamburger Sidebar */
    .app-layout {
        grid-template-columns: 1fr;
        display: block;
    }

    .mobile-header {
        display: flex !important;
    }

    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        width: 260px;
        height: 100vh;
        z-index: 1000;
        background: white;
        box-shadow: 4px 0 15px rgba(0,0,0,0.1);
        transition: left 0.3s ease-in-out;
        overflow-y: auto;
    }

    .sidebar.active {
        left: 0;
    }

    .main-content {
        padding: 10px !important;
        margin-left: 0 !important;
    }

    .nav-menu {
        display: flex;
        flex-direction: column;
        gap: 6px;
        overflow-x: visible;
    }

    .nav-item {
        white-space: normal;
        padding: 10px 12px;
        font-size: 13px;
    }

    /* 2. Grid POS & Statistik */
    .pos-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .stat-card {
        padding: 12px !important;
    }

    .stat-card h3 {
        font-size: 15px !important;
    }

    .stat-label {
        font-size: 11px !important;
    }

    /* 3. Ukuran Teks & Kartu */
    .page-header h2 {
        font-size: 17px !important;
    }
    
    .page-header p {
        font-size: 11px !important;
    }

    .card {
        padding: 15px !important;
    }

    .card h3 {
        font-size: 13px !important;
    }

    button, .btn-primary, .btn-secondary {
        font-size: 12px !important;
        padding: 8px 12px !important;
    }

    /* 4. Tabel Full-Width & Rapi */
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table, .card table {
        width: 100% !important;
        display: table !important;
        table-layout: auto !important;
        border-collapse: collapse;
    }

    .data-table th, .data-table td, .card table th, .card table td {
        font-size: 11px !important;
        padding: 8px 6px !important;
        white-space: nowrap;
    }

    .badge {
        font-size: 10px !important;
        padding: 3px 6px !important;
    }
}

/* --- PERBAIKAN LAYOUT AGAR PAS DI LAYAR HP --- */
@media screen and (max-width: 768px) {
    /* Memastikan body dan layout utama mengambil lebar penuh 100% tanpa ada batasan kaku */
    body, html {
        width: 100%;
        overflow-x: hidden;
    }

    .app-layout {
        width: 100%;
        display: block;
    }

    .main-content {
        width: 100% !important;
        margin-left: 0 !important;
        padding: 10px !important;
        box-sizing: border-box;
    }

    /* Menyesuaikan kotak kartu agar tidak keluar jalur layar */
    .card, .stats-grid, .pos-grid {
        width: 100% !important;
        box-sizing: border-box;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* --- PERKECIL KOLOM DAFTAR LAYANAN & SKINCARE DI HP --- */
/* --- TAMPILAN PRODUK ULTRA-COMPACT & SCROLLABLE DI HP --- */
@media screen and (max-width: 768px) {
    /* 1. Jadikan 3 kolom menyamping & beri batas tinggi agar bisa di-scroll di dalam kotak */
    .grid-produk {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6px !important;
        margin-top: 8px !important;
        max-height: 220px; /* Batas tinggi kotak daftar layanan, sesuaikan jika perlu */
        overflow-y: auto;  /* Bisa di-scroll ke bawah di dalam kotak */
        padding-right: 2px;
    }

    /* 2. Perkecil ukuran kartu & padding seminimal mungkin */
    .item-card {
        padding: 6px !important;
        border-radius: 8px !important;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    /* 3. Perkecil badge kategori (Treatment / Skincare) */
    .item-card .badge {
        font-size: 8px !important;
        padding: 2px 4px !important;
        margin-bottom: 3px !important;
        align-self: flex-start;
    }

    /* 4. Perkecil judul item & rapikan jika teks panjang */
    .item-card h4 {
        font-size: 10.5px !important;
        margin: 2px 0 !important;
        line-height: 1.2 !important;
        display: -webkit-box;
        -webkit-line-clamp: 2; /* Maksimal 2 baris agar tinggi kartu seragam */
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* 5. Perkecil harga & info stok */
    .item-card p {
        font-size: 10.5px !important;
        margin-top: 2px !important;
    }

    .item-card small {
        font-size: 8.5px !important;
        margin-top: 1px !important;
    }
}

@media screen and (max-width: 768px) {
    .card input[type="date"],
    .form-group input[type="date"] {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        font-size: 12px !important;
        padding: 8px 10px !important;
    }
}