/* ==========================================================================
   EVENT ERP - RESPONSIVE DESIGN SYSTEM (MOBILE & DESKTOP COMPATIBLE)
   ========================================================================== */

/* --- Base & Reset --- */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}
html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #f8fafc;
    color: #0f172a;
    font-size: 15px;
    line-height: 1.5;
}

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

/* --- Sidebar (Desktop) --- */
.sidebar {
    width: 260px;
    background: #0f172a;
    color: #fff;
    padding: 22px 16px;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    overflow-y: auto;
    z-index: 100;
    transition: width 0.25s ease, transform 0.25s ease;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}
.brand h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fff;
}
.brand small {
    display: inline-block;
    color: #94a3b8;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.menu-toggle {
    background: #1e293b;
    color: #fff;
    border: 1px solid #334155;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    min-width: 40px;
    padding: 0;
    font-size: 18px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.menu-toggle:hover {
    background: #334155;
}

.sidebar nav {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sidebar nav a {
    color: #cbd5e1;
    text-decoration: none;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
}
.sidebar nav a:hover {
    background: #1e293b;
    color: #fff;
}
.sidebar nav a.logout {
    background: #dc2626;
    color: #fff;
    margin-top: 16px;
    font-weight: 600;
}
.sidebar nav a.logout:hover {
    background: #b91c1c;
}

/* Mobile Floating Elements (Hidden by default on Desktop) */
.mobile-floating-bar,
.mobile-fab-btn,
.sidebar-backdrop,
.sidebar-close-btn {
    display: none;
}

/* Sidebar collapsed state on Desktop */
.sidebar.menu-hidden {
    width: 72px;
    padding: 18px 12px;
}
.sidebar.menu-hidden .brand div {
    display: none;
}
.sidebar.menu-hidden nav {
    display: none;
}
body.sidebar-collapsed .main {
    margin-left: 72px;
    width: calc(100% - 72px);
}

/* --- Main Content Area --- */
.main {
    margin-left: 260px;
    padding: 28px;
    width: calc(100% - 260px);
    min-width: 0;
    transition: margin-left 0.25s ease, width 0.25s ease;
}

/* --- Topbar & Header --- */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
}
.topbar h1,
main > h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
    line-height: 1.25;
}
.topbar p {
    color: #64748b;
    margin: 6px 0 0;
    font-size: 14px;
}
.user-info {
    padding: 8px 16px;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
}

/* --- Metric Cards --- */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}
.card {
    background: #fff;
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    border: 1px solid #e2e8f0;
    min-width: 0;
}
.card span {
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
    display: block;
}
.card h2 {
    margin: 8px 0 0;
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
    word-break: break-word;
    letter-spacing: -0.02em;
}
.card small {
    display: block;
    color: #64748b;
    font-size: 12px;
    margin-top: 6px;
}

/* --- Charts Grid --- */
.charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-top: 18px;
    margin-bottom: 22px;
}
.chart-box {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    border: 1px solid #e2e8f0;
    min-width: 0;
}
.chart-box.full {
    grid-column: span 2;
}
.chart-box h3 {
    margin: 0 0 16px;
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
}

/* --- Form Box & Inputs --- */
.form-box {
    background: #fff;
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    border: 1px solid #e2e8f0;
    max-width: 1000px;
    margin-bottom: 22px;
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
label {
    display: block;
    font-weight: 600;
    font-size: 13.5px;
    color: #334155;
    margin: 10px 0 5px;
}
input, select, textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    background: #fff;
    font-size: 15px;
    color: #0f172a;
    min-height: 42px;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
textarea {
    min-height: 88px;
    resize: vertical;
}

/* --- Buttons --- */
button, .btn {
    border: 0;
    background: #2563eb;
    color: #fff;
    padding: 10px 16px;
    border-radius: 9px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 42px;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.15s ease;
    touch-action: manipulation;
}
button:hover, .btn:hover {
    background: #1d4ed8;
}

/* --- Table Box & Tables --- */
.table-box {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    border: 1px solid #e2e8f0;
    margin-top: 22px;
    margin-bottom: 22px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.table-box h3 {
    margin: 0 0 14px;
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
th, td {
    padding: 12px 10px;
    border-bottom: 1px solid #f1f5f9;
    text-align: left;
    vertical-align: middle;
}
th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
tr:hover td {
    background: #fbfcfe;
}

/* Table buttons */
table .btn, table button {
    padding: 6px 11px;
    font-size: 12px;
    min-height: 32px;
    border-radius: 7px;
    font-weight: 600;
}

/* --- Badges & Alerts --- */
.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.alert-info {
    background: #e0f2fe;
    color: #0369a1;
    padding: 12px 16px;
    border-radius: 10px;
    margin: 12px 0;
    font-size: 14px;
}
.alert-error {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 14px;
    font-size: 14px;
}

/* --- Login Page --- */
.login-body {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 16px;
}
.login-card {
    background: #fff;
    width: min(400px, 100%);
    padding: 32px 28px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.25);
}
.login-card h2 {
    margin: 0 0 6px;
    font-size: 24px;
    font-weight: 800;
    color: #0f172a;
}
.login-card p {
    margin: 0 0 20px;
    color: #64748b;
    font-size: 14px;
}
.login-card button {
    width: 100%;
    margin-top: 20px;
    min-height: 46px;
    font-size: 15px;
}

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES (MOBILE PHONE & TABLET COMPATIBILITY)
   ========================================================================== */

/* --- Medium Devices (Tablets, max 1024px) --- */
@media (max-width: 1024px) {
    .sidebar {
        width: 230px;
    }
    .main {
        margin-left: 230px;
        width: calc(100% - 230px);
        padding: 20px;
    }
    .cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .charts {
        grid-template-columns: 1fr;
    }
    .chart-box.full {
        grid-column: span 1;
    }
}

/* --- Mobile Phones & Small Tablets (max 768px) --- */
@media (max-width: 768px) {
    body {
        font-size: 14.5px;
        background: #f1f5f9;
    }
    .app {
        display: block;
        min-height: 100vh;
    }

    /* ==========================================================
       MOBILE FLOATING SIDEBAR SYSTEM (HANDPHONE & MOBILE SCREENS)
       ========================================================== */

    /* 1. Floating Menu Trigger Pill (Pojok Kiri Atas) */
    .mobile-floating-bar {
        display: flex !important;
        position: fixed !important;
        top: 12px !important;
        left: 12px !important;
        z-index: 9980 !important;
    }
    .mobile-floating-btn {
        display: inline-flex !important;
        align-items: center !important;
        gap: 8px !important;
        background: rgba(15, 23, 42, 0.94) !important;
        color: #fff !important;
        border: 1px solid rgba(255, 255, 255, 0.16) !important;
        border-radius: 999px !important;
        padding: 7px 15px 7px 9px !important;
        font-size: 13px !important;
        font-weight: 600 !important;
        cursor: pointer !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
        backdrop-filter: blur(12px) !important;
        -webkit-backdrop-filter: blur(12px) !important;
        transition: transform 0.15s ease, background 0.2s !important;
    }
    .mobile-floating-btn:active {
        transform: scale(0.95) !important;
        background: #1e293b !important;
    }
    .mobile-floating-btn .hamburger-icon {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 24px !important;
        height: 24px !important;
        background: #2563eb !important;
        color: #fff !important;
        border-radius: 50% !important;
        font-size: 13px !important;
    }

    /* 2. Floating Action Button (FAB di Pojok Kanan Bawah untuk Akses Jempol) */
    .mobile-fab-btn {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        position: fixed !important;
        bottom: 20px !important;
        right: 16px !important;
        width: 52px !important;
        height: 52px !important;
        border-radius: 50% !important;
        background: #2563eb !important;
        color: #fff !important;
        border: 2px solid #93c5fd !important;
        box-shadow: 0 8px 24px rgba(37, 99, 235, 0.5) !important;
        font-size: 22px !important;
        cursor: pointer !important;
        z-index: 9980 !important;
        transition: transform 0.15s ease, background 0.2s !important;
    }
    .mobile-fab-btn:active {
        transform: scale(0.92) !important;
        background: #1d4ed8 !important;
    }

    /* 3. Dark Backdrop Blur Overlay */
    .sidebar-backdrop {
        display: block !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        background: rgba(15, 23, 42, 0.72) !important;
        backdrop-filter: blur(5px) !important;
        -webkit-backdrop-filter: blur(5px) !important;
        z-index: 9990 !important;
        opacity: 0 !important;
        pointer-events: none !important;
        visibility: hidden !important;
        transition: opacity 0.25s ease, visibility 0.25s !important;
    }
    .sidebar-backdrop.active {
        opacity: 1 !important;
        pointer-events: auto !important;
        visibility: visible !important;
    }

    /* 4. Floating Sidebar Card Drawer */
    .sidebar {
        position: fixed !important;
        top: 12px !important;
        bottom: 12px !important;
        left: 12px !important;
        width: min(315px, calc(100vw - 32px)) !important;
        max-height: calc(100vh - 24px) !important;
        height: auto !important;
        background: #0f172a !important;
        color: #fff !important;
        border-radius: 22px !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.08) !important;
        z-index: 10000 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 18px 16px 24px !important;
        transform: translateX(calc(-100% - 30px)) !important;
        opacity: 0 !important;
        pointer-events: none !important;
        visibility: hidden !important;
        transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s ease, visibility 0.28s !important;
    }
    .sidebar.floating-open {
        transform: translateX(0) !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        visibility: visible !important;
    }

    body.floating-sidebar-active {
        overflow: hidden !important;
    }

    /* Brand Header di dalam Floating Sidebar */
    .brand {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        padding-bottom: 14px !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
        margin-bottom: 8px !important;
    }
    .brand-info {
        display: flex !important;
        flex-direction: column !important;
        gap: 2px !important;
    }
    .brand h2 {
        font-size: 19px !important;
        color: #fff !important;
        margin: 0 !important;
    }
    .brand small {
        background: rgba(37, 99, 235, 0.25) !important;
        color: #93c5fd !important;
        border: 1px solid rgba(96, 165, 250, 0.3) !important;
        padding: 2px 8px !important;
        border-radius: 6px !important;
        font-size: 11px !important;
        width: fit-content !important;
    }
    .sidebar .menu-toggle {
        display: none !important;
    }
    .sidebar-close-btn {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: #1e293b !important;
        color: #94a3b8 !important;
        border: 1px solid #334155 !important;
        border-radius: 50% !important;
        width: 36px !important;
        height: 36px !important;
        font-size: 16px !important;
        cursor: pointer !important;
        margin-left: auto !important;
        transition: all 0.2s !important;
    }
    .sidebar-close-btn:active {
        background: #dc2626 !important;
        color: #fff !important;
        border-color: #dc2626 !important;
    }

    /* Menu Navigasi di dalam Floating Sidebar */
    .sidebar nav {
        margin-top: 10px !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 6px !important;
        max-height: none !important;
        overflow-y: visible !important;
        padding-bottom: 8px !important;
    }
    .sidebar nav a {
        padding: 11px 14px !important;
        font-size: 14px !important;
        background: rgba(30, 41, 59, 0.7) !important;
        color: #e2e8f0 !important;
        border: 1px solid rgba(255, 255, 255, 0.05) !important;
        border-radius: 10px !important;
        text-align: left !important;
        justify-content: flex-start !important;
        min-height: 44px !important;
        font-weight: 500 !important;
        transition: all 0.15s ease !important;
    }
    .sidebar nav a:active {
        background: #2563eb !important;
        color: #fff !important;
        transform: scale(0.98) !important;
    }
    .sidebar nav a.logout {
        margin-top: 14px !important;
        background: #dc2626 !important;
        color: #fff !important;
        border: none !important;
        font-weight: 600 !important;
    }

    /* Main Container dengan Ruang Atas Aman */
    .main, body.sidebar-collapsed .main {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 60px 14px 40px !important;
        box-sizing: border-box !important;
    }

    /* Topbar on Mobile */
    .topbar {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
        margin-bottom: 16px !important;
    }
    .topbar h1, main > h1 {
        font-size: 20px !important;
        line-height: 1.3 !important;
    }
    .topbar p {
        font-size: 13px !important;
    }
    .user-info {
        font-size: 12px !important;
        padding: 5px 10px !important;
        border-radius: 6px !important;
    }

    /* Metric Cards on Mobile (2 columns, compact and clean) */
    .cards {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
        margin-bottom: 14px !important;
    }
    .card {
        padding: 12px 12px !important;
        border-radius: 11px !important;
    }
    .card span {
        font-size: 11.5px !important;
    }
    .card h2 {
        font-size: 16px !important;
        margin-top: 4px !important;
    }
    .card small {
        font-size: 10.5px !important;
        margin-top: 3px !important;
    }

    /* Charts on Mobile */
    .charts {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        margin-top: 12px !important;
        margin-bottom: 14px !important;
    }
    .chart-box {
        padding: 14px 12px !important;
        border-radius: 11px !important;
    }
    .chart-box h3 {
        font-size: 14px !important;
        margin-bottom: 10px !important;
    }

    /* Forms on Mobile */
    .form-box {
        padding: 16px 12px !important;
        border-radius: 11px !important;
        margin-bottom: 16px !important;
    }
    .form-grid {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }
    input, select, textarea {
        font-size: 16px !important; /* Prevents auto-zoom on iOS Safari */
        min-height: 44px !important;
        padding: 10px 12px !important;
        border-radius: 8px !important;
    }
    .form-box button[type="submit"] {
        width: 100% !important;
        min-height: 46px !important;
        font-size: 15px !important;
    }

    /* Tables & Horizontal Scroll Container on Mobile */
    .table-box {
        padding: 14px 10px !important;
        border-radius: 11px !important;
        margin-top: 14px !important;
        margin-bottom: 16px !important;
    }
    .table-box::before {
        content: '↔ Geser tabel ke samping untuk melihat detail';
        display: block;
        font-size: 11px;
        color: #64748b;
        background: #f1f5f9;
        padding: 4px 8px;
        border-radius: 6px;
        margin-bottom: 10px;
        width: fit-content;
    }
    .table-box table {
        min-width: 600px;
        font-size: 13px !important;
    }
    th, td {
        padding: 10px 7px !important;
    }
    table button, table .btn {
        width: auto !important;
        min-width: unset !important;
        padding: 5px 9px !important;
        font-size: 11.5px !important;
        min-height: 30px !important;
        border-radius: 6px !important;
        margin: 2px 2px !important;
        display: inline-flex !important;
        white-space: nowrap !important;
    }

    /* Filter Toolbars on Mobile */
    form[method="get"] {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        align-items: stretch !important;
    }
    form[method="get"] > div {
        width: 100% !important;
        min-width: 0 !important;
    }
    form[method="get"] button,
    form[method="get"] .btn {
        width: 100% !important;
        margin: 2px 0 !important;
    }

    /* Bulk Delete Toolbar on Mobile */
    div[style*="justify-content:space-between"] {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }
    #bulkDeleteBtn {
        width: 100% !important;
        justify-content: center !important;
    }

    /* Banners on Mobile */
    span[style*="background:#d1fae5"],
    span[style*="background:#fee2e2"] {
        display: block !important;
        width: 100% !important;
        box-sizing: border-box !important;
        font-size: 13px !important;
        padding: 8px 12px !important;
    }
}

/* --- Extra Small Handphones (max 420px) --- */
@media (max-width: 420px) {
    .main {
        padding: 58px 10px 30px !important;
    }
    .sidebar {
        width: calc(100vw - 20px) !important;
        left: 10px !important;
        top: 10px !important;
        bottom: 10px !important;
        padding: 16px 12px 20px !important;
    }
    .cards {
        grid-template-columns: 1fr 1fr !important;
        gap: 6px !important;
    }
    .card {
        padding: 10px 10px !important;
    }
    .card h2 {
        font-size: 15px !important;
    }
    .topbar h1, main > h1 {
        font-size: 18px !important;
    }
}

/* --- Print Styles --- */
@media print {
    .sidebar, .btn, button, .menu-toggle {
        display: none !important;
    }
    .main {
        margin: 0 !important;
        width: 100% !important;
        padding: 0 !important;
    }
    .card, .table-box, .form-box, .chart-box {
        box-shadow: none !important;
        border: 1px solid #cbd5e1 !important;
    }
}


/* ==========================================================================
   STOCK MONITORING — MOBILE CARD LAYOUT & DESKTOP ENHANCEMENTS
   ========================================================================== */

/* ── Category pill badges ─────────────────────────────────────────── */
.cat-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .03em;
    white-space: nowrap;
}
.cat-badge.fnb         { background:#dcfce7; color:#15803d; }
.cat-badge.merchandise { background:#ede9fe; color:#6d28d9; }
.cat-badge.apparel     { background:#fce7f3; color:#be185d; }
.cat-badge.perlengkapan{ background:#fef3c7; color:#b45309; }
.cat-badge.dokumentasi { background:#dbeafe; color:#1d4ed8; }
.cat-badge.medis       { background:#fee2e2; color:#b91c1c; }
.cat-badge.default     { background:#f1f5f9; color:#475569; }

/* ── Status chips ─────────────────────────────────────────────────── */
.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.status-chip.aman    { background:#dcfce7; color:#15803d; }
.status-chip.warning { background:#fef9c3; color:#a16207; }
.status-chip.low     { background:#fee2e2; color:#b91c1c; }

/* ── Stock value highlight ────────────────────────────────────────── */
.stock-val {
    font-weight: 800;
    font-size: 18px;
    line-height: 1.2;
}
.stock-val.low     { color:#dc2626; }
.stock-val.warning { color:#d97706; }
.stock-val.aman    { color:#16a34a; }

/* ── Sticky filter bar ────────────────────────────────────────────── */
.stock-filter-bar {
    position: sticky;
    top: 0;
    z-index: 80;
    background: #f8fafc;
    padding: 10px 0 8px;
    margin-bottom: 4px;
}

/* ── View-toggle buttons (Card / Table) ───────────────────────────── */
.view-toggle {
    display: inline-flex;
    gap: 0;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    overflow: hidden;
    flex-shrink: 0;
}
.view-toggle button {
    background: #fff;
    color: #475569;
    border: none;
    border-radius: 0;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    min-height: 36px;
    gap: 5px;
    transition: background .15s, color .15s;
}
.view-toggle button:hover { background:#f1f5f9; color:#0f172a; }
.view-toggle button.active { background:#2563eb; color:#fff; }
.view-toggle button:first-child { border-right: 1px solid #cbd5e1; }

/* ── Category summary strip ──────────────────────────────────────── */
.cat-strip {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.cat-strip-item {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: all .15s;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.cat-strip-item:hover, .cat-strip-item.active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}
.cat-strip-item .strip-count {
    background: rgba(0,0,0,.08);
    border-radius: 999px;
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 700;
}
.cat-strip-item.active .strip-count { background: rgba(255,255,255,.25); }

/* ── Stock card grid (mobile & desktop card view) ─────────────────── */
.stock-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
    margin-top: 10px;
}

/* ── Individual stock card ────────────────────────────────────────── */
.stock-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: box-shadow .15s, transform .12s;
    position: relative;
}
.stock-card:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,.09);
    transform: translateY(-1px);
}
.stock-card.low-stock  { border-left: 4px solid #dc2626; }
.stock-card.warn-stock { border-left: 4px solid #f59e0b; }
.stock-card.ok-stock   { border-left: 4px solid #22c55e; }

/* Card header row */
.sc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}
.sc-name {
    font-weight: 700;
    font-size: 14.5px;
    color: #0f172a;
    line-height: 1.35;
    flex: 1;
    min-width: 0;
    word-break: break-word;
}
.sc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}
.sc-meta-pill {
    background: #f1f5f9;
    color: #475569;
    border-radius: 6px;
    padding: 2px 7px;
    font-size: 11px;
    font-weight: 600;
}

/* Stock numbers row */
.sc-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    background: #f8fafc;
    border-radius: 10px;
    padding: 10px 8px;
}
.sc-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2px;
}
.sc-stat-label {
    font-size: 10px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.sc-stat-val {
    font-size: 17px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
}
.sc-stat-val.sisa.low     { color:#dc2626; }
.sc-stat-val.sisa.warning { color:#d97706; }
.sc-stat-val.sisa.aman    { color:#16a34a; }
.sc-stat-sub {
    font-size: 10px;
    color: #94a3b8;
}

/* Card footer row */
.sc-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    flex-wrap: nowrap;
    border-top: 1px solid #f1f5f9;
    padding-top: 8px;
    margin-top: 2px;
}

/* Checkbox for bulk select on card — compact toggle style */
.sc-checkbox-wrap {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    user-select: none;
    font-size: 11.5px;
    color: #94a3b8;
    padding: 4px 8px;
    border-radius: 7px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    transition: all .15s;
    white-space: nowrap;
}
.sc-checkbox-wrap:hover {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #2563eb;
}
.sc-checkbox-wrap input[type=checkbox] {
    width: 13px;
    height: 13px;
    min-height: unset;
    padding: 0;
    margin: 0;
    border-radius: 3px;
    cursor: pointer;
    accent-color: #2563eb;
    flex-shrink: 0;
}

/* ── Category group header inside card grid ───────────────────────── */
.stock-cat-header {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px 4px;
    border-bottom: 2px solid #e2e8f0;
    margin-top: 4px;
}
.stock-cat-header-label {
    font-weight: 800;
    font-size: 13.5px;
    color: #1e293b;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.stock-cat-header-count {
    background: #e2e8f0;
    color: #475569;
    border-radius: 999px;
    padding: 1px 9px;
    font-size: 11px;
    font-weight: 700;
}

/* ── Desktop table enhancements (applied always for consistency) ──── */
.tbl-category-row td {
    background: #f3f4f6;
    font-weight: 800;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #374151;
    padding: 7px 10px !important;
    border-bottom: 2px solid #e2e8f0;
}
.tbl-stock-in  { color:#16a34a; font-weight:700; }
.tbl-stock-out { color:#dc2626; font-weight:700; }
.tbl-stock-remain { font-weight:800; }
.tbl-stock-remain.low     { color:#dc2626; }
.tbl-stock-remain.warning { color:#d97706; }
.tbl-stock-remain.aman    { color:#16a34a; }

/* ── Floating bulk-delete bar (appears when items selected) ───────── */
.bulk-action-bar {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #0f172a;
    color: #fff;
    border-radius: 14px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,.35);
    z-index: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
    white-space: nowrap;
    border: 1px solid rgba(255,255,255,.1);
}
.bulk-action-bar.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}
.bulk-action-bar .bulk-count {
    font-size: 13px;
    font-weight: 600;
    color: #94a3b8;
}
.bulk-action-bar .bulk-count strong { color:#fff; }
.bulk-action-bar .btn-bulk-delete {
    background: #dc2626;
    color: #fff;
    border: none;
    border-radius: 9px;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    transition: background .15s;
}
.bulk-action-bar .btn-bulk-delete:hover { background:#b91c1c; }
.bulk-action-bar .btn-bulk-cancel {
    background: transparent;
    color: #94a3b8;
    border: 1px solid #334155;
    border-radius: 9px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    min-height: 36px;
    transition: all .15s;
}
.bulk-action-bar .btn-bulk-cancel:hover { color:#fff; border-color:#64748b; }

/* ── Empty state ──────────────────────────────────────────────────── */
.stock-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 20px;
    color: #94a3b8;
}
.stock-empty .empty-icon { font-size: 48px; margin-bottom: 12px; }
.stock-empty p { font-size: 15px; font-weight: 600; margin: 0 0 6px; color: #475569; }
.stock-empty small { font-size: 13px; }

/* ── Action button group inside card ──────────────────────────────── */
.sc-actions { display:flex; gap:5px; flex-wrap:nowrap; }
.sc-actions .btn {
    padding: 4px 10px;
    font-size: 11.5px;
    min-height: 28px;
    border-radius: 6px;
    font-weight: 600;
    white-space: nowrap;
}

/* ── Mobile overrides for stock page ─────────────────────────────── */
@media (max-width: 768px) {
    /* Hide table, show cards on mobile */
    .stock-table-wrap  { display: none !important; }
    .stock-card-grid   { display: grid !important; grid-template-columns: 1fr !important; gap: 10px !important; }

    /* Sticky filter on mobile */
    .stock-filter-bar  { top: 0 !important; padding: 8px 0 6px !important; background: #f1f5f9 !important; }

    /* Cat strip scrolls horizontally */
    .cat-strip         { flex-wrap: nowrap !important; overflow-x: auto !important; -webkit-overflow-scrolling: touch !important; padding-bottom: 4px !important; }
    .cat-strip::-webkit-scrollbar { height: 0; }

    /* Card grid full width */
    .stock-card        { border-radius: 12px !important; padding: 12px 11px !important; gap: 8px !important; }
    .sc-stat-val       { font-size: 15px !important; }
    .sc-name           { font-size: 13.5px !important; }
    .sc-stats          { padding: 8px 6px !important; gap: 6px !important; }

    /* Footer compact on mobile */
    .sc-footer         { padding-top: 7px !important; gap: 5px !important; }
    .sc-checkbox-wrap  { padding: 3px 7px !important; font-size: 11px !important; }
    .sc-checkbox-wrap input[type=checkbox] { width: 12px !important; height: 12px !important; }
    .sc-actions .btn   { padding: 3px 9px !important; font-size: 11px !important; min-height: 26px !important; }

    /* Header action row stacks */
    .stock-header-row  { flex-direction: column !important; align-items: stretch !important; gap: 10px !important; }
    .stock-header-row .btn-group { flex-direction: column !important; }
    .stock-header-row .btn-group .btn { width: 100% !important; justify-content: center !important; }

    /* Bulk action bar sits above FAB */
    .bulk-action-bar   { bottom: 84px !important; max-width: calc(100vw - 28px) !important; }

    /* View toggle hidden on mobile (always card view) */
    .view-toggle       { display: none !important; }
}

@media (min-width: 769px) {
    /* Hide cards, show table on desktop by default */
    .stock-card-grid.desktop-hide { display: none !important; }
}
