* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: #f6f7f9;
    color: #232333;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ----- Enhanced Professional Navbar ----- */
.navbar {
    background: #ffffff;
    padding: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    min-height: 70px;
    max-width: 1400px;
    margin: 0 auto;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #374151;
}

.nav-logo svg {
    width: 40px;
    height: 40px;
}

.nav-brand-text {
    display: flex;
    flex-direction: column;
}

.business-name {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
}

.tagline {
    font-size: 11px;
    opacity: 0.8;
    font-weight: 400;
}

.nav-menu {
    display: flex;
    gap: 32px;
    align-items: center;
    flex: 1;
    justify-content: center;
}

.nav-group {
    position: relative;
}

.nav-group-title {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    color: #6b7280;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    text-align: center;
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    color: #6b7280;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link:hover {
    background: #f3f4f6;
    color: #374151;
    transform: translateY(-1px);
}

.nav-link.active {
    background: #e5e7eb;
    color: #3b82f6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.nav-icon {
    font-size: 14px;
}

.nav-text {
    white-space: nowrap;
}

/* User Menu */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-menu {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    color: #374151;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.user-menu-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.user-icon {
    font-size: 16px;
}

.dropdown-arrow {
    font-size: 10px;
    transition: transform 0.3s ease;
}

.user-menu.active .dropdown-arrow {
    transform: rotate(180deg);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    min-width: 160px;
    display: none;
    z-index: 1000;
    margin-top: 8px;
}

.user-dropdown.show {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    color: #374151;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background: #f3f4f6;
    color: #111827;
}

.dropdown-item.active {
    background: #e5e7eb;
    color: #6366f1;
}

.dropdown-item.logout:hover {
    background: #fee2e2;
    color: #dc2626;
}

.dropdown-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 4px 0;
}

.dropdown-icon {
    font-size: 14px;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.mobile-menu-btn:hover {
    background: #f3f4f6;
}

.hamburger {
    width: 20px;
    height: 2px;
    background: #374151;
    transition: all 0.3s ease;
    transform-origin: center center;
    border-radius: 1px;
    position: relative;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .nav-menu {
        gap: 20px;
    }
    
    .nav-group-title {
        display: none;
    }
    
    .nav-list {
        gap: 2px;
    }
    
    .nav-link {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .nav-icon {
        font-size: 12px;
    }
    
    .business-name {
        font-size: 16px;
    }
}

@media (max-width: 768px) {
    .nav-container {
        padding: 0 16px;
        min-height: 64px;
    }
    
    .navbar {
        min-height: 64px;
    }
    
    .nav-brand {
        flex-shrink: 0;
    }
    
    .business-name {
        font-size: 16px;
    }
    
    .nav-logo svg {
        width: 36px;
        height: 36px;
    }
    
    .mobile-menu-btn {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 44px;
        height: 44px;
        padding: 0;
        border: none;
        background: none;
        cursor: pointer;
        border-radius: 6px;
        transition: background-color 0.2s ease;
    }
    
    .mobile-menu-btn:hover {
        background-color: #f3f4f6;
    }
    
    .hamburger {
        width: 22px;
        height: 2px;
        background-color: #374151;
        margin: 3px 0;
        transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
        border-radius: 1px;
        display: block;
        transform-origin: center;
    }
    
    .mobile-menu-btn.active .hamburger:nth-child(1) {
        transform: rotate(45deg) translate(6px, 6px);
    }

    .mobile-menu-btn.active .hamburger:nth-child(2) {
        opacity: 0;
        transform: translateX(-20px);
    }

    .mobile-menu-btn.active .hamburger:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: #ffffff;
        flex-direction: column;
        padding: 16px;
        gap: 16px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
        border-top: 1px solid #e5e7eb;
        max-height: calc(100vh - 64px);
        overflow-y: auto;
        overflow-x: hidden;
        z-index: 1000;
        -webkit-overflow-scrolling: touch;
    }
    
    .nav-menu.mobile-active {
        display: flex;
        animation: slideDown 0.3s ease-out;
    }
    
    .nav-group {
        width: 100%;
        margin-bottom: 8px;
    }
    
    .nav-group:last-child {
        margin-bottom: 0;
    }
    
    .nav-group-title {
        display: block;
        text-align: left;
        margin-bottom: 10px;
        padding-bottom: 6px;
        border-bottom: 1px solid #e5e7eb;
        font-size: 13px;
        font-weight: 600;
        color: #6b7280;
    }
    
    .nav-list {
        flex-direction: column;
        gap: 4px;
    }
    
    .nav-link {
        padding: 12px 16px;
        width: 100%;
        justify-content: flex-start;
        border-radius: 8px;
    }
    
    .nav-container {
        padding: 0 16px;
        min-height: 60px;
        position: relative;
    }
    
    .business-name {
        font-size: 14px;
    }
    
    .tagline {
        font-size: 10px;
    }
    
    .mobile-menu-btn.active .hamburger:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .mobile-menu-btn.active .hamburger:nth-child(2) {
        opacity: 0;
        transform: translateX(-15px);
    }

    .mobile-menu-btn.active .hamburger:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }    /* Ensure proper scrolling on mobile */
    body.mobile-menu-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
    
    .nav-menu.mobile-active {
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
    
    /* Better touch targets for mobile */
    .nav-link {
        min-height: 48px; /* Accessibility guideline for touch targets */
        display: flex;
        align-items: center;
    }
}

/* ----- Main Content Area ----- */
main {
    padding: 32px 40px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
    overflow-y: auto;
}

.content-header {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 24px;
    color: #232333;
    display: flex;
    align-items: center;
    gap: 12px;
}

.content-header-icon {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #0e71eb;
    color: white;
    border-radius: 8px;
    font-size: 18px;
}

/* ----- Card Styles ----- */
.card-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    padding: 24px;
    border: 1px solid #e1e1e6;
    transition: all 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.card h3 {
    margin-top: 0;
    margin-bottom: 16px;
    color: #232333;
    font-size: 18px;
    font-weight: 600;
}

/* ----- Button Styles ----- */
.btn-primary {
    background: #0e71eb;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    background: #0b5ed7;
    box-shadow: 0 4px 8px rgba(14, 113, 235, 0.3);
}

.btn-secondary {
    background: #ffffff;
    color: #0e71eb;
    border: 1px solid #e1e1e6;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: #f6f7f9;
    border-color: #0e71eb;
}

/* ----- Form Styles ----- */
.form-container {
    background: #ffffff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid #e1e1e6;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #232333;
    font-size: 14px;
}

.form-input, .form-select {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #e1e1e6;
    border-radius: 8px;
    box-sizing: border-box;
    font-family: inherit;
    transition: all 0.2s ease;
    background-color: #ffffff;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: #0e71eb;
    box-shadow: 0 0 0 3px rgba(14, 113, 235, 0.1);
}

.form-button {
    background-color: #0e71eb;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.form-button:hover {
    background-color: #0b5ed7;
    box-shadow: 0 4px 8px rgba(14, 113, 235, 0.3);
}

/* ----- Table Styles ----- */
.table-container {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid #e1e1e6;
    overflow-x: auto;
    margin-bottom: 20px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e1e1e6;
}

.data-table th {
    background-color: #f6f7f9;
    font-weight: 600;
    color: #232333;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr:hover {
    background-color: #f6f7f9;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Status indicators */
.status-paid {
    color: #10b981;
    font-weight: 600;
}

.status-partial {
    color: #f59e0b;
    font-weight: 600;
}

.status-pending {
    color: #ef4444;
    font-weight: 600;
}

/* Summary boxes */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.summary-box {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid #e1e1e6;
    text-align: center;
    transition: all 0.2s ease;
}

.summary-box:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.summary-box h3 {
    margin: 0 0 12px 0;
    color: #747487;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-box .amount {
    font-size: 32px;
    font-weight: 700;
    color: #232333;
    margin-bottom: 8px;
}

.summary-box small {
    color: #747487;
    font-size: 12px;
}

.debit {
    color: #ef4444 !important;
}

.credit {
    color: #10b981 !important;
}

/* Invoice Style Form */
.invoice-container {
    background: #ffffff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid #e1e1e6;
    max-width: 1200px;
    margin: 0 auto;
}

.invoice-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e1e1e6;
}

.invoice-section {
    margin-bottom: 24px;
}

.invoice-section h3 {
    color: #232333;
    margin-bottom: 16px;
    font-size: 16px;
    font-weight: 600;
    padding-bottom: 8px;
    border-bottom: 2px solid #e1e1e6;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.form-row.full-width {
    grid-template-columns: 1fr;
}

/* Settings grid for 2x2 layout */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.settings-grid .form-container {
    background: #ffffff;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    word-wrap: break-word;
}

.table-wrapper {
    max-height: 300px;
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

.table-wrapper::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.table-wrapper .data-table {
    margin: 0;
    border: none;
    min-width: 100%;
    width: 100%;
}

.table-wrapper .data-table th,
.table-wrapper .data-table td {
    padding: 8px 12px;
    font-size: 14px;
    text-align: left;
}

.table-wrapper .data-table th:last-child,
.table-wrapper .data-table td:last-child {
    text-align: center;
    width: 80px;
    min-width: 80px;
}

/* Tablet breakpoint */
@media (max-width: 1024px) {
    .settings-grid {
        gap: 1.5rem;
    }
    
    .settings-grid .form-container {
        padding: 1.25rem;
    }
}

/* Small tablet breakpoint */
@media (max-width: 900px) {
    .settings-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

.items-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    border: 1px solid #e1e1e6;
    border-radius: 8px;
    overflow: hidden;
}

.items-table th,
.items-table td {
    padding: 12px;
    border: 1px solid #e1e1e6;
    text-align: left;
}

.items-table th {
    background-color: #f6f7f9;
    font-weight: 600;
    color: #232333;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.items-table input,
.items-table select {
    width: 100%;
    border: 1px solid #e1e1e6;
    padding: 8px;
    font-size: 14px;
    background: white;
    border-radius: 6px;
    font-family: inherit;
}

.items-table input:focus,
.items-table select:focus {
    outline: none;
    border-color: #0e71eb;
    box-shadow: 0 0 0 3px rgba(14, 113, 235, 0.1);
}

.btn-add-item {
    background-color: #10b981;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    transition: all 0.2s ease;
}

.btn-add-item:hover {
    background-color: #059669;
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.btn-remove, .btn-remove-sale {
    background-color: #ef4444;
    color: white;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-remove:hover, .btn-remove-sale:hover {
    background-color: #dc2626;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

.totals-section {
    border-top: 2px solid #e1e1e6;
    padding-top: 24px;
    margin-top: 24px;
}

.totals-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: start;
}

.totals-right {
    min-width: 350px;
    background: #f6f7f9;
    padding: 20px;
    border-radius: 8px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #e1e1e6;
    font-size: 14px;
}

.total-row.grand-total {
    border-bottom: 2px solid #0e71eb;
    border-top: 2px solid #e1e1e6;
    font-weight: 700;
    font-size: 18px;
    color: #0e71eb;
    margin-top: 8px;
    padding-top: 12px;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.btn-cancel, .btn-cancel-sale {
    background-color: #ffffff;
    color: #747487;
    border: 1px solid #e1e1e6;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-cancel:hover, .btn-cancel-sale:hover {
    background-color: #f6f7f9;
    border-color: #747487;
}

.btn-save {
    background-color: #0e71eb;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-save:hover {
    background-color: #0b5ed7;
    box-shadow: 0 4px 8px rgba(14, 113, 235, 0.3);
}

/* Vendor Ledger Specific Styles */
.vendor-header-gradient {
    background: linear-gradient(135deg, #0e71eb 0%, #0b5ed7 100%);
    color: white;
    padding: 24px;
    margin: -24px -24px 24px -24px;
    border-radius: 12px 12px 0 0;
}

.progress-bar-container {
    width: 120px;
    height: 8px;
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
    margin: 8px auto 0;
    overflow: hidden;
}

.ledger-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
    padding: 20px;
    background: #f6f7f9;
    border-radius: 8px;
}

.transaction-table-header {
    background: linear-gradient(135deg, #0e71eb 0%, #0b5ed7 100%);
    color: white !important;
}

.transaction-table-header th {
    color: white !important;
}

.balance-summary-row {
    background: linear-gradient(135deg, #f6f7f9 0%, #e1e1e6 100%);
    font-weight: 700;
    border-top: 3px solid #0e71eb !important;
}

.balance-summary-row td {
    font-weight: 700;
}

/* Additional utility classes */
.text-right {
    text-align: right;
}

.small-input {
    width: 100px;
    text-align: right;
    padding: 8px;
    border: 1px solid #e1e1e6;
    border-radius: 6px;
}

.medium-input {
    width: 120px;
    text-align: right;
    padding: 8px;
    border: 1px solid #e1e1e6;
    border-radius: 6px;
}

.resize-vertical {
    resize: vertical;
}

.balance-due-text {
    color: #ef4444;
    font-weight: 600;
}

/* Alert boxes */
.alert-info {
    background: #e0f2fe;
    border-left: 4px solid #0e71eb;
    padding: 16px;
    border-radius: 8px;
    margin-top: 20px;
    color: #0c4a6e;
}

.alert-warning {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 16px;
    border-radius: 8px;
    margin-top: 20px;
    color: #92400e;
}

.alert-success {
    background: #d1fae5;
    border-left: 4px solid #10b981;
    padding: 16px;
    border-radius: 8px;
    margin-top: 20px;
    color: #065f46;
}

.alert-danger {
    background: #fee2e2;
    border-left: 4px solid #ef4444;
    padding: 16px;
    border-radius: 8px;
    margin-top: 20px;
    color: #991b1b;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .nav-container {
        padding: 0 12px;
        min-height: 60px;
        position: relative;
    }
    
    .navbar {
        padding: 0;
        min-height: 60px;
        flex-wrap: nowrap;
    }
    
    .nav-brand {
        font-size: 18px;
        padding: 0;
        flex-shrink: 0;
    }
    
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #ffffff;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        border-top: 1px solid #e5e7eb;
        flex-direction: column;
        padding: 0;
        margin: 0;
        z-index: 1000;
    }
    
    .nav-links.active {
        display: flex;
    }
    
    .nav-links li {
        border-bottom: 1px solid #f3f4f6;
        margin: 0;
    }
    
    .nav-links li:last-child {
        border-bottom: none;
    }
    
    .nav-links a {
        padding: 16px 20px;
        display: block;
        color: #374151;
        font-size: 16px;
        border-radius: 0;
        transition: background-color 0.2s ease;
    }
    
    .nav-links a:hover,
    .nav-links a.active {
        background-color: #f9fafb;
        color: #1f2937;
    }
    
    main {
        padding: 20px 16px;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
    }
    
    .invoice-header,
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0;
    }
    
    .settings-grid .form-container {
        padding: 1rem;
        margin-bottom: 0;
        width: 100%;
        box-sizing: border-box;
        min-width: 0;
        overflow: hidden;
    }
    
    .form-input, .form-button {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .table-wrapper {
        max-height: 250px;
        overflow-x: auto;
    }
    
    .data-table {
        font-size: 12px;
    }
    
    .data-table th,
    .data-table td {
        padding: 6px 8px;
        white-space: nowrap;
    }
    
    .edit-vendor-btn {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    .totals-grid {
        grid-template-columns: 1fr;
    }
    
    .totals-right {
        min-width: 100%;
    }
}

/* Extra small mobile breakpoint */
@media (max-width: 480px) {
    .settings-grid {
        gap: 0.75rem;
        padding: 0;
    }
    
    .settings-grid .form-container {
        padding: 0.75rem;
        border-radius: 6px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }
    
    .form-container h3 {
        font-size: 18px;
        margin-bottom: 1rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-label {
        font-size: 14px;
        margin-bottom: 0.5rem;
    }
    
    .table-wrapper {
        max-height: 200px;
    }
    
    /* Hide address column on very small screens for settings page only */
    .settings-grid .data-table th:nth-child(3),
    .settings-grid .data-table td:nth-child(3) {
        display: none; /* Hide address column on very small screens */
    }
    
    main {
        padding: 15px 12px;
    }
    
    .form-container {
        margin: 0 !important;
    }
}

/* Intermediate breakpoint for landscape phones/small tablets */
@media (max-width: 640px) {
    .settings-grid {
        gap: 1rem;
    }
    
    .settings-grid .form-container {
        padding: 0.875rem;
        border-radius: 6px;
    }
    
    .form-container h3 {
        font-size: 16px;
        margin-bottom: 0.875rem;
    }
    
    .table-wrapper {
        max-height: 220px;
    }
    
    main {
        padding: 18px 14px;
    }
}

/* Medium mobile for invoice pages */
@media (max-width: 640px) {
    .invoice-container {
        padding: 8px;
        margin: 0;
        border-radius: 8px;
    }
    
    .invoice-section {
        padding: 12px;
        margin-bottom: 16px;
        border-radius: 6px;
    }
    
    .invoice-section h3 {
        font-size: 16px;
        margin-bottom: 12px;
    }
    
    .form-input,
    .form-select {
        padding: 12px;
        font-size: 16px;
        min-height: 48px;
        border-radius: 6px;
    }
    
    /* Items table container with horizontal scroll */
    .items-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 16px -12px;
        padding: 0 12px;
        border-radius: 8px;
    }
    
    .items-table {
        min-width: 700px;
        font-size: 13px;
        border-collapse: separate;
        border-spacing: 0;
    }
    
    .items-table th,
    .items-table td {
        padding: 8px 6px;
        vertical-align: middle;
        white-space: nowrap;
    }
    
    .items-table th:first-child,
    .items-table td:first-child {
        width: 50px;
        text-align: center;
        position: sticky;
        left: 0;
        background: #f6f7f9;
        z-index: 2;
    }
    
    .items-table input {
        width: 75px;
        font-size: 13px;
        padding: 6px 4px;
        border-radius: 4px;
    }
    
    .items-table select {
        width: 110px;
        font-size: 13px;
        padding: 6px 4px;
        border-radius: 4px;
    }
    
    .content-header {
        font-size: 18px;
        margin-bottom: 16px;
    }
    
    /* Header button adjustments */
    .header-with-buttons {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .header-buttons {
        width: 100%;
        justify-content: space-between;
    }
    
    .header-buttons button {
        flex: 1;
        margin: 0 4px;
        padding: 8px 12px;
        font-size: 12px;
        white-space: nowrap;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .nav-container {
        padding: 0 12px;
        min-height: 56px;
    }
    
    .navbar {
        min-height: 56px;
    }
    
    .business-name {
        font-size: 14px;
    }
    
    .nav-logo svg {
        width: 32px;
        height: 32px;
    }
    
    .mobile-menu-btn {
        width: 40px;
        height: 40px;
    }
    
    .hamburger {
        width: 18px;
    }
    
    .nav-menu {
        padding: 12px;
        gap: 10px;
        max-height: calc(100vh - 56px);
    }
    
    .nav-menu.mobile-active {
        top: 56px;
        height: calc(100vh - 56px);
    }
    
    .nav-link {
        padding: 12px 14px;
        min-height: 44px;
    }
    
    .nav-text {
        font-size: 14px;
    }
    
    .nav-icon {
        font-size: 14px;
        margin-right: 10px;
        width: 18px;
    }
    
    .nav-group-title {
        font-size: 12px;
        margin-bottom: 8px;
        padding-bottom: 4px;
    }
    
    .user-menu-btn {
        padding: 8px 10px;
        min-height: 40px;
        font-size: 13px;
    }
    
    .user-dropdown {
        min-width: 180px;
        right: 12px;
    }
    
    .dropdown-item {
        padding: 12px 16px;
        min-height: 44px;
        font-size: 13px;
        margin: 2px;
    }
    
    /* Extra small invoice optimization */
    .invoice-container {
        padding: 4px;
        margin: 0;
        border-radius: 6px;
    }
    
    .invoice-section {
        padding: 8px;
        margin-bottom: 12px;
        border-radius: 4px;
    }
    
    .invoice-section h3 {
        font-size: 15px;
        margin-bottom: 10px;
        font-weight: 600;
    }
    
    .form-input,
    .form-select {
        padding: 10px;
        font-size: 16px;
        min-height: 48px;
        border-radius: 4px;
    }
    
    .form-button,
    .btn-add-item {
        padding: 12px 16px;
        font-size: 15px;
        min-height: 48px;
        border-radius: 6px;
        width: 100%;
        margin-bottom: 8px;
    }
    
    /* Horizontal scrollable table for very small screens */
    .items-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 12px -8px;
        padding: 0 8px;
        border: 1px solid #e1e1e6;
        border-radius: 6px;
        background: white;
    }
    
    .items-table {
        font-size: 11px;
        min-width: 650px;
        margin: 0;
        border: none;
    }
    
    .items-table th,
    .items-table td {
        padding: 6px 4px;
        border: 1px solid #e1e1e6;
        vertical-align: middle;
    }
    
    .items-table th:first-child,
    .items-table td:first-child {
        position: sticky;
        left: 0;
        background: #f9fafb;
        z-index: 2;
        width: 40px;
        text-align: center;
        border-right: 2px solid #e1e1e6;
    }
    
    .items-table input {
        width: 55px;
        font-size: 12px;
        padding: 4px 3px;
        border-radius: 3px;
    }
    
    .items-table select {
        width: 80px;
        font-size: 11px;
        padding: 4px 2px;
        border-radius: 3px;
    }
    
    .btn-remove {
        padding: 4px 6px;
        font-size: 10px;
        border-radius: 3px;
    }
    
    .content-header {
        font-size: 16px;
        margin-bottom: 12px;
    }
    
    /* Compact totals section */
    .totals-section {
        margin-top: 16px;
        padding: 12px;
        background: #f8f9fa;
        border-radius: 6px;
    }
    
    .totals-right {
        padding: 12px;
        min-width: 100%;
    }
    
    .total-row {
        padding: 6px 0;
        font-size: 13px;
    }
    
    .total-row.grand-total {
        font-size: 16px;
        padding: 8px 0;
    }
    
    .small-input,
    .medium-input {
        width: 80px;
        font-size: 13px;
        padding: 6px;
    }
    
    /* Form actions */
    .form-actions {
        flex-direction: column;
        gap: 8px;
        margin-top: 16px;
    }
    
    .form-actions button {
        width: 100%;
        padding: 12px;
        font-size: 15px;
        min-height: 48px;
    }
    
    /* Page header mobile */
    div[style*="justify-content: space-between"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
        margin-bottom: 12px !important;
    }
    
    div[style*="justify-content: space-between"] .header-buttons {
        width: 100%;
        gap: 6px;
    }
    
    div[style*="justify-content: space-between"] .header-buttons button {
        flex: 1;
        padding: 8px 6px;
        font-size: 11px;
        white-space: nowrap;
    }
    
    /* Print button mobile */
    .print-btn {
        padding: 6px 12px !important;
        font-size: 12px !important;
    }
    
    .print-btn span:last-child {
        display: none; /* Hide "Print" text on mobile, show only icon */
    }
    
    /* Dashboard inventory table mobile */
    .card .data-table {
        font-size: 12px;
        border-spacing: 0;
    }
    
    .card .data-table th,
    .card .data-table td {
        padding: 10px 8px;
    }
    
    .card .data-table th:not(:last-child),
    .card .data-table td:not(:last-child) {
        padding-right: 12px;
    }
    
    .stock-status {
        font-size: 10px;
        padding: 2px 6px;
        min-width: 60px;
    }
    
    .stock-quantity {
        font-size: 12px;
    }
    
    /* Dashboard inventory table mobile optimization */
    .card .data-table th:nth-child(1),
    .card .data-table td:nth-child(1) {
        width: 38%; /* Product name */
        padding-left: 12px;
    }
    
    .card .data-table th:nth-child(2),
    .card .data-table td:nth-child(2) {
        width: 37%; /* Stock quantity */
        text-align: right;
        font-weight: 600;
        padding: 10px 16px 10px 12px;
    }
    
    .card .data-table th:nth-child(3),
    .card .data-table td:nth-child(3) {
        width: 25%; /* Status */
        text-align: center;
        padding-right: 12px;
    }
    
    /* Ensure all columns are visible on dashboard */
    .card .data-table th,
    .card .data-table td {
        display: table-cell !important;
    }
}

/* Large tablet breakpoint */
@media (max-width: 1200px) {
    .settings-grid {
        gap: 1.5rem;
    }
    
    .settings-grid .form-container {
        padding: 1.25rem;
    }
}

/* Medium tablet breakpoint */
@media (max-width: 1024px) {
    .settings-grid {
        gap: 1.25rem;
    }
    
    .settings-grid .form-container {
        padding: 1rem;
    }
    
    .form-input, .form-button {
        font-size: 15px;
    }
}

/* Small tablet breakpoint */
@media (max-width: 900px) {
    .settings-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .settings-grid .form-container {
        padding: 1.25rem;
        max-width: 100%;
        box-sizing: border-box;
    }
}

/* Ripple effect for nav links */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    transform: scale(0);
    animation: rippleEffect 0.6s linear;
    pointer-events: none;
}

@keyframes rippleEffect {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Enhanced mobile touch interactions */
.nav-link {
    position: relative;
    overflow: hidden;
}

.nav-link:active {
    transform: scale(0.98);
    background-color: #e5e7eb;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Perfect mobile navbar optimization */
@media (max-width: 768px) {
    .nav-link {
        padding: 14px 16px;
        min-height: 48px;
        font-size: 15px;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
        touch-action: manipulation;
    }
    
    .mobile-menu-btn {
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    }
    
    .user-menu-btn {
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
        min-height: 44px;
    }
    
    /* Invoice pages mobile optimization */
    .invoice-container {
        padding: 16px;
        margin: 0;
        width: 100%;
        box-sizing: border-box;
    }
    
    .invoice-header {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .invoice-section {
        margin-bottom: 20px;
        padding: 16px;
    }
    
    .invoice-section h3 {
        font-size: 18px;
        margin-bottom: 16px;
    }
    
    /* Form elements mobile optimization */
    .form-input,
    .form-select {
        font-size: 16px;
        padding: 12px;
        min-height: 48px;
        -webkit-appearance: none;
        appearance: none;
        border-radius: 6px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .form-button {
        font-size: 16px;
        padding: 12px 20px;
        min-height: 48px;
        border-radius: 6px;
        width: 100%;
        margin-bottom: 8px;
    }
    
    /* Items table mobile optimization */
    .items-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 16px 0;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    .items-table {
        min-width: 600px;
        font-size: 14px;
    }
    
    .items-table th,
    .items-table td {
        padding: 8px 6px;
        white-space: nowrap;
    }
    
    .items-table input {
        width: 80px;
        padding: 6px;
        font-size: 14px;
    }
    
    .items-table select {
        width: 100px;
        padding: 6px;
        font-size: 14px;
    }
    
    /* Header buttons mobile */
    .content-header {
        font-size: 20px;
        margin-bottom: 16px;
    }
    
    /* Page header mobile optimization */
    div[style*="justify-content: space-between"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
        margin-bottom: 16px !important;
    }
    
    div[style*="justify-content: space-between"] h1 {
        margin: 0 !important;
        width: 100%;
    }
    
    /* Button groups mobile */
    div[style*="display: flex"][style*="gap: 8px"] {
        flex-direction: row !important;
        width: 100% !important;
        justify-content: space-between !important;
    }
    
    div[style*="display: flex"][style*="gap: 8px"] button {
        flex: 1 !important;
        margin: 0 !important;
        padding: 10px 8px !important;
        font-size: 13px !important;
        white-space: nowrap;
    }
    
    /* Totals section mobile */
    .totals-section {
        margin-top: 20px;
        padding: 16px;
        background: #f8f9fa;
        border-radius: 8px;
    }
    
    .totals-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .totals-right {
        min-width: 100%;
    }
}

/* Modal responsive styles */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 10px;
        align-items: flex-start;
        padding-top: 5vh;
    }
    
    .modal {
        width: 95%;
        max-width: none;
        max-height: 90vh;
        overflow-y: auto;
        margin: 0;
    }
    
    .modal-header {
        padding: 16px;
    }
    
    .modal-header h2,
    .modal-header h3 {
        font-size: 18px;
    }
    
    .modal-body {
        padding: 16px;
        max-height: none;
    }
    
    .modal-actions {
        flex-direction: column;
        gap: 8px;
        padding: 16px;
    }
    
    .modal-actions button {
        width: 100%;
        margin: 0;
        padding: 12px;
        min-height: 48px;
        font-size: 16px;
    }
    
    .form-input,
    .form-select {
        font-size: 16px;
        min-height: 48px;
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .modal-overlay {
        padding: 5px;
        padding-top: 2vh;
    }
    
    .modal {
        width: 98%;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 12px;
    }
    
    .modal-header h2,
    .modal-header h3 {
        font-size: 16px;
    }
    
    .modal-body {
        padding: 12px;
    }
    
    .modal-actions {
        padding: 12px;
        gap: 6px;
    }
    
    .modal-actions button {
        padding: 14px;
        font-size: 15px;
        min-height: 48px;
    }
}

/* Inventory stock status styles */
.stock-quantity {
    font-weight: 600;
    text-align: right;
}

.stock-status {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    display: inline-block;
    min-width: 80px;
}

.status-in-stock {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.status-low-stock {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.status-out-of-stock {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Print button styles */
.print-btn:hover {
    background: #3730a3 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(79, 70, 229, 0.3);
    transition: all 0.2s ease;
}

.print-btn:active {
    transform: translateY(0);
}

/* Dashboard inventory table */
.card .table-wrapper {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
}

.card .data-table {
    margin: 0;
    border: none;
}

.card .data-table th {
    background-color: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
    font-weight: 600;
    color: #374151;
}

.card .data-table td {
    border-bottom: 1px solid #f3f4f6;
}

.card .data-table tbody tr:hover {
    background-color: #f9fafb;
}

/* Search container styles */
.search-container input {
    transition: all 0.2s ease;
    border: 2px solid #e5e7eb;
}

.search-container input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

/* Mobile responsive search */
@media (max-width: 768px) {
    div[style*="justify-content: space-between"] .search-container {
        min-width: 100% !important;
        margin-top: 8px;
    }
    
    .search-container input {
        font-size: 16px !important;
        padding: 10px 12px !important;
    }
    
    .search-container button {
        padding: 10px 14px !important;
        font-size: 13px !important;
    }
}

@media (max-width: 480px) {
    .search-container {
        flex-direction: column !important;
        gap: 8px !important;
    }
    
    .search-container input,
    .search-container button {
        width: 100% !important;
    }
}

/* Loading and empty states */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #747487;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 16px;
    margin-bottom: 24px;
}

/* Badge styles */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #e0f2fe;
    color: #0c4a6e;
}

/* Form help text */
.form-help {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
    font-style: italic;
}

/* Clickable category labels */
.clickable-label {
    display: inline-block;
    color: #0e71eb;
    cursor: pointer;
    text-decoration: none;
    padding: 4px 8px;
    margin: 2px;
    border-radius: 12px;
    transition: all 0.2s ease;
    font-style: normal;
    font-weight: 500;
    font-size: 11px;
    background-color: #f0f7ff;
    border: 1px solid #bfdbfe;
    white-space: nowrap;
}

.clickable-label:hover {
    background-color: #0e71eb;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(14, 113, 235, 0.2);
}

/* Credit/Debit specific styling */
.btn-credit {
    background-color: #10b981;
    border-color: #10b981;
}

.btn-credit:hover {
    background-color: #059669;
    border-color: #059669;
}

.btn-debit {
    background-color: #ef4444;
    border-color: #ef4444;
}

.btn-debit:hover {
    background-color: #dc2626;
    border-color: #dc2626;
}

.credit-amount {
    color: #10b981;
    font-weight: 600;
}

.debit-amount {
    color: #ef4444;
    font-weight: 600;
}

.summary-row {
    border-top: 2px solid #e1e1e6;
    font-weight: bold;
    background-color: #f9fafb;
}

.balance-row {
    border-top: 1px solid #0e71eb;
    background-color: #f0f7ff;
}

/* Business info display */
.business-info-card {
    background: #f9fafb;
    border: 1px solid #e1e1e6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.info-row {
    padding: 8px 0;
    border-bottom: 1px solid #e1e1e6;
    font-size: 14px;
}

.info-row:last-child {
    border-bottom: none;
}

.info-row strong {
    color: #232333;
    font-weight: 600;
    margin-right: 8px;
}

/* Modal styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.modal {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    width: 400px;
    max-width: 90vw;
    overflow: hidden;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e1e1e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #232333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #747487;
    cursor: pointer;
    padding: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.modal-close:hover {
    background: #f6f7f9;
    color: #232333;
}

.modal-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #232333;
    font-size: 14px;
}

.form-input, .form-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e1e1e6;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #ffffff;
    box-sizing: border-box;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: #0e71eb;
    box-shadow: 0 0 0 2px rgba(14, 113, 235, 0.1);
}

.form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e1e1e6;
}

/* Alert Messages */
.alert {
    padding: 12px 16px;
    margin: 16px 0;
    border-radius: 6px;
    font-size: 14px;
    border: 1px solid;
}

.alert-success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.alert-error {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

/* ----- Standardized Modal Styles ----- */
/* This block replaces all previous .modal, .modal-overlay, 
  and .modal-content styles for consistency.
*/
.modal-overlay {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none; /* Hidden by default */
    align-items: center; /* Vertical center */
    justify-content: center; /* Horizontal center */
    overflow-y: auto;
    padding: 20px; /* Add padding for small screens */
}

.modal {
    background-color: #fefefe;
    padding: 0;
    border: 1px solid #888;
    border-radius: 8px;
    width: 90%;
    max-width: 600px; /* Default max-width */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    animation: modalSlide 0.3s ease-out;
    margin: 0; /* Remove auto margin, flex handles it */
    overflow: hidden; /* Prevent content from spilling */
}

/* Animation */
@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2,
.modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #000;
}

.modal-body {
    padding: 20px;
    max-height: 70vh; /* Add max-height for scrolling */
    overflow-y: auto; /* Enable scrolling for modal body */
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 0; /* Reset margin */
    padding: 20px;
    border-top: 1px solid #dee2e6;
    background-color: #f8f9fa;
    border-radius: 0 0 8px 8px;
}
/* ----- End of Standardized Modal Styles ----- */

/* Success/Error Message Styles */
.toast-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 5px;
    z-index: 9999;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideIn 0.3s ease-out;
}

.toast-success {
    background: #28a745;
    color: white;
}

.toast-error {
    background: #dc3545;
    color: white;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Header buttons layout */
.header-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.header-with-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.inventory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* Mobile viewport optimization */
@media (max-width: 768px) {
    /* Better mobile form row handling */
    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .invoice-header {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    /* Better mobile table scrolling indicator */
    .items-table-wrapper {
        position: relative;
        border: 1px solid #e1e1e6;
        border-radius: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 16px 0;
    }
    
    .items-table-wrapper::before {
        content: "← Scroll to see more →";
        position: absolute;
        top: 0;
        right: 0;
        background: rgba(0, 0, 0, 0.7);
        color: white;
        padding: 4px 8px;
        font-size: 11px;
        border-radius: 0 8px 0 4px;
        z-index: 3;
        pointer-events: none;
    }
    
    /* Hide scroll indicator after interaction */
    .items-table-wrapper:hover::before,
    .items-table-wrapper:focus-within::before {
        display: none;
    }
}