:root {
    color-scheme: light;
    font-family:
        Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", sans-serif;
    font-synthesis: none;
    --page: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #f9fafc;
    --text: #18202f;
    --muted: #687386;
    --line: #e4e9f1;
    --line-strong: #d6dde8;
    --accent: #315ee8;
    --accent-strong: #254cc4;
    --accent-soft: #edf2ff;
    --success: #237a57;
    --success-soft: #e9f7f0;
    --warning: #98610d;
    --warning-soft: #fff5df;
    --danger: #b13b46;
    --danger-soft: #fff0f1;
    --shadow: 0 18px 48px rgb(25 38 65 / 8%);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--page);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 82% 6%, rgb(49 94 232 / 9%), transparent 28rem),
        linear-gradient(180deg, #fafbfe 0, var(--page) 30rem);
}

button,
input {
    font: inherit;
}

button {
    touch-action: manipulation;
}

[hidden] {
    display: none !important;
}

.site-header {
    display: flex;
    align-items: center;
    min-height: 72px;
    padding: 0 4vw;
    border-bottom: 1px solid rgb(228 233 241 / 80%);
    background: rgb(255 255 255 / 78%);
    backdrop-filter: blur(18px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text);
    font-size: 1rem;
    font-weight: 680;
    letter-spacing: -0.015em;
    text-decoration: none;
}

.brand-mark {
    width: 1.05rem;
    height: 1.05rem;
    border-radius: 0.32rem;
    background: linear-gradient(145deg, #5b7df0, #274fc9);
    box-shadow: 0 5px 14px rgb(49 94 232 / 28%);
    transform: rotate(8deg);
}

.page-shell {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
    padding: clamp(3.5rem, 8vw, 7.5rem) 0 5rem;
}

.login-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(310px, 430px);
    align-items: center;
    gap: clamp(3rem, 8vw, 8rem);
    min-height: 58vh;
}

.intro-copy {
    max-width: 650px;
}

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

h1 {
    max-width: 17ch;
    margin-bottom: 1.35rem;
    font-size: clamp(2.55rem, 6vw, 5.25rem);
    font-weight: 680;
    line-height: 1.02;
    letter-spacing: -0.055em;
}

.workspace-heading h1 {
    max-width: none;
    margin-bottom: 0.8rem;
    font-size: clamp(2.3rem, 5vw, 4.25rem);
}

h2 {
    margin-bottom: 0;
    font-size: 1.35rem;
    font-weight: 680;
    line-height: 1.2;
    letter-spacing: -0.025em;
}

.eyebrow {
    margin-bottom: 0.75rem;
    color: var(--accent);
    font-size: 0.76rem;
    font-weight: 760;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.lead {
    max-width: 55ch;
    margin-bottom: 0;
    color: var(--muted);
    font-size: clamp(1.05rem, 2vw, 1.25rem);
    line-height: 1.7;
}

.lead.compact {
    font-size: 1.05rem;
}

.card {
    border: 1px solid rgb(228 233 241 / 88%);
    border-radius: var(--radius);
    background: rgb(255 255 255 / 94%);
    box-shadow: var(--shadow);
}

.login-card {
    padding: clamp(1.6rem, 4vw, 2.5rem);
}

.card-heading {
    margin-bottom: 1.7rem;
}

.stack {
    display: grid;
    gap: 1rem;
}

label:not(.file-picker) {
    display: grid;
    gap: 0.5rem;
    color: #394456;
    font-size: 0.88rem;
    font-weight: 650;
}

input[type="text"],
input[type="password"],
select,
textarea {
    width: 100%;
    min-height: 48px;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--line-strong);
    border-radius: 11px;
    outline: none;
    color: var(--text);
    background: var(--surface);
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgb(49 94 232 / 12%);
}

textarea {
    /* A browser defaults a text area to monospace; this note is prose. */
    font: inherit;
    min-height: 7rem;
    line-height: 1.55;
    resize: vertical;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0.65rem 1rem;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 680;
    line-height: 1;
    transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.button:focus-visible,
.file-picker:focus-visible {
    outline: 3px solid rgb(49 94 232 / 26%);
    outline-offset: 2px;
}

.button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.button.primary {
    color: #fff;
    background: var(--accent);
    box-shadow: 0 8px 20px rgb(49 94 232 / 18%);
}

.button.primary:hover:not(:disabled) {
    background: var(--accent-strong);
}

.button.secondary {
    border-color: var(--line-strong);
    color: #344054;
    background: var(--surface);
}

.button.secondary:hover:not(:disabled) {
    border-color: #bbc5d5;
    background: var(--surface-soft);
}

.button.danger {
    border-color: #e4b8bd;
    color: var(--danger);
    background: var(--danger-soft);
}

.button.danger:hover:not(:disabled) {
    border-color: #d89ba2;
    background: #ffe5e7;
}

.form-status {
    min-height: 1.35rem;
    margin: 0.25rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.workspace-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 3rem;
}

.account-controls {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding-bottom: 0.35rem;
}

.customer-badge {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0.45rem 0.75rem;
    border: 1px solid #dbe3f4;
    border-radius: 999px;
    color: #36508c;
    background: var(--accent-soft);
    font-size: 0.84rem;
    font-weight: 700;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(280px, 0.72fr) minmax(0, 1.6fr);
    align-items: start;
    gap: 1.5rem;
}

.upload-card,
.jobs-card {
    padding: clamp(1.35rem, 3vw, 2rem);
}

.file-picker {
    display: grid;
    gap: 0.4rem;
    min-height: 128px;
    padding: 1.25rem;
    border: 1px dashed #b9c6df;
    border-radius: 13px;
    cursor: pointer;
    place-content: center;
    text-align: center;
    background: var(--surface-soft);
    transition: border-color 140ms ease, background 140ms ease;
}

.file-picker:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.file-picker-title {
    color: #2a426f;
    font-weight: 700;
}

.file-picker-detail,
.supporting-text {
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.55;
}

.supporting-text {
    margin: 1rem 0 0;
}

/* A background note is optional and secondary to the archive itself, so the form
   keeps it folded until the analyst asks for it. A closed <details> still submits its
   field, and app.js reads the value directly rather than depending on that. */
.background-details {
    padding: 0.2rem 0;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-soft);
}

.background-details > summary {
    padding: 0.6rem 0.9rem;
    color: #334873;
    font-weight: 700;
    cursor: pointer;
}

/* label:not(.file-picker) already lays this out and out-specifies this rule, so
   only the inset and the weight of the question are added here. */
.background-field {
    padding: 0.4rem 0.9rem 0;
}

.background-field span {
    color: var(--muted);
    font-weight: 400;
}

.background-details .supporting-text {
    margin: 0;
    padding: 0.6rem 0.9rem 0.7rem;
}

code,
.job-id,
pre {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

code {
    padding: 0.12rem 0.32rem;
    border-radius: 5px;
    color: #334873;
    background: var(--accent-soft);
    font-size: 0.88em;
}

.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

/*
   One card per job. The list is a plain <ul> and each card is a grid, so the
   width of a job ID, a failure reason, or the presence of output links never
   pushes the other jobs around the way table columns did.
*/
.job-list {
    display: grid;
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.job-card {
    display: grid;
    gap: 0.7rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface-soft);
}

.job-card-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

.job-id {
    margin: 0;
    color: #27344a;
    font-size: 0.85rem;
    font-weight: 650;
    overflow-wrap: anywhere;
}

.job-card .status-pill {
    flex: none;
}

.job-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem 1.6rem;
    margin: 0;
    font-size: 0.84rem;
}

.job-meta > div {
    display: flex;
    gap: 0.4rem;
}

.job-meta dt {
    color: var(--muted);
}

.job-meta dd {
    margin: 0;
    color: #465164;
    /* A customer-chosen archive name can be long; it must not widen the card. */
    overflow-wrap: anywhere;
}

/* The gap is the only separator between output links; bordered buttons make
   each target obvious without needing punctuation between the words. */
.job-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.9rem;
    margin: 0;
    color: var(--muted);
    font-size: 0.84rem;
}

.job-actions .button {
    flex: none;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.58rem;
    border-radius: 999px;
    color: var(--pill-fg, #4d586a);
    background: var(--pill-bg, #eff2f6);
    font-size: 0.76rem;
    font-weight: 720;
}

/*
   One rule per lifecycle state documented in gpu/README.md. Colours are set through
   --pill-fg and --pill-bg so a state never has to repeat the pill chrome.
   A state with no rule below keeps the neutral pill above, which is also the
   fallback for the "incomplete" and "unknown" states the API reports.
*/
.status-job-queued {
    --pill-fg: #3957a0;
    --pill-bg: var(--accent-soft);
}

.status-running {
    --pill-fg: var(--warning);
    --pill-bg: var(--warning-soft);
}

.status-completed {
    --pill-fg: var(--success);
    --pill-bg: var(--success-soft);
}

.status-failed {
    --pill-fg: var(--danger);
    --pill-bg: var(--danger-soft);
}

.status-deleting {
    --pill-fg: #8a4f17;
    --pill-bg: #fff0d8;
}

.failure-reason {
    margin: 0;
    padding: 0.55rem 0.75rem;
    border-left: 3px solid var(--danger);
    border-radius: 0 8px 8px 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    color: var(--danger);
    background: var(--danger-soft);
    font-size: 0.84rem;
    line-height: 1.5;
}

pre {
    max-height: 70vh;
    overflow: auto;
    margin: 0;
    padding: 1.25rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: #29364a;
    background: #f8fafc;
    font-size: 0.84rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

footer {
    display: flex;
    justify-content: center;
    padding: 0 1rem 2rem;
    color: #929baa;
    font-size: 0.78rem;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@media (max-width: 850px) {
    .login-layout,
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .login-layout {
        gap: 3rem;
    }

    .login-card {
        max-width: 520px;
    }

    .workspace-heading {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 580px) {
    .site-header {
        padding: 0 1rem;
    }

    .page-shell {
        width: min(100% - 1.25rem, 1180px);
        padding-top: 2.75rem;
    }

    h1 {
        font-size: 2.65rem;
    }

    .account-controls,
    .section-heading {
        width: 100%;
    }

    .workspace-heading .account-controls {
        justify-content: space-between;
    }

    .jobs-card {
        padding-inline: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
