/* --- Dashboard Specific Styles --- */
.dashboard-body {
    background-color: var(--bg-color);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

.customer-theme {
    display: block;
    /* Customer dashboard has top nav */
}

/* --- SafiApp Replica Sidebar --- */
.sidebar {
    width: 200px;
    background-color: #071f11;
    /* Deep dark green matching screenshot */
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 1000;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.sidebar-header .logo {
    color: #ffffff;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-weight: 700;
}

.sidebar-header .logo i {
    color: #a4d65e;
    /* Light green leaf */
}

.sidebar-nav {
    padding: 1.5rem 0;
    flex-grow: 1;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.7rem;
    color: #a8b8b0;
    text-decoration: none;
    font-weight: 400;
    font-size: 0.95rem;
    transition: background 0.2s;
}

.sidebar-nav a:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-nav a i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar-nav a.active {
    background-color: #173b27;
    color: #ffffff;
    font-weight: 600;
    border-left: 4px solid #1e7041;
}

.sidebar-footer {
    padding: 1.5rem;
}

.sidebar-footer a,
.sidebar-footer button {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1.5rem;
    width: 100%;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    text-decoration: none;
    text-align: left;
}

.sidebar-footer .theme-toggle {
    color: #a8b8b0;
}

.sidebar-footer .theme-toggle i {
    color: #e6a715;
}

.sidebar-footer .logout-btn {
    color: #f75959;
    font-weight: 600;
    margin-top: 0.5rem;
}

.sidebar-footer .logout-btn:hover {
    color: #ff7575;
}

/* --- Main SafiApp Layout --- */
.main-content {
    flex-grow: 1;
    margin-left: 200px;
    padding: 2rem 3rem;
    width: calc(100% - 200px);
    background-color: var(--bg-color);
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

.admin-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 600;
}

.avatar {
    width: 40px;
    height: 40px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Stats --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background-color: rgba(45, 106, 79, 0.1);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.stat-icon.warning {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.stat-icon.success {
    background-color: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 700;
}

.stat-number.positive {
    color: var(--text-positive);
}

.stat-number.negative {
    color: var(--text-negative);
}

/* --- SafiApp Data Cards --- */
.safi-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.safi-metric-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.safi-metric-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.safi-metric-img {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: cover;
    margin-bottom: 1rem;
    background: #eee;
}

.safi-metric-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-main);
    margin-bottom: 0.8rem;
}

.safi-metric-number {
    font-size: 2.2rem;
    font-weight: 700;
    color: #1e7041;
    line-height: 1;
}

.safi-metric-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
}


.section-header-inline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
    /* guarantees table readability */
}

/* --- SafiApp Data Tables --- */
.safi-table-container {
    width: 100%;
    margin-top: 1.5rem;
}

.safi-table {
    width: 100%;
    border-collapse: collapse;
}

.safi-table th {
    background-color: var(--surface-color);
    color: var(--text-main);
    font-weight: 700;
    font-size: 0.85rem;
    padding: 1.2rem 1.5rem;
    text-align: left;
}

.safi-table th:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.safi-table th:last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    text-align: right;
}

.safi-table td {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 600;
    vertical-align: middle;
}

.safi-table td:last-child {
    text-align: right;
}

.safi-table tr:last-child td {
    border-bottom: none;
}

.safi-table .text-green {
    color: #1e7041;
}

.safi-table .text-red {
    color: #dc3545;
}

.safi-table .text-muted {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.8rem;
}

/* --- SafiApp Tabs --- */
.safi-tabs-container {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.safi-tabs-container button {
    background: none;
    border: none;
    padding: 0.8rem 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.safi-tabs-container button:hover {
    color: #1e7041;
}

.safi-tabs-container button.active {
    color: #1e7041;
    border-bottom: 3px solid #1e7041;
}

.safi-tabs-container button .dot-active {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #28a745;
    border-radius: 50%;
    margin-right: 6px;
}

.safi-tabs-container button .dot-inactive {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #dc3545;
    border-radius: 50%;
    margin-right: 6px;
}

/* --- Inline Input Groups --- */
.safi-input-row {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

.safi-input {
    flex-grow: 1;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    background: var(--bg-color);
    color: var(--text-main);
}

.safi-btn-primary {
    background-color: #26593a;
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.safi-btn-primary:hover {
    background-color: #1e452e;
}

.safi-btn-ghost {
    background-color: transparent;
    border: 1px solid #26593a;
    color: #26593a;
    padding: 0.8rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Override existing data-table */
.data-table {
    display: none;
}

.balance-card {
    background: var(--surface-color);
    border-radius: var(--radius);
    padding: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    border-left: 5px solid;
    flex-wrap: wrap;
    gap: 1rem;
}

.positive-balance {
    border-left-color: var(--primary-color);
}

.negative-balance {
    border-left-color: #dc3545;
}

.balance-amount h2 {
    font-size: 2.5rem;
    color: var(--primary-color);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.order-form .row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid #eee;
}

.order-form .row:last-child {
    border: none;
}

.qty-control {
    display: flex;
    align-items: center;
    background: #f1f3f5;
    border-radius: 8px;
    overflow: hidden;
}

.qty-btn {
    background: none;
    border: none;
    width: 35px;
    height: 35px;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--primary-dark);
}

.qty-control input {
    width: 40px;
    text-align: center;
    border: none;
    background: transparent;
    font-weight: 600;
    pointer-events: none;
}

.w-100 {
    width: 100%;
    margin-top: 1.5rem;
}

/* --- Modals for auth, ledger, and products --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-card {
    background: var(--surface-color);
    width: 100%;
    max-width: 450px;
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    transform: translateY(20px);
    transition: var(--transition);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.active .modal-card {
    transform: translateY(0);
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

.auth-form .form-group {
    margin-bottom: 1.2rem;
}

.auth-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.auth-form input,
.auth-form select {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    background-color: var(--surface-color);
    color: var(--text-main);
    border-radius: 8px;
    font-family: inherit;
    transition: var(--transition);
}

.auth-form input:focus,
.auth-form select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.1);
}

/* --- Profile Dropdown (Owner Icon) --- */
.top-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.profile-dropdown-wrapper {
    position: relative;
}

.profile-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.profile-dropdown {
    position: absolute;
    top: 50px;
    right: 0;
    background: var(--surface-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: 500;
    display: none;
    overflow: hidden;
}

.profile-dropdown.active {
    display: block;
}

.profile-dropdown a {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1.2rem;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

.profile-dropdown a:hover {
    background: var(--bg-color);
}

/* --- 3-Dot Menu for Products --- */
.dot-menu-btn {
    background: none;
    border: 1px solid #eee;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1rem;
    transition: var(--transition);
}

.dot-menu-btn:hover {
    background: var(--bg-color);
    color: var(--text-main);
}

.pac-actions {
    position: relative;
}

.dot-menu-dropdown {
    display: none;
    position: absolute;
    top: 36px;
    right: 0;
    background: var(--surface-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 140px;
    z-index: 500;
    overflow: hidden;
}

.dot-menu-dropdown.active {
    display: block;
}

.dot-menu-dropdown a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1rem;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.85rem;
    transition: var(--transition);
}

.dot-menu-dropdown a:hover {
    background: var(--bg-color);
}

.dot-menu-dropdown a.danger {
    color: #dc3545;
}

.dot-menu-dropdown a.danger:hover {
    background: #fff5f5;
}

/* --- Product Admin Grid (Card Layout) --- */
.products-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
}

.product-admin-card {
    background: var(--surface-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    position: relative;
    transition: var(--transition);
}

.product-admin-card:hover {
    box-shadow: var(--shadow-md);
}

.pac-img {
    height: 160px;
    background-color: var(--bg-color);
    background-size: cover;
    background-position: center;
}

.pac-info {
    padding: 1rem;
}

.pac-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
}

.pac-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}

/* --- Image Upload Box --- */
.image-upload-box {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-muted);
}

.image-upload-box:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.image-upload-box i {
    font-size: 1.5rem;
    margin-bottom: 0.3rem;
}

/* --- Clickable Table Rows --- */
.clickable-row {
    cursor: pointer;
    transition: var(--transition);
}

.clickable-row:hover {
    background-color: rgba(45, 106, 79, 0.04);
}

/* --- Customer Profile Card (Detail Page) --- */
.customer-profile-card {
    background: var(--surface-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.cp-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.cp-avatar {
    width: 60px;
    height: 60px;
    background: var(--bg-color);
    color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.cp-balance-box {
    text-align: right;
    padding: 1rem 1.5rem;
    background: var(--bg-color);
    border-radius: 8px;
}

.cp-balance-box p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

/* --- Inline Form (used on customer detail) --- */
.inline-form {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.inline-form select,
.inline-form input {
    padding: 0.7rem;
    border: 1px solid var(--border-color);
    background-color: var(--surface-color);
    color: var(--text-main);
    border-radius: 8px;
    font-family: inherit;
    flex: 1;
    min-width: 120px;
}

.inline-form select:focus,
.inline-form input:focus {
    border-color: var(--primary-color);
    outline: none;
}

/* --- Settings Tabs --- */
.settings-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 2rem;
    background: var(--surface-color);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    border: none;
    background: transparent;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: rgba(45, 106, 79, 0.03);
}

/* --- Mobile Sidebar Button --- */
.mobile-sidebar-btn {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 99;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.close-sidebar {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

/* === MOBILE RESPONSIVE === */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 1.5rem 0.6rem 5.5rem 0.6rem;
    }

    .mobile-sidebar-btn,
    .close-sidebar {
        display: block;
    }

    .top-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 0.5rem;
        margin-top: 1rem;
        margin-bottom: 1.5rem;
    }

    .top-header h1 {
        font-size: 1.3rem;
    }

    .card {
        padding: 0.8rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.6rem 0.5rem;
        font-size: 0.8rem;
    }

    .stat-card {
        padding: 1rem;
        gap: 0.8rem;
    }

    .stat-info h3 {
        font-size: 0.9rem;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .stat-number {
        font-size: 1.25rem;
    }

    .btn-action {
        padding: 0.3rem;
        font-size: 0.7rem;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .products-admin-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }

    .pac-img {
        height: 120px;
    }

    .customer-profile-card {
        padding: 1rem;
    }

    .cp-avatar {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }

    .cp-balance-box {
        text-align: left;
        width: 100%;
    }

    .inline-form {
        flex-direction: column;
    }

    .settings-tabs {
        flex-direction: column;
    }

    .tab-btn {
        border-bottom: none;
        border-left: 3px solid transparent;
        text-align: left;
        padding: 0.8rem 1rem;
    }

    .tab-btn.active {
        border-left-color: var(--primary-color);
    }

    .order-product-row {
        flex-direction: row;
        gap: 0.8rem;
        padding: 0.8rem 0;
    }

    .opr-img {
        width: 45px;
        height: 45px;
        min-width: 45px;
        border-radius: 6px;
    }

    .opr-info h4 {
        font-size: 0.9rem;
    }

    .opr-info p {
        font-size: 0.75rem;
    }

    .order-total-bar {
        flex-direction: column;
        gap: 0.8rem;
        align-items: flex-start;
    }
}

/* --- Customer Order Product Row --- */
.order-product-row {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.order-product-row:last-child {
    border-bottom: none;
}

.opr-img {
    width: 55px;
    height: 55px;
    min-width: 55px;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-color);
    border-radius: 8px;
}

.opr-info {
    flex: 1;
}

.opr-info h4 {
    font-size: 1rem;
    margin-bottom: 0.2rem;
    color: var(--primary-dark);
}

.qty-display {
    display: inline-block;
    width: 30px;
    text-align: center;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-main);
}

.qty-control {
    display: flex;
    align-items: center;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.qty-btn {
    background: transparent;
    border: none;
    color: var(--text-main);
    width: 35px;
    height: 35px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}

.qty-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* --- Order Total Bar --- */
.order-total-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-color);
    padding: 1rem 1.2rem;
    border-radius: 8px;
    margin-top: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.total-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.total-info strong {
    font-size: 1.3rem;
    color: var(--primary-color);
}

/* --- Order Status Banner --- */
.order-status-banner {
    border-left: 4px solid var(--accent-color);
}

/* --- Mobile Responsiveness Native Hooks --- */
@media (max-width: 768px) {
    .container {
        width: 100% !important;
        padding: 0 0.5rem !important;
    }

    .safi-card {
        padding: 1rem !important;
        border-radius: 8px !important;
    }

    .safi-table th,
    .safi-table td {
        padding: 0.8rem 0.4rem !important;
        font-size: 0.85rem;
    }

    .safi-table img {
        width: 32px !important;
        height: 32px !important;
    }

    .dot-menu-dropdown {
        right: 0px !important;
        top: 25px !important;
    }
}

/* --- Bottom Navigation Bar (Mobile) --- */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    z-index: 2000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.bottom-nav-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 500px;
    margin: 0 auto;
}

.bn-item {
    text-decoration: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.4rem 0.5rem;
    transition: all 0.2s;
}

.bn-item i {
    font-size: 1.2rem;
}

.bn-item.active {
    color: #1e7041;
}

.bn-item:hover {
    color: var(--text-main);
}

@media (max-width: 768px) {
    .bottom-nav {
        display: block;
    }

    .mobile-sidebar-btn {
        display: none !important;
    }

    /* Modals - Allow Scrolling */
    .modal-overlay {
        align-items: flex-start;
        padding: 2rem 0.5rem;
        overflow-y: auto;
    }

    .modal-card {
        padding: 1.5rem 1rem;
        width: 100%;
        margin: 0 auto;
        max-height: none;
        overflow-y: visible;
    }

    /* Condense 4 Stat Boxes into 2-Column Grid */
    .stats-grid,
    .dash-stats-grid,
    .cust-stats-grid,
    .prod-stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.6rem !important;
        margin-bottom: 2rem !important;
    }

    .stat-card,
    .dash-stat-card,
    .cust-stat-card,
    .prod-stat-card {
        padding: 0.8rem !important;
        gap: 0.5rem !important;
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    .stat-icon,
    .ds-icon,
    .cust-stat-icon,
    .prod-stat-icon {
        width: 32px !important;
        height: 32px !important;
        font-size: 1rem !important;
        border-radius: 8px !important;
        margin-bottom: 0.5rem !important;
    }

    .stat-number,
    .dash-stat-val,
    .cust-stat-val,
    .prod-stat-val {
        font-size: 1.25rem !important;
        line-height: 1 !important;
        margin-bottom: 0.2rem !important;
    }

    .stat-title,
    .dash-stat-title,
    .cust-stat-title,
    .prod-stat-title {
        font-size: 0.85rem !important;
        margin-bottom: 0.1rem !important;
    }

    .stat-sub,
    .dash-stat-sub,
    .cust-stat-sub,
    .prod-stat-sub {
        font-size: 0.7rem !important;
        line-height: 1.2 !important;
    }

    /* Product Page Filters (One Line Scrollable) */
    .prod-toolbar {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        padding-bottom: 0.8rem;
        -webkit-overflow-scrolling: touch;
        gap: 0.5rem;
    }

    .prod-toolbar>* {
        flex: 0 0 auto !important;
        white-space: nowrap;
    }

    .prod-search {
        min-width: 180px;
    }

    .prod-search input,
    .prod-filter-select,
    .btn-clear {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
        font-size: 0.8rem;
    }
}

/* --- Horizontal Scrollable Tabs --- */
.safi-tabs-container,
.settings-tabs {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

.safi-tabs-container::-webkit-scrollbar,
.settings-tabs::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari and Opera */
}

.tab-btn {
    flex-shrink: 0;
}

/* === GLOBAL UI HOTFIXES === */
input:focus,
select:focus,
textarea:focus,
button:focus {
    outline: none !important;
    box-shadow: none !important;
}

.modal-content,
.modal-card {
    max-height: 90vh;
    overflow-y: auto;
}

@media (max-width: 768px) {

    .modal-content,
    .modal-card {
        max-height: 85vh;
        overflow-y: auto;
        padding-bottom: 2rem !important;
        /* Ensure buttons are not cut off */
    }
}