/* ============================================================ */
/* 1.0  RESET & GLOBAL STYLES */
/* ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c5282;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #2d3748;
    
    --sidebar-width: 260px;
    --navbar-height: 60px;
    
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    
    --transition: all 0.3s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background: #f4f6f9;
    overflow-x: hidden;
}

/* ============================================================ */
/* 2.0  TOP NAVIGATION BAR */
/* ============================================================ */
.top-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    background: white;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 1000;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 20px;
    color: #333;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: var(--light-color);
}

.navbar-brand {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-brand i {
    font-size: 24px;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.navbar-item {
    position: relative;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: var(--transition);
}

.navbar-item:hover {
    background: var(--light-color);
}

.navbar-item i {
    font-size: 18px;
    color: #666;
}

.navbar-item .badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger-color);
    color: white;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 10px;
    font-weight: bold;
}

/* ============================================================ */
/* 2.1  USER DROPDOWN */
/* ============================================================ */
.user-dropdown {
    position: relative;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px;
    cursor: pointer;
}

.user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
}

.user-details {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.user-role {
    font-size: 12px;
    color: #666;
}

.user-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: white;
    box-shadow: var(--shadow-lg);
    border-radius: 8px;
    min-width: 200px;
    display: none;
    z-index: 1001;
}

.user-menu.show {
    display: block;
}

.user-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    transition: var(--transition);
}

.user-menu a:hover {
    background: var(--light-color);
}

.user-menu a i {
    width: 20px;
    font-size: 16px;
}

.user-menu hr {
    margin: 5px 0;
    border: none;
    border-top: 1px solid #eee;
}

.logout-link {
    color: var(--danger-color) !important;
}

/* ============================================================ */
/* 3.0  LAYOUT WRAPPER */
/* ============================================================ */
.layout-wrapper {
    margin-top: var(--navbar-height);
    display: flex;
    min-height: calc(100vh - var(--navbar-height));
}

/* ============================================================ */
/* 4.0  SIDEBAR */
/* ============================================================ */
.sidebar {
    width: var(--sidebar-width);
    background: white;
    box-shadow: var(--shadow-sm);
    position: fixed;
    left: 0;
    top: var(--navbar-height);
    height: calc(100vh - var(--navbar-height));
    overflow-y: auto;
    transition: var(--transition);
    z-index: 999;
}

.sidebar.collapsed {
    margin-left: calc(var(--sidebar-width) * -1);
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-group {
    margin-bottom: 20px;
}

.nav-group-title {
    padding: 8px 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #999;
    letter-spacing: 0.5px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #666;
    text-decoration: none;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--light-color);
    color: var(--primary-color);
}

.nav-item.active {
    background: rgba(0, 123, 255, 0.1);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 600;
}

.nav-item i {
    width: 20px;
    font-size: 16px;
    text-align: center;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px 20px;
    background: var(--light-color);
    text-align: center;
    font-size: 11px;
    color: #999;
}

.sidebar-footer p {
    margin: 2px 0;
}

/* ============================================================ */
/* 5.0  MAIN CONTENT */
/* ============================================================ */
.main-content {
    flex: 1;
    min-width: 0; /* prevent flex item from expanding beyond viewport */
    margin-left: var(--sidebar-width);
    padding: 30px;
    transition: var(--transition);
}

.main-content.expanded {
    margin-left: 0;
}

/* ============================================================ */
/* 6.0  PAGE HEADER */
/* ============================================================ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-title {
    font-size: 28px;
    font-weight: 600;
    color: #333;
}

.page-subtitle {
    font-size: 14px;
    color: #666;
    margin-top: 5px;
}

.page-actions {
    display: flex;
    gap: 10px;
}

/* ============================================================ */
/* 7.0  CARDS */
/* ============================================================ */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 15px 20px;
    background: var(--light-color);
    border-top: 1px solid #eee;
}

/* ============================================================ */
/* 7.1  STAT CARDS */
/* ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 25px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
}

.stat-icon.primary {
    background: linear-gradient(135deg, var(--primary-color), #1a365d);
}

.stat-icon.success {
    background: linear-gradient(135deg, var(--success-color), #1e7e34);
}

.stat-icon.warning {
    background: linear-gradient(135deg, var(--warning-color), #e0a800);
}

.stat-icon.danger {
    background: linear-gradient(135deg, var(--danger-color), #bd2130);
}

.stat-details {
    flex: 1;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #333;
    line-height: 1;
}

.stat-label {
    font-size: 13px;
    color: #666;
    margin-top: 5px;
}

.stat-change {
    font-size: 12px;
    margin-top: 5px;
}

.stat-change.up {
    color: var(--success-color);
}

.stat-change.down {
    color: var(--danger-color);
}

/* ============================================================ */
/* 8.0  BUTTONS */
/* ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #1a365d;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-warning {
    background: var(--warning-color);
    color: #333;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn-info {
    background: var(--info-color);
    color: white;
}

.btn-info:hover {
    background: #138496;
}

.btn-light {
    background: var(--light-color);
    color: #333;
    border: 1px solid #ddd;
}

.btn-light:hover {
    background: #e2e6ea;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

/* ============================================================ */
/* 9.0  TABLES */
/* ============================================================ */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    margin: 0 -20px; /* Extend to card edges */
    padding: 0 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    min-width: 600px; /* Prevent table from being too narrow */
}

table thead {
    background: var(--light-color);
}

table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap; /* Prevent header wrapping */
}

table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

table tbody tr:hover {
    background: var(--light-color);
}

.table-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ============================================================ */
/* 10.0  FORMS */
/* ============================================================ */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

label.required::after {
    content: ' *';
    color: var(--danger-color);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: var(--transition);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

/* ============================================================ */
/* 11.0  ALERTS */
/* ============================================================ */
.alert {
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert i {
    font-size: 18px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error,
.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.alert-dismissible {
    position: relative;
    padding-right: 50px;
}

.alert-close {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.5;
    transition: var(--transition);
}

.alert-close:hover {
    opacity: 1;
}

/* ============================================================ */
/* 12.0  BADGES */
/* ============================================================ */
.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 12px;
    letter-spacing: 0.5px;
}

.badge-primary {
    background: var(--primary-color);
    color: white;
}

.badge-success {
    background: var(--success-color);
    color: white;
}

.badge-danger {
    background: var(--danger-color);
    color: white;
}

.badge-warning {
    background: var(--warning-color);
    color: #333;
}

.badge-info {
    background: var(--info-color);
    color: white;
}

.badge-secondary {
    background: var(--secondary-color);
    color: white;
}

/* ============================================================ */
/* 13.0  PAGINATION */
/* ============================================================ */
.pagination {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin-top: 20px;
}

.page-link {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    transition: var(--transition);
}

.page-link:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.page-link.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* ============================================================ */
/* 14.0  UTILITY CLASSES */
/* ============================================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }

.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }

.p-20 { padding: 20px; }
.p-30 { padding: 30px; }

/* ============================================================ */
/* 14.0a  SHOW/HIDE RESPONSIVE HELPERS */
/* ============================================================ */
.mobile-only { display: none; }
.desktop-only { display: block; }

/* ============================================================ */
/* 14.0b  GENERIC LIST CARD (mobile layout — invoices, quotations, customers, etc) */
/* ============================================================ */
.list-card {
    border-bottom: 1px solid #eee;
    padding: 14px 16px;
    background: white;
}

.list-card:last-child { border-bottom: none; }

.list-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 8px;
}

.list-card-number {
    font-weight: 700;
    color: #007bff;
    text-decoration: none;
    font-size: 14px;
}

.list-card-customer {
    font-weight: 600;
    font-size: 15px;
    color: #333;
    margin-bottom: 6px;
}

.list-card-sub {
    font-size: 12px;
    color: #888;
    margin-bottom: 6px;
}

.list-card-meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.list-card-meta span { display: flex; align-items: center; gap: 4px; }

.list-card-amount {
    font-size: 18px;
    font-weight: 700;
    color: #2c5282;
    margin-bottom: 10px;
}

.list-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.list-card-actions .btn {
    flex: 1;
    min-width: 60px;
    justify-content: center;
    font-size: 13px;
    padding: 8px 10px;
    min-height: 38px;
}

/* ============================================================ */
/* 14.0c  PRODUCT CARD (mobile layout — list_products specific) */
/* ============================================================ */
.product-card {
    border-bottom: 1px solid #eee;
    padding: 14px 16px;
    background: white;
}

.product-card:last-child {
    border-bottom: none;
}

.product-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    gap: 10px;
}

.product-card-code {
    font-weight: 700;
    color: #007bff;
    text-decoration: none;
    font-size: 13px;
    display: block;
}

.product-card-name {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-top: 2px;
    line-height: 1.3;
}

.product-card-info {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 12px;
}

.product-card-label {
    color: #666;
}

.product-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.product-card-actions .btn {
    flex: 1;
    justify-content: center;
    min-width: 70px;
}

/* ============================================================ */
/* 14.1  FILTER GRID */
/* ============================================================ */
.filter-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto;
    gap: 10px;
    margin-bottom: 10px;
}

/* ============================================================ */
/* 14.2  TAB SCROLL (product/filter tabs) */
/* ============================================================ */
.tab-scroll {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

/* ============================================================ */
/* 14.3  SPACING UTILITIES (mb-0, mb-4 used in report pages) */
/* ============================================================ */
.mb-0 { margin-bottom: 0 !important; }
.mb-4 { margin-bottom: 24px !important; }

/* ============================================================ */
/* 14.3b PROGRESS BAR (used in inventory reports) */
/* ============================================================ */
.progress {
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    height: 20px;
}
.progress-bar {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: white;
    background: var(--warning-color);
    transition: width 0.4s ease;
}
.progress-bar.bg-warning { background: var(--warning-color); }
.progress-bar.bg-danger  { background: var(--danger-color); }
.progress-bar.bg-success { background: var(--success-color); }

/* ============================================================ */
/* 14.4  PRODUCT SEARCH GRID */
/* ============================================================ */
.product-search-grid {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 10px;
    align-items: center;
}

/* ============================================================ */
/* 14.6  TWO-COLUMN GRID (report sections, side-by-side cards) */
/* ============================================================ */
.two-col-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

/* ============================================================ */
/* 14.5  PRODUCT CARD VALUE OVERFLOW FIX */
/* ============================================================ */
.product-card {
    overflow: hidden;
    max-width: 100%;
}
.product-card-info {
    overflow: hidden;
}
.product-card-row {
    display: grid;
    grid-template-columns: 110px 1fr;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    font-size: 13px;
    border-bottom: 1px solid #eee;
}
.product-card-row:last-child { border-bottom: none; }
.product-card-row > span:last-child,
.product-card-row > strong:last-child {
    text-align: right;
    word-break: break-word;
    min-width: 0;
    overflow: hidden;
}

/* ============================================================ */
/* 14.5  MOBILE SIDEBAR BACKDROP */
/* ============================================================ */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1099;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-backdrop.show {
    display: block;
    opacity: 1;
}

/* ============================================================ */
/* 15.0  RESPONSIVE — Tablet & below (≤768px)                  */
/* Covers: Honor X9c (412px), iPhone 12–17 Pro Max (390–430px) */
/* ============================================================ */
@media (max-width: 768px) {

    /* --- Show/Hide helpers ---------------------------------- */
    .mobile-only { display: block; }
    .desktop-only { display: none !important; }

    /* --- Sidebar -------------------------------------------- */
    .sidebar {
        margin-left: calc(var(--sidebar-width) * -1);
        box-shadow: 2px 0 10px rgba(0,0,0,0.3);
        z-index: 1100;
        /* Fix: kemas kini top & height untuk iOS safe area (notch/Dynamic Island) */
        top: calc(var(--navbar-height) + env(safe-area-inset-top, 0px));
        height: calc(100vh - var(--navbar-height) - env(safe-area-inset-top, 0px));
    }

    .sidebar.show {
        margin-left: 0;
    }

    .nav-item {
        padding: 15px 20px;
        font-size: 15px;
        min-height: 52px;
    }

    .nav-item i {
        font-size: 18px;
    }

    /* --- Navbar --------------------------------------------- */
    .top-navbar {
        padding: 0 12px;
        /* iOS safe area — top notch / Dynamic Island */
        padding-top: env(safe-area-inset-top, 0px);
        height: calc(var(--navbar-height) + env(safe-area-inset-top, 0px));
    }

    .navbar-brand {
        font-size: 15px;
    }

    .navbar-brand img {
        height: 26px !important;
    }

    .user-details {
        display: none;
    }

    .user-info i.fa-chevron-down {
        display: none;
    }

    .sidebar-toggle {
        font-size: 22px;
        padding: 10px;
        min-width: 44px;
        min-height: 44px;
    }

    .user-menu {
        right: 0;
        min-width: 190px;
    }

    .user-menu a {
        padding: 14px 18px;
        min-height: 48px;
    }

    /* --- Layout --------------------------------------------- */
    .layout-wrapper {
        margin-top: calc(var(--navbar-height) + env(safe-area-inset-top, 0px));
        min-height: calc(100vh - var(--navbar-height) - env(safe-area-inset-top, 0px));
    }

    .main-content {
        margin-left: 0;
        min-width: 0;
        max-width: 100%;
        overflow-x: hidden;
        padding: 16px;
        /* iOS home indicator safe area */
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }

    /* --- Page header ---------------------------------------- */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 20px;
    }

    .page-title {
        font-size: 22px;
    }

    .page-subtitle {
        font-size: 13px;
    }

    /* Page actions — wrap, full width buttons */
    .page-actions {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }

    .page-actions .btn {
        flex: 1 1 auto;
        justify-content: center;
        min-width: 120px;
    }

    /* --- Cards ---------------------------------------------- */
    .card {
        margin-bottom: 14px;
        border-radius: 8px;
    }

    .card-header {
        padding: 14px 16px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .card-title {
        font-size: 16px;
    }

    .card-body {
        padding: 14px 16px;
    }

    /* --- Stats grid — 2 kolum di telefon ------------------- */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        margin-bottom: 20px;
    }

    /* --- Two-col-grid — 1 kolum di telefon ----------------- */
    .two-col-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    /* --- Product search grid — stack on mobile ------------- */
    .product-search-grid {
        grid-template-columns: 1fr 1fr;
    }
    .product-search-grid input[type="text"] {
        grid-column: 1 / -1;
    }

    .stat-card {
        padding: 16px;
        gap: 12px;
        flex-direction: column;
        align-items: flex-start;
    }

    .stat-icon {
        width: 48px;
        height: 48px;
        font-size: 22px;
        border-radius: 10px;
    }

    .stat-value {
        font-size: 22px;
    }

    .stat-label {
        font-size: 12px;
    }

    /* --- Buttons -------------------------------------------- */
    .btn {
        display: flex; /* Tukar dari inline-flex — fix teks hilang bila width:100% */
        justify-content: center;
        padding: 11px 18px;
        font-size: 14px;
        min-height: 44px;
    }

    .btn-sm {
        padding: 9px 14px;
        font-size: 13px;
        min-height: 40px;
    }

    .btn-lg {
        padding: 14px 24px;
        font-size: 16px;
        min-height: 52px;
    }

    /* --- Filter grid collapse ------------------------------- */
    .filter-grid {
        grid-template-columns: 1fr 1fr;
    }

    /* --- Tab scroll ----------------------------------------- */
    .tab-scroll {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        scrollbar-width: none; /* Firefox */
    }

    .tab-scroll::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }

    .tab-scroll .btn {
        flex-shrink: 0;
        white-space: nowrap;
        justify-content: center;
    }

    /* --- Forms ---------------------------------------------- */
    .form-row {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    label {
        font-size: 14px;
        margin-bottom: 6px;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    input[type="tel"],
    input[type="search"],
    select,
    textarea {
        padding: 12px 14px;
        font-size: 16px; /* Cegah auto-zoom iOS */
        min-height: 48px;
        border-radius: 8px;
    }

    textarea {
        min-height: 90px;
    }

    /* --- Tables --------------------------------------------- */
    .table-responsive {
        margin: 0 -16px;
        padding: 0;
        border-radius: 0;
        /* Tunjuk ada content boleh scroll ke kanan */
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 13px;
        min-width: 500px;
    }

    table th {
        padding: 10px 10px;
        font-size: 11px;
    }

    table td {
        padding: 10px 10px;
        font-size: 13px;
    }

    .table-actions {
        gap: 4px;
        flex-wrap: nowrap;
    }

    .table-actions .btn {
        padding: 7px 10px;
        font-size: 12px;
        min-height: 36px;
        min-width: 32px;
    }

    /* --- Alerts --------------------------------------------- */
    .alert {
        padding: 12px 14px;
        font-size: 13px;
        gap: 10px;
        border-radius: 8px;
    }

    /* --- Pagination ----------------------------------------- */
    .pagination {
        flex-wrap: wrap;
        gap: 4px;
    }

    .page-link {
        padding: 9px 13px;
        min-height: 40px;
    }
}

/* ============================================================ */
/* 15.1  SMALL PHONES — ≤430px                                  */
/* iPhone 12/13/14/15/16 (390px) hingga Pro Max (430px)         */
/* Honor X9c (412px)                                            */
/* ============================================================ */
@media (max-width: 430px) {

    .main-content {
        padding: 12px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }

    .page-title {
        font-size: 20px;
    }

    /* Stats — tetap 2 kolum tapi lebih compact */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 14px 12px;
    }

    .stat-value {
        font-size: 20px;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    /* Navbar brand — truncate kalau terlalu panjang */
    /* flex container: guna overflow:hidden sahaja, text-overflow tak apply pada flex */
    .navbar-brand {
        font-size: 14px;
        max-width: 180px;
        overflow: hidden;
        white-space: nowrap;
    }

    .card-header {
        padding: 12px 14px;
    }

    .card-body {
        padding: 12px 14px;
    }

    .card-title {
        font-size: 15px;
    }

    /* Page actions — stack kalau < 2 butang */
    .page-actions {
        flex-direction: column;
    }

    .page-actions .btn {
        width: 100%;
        min-width: unset;
        justify-content: center;
    }

    /* Filter grid — single column */
    .filter-grid {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 12px;
        min-width: 460px;
    }

    table th {
        padding: 9px 8px;
        font-size: 10px;
    }

    table td {
        padding: 9px 8px;
        font-size: 12px;
    }

    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }

    .alert {
        font-size: 13px;
        flex-direction: row;
        align-items: flex-start;
    }
}

/* ============================================================ */
/* 16.0  SCROLLBAR STYLING */
/* ============================================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}