/* File Name style.css */

/* Force the container to be the exact size of the browser window */
body, html {
  margin: 0;
  padding: 0;
  height: 100%;  /* Required for vertical centering */
  width: 100%;
  overflow-x: hidden;
}

body {
 /*   display: flex; */
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background-color: #f4f7f6;
}


/* This is the magic for perfect centering */


#login-view, #register-view, #verify-view {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;    
    width: 100vw;     
    margin: 0;
    padding: 16px;
    box-sizing: border-box;
}



/* Ensure the dashboard view starts below the navigation/header */
#app-view {
    padding: 20px;
    margin-top: 20px; /* Gives the header some breathing room */
    display: flex;
    flex-direction: column;
    gap: 20px;       /* Adds space between the white cards */
}


#users-view {
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Starts at the very top */
    align-items: center;
    padding-top: 80px; /* This gives you a clear 'Header' area at the top */
    gap: 30px;         /* This creates the gap between your white boxes */
}

/* Fix the white cards so they don't touch each other */
.card, .settings-section {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
}

.management-section {
    margin-top: 20px;
}


.management-card {
    margin-top: 200px;
    border: 1px solid #000;
    padding: 20px;
    border-radius: 8px;
    background-color: #fff;
}

.company-management-card,
.user-management-card,
.category-management-card,
.wa-management-card {
    display: grid;
    gap: 14px;
    margin-top: 0;
    border: none;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(20, 35, 50, 0.08);
    font-family: Inter, Arial, sans-serif;
    overflow: visible;
}

.company-management-header,
.user-management-header,
.category-management-header,
.wa-management-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 18px 0;
}

.company-management-header .section-title,
.user-management-header .section-title,
.category-management-header .section-title,
.wa-management-header .section-title {
    margin: 0;
    color: #17212b;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.company-form-list,
.user-list-shell,
.category-list-shell,
.wa-list-shell {
    padding: 0 18px 18px;
    background: #f7f7f7;
    border-radius: 0 0 12px 12px;
}

.company-form-card {
    display: grid;
    grid-template-columns: 1.5fr 1.5fr 140px;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-radius: 10px;
    background: #fff;
}

.company-form-card label,
.add-user-fields label,
.add-category-fields label {
    display: grid;
    gap: 4px;
    margin: 0;
}

.company-form-card label span,
.add-user-fields label span,
.add-category-fields label span {
    color: #72808f;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.company-form-card input,
.add-user-fields input,
.add-user-fields select,
.add-category-fields input,
.add-category-fields select {
    width: 100%;
    height: 38px;
    margin: 0;
    border: 1px solid #e8edf2;
    border-radius: 8px;
    background: #fff;
    color: #17212b;
    font-family: Inter, Arial, sans-serif;
    font-size: 14px;
    font-weight: 500;
    padding: 0 12px;
    box-sizing: border-box;
}

.company-form-card input:focus,
.add-user-fields input:focus,
.add-user-fields select:focus,
.add-category-fields input:focus,
.add-category-fields select:focus {
    outline: none;
    border-color: #27C2B8;
    box-shadow: 0 0 0 3px rgba(39, 194, 184, 0.1);
}

.company-edit-btn,
.add-user-btn,
.add-category-btn,
.wa-save-btn,
.wa-select-all-btn {
    border: none;
    border-radius: 8px;
    background: #27C2B8;
    color: #fff;
    cursor: pointer;
    font-weight: 700;
    height: 38px;
    padding: 0 16px;
    font-size: 13px;
    text-align: center;
}

.company-empty {
    padding: 16px 18px;
    border-radius: 10px;
    background: #fff;
    color: #72808f;
    font-weight: 500;
    font-size: 14px;
}

.company-error {
    color: #dc3545;
}

/* MODAL STYLES */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    min-height: 100dvh;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    box-sizing: border-box;
    overflow-y: auto;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.modal-card {
    position: relative;
    width: min(90vw, 420px);
    max-height: calc(100dvh - 36px);
    overflow-y: auto;
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    padding: 24px;
    display: grid;
    gap: 16px;
    font-family: Inter, Arial, sans-serif;
}

.modal-card::-webkit-scrollbar {
    width: 8px;
}

.modal-card::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 24px;
}

.modal-card::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 24px;
}

.modal-card::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-header span {
    color: #27C2B8;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.modal-header h2 {
    margin: 0;
    color: #17212b;
    font-size: 28px;
    letter-spacing: -0.04em;
}

.modal-card label {
    display: grid;
    gap: 6px;
    margin: 0;
}

.modal-card label span {
    color: #72808f;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.modal-card input {
    width: 100%;
    height: 46px;
    margin: 0;
    border: 1px solid #e8edf2;
    border-radius: 14px;
    background: #f7fafa;
    color: #17212b;
    font-family: Inter, Arial, sans-serif;
    font-size: 15px;
    font-weight: 700;
    padding: 0 14px;
    box-sizing: border-box;
}

.modal-card input:focus {
    outline: none;
    border-color: #27C2B8;
    box-shadow: 0 0 0 4px rgba(39, 194, 184, 0.12);
}

.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 8px;
}

.modal-cancel,
.modal-save {
    border: none;
    border-radius: 14px;
    cursor: pointer;
    font-weight: 800;
    min-height: 46px;
    padding: 0 16px;
    text-align: center;
}

.modal-cancel {
    background: #f7fafa;
    color: #72808f;
}

.modal-save {
    background: #27C2B8;
    color: #fff;
}

.modal-actions.single-action {
    grid-template-columns: 1fr;
}

.expense-detail-card {
    width: min(94vw, 560px);
}

.expense-detail-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px 14px;
    padding: 12px;
    border-radius: 16px;
    background: #f7fafa;
}

.expense-detail-grid strong {
    color: #72808f;
    font-size: 12px;
    text-transform: uppercase;
}

.expense-detail-grid span {
    color: #17212b;
    font-weight: 700;
}

.expense-detail-image {
    width: 100%;
    max-height: 60vh;
    object-fit: contain;
    border-radius: 16px;
    border: 1px solid #e8edf2;
    background: #f7fafa;
}

.expense-detail-empty {
    margin: 0;
    padding: 18px;
    border-radius: 16px;
    background: #fff8e6;
    color: #b7791f;
    font-weight: 700;
}

.expense-detail-edit {
    display: grid;
    gap: 12px;
    padding: 12px;
    border-radius: 16px;
    border: 1px solid #e8edf2;
}

.transaction-desc-with-thumb {
    display: flex;
    align-items: center;
    gap: 8px;
}

.transaction-receipt-thumb {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid #e8edf2;
    background: #f7fafa;
    flex: 0 0 auto;
}

.modal-card input[type="checkbox"] {
    width: auto;
    height: auto;
    margin-right: 8px;
    accent-color: #27C2B8;
}

.modal-card input[type="file"] {
    height: auto;
    min-height: 46px;
    padding: 10px 14px;
}

/* USER MANAGEMENT STYLES */
.user-list-header,
.category-list-header,
.wa-list-header {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1.5fr;
    align-items: center;
    gap: 12px;
    padding: 0 12px 6px;
    color: #72808f;
    font-family: Inter, Arial, sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.wa-list-header {
    grid-template-columns: 1.5fr 1fr 1fr;
}

.user-list,
.category-list,
.wa-list {
    display: grid;
    gap: 6px;
}

.user-list-row,
.category-list-row,
.wa-list-row {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1.5fr;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 10px;
    background: #fff;
    color: #72808f;
    font-size: 13px;
    line-height: 1.2;
    font-family: Inter, Arial, sans-serif;
}

.wa-list-row {
    grid-template-columns: 1.5fr 1fr 1fr;
}

.user-list-row strong,
.category-list-row strong,
.wa-list-row strong {
    color: #17212b;
    font-weight: 600;
    font-size: 13px;
}

.user-list-row span,
.category-list-row span,
.wa-list-row span {
    color: #72808f;
    font-weight: 500;
    font-size: 13px;
}

.user-list-row span:last-child,
.category-list-row span:last-child {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.user-edit-btn,
.user-delete-btn,
.user-disable-btn,
.user-wa-btn,
.category-edit-btn,
.category-hide-btn,
.category-delete-btn {
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    padding: 6px 10px;
    font-size: 12px;
    height: 28px;
}

.user-edit-btn,
.category-edit-btn {
    background: #e8fbf9;
    color: #159d96;
}

.user-delete-btn,
.category-delete-btn {
    background: #fff2f2;
    color: #dc3545;
}

.user-disable-btn {
    background: #f0fff4;
    color: #25D366;
    border: none;
}

.user-disable-btn.user-enable-btn {
    background: #fff2f2;
    color: #dc3545;
}

.user-disabled-row {
    opacity: 0.65;
    text-decoration: line-through;
}

.category-hide-btn {
    background: #fff8e6;
    color: #b7791f;
}

.category-hidden-row {
    opacity: 0.65;
    text-decoration: line-through;
}

.user-wa-btn {
    background: #f0fff4;
    color: #25D366;
}

.add-user-form,
.add-category-form {
    display: grid;
    gap: 12px;
    padding: 12px 18px;
    background: #f7f7f7;
    border-radius: 0 0 12px 12px;
}

.add-user-header,
.add-category-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.add-user-header span,
.add-category-header span {
    color: #72808f;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.add-user-header h3,
.add-category-header h3 {
    margin: 0;
    color: #17212b;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.add-user-fields {
    display: grid;
    grid-template-columns: 1.2fr 1.2fr 100px auto;
    gap: 10px;
    align-items: center;
}

/* CATEGORY & WHATSAPP MANAGEMENT STYLES */
.add-category-fields {
    display: grid;
    grid-template-columns: 1.5fr 1fr 120px;
    gap: 10px;
    align-items: center;
}

.category-type-expense {
    color: #dc3545;
    font-weight: 700;
    font-size: 12px;
}

.category-type-credit {
    color: #28a745;
    font-weight: 700;
    font-size: 12px;
}

.wa-list-row span {
    display: flex;
    justify-content: center;
}

.wa-list-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #27C2B8;
}

.phone-input-group {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 8px;
}

.modal-card select,
.phone-input-group select {
    width: 100%;
    height: 38px;
    margin: 0;
    border: 1px solid #e8edf2;
    border-radius: 8px;
    background: #f7fafa;
    color: #17212b;
    font-family: Inter, Arial, sans-serif;
    font-size: 14px;
    font-weight: 500;
    padding: 0 12px;
    box-sizing: border-box;
}

.section-title {
    margin-top: 0;
}


.dashboard-header {
    padding: 20px;
    background: white;
    margin-bottom: 20px;
}

.dashboard-header h1 {
    margin: 0;
    font-size: 1.8rem;
    color: #333;
}

.dashboard-header p {
    color: #777;
    margin-top: 10px;
}


.gateway-container {
  background: white;
  width: 90%;
  max-width: 400px;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  text-align: center;
  margin: auto; 
  box-sizing: border-box;
}


.register-container {
    background: #ffffff;
    width: 90%;
    max-width: 400px;
    padding: 35px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    text-align: center;
    box-sizing: border-box;

    /* ADD THESE 3 LINES TO FIX THE STRETCHING */
    height: max-content;       /* Forces the card to shrink down to only fit its internal text/inputs */
    margin: 40px auto;         /* Centers the card horizontally and keeps 40px padding away from the top/bottom screen edges */
    display: block;            /* Prevents parent flexbox rules from forcing a full-screen height stretch */
}


/* Fix the form that is jumping inside the card */
#loginForm {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 20px 0 0 0 !important; /* Overrides the 'margin: auto' in your HTML */
    width: 100%;
}

#loginForm input {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    width: 100%;
}

.btn {
    width: 100%;
    padding: 14px;
    margin-bottom: 12px;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    font-weight: 600;
    text-decoration: none;
}

.btn-primary { background: #004a99; color: white; }

.container { 
    background: white; 
    padding: 25px; 
    border-radius: 12px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.1); 
}

/* 4. STATS CARDS GRID */
.stats-grid { 
    display: flex; 
    gap: 20px; 
    margin-bottom: 30px; 
}

.card { 
    padding: 20px; 
    border-radius: 10px; 
    flex: 1; 
    color: white; 
    transition: transform 0.2s; 
}

.card:hover { transform: translateY(-5px); }
.card-blue { background: #007bff; }
.card-red { background: #dc3545; }
.card-green { background: #28a745; }

.welcome-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
    margin-bottom: 30px;
}

.welcome-stat-card {
    display: grid;
    gap: 12px;
    padding: 24px;
    border-radius: 24px;
    background: white;
    box-shadow: 0 10px 24px rgba(20, 35, 50, 0.06);
    text-align: center;
    color: #17212b;
}

.welcome-stat-icon {
    font-size: 56px;
    line-height: 1;
}

.welcome-stat-card h3 {
    margin: 0;
    color: #72808f;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.welcome-stat-card h2 {
    margin: 0;
    color: #17212b;
    font-size: 28px;
    font-weight: 900;
}

.welcome-expenses-card {
    border-top: 5px solid #dc3545;
    background: #fff8f9;
}

.welcome-till-card {
    border-top: 5px solid #28a745;
    background: #f7fff9;
}

.transaction-panel {
    display: grid;
    gap: 18px;
    border-radius: 24px;
    background: white;
    box-shadow: 0 10px 24px rgba(20, 35, 50, 0.06);
    font-family: Inter, Arial, sans-serif;
    overflow-x: auto;
}

.transaction-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.transaction-panel-header span {
    color: #27C2B8;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.transaction-panel-header h3 {
    margin: 4px 0 0;
    color: #17212b;
    font-size: 32px;
    letter-spacing: -0.04em;
}

.transaction-panel .form-group {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)) auto;
    gap: 12px;
    padding: 18px;
    border-radius: 24px;
    background: #f7fafa;
}

.transaction-panel .form-group label {
    display: grid;
    gap: 6px;
    color: #72808f;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.transaction-panel .form-group input,
.transaction-panel .form-group select {
    height: 42px;
    margin: 0;
    border: 1px solid #e8edf2;
    border-radius: 14px;
    padding: 0 12px;
    color: #17212b;
    background: white;
}

.transaction-panel .btn-save {
    align-self: end;
    height: 42px;
    border: none;
    border-radius: 14px;
    background: #27C2B8;
    color: white;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 14px 24px rgba(39, 194, 184, 0.22);
}

.transaction-panel .tab-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 0;
    border-bottom: none;
}

.transaction-panel .tab-btn {
    min-height: 42px;
    border-radius: 14px;
    background: #eef2f7;
    color: #17212b;
    font-weight: 800;
}

.transaction-panel .tab-btn.active {
    border-bottom: none;
    background: #e8fbf9;
    color: #159d96;
}

.transaction-card-shell {
    padding: 0 12px 18px;
    background: #eeeeee;
    border-radius: 0 0 24px 24px;
    box-sizing: border-box;
    width: 100%;
}

.transaction-card-header {
    display: grid;
    grid-template-columns: 1fr 1.8fr 1.3fr 1fr 1fr 0.9fr 1.6fr;
    gap: 12px;
    padding: 0 6px 6px;
    color: #72808f;
    font-family: Inter, Arial, sans-serif;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
    box-sizing: border-box;
    width: 100%;
}

.transaction-card-list {
    display: grid;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    background: #f7fafa;
    padding: 12px;
    border-radius: 16px;
}

.sync-notification-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 16px;
    margin: 8px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: slideDown 0.3s ease-out;
}

.sync-notification-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.sync-notification-badge:active {
    transform: translateY(0);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.transaction-card-row {
    display: grid;
    grid-template-columns: 1fr 1.8fr 1.3fr 1fr 1fr 0.9fr 1.6fr;
    align-items: center;
    gap: 12px;
    min-height: 42px;
    padding: 10px 18px;
    border-radius: 22px;
    background: white;
    box-shadow: 0 2px 8px rgba(20, 35, 50, 0.08);
    font-family: Inter, Arial, sans-serif;
    color: #72808f;
    font-size: 14px;
    line-height: 1.25;
    cursor: pointer;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
}

.expense-collapsible-row {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.expense-detail-card {
    position: relative;
    padding: 16px;
    border-radius: 24px;
    background: white;
    margin-top: 8px;
    margin-bottom: 12px;
    box-shadow: 0 10px 24px rgba(20, 35, 50, 0.06);
    display: grid;
    gap: 18px;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.expense-detail-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e8edf2;
}

.expense-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #e8edf2;
}

.expense-detail-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
}

.transaction-card-row strong {
    color: #17212b;
    font-weight: 700;
    letter-spacing: 0;
}

.transaction-card-row span {
    color: #72808f;
    font-weight: 500;
    letter-spacing: 0;
}

.transaction-card-row .transaction-amount-credit,
.transaction-card-row .transaction-amount-expense {
    color: #17212b;
    font-weight: 700;
}

/* 5. TABS & BUTTONS */
.tab-container { 
    margin-top: 20px; 
    border-bottom: 2px solid #ddd; 
    display: flex; 
    gap: 10px; 
}

.tab-btn { 
    padding: 10px 20px; 
    border: none; 
    background: none; 
    cursor: pointer; 
    font-weight: bold; 
    color: #666; 
}

.tab-btn.active {
    border-bottom: 3px solid #007bff;
    color: #007bff;
}

/* System Tabs Styling */
.system-tab-panel {
    display: none;
}

.system-tab-panel.active {
    display: block;
}

/* Stock Management Sub-Tabs Styling */
.stock-tab-panel {
    display: none;
}

.stock-tab-panel.active {
    display: block;
}

.tab-container .tab-btn {
    min-height: 42px;
    border-radius: 14px;
    background: #eef2f7;
    color: #17212b;
    font-weight: 800;
    border: none;
    cursor: pointer;
}

.tab-container .tab-btn.active {
    background: #e8fbf9;
    color: #159d96;
}

/* Duplicate .btn block removed (consolidated above) */

.btn-primary { background: #004a99; color: white; }
.btn-outline { background: transparent; color: #004a99; border: 2px solid #004a99; }
.btn-save { background: #28a745; color: white; border: none; padding: 12px 25px; cursor: pointer; border-radius: 5px; font-weight: bold; transition: background-color 0.2s ease; }
.btn-save:hover { background: #218838; }

/* 6. FORM & TABLE LAYOUT */
.form-group { 
    display: grid; 
    grid-template-columns: 1fr 1fr 1fr auto; 
    gap: 10px; 
    align-items: end; 
}

input, select { 
    margin-bottom: 10px; 
    padding: 10px; 
    border: 1px solid #ddd; 
    border-radius: 5px; 
    width: 100%; 
    box-sizing: border-box; 
}

table { width: 100%; margin-top: 10px; border-collapse: collapse; background: white; }
th, td { border-bottom: 1px solid #eee; padding: 12px; text-align: left; }
th { background: #fafafa; color: #666; }

/* 7. ROW STATES */
.deleted-row { background-color: #fff5f5; color: #a0aec0; text-decoration: line-through; }
.verified-row { background-color: #f8f9fa; color: #6c757d; font-style: normal; }

/* 8. LOGO & HEADER */
.logo { 
    display: flex; 
    align-items: center; 
    justify-content: center;
    gap: 10px; 
    font-size: 2rem; 
    font-weight: 800; 
    color: #000000; 
    margin-bottom: 40px; 
}

.logo img { height: 40px; width: auto; }


/* --- Admin/User Management Styles --- */

/* Specific Table Styles for Admin */
#userTable, #waPrefsTable {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background: white;
}

#adminMenu {
    border-left: none !important; /* Forces any left-side border to vanish */
    outline: none !important;     /* Removes the browser's default focus outline */
    box-shadow: none;             /* Ensures it's not a thin shadow cast by the box */
}


#userTable th, #waPrefsTable th {
    background: #f8f9fa;
    color: #333;
    font-weight: 700;
    padding: 14px;
    border-bottom: 2px solid #ddd;
    text-align: left;
}

#userTable td, #waPrefsTable td {
    padding: 12px;
    border-bottom: 1px solid #eee;
}

/* User Management Specific Components */
.add-user-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #eee;
    margin-top: 20px;
}

.back-btn {
    margin-bottom: 25px;
    display: inline-block;
    padding: 10px 20px;
    background: #333; /* Professional black theme */
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    border: none;
    cursor: pointer;
}

/* Status Badges */
.status-active { color: #28a745; font-weight: bold; }
.status-inactive { color: #dc3545; font-weight: bold; }

/* WA Preferences specific */
.wa-checkbox-group {
    display: flex;
    gap: 15px;
    align-items: center;
}


#admin-view {
    display: none; /* Controlled by app.js showView() */
    width: 100%;
    max-height: 100vh;
    overflow-y: auto; /* Allows scrolling if user list is long */
}

#admin-view .container {
    max-width: 1100px;
    margin: 40px auto; /* Centers the admin box */
    padding: 30px;
    background: white;
    border-radius: 12px;
}




/* users styles */
/*
body { font-family: 'Segoe UI', sans-serif; padding: 40px; background: #f0f2f5; }
        .container { background: white; padding: 30px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); max-width: 1000px; margin: auto; }
        table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
        th, td { padding: 12px; border-bottom: 1px solid #eee; text-align: left; }
        th { background: #333; color: white; }
        input, select { padding: 10px; border: 1px solid #ddd; border-radius: 4px; }
        .back-btn { margin-bottom: 20px; display: inline-block; padding: 10px 15px; background: #007bff; color: white; text-decoration: none; border-radius: 4px; }
        button { cursor: pointer; transition: 0.2s; }
        button:hover { opacity: 0.8; }

*/

body { 
    font-family: 'Segoe UI', sans-serif; 
    padding: 0; /* Change from 40px to 0 */
    background: #f0f2f5; 
    margin: 0;
}

#waPrefsTable {
    width: 100%;
    border-collapse: collapse;
}
/* Black header to match your Category table */
#waPrefsTable thead tr {
    background-color: #222; 
    color: white;
}

.transaction-form-actions {
    display: flex;
    gap: 10px;
    align-items: end;
}

.transaction-form-actions .btn-save,
.transaction-form-actions .btn-cancel {
    flex: 1;
    height: 42px;
    padding: 0 12px;
}

.btn-cancel {
    background: #fff2f2;
    color: #dc3545;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    font-weight: bold;
}
#waPrefsTable th {
    padding: 10px;
    text-align: left;
    font-size: 0.9em;
}
#waPrefsTable td {
    padding: 10px;
    border-bottom: 1px solid #eee;
    font-size: 0.95em;
}
/* Styled the button to look like your "Select All" */
.btn-select-all {
    background: #fff;
    border: 1px solid #ccc;
    padding: 2px 8px;
    font-size: 0.75em;
    cursor: pointer;
    color: #333;
}

.btn-admin {
    border: none;
    padding: 10px 15px;
    border-radius: 3px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
}

/* The Black Header Bar Style */
.black-header-row th {
    background-color: #212529 !important;
    color: white !important;
    padding: 18px 15px; /* Taller bar */
    font-size: 18px;    /* Larger, clearer text */
    font-weight: bold;
    border: none;
    text-transform: none; /* Keeps casing exactly as you typed it */
}

/* Optional: round the corners of the bar */
/*.table-header-bar tr:first-child th:first-child { border-top-left-radius: 8px; }
.table-header-bar tr:first-child th:last-child { border-top-right-radius: 8px; }*/

#waPrefsTable {
    border-collapse: collapse; /* Merges the separate cells into one solid structure */
    width: 100%;
}

.btn-select-all {
    background: transparent !important;
    color: white !important;
    border: 2px solid #ffffff !important; /* Thick white border */
    padding: 8px 16px; /* Bigger button area */
    border-radius: 4px;
    font-size: 14px;   /* Larger button text */
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-select-all:hover {
    background: white !important;
    color: #212529 !important;
}

/* Redundant .btn text-decoration rule removed (consolidated above) */



#epos-view {
    display: block;
    position: relative;
    z-index: 100;
    padding: 20px;
    background-color: #f4f7f6; /* Matches your core background tone */
    min-height: 100vh;
    box-sizing: border-box;
}

/* Ensure product action tiles grid aligns cleanly on smartphone viewports */
#quickProductGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.epos-vat-modern {
    --teal: #27C2B8;
    --teal-dark: #159d96;
    --teal-soft: #e8fbf9;
    --text: #17212b;
    --muted: #72808f;
    --line: #e8edf2;
    display: grid;
    gap: 18px;
    color: var(--text);
    font-family: Inter, Arial, sans-serif;
}

.epos-vat-header {
    display: grid;
    grid-template-columns: 1fr 190px;
    align-items: start;
    gap: 16px;
}

.epos-vat-header span {
    color: var(--teal);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.epos-vat-header h2 {
    margin: 4px 0 0;
    font-size: 34px;
    letter-spacing: -0.04em;
}

.epos-vat-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 16px;
}

.epos-vat-list,
.epos-vat-editor {
    border-radius: 26px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(20, 35, 50, 0.06);
}

.epos-vat-list {
    display: grid;
    align-content: start;
    gap: 10px;
    padding: 18px;
}

.epos-vat-list button {
    min-height: 48px;
    border: 1px solid transparent;
    border-radius: 16px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-weight: 800;
    text-align: left;
    padding: 0 14px;
}

.epos-vat-list button.active {
    border-color: rgba(39, 194, 184, 0.24);
    background: var(--teal-soft);
    color: var(--teal-dark);
}

.epos-vat-editor {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 18px;
}

.epos-vat-editor label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.epos-vat-editor input,
.epos-vat-editor select {
    min-width: 0;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0 12px;
    outline: none;
    background: #fbfdfd;
    color: var(--text);
}

.epos-vat-check {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0 12px;
}

.epos-vat-check input {
    width: 20px;
    height: 20px;
}

.epos-vat-save {
    min-height: 46px;
    border: none;
    border-radius: 14px;
    background: var(--teal);
    color: #fff;
    cursor: pointer;
    font-weight: 900;
}

.epos-products-modern {
    --teal: #27C2B8;
    --teal-dark: #159d96;
    --teal-soft: #e8fbf9;
    --text: #17212b;
    --muted: #72808f;
    --line: #e8edf2;
    display: grid;
    gap: 18px;
    color: var(--text);
    font-family: Inter, Arial, sans-serif;
}

.epos-products-header,
.epos-products-panel-title,
.epos-product-actions,
.epos-product-image-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.epos-products-header span {
    color: var(--teal);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.epos-products-header h2 {
    margin: 4px 0 0;
    font-size: 34px;
    letter-spacing: -0.04em;
}

.epos-products-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 16px;
}

.epos-products-list-panel,
.epos-product-editor {
    border-radius: 26px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(20, 35, 50, 0.06);
}

.epos-products-list-panel,
.epos-product-editor {
    display: grid;
    align-content: start;
    gap: 14px;
    padding: 18px;
}

.epos-products-panel-title button,
.epos-product-actions button,
.epos-product-save-action,
.epos-barcode-row button,
.epos-product-image-actions label {
    border: none;
    border-radius: 14px;
    background: var(--teal);
    color: #fff;
    cursor: pointer;
    font-weight: 900;
}

.epos-products-panel-title button {
    padding: 8px 12px;
}

#eposProductSearch,
.epos-product-form input,
.epos-product-form select,
.epos-product-image-url input,
.epos-barcode-row input {
    min-width: 0;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0 12px;
    outline: none;
    background: #fbfdfd;
    color: var(--text);
}

#eposProductSearch:focus,
.epos-product-form input:focus,
.epos-product-form select:focus,
.epos-product-image-url input:focus,
.epos-barcode-row input:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 4px rgba(39, 194, 184, 0.12);
}

.epos-products-list {
    display: grid;
    gap: 10px;
    max-height: 620px;
    overflow: auto;
}

.epos-products-list button {
    display: grid;
    gap: 5px;
    border: 1px solid transparent;
    border-radius: 18px;
    background: transparent;
    padding: 12px;
    cursor: pointer;
    text-align: left;
}

.epos-products-list button.active {
    border-color: rgba(39, 194, 184, 0.24);
    background: var(--teal-soft);
}

.epos-products-list button span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.epos-product-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}

.epos-product-actions button {
    min-height: 48px;
}

.epos-product-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
}

.epos-product-tabs button {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    color: var(--muted);
    cursor: pointer;
    font-weight: 900;
    padding: 0 16px;
}

.epos-product-tabs button.active {
    border-color: var(--teal);
    background: var(--teal-soft);
    color: var(--teal-dark);
}

.epos-product-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.epos-product-form label,
.epos-product-image-url {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.epos-product-form .wide {
    grid-column: 1 / -1;
}

.epos-product-checks {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.epos-product-checks label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0 12px;
}

.epos-product-checks input {
    width: 20px;
    height: 20px;
}

.epos-barcode-row {
    display: grid;
    grid-template-columns: 1fr 82px;
    gap: 8px;
}

.epos-product-save-action {
    min-height: 46px;
}

.epos-product-save-action.secondary {
    background: #fff2f2;
    color: #dc3545;
}

.epos-product-image-panel {
    display: grid;
    gap: 14px;
}

.epos-product-image-preview {
    display: grid;
    place-items: center;
    min-height: 280px;
    border: 1px dashed rgba(39, 194, 184, 0.5);
    border-radius: 24px;
    background: linear-gradient(135deg, #f7fafa, var(--teal-soft));
    color: var(--muted);
    font-weight: 800;
    overflow: hidden;
}

.epos-product-image-preview img {
    width: 100%;
    height: 100%;
    max-height: 360px;
    object-fit: contain;
}

.epos-product-image-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
}

.epos-product-image-actions label {
    display: grid;
    place-items: center;
    min-height: 48px;
}

.epos-product-image-actions input {
    display: none;
}

.epos-sales-modern {
    --teal: #27C2B8;
    --teal-dark: #159d96;
    --teal-soft: #e8fbf9;
    --text: #17212b;
    --muted: #72808f;
    --line: #e8edf2;
    display: grid;
    gap: 18px;
    color: var(--text);
    font-family: Inter, Arial, sans-serif;
}

.epos-pay-later-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(15, 23, 42, 0.55);
}

.epos-pay-later-card {
    display: grid;
    gap: 12px;
    width: min(460px, 100%);
    border-radius: 24px;
    background: #fff;
    padding: 22px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
}

.epos-pay-later-card h3,
.epos-pay-later-card p {
    margin: 0;
}

.epos-pay-later-card label {
    display: grid;
    gap: 6px;
    color: #72808f;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.epos-pay-later-card input {
    height: 44px;
    border: 1px solid #e8edf2;
    border-radius: 14px;
    padding: 0 12px;
}

.epos-pay-later-check {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    border: 1px solid #e8edf2;
    border-radius: 14px;
    padding: 0 12px;
}

.epos-pay-later-check input {
    width: 20px;
    height: 20px;
}

.epos-pay-later-card > div:last-child {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.epos-pay-later-card button,
.epos-paylater-card button {
    min-height: 44px;
    border: none;
    border-radius: 14px;
    background: #27C2B8;
    color: #fff;
    cursor: pointer;
    font-weight: 900;
}

.epos-pay-later-card button:first-child {
    background: #eef2f7;
    color: #17212b;
}

.epos-customer-payment-modern {
    display: grid;
    gap: 18px;
    color: #17212b;
    font-family: Inter, Arial, sans-serif;
}

.epos-customer-payment-summary,
.epos-paylater-card,
.epos-paylater-empty {
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(20, 35, 50, 0.06);
}

.epos-customer-payment-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px;
}

.epos-customer-payment-summary span {
    color: #27C2B8;
    font-size: 24px;
    font-weight: 900;
}

.epos-paylater-list {
    display: grid;
    gap: 12px;
}

.epos-paylater-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px;
}

.epos-paylater-card div {
    display: grid;
    gap: 5px;
}

.epos-paylater-card span,
.epos-paylater-card small {
    color: #72808f;
}

.epos-paylater-empty {
    padding: 18px;
    color: #72808f;
}

.epos-sales-header,
.epos-sales-toolbar,
.epos-sales-cart-head,
.epos-cart-line,
.epos-product-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: relative;
}

.epos-sales-header .epos-tile {
    position: absolute;
    right: 0;
    top: 0;
}

.epos-sales-header span,
.epos-sales-toolbar span,
.epos-sales-cart-head span {
    color: var(--teal);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.epos-sales-header h2,
.epos-sales-cart-head h3 {
    margin: 4px 0 0;
    letter-spacing: -0.04em;
}

.epos-sales-header h2 {
    font-size: 34px;
}

.epos-sales-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr) 340px;
    gap: 16px;
}

.epos-sales-categories,
.epos-sales-products-panel,
.epos-sales-cart {
    border-radius: 26px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(20, 35, 50, 0.06);
}

.epos-sales-categories {
    display: grid;
    align-content: start;
    gap: 12px;
    padding: 18px;
}

.epos-sales-categories > strong,
.epos-sales-payments > strong {
    font-size: 14px;
}

#eposSalesCategories {
    display: grid;
    gap: 10px;
}

#eposSalesCategories button {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    border: 1px solid transparent;
    border-radius: 16px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-weight: 800;
    text-align: left;
}

#eposSalesCategories button span {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 12px;
    background: #f7fafa;
    color: var(--teal);
}

#eposSalesCategories button.active {
    border-color: rgba(39, 194, 184, 0.24);
    background: var(--teal-soft);
}

.epos-sales-products-panel,
.epos-sales-cart {
    display: grid;
    align-content: start;
    gap: 14px;
    padding: 18px;
}

.epos-sales-barcode {
    display: flex;
    gap: 8px;
}

.epos-sales-barcode input,
.epos-sales-payments input,
.epos-split-fields input,
.epos-sales-totals input {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 14px;
    outline: none;
    background: #fbfdfd;
    color: var(--text);
}

.epos-sales-barcode input,
.epos-sales-payments input {
    height: 42px;
    padding: 0 12px;
}

.epos-sales-barcode input:focus,
.epos-sales-payments input:focus,
.epos-split-fields input:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 4px rgba(39, 194, 184, 0.12);
}

.epos-sales-barcode button,
.epos-sales-cart-head button,
.epos-process-payment {
    border: none;
    border-radius: 14px;
    background: var(--teal);
    color: #fff;
    cursor: pointer;
    font-weight: 900;
}

.epos-sales-barcode button {
    padding: 0 16px;
}

.epos-sales-cart-head button {
    padding: 10px 12px;
    background: #fff2f2;
    color: #dc3545;
}

.epos-sales-products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}

.epos-product-card {
    display: grid;
    gap: 12px;
    min-height: 190px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    box-shadow: 0 8px 18px rgba(20, 35, 50, 0.04);
}

.epos-product-image {
    display: grid;
    place-items: center;
    height: 96px;
    border-radius: 18px;
    background: linear-gradient(135deg, #f7fafa, var(--teal-soft));
    overflow: hidden;
}

.epos-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.epos-product-image span {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--teal);
    color: #fff;
    font-size: 30px;
    font-weight: 900;
}

.epos-product-meta span {
    font-weight: 900;
}

.epos-product-meta small,
.epos-cart-line span {
    color: var(--muted);
    font-weight: 700;
}

.epos-sales-lines {
    display: grid;
    gap: 10px;
    max-height: 320px;
    overflow: auto;
}

.epos-empty-cart {
    padding: 22px;
    border-radius: 20px;
    background: #f7fafa;
    color: var(--muted);
    text-align: center;
    font-weight: 700;
}

.epos-cart-line {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    cursor: pointer;
}

.epos-cart-line.selected {
    border-color: var(--teal);
    background: var(--teal-soft);
}

.epos-cart-line button {
    display: block;
    margin-left: auto;
    border: none;
    background: transparent;
    color: #dc3545;
    cursor: pointer;
    font-weight: 800;
}

.epos-sales-totals {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.epos-sales-totals label,
.epos-split-fields label {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.epos-sales-totals input,
.epos-split-fields input {
    height: 40px;
    padding: 0 10px;
    font-weight: 900;
}

.epos-sales-payments,
.epos-split-fields {
    display: grid;
    gap: 10px;
}

.epos-sales-payment-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.epos-sales-payment-grid button {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    color: var(--muted);
    cursor: pointer;
    font-weight: 900;
}

.epos-sales-payment-grid button.active {
    border-color: var(--teal);
    background: var(--teal-soft);
    color: var(--teal-dark);
}

.epos-split-fields {
    grid-template-columns: repeat(3, 1fr);
}

.epos-process-payment {
    min-height: 48px;
    box-shadow: 0 14px 24px rgba(39, 194, 184, 0.22);
}

.epos-sales-modebar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
}

.epos-sales-modebar button,
.epos-sales-modebar span {
    min-height: 42px;
    border: none;
    border-radius: 14px;
    background: #17212b;
    color: #fff;
    padding: 0 16px;
    font-weight: 900;
}

.epos-sales-modebar span {
    display: inline-flex;
    align-items: center;
    background: var(--teal-soft);
    color: var(--teal-dark);
}

.epos-high-volume-pos {
    width: 100%;
    min-height: calc(100dvh - 140px);
}

.epos-hv-scanner-input {
    position: fixed;
    left: -1000px;
    top: 0;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.epos-hv-layout {
    display: grid;
    grid-template-columns: minmax(0, 45fr) minmax(220px, 25fr) minmax(280px, 30fr);
    gap: 14px;
    min-height: calc(100dvh - 190px);
}

.epos-hv-feed,
.epos-hv-fast-items,
.epos-hv-command-deck {
    display: grid;
    align-content: start;
    gap: 12px;
    min-width: 0;
    border-radius: 26px;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(20, 35, 50, 0.08);
    padding: 16px;
}

.epos-hv-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    min-height: 44px;
}

.epos-hv-panel-head strong {
    font-size: 20px;
    color: #17212b;
}

.epos-hv-panel-head span {
    color: #72808f;
    font-weight: 800;
}

.epos-hv-panel-head button {
    min-height: 40px;
    border: none;
    border-radius: 12px;
    background: #fff2f2;
    color: #dc3545;
    padding: 0 12px;
    font-weight: 900;
}

.epos-hv-lines {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: calc(100dvh - 360px);
    overflow-y: auto;
    padding-right: 4px;
}

.epos-hv-lines .epos-cart-line {
    min-height: 74px;
    border-width: 2px;
    border-radius: 16px;
    background: #f8fafc;
    font-size: 16px;
}

.epos-hv-lines .epos-cart-line strong {
    font-size: 20px;
}

.epos-hv-lines .epos-cart-line.last-scanned {
    border-color: #f59e0b;
    background: #fffbeb;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18);
}

.epos-hv-lines .epos-cart-line.selected {
    border-color: #2563eb;
    background: #eff6ff;
}

.epos-hv-totals {
    grid-template-columns: 1fr;
}

.epos-hv-totals input {
    height: 52px;
    font-size: 24px;
}

.epos-hv-fast-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 10px;
}

.epos-hv-fast-grid button {
    display: grid;
    align-content: center;
    gap: 6px;
    min-height: 78px;
    border: none;
    border-radius: 16px;
    background: #e8fbf9;
    color: #17212b;
    padding: 10px;
    text-align: left;
    font-weight: 900;
}

.epos-hv-fast-grid button:nth-child(3n+1) { background: #e8fbf9; }
.epos-hv-fast-grid button:nth-child(3n+2) { background: #eff6ff; }
.epos-hv-fast-grid button:nth-child(3n+3) { background: #fff7ed; }

.epos-hv-fast-grid button span {
    color: #159d96;
    font-size: 13px;
}

.epos-hv-qty-display {
    border-radius: 16px;
    background: #17212b;
    color: #ffffff;
    padding: 14px;
    font-size: 18px;
    font-weight: 900;
    text-align: center;
}

.epos-hv-numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.epos-hv-numpad button,
.epos-hv-macro,
.epos-hv-pay {
    min-height: 58px;
    border: none;
    border-radius: 16px;
    font-size: 18px;
    font-weight: 900;
    cursor: pointer;
}

.epos-hv-numpad button {
    background: #f1f5f9;
    color: #17212b;
}

.epos-hv-macro {
    background: #f59e0b;
    color: #ffffff;
}

.epos-hv-macro.danger {
    background: #dc3545;
}

.epos-hv-reference {
    height: 46px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0 12px;
    font-size: 16px;
}

.epos-hv-pay.cash {
    min-height: 68px;
    background: #16a34a;
    color: #ffffff;
}

.epos-hv-pay.card {
    min-height: 68px;
    background: #2563eb;
    color: #ffffff;
}

@media (max-width: 900px) {
    .epos-hv-layout {
        grid-template-columns: 1fr;
    }

    .epos-hv-lines {
        max-height: 48dvh;
    }
}

/* Removed unused EPOS-specific selector (#eposCartItems) to avoid stale styles. */

/* Responsive Design for Mobile Devices */
@media (max-width: 600px) {
    .modal {
        align-items: flex-start;
        padding: 12px;
    }

    .modal-card {
        width: 100%;
        max-height: calc(100dvh - 24px);
        border-radius: 18px;
        padding: 18px;
        margin: 0;
    }

    .modal-header h2 {
        font-size: 22px;
    }

    .modal-actions {
        grid-template-columns: 1fr;
    }

    #app-view {
        padding: 14px;
        margin-top: 0;
        gap: 14px;
    }

    #app-view > div:first-child {
        display: grid !important;
        grid-template-columns: 1fr auto;
        gap: 12px;
    }

    #app-view > div:first-child button {
        min-width: 0 !important;
        height: 52px !important;
        padding: 0 12px !important;
        font-size: 14px !important;
    }

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

    .welcome-stat-card {
        padding: 20px;
        border-radius: 22px;
    }

    .container {
        padding: 18px;
        border-radius: 20px;
        overflow-x: auto;
    }

    .container h3 {
        font-size: 26px;
        margin-top: 0;
    }

    .form-group {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        align-items: end;
    }

    .form-group > div {
        min-width: 0;
    }

    .form-group label {
        display: block;
        font-size: 14px;
        font-weight: 700;
        margin-bottom: 6px;
    }

    .form-group input,
    .form-group select {
        min-width: 0;
        margin-bottom: 0;
        font-size: 16px;
    }

    .form-group .btn-save {
        grid-column: 1 / -1;
        width: 100%;
        min-height: 52px;
        border-radius: 10px;
        font-size: 17px;
    }

    .tab-container {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0;
        min-width: 0;
    }

    .tab-btn {
        padding: 12px 6px;
        white-space: normal;
        line-height: 1.25;
    }

    .transaction-card-shell {
        padding: 0 10px 14px;
    }

    .transaction-card-header {
        display: none;
    }

    .transaction-card-row {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 12px 14px;
    }

    .company-management-card,
    .user-management-card,
    .category-management-card,
    .wa-management-card {
        border-radius: 10px;
    }

    .company-management-header .section-title,
    .user-management-header .section-title,
    .category-management-header .section-title,
    .wa-management-header .section-title {
        font-size: 16px;
    }

    .company-form-card {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .user-list-shell,
    .category-list-shell,
    .wa-list-shell {
        padding: 0 10px 12px;
    }

    .user-list-header,
    .category-list-header,
    .wa-list-header {
        display: none;
    }

    .user-list-row,
    .category-list-row,
    .wa-list-row {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 10px 12px;
    }

    .user-list-row span:last-child,
    .category-list-row span:last-child {
        justify-content: flex-start;
    }

    .add-user-form,
    .add-category-form {
        padding: 10px 12px;
    }

    .add-user-header h3,
    .add-category-header h3 {
        font-size: 14px;
    }

    .add-user-fields,
    .add-category-fields {
        grid-template-columns: 1fr;
    }

    .add-user-btn {
        grid-column: 1 / -1;
    }

    .phone-input-group {
        grid-template-columns: 1fr;
    }

    #epos-topbar {
        grid-template-columns: 1fr !important;
        height: 44px !important;
    }

    #eposTopbarTitle {
        display: none !important;
    }

    #eposClock {
        font-size: 18px !important;
        line-height: 44px !important;
    }

    #epos-workspace-panel {
        padding: 26px 18px !important;
    }

    #epos-workspace-title {
        display: block !important;
        width: 100% !important;
        margin: 0 0 16px !important;
        padding-top: 0 !important;
        clear: both !important;
        line-height: 1.4 !important;
    }

    #epos-workspace-title button {
        font-size: 18px !important;
        line-height: 1.4 !important;
    }

    #epos-workspace-divider {
        margin-bottom: 28px !important;
    }

    .epos-vat-header {
        grid-template-columns: 1fr 150px;
    }

    .epos-vat-header h2 {
        font-size: 28px;
    }

    .epos-vat-layout,
    .epos-vat-editor {
        grid-template-columns: 1fr;
    }

    .epos-products-header {
        align-items: flex-start;
        display: grid;
        grid-template-columns: 1fr 150px;
    }

    .epos-products-header h2 {
        font-size: 28px;
    }

    .epos-products-layout {
        grid-template-columns: 1fr;
    }

    .epos-products-list {
        max-height: 280px;
    }

    .epos-product-actions {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .epos-product-checks,
    .epos-product-image-actions {
        grid-template-columns: 1fr;
    }

    .epos-product-image-preview {
        min-height: 220px;
    }

    .epos-sales-header {
        align-items: flex-start;
        display: grid;
        grid-template-columns: 1fr 150px;
    }

    .epos-sales-header h2 {
        font-size: 28px;
    }

    .epos-sales-layout {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .epos-sales-categories {
        order: 1;
        overflow-x: auto;
        margin-inline: -18px;
        padding: 16px 18px;
        border-radius: 0;
        box-shadow: none;
        position: sticky;
        top: 44px;
        z-index: 18;
    }

    .epos-sales-categories > strong {
        display: block;
        margin-bottom: 10px;
        font-size: 16px;
    }

    .epos-sales-products-panel {
        order: 2;
        min-height: 64vh;
        padding: 16px;
    }

    #eposSalesCategories {
        display: flex;
        gap: 10px;
        width: max-content;
        min-width: 100%;
    }

    #eposSalesCategories button {
        min-width: 210px;
        min-height: 64px;
        padding: 0 16px;
        border-radius: 20px;
        font-size: 15px;
    }

    .epos-sales-toolbar,
    .epos-sales-cart-head,
    .epos-cart-line {
        align-items: stretch;
    }

    .epos-sales-toolbar {
        flex-direction: column;
    }

    .epos-sales-barcode {
        display: grid;
        grid-template-columns: 1fr 74px;
    }

    .epos-sales-products {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        min-height: 46vh;
        max-height: none;
        overflow-y: auto;
        padding-right: 2px;
    }

    .epos-product-card {
        min-height: 170px;
        padding: 12px;
    }

    .epos-product-image {
        height: 82px;
    }

    .epos-sales-cart {
        order: 3;
        position: static;
        border-radius: 24px;
        margin-top: 8px;
    }

    .epos-sales-lines {
        max-height: 230px;
    }

    .epos-sales-totals,
    .epos-split-fields {
        grid-template-columns: 1fr;
    }

    .epos-sales-payment-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .gateway-container, .register-container {
        width: min(94vw, 520px);
        max-width: none;
        padding: 36px 24px;
        border-radius: 16px;
    }
    
    .gateway-container h2, .register-container h2 {
        font-size: clamp(30px, 8vw, 42px);
        margin: 18px 0 10px;
    }
    
    .gateway-container p, .register-container p {
        font-size: clamp(17px, 4.5vw, 22px);
        line-height: 1.35;
    }

    .gateway-container input,
    .register-container input,
    .register-container select,
    .gateway-container .btn,
    .register-container .btn {
        min-height: 54px;
        font-size: 18px;
    }
    
    .logo span {
        font-size: clamp(30px, 8vw, 42px);
    }
    
    .logo img {
        width: 72px;
        height: 72px;
    }
}

/* The active cart element uses `#cartItemsList` in the markup. */
.receipt-thumbnail-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.receipt-thumbnail-card {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    background: #f7fafa;
    border: 1px solid #e8edf2;
    flex: 0 0 80px;
}

.receipt-thumbnail-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

.receipt-thumbnail-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    line-height: 22px;
    padding: 0;
    cursor: pointer;
}

.receipt-upload-actions {
    display: none;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.receipt-choose-btn,
.receipt-upload-btn {
    border: none;
    border-radius: 12px;
    padding: 10px 14px;
    font-weight: 800;
    cursor: pointer;
}

.receipt-choose-btn {
    background: #eef7f7;
    color: #17212b;
}

.receipt-upload-btn {
    background: #27C2B8;
    color: #fff;
}

.expense-detail-edit .receipt-upload-actions {
    display: flex;
}

.receipt-upload-progress {
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    height: 24px;
}

.receipt-upload-progress::before {
    content: '';
    grid-column: 1;
    grid-row: 1;
    height: 10px;
    border-radius: 999px;
    background: #e8edf2;
}

.receipt-upload-progress-bar {
    grid-column: 1;
    grid-row: 1;
    width: 0%;
    height: 10px;
    border-radius: 999px;
    background: #27C2B8;
    transition: width 0.2s ease;
    z-index: 1;
}

.receipt-upload-progress span {
    grid-column: 2;
    color: #17212b;
    font-size: 12px;
    font-weight: 800;
}

.receipt-image-viewer {
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.receipt-image-viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
}

.receipt-image-viewer-card {
    position: relative;
    z-index: 1;
    max-width: min(920px, 96vw);
    max-height: 92vh;
}

.receipt-image-viewer-card img {
    display: block;
    max-width: 100%;
    max-height: 92vh;
    border-radius: 14px;
    object-fit: contain;
    background: #fff;
}

.receipt-image-viewer-close {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: #fff;
    color: #17212b;
    font-size: 24px;
    font-weight: 800;
    line-height: 34px;
    cursor: pointer;
}

.transaction-receipt-thumb,
.receipt-thumbnail-card img {
    cursor: zoom-in;
}

.transaction-receipt-thumbs {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-left: 8px;
    vertical-align: middle;
}

.epos-product-image-preview {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: 116px;
    padding: 16px;
    overflow-x: auto;
}

.epos-product-thumbnail-card {
    position: relative;
    flex: 0 0 auto;
    width: 80px;
    height: 80px;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 8px 18px rgba(20, 35, 50, 0.12);
}

.epos-product-thumbnail-card img {
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: cover;
    cursor: zoom-in;
}

.epos-product-thumbnail-card button {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(220, 53, 69, 0.94);
    color: #fff;
    font-size: 16px;
    font-weight: 900;
    line-height: 20px;
    cursor: pointer;
}

.epos-product-image-status {
    align-self: center;
    margin: auto;
}

.epos-categories-modern .epos-product-actions {
    background: #27C2B8;
    border-radius: 18px;
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}

.epos-categories-modern .epos-product-actions button {
    background: rgba(255, 255, 255, 0.16);
    border-radius: 14px;
    color: #fff;
    min-height: 44px;
}

.epos-categories-modern .epos-product-actions button:hover {
    background: rgba(255, 255, 255, 0.26);
}

.epos-category-form {
    display: grid;
    gap: 16px;
    padding: 18px;
    border-radius: 26px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(20, 35, 50, 0.06);
}

.epos-category-form label {
    display: grid;
    gap: 7px;
    color: #72808f;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.epos-category-form input,
.epos-category-form select,
#eposCategorySearch {
    min-width: 0;
    height: 42px;
    border: 1px solid #e8edf2;
    border-radius: 14px;
    background: #f7fafa;
    color: #17212b;
    font-size: 14px;
    font-weight: 800;
    padding: 0 12px;
    outline: none;
}

.epos-category-form input:focus,
.epos-category-form select:focus,
#eposCategorySearch:focus {
    border-color: #27C2B8;
    box-shadow: 0 0 0 4px rgba(39, 194, 184, 0.12);
}

.epos-categories-list button {
    display: grid;
    gap: 5px;
    border: 1px solid transparent;
    border-radius: 16px;
    background: #f7fafa;
    color: #17212b;
    padding: 12px 14px;
    text-align: left;
    cursor: pointer;
}

.epos-categories-list button.active {
    border-color: rgba(39, 194, 184, 0.24);
    background: #e8fbf9;
}

.epos-stock-management {
    --teal: #27C2B8;
    --text: #17212b;
    --muted: #72808f;
    width: 100%;
    box-sizing: border-box;
}

.epos-stock-summary {
    display: flex;
    gap: 12px;
    width: 100%;
    margin-bottom: 16px;
}

.epos-stock-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.epos-stock-tabs button {
    background: #e8fbf9;
    border: 1px solid rgba(39, 194, 184, 0.24);
    border-radius: 12px;
    padding: 16px;
    font-weight: 700;
    color: #17212b;
    cursor: pointer;
    transition: all 0.2s;
}

.epos-stock-tabs button:hover {
    background: #d5f7f4;
    border-color: rgba(39, 194, 184, 0.4);
}

.epos-stock-tabs button.active {
    background: linear-gradient(90deg, var(--teal), #159d96);
    color: white;
    border-color: transparent;
}

.epos-stock-tabs button,
.epos-invoice-match button,
.epos-stock-adjuster button {
    border: none;
    border-radius: 14px;
    background: var(--teal);
    color: #fff;
    font-weight: 900;
    cursor: pointer;
}

.epos-stock-tabs button {
    min-height: 46px;
    padding: 10px 12px;
}

.epos-stock-tabs button.active {
    background: #159d96;
}

.epos-stock-panel {
    border-radius: 26px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(20, 35, 50, 0.06);
    padding: 16px;
    margin-bottom: 16px;
}

.epos-stock-history {
    display: grid;
    gap: 12px;
    background: transparent;
    box-shadow: none;
    padding: 0;
    margin-bottom: 16px;
}

.epos-stock-section-title {
    color: var(--text);
    margin-bottom: 12px;
}

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

.epos-stock-table-wrap table {
    width: 100%;
    border-collapse: collapse;
    min-width: 100%;
}

.epos-stock-table-wrap th,
.epos-stock-table-wrap td {
    border-bottom: 1px solid #e8edf2;
    padding: 12px;
    text-align: left;
    color: var(--muted);
    font-size: 13px;
}

.epos-stock-table-wrap th {
    color: var(--text);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.epos-stock-table-wrap input,
.epos-stock-table-wrap select,
.epos-invoice-line input,
.epos-invoice-line select {
    height: 42px;
    border: 1px solid #e8edf2;
    border-radius: 14px;
    background: #f7fafa;
    color: var(--text);
    padding: 0 12px;
    outline: none;
    font-size: 16px;
}

.epos-stock-table-wrap input:focus,
.epos-stock-table-wrap select:focus,
.epos-invoice-line input:focus,
.epos-invoice-line select:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 4px rgba(39, 194, 184, 0.12);
}

.epos-stock-low {
    color: #dc3545 !important;
    font-weight: 900;
}

.epos-stock-adjuster {
    display: grid;
    grid-template-columns: 38px 72px 38px;
    gap: 6px;
}

.epos-stock-save-panel {
    position: sticky;
    bottom: 0;
    background: #ffffff;
    border-top: 1px solid #e8edf2;
    padding: 16px 20px;
    margin-top: 20px;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
    z-index: 10;
    display: flex;
    gap: 12px;
}

.epos-stock-save-button,
.epos-stock-cancel-button {
    flex: 1;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

.epos-stock-save-button {
    background: #27C2B8;
    color: #ffffff;
}

.epos-stock-save-button:hover {
    background: #22a8a0;
}

.epos-stock-save-button:active {
    transform: scale(0.98);
}

.epos-stock-cancel-button {
    background: #ffffff;
    color: #17212b;
    border: 1px solid #e8edf2;
}

.epos-stock-cancel-button:hover {
    background: #f8f9fa;
}

.epos-stock-cancel-button:active {
    transform: scale(0.98);
}

.epos-invoice-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
}

.epos-invoice-dropzone,
.epos-invoice-match {
    display: grid;
    gap: 12px;
    min-height: 260px;
    border: 1px dashed rgba(39, 194, 184, 0.5);
    border-radius: 24px;
    background: linear-gradient(135deg, #f7fafa, #e8fbf9);
    padding: 18px;
    color: var(--muted);
}

.epos-invoice-dropzone {
    place-items: center;
    text-align: center;
}

.epos-invoice-line {
    display: grid;
    grid-template-columns: 1fr 1fr 90px;
    gap: 10px;
}

.epos-stock-progress {
    height: 12px;
    border-radius: 999px;
    background: #e8edf2;
    overflow: hidden;
    margin-bottom: 6px;
}

.epos-stock-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--teal), #159d96);
}

@media (max-width: 768px) {
    .epos-stock-tabs,
    .epos-invoice-grid,
    .epos-invoice-line {
        grid-template-columns: 1fr;
    }

    .epos-stock-tabs {
        display: grid;
        width: 100%;
        gap: 10px;
    }

    .epos-stock-tabs button {
        width: 100%;
        min-height: 48px;
        font-size: 16px;
    }

    .epos-stock-panels {
        display: grid;
        gap: 14px;
    }

    .epos-stock-panel,
    .epos-stock-history {
        display: block !important;
        max-height: none;
        overflow: visible;
    }
}


.epos-back-button {
    height: 46px;
    padding: 0 24px;
    border: 1px solid #e8edf2;
    border-radius: 14px;
    background: white;
    color: #17212b;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.epos-back-button:hover {
    background: #f7fafa;
    border-color: #d1d8e0;
}

.share-app-button {
    height: 46px;
    padding: 0 20px;
    border: 1px solid #27C2B8;
    border-radius: 14px;
    background: #27C2B8;
    color: white;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(39, 194, 184, 0.3);
}

.share-app-button:hover {
    background: #20a89f;
    border-color: #20a89f;
    box-shadow: 0 4px 12px rgba(39, 194, 184, 0.4);
    transform: translateY(-1px);
}

.share-app-button:active {
    transform: translateY(0);
}

.epos-page-heading {
    font-size: 1.75rem;
    font-weight: 700;
    color: #111827;
    margin-top: 8px;
    margin-bottom: 20px;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

@media (max-width: 768px) {
    .epos-page-heading {
        font-size: 1.5rem;
        margin-bottom: 16px;
    }
}

.shop-grid-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    background-color: #ebf0f3;
    padding: 24px;
    border-radius: 16px;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .shop-grid-container {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 16px;
        padding: 16px;
    }
}

/* The uniform gray background panel card wrapper */
.epos-menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    background-color: #ebf0f3;
    padding: 16px;
    border-radius: 16px;
    width: 100%;
    box-sizing: border-box;
}

/* The standalone tile button cards */
.epos-menu-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 110px;
    width: 100%;
    background-color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 16px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.04);
    box-sizing: border-box;
}

/* Clean Desktop Scaling Breakpoint */
@media (min-width: 768px) {
    .epos-menu-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
        padding: 24px;
    }
    .epos-menu-tile {
        min-height: 130px;
    }
}

@media (min-width: 769px) {
    #eposStockSummary {
        display: flex !important;
        flex-direction: row !important;
        gap: 20px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        margin-bottom: 24px !important;
    }
    .epos-summary-card {
        flex: 1 !important;
        text-align: center !important;
        padding: 24px !important;
        box-sizing: border-box !important;
    }
}

@media (max-width: 768px) {
    #app-view,
    #epos-shell,
    #epos-workspace-panel,
    #epos-workspace-content,
    .stock-tab-panel,
    .epos-products-layout,
    .epos-stock-management,
    .epos-stock-panels,
    .epos-stock-panel,
    .epos-stock-history,
    .epos-stock-table-wrap,
    #eposStockSummary,
    .epos-summary-card {
        min-width: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    #app-view,
    #epos-shell,
    #epos-workspace-panel,
    #epos-workspace-content,
    .epos-products-layout,
    .epos-stock-management {
        overflow-x: hidden !important;
        padding: 10px !important;
    }

    #epos-workspace-content {
        display: block !important;
        grid-template-columns: 1fr !important;
        margin: 0 !important;
    }

    #eposStockSummary {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        margin: 0 0 14px 0 !important;
        padding: 0 !important;
    }

    .epos-summary-card {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        margin: 0 !important;
        padding: 16px !important;
        text-align: center !important;
    }

    .epos-stock-summary article,
    .epos-stock-summary span,
    .epos-stock-summary strong {
        color: #17212b !important;
        text-align: center !important;
    }

    .epos-stock-summary article span:first-child {
        color: #72808f !important;
        font-size: 11px !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
        font-weight: 700 !important;
    }

    .epos-stock-summary article strong {
        font-size: 22px !important;
        font-weight: 800 !important;
    }

    #eposStockPanelCurrent .epos-stock-table-wrap {
        overflow-x: hidden !important;
    }

    #eposStockPanelCurrent .epos-stock-table-wrap table,
    #eposStockPanelCurrent .epos-stock-table-wrap tbody,
    #eposStockPanelCurrent .epos-stock-table-wrap tr,
    #eposStockPanelCurrent .epos-stock-table-wrap td {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    #eposStockPanelCurrent .epos-stock-table-wrap table {
        border-collapse: separate !important;
        border-spacing: 0 !important;
    }

    #eposStockPanelCurrent .epos-stock-table-wrap thead {
        display: none !important;
    }

    #eposStockPanelCurrent .epos-stock-table-wrap tbody tr {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        background: #ffffff !important;
        border: 1px solid #e8edf2 !important;
        border-radius: 18px !important;
        padding: 14px !important;
        margin-bottom: 15px !important;
        box-shadow: 0 6px 18px rgba(20, 35, 50, 0.08) !important;
    }

    #eposStockPanelCurrent .epos-stock-table-wrap tbody td {
        border-bottom: none !important;
        color: #17212b !important;
        padding: 0 !important;
        margin-bottom: 10px !important;
        font-size: 16px !important;
    }

    #eposStockPanelCurrent .epos-stock-table-wrap tbody td:nth-child(1) {
        font-size: 17px !important;
        font-weight: 900 !important;
        margin-bottom: 8px !important;
    }

    #eposStockPanelCurrent .epos-stock-table-wrap tbody td:nth-child(2),
    #eposStockPanelCurrent .epos-stock-table-wrap tbody td:nth-child(3) {
        display: inline-flex !important;
        width: auto !important;
        max-width: calc(50% - 4px) !important;
        align-items: center !important;
        gap: 6px !important;
        margin-right: 8px !important;
        margin-bottom: 12px !important;
        padding: 6px 10px !important;
        border-radius: 999px !important;
        background: #f7fafa !important;
        font-weight: 800 !important;
    }

    #eposStockPanelCurrent .epos-stock-table-wrap tbody td:nth-child(2)::before { content: "Stock"; }
    #eposStockPanelCurrent .epos-stock-table-wrap tbody td:nth-child(3)::before { content: "Unit"; }
    #eposStockPanelCurrent .epos-stock-table-wrap tbody td:nth-child(4)::before { content: "Low-Stock Alert Level"; }
    #eposStockPanelCurrent .epos-stock-table-wrap tbody td:nth-child(5)::before { content: "Manual Adjuster"; }
    #eposStockPanelCurrent .epos-stock-table-wrap tbody td:nth-child(6)::before { content: "Reason for Adjustment"; }

    #eposStockPanelCurrent .epos-stock-table-wrap tbody td:nth-child(n+4)::before {
        display: block !important;
        margin-bottom: 6px !important;
        color: #72808f !important;
        font-size: 11px !important;
        font-weight: 900 !important;
        letter-spacing: 0.05em !important;
        text-transform: uppercase !important;
    }

    #eposStockPanelCurrent .epos-stock-table-wrap tbody td:nth-child(2)::before,
    #eposStockPanelCurrent .epos-stock-table-wrap tbody td:nth-child(3)::before {
        color: #72808f !important;
        font-size: 11px !important;
        font-weight: 900 !important;
        text-transform: uppercase !important;
    }

    #eposStockPanelCurrent .epos-stock-table-wrap input,
    #eposStockPanelCurrent .epos-stock-table-wrap select,
    #eposStockPanelCurrent .epos-stock-adjuster {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        margin-bottom: 10px !important;
        font-size: 16px !important;
    }

    #eposStockPanelCurrent .epos-stock-adjuster {
        display: grid !important;
        grid-template-columns: 44px minmax(0, 1fr) 44px !important;
        gap: 8px !important;
        align-items: center !important;
    }

    #eposStockPanelCurrent .epos-stock-adjuster button,
    #eposStockPanelCurrent .epos-stock-adjuster input,
    #eposStockPanelCurrent .alert-level-input,
    #eposStockPanelCurrent select {
        min-height: 44px !important;
        height: 44px !important;
        font-size: 16px !important;
    }

    #eposStockPanelCurrent .alert-level-input {
        width: 100% !important;
        text-align: left !important;
    }
}

.invoice-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.invoice-status-unmatched {
    background: #fff7ed;
    color: #9a3412;
    border: 1px solid #fed7aa;
}

.invoice-status-matched {
    background: #16a34a;
    color: #ffffff;
    border: 1px solid #15803d;
}

.invoice-ticket-link,
.invoice-match-link {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: none;
    border-radius: 12px;
    background: #e8fbf9;
    color: #159d96;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
    box-sizing: border-box;
}

.invoice-match-link {
    background: #17212b;
    color: #ffffff;
}

.auth-password-field {
    position: relative;
    width: 100%;
    margin-bottom: 15px;
    box-sizing: border-box;
}

.auth-password-field input {
    width: 100%;
    padding-right: 46px;
    box-sizing: border-box;
}

.auth-password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 10px;
    background: #f4f7f6;
    color: #17212b;
    cursor: pointer;
}

.auth-preference-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 12px;
    margin: 12px 0;
    box-sizing: border-box;
}

.auth-remember-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: #004a99;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.auth-remember-row input {
    width: auto;
    margin: 0;
    accent-color: #004a99;
}

.auth-forgot-link {
    color: #004a99;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.auth-forgot-link:hover {
    text-decoration: underline;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin: 18px 0 12px;
    color: #72808f;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e8edf2;
}

.auth-social-block {
    display: grid;
    gap: 8px;
    width: 100%;
    margin-bottom: 14px;
}

.auth-social-btn {
    width: 100%;
    min-height: 42px;
    border: 1px solid #e8edf2;
    border-radius: 12px;
    background: #ffffff;
    color: #17212b;
    font-weight: 800;
    cursor: pointer;
}

@media (max-width: 480px) {
    .gateway-container {
        width: 100%;
        box-sizing: border-box;
    }

    .transaction-card-shell {
        padding: 0 8px 18px;
    }

    .transaction-card-header {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 0 4px 6px;
    }

    .transaction-card-header > span {
        display: block;
    }

    .transaction-card-row {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 12px 8px;
    }

    .transaction-card-row > span,
    .transaction-card-row > strong {
        display: block;
    }

    .expense-detail-card {
        padding: 12px;
        gap: 12px;
    }

    .expense-detail-summary {
        grid-template-columns: 1fr;
    }

    .expense-detail-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .expense-detail-row > div {
        width: 100%;
        box-sizing: border-box;
    }
}

#login-view,
#register-view,
#verify-view {
    max-height: 100vh;
    box-sizing: border-box;
    overflow-y: auto;
}

#login-view .gateway-container,
#register-view .gateway-container,
#verify-view .gateway-container {
    max-height: 90vh;
    overflow-y: auto;
    box-sizing: border-box;
}

#loginForm {
    gap: 10px;
    margin-top: 14px !important;
}

#loginForm input,
#register-view .gateway-container input,
#register-view .gateway-container select,
#verify-view .gateway-container input {
    margin-bottom: 10px;
}

.auth-password-field {
    margin-bottom: 10px;
}

.auth-divider {
    margin: 12px 0 8px;
}

.auth-social-block {
    gap: 6px;
    margin-bottom: 10px;
}

@media (max-width: 480px) {
    #login-view,
    #register-view,
    #verify-view {
        align-items: flex-start;
        padding: 10px;
    }

    #login-view .gateway-container,
    #register-view .gateway-container,
    #verify-view .gateway-container {
        width: 100%;
        max-width: 100%;
        padding: 18px 16px;
        border-radius: 14px;
    }

    .logo {
        margin-bottom: 16px;
        gap: 8px;
    }

    .logo span {
        font-size: clamp(22px, 7vw, 30px);
    }

    .logo img {
        width: 42px;
        height: 42px;
    }

    .gateway-container h2 {
        font-size: clamp(22px, 6vw, 28px);
        margin: 8px 0 6px;
    }

    .gateway-container p {
        font-size: 14px;
        line-height: 1.3;
        margin: 0 0 12px;
    }

    #loginForm input,
    #register-view .gateway-container input,
    #register-view .gateway-container select,
    #verify-view .gateway-container input,
    .gateway-container .btn,
    .auth-social-btn {
        min-height: 40px;
        font-size: 14px;
    }

    .btn {
        padding: 10px 12px;
        margin-bottom: 8px;
    }
}

/* Global Viewport Safety Anchors */
.view, .view-panel, .workspace-content {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    padding: 0 12px;
}

/* Flexbox Containment Fix for Dynamic Text Nodes */
.flex-mobile-stack {
    display: flex;
    flex-direction: column;
    min-width: 0 !important;
    width: 100%;
}

.text-wrap-safe {
    min-width: 0 !important;
    word-break: break-all !important;
    overflow-wrap: break-word !important;
    white-space: normal !important;
}

.app-version-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border: 1px solid #e8edf2;
    border-radius: 999px;
    background: #f7fafa;
    color: #72808f;
    padding: 0 9px;
    margin-left: 8px;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
}

.app-version-badge[data-version-status="update"] {
    border-color: #f59e0b;
    background: #fffbeb;
    color: #92400e;
}

.app-version-badge[data-version-status="critical"] {
    border-color: #dc3545;
    background: #fff2f2;
    color: #dc3545;
}

#criticalVersionUpdateOverlay {
    position: fixed;
    inset: 0;
    z-index: 1000000;
    display: none;
    place-items: center;
    background: rgba(15, 23, 42, 0.76);
    padding: 18px;
}

#criticalVersionUpdateOverlay > div {
    width: 100%;
    max-width: 420px;
    border-radius: 24px;
    background: #ffffff;
    color: #17212b;
    padding: 28px 22px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
    font-size: 18px;
    font-weight: 900;
    text-align: center;
}

