/* ===== CSS VARIABLES / THEME ===== */

:root {
    --primary: #1a3a6e;
    --primary-dark: #0f2347;
    --primary-light: #2557a7;
    --accent: #f0a500;
    --accent-light: #ffc93c;
    --white: #ffffff;
    --light: #f0f4fb;
    --light2: #e0e9f7;
    --text: #1a2740;
    --text-muted: #6b7a99;
    --danger: #e53935;
    --success: #2e7d32;
    --border: #c5d4ef;
    --shadow: 0 4px 24px rgba(26, 58, 110, 0.12);
    --radius: 12px;
}
/* ── Sortable Table Headers ── */
.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.sortable:hover { background: var(--light2); }
.sort-arrow { font-size: 0.7rem; margin-left: 4px; opacity: 0.4; }
.sort-arrow.active { opacity: 1; color: var(--primary); }
/* Custom Scrollbar: borderless and blended color */
*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
*::-webkit-scrollbar-track {
    background: rgba(224, 233, 247, 0.9); /* light area blend */
    border-radius: 999px;
}
*::-webkit-scrollbar-thumb {
    background: rgba(26, 58, 110, 0.45);
    border-radius: 999px;
    border: 0;
}
*::-webkit-scrollbar-thumb:hover {
    background: rgba(26, 58, 110, 0.65);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(26,58,110,0.45) rgba(224,233,247,0.9);
}

/*Hide-details*/
#hide-details{
    background: var(--white);
    border-radius: var(--radius);
    padding: 22px 24px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
    border-top: none;
    border-right: none;
    border-bottom: none;
    justify-items: center;
    align-items: center;
}

 .bi-eye-slash{
    display: none;
    cursor: pointer;
 }

 .bi-eye{
    z-index: 999;
    cursor: pointer;
 }


/* ===== RESET ===== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Barlow', sans-serif;
    background: var(--light);
    color: var(--text);
    min-height: 100vh;
}


/* ===== UTILITIES ===== */

.hidden {
    display: none!important;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 12px;
}

.ml-auto {
    margin-left: auto;
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-admin {
    background: #e3edff;
    color: var(--primary);
}

.badge-staff {
    background: #e8f5e9;
    color: var(--success);
}


/* ===== LOGIN PAGE ===== */

#loginPage {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
    position: relative;
    overflow: hidden;
}

#loginPage::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.03) 0px, rgba(255, 255, 255, 0.03) 1px, transparent 1px, transparent 40px);
}

.login-card {
    background: var(--white);
    border-radius: 20px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo .logo-icon {
    width: 72px;
    height: 72px;
    background: var(--primary);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.login-logo h1 {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 1px;
}

.login-logo p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 2px;
}

.logout-card {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    position: relative
}

.logout-card h1 {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 1px;
}

.logout-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 2px;
}

.button-group {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.confirm-button {
    background-color: var(--danger);
    color: var(--white);
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
    opacity: 0.8;
}

.cancel-button {
    background-color: var(--light2);
    color: var(--text);
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease
}

.confirm-button:hover {
    background-color: var(--danger);
    color: var(--white);
    opacity: 1;
}

.cancel-button:hover {
    background-color: var(--primary-dark);
    color: var(--white);
}


/* ===== FORM ELEMENTS ===== */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text);
    margin-bottom: 6px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-family: 'Barlow', sans-serif;
    font-size: 0.95rem;
    color: var(--text);
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-light);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-actions {
    margin-top: 20px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.section-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 14px;
}

.error-msg {
    color: var(--danger);
    font-size: 0.83rem;
    margin-top: 8px;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7a99'%3E%3Cpath d='M5 7l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 32px!important;
}


/* ===== BUTTONS ===== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-family: 'Barlow', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-accent {
    background: var(--accent);
    color: var(--primary-dark);
}

.btn-accent:hover {
    background: var(--accent-light);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-sm {
    padding: 7px 16px;
    font-size: 0.85rem;
}

.card-body .btn-outline {
    margin-top: 20px;
}


/* ===== APP LAYOUT ===== */

#appPage {
    display: flex;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}


/* ===== SIDEBAR ===== */

.sidebar {
    width: 260px;
    background: var(--primary-dark);
    color: var(--white);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s;
}

.sidebar-logo {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-family: 'Barlow Condensed', sans-serif;
}

.sidebar-logo .logo-box {
    width: 44px;
    height: 44px;
    background: var(--accent);
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    color: var(--primary-dark);
    margin-bottom: 8px;
}

.sidebar-logo h2 {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 1px;
    line-height: 1.2;
}

.sidebar-logo span {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.nav-section {
    padding: 8px 20px 4px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.93rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.07);
    color: var(--white);
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    border-left-color: var(--accent);
}

.nav-item svg {
    flex-shrink: 0;
}

/* ── Sidebar Dropdown Styles ── */
.nav-dropdown {
    margin-bottom: 4px;
}
.nav-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.nav-dropdown-header:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.05);
}
.nav-dropdown-header svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
    opacity: 0.5;
}
.nav-dropdown.active .nav-dropdown-header {
    color: #f0a500;
    border-left-color: #f0a500;
}
.nav-dropdown.active .nav-dropdown-header svg {
    transform: rotate(180deg);
    opacity: 1;
}
.nav-dropdown-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    background: rgba(0, 0, 0, 0.15);
}
.nav-dropdown.active .nav-dropdown-content {
    max-height: 500px;
    transition: max-height 0.5s ease-in;
}
/* Adjust padding for items inside dropdowns */
.nav-dropdown-content .nav-item {
    padding-left: 44px; /* Indent to align with header text */
    border-left: 3px solid transparent;
}
.nav-dropdown-content .nav-item:hover {
    border-left-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
}
.nav-dropdown-content .nav-item.active {
    background: rgba(240, 165, 0, 0.1);
    border-left-color: #f0a500;
    color: #f0a500;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: var(--primary-dark);
    flex-shrink: 0;
}

.user-name {
    font-weight: 600;
    font-size: 0.88rem;
}

.user-role {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}


/* ===== MAIN CONTENT ===== */

.main-content {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    width: calc(100vw - 260px);
    max-width: calc(100vw - 260px);
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
}

.topbar {
    background: var(--white);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(26, 58, 110, 0.06);
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 12px;
    flex-shrink: 0;
}

.topbar h1 {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.content-area {
    padding: 24px;
    flex: 1;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    position: relative;
}


/* ===== DASHBOARD STATS ===== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 22px 24px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}

.stat-card.accent {
    border-left-color: var(--accent);
}

.stat-card.success {
    border-left-color: var(--success);
}

.stat-card.danger {
    border-left-color: var(--danger);
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    margin: 4px 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    line-height: 1.2;
}

.stat-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
}


/* ===== CARDS ===== */

.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    min-height: 0;
}

.card-header h3 {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
    flex: 1 1 auto;
    min-width: 0;
}

.card-body {
    padding: 20px;
    overflow-x: hidden;
}


/* ===== TABLES ===== */

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
}

.table-wrap table {
    min-width: 560px;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead tr {
    background: var(--light);
}

th {
    padding: 11px 14px;
    text-align: left;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: var(--light);
}


/* ===== SALES ENTRY ===== */

.product-line {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 10px;
}

.product-line .form-group {
    margin-bottom: 0;
}

.line-total {
    background: var(--light);
    border-radius: 8px;
    padding: 11px 14px;
    font-weight: 600;
    color: var(--primary);
    text-align: right;
    white-space: nowrap;
    font-size: 0.9rem;
    min-width: 90px;
}

.grand-total-box {
    background: var(--primary);
    color: var(--white);
    border-radius: 10px;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
}

.grand-total-box .label {
    font-size: 0.9rem;
    opacity: 0.8;
}

.grand-total-box .amount {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
}


/* ===== RECEIPT MODAL ===== */

#receiptModal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.receipt-wrapper {
    background: var(--white);
    border-radius: 16px;
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.receipt-actions {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

#receiptContent {
    padding: 32px;
    font-size: 0.9rem;
}

.receipt-header {
    text-align: center;
    margin-bottom: 20px;
}

.receipt-company {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 2px;
}

.receipt-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.receipt-divider {
    border: none;
    border-top: 2px dashed var(--border);
    margin: 16px 0;
}

.receipt-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    margin-bottom: 12px;
}

.receipt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.receipt-table th {
    background: var(--light);
    padding: 7px 10px;
    text-align: left;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.receipt-table td {
    padding: 7px 10px;
    border-bottom: 1px solid var(--border);
}

.receipt-total-row td {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.95rem;
    border-top: 2px solid var(--primary);
}

.receipt-footer {
    text-align: center;
    margin-top: 16px;
    font-size: 0.75rem;
    color: var(--text-muted);
}


/* ===== REPORTS ===== */

.range-grid {
    display: grid;
    grid-template-columns: auto 1fr 1fr auto;
    gap: 12px;
    align-items: end;
}

.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.report-stat {
    background: var(--light);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
}

.report-stat .val {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary);
}

.report-stat .lbl {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
}


/* ===== MODALS ===== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow-y: auto;
    box-sizing: border-box;
}

.modal {
    background: var(--white);
    border-radius: 14px;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    max-height: calc(100vh - 48px);
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin: auto;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

.modal-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    gap: 10px;
}

.modal-header h3 {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
    flex: 1;
    min-width: 0;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.3rem;
    color: var(--text-muted);
    flex-shrink: 0;
    line-height: 1;
    padding: 2px 6px;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-shrink: 0;
    flex-wrap: wrap;
    background: var(--light);
}


/* ===== TOAST NOTIFICATION ===== */

#toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--primary);
    color: var(--white);
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.9rem;
    z-index: 999;
    transform: translateY(80px);
    opacity: 0;
    transition: all 0.3s;
    box-shadow: var(--shadow);
}

#toast.show {
    transform: translateY(0);
    opacity: 1;
}

#toast.success {
    background: var(--success);
}

#toast.error {
    background: var(--danger);
}


/* ===== ACTIVITY LOG ===== */

.activity-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    margin-top: 6px;
    flex-shrink: 0;
}

.activity-text {
    font-size: 0.88rem;
}

.activity-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}


/* ===== TABS ===== */

.tabs {
    display: flex;
    gap: 4px;
    background: var(--light2);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 20px;
    width: fit-content;
}

.tab {
    padding: 8px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-muted);
    transition: all 0.15s;
}

.tab.active {
    background: var(--white);
    color: var(--primary);
    box-shadow: 0 2px 6px rgba(26, 58, 110, 0.1);
}


/* ===== SEARCH BAR ===== */

.search-bar {
    position: relative;
}

.search-bar input {
    padding-left: 36px!important;
}

.search-bar svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.filter-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}


/* ===== SIDEBAR OVERLAY (mobile) ===== */

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

.overlay-bg.show {
    display: block;
}

.menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}


/* ===== ACCESS CONTROLS — toggle switches ===== */

.control-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.control-row:last-of-type {
    border-bottom: none;
}

.control-info {
    flex: 1;
}

.control-label {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text);
    margin-bottom: 4px;
}

.control-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.4;
}


/* Toggle switch component */

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
    margin-top: 2px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #ccc;
    border-radius: 26px;
    cursor: pointer;
    transition: background 0.25s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.25s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked+.toggle-slider {
    background: var(--primary);
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(22px);
}

/* ===== RESPONSIVE: TABLET & SMALLER ===== */
@media(max-width:768px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 300;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
    }
    .menu-btn {
        display: flex !important;
        margin-right: 8px;
        flex-shrink: 0;
    }
    .form-row { grid-template-columns: 1fr; }
    .product-line { grid-template-columns: 1fr 1fr; }
    .product-line .line-total { grid-column: 1/-1; }
    .range-grid { grid-template-columns: 1fr 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .content-area { padding: 12px; }
    #receiptContent { padding: 16px; }
    .card-body { padding: 14px; }
    .card-header { padding: 12px 14px; gap: 8px; }
    .filter-bar { flex-direction: column; }
    .pnl-row { flex-direction: column; gap: 8px; }
    .pnl-op { align-self: center; font-size: 1.2rem; }
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    /* Modal: full responsive, never clips off screen */
    .modal-overlay {
        align-items: flex-start;
        padding: 12px;
        overflow-y: auto;
    }
    .modal {
        max-width: calc(100vw - 24px);
        max-height: calc(100vh - 24px);
        width: 100%;
        margin: auto;
        border-radius: 12px;
    }
    .modal-body {
        padding: 14px;
        max-height: calc(100vh - 200px);
        overflow-y: auto;
    }
    .modal-header { padding: 14px 16px; }
    .modal-footer { padding: 12px 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .topbar { padding: 10px 14px; }
    .topbar h1 { font-size: 1.2rem; }
    .payment-type-group { flex-direction: column; }
    .payment-type-option { min-width: auto; }
    .grand-total-box { flex-direction: column; align-items: flex-start; gap: 4px; }
    .pnl-box { min-width: 100px; }
}

/* ===== RESPONSIVE: MOBILE ===== */
@media(max-width:480px) {
    .main-content {
        margin-left: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
    }
    .stats-grid { grid-template-columns: 1fr; }
    .product-line { grid-template-columns: 1fr; }
    .content-area { padding: 8px; }
    .card-body { padding: 10px; }
    .card-header { padding: 10px 12px; }
    .topbar h1 { font-size: 1rem; }
    .card-header h3 { font-size: 0.95rem; }
    .payment-type-label { font-size: 0.82rem; padding: 8px 10px; }
    .pnl-row { flex-direction: column; }
    .pnl-op { align-self: center; font-size: 1.1rem; }
    .modal-overlay { padding: 8px; align-items: flex-start; }
    .modal {
        max-width: calc(100vw - 16px);
        max-height: calc(100vh - 16px);
        width: 100%;
        margin: auto;
    }
    .modal-body {
        padding: 12px;
        max-height: calc(100vh - 180px);
        overflow-y: auto;
    }
    .stat-value { font-size: 1.6rem; }
    .filter-bar { gap: 8px; }
    .btn { padding: 9px 14px; font-size: 0.85rem; }
    .form-row,
    .form-grid { grid-template-columns: 1fr; gap: 10px; }
    .range-grid { grid-template-columns: 1fr; }
    table { font-size: 0.82rem; }
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}


.bi-eye-slash-2{
    display: none;
    cursor: pointer;
    margin-left: auto;
 }

 .bi-eye-2{
    z-index: 999;
    cursor: pointer;
    margin-left: auto;
 }


/* ================================================================
   DAILY P&L SUMMARY
   ================================================================ */

.pnl-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.pnl-box {
    flex: 1;
    min-width: 130px;
    text-align: center;
    padding: 16px 12px;
    background: var(--light);
    border-radius: 10px;
}

.pnl-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.pnl-value {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.65rem;
    font-weight: 800;
}

.pnl-sales .pnl-value {
    color: var(--success);
}

.pnl-expenses .pnl-value {
    color: var(--danger);
}

.pnl-op {
    font-size: 1.8rem;
    color: var(--text-muted);
    font-weight: 300;
    flex-shrink: 0;
}


/* ================================================================
   ROLE BADGES — developer role
   ================================================================ */

.badge-developer {
    background: #1b0040;
    color: #ce93d8;
}


/* ================================================================
   DEV PANEL
   ================================================================ */

#page-devpanel .card-header {
    background: linear-gradient(135deg, #0d1b2a, #1a3a6e);
}

#page-devpanel .card-header h3 {
    color: #f0a500;
}
/* ── Customer Autocomplete ─────────────────────────────── */
.suggestion-list {
    position: absolute; background: #fff; border: 1px solid var(--border);
    border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12);
    z-index: 200; max-height: 200px; overflow-y: auto; display: none;
    min-width: 260px;
}
.suggestion-item {
    padding: 10px 14px; cursor: pointer; font-size: .88rem;
    transition: background .15s;
}
.suggestion-item:hover { background: var(--bg); }

/* align action buttons under header */
.table-wrap table th.actions-col,
.table-wrap table td.actions-cell {
    text-align: center;
    /* ensure column doesn't collapse when flex used */
    white-space: nowrap;
}
.table-wrap table td.actions-cell {
    display: flex;
    gap: 4px;
    justify-content: center;
    align-items: center;
}

.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== FACTORY RESET MODAL ===== */

#factoryResetModal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

#factoryResetModal .modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

#factoryResetModal .modal-content {
    position: relative;
    background: var(--white);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #factoryResetModal {
        padding: 10px;
    }
    
    #factoryResetModal .modal-content {
        max-width: 95vw;
        max-height: 95vh;
        border-radius: 12px;
    }
    
    .factory-reset-modal .modal-header {
        padding: 16px 20px;
    }
    
    .factory-reset-modal .modal-header h3 {
        font-size: 1.1rem;
    }
    
    .factory-reset-modal .modal-body {
        padding: 20px 16px;
        max-height: calc(95vh - 120px);
    }
    
    .factory-reset-modal .modal-footer {
        padding: 16px 20px;
    }
    
    .warning-icon {
        font-size: 2.5rem;
        margin-bottom: 16px;
    }
    
    .warning-text {
        font-size: 0.95rem;
    }
    
    .reset-data-list {
        padding: 12px;
        margin: 16px 0;
    }
    
    .confirm-input input {
        padding: 10px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    #factoryResetModal {
        padding: 5px;
    }
    
    #factoryResetModal .modal-content {
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 8px;
    }
    
    .factory-reset-modal .modal-body {
        padding: 16px 12px;
        max-height: calc(100vh - 100px);
    }
    
    .warning-text.final {
        font-size: 1rem;
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.factory-reset-modal .modal-header {
    background: linear-gradient(135deg, var(--danger), #d32f2f);
    color: white;
    flex-shrink: 0;
}

.factory-reset-modal .modal-header h3 {
    color: white;
    margin: 0;
}

.factory-reset-modal .modal-close {
    color: white;
    opacity: 0.8;
}

.factory-reset-modal .modal-close:hover {
    opacity: 1;
}

.factory-reset-modal .modal-body {
    text-align: center;
    padding: 30px 24px;
    flex: 1;
    overflow-y: auto;
    max-height: calc(90vh - 140px); /* Account for header and footer */
}

.warning-icon {
    font-size: 3rem;
    margin-bottom: 20px;
}

.warning-text {
    color: var(--text);
    line-height: 1.5;
    margin-bottom: 16px;
}

.warning-text.final {
    color: var(--danger);
    font-weight: 600;
    font-size: 1.1rem;
}

.reset-data-list {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-radius: 8px;
    padding: 16px;
    margin: 20px 0;
    text-align: left;
    list-style: none;
    padding-left: 0;
}

.reset-data-list li {
    padding: 4px 0;
    color: var(--text);
    position: relative;
    padding-left: 20px;
}

.reset-data-list li:before {
    content: "🗑";
    position: absolute;
    left: 0;
    top: 4px;
}

.confirm-input {
    margin-top: 24px;
    text-align: left;
}

.confirm-input label {
    display: block;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.confirm-input input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    text-align: center;
    font-family: monospace;
    transition: border-color 0.2s;
}

.confirm-input input:focus {
    outline: none;
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.1);
}

.factory-reset-modal .modal-footer {
    background: #f8f9fa;
    padding: 20px 24px;
    flex-shrink: 0;
}

.btn-danger {
    background: var(--danger);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-danger:hover {
    background: #d32f2f;
}

.btn-danger:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ===== BACKUP HISTORY ===== */

.backup-history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.backup-history-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
    background: var(--light);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.backup-history-item .backup-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}

.backup-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.backup-date {
    font-weight: 500;
    color: var(--text);
    font-size: 0.9rem;
}

.backup-type {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.backup-status {
    font-weight: 500;
    font-size: 0.85rem;
    padding: 4px 8px;
    border-radius: 4px;
    text-align: center;
    min-width: 80px;
}

.backup-status.success {
    background: rgba(46, 125, 50, 0.1);
    color: var(--success);
}

.backup-status.failed {
    background: rgba(229, 57, 53, 0.1);
    color: var(--danger);
}

.backup-error {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(229, 57, 53, 0.05);
    border-left: 3px solid var(--danger);
    color: var(--danger);
    font-size: 0.8rem;
    border-radius: 4px;
}

.backup-actions {
    margin-top: 8px;
}

.backup-actions .btn {
    font-size: 0.8rem;
    padding: 4px 8px;
}


/* ================================================================
   FEATURES v2 — Credit, Deliveries, Deposits, Production, Payroll
   ================================================================ */

/* Payroll grid card */
.payroll-card {
    transition: transform 0.15s, box-shadow 0.15s;
}
.payroll-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(26,58,110,0.16);
}

/* Loading spinner */
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Badge sizes */
.badge-sm {
    font-size: 0.72rem;
    padding: 2px 8px;
}

/* Logout card */
.logout-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 32px 36px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    text-align: center;
    max-width: 360px;
    width: 90%;
}
.logout-card h1 {
    font-family: 'Barlow Condensed', sans-serif;
    color: var(--primary);
    font-size: 1.5rem;
    margin-bottom: 10px;
}
.logout-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 24px;
}
.logout-card .button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
}
.logout-card .confirm-button {
    background: var(--danger);
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: var(--radius);
    font-family: 'Barlow', sans-serif;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
}
.logout-card .cancel-button {
    background: var(--light);
    color: var(--text);
    border: 2px solid var(--border);
    padding: 10px 24px;
    border-radius: var(--radius);
    font-family: 'Barlow', sans-serif;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
}
.logout-card .confirm-button:hover { background: #b71c1c; }
.logout-card .cancel-button:hover  { background: var(--border); }
/* ================================================================
   OPERATIONS PAGES STYLING
   Credit Sales, Deliveries, Deposits, Production, Payroll
   ================================================================ */

/* ── Credit Sales Progress Bars ─────────────────────────────── */
.credit-progress-bar {
    display: inline-block;
    background: var(--light);
    border-radius: 6px;
    height: 8px;
    width: 80px;
    vertical-align: middle;
    margin-right: 4px;
    overflow: hidden;
}

.credit-progress-bar-fill {
    background: linear-gradient(90deg, var(--accent), var(--primary));
    height: 100%;
    border-radius: 6px;
    transition: width 0.3s ease;
}

/* ── Delivery Status Badges ─────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    min-width: 80px;
}

.badge-pending {
    background: #fff3e0;
    color: #e65100;
}

.badge-delivered {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-failed {
    background: #ffebee;
    color: #c62828;
}

.badge-partial {
    background: #fff3e0;
    color: #e65100;
}

.badge-paid {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-held {
    background: #e3edff;
    color: var(--primary);
}

.badge-applied {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-refunded {
    background: #f3e5f5;
    color: #6a1b9a;
}

/* ── Production Summary Cards ───────────────────────────────── */
.production-summary-card {
    background: var(--light);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    border-left: 4px solid var(--primary);
}

.production-summary-card .label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
    margin-bottom: 4px;
}

.production-summary-card .value {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
}

.production-summary-card .unit {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: 4px;
}

/* ── Payroll Status Cards ───────────────────────────────────── */
#payrollGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.payroll-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.payroll-card.paid {
    border-left-color: var(--success);
    background: #f1f8f4;
}

.payroll-card.partial {
    border-left-color: var(--accent);
    background: #fffbf0;
}

.payroll-card.unpaid {
    border-left-color: var(--danger);
    background: #fff5f5;
}

.payroll-worker-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
}

.payroll-worker-role {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.payroll-amount {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.payroll-amount .label {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.payroll-amount .value {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary);
}

.payroll-status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    text-align: center;
}

.payroll-status-badge.paid {
    background: var(--success);
    color: white;
}

.payroll-status-badge.partial {
    background: var(--accent);
    color: var(--primary-dark);
}

.payroll-status-badge.unpaid {
    background: var(--danger);
    color: white;
}

.payroll-action-btn {
    width: 100%;
    padding: 8px 12px;
    margin-top: 8px;
    border: none;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--primary);
    color: white;
}

.payroll-action-btn:hover {
    background: var(--primary-dark);
}

/* ── Deliveries & Clean up styles ───────────────────────────── */
.delivery-status-row {
    padding: 12px;
    border-radius: 8px;
    background: var(--light);
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ── Tab styling for operations ─────────────────────────────── */
.tabs {
    display: flex;
    gap: 4px;
    background: var(--light2);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 20px;
    width: fit-content;
    flex-wrap: wrap;
}

.tab {
    padding: 8px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-muted);
    transition: all 0.15s;
    border: none;
    background: transparent;
}

.tabs .tab:hover {
    background: rgba(26, 58, 110, 0.05);
}

.tabs .tab.active {
    background: var(--white);
    color: var(--primary);
    box-shadow: 0 2px 6px rgba(26, 58, 110, 0.1);
}

/* ── Autocomplete list styling ──────────────────────────────── */
.autocomplete-list {
    position: absolute;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 200;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    width: 100%;
    top: 100%;
    left: 0;
}

.autocomplete-list.show {
    display: block;
}

.autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.88rem;
    transition: background 0.15s;
    border-bottom: 1px solid var(--light);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: var(--light);
}

/* ── Success message styling ────────────────────────────────── */
.success-msg {
    color: var(--success);
    font-size: 0.85rem;
    padding: 10px 12px;
    background: #e8f5e9;
    border-radius: 8px;
    margin-bottom: 12px;
}

/* ── Modal slide-up animation ──────────────────────────────── */
.modal-overlay .modal {
    animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Operations page specific card headers ──────────────────── */
#page-credit .card-header {
    background: linear-gradient(135deg, rgba(240, 165, 0, 0.1), rgba(240, 165, 0, 0.05));
    border-left: 4px solid var(--accent);
}

#page-deliveries .card-header {
    background: linear-gradient(135deg, rgba(26, 58, 110, 0.05), rgba(240, 165, 0, 0.05));
}

#page-deposits .card-header {
    background: linear-gradient(135deg, rgba(26, 58, 110, 0.1), rgba(26, 58, 110, 0.05));
}

#page-production .card-header {
    background: linear-gradient(135deg, rgba(46, 125, 50, 0.1), rgba(46, 125, 50, 0.05));
}

#page-payroll .card-header {
    background: linear-gradient(135deg, rgba(26, 58, 110, 0.1), rgba(26, 58, 110, 0.05));
}

/* ── Responsive adjustments for operations ──────────────────── */
@media (max-width: 768px) {
    #payrollGrid {
        grid-template-columns: 1fr;
    }
    
    .tabs {
        flex-wrap: wrap;
        gap: 2px;
    }
    
    .tab {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .payroll-card {
        padding: 14px;
    }
    
    .payroll-worker-name {
        font-size: 0.95rem;
    }
    
    .autocomplete-list {
        width: calc(100% + 0px);
    }
}

/* ===== PAYMENT TYPE SELECTOR ===== */
.payment-type-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.payment-type-option {
    cursor: pointer;
    flex: 1;
    min-width: 140px;
}

.payment-type-option input[type="radio"] {
    display: none;
}

.payment-type-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--white);
    transition: all 0.15s;
    cursor: pointer;
    width: 100%;
}

.payment-type-option input[type="radio"]:checked + .payment-type-label {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--light2);
}

.payment-type-option:has(input[value="full"]) input:checked + .payment-type-label {
    border-color: var(--success);
    color: var(--success);
    background: #e8f5e9;
}

.payment-type-option:has(input[value="part"]) input:checked + .payment-type-label {
    border-color: var(--accent);
    color: #b37800;
    background: #fff8e1;
}

.payment-type-option:has(input[value="credit"]) input:checked + .payment-type-label {
    border-color: var(--danger);
    color: var(--danger);
    background: #ffebee;
}

/* ===== P&L ROW LAYOUT FIX ===== */
.pnl-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.pnl-box {
    flex: 1;
    min-width: 120px;
}

.pnl-op {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ===== EXPORT/IMPORT NAV ITEMS ===== */
.nav-item.export-nav {
    color: rgba(255,255,255,0.6);
}


/* ================================================================
   UNIFIED LAYOUT & RESPONSIVE ADDITIONS
   ================================================================ */

/* --- App page container --- */
/* --- Form grid --- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

/* --- Menu button: hidden on desktop, shown on mobile --- */
.menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    flex-shrink: 0;
}

/* --- Operations page containers: never overflow sidebar --- */
#page-credit,
#page-deliveries,
#page-deposits,
#page-production,
#page-payroll,
#page-dashboard,
#page-sales,
#page-customers,
#page-expenses,
#page-reports,
#page-workers,
#page-users,
#page-activity,
#page-controls,
#page-settings,
#page-devpanel,
#page-newSale {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* --- Filter bar --- */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}

/* --- P&L row (always flex, wraps on small) --- */
.pnl-row {
    display: flex;
    align-items: stretch;
    gap: 12px;
    flex-wrap: wrap;
}

.pnl-box {
    flex: 1;
    min-width: 110px;
    background: var(--light);
    border-radius: 10px;
    padding: 14px 16px;
}

.pnl-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 4px;
}

.pnl-value {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary);
}

.pnl-op {
    display: flex;
    align-items: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
    padding: 0 2px;
}

.pnl-box.pnl-sales  { background: #edf2ff; }
.pnl-box.pnl-expenses { background: #ffebee; }

/* --- Grand total box in new sale --- */
.grand-total-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--primary);
    color: #fff;
    border-radius: 10px;
    padding: 14px 20px;
    margin-top: 16px;
    flex-wrap: wrap;
    gap: 8px;
}

.grand-total-box .label {
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0.85;
}

.grand-total-box .amount {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--accent);
}

/* --- Tabs --- */
.tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
}

.tab {
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: 8px 8px 0 0;
    border: 2px solid transparent;
    border-bottom: none;
    transition: all 0.15s;
    white-space: nowrap;
}

.tab.active {
    color: var(--primary);
    background: var(--white);
    border-color: var(--border);
    border-bottom-color: var(--white);
    margin-bottom: -2px;
}

.tab:hover:not(.active) {
    background: var(--light);
    color: var(--primary);
}

/* --- Overlay background for mobile sidebar --- */
.overlay-bg {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 250;
}
.overlay-bg.show { display: block; }

/* --- Report summary stats --- */
.report-summary {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.report-stat {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
    min-width: 120px;
    flex: 1;
}

.report-stat .val {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary);
}

.report-stat .lbl {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* --- Autocomplete dropdown --- */
.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 2px solid var(--border);
    border-top: none;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 8px 24px rgba(26,58,110,0.12);
    z-index: 100;
    display: none;
    max-height: 220px;
    overflow-y: auto;
}

.autocomplete-list.show { display: block; }

.autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.88rem;
    transition: background 0.15s;
    border-bottom: 1px solid var(--light);
}

.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--light); }

/* ================================================================
   RESPONSIVE — TABLET  (≤ 768 px)
   ================================================================ */
@media (max-width: 768px) {
    .menu-btn { display: flex !important; }

    .sidebar {
        position: fixed;
        z-index: 300;
        transform: translateX(-100%);
        transition: transform 0.28s ease;
    }
    .sidebar.open { transform: translateX(0); }

    .main-content {
        margin-left: 0 !important;
        max-width: 100vw;
    }

    .content-area { padding: 12px; }

    .topbar { padding: 10px 14px; }
    .topbar h1 { font-size: 1.2rem; }

    .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }

    .form-grid { grid-template-columns: 1fr; }

    .product-line {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .product-line .line-total { grid-column: 1 / -1; }

    .range-grid { grid-template-columns: 1fr 1fr; }

    .card-body { padding: 14px; }
    .card-header { padding: 12px 14px; }

    .filter-bar { flex-direction: column; }

    .pnl-row { gap: 8px; }
    .pnl-box { min-width: 100px; padding: 10px 12px; }
    .pnl-value { font-size: 1.3rem; }
    .pnl-op { font-size: 1.1rem; }

    .payment-type-group { flex-direction: column; }
    .payment-type-option { min-width: auto; }

    .grand-total-box { padding: 12px 14px; }
    .grand-total-box .amount { font-size: 1.4rem; }

    .tabs { gap: 2px; }
    .tab { padding: 7px 10px; font-size: 0.8rem; }

    .report-summary { gap: 10px; }
    .report-stat { padding: 12px 14px; min-width: 100px; }
    .report-stat .val { font-size: 1.3rem; }

    /* Modals: centred, limited width */
    .modal-overlay {
        align-items: center;
        padding: 16px;
    }
    .modal {
        max-width: calc(100vw - 32px);
        max-height: calc(100vh - 40px);
        border-radius: 14px;
        margin: auto;
    }
    .modal-body { padding: 14px; }
    .modal-header { padding: 12px 14px; }
    .modal-footer { padding: 10px 14px; }

    /* Table columns visible on scroll */
    .table-wrap { overflow-x: auto; }
}

/* ================================================================
   RESPONSIVE — MOBILE  (≤ 480 px)
   ================================================================ */
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; gap: 10px; }
    .stat-value { font-size: 1.5rem; }

    .content-area { padding: 8px; }
    .card-body { padding: 10px; }
    .card-header { padding: 10px 12px; }
    .card-header h3 { font-size: 0.95rem; }

    .topbar h1 { font-size: 1rem; }

    .product-line { grid-template-columns: 1fr; }

    .pnl-row { flex-direction: column; gap: 6px; }
    .pnl-op { align-self: center; writing-mode: horizontal-tb; }
    .pnl-box { min-width: auto; }

    .modal {
        max-width: calc(100vw - 16px);
        max-height: calc(100vh - 20px);
    }
    .modal-overlay { padding: 8px; }
    .modal-body { padding: 12px; }

    .payment-type-label { font-size: 0.8rem; padding: 8px 10px; }

    .tabs { gap: 2px; margin-bottom: 12px; }
    .tab { padding: 6px 8px; font-size: 0.75rem; }

    .report-stat { min-width: 80px; }
    .report-stat .val { font-size: 1.1rem; }
}
