/* Appwala - Modern Responsive Invoice System */
/* Mobile-First Design */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #3b82f6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #0ea5e9;
    --dark-color: #1f2937;
    --light-color: #f9fafb;
    --border-color: #e5e7eb;
    --text-color: #111827;
    --text-muted: #6b7280;
    --sidebar-width: 220px;
    --header-height: 55px;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--light-color);
    color: var(--text-color);
    line-height: 1.5;
    font-size: 14px;
}

@media (min-width: 1024px) {
    body {
        font-size: 13px;
    }
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 40px 30px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    width: 180px;
    height: auto;
    max-width: 100%;
    margin-bottom: 20px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.login-header h1 {
    font-size: 32px;
    color: var(--primary-color);
    margin-bottom: 8px;
    font-weight: 700;
}

.login-header p {
    color: var(--text-muted);
    font-size: 14px;
}

.login-form {
    margin-top: 30px;
}

.login-footer {
    margin-top: 20px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}

@media (min-width: 1024px) {
    .form-group {
        margin-bottom: 12px;
    }
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-color);
    font-size: 13px;
}

@media (min-width: 1024px) {
    .form-group label {
        font-size: 12px;
        margin-bottom: 4px;
    }
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s;
    background: white;
}

@media (min-width: 1024px) {
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 6px 10px;
        font-size: 13px;
        border-radius: 4px;
    }
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

@media (min-width: 1024px) {
    .form-group textarea {
        min-height: 50px;
    }
}

.form-help {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

.form-hint {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    font-style: italic;
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

@media (min-width: 1024px) {
    .form-row {
        gap: 12px;
        margin-bottom: 12px;
    }
}

@media (min-width: 768px) {
    .form-row {
        grid-template-columns: 1fr 1fr;
    }
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    text-align: center;
}

@media (min-width: 1024px) {
    .btn {
        padding: 6px 14px;
        font-size: 13px;
        border-radius: 4px;
    }
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--text-muted);
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}
 
.btn-danger:hover {
    background: #dc2626;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

@media (min-width: 1024px) {
    .btn-sm {
        padding: 4px 10px;
        font-size: 11px;
    }
}

.btn-block {
    width: 100%;
    display: block;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile browsers */
    max-height: 100vh;
    max-height: 100dvh;
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    transform: translateX(0);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

@media (min-width: 1024px) {
    .sidebar-header {
        padding: 10px 14px;
    }
}

.sidebar-logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    width: 45px;
    height: 45px;
    object-fit: contain;
    flex-shrink: 0;
}

@media (min-width: 1024px) {
    .sidebar-logo {
        width: 42px;
        height: 42px;
    }
}

.sidebar-header h2 {
    font-size: 24px;
    color: white;
    font-weight: 700;
    margin: 0;
}

@media (min-width: 1024px) {
    .sidebar-header h2 {
        font-size: 22px;
    }
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.sidebar-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: white;
    margin: 4px 0;
    transition: 0.3s;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.sidebar-nav ul {
    list-style: none;
    padding: 12px 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 1024px) {
    .sidebar-nav ul {
        padding: 10px 0;
    }
}

.sidebar-nav li {
    margin-bottom: 2px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    font-size: 14px;
}

@media (min-width: 1024px) {
    .sidebar-nav a {
        padding: 8px 14px;
        font-size: 13px;
    }
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.15);
    border-left-color: white;
    color: white;
}

.sidebar-nav a.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-left-color: white;
    font-weight: 600;
}

.nav-icon {
    font-size: 18px;
    margin-right: 10px;
    width: 20px;
    text-align: center;
    opacity: 0.9;
}

@media (min-width: 1024px) {
    .nav-icon {
        font-size: 16px;
        margin-right: 8px;
        width: 18px;
    }
}

.logout-btn {
    color: rgba(255, 255, 255, 0.9) !important;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.3) !important;
    color: white !important;
}

.sidebar-footer {
    width: 100%;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    margin-top: auto;
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-dark) 100%);
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    font-size: 14px;
}

@media (min-width: 1024px) {
    .sidebar-footer a {
        padding: 8px 14px;
        font-size: 13px;
    }
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.header {
    background: white;
    height: var(--header-height);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 100%;
}

@media (min-width: 1024px) {
    .header-content {
        padding: 0 16px;
    }
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-color);
    margin: 4px 0;
    transition: 0.3s;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-info h2 {
    font-size: 16px;
    font-weight: 600;
}

@media (min-width: 1024px) {
    .header-info h2 {
        font-size: 14px;
    }
}

.user-badge {
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.content-wrapper {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

@media (min-width: 1024px) {
    .content-wrapper {
        padding: 16px;
        max-width: 1200px;
    }
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

@media (min-width: 1024px) {
    .page-header {
        margin-bottom: 16px;
        gap: 10px;
    }
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-color);
}

@media (min-width: 1024px) {
    .page-header h1 {
        font-size: 20px;
    }
}

/* Alerts */
.alert {
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13px;
}

@media (min-width: 1024px) {
    .alert {
        padding: 8px 12px;
        margin-bottom: 12px;
        font-size: 12px;
        border-radius: 4px;
    }
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border-left: 4px solid var(--success-color);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border-left: 4px solid var(--danger-color);
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

@media (min-width: 1024px) {
    .card {
        padding: 14px;
        margin-bottom: 14px;
        border-radius: 6px;
    }
}

.card h2 {
    font-size: 18px;
    margin-bottom: 14px;
    color: var(--text-color);
}

@media (min-width: 1024px) {
    .card h2 {
        font-size: 16px;
        margin-bottom: 12px;
    }
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

@media (min-width: 1024px) {
    .stats-grid {
        gap: 12px;
        margin-bottom: 16px;
    }
}

@media (min-width: 640px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 14px;
}

@media (min-width: 1024px) {
    .stat-card {
        padding: 12px;
        gap: 12px;
        border-radius: 6px;
    }
}

.stat-icon {
    font-size: 32px;
}

@media (min-width: 1024px) {
    .stat-icon {
        font-size: 28px;
    }
}

.stat-info h3 {
    font-size: 26px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 2px;
}

@media (min-width: 1024px) {
    .stat-info h3 {
        font-size: 22px;
    }
}

.stat-info p {
    color: var(--text-muted);
    font-size: 13px;
}

@media (min-width: 1024px) {
    .stat-info p {
        font-size: 12px;
    }
}

/* Companies Grid */
.companies-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 1024px) {
    .companies-grid {
        gap: 12px;
    }
}

@media (min-width: 640px) {
    .companies-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .companies-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.company-card {
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}

@media (min-width: 1024px) {
    .company-card {
        padding: 14px;
        border-radius: 6px;
    }
}

.company-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.company-logo {
    margin-bottom: 16px;
    text-align: center;
}

.company-logo img {
    max-width: 120px;
    max-height: 120px;
    border-radius: 8px;
    object-fit: contain;
}

.company-info h3 {
    font-size: 18px;
    margin-bottom: 6px;
    color: var(--text-color);
}

@media (min-width: 1024px) {
    .company-info h3 {
        font-size: 16px;
        margin-bottom: 4px;
    }
}

.company-code {
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 12px;
}

.company-info p {
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--text-color);
}

.company-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

/* Users */
.users-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.company-users-section {
    background: white;
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: var(--shadow);
    margin-bottom: 12px;
}

.company-section-title {
    font-size: 16px;
    margin-bottom: 12px;
    color: var(--primary-color);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.users-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

@media (min-width: 640px) {
    .users-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

@media (min-width: 1024px) {
    .users-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 12px;
    }
}

.user-card {
    background: var(--light-color);
    border-radius: 6px;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

@media (max-width: 639px) {
    .user-card {
        flex-direction: column;
        align-items: flex-start;
    }
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-info h3 {
    font-size: 15px;
    margin-bottom: 4px;
    font-weight: 600;
}

.user-code {
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 12px;
}

.user-info p {
    font-size: 12px;
    margin-bottom: 3px;
    line-height: 1.4;
}

.user-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

@media (max-width: 639px) {
    .user-actions {
        width: 100%;
        margin-top: 8px;
    }
    
    .user-actions .btn {
        flex: 1;
    }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

@media (min-width: 1024px) {
    .modal-content {
        max-width: 550px;
        border-radius: 6px;
    }
}

.modal-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

@media (min-width: 1024px) {
    .modal-header {
        padding: 14px;
    }
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
}

@media (min-width: 1024px) {
    .modal-header h2 {
        font-size: 18px;
    }
}

.modal-close {
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text-color);
}

.modal-body {
    padding: 16px;
}

@media (min-width: 1024px) {
    .modal-body {
        padding: 14px;
    }
}

.modal-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

@media (min-width: 1024px) {
    .modal-footer {
        padding: 14px;
        gap: 8px;
    }
}

/* Invoice Form */
.invoice-form {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.form-section {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

@media (min-width: 1024px) {
    .form-section {
        margin-bottom: 20px;
        padding-bottom: 14px;
    }
}

.form-section:last-child {
    border-bottom: none;
}

.form-section h2 {
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--primary-color);
}

@media (min-width: 1024px) {
    .form-section h2 {
        font-size: 16px;
        margin-bottom: 12px;
    }
}

.table-responsive {
    overflow-x: auto;
    margin-bottom: 20px;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .table-responsive {
        margin-left: -15px;
        margin-right: -15px;
        padding: 0 15px;
    }
    
    .table-responsive .invoice-items-table {
        margin-bottom: 0;
    }
}

.invoice-items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    table-layout: auto;
}

@media (max-width: 768px) {
    .invoice-items-table {
        font-size: 15px;
        min-width: 800px;
    }
}

.invoice-items-table th,
.invoice-items-table td {
    padding: 16px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

@media (min-width: 640px) {
    .invoice-items-table th,
    .invoice-items-table td {
        padding: 12px 10px;
    }
}

@media (min-width: 1024px) {
    .invoice-items-table th,
    .invoice-items-table td {
        padding: 6px;
    }
}

.invoice-items-table th {
    background: var(--light-color);
    font-weight: 600;
    color: var(--text-color);
    font-size: 14px;
    padding: 14px 12px;
    white-space: nowrap;
    word-break: keep-all;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width: 640px) {
    .invoice-items-table th {
        font-size: 13px;
        padding: 12px 10px;
    }
}

@media (min-width: 1024px) {
    .invoice-items-table th {
        font-size: 11px;
        padding: 6px;
    }
}

.invoice-items-table input,
.invoice-items-table textarea {
    width: 100%;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 17px;
    font-family: inherit;
    resize: none;
    overflow: hidden;
    min-height: 56px;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.invoice-items-table textarea {
    line-height: 1.7;
    vertical-align: middle;
}

@media (min-width: 640px) {
    .invoice-items-table input,
    .invoice-items-table textarea {
        padding: 12px;
        font-size: 16px;
        min-height: 48px;
    }
}

@media (min-width: 1024px) {
    .invoice-items-table input,
    .invoice-items-table textarea {
        padding: 6px;
        font-size: 13px;
        min-height: 32px;
    }
}

.subtotals {
    max-width: 400px;
    margin-left: auto;
}

.subtotal-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

@media (min-width: 1024px) {
    .subtotal-row {
        padding: 6px 0;
        font-size: 13px;
    }
}

.total-row {
    font-size: 16px;
    font-weight: 700;
    border-bottom: 2px solid var(--text-color);
    padding-top: 12px;
}

@media (min-width: 1024px) {
    .total-row {
        font-size: 15px;
        padding-top: 10px;
    }
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* Filters */
.filters-card {
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

@media (min-width: 1024px) {
    .filters-card {
        padding: 14px;
        margin-bottom: 14px;
        border-radius: 6px;
    }
}

.filters-form {
    width: 100%;
}

.filter-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 1024px) {
    .filter-row {
        gap: 10px;
    }
}

@media (min-width: 768px) {
    .filter-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .filter-row {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.data-table thead {
    background: var(--primary-color);
    color: white;
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    text-align: left;
    font-size: 13px;
}

@media (min-width: 1024px) {
    .data-table th,
    .data-table td {
        padding: 8px 10px;
        font-size: 12px;
    }
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border-color);
}

.data-table tbody tr:hover {
    background: var(--light-color);
}

.actions-cell {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.text-center {
    text-align: center;
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

@media (min-width: 640px) {
    .quick-actions {
        grid-template-columns: repeat(4, 1fr);
    }
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--light-color);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.3s;
}

.action-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.action-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

/* Print Page */
.print-page {
    background: white;
}

.print-actions {
    padding: 20px;
    background: var(--light-color);
    border-bottom: 1px solid var(--border-color);
}

.invoice-print {
    max-width: 1000px;
    margin: 0 auto;
    padding: 30px;
    background: white;
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media print {
    .invoice-print {
        max-width: 100% !important;
        padding: 0 !important;
    }
}

/* Modern Grid Header - Company and Logo */
.invoice-header-grid {
    position: relative;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 3px solid var(--primary-color);
    min-height: auto;
}

.company-details-print {
    text-align: right;
    width: 100%;
}

.company-details-print h1 {
    font-size: 20px;
    margin-bottom: 5px;
    color: var(--primary-color);
    font-weight: 700;
    line-height: 1.3;
}

.company-details-print p {
    margin-bottom: 4px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-color);
    text-align: right;
}

.company-details-print p:last-child {
    margin-bottom: 0;
}

.company-logo-print {
    position: absolute;
    left: 0;
    bottom: 12px;
    top: auto;
    display: flex;
    justify-content: flex-start;
    align-items: flex-end;
    flex-shrink: 0;
    z-index: 1;
}

.company-logo-print img {
    width: 80px;
    height: 80px;
    max-width: 80px;
    max-height: 80px;
    object-fit: contain;
    display: block;
    border-radius: 8px;
}


/* Grid Layout for Customer and Billing Info */
.invoice-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 18px;
}

.info-box {
    padding: 0;
}

.info-box h3 {
    font-size: 13px;
    margin-bottom: 8px;
    color: var(--text-color);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.3;
}

.customer-details-print p,
.invoice-meta p {
    margin-bottom: 5px;
    font-size: 11px;
    line-height: 1.4;
    color: var(--text-color);
}

.customer-details-print p strong,
.invoice-meta p strong {
    font-weight: 700;
    color: var(--text-color);
    display: inline-block;
    min-width: 120px;
    text-align: left;
    vertical-align: top;
}

.invoice-section {
    margin-bottom: 15px;
}

.invoice-items-print {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background: white;
    border: 2px solid var(--text-color);
    border-radius: 0;
    box-shadow: none;
}

.invoice-items-print th,
.invoice-items-print td {
    padding: 6px 8px;
    text-align: left;
    border: 1px solid var(--text-color);
    font-size: 10px;
    vertical-align: top;
    border-collapse: collapse;
    line-height: 1.3;
}

.invoice-items-print th {
    padding: 7px 8px;
    font-size: 10px;
}

/* Proportional font sizing for invoice print */
.invoice-print {
    font-size: 12px;
}

.invoice-print .company-details-print h1 {
    font-size: 20px; /* 1.67x base */
}

.invoice-print .invoice-title-section h2 {
    font-size: 18px; /* 1.5x base */
}

.invoice-print .invoice-number {
    font-size: 12px; /* 1x base */
}

.invoice-print .info-box h3 {
    font-size: 13px; /* 1.08x base */
}

.invoice-print .customer-details-print p,
.invoice-print .invoice-meta p {
    font-size: 12px; /* 1x base */
}

.invoice-print .invoice-items-print th,
.invoice-print .invoice-items-print td {
    font-size: 10px;
}

.invoice-print .totals-row {
    font-size: 11px;
}

.invoice-print .total-bold,
.invoice-print .total-final {
    font-size: 12px;
}

.invoice-items-print td:nth-child(1),
.invoice-items-print td:nth-child(2) {
    max-width: 180px;
    word-wrap: break-word;
    white-space: normal;
    line-height: 1.3;
}

.invoice-items-print th {
    background: var(--light-color);
    color: var(--text-color);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    border: 1px solid var(--text-color);
}

.invoice-items-print tbody tr:hover {
    background: var(--light-color);
}

.invoice-items-print tbody tr:last-child td {
    border-bottom: none;
}

.invoice-totals {
    max-width: 380px;
    margin-left: auto;
    margin-top: 15px;
    padding: 0;
    border: 2px solid var(--text-color);
    background: white;
}

.totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    font-size: 11px;
    border-bottom: 1px solid var(--text-color);
    line-height: 1.4;
}

.totals-row:last-child {
    border-bottom: none;
}

.totals-row small {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: normal;
    line-height: 1.3;
}

.total-bold {
    font-size: 12px;
    font-weight: 500;
    padding-top: 8px;
    margin-top: 5px;
    color: var(--text-color);
}

.total-final {
    font-size: 12px;
    font-weight: 500;
    border-bottom: 2px solid var(--text-color);
    padding-top: 8px;
    margin-top: 5px;
    color: var(--text-color);
}

.totals-row:not(.total-final):not(.total-bold) {
    border-bottom: 1px solid var(--border-color);
}

.invoice-totals .due-amount {
    color: var(--danger-color);
    font-weight: 500;
    font-size: 13px;
}

.invoice-totals .due-amount span {
    color: var(--danger-color);
    font-weight: 500;
}

.invoice-totals .due-amount strong {
    font-weight: 500;
}

.due-amount {
    color: var(--danger-color);
    font-weight: 600;
}

.due-amount label,
.due-amount span {
    color: var(--danger-color);
}

.invoice-terms {
    margin-top: 15px;
    padding: 12px;
    border: 2px solid var(--text-color);
    background: white;
    box-sizing: border-box;
    width: 100%;
    display: block;
    min-height: auto;
}

.invoice-terms h3 {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    line-height: 1.3;
}

.terms-content {
    font-size: 10px;
    color: var(--text-color);
    line-height: 1.4;
    white-space: pre-wrap;
    text-align: left !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100%;
    display: block;
    min-height: auto;
    text-indent: 0 !important;
}

.invoice-footer {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
    text-align: center;
}

.invoice-footer p {
    font-size: 13px;
    color: var(--text-color);
    margin-bottom: 6px;
}

.footer-note {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    font-style: italic;
}

/* Print Specific Styles - Handled in print.css */

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height for mobile */
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .sidebar-nav {
        min-height: 0;
        flex: 1;
        display: flex;
        flex-direction: column;
        height: calc(100vh - var(--header-height));
        height: calc(100dvh - var(--header-height)); /* Dynamic viewport height */
    }
    
    .sidebar-nav ul {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .sidebar-footer {
        flex-shrink: 0;
        margin-top: auto;
    }
    
    .content-wrapper {
        padding: 20px 15px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .invoice-header-grid {
        position: relative !important;
        min-height: 150px !important;
        display: block !important;
    }
    
    .company-logo-print {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        z-index: 1 !important;
        width: auto !important;
    }
    
    .company-details-print {
        text-align: right !important;
        width: 100% !important;
        padding-left: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-right: 0 !important;
    }
    
    .company-details-print h1,
    .company-details-print p {
        text-align: right !important;
    }
    
    .invoice-title-section {
        text-align: left;
    }
    
    .invoice-info-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .invoice-items-table {
        font-size: 16px;
    }
    
    .invoice-items-table th,
    .invoice-items-table td {
        padding: 16px 12px !important;
        min-width: 90px;
    }
    
    .invoice-items-table th {
        font-size: 14px !important;
        padding: 14px 12px !important;
        font-weight: 700;
        white-space: nowrap !important;
        word-break: keep-all !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    
    .invoice-items-table input,
    .invoice-items-table textarea {
        padding: 16px !important;
        font-size: 17px !important;
        min-height: 56px !important;
        border-radius: 8px !important;
        line-height: 1.7 !important;
    }
    
    .invoice-items-table .item-name,
    .invoice-items-table .item-description {
        min-width: 150px;
    }
    
    .invoice-items-table .item-quantity {
        min-width: 100px;
    }
    
    .invoice-items-table .item-vat {
        min-width: 95px;
    }
    
    .invoice-items-table .item-unit-price {
        min-width: 120px;
    }
    
    .invoice-items-table .item-total {
        min-width: 120px;
    }
    
    .invoice-items-table .remove-item {
        padding: 10px 14px !important;
        font-size: 14px !important;
        white-space: nowrap;
        min-height: 56px;
    }
    
    .data-table {
        font-size: 12px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 4px;
    }
    
    .actions-cell {
        flex-direction: column;
    }
    
    .modal-content {
        max-width: 100%;
        margin: 10px;
    }
}

/* Utility Classes */
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

