:root {
    color-scheme: light dark;
    --font-sans: "Avenir Next LT Pro Light", "Avenir Next", "Avenir", "Segoe UI", system-ui, -apple-system, sans-serif;
    --font-display: "Avenir Next LT Pro Light", "Avenir Next", "Avenir", "Segoe UI", system-ui, -apple-system, sans-serif;
    --bg: #f4f5f7;
    --surface: #ffffff;
    --surface-2: #f0f1f4;
    --text: #343c4e;
    --text-strong: #0b1220;
    --text-soft: #1f2937;
    --muted: #334155;
    --border: rgba(16, 24, 40, 0.1);
    --shadow: 0 12px 30px rgba(16, 24, 40, 0.08);

    --accent: #9f7aea;
    --accent-2: #60a5fa;

    --cyan:#007cdb;
    --cyan-2:#00e5c6;
}

[data-theme="dark"] {
    --bg: #0f1115;
    --surface: #17191f;
    --surface-2: #1f2229;
    --text: #eef1f6;
    --text-strong: #ffffff;
    --text-soft: #cbd5e1;
    --muted: #a0a6b2;
    --border: rgba(255, 255, 255, 0.08);
    --shadow: 0 16px 40px rgba(0, 0, 0, 0.45);

    --accent: #7c3aed;
    --accent-2: #2563eb;

    --cyan:#1a9cff;
    --cyan-2:#00e2c4;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
}

*::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

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

*::-webkit-scrollbar-thumb {
    background-color: var(--cyan);
    border-radius: 10px;
}

*::-webkit-scrollbar-thumb:hover {
    background-color: var(--cyan-2);
}

.page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 28px 72px;
}

.hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 11px;
    color: var(--muted);
    margin: 0 0 8px;
}

.hero h1 {
    margin: 0 0 6px;
    font-size: 34px;
    font-weight: 700;
    color: var(--text-strong);
    font-family: var(--font-display);
}

.subtext {
    margin: 0;
    color: var(--text-soft);
}

.hero-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
    margin: 24px 0;
}


.grid.two-cols {
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
}

.col-right {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    height: 100%;
}

.col-right .panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.services-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
}

.service-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;


    border: none;

    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
}

.service-item input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    display: inline-block;
    position: relative;
    cursor: pointer;
    transition: all 0.14s ease;
    box-shadow: 0 1px 0 rgba(16,24,40,0.03) inset;
}

.service-item input[type="checkbox"]:hover {
    border-color: rgba(159,122,234,0.7);
}

.service-item input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(159,122,234,0.12);
}

.service-item input[type="checkbox"]::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    opacity: 0;
    transition: transform 0.14s ease, opacity 0.14s ease;
}

.service-item input[type="checkbox"]:checked {
    background: linear-gradient(120deg, var(--accent), var(--accent-2));
    border-color: transparent;
}

.service-item input[type="checkbox"]:checked::after {
    transform: rotate(45deg) scale(1);
    opacity: 1;
}

.panel {
    background: var(--surface);
    border-radius: 14px;
    padding: 20px;
    border: 1px solid transparent;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.focus-panel {
    border-color: rgba(96, 165, 250, 0.75);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35), 0 0 30px rgba(59, 130, 246, 0.25);
}

.panel-header h2 {
    margin: 0;
    font-size: 20px;
    font-family: var(--font-display);
}

.panel-meta {
    color: var(--text-soft);
    font-size: 14px;
}

.dropzone {
    border: 1px dashed var(--border);
    border-radius: 16px;
    padding: 28px;
    background: var(--surface-2);
    text-align: center;
    cursor: pointer;
    position: relative;
}

.dropzone input {
    opacity: 0;
    position: absolute;
    inset: 0;
    cursor: pointer;
}

.dropzone p {
    margin: 0 0 6px;
    font-size: 16px;
}

.dropzone span {
    color: var(--muted);
}

.row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.row .reset-btn {
    margin-left: auto;
}

.form .row {
    margin-top: 8px;
    flex-direction: column;
    align-items: flex-start;
}


.primary,
.ghost {
    border-radius: 999px;
    border: 1px solid var(--border);
    padding: 10px 18px;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
}

.ghost {
    background: var(--surface-2);
    color: var(--text-soft);
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.ghost:hover {
    color: var(--text);
    border-color: var(--accent);
}

.theme-toggle {
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--muted);
    border-radius: 999px;
    padding: 6px 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.theme-toggle:hover {
    color: var(--text);
    border-color: var(--accent);
}

.theme-icon {
    display: inline-flex;
    align-items: center;
}

.theme-toggle i {
    width: 14px;
    height: 14px;
}

[data-theme="dark"] .theme-icon[data-theme-icon="sun"] {
    opacity: 0.4;
}

[data-theme="light"] .theme-icon[data-theme-icon="moon"] {
    opacity: 0.4;
}

.primary {
    background: linear-gradient(120deg, var(--accent), var(--accent-2));
    color: #ffffff;
    border: none;
}

.primary:disabled,
.ghost:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.primary:disabled {
    background: var(--surface-2);
    color: var(--muted);
    border: 1px solid var(--border);
}

.is-hidden {
    display: none;
}

.ghost {
    background: var(--surface-2);
    color: var(--text-soft);
}

.hint {
    color: var(--muted);
    font-size: 15px;
}

.form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--text-soft);
    margin-top: 8px;
}

.form label:first-of-type {
    margin-top: 0;
}

.form input {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    font-family: var(--font-sans);
}

.steps {
    display: grid;
    gap: 10px;
    position: relative;
    padding-left: 20px;
}

.step {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 4px;
    border-bottom: 1px solid var(--border);
    color: var(--text-soft);
    font-size: 14px;
    position: relative;
}

.step.hidden {
    display: none;
}

.step.inactive {
    color: var(--muted);
}

.step::before {
    content: "";
    position: absolute;
    left: -16px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12);
    transform: translateY(-50%);
}

.step::after {
    content: "";
    position: absolute;
    left: -13px;
    top: calc(50% + 8px);
    width: 2px;
    height: 0;
    background: rgba(34, 197, 94, 0.4);
    transition: height 0.35s ease;
}

.step:last-child {
    border-bottom: none;
}

.step:last-child::after {
    display: none;
}

.step.complete::after {
    height: calc(100% + 2px);
}

.step.processing::after {
    height: 0;
}

.step span {
    font-weight: 600;
    color: var(--text);
}

.step.complete {
    color: var(--text-strong);
}

.step.processing {
    color: var(--text-strong);
    border-bottom-color: transparent;
}

.step.tail {
    border-bottom-color: transparent;
}


.step.tail::after {
    display: none;
}

.step-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-style: italic;
    color: var(--muted);
}

.step.processing .step-status::after {
    content: "";
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(34, 197, 94, 0.25);
    border-top-color: #22c55e;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.files {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.file-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    box-shadow: none;
}

.file-row>div:first-child {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1 1 auto;
}

.file-row strong {
    color: var(--text);
    font-family: "Avenir Next LT Pro Light", "Avenir Next", "Avenir", "Segoe UI", system-ui, -apple-system, sans-serif;
    font-weight: 400;
    letter-spacing: 0.01em;
    display: block;
    overflow: visible;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    max-width: 100%;
}

.file-icon {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    flex: 0 0 auto;
}

.file-row .hint {
    color: var(--muted);
}

.file-row .ghost {
    justify-self: flex-start;
}

.file-row .ghost {
    padding: 0;
    border: none;
    background: transparent;
    color: var(--muted);
    border-radius: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.file-row .ghost:hover {
    color: var(--text);
    border-color: transparent;
}

.file-row .ghost i {
    width: 16px;
    height: 16px;
}

.file-row .ghost::after {
    content: "";
}

.modal {
    height: 100vh;
    width: 100vw;
    position: fixed;
    inset: 0;
    background: rgba(132, 0, 255, 0.012);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
}

.data-preview {
    overflow: auto;
    max-height: 60vh;
    font-size: 13px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.modal[aria-hidden="false"] {
    opacity: 0.99;
    pointer-events: all;
}

.modal-card {
    width: min(92%);
    background: var(--surface);
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 18px;
}

/* Narrow the files modal specifically for better readability */
#files-modal .modal-card {
    width: min(72%, 880px);
    max-width: 880px;
}

/* Make files modal body scrollable like data-preview */
#files-modal .modal-card {
    max-height: 80vh;
    overflow: hidden;
}

#files-modal .files-modal-body {
    overflow: auto;
    max-height: 60vh;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    padding-bottom: 0.5%;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.35em;
    font-weight: 700;
    margin: 0;
    margin-bottom: 0.5%;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 i {
    width: 1em;
    height: 1em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    border: none;
    background: none;
}

.modal-header button.ghost {
    background: none;
    border: none;
    padding: 0;
    box-shadow: none;
    color: var(--muted);
    width: 28px;
    height: 28px;
}

.modal-header button.ghost:hover {
    color: var(--text);
}

* {
    box-sizing: border-box;
}

.data-preview table {
    width: 100%;
    border-collapse: collapse;
}

.data-preview th,
.data-preview td {
    border-bottom: 1px solid var(--border);
    padding: 2px 4px;
    text-align: left;
}

@media (max-width: 900px) {
    .hero {
        flex-direction: column;
        align-items: flex-start;
    }
    .grid.two-cols {
        grid-template-columns: 1fr;
    }
    .col-right {
        display: grid;
        grid-template-columns: 1fr;
        height: auto;
    }
    .col-right .panel {
        height: auto;
    }
}


.file-select-list {
    display: grid;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}


.file-select-list.cols-2 {
    grid-template-columns: repeat(2, minmax(280px, 1fr));
}

.file-select-list.cols-3 {
    grid-template-columns: repeat(3, minmax(220px, 1fr));
}

@media (max-width: 900px) {
    .file-select-list.cols-2,
    .file-select-list.cols-3 {
        grid-template-columns: 1fr;
    }
}


.modal.cols-2 .modal-card {
    width: fit-content;
    max-width: calc(100% - 80px);
    min-width: 640px;
}


.modal.cols-3 .modal-card {
    max-width: calc(100% - 80px);
}

.file-select-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    transition: border-color 0.2s ease;
}

.file-select-row:hover {
    border-color: var(--accent);
}

.file-select-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.file-select-info strong {
    color: var(--text-strong);
    font-family: var(--font-sans);
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.select-file-btn {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.select-file-btn:hover {
    border-color: var(--accent);
    background: var(--accent);
    color: white;
}

.select-file-btn.ghost {
    background: transparent;
    border: 1px solid var(--border);
}

.select-file-btn.ghost:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}


.new-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0;
    overflow: visible;
    gap: 20px;
}


.new-panel .service-panel {
    padding: 20px 20px 12px 20px;
    flex: 1;
}


.new-panel .start-pipeline-panel {
    margin: auto;
    display: flex;
    flex-direction: row;
    gap: 18px;
}


.new-panel .start-pipeline-panel button {
    margin-left: auto;
    margin-right: auto;
}


.col-right {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    height: 100%;
}

.col-right .panel {
    height: 100%;
    margin: 0;
}


#service-panel .row {
    display: none;
}

@media (max-width: 900px) {
    .col-right {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .new-panel {
        height: auto;
    }
}

/* compact view-all link in upload panel */
.files-view-more {
    color: var(--cyan);
    cursor: pointer;
    margin-left: 6px;
}
.files-view-more:hover {
    color: var(--cyan-2);
    cursor: pointer;
    margin-left: 6px;
}

.files-modal-body {
    font-size: 14px;
    color: var(--text-soft);
    white-space: normal;
    word-break: break-word;
}

/* color just the filename within the files modal */
.files-modal-body .files-modal-name {
    color: var(--cyan);
}
