/* CSLine Invoicing - Modern Luxury Theme - Fully Mobile Responsive */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:wght@400;600;700&display=swap');

:root {
    --primary: #1a1a2e;
    --primary-light: #16213e;
    --accent: #c9a84c;
    --accent-hover: #b8933d;
    --accent-light: rgba(201, 168, 76, 0.1);
    --bg: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-card-hover: #1e1e35;
    --bg-input: #12121f;
    --text: #e8e8ef;
    --text-muted: #8888a0;
    --text-light: #b0b0c0;
    --border: #2a2a40;
    --border-light: #3a3a55;
    --success: #2ecc71;
    --danger: #e74c3c;
    --warning: #f39c12;
    --info: #3498db;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.4);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-width: 260px;
    --mobile-header-height: 60px;
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

body.sidebar-open { overflow: hidden; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

/* Layout */
.app-wrapper { display: flex; min-height: 100vh; }

/* Mobile Header - Hidden on desktop */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--mobile-header-height);
    background: var(--primary);
    border-bottom: 1px solid var(--border);
    z-index: 200;
    padding: 0 16px;
    align-items: center;
    justify-content: space-between;
}

.menu-toggle {
    background: none;
    border: none;
    color: var(--text);
    font-size: 22px;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-brand .logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: var(--primary);
}

.mobile-brand span {
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    color: var(--accent);
    font-weight: 600;
}

.mobile-logout {
    color: var(--text-muted);
    font-size: 20px;
    padding: 8px;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 150;
    backdrop-filter: blur(4px);
}

.sidebar-overlay.active { display: block; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--primary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 200;
    transition: var(--transition);
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    margin-left: auto;
}

.sidebar-brand {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand .logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: var(--primary);
    flex-shrink: 0;
}

.sidebar-brand h2 {
    font-family: 'Playfair Display', serif;
    font-size: 20px;
    color: var(--accent);
    font-weight: 600;
}

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

.nav-section { margin-bottom: 24px; }

.nav-section-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    padding: 0 12px;
    margin-bottom: 8px;
    font-weight: 600;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    color: var(--text-light);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-size: 14px;
    font-weight: 400;
    margin-bottom: 2px;
}

.nav-link:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.nav-link.active {
    background: linear-gradient(135deg, rgba(201,168,76,0.15), rgba(201,168,76,0.05));
    color: var(--accent);
    font-weight: 500;
}

.nav-link .icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

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

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: var(--primary);
    flex-shrink: 0;
}

.user-details { flex: 1; min-width: 0; }
.user-details .name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-details .role { font-size: 11px; color: var(--text-muted); }

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px;
    max-width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 28px;
    font-weight: 600;
    color: var(--text);
}

.page-header .subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: var(--primary);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(201,168,76,0.3); }

.btn-secondary {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

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

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }

.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    margin-bottom: 24px;
}

.card:hover { border-color: var(--border-light); }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
    flex-wrap: wrap;
}

.card-header h2, .card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), transparent);
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 12px;
}

.stat-card .stat-icon.gold { background: rgba(201,168,76,0.15); color: var(--accent); }
.stat-card .stat-icon.green { background: rgba(46,204,113,0.15); color: var(--success); }
.stat-card .stat-icon.red { background: rgba(231,76,60,0.15); color: var(--danger); }
.stat-card .stat-icon.blue { background: rgba(52,152,219,0.15); color: var(--info); }

.stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
    font-family: 'Playfair Display', serif;
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    margin: -4px;
    padding: 4px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

table th {
    background: var(--bg);
    padding: 12px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

table td {
    padding: 12px 14px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    color: var(--text-light);
}

table tbody tr { transition: var(--transition); }
table tbody tr:hover { background: var(--bg-card-hover); }

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    text-transform: capitalize;
    white-space: nowrap;
}

.badge-paid { background: rgba(46,204,113,0.15); color: var(--success); }
.badge-sent { background: rgba(52,152,219,0.15); color: var(--info); }
.badge-draft { background: rgba(136,136,160,0.15); color: var(--text-muted); }
.badge-overdue { background: rgba(231,76,60,0.15); color: var(--danger); }
.badge-cancelled { background: rgba(136,136,160,0.1); color: #666; }

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

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 16px; /* Prevents zoom on iOS */
    font-family: 'Inter', sans-serif;
    transition: var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(201,168,76,0.1);
}

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238888a0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control { resize: vertical; min-height: 100px; }

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

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    overflow-y: auto;
    backdrop-filter: blur(4px);
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 100%;
    max-width: 600px;
    margin: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 18px; font-weight: 600; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}
.modal-close:hover { color: var(--text); }

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    position: relative;
    overflow: hidden;
    padding: 20px;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(201,168,76,0.08), transparent 70%);
    top: -100px;
    right: -100px;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(201,168,76,0.05), transparent 70%);
    bottom: -100px;
    left: -100px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
}

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

.login-card .brand .logo-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 24px;
    color: var(--primary);
    margin: 0 auto 16px;
}

.login-card .brand h1 {
    font-family: 'Playfair Display', serif;
    font-size: 28px;
    color: var(--accent);
}

.login-card .brand p {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 8px;
}

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

.login-card .btn-primary {
    width: 100%;
    padding: 14px;
    font-size: 15px;
}

.error-msg {
    background: rgba(231,76,60,0.1);
    border: 1px solid rgba(231,76,60,0.3);
    color: var(--danger);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 20px;
}

.success-msg {
    background: rgba(46,204,113,0.1);
    border: 1px solid rgba(46,204,113,0.3);
    color: var(--success);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 20px;
}

/* Invoice View */
.invoice-paper {
    background: #ffffff;
    color: #333;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.invoice-paper .inv-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 2px solid #c9a84c;
    gap: 20px;
    flex-wrap: wrap;
}

.invoice-paper .company-logo img {
    max-height: 50px;
    margin-bottom: 8px;
}

.invoice-paper .company-info h2 {
    font-family: 'Playfair Display', serif;
    font-size: 20px;
    color: #1a1a2e;
    margin-bottom: 4px;
}

.invoice-paper .company-info p {
    font-size: 12px;
    color: #666;
    line-height: 1.5;
}

.invoice-paper .inv-title { text-align: right; }

.invoice-paper .inv-title h1 {
    font-family: 'Playfair Display', serif;
    font-size: 28px;
    color: #c9a84c;
    margin-bottom: 10px;
}

.invoice-paper .inv-title .inv-meta {
    font-size: 12px;
    color: #666;
}

.invoice-paper .inv-title .inv-meta strong { color: #333; }

.invoice-paper .inv-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.invoice-paper .party-block h4 {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #999;
    margin-bottom: 8px;
}

.invoice-paper .party-block .party-name {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 4px;
}

.invoice-paper .party-block p {
    font-size: 12px;
    color: #666;
    line-height: 1.5;
}

.invoice-paper table { margin-bottom: 24px; min-width: 100%; }

.invoice-paper table th {
    background: #f8f6f1;
    color: #1a1a2e;
    padding: 10px 12px;
    font-size: 10px;
    border-bottom: 2px solid #c9a84c;
}

.invoice-paper table td {
    padding: 10px 12px;
    font-size: 12px;
    color: #444;
    border-bottom: 1px solid #eee;
}

.invoice-paper .inv-summary {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 30px;
}

.invoice-paper .summary-table { width: 250px; }

.invoice-paper .summary-table .row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
    color: #555;
}

.invoice-paper .summary-table .row.total {
    border-top: 2px solid #c9a84c;
    margin-top: 8px;
    padding-top: 10px;
    font-size: 16px;
    font-weight: 700;
    color: #1a1a2e;
}

.invoice-paper .inv-bank {
    background: #f8f6f1;
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.invoice-paper .inv-bank h4 {
    font-size: 12px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 6px;
}

.invoice-paper .inv-bank p {
    font-size: 12px;
    color: #555;
}

.invoice-paper .inv-notes {
    font-size: 11px;
    color: #888;
    line-height: 1.6;
    padding-top: 14px;
    border-top: 1px solid #eee;
}

/* Charts */
.chart-container {
    position: relative;
    min-height: 250px;
    width: 100%;
}

/* Grid Layouts */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }

/* Filters */
.filters-bar { margin-bottom: 24px; }

.filters-bar form {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.filters-bar .filter-group {
    flex: 1;
    min-width: 120px;
}

.filters-bar .filter-group .form-control { width: 100%; }

/* Actions */
.actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.pagination a, .pagination span {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 13px;
    color: var(--text-muted);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .active { background: var(--accent); color: var(--primary); border-color: var(--accent); }

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab {
    padding: 12px 20px;
    font-size: 14px;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Amount formatting */
.amount { font-variant-numeric: tabular-nums; font-weight: 500; }
.amount-positive { color: var(--success); }
.amount-negative { color: var(--danger); }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state .icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; color: var(--text-light); }
.empty-state p { font-size: 14px; margin-bottom: 24px; }

/* Print */
@media print {
    .sidebar, .mobile-header, .page-header .btn, .no-print, .sidebar-overlay { display: none !important; }
    .main-content { margin-left: 0 !important; padding: 0 !important; max-width: 100% !important; }
    .invoice-paper { box-shadow: none; padding: 20px; }
    body { background: #fff; }
}

/* ========== MOBILE RESPONSIVE ========== */

/* Tablets and smaller */
@media (max-width: 1024px) {
    .main-content { padding: 24px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* Mobile devices */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 280px;
    }

    /* Show mobile header */
    .mobile-header { display: flex; }

    /* Hide sidebar by default, show on toggle */
    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }

    .sidebar.open { transform: translateX(0); }

    .sidebar-close { display: block; }

    .sidebar-brand {
        padding: 20px 16px;
    }

    /* Main content adjustments */
    .main-content {
        margin-left: 0;
        max-width: 100%;
        padding: 16px;
        padding-top: calc(var(--mobile-header-height) + 16px);
    }

    /* Page header */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 20px;
    }

    .page-header h1 { font-size: 22px; }

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

    .stat-card {
        padding: 16px;
    }

    .stat-card .stat-value { font-size: 20px; }
    .stat-card .stat-icon { width: 36px; height: 36px; font-size: 16px; }

    /* Cards */
    .card { padding: 16px; }
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    /* Forms */
    .form-row { grid-template-columns: 1fr; gap: 12px; }
    .form-group { margin-bottom: 16px; }

    /* Tables - make scrollable */
    .table-wrapper { margin: 0 -16px; padding: 0 16px; }

    /* Buttons */
    .btn { padding: 10px 16px; font-size: 13px; }
    .btn-sm { padding: 8px 12px; font-size: 12px; }

    /* Filters */
    .filters-bar form {
        flex-direction: column;
        align-items: stretch;
    }

    .filters-bar .filter-group {
        min-width: 100%;
    }

    /* Invoice paper */
    .invoice-paper {
        padding: 20px;
        margin: 0 -16px;
        border-radius: 0;
    }

    .invoice-paper .inv-header {
        flex-direction: column;
        text-align: left;
    }

    .invoice-paper .inv-title {
        text-align: left;
    }

    .invoice-paper .inv-title h1 { font-size: 24px; }

    .invoice-paper .inv-parties {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .invoice-paper .inv-summary {
        justify-content: stretch;
    }

    .invoice-paper .summary-table {
        width: 100%;
    }

    /* Modal */
    .modal-overlay { padding: 10px; }
    .modal {
        padding: 20px;
        max-height: calc(100vh - 20px);
    }

    /* Actions */
    .actions {
        flex-wrap: wrap;
    }

    /* Pagination */
    .pagination {
        gap: 2px;
    }

    .pagination a, .pagination span {
        padding: 8px 10px;
        font-size: 12px;
    }

    /* Charts */
    .chart-container { min-height: 200px; }

    /* Tabs */
    .tabs { margin: 0 -16px 20px; padding: 0 16px; }
    .tab { padding: 10px 16px; font-size: 13px; }
}

/* Small phones */
@media (max-width: 400px) {
    .stats-grid { grid-template-columns: 1fr; }

    .stat-card {
        display: flex;
        align-items: center;
        gap: 16px;
        padding: 14px;
    }

    .stat-card .stat-icon { margin-bottom: 0; }

    .stat-card .stat-content { flex: 1; }

    .page-header h1 { font-size: 20px; }

    .login-card { padding: 24px; }
    .login-card .brand h1 { font-size: 24px; }
    .login-card .brand .logo-icon { width: 50px; height: 50px; font-size: 20px; }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .btn { min-height: 44px; }
    .nav-link { min-height: 48px; }
    .form-control { min-height: 48px; }

    table td, table th {
        padding: 14px 12px;
    }
}
