        :root {
            --bg:#f4f4f4;--surface:#fff;--border:#e5e7eb;--text:#111827;
            --text-muted:#6b7280;--thead:#f9fafb;--row-hover:#f9fafb;
            --row-sel:rgba(255,220,0,0.18);--input-bg:#fff;--input-br:#d1d5db;
            --btn-bg:#e5e7eb;--log-bg:#111;--log-text:#00ff00;
            --shadow:0 1px 4px rgba(0,0,0,0.06);
        }
        [data-theme="dark"] {
            --bg:#0f172a;--surface:#1e293b;--border:#334155;--text:#f1f5f9;
            --text-muted:#94a3b8;--thead:#1e293b;--row-hover:#263347;
            --row-sel:rgba(255,220,0,0.10);--input-bg:#0f172a;--input-br:#475569;
            --btn-bg:#334155;--log-bg:#0a0a0a;--log-text:#00ff00;
            --shadow:0 1px 4px rgba(0,0,0,0.3);
            color-scheme:dark;
        }
        [data-theme="dark"], [data-theme="dark"] * {
            scrollbar-color:#475569 #111827;
            scrollbar-width:thin;
        }
        [data-theme="dark"] ::-webkit-scrollbar { width:10px;height:10px; }
        [data-theme="dark"] ::-webkit-scrollbar-track { background:#111827; }
        [data-theme="dark"] ::-webkit-scrollbar-thumb {
            background:#475569;
            border:2px solid #111827;
            border-radius:999px;
        }
        [data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background:#64748b; }
        [data-theme="dark"] ::-webkit-scrollbar-corner { background:#111827; }
        [data-theme="dark"] input[type="checkbox"] {
            appearance:none;
            -webkit-appearance:none;
            width:15px;
            height:15px;
            min-width:13px;
            min-height:13px;
            display:inline-grid;
            place-content:center;
            border:1px solid #64748b;
            border-radius:3px;
            background:#111827;
            vertical-align:middle;
            cursor:pointer;
        }
        [data-theme="dark"] input[type="checkbox"]::before {
            content:"";
            width:0.58em;
            height:0.58em;
            transform:scale(0);
            transition:transform .08s ease-in-out;
            background:#f8fafc;
            clip-path:polygon(14% 44%,0 59%,40% 100%,100% 20%,84% 5%,39% 70%);
        }
        [data-theme="dark"] input[type="checkbox"]:checked {
            background:#16a34a;
            border-color:#22c55e;
        }
        [data-theme="dark"] input[type="checkbox"]:checked::before { transform:scale(1); }
        [data-theme="dark"] input[type="checkbox"]:focus-visible {
            outline:2px solid #60a5fa;
            outline-offset:2px;
        }
        [data-theme="dark"] input[type="checkbox"]:disabled { opacity:.5;cursor:not-allowed; }
        *{box-sizing:border-box;margin:0;padding:0;}
        body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
            background:var(--bg);color:var(--text);font-size:14px;
            transition:background 0.2s,color 0.2s;}
        .container { max-width: 95%; margin: 0 auto; padding: 24px; padding-top: 0px; }

        .topbar{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px;}
        h1{font-size:22px;font-weight:700;}
        .theme-toggle{background:var(--btn-bg);border:1px solid var(--border);color:var(--text);
            padding:6px 14px;border-radius:20px;cursor:pointer;font-size:13px;font-weight:500;}

        .tabs{display:flex;gap:4px;margin-bottom:20px;border-bottom:2px solid var(--border);}
        .tab-btn{padding:8px 18px;border:none;background:none;color:var(--text-muted);
            font-size:14px;font-weight:500;cursor:pointer;border-bottom:2px solid transparent;
            margin-bottom:-2px;border-radius:0;transition:color 0.15s;}
        .tab-btn.active{color:var(--text);border-bottom-color:#3b82f6;font-weight:600;}
        .tab-btn:hover{color:var(--text);}
        .tab-btn-right-start{margin-left:auto;}
        .tab-content{display:none;}
        .tab-content.active{display:block;}
        #tab-pour.active{padding-bottom:24px;}
        #tab-creatives.active{padding-bottom:110px;}
        body.pour-active .bottom-bar{display:none!important;}

        .filters{display:flex;gap:10px;margin-bottom:16px;flex-wrap:wrap;align-items:center;}
        .filters input{padding:8px 12px;border:1px solid var(--input-br);border-radius:7px;
            font-size:14px;outline:none;background:var(--input-bg);color:var(--text);}
        .filters input:focus{border-color:#6366f1;}
        #prefixInput{width:200px;}
        .filters span{font-size:13px;color:var(--text-muted);}

        table{width:100%;background:var(--surface);border-collapse:collapse;
            border-radius:10px;overflow:hidden;box-shadow:var(--shadow);}
        th,td{padding:10px 12px;text-align:left;border-bottom:1px solid var(--border);font-size:14px;}
        th{background:var(--thead);font-weight:600;user-select:none;}
        tr:hover td{background:var(--row-hover);}
        tr.selected td{background:var(--row-sel)!important;}
        .status-1{color:#16a34a;font-weight:600;}
        .status-0{color:#dc2626;font-weight:600;}
        .status-null{color:var(--text-muted);}
        .log-cell{font-size:12px;color:var(--text-muted);width:260px;min-width:260px;max-width:260px;
            overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}
        .log-cell.running{color:#3b82f6;}
        .log-cell.done{color:#16a34a;}
        .log-cell.error{color:#dc2626;}
        .name-input{border:1px solid transparent;border-radius:5px;padding:3px 7px;
            font-size:14px;width:120px;background:transparent;color:var(--text);}
        .name-input:focus{border-color:var(--input-br);background:var(--input-bg);outline:none;}
        .name-input:disabled{opacity:0.5;}
        .delete-btn{background:none;border:none;cursor:pointer;color:#dc2626;padding:3px 6px;
            border-radius:4px;font-size:15px;opacity:0.35;transition:opacity 0.15s;}
        .delete-btn:hover{opacity:1;background:#fee2e2;}
        .running-dot{text-align:center;font-size:14px;width:36px;}
        .running-port{font-size:12px;color:var(--text-muted);width:60px;}

        .log-section{margin-top:24px;}
        .log-search{display:flex;align-items:center;gap:8px;margin-bottom:8px;}
        .log-search input{padding:7px 12px;border:1px solid #333;border-radius:6px;
            background:#222;color:#0f0;font-size:13px;outline:none;width:280px;}
        .log-search input::placeholder{color:#555;}
        .log-search button{padding:6px 12px;background:#333;color:#ccc;border:1px solid #444;
            border-radius:6px;font-size:13px;cursor:pointer;}
        .log-search span{font-size:13px;color:var(--text-muted);}
        #globalLog{background:var(--log-bg);color:var(--log-text);padding:16px;border-radius:8px;
            font-size:12px;white-space:pre-wrap;max-height:320px;overflow-y:auto;}
        #globalLog .highlight{background:#ff0;color:#000;border-radius:2px;}

        /* Settings */
        .settings-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(360px,1fr));gap:20px;}
        .config-card{background:var(--surface);border:1px solid var(--border);
            border-radius:10px;padding:20px;box-shadow:var(--shadow);}
        .config-card h3{font-size:15px;font-weight:600;margin-bottom:16px;}
        .config-field{margin-bottom:12px;}
        .config-field label{display:block;font-size:12px;color:var(--text-muted);
            margin-bottom:4px;font-weight:500;}
        .config-field input,.config-field select,.config-field textarea{
            width:100%;padding:7px 10px;border:1px solid var(--input-br);border-radius:6px;
            font-size:13px;background:var(--input-bg);color:var(--text);outline:none;}
        .config-field input:focus,.config-field select:focus,.config-field textarea:focus{border-color:#6366f1;}

        /* Dynamic textarea list */
        .textarea-list{display:flex;flex-direction:column;gap:6px;}
        .textarea-item{display:flex;gap:6px;align-items:flex-start;}
        .textarea-item textarea{flex:1;padding:7px 10px;border:1px solid var(--input-br);
            border-radius:6px;font-size:13px;background:var(--input-bg);color:var(--text);
            outline:none;resize:vertical;min-height:52px;font-family:inherit;}
        .textarea-item textarea:focus{border-color:#6366f1;}
        .textarea-item .remove-btn{background:#fee2e2;border:none;color:#dc2626;
            border-radius:6px;padding:5px 8px;cursor:pointer;font-size:14px;flex-shrink:0;margin-top:1px;}
        .textarea-item .remove-btn:hover{background:#fecaca;}
        .add-item-btn{display:flex;align-items:center;gap:6px;padding:6px 12px;
            background:var(--btn-bg);border:1px dashed var(--border);color:var(--text-muted);
            border-radius:6px;cursor:pointer;font-size:13px;width:100%;justify-content:center;
            margin-top:4px;transition:all 0.15s;}
        .add-item-btn:hover{color:var(--text);border-color:var(--input-br);}

        .config-save-btn{width:100%;padding:8px;background:#3b82f6;color:white;border:none;
            border-radius:7px;font-size:13px;font-weight:600;cursor:pointer;margin-top:4px;}
        .config-save-btn:hover{background:#2563eb;}
        .config-saved{color:#16a34a;font-size:12px;margin-top:6px;display:none;}

        /* Bottom bar */
        .bottom-bar{position:fixed;bottom:0;left:0;right:0;background:var(--surface);
            border-top:1px solid var(--border);padding:10px 20px;display:flex;gap:8px;
            align-items:center;justify-content:center;flex-wrap:wrap;
            box-shadow:0 -2px 10px rgba(0,0,0,0.06);}
        .bottom-bar .divider{width:1px;height:28px;background:var(--border);margin:0 4px;}
        button{padding:7px 14px;border:none;border-radius:7px;cursor:pointer;
            font-size:13px;font-weight:600;transition:opacity 0.15s,transform 0.1s;}
        button:hover{opacity:0.85;}
        button:active{transform:scale(0.97);}
        .btn-black{background:#111;color:white;}
        .btn-white{background:var(--surface);color:var(--text);border:1px solid var(--border);}
        .btn-fill{background:#3b82f6;color:white;}
        .btn-select{background:var(--btn-bg);color:var(--text);border:1px solid var(--border);}
        .btn-reload{background:var(--btn-bg);color:var(--text);border:1px solid var(--border);}
        .btn-clear{background:#fee2e2;color:#dc2626;}
        [data-theme="dark"] .btn-clear{
            background:#3f171c;
            color:#fca5a5;
            border:1px solid #7f1d1d;
        }
        [data-theme="dark"] .btn-clear:hover{background:#551c23;}
        [data-theme="dark"] .colibrix-config{
            background:#141c2c!important;
            border-color:#633047!important;
            box-shadow:0 1px 4px rgba(0,0,0,.28)!important;
        }
        [data-theme="dark"] .colibrix-config>label{color:#f0a3c4!important;}
        [data-theme="dark"] .colibrix-action{
            background:#1e293b!important;
            color:#f0a3c4!important;
            border-color:#70405a!important;
        }
        [data-theme="dark"] .colibrix-action:hover{background:#29364b!important;}
        [data-theme="dark"] .colibrix-result{
            background:#0f172a!important;
            border-color:#633047!important;
        }
        [data-theme="dark"] .colibrix-result textarea{
            background:#111827!important;
            color:#e2e8f0!important;
            border-color:#475569!important;
        }
        [data-theme="dark"] .colibrix-result button{
            background:#1e293b!important;
            color:#f0a3c4!important;
            border-color:#70405a!important;
        }
        [data-theme="dark"] #bulk-edit-modal [style*="background:#fff"]{
            background:#111827!important;
            color:#e2e8f0!important;
            border-color:#475569!important;
            box-shadow:none!important;
        }
        [data-theme="dark"] #bulk-edit-modal button[style*="background:#fff"]:hover{
            background:#1e293b!important;
        }
        .btn-combo{background:#7c3aed;color:white;font-size:12px;padding:7px 12px;}
        .selected-count{font-size:14px;color:var(--text-muted);margin-right:4px;}
        .spinner{display:none;width:18px;height:18px;border:2px solid var(--border);
            border-top-color:#3b82f6;border-radius:50%;animation:spin 0.6s linear infinite;}
            .btn-farm { background: #16a34a; color: white; }
        @keyframes spin{to{transform:rotate(360deg);}}
        .start-btn, .stop-btn {
            background: none; border: none; cursor: pointer;
            padding: 3px 6px; border-radius: 4px;
            font-size: 14px; opacity: 0.4; transition: opacity 0.15s;
        }
        .start-btn { color: #16a34a; }
        .start-btn:hover { opacity: 1; background: #dcfce7; }
        .stop-btn  { color: #dc2626; }
        .stop-btn:hover  { opacity: 1; background: #fee2e2; }
        .btn-start-all { background: #16a34a; color: white; }
        .btn-stop-all  { background: #dc2626; color: white; }
        .btn-check-ads { background: #f59e0b; color: white; }
        .btn-delete-campaigns { background: #dc2626; color: white; }
        .btn-delete-posts { background: #dc2626; color: white; }
        .drop-zone {
            border: 2px dashed var(--border);
            border-radius: 8px;
            padding: 20px;
            text-align: center;
            cursor: pointer;
            transition: all 0.2s;
            background: var(--input-bg);
        }
        .drop-zone:hover, .drop-zone.dragover {
            border-color: #3b82f6;
            background: rgba(59,130,246,0.05);
        }
        .drop-zone-text { font-size: 13px; color: var(--text-muted); }
        .count-selected-profiles{
            padding: 5px 10px;
            color: white;
            background: #3b82f6;
            border-radius: 5px;
        }
        .tabs {
    position: sticky;
    top: 0;
    z-index: 99;
    background: var(--bg);
    padding-bottom: 0;
    margin-bottom: 20px;
}
.btn-premium { background: #1d9bf0; color: white; }


.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.open {
    display: flex;
}
.modal {
    background: var(--surface);
    border-radius: 12px;
    padding: 28px;
    min-width: 400px;
    max-width: 500px;
    width: 100%;
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}
.modal-title {
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 24px;
    color: var(--text);
}
.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 6px;
}
.modal-close:hover { background: var(--btn-bg); }
.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 24px;
}

.table-wrapper {
    height: 74vh;
    overflow-y: auto;
    border-radius: 10px;
    box-shadow: var(--shadow);
    flex-shrink: 0;
}



.table-wrapper table {
    border-radius: 0;
    box-shadow: none;
}

.table-wrapper thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--thead);
}

#pourLogSection {
    scroll-margin-bottom: calc(var(--bottom-bar-clearance, 90px) + 12px);
}


#scroll-top-left, #scroll-top-right,
#scroll-bottom-left, #scroll-bottom-right {
    display: flex !important;
}

.profile-cb {
    width: 22px;
    height: 22px;
    cursor: pointer;
    vertical-align: middle;
}

.topbar {
    display: flex;
    align-items: center;
    position: relative;
}

.topbar h1 {
    
}

.theme-toggle {
    margin-left: auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes queue-dot-spin {
    to { transform: rotate(360deg); }
}

.queue-dot-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    box-sizing: border-box;
    border: 2px solid rgba(245, 158, 11, 0.28);
    border-top-color: #f59e0b;
    border-radius: 50%;
    animation: queue-dot-spin 0.75s linear infinite;
    vertical-align: middle;
}
