/* ════════════════════════════════════════
   LeadGen Jacuzzi Pro — Style v2 (Full Mobile + UX)
   ════════════════════════════════════════ */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #1a5276;
    --primary-light: #2980b9;
    --accent: #3498db;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --bg: #f0f3f7;
    --card-bg: #ffffff;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --border: #e1e8ed;
    --sidebar-bg: #1a2332;
    --sidebar-text: #b0bec5;
    --sidebar-active: #2980b9;
    --selected-bg: #e8f4fd;
    --selected-border: #a8d4f0;
    --sidebar-w: 220px;
    --radius: 12px;
    --radius-sm: 8px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
}

html { -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ─── Sidebar ─── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 200;
    transition: transform 0.3s cubic-bezier(.4,0,.2,1);
    scrollbar-width: thin;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-size: 17px;
    font-weight: 700;
    color: #fff;
}
.logo small { font-size: 11px; font-weight: 400; color: var(--accent); display: block; }
.logo-icon { font-size: 26px; flex-shrink: 0; }

.nav-menu {
    list-style: none;
    padding: 8px 0;
}
.nav-menu li {
    padding: 11px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
    transition: all 0.15s;
    border-left: 3px solid transparent;
    white-space: nowrap;
}
.nav-menu li:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}
.nav-menu li.active {
    background: rgba(41,128,185,0.18);
    color: #fff;
    border-left-color: var(--accent);
    font-weight: 600;
}
.nav-menu li span.nav-icon { font-size: 16px; width: 22px; text-align: center; flex-shrink: 0; }
.nav-menu li .nav-label { overflow: hidden; text-overflow: ellipsis; }

/* ─── Mobile hamburger ─── */
.mobile-header {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 56px;
    background: var(--sidebar-bg);
    color: #fff;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    z-index: 300;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.mobile-header .logo-icon { font-size: 22px; }
.mobile-header .mobile-title { font-size: 16px; font-weight: 700; flex: 1; }
.hamburger {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; color: #fff;
    font-size: 24px; cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s;
}
.hamburger:hover { background: rgba(255,255,255,0.1); }

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 150;
    opacity: 0;
    transition: opacity 0.3s;
}
.sidebar-overlay.show { display: block; opacity: 1; }

/* ─── Content ─── */
.content {
    margin-left: var(--sidebar-w);
    padding: 28px 30px;
    flex: 1;
    min-width: 0;
    max-width: 100%;
}

.tab-content { display: none; animation: fadeIn 0.25s ease; }
.tab-content.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

h1 {
    font-size: 22px;
    margin-bottom: 18px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
h3 { font-size: 15px; margin-bottom: 14px; color: var(--primary); }

.subtitle {
    font-size: 13px;
    color: var(--text-light);
    margin: -12px 0 18px;
    line-height: 1.5;
}
.info-text {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.5;
    margin-bottom: 15px;
}

/* ─── Cards ─── */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.02);
}
.mt-10 { margin-top: 10px; }
.mt-15 { margin-top: 15px; }
.mt-20 { margin-top: 20px; }

.row { display: flex; gap: 20px; flex-wrap: wrap; }
.half { flex: 1; min-width: 280px; }
.third { flex: 1; min-width: 200px; }

.text-muted { color: var(--text-light); }

/* ─── Stats Grid ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px 14px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border-top: 3px solid var(--border);
    transition: transform 0.15s, box-shadow 0.15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.stat-card.accent { border-top-color: var(--accent); }
.stat-card.success { border-top-color: var(--success); }
.stat-card.warn { border-top-color: var(--warning); }
.stat-card.danger { border-top-color: var(--danger); }
.stat-value { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 11px; color: var(--text-light); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
    background: #eef2f7;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: var(--text);
}
.tag strong { color: var(--primary); margin-right: 3px; }

/* ─── Forms ─── */
.form-row { display: flex; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.form-group { flex: 1; min-width: 160px; }
.form-group.full-width { flex: 0 0 100%; min-width: 100%; }
.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.form-group label small { text-transform: none; font-weight: 400; opacity: .7; }

/* Source checkboxes grid */
.source-checkboxes {
    display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px;
}
.source-cb {
    display: flex; align-items: center; gap: 6px;
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 8px 14px;
    font-size: 13px; cursor: pointer; user-select: none;
    transition: all .15s;
    text-transform: none; font-weight: 500; letter-spacing: 0;
}
.source-cb:hover { border-color: var(--primary); background: rgba(99,102,241,.06); }
.source-cb input[type="checkbox"] { margin: 0; accent-color: var(--primary); width: 16px; height: 16px; }
.source-cb input[type="checkbox"]:checked + span,
.source-cb:has(input:checked) { border-color: var(--primary); background: rgba(99,102,241,.08); }
.source-cb small { font-size: 11px; opacity: .6; }

input[type="text"], input[type="number"], input[type="email"],
input[type="url"], input[type="password"], select, textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
    color: var(--text);
    -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(41,128,185,0.12);
}
input[type="file"] {
    padding: 8px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    background: #fafbfc;
    cursor: pointer;
    font-size: 13px;
}
input[type="file"]:hover {
    border-color: var(--accent);
    background: #f0f7ff;
}
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237f8c8d' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 9px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    background: #eef2f7;
    color: var(--text);
    white-space: nowrap;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: #e0e5ec; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #1e6091; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #219a52; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-sm { padding: 7px 12px; font-size: 12px; }
.btn-xs { padding: 4px 8px; font-size: 11px; border-radius: 6px; }
.btn-outline { background: transparent; border: 1px solid var(--border); }
.btn-outline:hover { background: #f8f9fb; }

.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* ─── Progress ─── */
.progress-bar {
    height: 6px;
    background: #e8ecf0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 14px;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--success));
    border-radius: 3px;
    width: 0%;
    transition: width 0.4s ease;
}

.log-box {
    background: #0d1117;
    color: #8bd5a0;
    padding: 14px;
    border-radius: var(--radius-sm);
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 12px;
    max-height: 350px;
    overflow-y: auto;
    line-height: 1.7;
    scrollbar-width: thin;
}
.log-box .log-error { color: #f97583; }
.log-box .log-success { color: #56d364; }
.log-box .log-info { color: #79c0ff; }
.log-box .log-warn { color: #e3b341; }

/* ─── Jacuzzi badge ─── */
.jacuzzi-badge { font-size: 0.85em; cursor: default; }
.jacuzzi-filter-group { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.jacuzzi-filter-cb { margin-top: 8px; font-weight: 600; color: #1a5276; }
.jacuzzi-filter-cb small { display: block; font-weight: 400; color: #666; font-size: 0.8em; margin-left: 18px; }

/* ─── Table ─── */
.toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    align-items: center;
}
.search-input {
    flex: 1;
    min-width: 180px;
}
.toolbar select {
    min-width: 0;
    max-width: 170px;
    font-size: 13px;
    padding: 8px 28px 8px 10px;
}

.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -22px;
    padding: 0 22px;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
th {
    background: #f8f9fb;
    padding: 9px 10px;
    text-align: left;
    font-weight: 600;
    color: var(--text-light);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
td {
    padding: 9px 10px;
    border-bottom: 1px solid #f0f2f5;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}
tr { transition: background 0.1s; }
tr:hover { background: #f8f9fb; }
tbody tr:last-child td { border-bottom: none; }

/* ─── Checkbox in table ─── */
.lead-checkbox, .check-all-box {
    width: 17px; height: 17px;
    cursor: pointer;
    accent-color: var(--accent);
    flex-shrink: 0;
}
td:first-child, th:first-child { width: 40px; text-align: center; }
tr.row-selected {
    background: var(--selected-bg) !important;
}
tr.row-selected td:first-child {
    box-shadow: inset 3px 0 0 var(--accent);
}

/* ─── Bulk actions bar ─── */
.bulk-actions-bar {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #1a5276, #2471a3);
    color: #fff;
    border-radius: var(--radius);
    margin-bottom: 12px;
    flex-wrap: wrap;
    animation: slideDown 0.25s ease;
}
#selected-count {
    font-weight: 700;
    font-size: 13px;
    padding: 3px 10px;
    background: rgba(255,255,255,0.18);
    border-radius: 6px;
    margin-right: 4px;
    white-space: nowrap;
}
.bulk-actions-bar .btn {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.18);
    padding: 6px 12px;
    font-size: 12px;
}
.bulk-actions-bar .btn:hover {
    background: rgba(255,255,255,0.25);
}
.bulk-actions-bar .btn-danger {
    background: rgba(231,76,60,0.75);
    border-color: rgba(231,76,60,0.4);
}

@keyframes slideDown {
    from { transform: translateY(-8px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ─── Table actions row ─── */
.table-actions-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.table-actions-row > div { display: flex; gap: 6px; flex-wrap: wrap; }

/* ─── Sortable columns ─── */
th.sortable {
    cursor: pointer;
    user-select: none;
}
th.sortable:hover { color: var(--primary); }
th.sortable::after {
    content: ' ⇅';
    font-size: 10px;
    opacity: 0.3;
}
th.sort-asc::after { content: ' ↑'; opacity: 1; color: var(--accent); }
th.sort-desc::after { content: ' ↓'; opacity: 1; color: var(--accent); }

/* ─── Source badges (color-coded) ─── */
.source-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.source-duckduckgo { background: #de5833; color: #fff; }
.source-google { background: #4285f4; color: #fff; }
.source-google-maps { background: #34a853; color: #fff; }
.source-bing { background: #00809d; color: #fff; }
.source-nocowanie { background: #2e7d32; color: #fff; }
.source-booking { background: #003580; color: #fff; }
.source-tripadvisor { background: #00af87; color: #fff; }
.source-eturysta { background: #ff9800; color: #fff; }
.source-hotels { background: #d32f2f; color: #fff; }
.source-trivago { background: #007faf; color: #fff; }
.source-kayak { background: #ff690f; color: #fff; }
.source-web { background: #78909c; color: #fff; }
.source-default { background: #e0e0e0; color: #555; }

/* Price badge */
.price-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #e8f5e9;
    color: #2e7d32;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

/* Email tooltip */
.email-tooltip-wrap { position: relative; display: inline-block; }
.email-tooltip-wrap .email-tooltip-content {
    display: none; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
    background: #2c3e50; color: #fff; padding: 8px 12px; border-radius: 6px; font-size: 11px;
    white-space: nowrap; z-index: 999; box-shadow: 0 2px 8px rgba(0,0,0,.3); min-width: 200px;
}
.email-tooltip-wrap .email-tooltip-content::after {
    content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
    border: 5px solid transparent; border-top-color: #2c3e50;
}
.email-tooltip-wrap:hover .email-tooltip-content { display: block; }

/* ─── Tag (small) ─── */
.tag-sm {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 10px;
    background: #e8f4fd;
    color: #2471a3;
    margin: 1px;
    font-weight: 600;
}

/* ─── Status badges ─── */
.status-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.status-new { background: #e8f4fd; color: #2980b9; }
.status-contact_found { background: #d5f5e3; color: #27ae60; }
.status-no_contact { background: #fdebd0; color: #e67e22; }
.status-emailed { background: #d4efdf; color: #1e8449; }
.status-bounced { background: #fadbd8; color: #e74c3c; }
.status-unsubscribed { background: #f2f3f4; color: #95a5a6; }
.status-interested { background: #abebc6; color: #145a32; }
.status-not_interested { background: #f5b7b1; color: #922b21; }
.status-replied { background: #aed6f1; color: #1b4f72; }
.status-sold { background: #fdebd0; color: #b7950b; border: 1px solid #f1c40f; }

/* ─── Pagination ─── */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 14px;
    align-items: center;
    flex-wrap: wrap;
}
.pagination button {
    padding: 6px 11px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.1s;
    min-width: 36px;
    text-align: center;
}
.pagination button:hover { background: #f0f3f7; }
.pagination button.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.pagination-info {
    font-size: 12px;
    color: var(--text-light);
    margin-right: 8px;
    width: 100%;
    text-align: center;
    margin-bottom: 6px;
}

/* ─── Modal ─── */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
    backdrop-filter: blur(2px);
}
.modal {
    background: #fff;
    border-radius: var(--radius);
    padding: 22px;
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    animation: modalIn 0.2s ease;
    scrollbar-width: thin;
}
.modal-sm { max-width: 380px; }

@keyframes modalIn {
    from { transform: scale(0.95) translateY(10px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-light);
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}
.modal-close:hover { background: #f0f3f7; color: var(--text); }

/* ─── Import area ─── */
.import-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    transition: all 0.2s;
}
.import-area:hover {
    border-color: var(--accent);
    background: #f0f7ff;
}
.import-area p {
    color: var(--text-light);
    font-size: 12px;
    margin-top: 8px;
}

#import-result, #test-email-result {
    margin-top: 10px;
    font-size: 13px;
}

/* ─── Email limit info ─── */
.email-limit-info {
    padding: 10px 14px;
    background: linear-gradient(135deg, #eef2f7, #e8f0fe);
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 14px;
    border-left: 3px solid var(--accent);
}

/* ─── Selected leads info ─── */
.selected-leads-info {
    padding: 10px 14px;
    background: #fef9e7;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 14px;
    border-left: 3px solid var(--warning);
}

/* ─── History tables ─── */
.history-section {
    margin-bottom: 24px;
}
.history-section h3 {
    border-bottom: 2px solid var(--border);
    padding-bottom: 8px;
}

/* ─── Email preview ─── */
#email-preview-box { margin-top: 15px; }
#email-preview-frame {
    width: 100%;
    min-height: 400px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

/* ─── Checkbox / toggle ─── */
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    margin: 8px 0;
    cursor: pointer;
}
.checkbox-row input[type="checkbox"] {
    width: 17px; height: 17px;
    accent-color: var(--accent);
    flex-shrink: 0;
}

/* ─── HR ─── */
hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 16px 0;
}

/* ─── Toast notifications ─── */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: calc(100vw - 32px);
}
.toast {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 13px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    animation: slideIn 0.3s ease;
    max-width: 340px;
    word-break: break-word;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--accent); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ─── Mobile cards for leads ─── */
.lead-cards-mobile {
    display: none;
}
.lead-card-m {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border-left: 3px solid transparent;
    transition: all 0.15s;
}
.lead-card-m.row-selected {
    background: var(--selected-bg);
    border-left-color: var(--accent);
}
.lead-card-m-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.lead-card-m-header .lead-checkbox { flex-shrink: 0; width: 20px; height: 20px; }
.lead-card-m-name {
    font-weight: 700;
    font-size: 14px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lead-card-m-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--text-light);
    align-items: center;
}
.lead-card-m-meta span { display: inline-flex; align-items: center; gap: 3px; }
.lead-card-m-contact {
    font-size: 13px;
    color: var(--text);
    margin-bottom: 8px;
    overflow-wrap: break-word;
    word-break: break-all;
    line-height: 1.6;
}
.lead-card-m-contact a { color: var(--accent); text-decoration: none; }
.lead-card-m-contact a:active { opacity: 0.7; }
.lead-card-m-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.lead-card-m-footer .btn-xs {
    min-height: 32px;
    min-width: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ════════════════════════════════════════
   RESPONSIVE — TABLET (< 1024px)
   ════════════════════════════════════════ */
@media (max-width: 1024px) {
    :root { --sidebar-w: 200px; }
    .content { padding: 20px; }
    .card { padding: 18px; }
    .toolbar select { max-width: 140px; }
    .stats-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
    .stat-value { font-size: 24px; }
    .half { min-width: 240px; }
    .third { min-width: 180px; }
    td { padding: 8px; max-width: 140px; }
    th { padding: 8px; }
}

/* ════════════════════════════════════════
   RESPONSIVE — MOBILE (< 768px)
   ════════════════════════════════════════ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        top: 0;
        padding-bottom: calc(20px + var(--safe-bottom));
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .mobile-header {
        display: flex;
        padding-top: calc(var(--safe-top));
        height: calc(56px + var(--safe-top));
    }

    .content {
        margin-left: 0;
        padding: calc(68px + var(--safe-top)) 14px calc(14px + var(--safe-bottom));
        padding-left: calc(14px + var(--safe-left));
        padding-right: calc(14px + var(--safe-right));
    }

    h1 { font-size: 18px; margin-bottom: 14px; }
    h3 { font-size: 14px; }
    .subtitle { font-size: 12px; margin: -8px 0 14px; }

    .card { padding: 14px; border-radius: 10px; }
    .row { gap: 12px; }
    .half, .third { min-width: 100%; flex-basis: 100%; }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .stat-card { padding: 12px 10px; }
    .stat-value { font-size: 22px; }
    .stat-label { font-size: 10px; }

    .form-row { flex-direction: column; gap: 10px; }
    .form-group { min-width: 100%; }

    /* Source checkboxes: scroll horizontally on small screens */
    .source-checkboxes {
        flex-wrap: wrap;
        gap: 6px;
    }
    .source-cb {
        padding: 7px 10px;
        font-size: 12px;
        flex: 0 0 auto;
    }
    .source-cb small { display: none; }

    /* Toolbar → stack filters properly */
    .toolbar {
        flex-direction: column;
        gap: 8px;
    }
    .toolbar .search-input { min-width: 100%; width: 100%; }
    .toolbar select { max-width: 100%; width: 100%; font-size: 14px; padding: 10px 30px 10px 12px; }
    .toolbar input { font-size: 14px; padding: 10px 12px; }

    /* Leads: table hidden, cards shown */
    .table-container { display: none; }
    .lead-cards-mobile { display: block; }

    /* Bulk bar: wrap tighter */
    .bulk-actions-bar {
        padding: 10px 12px;
        gap: 6px;
        border-radius: 10px;
        flex-wrap: wrap;
    }
    .bulk-actions-bar .btn { 
        padding: 8px 12px; 
        font-size: 12px; 
        flex: 1 1 auto;
        min-width: 0;
        justify-content: center;
    }
    #selected-count { 
        width: 100%; 
        text-align: center; 
        margin-bottom: 4px; 
        margin-right: 0; 
    }

    /* Table actions row */
    .table-actions-row {
        flex-direction: column;
        gap: 8px;
    }
    .table-actions-row > div { 
        width: 100%; 
        display: flex;
        gap: 6px;
    }
    .table-actions-row .btn { 
        flex: 1; 
        justify-content: center; 
        font-size: 12px; 
        padding: 10px 10px;
        min-height: 44px;
    }

    /* Pagination */
    .pagination { gap: 3px; }
    .pagination button { 
        padding: 8px 10px; 
        font-size: 13px; 
        min-width: 38px; 
        min-height: 38px;
    }
    .pagination-info { font-size: 11px; }

    /* Modal fullscreen on mobile */
    .modal-overlay { padding: 0; align-items: flex-end; }
    .modal { 
        padding: 20px; 
        padding-bottom: calc(20px + var(--safe-bottom));
        border-radius: 16px 16px 0 0; 
        max-height: 92vh;
        max-width: 100%;
        animation: modalSlideUp 0.3s ease;
    }
    .modal-sm { max-width: 100%; }

    @keyframes modalSlideUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    /* Bigger tap targets on mobile forms */
    .modal input, .modal select, .modal textarea {
        font-size: 16px !important;
        padding: 12px;
        min-height: 44px;
    }
    .modal .btn {
        min-height: 44px;
        font-size: 14px;
    }
    .modal .form-row {
        gap: 12px;
    }

    /* Log box */
    .log-box { max-height: 250px; font-size: 11px; padding: 10px; }

    /* Buttons bigger for touch */
    .btn { 
        padding: 10px 16px; 
        font-size: 13px; 
        min-height: 44px;
    }
    .btn-sm { padding: 8px 12px; font-size: 12px; min-height: 38px; }
    .btn-xs { padding: 6px 10px; font-size: 11px; min-height: 32px; }
    .btn-mobile-full { width: 100%; justify-content: center; }

    /* Submit buttons full width on mobile */
    #scraper-form .btn-primary,
    #settings-form .btn-primary,
    #btn-find-contacts,
    #btn-send-campaign,
    #btn-import-csv,
    #btn-export-full-csv {
        width: 100%;
        justify-content: center;
        min-height: 48px;
        font-size: 15px;
    }

    /* Toast */
    .toast-container { 
        right: 8px; 
        left: 8px; 
        top: calc(64px + var(--safe-top)); 
    }
    .toast { max-width: 100%; font-size: 14px; padding: 14px 18px; }

    /* Email preview */
    #email-preview-frame { min-height: 300px; }

    /* Progress bar section */
    .progress-bar { height: 8px; border-radius: 4px; }

    /* Jacuzzi filter checkbox */
    .jacuzzi-filter-cb {
        padding: 10px 14px !important;
        font-size: 14px !important;
    }

    /* History tables: scroll hint */
    .history-section .table-container {
        display: block;
        position: relative;
    }
    .history-section .table-container::after {
        content: '→ przewiń';
        position: absolute;
        top: 4px;
        right: 4px;
        font-size: 10px;
        color: var(--text-light);
        background: rgba(255,255,255,0.9);
        padding: 2px 6px;
        border-radius: 4px;
        pointer-events: none;
        opacity: 0.7;
    }

    /* Email section cards */
    .email-limit-info { font-size: 12px; }
    .selected-leads-info { font-size: 12px; }

    /* Settings form */
    #tab-settings .card { margin-bottom: 12px; }
}

/* ════════════════════════════════════════
   RESPONSIVE — SMALL PHONE (< 400px)
   ════════════════════════════════════════ */
@media (max-width: 400px) {
    .content { 
        padding: calc(62px + var(--safe-top)) 10px calc(10px + var(--safe-bottom)); 
        padding-left: calc(10px + var(--safe-left));
        padding-right: calc(10px + var(--safe-right));
    }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
    .stat-card { padding: 10px 8px; }
    .stat-value { font-size: 20px; }
    .card { padding: 12px; }
    .btn { padding: 10px 12px; font-size: 12px; }
    .btn-sm { padding: 8px 10px; font-size: 11px; }
    .lead-card-m { padding: 12px; }
    .lead-card-m-name { font-size: 13px; }
    h1 { font-size: 16px; }
    .source-cb { padding: 6px 8px; font-size: 11px; }
    
    /* Bulk actions: two per row */
    .bulk-actions-bar .btn {
        flex: 1 1 calc(50% - 4px);
        min-width: calc(50% - 4px);
    }
}
