:root {
    /* Font Family - Standard Professional Stack */
    --font-sans: 'Space Grotesk', 'Inter', system-ui, -apple-system, sans-serif;

    /* Light Mode Variables - Softer & Cleaner */
    --bg-body: #ffffff;
    /* Pure white body */
    --bg-surface: #f8fafc;
    /* Very subtle slate-50 for cards */
    --bg-surface-secondary: #f1f5f9;
    /* Slate-100 */

    --border-color: #f1f5f9;
    /* Much lighter border (Slate-100) */
    --border-color-hover: #cbd5e1;
    /* Slate-300 */

    --text-primary: #0f172a;
    /* Slate-900 */
    --text-secondary: #64748b;
    /* Slate-500 */
    --text-tertiary: #94a3b8;
    /* Slate-400 */

    --accent-primary: #2563eb;
    /* Blue-600 */
    --accent-primary-hover: #1d4ed8;
    /* Blue-700 */
    --accent-surface: #eff6ff;
    /* Blue-50 */
    --on-accent: #ffffff;

    --status-success-bg: #dcfce7;
    --status-success-text: #166534;
    --status-danger-bg: #fee2e2;
    --status-danger-text: #991b1b;
    --status-warning-bg: #fef9c3;
    --status-warning-text: #854d0e;

    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.02), 0 1px 2px -1px rgb(0 0 0 / 0.02);
    /* Softer shadow */
    --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.05), 0 4px 6px -4px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.05), 0 8px 10px -6px rgb(0 0 0 / 0.05);

    --radius-sm: 0.75rem;
    /* Increased radius */
    --radius-md: 1rem;
    /* Increased radius */
    --radius-lg: 1.5rem;
    /* Increased radius */
}

[data-theme="dark"] {
    /* Dark Mode Variables */
    --bg-body: #0f172a;
    /* Slate-900 */
    --bg-surface: #1e293b;
    /* Slate-800 */
    --bg-surface-secondary: #334155;
    /* Slate-700 */
    --border-color: #334155;
    /* Slate-700 */
    --border-color-hover: #475569;
    /* Slate-600 */

    --text-primary: #f8fafc;
    /* Slate-50 */
    --text-secondary: #cbd5e1;
    /* Slate-300 */
    --text-tertiary: #94a3b8;
    /* Slate-400 */

    --accent-primary: #3b82f6;
    /* Blue-500 */
    --accent-primary-hover: #60a5fa;
    /* Blue-400 */
    --accent-surface: rgba(59, 130, 246, 0.1);

    --status-success-bg: rgba(22, 163, 74, 0.2);
    --status-success-text: #86efac;
    --status-danger-bg: rgba(220, 38, 38, 0.2);
    --status-danger-text: #fca5a5;
    --status-warning-bg: rgba(234, 179, 8, 0.2);
    --status-warning-text: #fde047;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4);
}

/* Global Reset */
* {
    box-sizing: border-box;
}

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

input,
select,
textarea,
button {
    font-family: inherit;
}

/* Layout Shell */
.app-shell {
    height: 100vh;
    display: flex;
    /* Assuming flex layout based on original file context */
}

.app-shell aside {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
    background: var(--bg-body);
    /* padding removed to allow utility control */
}

.app-shell main {
    flex: 1;
    height: 100vh;
    overflow: hidden;
    /* Prevent global scroll */
    padding: 0;
    /* Padding moved to inner wrapper */
    display: flex;
    flex-direction: column;
}

/* Main Page Container - The new "Standard" */
.page-main-container {
    background: transparent;
    /* Removed backdrop/blur */
    border-radius: 0;
    padding: 0;
    margin: 0;
    box-shadow: none;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Scroll Areas */
.content-scroll {
    height: 100%;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Cards & Panels - Professional Look */
.glass-panel,
.glass-card,
.neon-card,
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.glass-panel:hover,
.glass-card:hover {
    border-color: var(--border-color-hover);
    box-shadow: var(--shadow-md);
}

/* Remove specific "neon" effects, map them to standard card */
.neon-card {
    /* Keeping the class name for compatibility but removing neon style */
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-primary);
    font-weight: 600;
    margin-top: 0;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-primary);
}

.section-eyebrow {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: 0.5rem;
}

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

/* Override legacy white text */
.text-slate-400 {
    color: var(--text-tertiary) !important;
}

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

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger,
.btn-surface {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s;
    cursor: pointer;
    line-height: 1.25rem;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: #ffffff;
    border: 1px solid transparent;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

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

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

.btn-secondary:hover {
    background-color: var(--bg-surface-secondary);
    border-color: var(--border-color-hover);
}

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

.btn-ghost:hover {
    background-color: var(--bg-surface-secondary);
    color: var(--text-primary);
}

.btn-danger {
    background-color: #ef4444;
    color: #fff;
    border: 1px solid transparent;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-compact {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
}

/* Forms */
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.form-input,
.form-select,
.form-textarea {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5rem;
    color: var(--text-primary);
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-surface);
}

.form-input::placeholder {
    color: var(--text-tertiary);
}

/* Status Pills */
.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.25rem;
}

.status-active {
    background-color: var(--status-success-bg);
    color: var(--status-success-text);
}

.status-inactive {
    background-color: var(--bg-surface-secondary);
    color: var(--text-tertiary);
}

.chip {
    display: inline-flex;
    padding: 0.125rem 0.5rem;
    border-radius: 0.375rem;
    background-color: var(--bg-surface-secondary);
    color: var(--text-secondary);
    font-size: 0.75rem;
    border: 1px solid var(--border-color);
}

/* Tables - Modern Clean */
.table-modern,
.table-plain {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: left;
}

.table-modern th,
.table-plain th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-surface-secondary);
}

.table-modern td,
.table-plain td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.875rem;
    vertical-align: middle;
}

.table-modern tr:last-child td {
    border-bottom: none;
}

.table-modern td p.font-semibold {
    color: var(--text-primary);
}

/* Modern Toggle Switch */
.status-switch {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    position: relative;
    width: 2.25rem;
    height: 1.25rem;
}

.status-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.status-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    /* Slate-300 off state */
    transition: .3s;
    border-radius: 999px;
}

.status-knob {
    position: absolute;
    content: "";
    height: 1rem;
    width: 1rem;
    left: 0.125rem;
    bottom: 0.125rem;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

input:checked+.status-slider {
    background-color: var(--accent-active, #10b981);
    /* Green-500 */
}

input:checked+.status-slider .status-knob {
    transform: translateX(1rem);
}

/* Modals */
.modal {
    background-color: rgba(15, 23, 42, 0.6);
    /* Backdrop dim */
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
}

/* Navigation Groups (Sidebar) */
.nav-group {
    margin-bottom: 1.5rem;
    border: none;
    background: transparent;
    padding: 0;
}

.nav-group-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 0.75rem;
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.15s;
    font-weight: 500;
}

.nav-link:hover {
    background-color: var(--bg-surface-secondary);
    color: var(--text-primary);
}

.nav-link.active {
    background-color: var(--accent-surface);
    color: var(--accent-primary);
}

/* Config Page Grid Layout Logic (Preserved) */
.config-page {
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 1.5rem;
    height: 100%;
}

.config-page .pipelines-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1.5rem;
    height: 100%;
    overflow: hidden;
}

.pipelines-sidebar {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.pipelines-sidebar-body {
    flex: 1;
    overflow-y: auto;
}

.pipeline-panel {
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.pipeline-panel-inner {
    height: 100%;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.pipeline-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

/* Config Tabs */
.config-tab {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    text-decoration: none;
    font-weight: 500;
}

.config-tab:hover {
    color: var(--text-primary);
}

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

/* Kanban Board Refactor */
.kanban-scroll-wrapper {
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.board-wrapper {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
}

.kanban-scroll {
    height: 100%;
    display: inline-flex;
    gap: 1.5rem;
    padding-bottom: 1rem;
    /* Space for scrollbar */
}

.board-grid {
    display: flex;
    gap: 1.5rem;
    height: 100%;
}

.kanban-column {
    width: 300px;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-surface-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    height: 100%;
}

.kanban-column-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-surface);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.kanban-list {
    padding: 1rem;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Mobile Responsive Adjustments */
@media (max-width: 1024px) {
    .app-shell {
        flex-direction: column;
        height: auto;
    }

    .app-shell aside {
        position: static;
        height: auto;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .app-shell main {
        padding: 1rem;
        height: auto;
        overflow: visible;
    }

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

    .config-page .pipelines-grid {
        display: flex;
        flex-direction: column;
        height: auto;
    }

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

    .kanban-column {
        height: auto;
        min-height: 500px;
    }

    .board-grid {
        flex-direction: column;
    }

    .kanban-scroll {
        display: block;
        height: auto;
    }
}

/* Custom Scrollbar - Theme Aware */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: var(--border-color-hover);
    /* Adapts to Light/Dark */
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-tertiary);
    /* Darker on hover */
}

/* For Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color-hover) transparent;
}