:root {
    --bg-color: #0b1121;
    --bg-surface: #111827;
    --card-bg: #1a2332;
    --text-primary: #f1f5f9;
    --text-secondary: #8896ab;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --border: #1e2d3d;
    --border-subtle: rgba(255, 255, 255, 0.06);
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --primary: #6366f1;
    --glow: rgba(99, 102, 241, 0.15);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    padding: 1rem;
    overflow-x: hidden;
}

@media (min-width: 640px) {
    body {
        padding: 1.5rem;
    }
}

@media (min-width: 1024px) {
    body {
        padding: 2rem;
    }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

@media (max-width: 1024px) {
    .container {
        max-width: 100%;
    }
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem 1.5rem;
    background: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.header-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent) 0%, #a855f7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.875rem;
    letter-spacing: -0.5px;
    color: white;
    flex-shrink: 0;
}

header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    -webkit-text-fill-color: unset;
    background: none;
}

.header-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 400;
    letter-spacing: 0.02em;
}

header nav {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.nav-link.active {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.12);
}

.nav-link.active svg {
    color: var(--accent);
}

.nav-link-dim {
    opacity: 0.6;
    font-size: 0.8rem;
}

.nav-link-dim:hover {
    opacity: 1;
}

.btn-nav {
    margin-left: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    min-height: unset;
}

@media (max-width: 640px) {
    header {
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem;
    }

    header nav {
        width: 100%;
        display: flex;
        gap: 0.25rem;
        flex-wrap: wrap;
    }

    .nav-link {
        flex: 1;
        justify-content: center;
        padding: 0.5rem;
        font-size: 0.8rem;
    }

    .btn-nav {
        margin-left: 0;
        flex: 1;
        justify-content: center;
    }
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}

.page-header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-header-content h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.page-header-content p {
    margin: 0;
}

@media (max-width: 640px) {
    .page-header-content {
        flex-direction: column;
    }
    
    .page-header-content .btn {
        width: 100%;
    }
}

/* Action Buttons Group - Enhanced Design */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.action-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.action-group-primary {
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    padding-right: 0.75rem;
    margin-right: 0.25rem;
}

.action-group-control {
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    padding-right: 0.75rem;
    margin-right: 0.25rem;
}

.action-group-secondary {
    /* No border for last group */
}

@media (max-width: 768px) {
    .action-buttons {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        padding: 0.75rem;
    }
    
    .action-group {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        padding-right: 0;
        padding-bottom: 0.75rem;
        margin-right: 0;
        margin-bottom: 0.75rem;
        gap: 0.5rem;
    }
    
    .action-group:last-child {
        border-bottom: none;
        padding-bottom: 0;
        margin-bottom: 0;
    }
    
    .action-group .btn {
        flex: 1;
        min-width: 0;
    }
    
    .btn-icon {
        min-width: 2.5rem;
        min-height: 2.5rem;
    }
}

/* Bulk Actions */
.bulk-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 1rem;
}

.bulk-actions strong {
    color: var(--text-primary);
    font-weight: 600;
}

@media (max-width: 640px) {
    .bulk-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .bulk-actions .btn {
        width: 100%;
    }
}

h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background-color: var(--accent);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    line-height: 1.5;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    min-height: 2.5rem;
}

.btn:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--glow);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    gap: 0.5rem;
    min-height: 2.25rem;
    border-radius: 0.5rem;
}

/* Primary Button */
.btn-primary {
    background: var(--primary);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px var(--glow);
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 16px var(--glow);
    transform: translateY(-1px);
}

/* Ghost Button */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    box-shadow: none;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-ghost-small {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 0.5rem;
    min-height: 2.25rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.btn-ghost-small:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Icon-only buttons */
.btn-icon {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    padding: 0.5rem;
    min-width: 2.5rem;
    min-height: 2.5rem;
    aspect-ratio: 1;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.2s ease;
    box-shadow: none;
}

.btn-icon:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.25);
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px var(--glow);
}

.btn-icon:active {
    transform: translateY(0);
}

/* Control buttons - Enhanced Design */
.btn-control {
    padding: 0.625rem 1.125rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 0.625rem;
    min-height: 2.5rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    letter-spacing: 0.025em;
    text-transform: uppercase;
    font-size: 0.75rem;
}

.btn-control.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.btn-control.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
    transform: translateY(-2px);
}

.btn-control.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
}

.btn-control.btn-warning:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
    transform: translateY(-2px);
}

.btn-control.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

.btn-control.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
    transform: translateY(-2px);
}

.btn-control:active {
    transform: translateY(0);
}

/* Danger outline buttons - Enhanced Design */
.btn-danger-outline {
    background: transparent;
    color: var(--error);
    border: 1.5px solid var(--error);
    padding: 0.5rem 1rem;
    border-radius: 0.625rem;
}

.btn-danger-outline:hover {
    background: linear-gradient(135deg, var(--error) 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
    transform: translateY(-2px);
}

.btn-danger-outline-small {
    background: rgba(239, 68, 68, 0.08);
    color: #f87171;
    border: 1.5px solid rgba(239, 68, 68, 0.3);
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 0.5rem;
    min-height: 2.25rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 4px rgba(239, 68, 68, 0.15);
}

.btn-danger-outline-small:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--error);
    color: #fca5a5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Button Color Variants */
.btn.bg-primary,
.bg-primary {
    background-color: var(--primary) !important;
    color: white !important;
}

.btn.bg-primary:hover {
    background-color: #2563eb !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4) !important;
}

.btn.bg-secondary,
.bg-secondary {
    background-color: var(--card-bg) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-primary) !important;
}

.btn.bg-secondary:hover {
    background-color: var(--border) !important;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1) !important;
}

.btn.bg-success,
.bg-success {
    background-color: var(--success) !important;
    color: white !important;
}

.btn.bg-success:hover {
    background-color: #059669 !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4) !important;
}

.btn.bg-error,
.bg-error {
    background-color: var(--error) !important;
    color: white !important;
}

.btn.bg-error:hover {
    background-color: #dc2626 !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4) !important;
}

.btn.bg-warning,
.bg-warning {
    background-color: var(--warning) !important;
    color: white !important;
}

.btn.bg-warning:hover {
    background-color: #d97706 !important;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4) !important;
}

.card {
    background-color: var(--card-bg);
    border-radius: 14px;
    border: 1px solid var(--border-subtle);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.3rem 0.75rem;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.status-queued {
    background: rgba(148, 163, 184, 0.12);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.15);
}

.status-running {
    background: rgba(99, 102, 241, 0.12);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.status-running::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #818cf8;
    animation: pulse-dot 1.5s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}

.status-completed {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.15);
}

.status-failed {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.status-paused {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.15);
}

/* Form Styles */
fieldset.form-group {
    pointer-events: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.02);
}

fieldset.form-group legend {
    padding: 0 0.5rem;
    color: var(--text-primary);
    font-size: 1rem;
    pointer-events: none; /* Prevent legend from blocking clicks on tabs */
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

input[type="text"],
input[type="password"],
textarea,
select,
.input {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus,
.input:focus {
    outline: none;
    border-color: var(--primary);
    background-color: var(--card-bg);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

input[type="text"]:hover,
input[type="password"]:hover,
textarea:hover,
select:hover,
.input:hover {
    border-color: rgba(255, 255, 255, 0.3);
}

textarea {
    min-height: 150px;
}

.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    position: relative;
    z-index: 10;
    pointer-events: auto;
}

.tab {
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    position: relative;
    z-index: 11;
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

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

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #a855f7);
    transition: width 0.5s ease;
    border-radius: 4px;
}

.script-progress-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
    font-size: 0.7em;
}

.script-progress-item {
    display: inline-block;
    margin-right: 0.5rem;
    padding: 0.125rem 0.25rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    font-size: 0.7em;
}

/* Modal Styles - Fixed nested scrollbar issue */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1rem;
}

.modal-content {
    background-color: var(--card-bg);
    margin: 0 auto;
    padding: 1.5rem;
    border: 1px solid var(--border);
    width: 100%;
    max-width: 1200px;
    border-radius: 12px;
    color: var(--text-primary);
    position: relative;
    margin-top: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    /* Remove overflow-y from modal-content - let modal handle scrolling */
    overflow: visible;
    max-height: calc(100vh - 4rem);
    display: flex;
    flex-direction: column;
}

.modal-content > *:not(:last-child) {
    flex-shrink: 0;
}

.modal-content > *:last-child {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* Fix for preview modal - prevent nested scrollbars */
#preview-content {
    overflow: visible !important;
    max-height: none !important;
    display: flex;
    flex-direction: column;
}

#preview-content .table-container {
    flex: 1;
    min-height: 0;
}

@media (min-width: 640px) {
    .modal {
        padding: 2rem;
    }
    
    .modal-content {
        padding: 2rem;
        margin-top: 5%;
        margin-bottom: 5%;
        max-height: 90vh;
    }
}

/* Prevent modal background clicks from closing console modal */
#console-modal .modal-content {
    pointer-events: auto;
}

#console-modal {
    pointer-events: auto;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #fff;
}

.console-box {
    background: #0a0a0a;
    color: #00ff00;
    font-family: 'Fira Code', 'Courier New', monospace;
    padding: 1rem;
    min-height: 400px;
    max-height: calc(100vh - 20rem);
    overflow-y: auto;
    border-radius: 8px;
    white-space: pre-wrap;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    cursor: text;
    border: 1px solid rgba(0, 255, 0, 0.2);
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 255, 0, 0.3) transparent;
}

.console-box::-webkit-scrollbar {
    width: 8px;
}

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

.console-box::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 0, 0.3);
    border-radius: 4px;
}

.console-box::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 0, 0.5);
}

/* Table Styles */
.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    display: table;
}

.results-table th,
.results-table td {
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    text-align: left;
    word-wrap: break-word;
}

.results-table th {
    background: rgba(59, 130, 246, 0.25);
    color: #60a5fa;
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}

.results-table th:hover {
    background: rgba(59, 130, 246, 0.35);
}

.results-table tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.03);
}

.results-table tr:hover {
    background: rgba(255, 255, 255, 0.06);
}

@media (max-width: 768px) {
    .results-table {
        font-size: 0.8125rem;
    }
    
    .results-table th,
    .results-table td {
        padding: 0.5rem;
    }
}

.results-section {
    margin-bottom: 1.5rem;
}

.results-section h3 {
    margin: 0 0 0.5rem;
}

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #1a1a1a;
    min-width: 100px;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
    z-index: 1;
    border: 1px solid #333;
    border-radius: 4px;
    margin-top: 4px;
}

.dropdown-content a {
    color: white;
    padding: 8px 12px;
    text-decoration: none;
    display: block;
}

.dropdown-content a:hover {
    background-color: #333;
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* Status filter dropdown styling */
#status-filter {
    transition: background-color 0.2s, border-color 0.2s;
}

#status-filter:hover {
    background-color: #2a2a2a !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
}

#status-filter:focus {
    outline: none;
    border-color: var(--primary) !important;
    background-color: #2a2a2a !important;
}

/* New Job Page Styles */
.checkbox-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.checkbox-card:hover {
    background: rgba(99, 102, 241, 0.06);
    border-color: rgba(99, 102, 241, 0.2);
}

.checkbox-card:has(input:checked) {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
}

.filter-row {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr 1fr auto;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: center;
}

@media (max-width: 768px) {
    .filter-row {
        grid-template-columns: 1fr;
        gap: 0.375rem;
    }
}

.filter-row select,
.filter-row input {
    padding: 0.5rem;
    background: #1a1a1a;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    color: #ffffff;
    font-size: 0.875rem;
}

.filter-row select {
    cursor: pointer;
    appearance: none;
    background-image: url('data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2712%27 height=%2712%27 viewBox=%270 0 12 12%27%3E%3Cpath fill=%27%23ffffff%27 d=%27M6 9L1 4h10z%27/%3E%3C/svg%3E');
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    padding-right: 2rem;
}

.filter-row select:hover {
    background-color: #2a2a2a;
    border-color: rgba(255,255,255,0.3);
}

.filter-row select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.filter-row select option {
    background: #1a1a1a;
    color: #ffffff;
    padding: 0.5rem;
}

.filter-row input {
    color: #ffffff;
}

.filter-row input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.btn-preset {
    padding: 0.25rem 0.75rem;
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 4px;
    color: #60a5fa;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.btn-preset:hover {
    background: rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
}

.btn-preset:active {
    transform: scale(0.95);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.modal-header h3 {
    margin: 0;
}

.close-modal {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.preview-table th,
.preview-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.preview-table th {
    background: rgba(255,255,255,0.05);
    font-weight: 600;
    position: sticky;
    top: 0;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.preview-table th:hover {
    background: rgba(255,255,255,0.1);
}

.preview-table tr:hover {
    background: rgba(255,255,255,0.05);
}

.sort-indicator {
    color: #60a5fa;
    font-size: 0.75rem;
    margin-left: 0.25rem;
}

.preview-stats {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(99, 102, 241, 0.1));
    border-radius: 8px;
    border: 1px solid rgba(59, 130, 246, 0.2);
    flex-wrap: wrap;
}

.preview-stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 120px;
}

.preview-stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.preview-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #60a5fa;
    line-height: 1.2;
}

.preview-cell {
    cursor: pointer;
    transition: background 0.2s;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-cell:hover {
    background: rgba(59, 130, 246, 0.1) !important;
}

.preview-column {
    position: relative;
}

.preview-column:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

/* Utility Classes */
.flex-row {
    display: flex;
    flex-direction: row;
}

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

.flex-wrap {
    flex-wrap: wrap;
}

.flex-nowrap {
    flex-wrap: nowrap;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.justify-start {
    justify-content: flex-start;
}

.justify-end {
    justify-content: flex-end;
}

.align-center {
    align-items: center;
}

.align-start {
    align-items: flex-start;
}

.align-end {
    align-items: flex-end;
}

.gap-1 {
    gap: 0.5rem;
}

.gap-2 {
    gap: 1rem;
}

.hidden {
    display: none !important;
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

.text-accent {
    color: var(--accent) !important;
}

.text-primary {
    color: var(--text-primary) !important;
}

.text-success {
    color: var(--success) !important;
}

.text-error {
    color: var(--error) !important;
}

.text-warning {
    color: var(--warning) !important;
}

.text-sm {
    font-size: 0.875rem;
}

.text-xs {
    font-size: 0.75rem;
}

.text-lg {
    font-size: 1.125rem;
}

.text-xl {
    font-size: 1.25rem;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-4 {
    gap: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.ml-1 {
    margin-left: 0.5rem;
}

.mr-1 {
    margin-right: 0.5rem;
}

.p-1 {
    padding: 0.5rem;
}

.p-2 {
    padding: 1rem;
}

.w-full {
    width: 100%;
}

.min-w-200 {
    min-width: 200px;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Better focus styles for accessibility */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Loading states */
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
    pointer-events: none;
}

.btn:disabled:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* Button focus states for accessibility */
.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
    border-radius: 0.625rem;
}

.btn-icon:focus-visible {
    outline-offset: 2px;
}

/* Button spacing improvements */
.action-group .btn + .btn {
    margin-left: 0;
}

/* Smooth icon transitions */
.btn-icon span,
.btn-control span,
.btn-ghost-small span {
    display: inline-block;
    transition: transform 0.2s ease;
}

.btn-icon:hover span {
    transform: scale(1.1);
}

.btn-control:hover span {
    transform: scale(1.05);
}

/* Script badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: rgba(99, 102, 241, 0.1);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: capitalize;
}

/* Phase pill */
.phase-pill {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: rgba(168, 85, 247, 0.12);
    color: #c084fc;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

/* Last log line */
.last-log {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.375rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 400px;
    opacity: 0.7;
}

/* Card hover effects */
.card:hover {
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
}

