:root {
    --bg: #eef3f6;
    --panel: #ffffff;
    --text: #182128;
    --muted: #65717b;
    --border: #d9e0e5;
    --border-strong: #b8c7d1;
    --teal: #0b7f79;
    --teal-dark: #075f5b;
    --blue: #275dad;
    --orange: #c96c2f;
    --green: #18794e;
    --red: #b42318;
    --yellow: #936900;
    --shadow: 0 14px 34px rgba(24, 33, 40, 0.09);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100%;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 "Segoe UI", Arial, Helvetica, sans-serif;
}

button,
input,
select {
    font: inherit;
}

a {
    color: inherit;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 24px 28px;
    border-bottom: 4px solid #10a39b;
    background: #172027;
    color: #fff;
    box-shadow: 0 10px 28px rgba(23, 32, 39, 0.18);
}

.eyebrow {
    margin: 0 0 4px;
    color: #8fd5cf;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 0;
}

h2 {
    margin-bottom: 0;
    font-size: 19px;
}

h3 {
    margin-bottom: 0;
    font-size: 16px;
}

.top-actions,
.section-title-row,
.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.shell {
    width: min(1440px, 100%);
    margin: 0 auto;
    padding: 22px;
}

.connection-bar,
.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.connection-bar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: end;
    gap: 16px;
    margin-bottom: 20px;
    padding: 16px;
}

.connection-bar.status-only {
    grid-template-columns: 1fr;
}

.connection-bar.status-only .health-pill {
    justify-self: start;
}

.connection-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(120px, 180px) auto;
    gap: 12px;
    align-items: end;
}

.workspace {
    display: grid;
    grid-template-columns: minmax(300px, 430px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.left-column,
.right-column {
    display: grid;
    gap: 20px;
}

.panel {
    padding: 18px;
}

.panel-heading {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #edf1f3;
}

label,
.field-label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

input[type="text"],
input[type="url"],
input[type="number"],
select {
    width: 100%;
    min-height: 42px;
    border: 1px solid #c7d0d7;
    border-radius: 6px;
    padding: 9px 11px;
    background: #fff;
    color: var(--text);
}

input:focus,
select:focus,
button:focus,
a:focus {
    outline: 3px solid rgba(11, 127, 121, 0.22);
    outline-offset: 2px;
}

.button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--teal);
    border-radius: 6px;
    padding: 9px 14px;
    background: var(--teal);
    color: #fff;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.button:hover {
    background: var(--teal-dark);
    border-color: var(--teal-dark);
}

.button:active {
    transform: translateY(1px);
}

.button.primary {
    background: var(--teal);
}

.button.ghost {
    background: #fff;
    color: var(--teal-dark);
}

.button.ghost:hover {
    background: #e9f5f3;
}

.button.danger {
    border-color: var(--red);
    background: var(--red);
    color: #fff;
}

.button.danger:hover {
    border-color: #8f1d14;
    background: #8f1d14;
}

.button.compact {
    min-height: 38px;
    padding: 7px 12px;
}

.button.wide {
    width: 100%;
}

.toggle {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    grid-template-columns: auto auto;
    gap: 8px;
    color: #e8f2f1;
    cursor: pointer;
}

.toggle input {
    width: 18px;
    height: 18px;
}

.health-pill {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    padding: 8px 12px;
    font-weight: 800;
    white-space: nowrap;
}

.health-pill.good {
    background: #e8f6ee;
    color: var(--green);
}

.health-pill.bad {
    background: #fcebea;
    color: var(--red);
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: currentColor;
}

.inline-error {
    grid-column: 1 / -1;
    margin: 0;
    color: var(--red);
    font-weight: 700;
}

.notice {
    margin-bottom: 14px;
    border: 1px solid #b9d8d5;
    border-radius: 8px;
    padding: 12px 14px;
    background: #edf8f6;
    color: #0b5f5b;
    font-weight: 700;
}

.notice.error,
.notice.bad {
    border-color: #f1b9b4;
    background: #fff0ef;
    color: var(--red);
}

.notice.success {
    border-color: #b9dfc8;
    background: #effaf3;
    color: var(--green);
}

.segmented {
    display: inline-flex;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #eef2f4;
}

.segmented button,
.segmented a {
    min-height: 34px;
    border: 0;
    border-right: 1px solid var(--border);
    padding: 7px 11px;
    background: transparent;
    color: var(--muted);
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
}

.segmented button:last-child,
.segmented a:last-child {
    border-right: 0;
}

.segmented button.active,
.segmented a.active {
    background: #fff;
    color: var(--text);
}

.source-pane,
.source-form {
    display: none;
    gap: 16px;
}

.source-pane.active,
.source-form {
    display: grid;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.file-picker {
    display: grid;
    gap: 8px;
    border: 1px dashed #9fb2bf;
    border-radius: 8px;
    padding: 14px;
    background: #fbfcfd;
    cursor: pointer;
}

.file-picker input {
    width: 100%;
}

.file-label {
    color: var(--text);
    font-size: 15px;
}

.file-picker strong {
    color: var(--muted);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.file-picker small {
    color: #7a8790;
    font-weight: 800;
}

.control-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.control-row.task-row {
    grid-template-columns: 1fr;
}

fieldset {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
}

legend {
    padding: 0 4px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

fieldset label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-weight: 700;
}

.output-fieldset {
    gap: 12px;
}

.output-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.output-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.output-options.compact-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.output-option {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 9px;
    border: 1px solid #d6dfe5;
    border-radius: 8px;
    padding: 10px;
    background: #fbfcfd;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.output-option:has(input:checked),
.output-option.checked {
    border-color: #78bcb7;
    background: #f2fbfa;
    box-shadow: inset 0 0 0 1px rgba(11, 127, 121, 0.08);
}

.output-option input {
    margin-top: 3px;
}

.output-option span,
.output-option strong,
.output-option small {
    display: block;
    min-width: 0;
}

.output-option strong {
    color: var(--text);
}

.output-option small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.find-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) repeat(3, minmax(120px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.detail-grid strong {
    display: block;
    overflow-wrap: anywhere;
}

.insight-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.insight-strip > div {
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    background: #fbfcfd;
}

.insight-strip span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.insight-strip strong {
    display: block;
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.job-id-line {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

code {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    color: #172027;
    font: 13px/1.4 Consolas, Monaco, monospace;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tiny-button,
.copy-link {
    border: 0;
    border-radius: 6px;
    background: #e9f5f3;
    color: var(--teal-dark);
    font-weight: 800;
    cursor: pointer;
}

.tiny-button {
    min-height: 30px;
    padding: 5px 8px;
}

.tiny-button.active {
    background: var(--teal);
    color: #fff;
}

.copy-link {
    padding: 6px 8px;
}

.progress-block {
    margin-bottom: 18px;
}

.progress-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    color: var(--muted);
    font-weight: 800;
}

.progress-meta span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.progress-track,
.mini-progress div {
    overflow: hidden;
    border-radius: 999px;
    background: #e7ecef;
}

.progress-track {
    height: 12px;
}

.progress-track div,
.mini-progress i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--teal), var(--blue));
}

.download-area {
    display: grid;
    gap: 12px;
}

.artifact-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.artifact-item {
    display: flex;
    min-height: 70px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    background: #fff;
}

.artifact-item:not(.muted) {
    border-color: #b9d8d5;
    background: #fbfffe;
}

.artifact-item strong,
.artifact-item span {
    display: block;
}

.artifact-item span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.artifact-item.muted {
    background: #f8fafb;
    color: #7b8790;
}

.continue-card {
    display: grid;
    grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr);
    gap: 18px;
    margin-top: 18px;
    border: 1px solid #bfd7d4;
    border-radius: 8px;
    padding: 16px;
    background: #f5fbfa;
}

.continue-card h3 {
    margin-bottom: 6px;
}

.continue-card p {
    margin-bottom: 0;
    color: var(--muted);
    font-weight: 700;
}

.continue-form {
    display: grid;
    gap: 14px;
}

.current-job-card {
    display: grid;
    gap: 14px;
}

.side-summary {
    display: grid;
    gap: 5px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    background: #fbfcfd;
}

.side-summary span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.side-summary strong {
    overflow-wrap: anywhere;
}

.danger-zone {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 18px;
    border: 1px solid #efb1aa;
    border-radius: 8px;
    padding: 14px;
    background: #fff7f6;
}

.danger-zone strong,
.danger-zone span {
    display: block;
}

.danger-zone span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.filter-form {
    display: grid;
    grid-template-columns: minmax(130px, 170px) 80px auto;
    gap: 8px;
    align-items: center;
}

.jobs-table {
    display: grid;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.jobs-head,
.jobs-row {
    display: grid;
    grid-template-columns: minmax(120px, 0.9fr) minmax(180px, 1.4fr) minmax(105px, 0.7fr) minmax(130px, 0.8fr) minmax(150px, 0.9fr) minmax(150px, auto);
    gap: 12px;
    align-items: center;
    padding: 12px;
}

.jobs-head {
    background: #eef2f4;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.jobs-row {
    border-top: 1px solid var(--border);
    background: #fff;
}

.jobs-row > div {
    min-width: 0;
}

.jobs-row strong,
.jobs-row span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.jobs-row span {
    color: var(--muted);
    font-size: 13px;
}

.badge {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.status-completed {
    background: #e8f6ee;
    color: var(--green);
}

.status-running {
    background: #eaf1fb;
    color: var(--blue);
}

.status-pending {
    background: #fff5db;
    color: var(--yellow);
}

.status-failed {
    background: #fcebea;
    color: var(--red);
}

.status-neutral {
    background: #eef2f4;
    color: var(--muted);
}

.mini-progress {
    display: grid;
    gap: 5px;
}

.mini-progress div {
    height: 8px;
}

.row-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.empty-state {
    display: flex;
    min-height: 150px;
    align-items: center;
    justify-content: center;
    border: 1px dashed #b7c4cc;
    border-radius: 8px;
    background: #fbfcfd;
    color: var(--muted);
    font-weight: 800;
    text-align: center;
}

.error-state {
    border-color: #efb1aa;
    background: #fff4f3;
    color: var(--red);
}

.pager {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
    color: var(--muted);
    font-weight: 800;
}

@media (max-width: 1120px) {
    .workspace,
    .connection-bar {
        grid-template-columns: 1fr;
    }

    .connection-form,
    .detail-grid,
    .insight-strip,
    .continue-card,
    .output-options.compact-options {
        grid-template-columns: 1fr 1fr;
    }

    .jobs-head {
        display: none;
    }

    .jobs-row {
        grid-template-columns: 1fr 1fr;
        gap: 14px;
    }

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

@media (max-width: 720px) {
    .topbar,
    .top-actions,
    .panel-heading,
    .section-title-row {
        align-items: stretch;
        flex-direction: column;
    }

    .shell {
        padding: 14px;
    }

    .connection-form,
    .form-grid,
    .control-row,
    .output-options,
    .output-options.compact-options,
    .find-form,
    .detail-grid,
    .insight-strip,
    .continue-card,
    .artifact-grid,
    .filter-form,
    .jobs-row {
        grid-template-columns: 1fr;
    }

    .artifact-item,
    .row-actions,
    .danger-zone {
        align-items: stretch;
        flex-direction: column;
    }

    .button,
    .button.compact {
        width: 100%;
    }
}
