/* Core Scientific — taken from the live marketing site so the portal reads as part of it:
   Montserrat for headings (uppercase, 700), Source Sans Pro for everything else, and
   #EA802E for the one action on the page. */

:root {
    --brand-orange: #ea802e;
    --brand-orange-dark: #d16f21;
    --brand-green: #04693e;
    --ink: #181818;
    /* Headings and form-input text are a desaturated plum on the marketing site, not the
       near-black the body copy uses. Two roles, two values. */
    --ink-heading: #3c3950;
    --ink-muted: #5f727f;
    --ink-faint: #99a9b5;
    --surface: #f4f6f7;
    /* The utility strip: a near-black navy under a lighter rule, top and bottom. */
    --topbar: #212331;
    --topbar-rule: #474b61;
    --card: #ffffff;
    --line: #dfe5e8;
    --danger: #c0392b;

    --heading: Montserrat, "Segoe UI", system-ui, sans-serif;
    --body: "Source Sans 3", "Source Sans Pro", "Segoe UI", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--surface);
}

h1, h2, h3 {
    font-family: var(--heading);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--ink-heading);
    margin: 0 0 0.5rem;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.125rem; }
h1:focus { outline: none; }

a { color: var(--brand-orange-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

hr { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }

/* Sign-in, registration and password pages: one centred card, the shape customers
   already know from the Experience Cloud portal. */
.auth-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    width: 100%;
    max-width: 26rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(24, 24, 24, 0.06);
}

.auth-logo {
    display: block;
    margin: 0 auto 1.75rem;
    height: 40px;
    width: auto;
}

.auth-footer {
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: var(--ink-muted);
    text-align: center;
}

.auth-footer a { display: inline-block; margin: 0 0.5rem; }

.auth-aside {
    margin-top: 1.5rem;
    font-size: 0.8125rem;
    color: var(--ink-faint);
    text-align: center;
}

/* Form controls. The scaffold emits Bootstrap's class names and Bootstrap is not
   loaded, so these are defined here rather than pulled in wholesale. */
.form-floating { position: relative; margin-bottom: 1rem; }

.form-control {
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-family: var(--body);
    font-size: 1rem;
    color: var(--ink);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 3px;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--brand-orange);
    box-shadow: 0 0 0 3px rgba(234, 128, 46, 0.15);
}

.form-label, .form-floating > label {
    display: block;
    margin-bottom: 0.3125rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--ink-muted);
}

/* The label follows the input in the markup, so it is moved above it here rather than
   by reordering every page. */
.form-floating { display: flex; flex-direction: column; }
.form-floating > input { order: 2; }
.form-floating > label { order: 1; }
.form-floating > .validation-message { order: 3; }

.form-check { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }
.form-check-input { width: 1rem; height: 1rem; accent-color: var(--brand-orange); margin: 0; }
.form-check-label { font-size: 0.9375rem; color: var(--ink-muted); }
.darker-border-checkbox.form-check-input { border-color: #929292; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.625rem 1rem;
    font-family: var(--heading);
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: center;
    border: 1px solid transparent;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.12s ease;
}

.btn:hover { text-decoration: none; }
.w-100 { width: 100%; }

.btn-primary { background: var(--brand-orange); color: #fff; }
.btn-primary:hover { background: var(--brand-orange-dark); }

.btn-lg { padding: 0.75rem 1.25rem; font-size: 0.875rem; }

.btn-link {
    background: none;
    border: 0;
    padding: 0;
    color: var(--brand-orange-dark);
    font-family: var(--body);
    font-size: 0.875rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.btn-link:hover { text-decoration: underline; }

/* Validation and status */
.valid.modified:not([type=checkbox]) { outline: none; }
.invalid { border-color: var(--danger) !important; }

.validation-message, .text-danger {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    color: var(--danger);
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 3px;
    font-size: 0.9375rem;
    margin-bottom: 1rem;
}

.alert-danger { background: #fdecea; border: 1px solid #f5c6c2; color: #8c2620; }
.alert-success { background: #eaf6f0; border: 1px solid #bfe3d1; color: #14603f; }

.blazor-error-boundary {
    background: var(--danger);
    padding: 1rem;
    color: #fff;
}

.blazor-error-boundary::after { content: "An error has occurred."; }

/* Content inside the portal chrome. The marketing site sets its page title at 32px over a
   generous top margin, and its section headings at 36px; these are the same relationships
   at the smaller scale an application page wants. */

.page h1 { font-size: 2rem; line-height: 1.2; margin-bottom: 1.5rem; }
.page h2 { font-size: 1.25rem; margin-top: 2.5rem; }

.lede { color: var(--ink-muted); font-size: 1.125rem; max-width: 60ch; }

/* Forms that create something in Salesforce. Grouped into fieldsets because the container
   request asks four unrelated questions and a flat column of inputs reads as one. */

.field-group {
    border: 1px solid var(--line);
    background: var(--card);
    padding: 1.25rem 1.5rem 1.5rem;
    margin: 0 0 1.5rem;
}

.field-group legend {
    font-family: var(--heading);
    font-weight: 700;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-heading);
    padding: 0 0.5rem;
}

.field-hint { color: var(--ink-muted); font-size: 0.9375rem; margin: 0 0 1rem; }

.field { display: block; margin: 0 0 1rem; }
.field > span { display: block; margin-bottom: 0.35rem; font-size: 0.9375rem; color: var(--ink-muted); }
.field:last-child { margin-bottom: 0; }

.count-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 1rem;
}

.count-grid label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.9375rem;
    color: var(--ink-muted);
}

.count-grid input {
    font-family: var(--body);
    font-size: 1rem;
    padding: 0.5rem 0.65rem;
    color: var(--ink);
    background: var(--card);
    border: 1px solid var(--line);
    width: 100%;
}

.count-grid input:focus, .field-group textarea:focus, .field-group select:focus {
    outline: none;
    border-color: var(--brand-orange);
}

.field-check {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
    font-size: 0.9375rem;
}

.field-check input { width: 1rem; height: 1rem; accent-color: var(--brand-orange); margin: 0; }

.notice {
    padding: 0.9rem 1.1rem;
    margin: 0 0 1.5rem;
    border-left: 4px solid;
    background: var(--card);
}

.notice-good { border-color: var(--brand-green); }
.notice-bad { border-color: var(--danger); color: var(--danger); }

/* Home: the two things a customer comes to do, then where their material is. */

.cta-row { display: flex; gap: 1rem; flex-wrap: wrap; margin: 0 0 2.5rem; }
.cta-row .btn { width: auto; padding-inline: 1.5rem; }
.btn-secondary { background: var(--brand-green); color: #fff; }
.btn-secondary:hover { background: #035430; }

.lot {
    background: var(--card);
    border: 1px solid var(--line);
    padding: 1.25rem 1.5rem;
    margin: 0 0 1rem;
}

.lot-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: baseline; }

.lot-number {
    font-family: var(--heading);
    font-weight: 700;
    text-transform: uppercase;
    color: var(--ink-heading);
}

.lot-date { color: var(--ink-muted); font-size: 0.9375rem; }

/* The four-stage tracker. The connecting line is drawn behind the dots so it does not
   need a pseudo-element per step. */
.tracker {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    list-style: none;
    margin: 1.5rem 0 0;
    padding: 0;
    position: relative;
}

.tracker::before {
    content: "";
    position: absolute;
    top: 7px;
    left: 12.5%;
    right: 12.5%;
    height: 2px;
    background: var(--line);
}

.step { text-align: center; position: relative; }

.dot {
    display: block;
    width: 16px;
    height: 16px;
    margin: 0 auto 0.6rem;
    border-radius: 50%;
    background: var(--card);
    border: 2px solid var(--line);
    position: relative;
    z-index: 1;
}

.step.done .dot { background: var(--brand-green); border-color: var(--brand-green); }

.step-label {
    display: block;
    font-family: var(--heading);
    font-weight: 700;
    font-size: 0.625rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-faint);
    padding: 0 0.25rem;
}

.step.done .step-label { color: var(--ink-heading); }

.assay {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0 0;
    border-top: 1px solid var(--line);
}

.assay th, .assay td { text-align: left; padding: 0.55rem 0; font-size: 0.9375rem; }

.assay th {
    font-family: var(--heading);
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-muted);
    padding-top: 1rem;
}

.assay td:not(:first-child), .assay th:not(:first-child) { text-align: right; }
.assay tbody td { color: var(--ink-heading); }
.assay tfoot td { border-top: 1px solid var(--line); font-weight: 700; color: var(--ink-heading); }

.lot-settled { margin: 0.75rem 0 0; font-size: 0.875rem; color: var(--ink-muted); }

.activity { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); }
.activity th, .activity td { text-align: left; padding: 0.7rem 1rem; border-bottom: 1px solid var(--line); font-size: 0.9375rem; }
.activity th { font-family: var(--heading); font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-muted); }
.activity tr:last-child td { border-bottom: 0; }

@media (max-width: 600px) {
    .tracker { grid-template-columns: 1fr; gap: 0.75rem; text-align: left; }
    .tracker::before { display: none; }
    .step { display: flex; align-items: center; gap: 0.6rem; text-align: left; }
    .dot { margin: 0; }
    /* Stack each row instead of scrolling it sideways: four columns never fit a phone,
       and a table you have to drag is worse than one you scroll past. */
    .activity thead { display: none; }
    .activity, .activity tbody, .activity tr, .activity td { display: block; width: 100%; }

    .activity tr { border-bottom: 1px solid var(--line); padding: 0.85rem 1rem; }
    .activity tr:last-child { border-bottom: 0; }

    .activity td {
        border: 0;
        padding: 0.2rem 0;
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 1rem;
    }

    .activity td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        font-family: var(--heading);
        font-size: 0.625rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--ink-muted);
    }

    /* The assay table is narrow enough to keep its shape. */
    .assay th, .assay td { padding-inline: 0; font-size: 0.875rem; }
}

/* Lot detail */

.crumb { margin: 0 0 0.5rem; font-size: 0.875rem; }
a.lot-number { text-decoration: none; }
a.lot-number:hover { color: var(--brand-orange); }

.assay.standalone { border-top: 0; margin-top: 0; }

.files { list-style: none; margin: 0 0 1rem; padding: 0; }

.files li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: baseline;
    background: var(--card);
    border: 1px solid var(--line);
    border-bottom: 0;
    padding: 0.8rem 1.1rem;
}

.files li:last-child { border-bottom: 1px solid var(--line); }
.file-meta { color: var(--ink-muted); font-size: 0.8125rem; }

/* File preview.
   A native <dialog>, so Escape, focus trapping and the backdrop come for free rather than
   being reimplemented - which matters more here than usual, because this app has no
   interactivity to lean on. */

.file-open {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    color: var(--brand-orange-dark);
    cursor: pointer;
    text-align: left;
}

.file-open:hover { text-decoration: underline; }

.preview {
    width: min(90vw, 900px);
    height: min(88vh, 1100px);
    padding: 0;
    border: 0;
    background: var(--card);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

.preview::backdrop { background: rgba(33, 35, 49, 0.6); }

.preview-head {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--line);
}

#file-preview-name {
    font-family: var(--heading);
    font-weight: 700;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--ink-heading);
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#file-preview-download { font-size: 0.875rem; white-space: nowrap; }

#file-preview-close {
    background: none;
    border: 0;
    font-size: 1.5rem;
    line-height: 1;
    padding: 0 0.25rem;
    cursor: pointer;
    color: var(--ink-muted);
}

#file-preview-close:hover { color: var(--ink-heading); }

.preview iframe {
    display: block;
    width: 100%;
    height: calc(100% - 52px);
    border: 0;
}

@media (max-width: 600px) {
    /* A PDF in a phone-sized frame is unreadable; the browser's own viewer is better. */
    .preview { width: 96vw; height: 80vh; }
}
