body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    /* Prevent scroll bounce on mobile */
    overscroll-behavior: none;
    -webkit-overscroll-behavior: none;
    /* Additional mobile scroll fixes */
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
}
.container {
    background-color: #ffffff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
    overflow: hidden;
    /* Prevent scroll bounce on mobile */
    overscroll-behavior: contain;
    -webkit-overscroll-behavior: contain;
}
h1 {
    color: #000000;
    font-size: 24px;
    margin-bottom: 20px;
    text-align: center;
}
form {
    display: flex;
    flex-direction: column;
}
.input-group {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}
.input-group label {
    background-color: #f0f0f0;
    padding: 10px;
    border: 1px solid #ccc;
    border-right: none;
    border-radius: 5px 0 0 5px;
}
input:not([type="radio"]):not([type="checkbox"]) {
    box-sizing: border-box;
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
}

/* Add spacing only for standalone inputs (not in input-group) */
input[type="text"], input[type="tel"] {
    margin-bottom: 15px;
}

/* Remove margin for inputs inside input-group */
.input-group input {
    margin-bottom: 0;
}
button {
    background-color: #007AFF;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}
button:hover {
    background-color: #0056b3;
}
.message {
    margin-bottom: 15px;
    padding: 10px;
    border-radius: 5px;
    background-color: #f0f0f0;
}
.telegram-link {
    display: block;
    text-align: center;
    margin-top: 15px;
    color: #007AFF;
    text-decoration: none;
    font-size: 14px;
}
.telegram-link:hover {
    text-decoration: underline;
}
.toggle-section {
    margin-top: 20px;
    border-top: 1px solid #ccc;
    padding-top: 15px;
}
.toggle-btn {
    background: none;
    border: none;
    color: #000000;
    font-size: 14px;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    width: 100%;
    text-align: left;
}
.toggle-btn:hover {
    text-decoration: none;
}
.toggle-btn::after {
    content: '\25BC';
    margin-left: 5px;
    transition: transform 0.3s;
    font-size: 10px;
}
.toggle-btn.active::after {
    transform: rotate(180deg);
}
.toggle-content {
    display: none;
    margin-top: 10px;
}
/* Login page radio buttons (index.php) */
.login-radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    margin-bottom: 16px;
}
  
.login-radio-btn-label {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 100%;
}
  
.login-radio-btn-label input[type="radio"] {
    flex-shrink: 0;
}
  
.login-radio-btn-label span {
    display: inline-block;
    color: #000 !important;
    font-size: 16px;
    white-space: nowrap;
    word-break: keep-all;
    overflow-wrap: normal;
    font-weight: 500;
    visibility: visible !important;
    opacity: 1 !important;
}
.login-radio-btn-label input[type="radio"]:checked + span {
    font-weight: bold;
    color: #007AFF;
}
.login-radio-btn-label:last-child {
    margin-right: 0;
}
.login-radio-btn-label input[type="radio"]:focus + span {
    outline: 2px solid #007AFF;
}

/* Main application radio buttons (user_form.php) */
.app-radio-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin-bottom: 16px;
    flex-wrap: nowrap;
}
  
.app-radio-btn-label {
    display: flex;
    align-items: center;
    gap: 8px;
    width: auto;
    max-width: none;
    flex-shrink: 0;
    white-space: nowrap;
}
  
.app-radio-btn-label input[type="radio"] {
    flex-shrink: 0;
    margin: 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
}
  
.app-radio-btn-label span {
    display: inline-block;
    color: #000 !important;
    font-size: 16px;
    white-space: nowrap;
    font-weight: 500;
}
.app-radio-btn-label input[type="radio"]:checked + span {
    font-weight: bold;
    color: #007AFF;
}
.app-radio-btn-label:last-child {
    margin-right: 0;
}
.app-radio-btn-label input[type="radio"]:focus + span {
    outline: 2px solid #007AFF;
}
.popup {
    /* display: none; */
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    max-width: 80%;
    width: 300px;
}
.popup-content {
    text-align: center;
}
.popup-close {
    position: absolute;
    right: 10px;
    top: 10px;
    cursor: pointer;
}
.logo-container {
    text-align: center;
    margin-bottom: 20px;
}
.logo {
    max-width: 200px;
    height: auto;
}
h2 {
    text-align: center;
    color: #000000;
    font-size: 24px;
    margin-bottom: 20px;
}
/* Mobile styles for login page radio buttons */
@media (max-width: 500px) {
    .container {
        padding: 15px;
        max-width: 100%;
        margin: 10px;
    }
    
    .login-radio-group {
        display: flex;
        flex-direction: column;
        gap: 12px;
        justify-content: flex-start;
        align-items: flex-start;
        margin-bottom: 16px;
        width: 100%;
        padding: 0;
    }
    .login-radio-btn-label {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        max-width: 100%;
        flex-wrap: nowrap;
        font-size: 15px;
        flex-shrink: 0;
        text-align: left;
        justify-content: flex-start;
    }
    .login-radio-btn-label span {
        font-size: 15px;
        white-space: nowrap;
        overflow: visible;
        text-overflow: clip;
        font-weight: 500;
        display: inline;
    }
}

@media (max-width: 400px) {
    .login-radio-group {
        gap: 10px;
        padding: 0;
    }
    .login-radio-btn-label {
        font-size: 14px;
        width: 100%;
        text-align: left;
        justify-content: flex-start;
    }
    .login-radio-btn-label span {
        font-size: 14px;
        font-weight: 500;
        display: inline;
    }
}

@media (max-width: 350px) {
    .login-radio-group {
        gap: 8px;
        padding: 0;
    }
    .login-radio-btn-label {
        font-size: 13px;
        width: 100%;
        text-align: left;
        justify-content: flex-start;
    }
    .login-radio-btn-label span {
        font-size: 13px;
        font-weight: 500;
        display: inline;
    }
}

@media (max-width: 300px) {
    .login-radio-group {
        flex-direction: column;
        gap: 10px;
        justify-content: flex-start;
        align-items: flex-start;
        padding: 0;
    }
    .login-radio-btn-label {
        font-size: 13px;
        width: 100%;
        justify-content: flex-start;
        text-align: left;
    }
    .login-radio-btn-label span {
        font-size: 13px;
        display: inline;
    }
    
    .input-group {
        margin-bottom: 12px;
    }
    
    .input-group label {
        padding: 8px;
        font-size: 14px;
    }
    
    .input-group input {
        padding: 8px;
        font-size: 14px;
    }
}

@media (max-width: 250px) {
    .login-radio-group {
        flex-direction: column;
        gap: 12px;
        justify-content: flex-start;
        align-items: flex-start;
        padding: 0;
    }
    .login-radio-btn-label {
        font-size: 14px;
        width: 100%;
        justify-content: flex-start;
        text-align: left;
    }
    .login-radio-btn-label span {
        font-size: 14px;
        display: inline;
    }
}

/* Mobile styles for app radio buttons (user_form.php) */
@media (max-width: 768px) {
    .app-radio-group {
        gap: 8px;
    }
    .app-radio-btn-label {
        font-size: 14px;
    }
    .app-radio-btn-label span {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .app-radio-group {
        gap: 6px;
    }
    .app-radio-btn-label {
        font-size: 13px;
    }
    .app-radio-btn-label span {
        font-size: 13px;
    }
}

@media (max-width: 350px) {
    .app-radio-group {
        gap: 4px;
    }
    .app-radio-btn-label {
        font-size: 12px;
    }
    .app-radio-btn-label span {
        font-size: 12px;
    }
} 

/* Tab Styles */
.tab-navigation {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #c7c7cc;
    background-color: #f8f9fa;
    border-radius: 8px 8px 0 0;
    padding: 0;
    position: relative;
}

.tab-button {
    background: #e9ecef;
    border: 1px solid #dee2e6;
    border-bottom: none;
    padding: 12px 24px;
    cursor: pointer;
    font-size: 16px;
    color: #6c757d;
    border-radius: 8px 8px 0 0;
    margin-right: 2px;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.tab-button:hover {
    background-color: #f8f9fa;
    color: #495057;
}

.tab-button.active {
    background-color: #ffffff;
    color: #007aff;
    font-weight: 600;
    border-color: #c7c7cc;
    border-bottom-color: #ffffff;
    z-index: 2;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.1);
}

.tab-content {
    display: none;
    background-color: #ffffff;
    border: 1px solid #c7c7cc;
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 20px;
    margin-top: -1px;
}

.tab-content.active {
    display: block;
}

.tab-content-container {
    position: relative;
    z-index: 0;
} 

/* ===== NEW STYLES FROM USER_FORM.PHP ===== */

:root {
    --primary-color: #007aff;
    --background-color: #f2f2f7;
    --card-background: #ffffff;
    --text-color: #000000;
    --border-color: #c7c7cc;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    margin: 0;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background-color: var(--card-background);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

h1, h2 {
    color: var(--text-color);
    font-weight: 600;
}

h1 {
    font-size: 28px;
    margin-bottom: 24px;
}

h2 {
    font-size: 22px;
    margin-top: 24px;
}

form {
    margin-bottom: 24px;
}

input[type="text"], button {
    font-size: 16px;
    padding: 12px 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    outline: none;
}

input[type="text"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: #0056b3;
}

.table-container {
    overflow-x: auto;
    margin-bottom: 24px;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 24px;
}

#poTable {
    min-width: 600px;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: var(--background-color);
    font-weight: 600;
}

.error {
    color: #ff3b30;
    margin-bottom: 16px;
}

#signature-pad {
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

#signature-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    z-index: 1000;
}

#signature-popup .close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    cursor: pointer;
    font-size: 20px;
}

#email-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    z-index: 1000;
}

#email-popup .close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    cursor: pointer;
    font-size: 20px;
}

#loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 2000;
}

.spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Tab Styles */
.tab-navigation {
    display: flex;
    margin-bottom: 24px;
    border-bottom: 2px solid #c7c7cc;
    background-color: #f8f9fa;
    border-radius: 8px 8px 0 0;
    padding: 0;
    position: relative;
    z-index: 10;
}

.tab-button {
    background: #e9ecef;
    border: 1px solid #dee2e6;
    border-bottom: none;
    padding: 14px 24px;
    cursor: pointer;
    font-size: 16px;
    color: #6c757d;
    border-radius: 8px 8px 0 0;
    margin-right: 2px;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
    pointer-events: auto;
    user-select: none;
}

.tab-button:hover {
    background-color: #f8f9fa;
    color: #495057;
}

.tab-button.active {
    background-color: #ffffff;
    color: #007aff;
    font-weight: 600;
    border-color: #c7c7cc;
    border-bottom-color: #ffffff;
    z-index: 2;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.1);
}

.tab-content {
    display: none;
    background-color: #ffffff;
    border: 1px solid #c7c7cc;
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 20px;
    margin-top: -1px;
}

.tab-content.active {
    display: block;
}

.tab-content-container {
    position: relative;
    z-index: 0;
}

.button-group {
    margin-top: 24px;
    display: flex;
    gap: 12px;
}

.button-group button {
    flex: 1;
    max-width: none;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 500;
    border-radius: 8px;
}

/* Improve table spacing and styling */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 24px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

th, td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

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

/* Main container styling */
.main-container {
    background: #f5f5f5;
    min-height: 100vh;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    /* Prevent scroll bounce on mobile */
    overscroll-behavior: contain;
    -webkit-overscroll-behavior: contain;
}

.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 30px;
    width: 100%;
    margin: 0 auto;
}

/* Header styling */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.header h1 {
    margin: 0;
    font-size: 32px;
    font-weight: 700;
    color: #333;
}

.logout-btn {
    background: #007AFF;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.logout-btn:hover {
    background: #0056b3;
}

/* Form styling */
.search-form {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
}

.form-group {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
    flex-direction: row;
    flex-wrap: nowrap;
    width: 100%;
    min-height: 40px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group input[type="radio"] {
    margin: 0;
    width: 18px;
    height: 18px;
    accent-color: #007AFF;
    flex-shrink: 0;
}

    .form-group label {
        font-weight: 500;
        color: #333;
        min-width: 80px;
        margin: 0;
        font-size: 16px;
        flex-shrink: 0;
        white-space: nowrap;
        display: inline-block;
        text-overflow: ellipsis;
        overflow: hidden;
    }

.form-group input[type="text"] {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    background: white;
    min-width: 0;
}

.form-group input[type="text"]:focus {
    border-color: #007AFF;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.1);
    outline: none;
}

.form-group input[type="text"]::placeholder {
    color: #999;
}

/* Mobile-specific improvements */
@media (max-width: 768px) {
    .main-container {
        padding: 10px;
    }
    
    .card {
        padding: 20px;
        border-radius: 8px;
    }
    
    .header h1 {
        font-size: 24px;
    }
    
    .logout-btn {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    .search-form {
        padding: 16px;
    }
    
    .form-group {
        margin-bottom: 12px;
        gap: 8px;
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
        width: 100%;
        min-height: 40px;
    }
    
    .form-group label {
        min-width: 60px;
        font-size: 14px;
        order: 2;
        flex-shrink: 0;
        white-space: nowrap;
        display: inline-block;
        text-align: left;
    }
    
    .form-group input[type="radio"] {
        order: 1;
        margin-right: 4px;
        width: 18px;
        height: 18px;
        flex-shrink: 0;
    }
    
    .form-group input[type="text"] {
        order: 3;
        flex: 1;
        padding: 10px 12px;
        font-size: 14px;
        min-width: 0;
    }
    
    .button-group {
        margin-top: 16px;
        gap: 8px;
    }
    
    .button-group button {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    /* Improve tab navigation for mobile */
    .tab-navigation {
        margin-bottom: 16px;
    }
    
    .tab-button {
        padding: 10px 16px;
        font-size: 14px;
        border-radius: 6px;
    }
    
    /* Improve table responsiveness */
    table {
        font-size: 13px;
    }
    
    th, td {
        padding: 10px 12px;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    .main-container {
        padding: 8px;
        display: flex;
        justify-content: center;
        align-items: flex-start;
        min-height: 100vh;
    }
    
    .card {
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
        padding: 16px;
        box-sizing: border-box;
    }
    
    .header {
        flex-direction: column;
        gap: 12px;
        align-items: center;
        text-align: center;
    }
    
    .header h1 {
        font-size: 22px;
        margin: 0;
    }
    
    .logout-btn {
        padding: 8px 16px;
        font-size: 13px;
        border-radius: 6px;
    }
    
    .search-form {
        padding: 12px;
    }
    
    .form-group {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 8px;
        margin-bottom: 12px;
        flex-wrap: nowrap;
        width: 100%;
        min-height: 40px;
        box-sizing: border-box;
        justify-content: flex-start;
        /* Ensure labels are always visible */
        overflow: visible;
        /* Prevent unexpected expansion */
        max-height: 50px;
    }
    
    .form-group label {
        min-width: 60px;
        margin: 0;
        order: 2;
        font-size: 14px;
        flex-shrink: 0;
        white-space: nowrap;
        display: inline-block !important;
        font-weight: 500;
        text-align: left;
        color: #333;
        /* Ensure labels are always visible */
        overflow: visible;
        text-overflow: clip;
        /* Force label visibility */
        visibility: visible !important;
        opacity: 1 !important;
        /* Prevent label hiding */
        position: static !important;
        clip: auto !important;
        height: auto !important;
        width: auto !important;
    }
    
    .form-group input[type="radio"] {
        order: 1;
        margin: 0;
        width: 18px;
        height: 18px;
        flex-shrink: 0;
        cursor: pointer;
        margin-right: 8px;
        accent-color: #007AFF;
    }
    
    .form-group input[type="text"] {
        flex: 1;
        box-sizing: border-box;
        order: 3;
        padding: 10px 12px;
        font-size: 14px;
        min-width: 0;
        border: 1px solid #ddd;
        border-radius: 6px;
        width: 100%;
    }
    
    .button-group {
        margin-top: 16px;
        gap: 8px;
        display: flex;
        flex-direction: column;
        width: 100%;
        align-items: center;
    }
    
    /* Ensure table horizontal scrolling works on mobile */
    .table-container {
        overflow-x: scroll !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        border: 1px solid #ddd;
        border-radius: 8px;
        margin: 10px 0;
        position: relative;
        /* Force horizontal scrollbar */
        white-space: nowrap;
        max-width: 100%;
        /* Force scrollbar visibility */
        scrollbar-width: auto;
        -ms-overflow-style: auto;
    }
    
    /* Ensure scrollbar is visible on webkit browsers */
    .table-container::-webkit-scrollbar {
        height: 8px;
        background-color: #f1f1f1;
    }
    
    .table-container::-webkit-scrollbar-thumb {
        background-color: #888;
        border-radius: 4px;
    }
    
    /* Add scroll indicator */
    .table-container::after {
        content: "← Scroll →";
        position: absolute;
        top: -25px;
        right: 10px;
        font-size: 12px;
        color: #666;
        background: rgba(255,255,255,0.9);
        padding: 2px 8px;
        border-radius: 4px;
        pointer-events: none;
        z-index: 10;
    }
    
    table {
        min-width: 800px !important;
        width: 100%;
        table-layout: auto;
        border-collapse: collapse;
        /* Force table to be wider than container */
        display: table;
    }
    
    /* Ensure table columns have proper widths on mobile */
    table th:nth-child(1), table td:nth-child(1) {
        min-width: 100px; /* PO Number */
        max-width: 120px;
    }
    
    table th:nth-child(2), table td:nth-child(2) {
        min-width: 150px; /* Invoice Number */
        max-width: 180px;
    }
    
    table th:nth-child(3), table td:nth-child(3) {
        min-width: 200px; /* Company */
        max-width: 250px;
    }
    
    table th:nth-child(4), table td:nth-child(4) {
        min-width: 80px; /* Action */
        max-width: 100px;
    }
    
    .button-group button {
        padding: 12px 16px;
        font-size: 14px;
        width: 100%;
        max-width: 250px;
        border-radius: 8px;
        font-weight: 500;
    }
    
    /* Improve tab navigation for very small screens */
    .tab-navigation {
        margin-bottom: 16px;
        display: flex;
        width: 100%;
    }
    
    .tab-button {
        flex: 1;
        padding: 12px 8px;
        font-size: 13px;
        text-align: center;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Improve table for very small screens */
    table {
        font-size: 12px;
        width: 100%;
        table-layout: fixed;
    }
    
    th, td {
        padding: 8px 6px;
        text-align: left;
        vertical-align: middle;
        word-wrap: break-word;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Column widths for mobile */
    table th:nth-child(1), table td:nth-child(1) {
        width: 35%;
    }
    
    table th:nth-child(2), table td:nth-child(2) {
        width: 25%;
    }
    
    table th:nth-child(3), table td:nth-child(3) {
        width: 25%;
    }
    
    table th:nth-child(4), table td:nth-child(4) {
        width: 15%;
    }
    
    /* Make tables scrollable on very small screens */
    .table-container {
        overflow-x: scroll !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        max-width: 100%;
        margin: 0 auto;
        /* Prevent scroll bounce on mobile */
        overscroll-behavior: contain;
        -webkit-overscroll-behavior: contain;
        /* Additional mobile scroll fixes */
        position: relative;
        z-index: 1;
        /* Ensure horizontal scrolling works */
        white-space: nowrap;
        /* Force scrollbar */
        scrollbar-width: auto;
        scrollbar-color: #888 #f1f1f1;
        /* Force scrollbar visibility */
        -ms-overflow-style: auto;
    }
    
    /* Ensure scrollbar is visible on webkit browsers */
    .table-container::-webkit-scrollbar {
        height: 8px;
        background-color: #f1f1f1;
    }
    
    .table-container::-webkit-scrollbar-thumb {
        background-color: #888;
        border-radius: 4px;
    }
    
    /* Ensure form elements don't overflow */
    .search-form {
        max-width: 100%;
        overflow: hidden;
        box-sizing: border-box;
    }
    
    .form-group {
        max-width: 100%;
        overflow: hidden;
    }
    
    .form-group input[type="text"] {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Results section should be scrollable */
    .tab-content {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Results container specific styling */
    .tab-content-container {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Ensure search results don't break layout */
    .search-results {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Table specific scrolling */
    table {
        min-width: 800px !important; /* Ensure minimum width for readability */
        width: 100%;
        table-layout: auto;
        border-collapse: collapse;
        /* Force table to be wider than container */
        display: table;
    }
    
    /* Ensure table columns have proper widths */
    table th:nth-child(1), table td:nth-child(1) {
        min-width: 150px; /* Invoice Number */
    }
    
    table th:nth-child(2), table td:nth-child(2) {
        min-width: 200px; /* Company */
    }
    
    table th:nth-child(3), table td:nth-child(3) {
        min-width: 100px; /* Date */
    }
    
    table th:nth-child(4), table td:nth-child(4) {
        min-width: 80px; /* Action */
    }
    
    /* Results container specific styling */
    .tab-content-container {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Ensure search results don't break layout */
    .search-results {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Extra small mobile devices - additional refinements */
@media (max-width: 400px) {
    .main-container {
        padding: 8px;
        display: flex;
        justify-content: center;
        align-items: flex-start;
        min-height: 100vh;
    }
    
    .card {
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
        padding: 16px;
        box-sizing: border-box;
    }
    
    .form-group {
        gap: 6px;
        margin-bottom: 10px;
        justify-content: flex-start;
        align-items: center;
        width: 100%;
        box-sizing: border-box;
    }
    
    .form-group label {
        min-width: 70px;
        font-size: 13px;
        flex-shrink: 0;
        text-align: left;
    }
    
    .form-group input[type="text"] {
        padding: 8px 10px;
        font-size: 13px;
        flex: 1;
        min-width: 0;
    }
    
    .button-group {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    
    .button-group button {
        padding: 10px 14px;
        font-size: 13px;
        width: 100%;
        max-width: 200px;
    }
    
    /* Adjust table for very small screens */
    table {
        font-size: 11px;
        width: 100%;
        margin: 0 auto;
        min-width: 280px; /* Minimum width for very small screens */
    }
    
    th, td {
        padding: 6px 4px;
    }
    
    /* Tighter column widths for very small screens */
    table th:nth-child(1), table td:nth-child(1) {
        width: 30%;
    }
    
    table th:nth-child(2), table td:nth-child(2) {
        width: 30%;
    }
    
    table th:nth-child(3), table td:nth-child(3) {
        width: 25%;
    }
    
    table th:nth-child(4), table td:nth-child(4) {
        width: 15%;
    }
    
    /* Ensure form elements don't overflow on very small screens */
    .search-form {
        max-width: 100%;
        overflow: hidden;
        box-sizing: border-box;
    }
    
    .form-group {
        max-width: 100%;
        overflow: hidden;
    }
    
    .form-group input[type="text"] {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Results section should be scrollable */
    .tab-content {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Legacy mobile styles for compatibility */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 16px;
    }
    
    input[type="text"], button {
        width: 100%;
        box-sizing: border-box;
    }
    
    .form-group {
        display: flex;
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
        width: 100%;
        min-height: 40px;
    }
    
    .form-group label {
        min-width: 60px;
        margin: 0;
        order: 2;
        font-size: 14px;
        flex-shrink: 0;
        white-space: nowrap;
        display: inline-block;
        text-align: left;
    }
    
    .form-group input[type="radio"] {
        order: 1;
        margin: 0;
        width: 18px;
        height: 18px;
        flex-shrink: 0;
        cursor: pointer;
        margin-right: 4px;
    }
    
    .form-group input[type="text"] {
        flex: 1;
        box-sizing: border-box;
        order: 3;
        padding: 10px 12px;
        font-size: 14px;
        min-width: 0;
        border: 1px solid #ddd;
        border-radius: 6px;
    }
    
    table, th, td {
        font-size: 14px;
    }
    
    /* Table button styles for compact mobile design */
    table button {
        padding: 6px 12px;
        font-size: 14px;
        min-height: auto;
        white-space: nowrap;
        height: auto;
        line-height: 1.2;
    }
    
    /* Compact table action buttons */
    .table-action-btn {
        background-color: #007AFF;
        color: white;
        border: none;
        cursor: pointer;
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 12px;
        white-space: nowrap;
        min-width: 50px;
        max-width: 70px;
        transition: background-color 0.3s;
    }
    
    .table-action-btn:hover {
        background-color: #0056b3;
    }
    
    /* Eye icon for View Invoice button */
    .view-invoice-btn {
        background: none;
        border: none;
        color: #007AFF;
        font-size: 18px;
        cursor: pointer;
        padding: 4px 8px;
        border-radius: 4px;
        transition: background-color 0.3s;
    }
    
    .view-invoice-btn:hover {
        background-color: #f0f0f0;
    }
    
    /* Signature image constraints */
    #signature-image {
        max-width: 300px;
        max-height: 150px;
        width: auto;
        height: auto;
        object-fit: contain;
        border: 1px solid #ddd;
        border-radius: 8px;
        margin: 10px 0;
        display: block;
    }
    
    /* Mobile signature image constraints */
    @media (max-width: 768px) {
        #signature-image {
            max-width: 250px;
            max-height: 120px;
        }
    }
    
    @media (max-width: 480px) {
        #signature-image {
            max-width: 200px;
            max-height: 100px;
        }
    }
    
    @media (max-width: 400px) {
        #signature-image {
            max-width: 180px;
            max-height: 90px;
        }
    }
    
    /* Mobile-specific table button optimizations */
    @media (max-width: 768px) {
        /* Prevent scroll bounce on mobile */
        html, body {
            overscroll-behavior: none;
            -webkit-overscroll-behavior: none;
            /* Additional mobile scroll fixes */
            -webkit-overflow-scrolling: touch;
            overflow-x: auto;
        }
        
        .main-container, .tab-content-container, .table-container {
            overscroll-behavior: contain;
            -webkit-overscroll-behavior: contain;
            /* Additional mobile scroll fixes */
            -webkit-overflow-scrolling: touch;
            position: relative;
            z-index: 1;
        }
        
        /* Specific mobile scroll container */
        .mobile-scroll-container {
            overscroll-behavior: contain;
            -webkit-overscroll-behavior: contain;
            -webkit-overflow-scrolling: touch;
            overflow-x: auto;
            overflow-y: auto;
            position: relative;
            z-index: 1;
        }
        table button {
            padding: 4px 8px;
            font-size: 12px;
            min-width: 60px;
            max-width: 80px;
        }
        
        .table-action-btn {
            padding: 3px 6px;
            font-size: 11px;
            min-width: 50px;
            max-width: 70px;
        }
        
        .view-invoice-btn {
            font-size: 16px;
            padding: 2px 6px;
        }
    }
    
    @media (max-width: 480px) {
        /* Prevent scroll bounce on mobile */
        html, body {
            overscroll-behavior: none;
            -webkit-overscroll-behavior: none;
            -webkit-overflow-scrolling: touch;
            overflow-x: auto;
        }
        
        .main-container, .tab-content-container, .table-container {
            overscroll-behavior: contain;
            -webkit-overscroll-behavior: contain;
            -webkit-overflow-scrolling: touch;
        }
        
        table button {
            padding: 3px 6px;
            font-size: 11px;
            min-width: 50px;
            max-width: 70px;
        }
        
        .table-action-btn {
            padding: 2px 4px;
            font-size: 10px;
            min-width: 40px;
            max-width: 60px;
        }
        
        .view-invoice-btn {
            font-size: 14px;
            padding: 2px 4px;
        }
    }
    
    @media (max-width: 400px) {
        /* Prevent scroll bounce on mobile */
        html, body {
            overscroll-behavior: none;
            -webkit-overscroll-behavior: none;
            -webkit-overflow-scrolling: touch;
            overflow-x: auto;
        }
        
        .main-container, .tab-content-container, .table-container {
            overscroll-behavior: contain;
            -webkit-overscroll-behavior: contain;
            -webkit-overflow-scrolling: touch;
        }
        
        table button {
            padding: 2px 4px;
            font-size: 10px;
            min-width: 40px;
            max-width: 60px;
        }
        
        .table-action-btn {
            padding: 1px 3px;
            font-size: 9px;
            min-width: 35px;
            max-width: 50px;
        }
        
        .view-invoice-btn {
            font-size: 12px;
            padding: 1px 3px;
        }
    }
} 