:root,
html[data-theme="light"] {
    --brand-navy: #0a3269;
    --brand-blue: #208fd1;
    --brand-cyan: #13d2df;

    --background: #f5f9fc;
    --background-secondary: #edf5fa;

    --surface: #ffffff;
    --surface-raised: #ffffff;
    --surface-hover: #f1f8fc;

    --text: #102b4d;
    --text-soft: #405a75;
    --text-muted: #71859a;

    --border: #dce8f1;
    --border-strong: #c7dae8;

    --primary: #0a3975;
    --primary-hover: #062b5b;

    --accent: #10cedc;
    --accent-soft: #dffbfc;

    --focus: rgba(19, 210, 223, 0.30);

    --shadow-small:
        0 4px 14px rgba(11, 49, 95, 0.07);

    --shadow:
        0 18px 50px rgba(11, 49, 95, 0.10);

    --shadow-button:
        0 8px 20px rgba(10, 57, 117, 0.20);
}


html[data-theme="dark"] {
    --background: #061426;
    --background-secondary: #091b31;

    --surface: #0d223c;
    --surface-raised: #102844;
    --surface-hover: #142f4d;

    --text: #f1f8fd;
    --text-soft: #bed0df;
    --text-muted: #8da7bd;

    --border: #213d58;
    --border-strong: #2a4c6a;

    --primary: #16cfdd;
    --primary-hover: #4ce4ed;

    --accent: #16d6e2;
    --accent-soft: #103e4b;

    --focus: rgba(22, 214, 226, 0.28);

    --shadow-small:
        0 5px 18px rgba(0, 0, 0, 0.22);

    --shadow:
        0 20px 60px rgba(0, 0, 0, 0.32);

    --shadow-button:
        0 8px 26px rgba(11, 213, 226, 0.12);
}


html[data-font-size="small"] {
    font-size: 14px;
}


html[data-font-size="normal"] {
    font-size: 16px;
}


html[data-font-size="large"] {
    font-size: 18px;
}


* {
    box-sizing: border-box;
}


html {
    min-height: 100%;

    color-scheme: light;
}


html[data-theme="dark"] {
    color-scheme: dark;
}


body {
    min-height: 100vh;

    margin: 0;

    display: flex;
    flex-direction: column;

    background:
        radial-gradient(
            circle at 10% 0%,
            color-mix(
                in srgb,
                var(--accent) 9%,
                transparent
            ),
            transparent 30rem
        ),
        radial-gradient(
            circle at 95% 20%,
            color-mix(
                in srgb,
                var(--brand-blue) 6%,
                transparent
            ),
            transparent 34rem
        ),
        var(--background);

    color: var(--text);

    font-family:
        "Lato",
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    font-size: 1rem;
    line-height: 1.55;

    transition:
        background-color 0.2s ease,
        color 0.2s ease;
}


a {
    color: inherit;
}


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


button,
a,
input,
select,
textarea {
    outline: none;
}


button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    box-shadow:
        0 0 0 4px var(--focus);
}


.topbar {
    position: sticky;
    top: 0;
    z-index: 100;

    border-bottom: 1px solid var(--border);

    background:
        color-mix(
            in srgb,
            var(--surface) 90%,
            transparent
        );

    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}


.topbar__inner {
    width: min(1500px, calc(100% - 40px));

    min-height: 78px;

    margin: 0 auto;

    display: flex;
    align-items: center;
    gap: 24px;
}


.brand-group {
    display: flex;
    align-items: center;
    gap: 16px;

    flex-shrink: 0;
}


.brand {
    display: flex;
    align-items: center;
    gap: 10px;

    text-decoration: none;
}


.logo-crop {
    position: relative;

    display: block;

    overflow: hidden;

    flex-shrink: 0;

    border: 1px solid
        color-mix(
            in srgb,
            var(--brand-blue) 25%,
            var(--border)
        );

    background: #ffffff;

    box-shadow: var(--shadow-small);
}


.logo-crop img {
    position: absolute;

    left: 50%;

    max-width: none;

    transform: translateX(-50%);
}


.logo-crop--photometry {
    width: 46px;
    height: 46px;

    border-radius: 14px;
}


.logo-crop--photometry img {
    top: -10px;

    width: 92px;
    height: 92px;
}


.logo-crop--ccdphot {
    width: 30px;
    height: 30px;

    border-radius: 9px;
}


.logo-crop--ccdphot img {
    top: -5px;

    width: 60px;
    height: 60px;
}


.brand__wordmark {
    color: var(--text);

    font-size: 1.34rem;
    font-weight: 900;

    letter-spacing: -0.035em;

    white-space: nowrap;
}


.brand__wordmark span {
    color: var(--brand-cyan);
}


.powered-by {
    min-height: 40px;

    padding-left: 16px;

    display: flex;
    align-items: center;
    gap: 7px;

    border-left: 1px solid var(--border);
}


.powered-by__label {
    color: var(--text-muted);

    font-size: 0.65rem;
    font-weight: 700;

    letter-spacing: 0.06em;
    text-transform: uppercase;
}


.powered-by__name {
    color: var(--brand-navy);

    font-size: 0.83rem;
    font-weight: 900;
}


html[data-theme="dark"] .powered-by__name {
    color: #d9ecff;
}


.powered-by__name span {
    color: var(--brand-cyan);
}


.main-nav {
    min-width: 0;

    margin-left: auto;

    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 2px;
}


.main-nav a {
    padding: 9px 10px;

    flex: 0 0 auto;

    display: inline-flex;
    align-items: center;
    gap: 6px;

    border-radius: 10px;

    color: var(--text-muted);

    font-size: 0.84rem;
    font-weight: 700;

    line-height: 1.15;
    text-decoration: none;
    white-space: nowrap;

    transition:
        background 0.15s ease,
        color 0.15s ease,
        transform 0.15s ease;
}


.main-nav a:hover {
    background: var(--surface-hover);

    color: var(--text);

    transform: translateY(-1px);
}


.main-nav a[aria-current="page"] {
    background:
        color-mix(
            in srgb,
            var(--accent) 10%,
            var(--surface-raised)
        );

    color: var(--text);

    box-shadow:
        inset 0 0 0 1px
        color-mix(
            in srgb,
            var(--accent) 24%,
            var(--border)
        );
}


.main-nav a[aria-current="page"]::after {
    width: 5px;
    height: 5px;

    border-radius: 50%;

    background: var(--accent);

    content: "";
}


.topbar__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}


.topbar__actions--guest {
    margin-left: auto;
}


.font-control {
    padding: 3px;

    display: flex;
    align-items: center;

    border: 1px solid var(--border);
    border-radius: 11px;

    background: var(--surface-raised);

    box-shadow: var(--shadow-small);
}


.font-control__button {
    min-width: 31px;
    min-height: 31px;

    padding: 0 6px;

    border: 0;
    border-radius: 8px;

    background: transparent;

    color: var(--text-muted);

    font-size: 0.75rem;
    font-weight: 900;

    cursor: pointer;

    transition:
        background 0.15s ease,
        color 0.15s ease;
}


.font-control__button:hover {
    color: var(--text);
}


.font-control__button.is-active {
    background: var(--background-secondary);

    color: var(--text);

    box-shadow:
        inset 0 0 0 1px var(--border);
}


.theme-toggle {
    min-height: 38px;

    padding: 0 10px;

    display: flex;
    align-items: center;
    gap: 6px;

    border: 1px solid var(--border);
    border-radius: 11px;

    background: var(--surface-raised);

    color: var(--text);

    box-shadow: var(--shadow-small);

    font-weight: 700;

    cursor: pointer;

    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        transform 0.15s ease;
}


.theme-toggle:hover {
    border-color: var(--border-strong);

    background: var(--surface-hover);

    transform: translateY(-1px);
}


.theme-toggle__icon {
    width: 18px;

    display: inline-flex;
    justify-content: center;

    color: var(--brand-cyan);

    font-size: 1rem;
}


.theme-toggle__icon--dark {
    display: none;
}


html[data-theme="dark"]
.theme-toggle__icon--light {
    display: none;
}


html[data-theme="dark"]
.theme-toggle__icon--dark {
    display: inline-flex;
}


.theme-toggle__label {
    color: var(--text-soft);

    font-size: 0.74rem;
}


.user-chip {
    min-height: 38px;

    padding: 4px 10px 4px 4px;

    display: flex;
    align-items: center;
    gap: 8px;

    border: 1px solid var(--border);
    border-radius: 999px;

    background: var(--surface-raised);

    box-shadow: var(--shadow-small);
}


.user-chip__avatar {
    width: 29px;
    height: 29px;

    display: grid;
    place-items: center;

    border-radius: 50%;

    background:
        linear-gradient(
            140deg,
            var(--brand-navy),
            var(--brand-blue) 55%,
            var(--brand-cyan)
        );

    color: #ffffff;

    font-size: 0.72rem;
    font-weight: 900;
}


.user-chip__name {
    max-width: 110px;

    overflow: hidden;

    color: var(--text-soft);

    font-size: 0.76rem;
    font-weight: 700;

    text-overflow: ellipsis;
    white-space: nowrap;
}


.page-shell {
    width: min(1180px, calc(100% - 40px));

    margin: 0 auto;

    padding: 58px 0 84px;

    flex: 1;
}


.hero {
    margin-bottom: 44px;

    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 32px;
}


.eyebrow {
    margin: 0 0 10px;

    color: var(--brand-cyan);

    font-size: 0.75rem;
    font-weight: 900;

    letter-spacing: 0.12em;
    text-transform: uppercase;
}


.hero h1,
.page-heading h1 {
    max-width: 780px;

    margin: 0;

    color: var(--text);

    font-size: clamp(2.4rem, 5vw, 4rem);
    font-weight: 900;

    letter-spacing: -0.05em;
    line-height: 1;
}


.page-heading h1 {
    font-size: clamp(2.2rem, 4vw, 3.2rem);
}


.hero__description,
.page-heading__description {
    max-width: 720px;

    margin: 19px 0 0;

    color: var(--text-muted);

    font-size: 1.06rem;
}


.hero__actions {
    display: flex;
    gap: 12px;
}


.button {
    min-height: 44px;

    padding: 0 19px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    border: 1px solid transparent;
    border-radius: 12px;

    background:
        linear-gradient(
            135deg,
            var(--primary),
            color-mix(
                in srgb,
                var(--primary) 78%,
                var(--brand-blue)
            )
        );

    color: #ffffff;

    box-shadow: var(--shadow-button);

    font-weight: 900;

    text-decoration: none;

    cursor: pointer;

    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        filter 0.15s ease;
}


html[data-theme="dark"] .button:not(.button--ghost) {
    color: #031625;
}


.button:hover {
    transform: translateY(-2px);

    filter: brightness(1.05);

    box-shadow:
        0 11px 28px
        color-mix(
            in srgb,
            var(--primary) 25%,
            transparent
        );
}


.button:active {
    transform: translateY(0);
}


.button--ghost {
    border-color: var(--border);

    background: var(--surface-raised);

    color: var(--text);

    box-shadow: var(--shadow-small);
}


.button--ghost:hover {
    background: var(--surface-hover);

    box-shadow: var(--shadow-small);

    filter: none;
}


.button--small {
    min-height: 38px;

    padding: 0 13px;

    border-radius: 10px;

    font-size: 0.78rem;
}


.section-heading {
    margin: 0 0 17px;

    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
}


.section-heading h2 {
    margin: 0;

    font-size: 1.4rem;
    font-weight: 900;

    letter-spacing: -0.025em;
}


.section-heading p {
    margin: 4px 0 0;

    color: var(--text-muted);
}


.card {
    border: 1px solid var(--border);
    border-radius: 18px;

    background: var(--surface);

    box-shadow: var(--shadow);

    transition:
        background 0.2s ease,
        border-color 0.2s ease;
}


.job-table-wrapper {
    overflow-x: auto;
}


.job-table {
    width: 100%;

    border-collapse: collapse;
}


.job-table th,
.job-table td {
    padding: 17px 20px;

    border-bottom: 1px solid var(--border);

    text-align: left;
}


.job-table th {
    color: var(--text-muted);

    font-size: 0.68rem;
    font-weight: 900;

    letter-spacing: 0.08em;
    text-transform: uppercase;
}


.job-table tbody tr {
    transition: background 0.15s ease;
}


.job-table tbody tr:hover {
    background: var(--surface-hover);
}


.job-table tbody tr:last-child td {
    border-bottom: 0;
}


.job-id {
    color: var(--primary);

    font-weight: 900;

    text-decoration: none;
}


html[data-theme="dark"] .job-id {
    color: var(--brand-cyan);
}


.filename {
    max-width: 400px;

    overflow: hidden;

    color: var(--text);

    font-weight: 700;

    text-overflow: ellipsis;
    white-space: nowrap;
}


.muted {
    color: var(--text-muted);
}


.status {
    padding: 5px 10px;

    display: inline-flex;
    align-items: center;
    gap: 7px;

    border: 1px solid transparent;
    border-radius: 999px;

    font-size: 0.72rem;
    font-weight: 900;

    text-transform: capitalize;
}


.status::before {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: currentColor;

    content: "";
}


.status--queued {
    border-color: rgba(180, 133, 0, 0.20);

    background:
        color-mix(
            in srgb,
            #e5ad14 15%,
            var(--surface)
        );

    color: #a47700;
}


.status--running {
    border-color: rgba(19, 164, 220, 0.20);

    background:
        color-mix(
            in srgb,
            #20a9e0 15%,
            var(--surface)
        );

    color: #1386b5;
}


.status--success {
    border-color: rgba(28, 158, 92, 0.20);

    background:
        color-mix(
            in srgb,
            #28b46c 15%,
            var(--surface)
        );

    color: #208450;
}


.status--failed {
    border-color: rgba(197, 64, 64, 0.20);

    background:
        color-mix(
            in srgb,
            #d64a4a 15%,
            var(--surface)
        );

    color: #bd4141;
}


.status--cancelled {
    border-color: var(--border);

    background: var(--background-secondary);

    color: var(--text-muted);
}


html[data-theme="dark"] .status--queued {
    color: #ffd56c;
}


html[data-theme="dark"] .status--running {
    color: #6ed8ff;
}


html[data-theme="dark"] .status--success {
    color: #73e2a8;
}


html[data-theme="dark"] .status--failed {
    color: #ff9696;
}


.empty-state {
    padding: 70px 30px;

    text-align: center;
}


.empty-state__icon {
    margin-bottom: 15px;

    color: var(--brand-cyan);

    font-size: 2.6rem;
}


.empty-state h3 {
    margin: 0 0 8px;

    font-size: 1.3rem;
}


.empty-state p {
    max-width: 440px;

    margin: 0 auto 24px;

    color: var(--text-muted);
}


.page-heading {
    margin-bottom: 30px;
}


.back-link {
    margin-bottom: 24px;

    display: inline-flex;

    color: var(--text-muted);

    font-size: 0.88rem;
    font-weight: 700;

    text-decoration: none;
}


.back-link:hover {
    color: var(--text);
}


.form-card {
    max-width: 760px;

    padding: 30px;
}


.form-field {
    margin-bottom: 24px;
}


.form-field label {
    margin-bottom: 8px;

    display: block;

    font-size: 0.9rem;
    font-weight: 900;
}


.form-field input[type="file"],
.login-form input[type="text"],
.login-form input[type="password"],
input[type="text"],
input[type="password"],
select,
textarea {
    width: 100%;

    padding: 13px 14px;

    border: 1px solid var(--border);
    border-radius: 12px;

    background: var(--background-secondary);

    color: var(--text);

    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        background 0.15s ease;
}


.form-field input[type="file"]:hover,
.login-form input:hover,
input[type="text"]:hover,
input[type="password"]:hover,
select:hover,
textarea:hover {
    border-color: var(--border-strong);
}


.form-help {
    margin: 8px 0 0;

    color: var(--text-muted);

    font-size: 0.8rem;
}


.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 11px;

    color: var(--text-soft);

    font-size: 0.88rem;
}


.checkbox-row input {
    width: 17px;
    height: 17px;

    margin-top: 3px;

    accent-color: var(--brand-cyan);
}


.error-list,
.errorlist {
    margin: 8px 0 0;
    padding: 0;

    color: #d84d4d;

    font-size: 0.82rem;

    list-style: none;
}


.detail-grid {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 18px;
}


.detail-card {
    padding: 22px;
}


.detail-card__label {
    margin-bottom: 7px;

    color: var(--text-muted);

    font-size: 0.67rem;
    font-weight: 900;

    letter-spacing: 0.08em;
    text-transform: uppercase;
}


.detail-card__value {
    word-break: break-word;

    font-weight: 700;
}


.detail-card--wide {
    grid-column: 1 / -1;
}


.code-value {
    overflow-wrap: anywhere;

    font-family:
        ui-monospace,
        SFMono-Regular,
        Menlo,
        Monaco,
        Consolas,
        monospace;

    font-size: 0.78rem;
}


.info-grid {
    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 18px;
}


.info-card {
    padding: 25px;
}


.info-card h3 {
    margin: 0 0 10px;

    font-size: 1.12rem;
    font-weight: 900;
}


.info-card p {
    margin: 0;

    color: var(--text-muted);
}


.login-shell {
    max-width: 450px;

    margin: 50px auto;
}


.login-card {
    padding: 32px;
}


.login-card h1 {
    margin-top: 0;

    font-size: 2.2rem;
    font-weight: 900;

    letter-spacing: -0.04em;
}


.login-form p {
    margin-bottom: 20px;
}


.login-form label {
    margin-bottom: 7px;

    display: block;

    font-size: 0.88rem;
    font-weight: 900;
}


.login-form input {
    margin-top: 7px;
}


.brand-showcase {
    margin-top: 28px;

    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 20px;
}


.brand-card {
    padding: 28px;
}


.brand-card__logo {
    min-height: 280px;

    margin-bottom: 20px;

    display: grid;
    place-items: center;

    overflow: hidden;

    border: 1px solid var(--border);
    border-radius: 15px;

    background: #ffffff;
}


.brand-card__logo img {
    width: min(100%, 330px);
    height: auto;

    display: block;
}


.brand-card h2 {
    margin: 0 0 8px;

    font-size: 1.35rem;
    font-weight: 900;
}


.brand-card p {
    margin: 0;

    color: var(--text-muted);
}


.site-footer {
    border-top: 1px solid var(--border);

    color: var(--text-muted);

    font-size: 0.75rem;
}


.site-footer__inner {
    width: min(1180px, calc(100% - 40px));

    min-height: 70px;

    margin: 0 auto;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}


@media (max-width: 1380px) {
    .topbar__inner {
        gap: 16px;
    }

    .main-nav a {
        padding-inline: 8px;

        font-size: 0.8rem;
    }

    .topbar__actions {
        gap: 6px;
    }
}


@media (max-width: 1250px) {
    .powered-by {
        display: none;
    }

    .main-nav a {
        padding-inline: 7px;

        font-size: 0.78rem;
    }
}


@media (max-width: 1080px) {
    .main-nav {
        display: none;
    }

    .topbar__actions {
        margin-left: auto;
    }
}


@media (max-width: 760px) {
    .topbar__inner,
    .page-shell,
    .site-footer__inner {
        width: min(100% - 24px, 1180px);
    }

    .topbar__inner {
        min-height: 68px;
    }

    .brand__wordmark {
        font-size: 1.05rem;
    }

    .logo-crop--photometry {
        width: 40px;
        height: 40px;
    }

    .logo-crop--photometry img {
        top: -8px;

        width: 80px;
        height: 80px;
    }

    .user-chip,
    .theme-toggle__label {
        display: none;
    }

    .font-control {
        display: none;
    }

    .page-shell {
        padding-top: 36px;
    }

    .hero {
        grid-template-columns: 1fr;
    }

    .hero__actions {
        align-items: stretch;
        flex-direction: column;
    }

    .detail-grid,
    .info-grid,
    .brand-showcase {
        grid-template-columns: 1fr;
    }

    .detail-card--wide {
        grid-column: auto;
    }

    .job-table th:nth-child(4),
    .job-table td:nth-child(4) {
        display: none;
    }

    .brand-card__logo {
        min-height: 220px;
    }
}

/* D41: consistent keyboard focus across workspace navigation and linked cards */

:is(
    .dashboard-stat,
    .dashboard-science-stat,
    .dashboard-view-switch__item,
    .dashboard-pagination__page,
    .series-view-switch__item,
    .series-card,
    .olc-object-card,
    .docs-nav__item,
    .storage-stat--link
):focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent) 30%, transparent);
    outline-offset: 3px;
}
