/* ============== Variables ============== */
:root {
    --bg-primary: #0b0e17;
    --bg-secondary: #111520;
    --bg-card: rgba(17, 21, 32, 0.85);
    --bg-glass: rgba(17, 24, 39, 0.6);

    --text-primary: #e8eaed;
    --text-secondary: #9ca3af;
    --text-muted: #4b5563;

    --accent-primary: #00e5c7;
    --accent-primary-dim: rgba(0, 229, 199, 0.15);
    --accent-primary-hover: #33ecd5;
    --accent-success: #34d399;
    --accent-warning: #fbbf24;
    --accent-danger: #f87171;

    --border-color: rgba(255, 255, 255, 0.06);
    --border-accent: rgba(0, 229, 199, 0.2);
    --shadow-color: rgba(0, 0, 0, 0.5);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    --font-body: 'DM Sans', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Consolas', monospace;
}

/* ============== Reset & Base ============== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Noise texture overlay */
.noise-overlay {
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 9999;
    opacity: 0.4;
}

/* Ambient glow */
body::before {
    content: '';
    position: fixed;
    top: -20%;
    left: -10%;
    width: 60%;
    height: 60%;
    background: radial-gradient(ellipse, rgba(0, 229, 199, 0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

body::after {
    content: '';
    position: fixed;
    bottom: -20%;
    right: -10%;
    width: 50%;
    height: 50%;
    background: radial-gradient(ellipse, rgba(251, 191, 36, 0.03) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

/* ============== Utilities ============== */
.glass {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 24px var(--shadow-color);
}

/* ============== Header ============== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0.875rem 2rem;
    background: rgba(11, 14, 23, 0.9);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--accent-primary-dim);
    color: var(--accent-primary);
}

.logo {
    font-family: var(--font-mono);
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    font-size: 0.8rem;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.status-dot.online {
    background: var(--accent-success);
    box-shadow: 0 0 8px var(--accent-success);
    animation: pulse 2.5s ease-in-out infinite;
}

.status-dot.offline {
    background: var(--accent-danger);
    box-shadow: 0 0 6px rgba(248, 113, 113, 0.4);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ============== Buttons ============== */
.btn {
    padding: 0.55rem 1.1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    line-height: 1;
}

.btn svg {
    flex-shrink: 0;
}

.btn-primary {
    background: var(--accent-primary);
    color: #0b0e17;
    font-weight: 600;
}

.btn-primary:hover {
    background: var(--accent-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 229, 199, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
}

.btn-danger {
    background: rgba(248, 113, 113, 0.12);
    color: var(--accent-danger);
    border: 1px solid rgba(248, 113, 113, 0.2);
}

.btn-danger:hover {
    background: rgba(248, 113, 113, 0.2);
    border-color: rgba(248, 113, 113, 0.35);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
}

/* ============== Inputs ============== */
.input, .textarea {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.25);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    transition: all 0.15s ease;
}

.input:focus, .textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(0, 229, 199, 0.12);
}

.textarea {
    min-height: 100px;
    resize: vertical;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.5;
}

/* ============== Modal ============== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    width: 100%;
    max-width: 380px;
    padding: 2rem;
    border-radius: var(--radius-lg);
    text-align: center;
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.auth-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: var(--accent-primary-dim);
    color: var(--accent-primary);
    margin-bottom: 1.25rem;
}

.modal-content h2 {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.modal-content p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
}

.modal-content .input {
    margin-bottom: 0.875rem;
}

.modal-content .btn-primary {
    width: 100%;
    justify-content: center;
    padding: 0.7rem;
}

.modal-large {
    max-width: 720px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    text-align: left;
}

.modal-large .modal-header {
    flex-shrink: 0;
}

.modal-large .modal-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.5rem;
}

.modal-large .modal-body::-webkit-scrollbar {
    width: 5px;
}

.modal-large .modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-large .modal-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.modal-large .modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* Broadcast Modal */
.modal-broadcast {
    max-width: 860px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    text-align: left;
}

.modal-broadcast .modal-header {
    flex-shrink: 0;
}

.modal-broadcast .modal-body {
    flex: 1;
    overflow-y: auto;
}

.modal-broadcast .modal-header h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.broadcast-layout {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 1.25rem;
}

.broadcast-editor .textarea {
    min-height: 160px;
}

.broadcast-scripts {
    border-left: 1px solid var(--border-color);
    padding-left: 1.25rem;
}

.broadcast-scripts .panel-header {
    margin-bottom: 0.75rem;
}

.broadcast-scripts .scripts-list {
    max-height: 300px;
}

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

.modal-header h2 {
    font-family: var(--font-mono);
    font-size: 1rem;
}

.close-btn {
    padding: 0.4rem;
    color: var(--text-muted);
}

.close-btn:hover {
    color: var(--text-primary);
}

.error-text {
    color: var(--accent-danger);
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

/* ============== Main Content ============== */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
    animation: fadeUp 0.3s ease;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============== Stats Bar ============== */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 3rem;
    padding: 1.25rem 2rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    border-left: 3px solid var(--accent-primary);
}

.stat {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}

.stat-icon {
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.stat-icon--online { color: var(--accent-success); }
.stat-icon--offline { color: var(--accent-danger); }

.stat-value {
    display: block;
    font-family: var(--font-mono);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-value.online {
    color: var(--accent-success);
}

.stat-value.offline {
    color: var(--accent-danger);
}

.stat-label {
    font-size: 0.65rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ============== Command Center (Two-col layout) ============== */
.command-center {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

/* ============== Actions Panel ============== */
.panel-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.panel-header svg {
    color: var(--accent-primary);
    flex-shrink: 0;
}

.panel-header h3 {
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.actions-panel {
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    border-left: 3px solid var(--accent-primary);
}

.actions-row {
    margin-bottom: 0.875rem;
}

.actions-row--buttons {
    margin-bottom: 0;
    display: flex;
    gap: 0.5rem;
}

/* ============== Scripts Panel ============== */
.scripts-panel {
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    border-left: 3px solid var(--accent-warning);
    display: flex;
    flex-direction: column;
}

.scripts-panel .panel-header svg {
    color: var(--accent-warning);
}

.scripts-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    overflow-y: auto;
    max-height: 220px;
}

.scripts-list::-webkit-scrollbar {
    width: 4px;
}

.scripts-list::-webkit-scrollbar-track {
    background: transparent;
}

.scripts-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.script-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.12s ease;
}

.script-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-accent);
}

.script-item svg {
    color: var(--accent-warning);
    flex-shrink: 0;
}

.script-item-info {
    min-width: 0;
    flex: 1;
}

.script-item-name {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.script-item-desc {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scripts-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ============== Workers Section ============== */
.section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.section-header svg {
    color: var(--accent-primary);
}

.section-header h3 {
    font-size: 0.85rem;
    font-weight: 500;
}

.workers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.empty-state p {
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

/* ============== Worker Card ============== */
.worker-card {
    padding: 1.1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    border-left: 3px solid transparent;
}

.worker-card.online {
    border-left-color: var(--accent-success);
}

.worker-card.offline {
    border-left-color: var(--accent-danger);
}

.worker-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    background: rgba(17, 24, 39, 0.8);
}

.worker-card-thumbnail {
    width: 100%;
    height: 110px;
    object-fit: cover;
    object-position: center top;
    border-radius: var(--radius-sm);
    margin-bottom: 0.875rem;
    border: 1px solid var(--border-color);
    background-color: #080a12;
}

.worker-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.worker-name {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.875rem;
}

.worker-status-badge {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.worker-status-badge.online {
    background: rgba(52, 211, 153, 0.12);
    color: var(--accent-success);
}

.worker-status-badge.offline {
    background: rgba(248, 113, 113, 0.12);
    color: var(--accent-danger);
}

.worker-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.worker-stat {
    display: flex;
    flex-direction: column;
}

.worker-stat-label {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.worker-stat-value {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.worker-card-actions {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

/* ============== Worker Modal ============== */
.worker-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding: 0.875rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.info-item .info-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.15rem;
}

.info-item .info-value {
    display: block;
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* Script picker */
.script-picker {
    margin-bottom: 0.75rem;
}

.script-section,
.output-section {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    padding: 1rem;
    border: 1px solid var(--border-color);
    margin-bottom: 1.25rem;
}

.script-section h4,
.output-section h4 {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-primary);
    margin-bottom: 0.75rem;
}

.screenshot-container {
    position: relative;
    width: 100%;
    margin-bottom: 1rem;
    background: #080a12;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.screenshot-img {
    width: 100%;
    height: auto;
    display: block;
}

.screenshot-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 3rem 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.screenshot-actions {
    display: flex;
    justify-content: flex-end;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.4);
    border-top: 1px solid var(--border-color);
}


.script-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 0.75rem;
}

.output-box {
    background: #080a12;
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
    border: 1px solid var(--border-color);
    min-height: 120px;
    max-height: 300px;
    overflow-y: auto;
}

.output-box::-webkit-scrollbar {
    width: 6px;
}

.output-box::-webkit-scrollbar-track {
    background: transparent;
}

.output-box::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

/* ============== Toast Notifications ============== */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 9999;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    min-width: 260px;
    max-width: 380px;
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastSlideIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.fade-out {
    animation: toastFadeOut 0.2s ease forwards;
}

@keyframes toastFadeOut {
    to { opacity: 0; transform: translateY(10px); }
}

/* Worker Groups Tabs */
.worker-groups-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.worker-groups-tabs::-webkit-scrollbar {
    height: 4px;
}
.worker-groups-tabs::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.group-tab {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.group-tab:hover {
    background: rgba(255, 255, 255, 0.08);
}

.group-tab.active {
    background: var(--accent-primary-dim);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* Custom Dropdown */
.custom-script-dropdown {
    position: relative;
    width: 100%;
    user-select: none;
}
.custom-dropdown-header {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: all 0.2s ease;
}
.custom-dropdown-header:hover, .custom-script-dropdown.open .custom-dropdown-header {
    border-color: var(--accent-primary);
    background: rgba(0, 0, 0, 0.6);
}
.custom-dropdown-body {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.25rem;
    background: #0d101a;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    max-height: 400px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.custom-script-dropdown.open .custom-dropdown-body {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.custom-dropdown-search {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}
.custom-dropdown-search input {
    width: 100%;
    padding: 0.6rem;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}
.custom-dropdown-search input:focus {
    outline: none;
    border-color: var(--accent-primary);
}
.custom-dropdown-list {
    overflow-y: auto;
    flex: 1;
}
.custom-dropdown-list::-webkit-scrollbar {
    width: 6px;
}
.custom-dropdown-list::-webkit-scrollbar-track { background: transparent; }
.custom-dropdown-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}
.custom-dropdown-group {
    padding: 0.6rem 1rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--accent-primary);
    background: #0d101a;
    font-family: var(--font-mono);
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border-bottom: 1px solid var(--border-color);
}
.custom-dropdown-item {
    padding: 0.6rem 1rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    transition: background 0.1s ease;
}
.custom-dropdown-item:last-child { border-bottom: none; }
.custom-dropdown-item:hover, .custom-dropdown-item.focused {
    background: rgba(0, 229, 199, 0.15);
    color: var(--text-primary);
}
.custom-dropdown-item-name {
    font-weight: 500;
    color: var(--text-primary);
    font-family: var(--font-mono);
}
.custom-dropdown-item-desc {
    font-size: 0.75rem;
    opacity: 0.6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Worker Card Selection overrides */
.worker-card {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.worker-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.3);
}
.worker-card.selected {
    border-color: var(--accent-primary);
    background: rgba(0, 229, 199, 0.05);
    box-shadow: 0 0 0 1px var(--accent-primary), 0 8px 32px rgba(0, 229, 199, 0.15);
}
.worker-selection-indicator {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: var(--accent-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    pointer-events: none;
}
.worker-selection-indicator svg {
    width: 1rem;
    height: 1rem;
}
.worker-card.selected .worker-selection-indicator {
    opacity: 1;
    transform: scale(1);
    color: #080a12;
}
.worker-card-details-action {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 2rem;
    height: 2rem;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    backdrop-filter: blur(4px);
    z-index: 10;
    transition: all 0.2s ease;
}
.worker-card-details-action:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #080a12;
}

/* FAB for Batch Selection */
.fab-container {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-lg);
    z-index: 900;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    border: 1px solid var(--accent-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.fab-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.fab-count {
    color: var(--accent-primary);
    font-weight: 600;
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

/* Collapsible log container for Batch Exec */
.worker-log-item {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}

.worker-log-header {
    padding: 0.6rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
}

.worker-log-title {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.worker-log-status {
    font-size: 0.75rem;
}

.worker-log-body {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: none;
}

.worker-log-body.open {
    display: block;
}

.worker-log-output {
    background: #080a12;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
}

.worker-log-status.pending { color: var(--text-muted); }
.worker-log-status.running { color: var(--accent-warning); }
.worker-log-status.success { color: var(--accent-success); }
.worker-log-status.failed { color: var(--accent-danger); }

.info-item {
    display: flex;
    flex-direction: column;
}

.info-label {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.info-value {
    font-size: 0.8rem;
    font-weight: 500;
}

.screenshot-container {
    margin-top: 0.75rem;
    text-align: center;
}

.screenshot-img {
    width: 100%;
    max-width: 100%;
    max-height: 280px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 0.5rem;
    background-color: #080a12;
}

.screenshot-placeholder {
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    border: 1px dashed var(--border-color);
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.screenshot-actions {
    display: flex;
    justify-content: center;
}

.script-picker {
    margin-bottom: 0.6rem;
}

.script-picker select {
    cursor: pointer;
    appearance: none;
    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='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.script-section, .output-section {
    margin-bottom: 1.25rem;
}

.script-section h4, .output-section h4 {
    margin-bottom: 0.6rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.script-section h4 svg, .output-section h4 svg {
    color: var(--accent-primary);
}

.script-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.6rem;
}

.output-box {
    padding: 0.875rem;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.5;
}

/* ============== Toast ============== */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    z-index: 2000;
}

.toast {
    padding: 0.75rem 1.1rem;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px var(--shadow-color);
    animation: slideIn 0.25s ease;
    max-width: 320px;
    font-size: 0.8rem;
    font-family: var(--font-mono);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toast.success {
    border-left: 3px solid var(--accent-success);
}

.toast.error {
    border-left: 3px solid var(--accent-danger);
}

.toast.info {
    border-left: 3px solid var(--accent-primary);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============== Responsive ============== */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 0.75rem;
    }

    .stats-bar {
        flex-direction: column;
        gap: 0.75rem;
    }

    .command-center {
        grid-template-columns: 1fr;
    }

    .workers-grid {
        grid-template-columns: 1fr;
    }

    .script-actions {
        flex-direction: column;
    }

    .main-content {
        padding: 1rem;
    }
}
