html, body {
    margin: 0;
    height: 100%;
    font-family: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
    color: #1a1a1a;
    background: #fff;
}

#app { height: 100%; }

.page {
    max-width: 48rem;
    margin: 0 auto;
    padding: 2rem 1.25rem;
}

h1 {
    font-size: 1.75rem;
    margin: 0 0 1rem;
}

.status {
    color: #4a4a4a;
}

.status--error {
    color: #b3261e;
}

/* Shown by index.html while the WebAssembly runtime downloads. */
.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #1b6ec2;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    inset: calc(20vh + 3.25rem) 0 auto 0;
    font-weight: 600;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.6rem 1.25rem;
    background: #ffe9a2;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* ---------- shared audit-log table ---------- */

/* The page fills the viewport and never scrolls itself: the header, stage chips and toolbar stay
   put while the table below them is the only scrolling region. */
.page {
    max-width: 90rem;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
}

.page > .audit-header,
.page > .audit-stages,
.page > .audit-toolbar,
.page > .audit-pager { flex: none; }

.audit-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.audit-status { color: #4a4a4a; }
.audit-status--error { color: #b3261e; }

/* ---------- pager ---------- */
.audit-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.85rem 0.15rem 0.2rem;
    font-size: 0.82rem;
    color: #4a4a4a;
}

.audit-pager__status {
    margin: 0;
    font-variant-numeric: tabular-nums;
}

.audit-pager__controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.audit-pager__button {
    border: 1px solid #dcdcdc;
    background: #fff;
    color: #1a1a1a;
    border-radius: 0.3rem;
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
    cursor: pointer;
    line-height: 1;
}

.audit-pager__button:hover:not(:disabled) { background: #f4f4f4; }

.audit-pager__button:disabled {
    color: #b0b0b0;
    cursor: default;
}

.audit-pager__button--page {
    min-width: 2rem;
    font-variant-numeric: tabular-nums;
}

.audit-pager__button.is-active {
    background: #0867a3;
    border-color: #0867a3;
    color: #fff;
}

.audit-pager__gap {
    padding: 0 0.15rem;
    color: #a0a0a0;
}

.audit-pager__size {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.audit-pager__select {
    border: 1px solid #dcdcdc;
    border-radius: 0.3rem;
    padding: 0.3rem 0.4rem;
    font-size: 0.8rem;
    background: #fff;
}

.audit-table-wrap {
    border: 1px solid #e6e6e6;
    border-radius: 0.4rem;
    /* The only scrolling region on the page. min-height:0 lets it shrink inside the flex column
       instead of pushing the sticky chrome off-screen. */
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.audit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
    table-layout: fixed;
}

.audit-table th {
    text-align: left;
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6a6a6a;
    background: #fbfbfb;
    /* Sticky cells drop collapsed borders, so the rule is drawn as a shadow instead. */
    box-shadow: inset 0 -1px 0 #e3e3e3;
    padding: 0.75rem 0.9rem;
    white-space: nowrap;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 2;
}

.audit-table td {
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
}

.audit-table tbody tr:hover { background: #fcfcfc; }
.audit-table tbody tr.is-expanded { background: #f7fafc; }

/* Column sizing keeps the table stable as rows stream in. */
.audit-col-when   { width: 10rem; white-space: nowrap; }
.audit-col-stage  { width: 8rem; }
.audit-col-action { width: 11rem; }
.audit-col-form   { min-width: 18rem; }
.audit-col-page   { width: 7rem; }
.audit-col-by     { width: 9rem; }
.audit-col-expand { width: 2.5rem; text-align: right; }

.audit-when {
    font-variant-numeric: tabular-nums;
    color: #b8860b;
    font-size: 0.82rem;
}

/* ---------- expand toggle + detail ---------- */
.audit-expand {
    border: 0;
    background: none;
    cursor: pointer;
    padding: 0.15rem;
    line-height: 0;
    color: #8a8a8a;
    border-radius: 0.25rem;
}

.audit-expand:hover { color: #1a1a1a; background: #f0f0f0; }

.audit-expand svg {
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.4;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.15s ease;
}

.audit-expand[aria-expanded="True"] svg { transform: rotate(180deg); }

.audit-detail-row td {    background: #f7fafc;
    padding: 0.9rem 1.2rem 1.1rem;
}

.audit-detail {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: 0.7rem 1.5rem;
    margin: 0;
}

.audit-detail__item { margin: 0; }

.audit-detail dt {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #7a7a7a;
    margin-bottom: 0.15rem;
}

.audit-detail dd {
    margin: 0;
    font-size: 0.84rem;
    color: #1a1a1a;
    word-break: break-word;
}

.audit-history { margin-top: 1rem; border-top: 1px solid #dfe6ec; padding-top: 0.8rem; }
.audit-history__title { margin: 0 0 0.5rem; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: #7a7a7a; }
.audit-history__list { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.3rem; }

.audit-history__item {
    display: grid;
    grid-template-columns: 12rem 1fr auto;
    gap: 0.75rem;
    align-items: baseline;
    font-size: 0.82rem;
    padding: 0.25rem 0.4rem;
    border-radius: 0.2rem;
    background: #fff;
}

.audit-history__when { color: #6b6b6b; font-variant-numeric: tabular-nums; white-space: nowrap; }
.audit-history__change { color: #1a1a1a; word-break: break-word; }
.audit-history__by { color: #6b6b6b; white-space: nowrap; }

@media (max-width: 40rem) {
    .audit-history__item { grid-template-columns: 1fr; gap: 0.15rem; }
}

/* ---------- ReviewWizard cells ---------- */
.audit-stage { display: inline-flex; align-items: center; gap: 0.45rem; white-space: nowrap; }
.audit-stage__dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; display: inline-block; flex: none; }

.audit-action { display: inline-flex; align-items: flex-start; gap: 0.45rem; }

.audit-action__icon {
    width: 1rem;
    height: 1rem;
    flex: none;
    margin-top: 0.05rem;
    fill: none;
    stroke: #5a5a5a;
    stroke-width: 1.3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.audit-action__label { color: #1a4f7a; font-weight: 500; }

.audit-form__name { color: #0867a3; display: block; font-weight: 500; }
.audit-form__detail { color: #6b6b6b; display: block; margin-top: 0.15rem; font-size: 0.78rem; }
.audit-form__count { display: inline-block; margin-left: 0.4rem; padding: 0.05rem 0.4rem; border-radius: 0.75rem; background: #e3eef6; color: #1a4f7a; font-size: 0.7rem; font-weight: 600; white-space: nowrap; }
.audit-source { color: #0867a3; white-space: nowrap; font-variant-numeric: tabular-nums; }
.audit-source--manual { color: #8a8a8a; font-style: italic; }

.audit-by { display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap; }

.audit-by__icon {
    width: 0.95rem;
    height: 0.95rem;
    flex: none;
    fill: none;
    stroke: #8a8a8a;
    stroke-width: 1.3;
    stroke-linecap: round;
}

/* ---------- engagement header ---------- */
.audit-header { margin-bottom: 1.4rem; }

.audit-header__bar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.audit-header__title {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0;
}

.audit-header__actions { display: flex; gap: 0.5rem; }

.audit-button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    border: 1px solid #d4d4d4;
    border-radius: 0.3rem;
    background: #fff;
    font: inherit;
    font-size: 0.82rem;
    cursor: pointer;
    color: #1a1a1a;
}

.audit-button:hover:not(:disabled) { border-color: #9a9a9a; background: #fafafa; }
.audit-button:disabled { color: #b0b0b0; cursor: default; }

.audit-button--dark { background: #1a1a1a; border-color: #1a1a1a; color: #fff; }
.audit-button--dark:hover:not(:disabled) { background: #333; border-color: #333; }

.audit-button__icon {
    width: 0.95rem;
    height: 0.95rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.3;
    stroke-linejoin: round;
}

.audit-header__subject {
    font-weight: 600;
    font-size: 0.95rem;
    margin: 0.5rem 0 0.35rem;
}

.audit-header__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
    margin: 0;
    font-size: 0.76rem;
    color: #a07d2c;
}

.audit-header__meta-item--key { color: #0867a3; }

/* ---------- wizard stage chips ---------- */
.audit-stages { margin-bottom: 1rem; }

.audit-stages__label {
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6a6a6a;
    font-weight: 600;
    margin: 0 0 0.45rem;
}

.audit-stages__hint {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
    color: #9a9a9a;
}

.audit-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.audit-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.7rem;
    border: 1px solid #e0e0e0;
    border-radius: 0.3rem;
    background: #fff;
    font: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    color: #1a1a1a;
}

.audit-chip:hover { border-color: #9a9a9a; }
.audit-chip.is-active { background: #1a3d2f; border-color: #1a3d2f; color: #fff; }
.audit-chip.is-active .audit-chip__count { background: rgba(255, 255, 255, 0.22); color: #fff; }

.audit-chip__dot { width: 0.45rem; height: 0.45rem; border-radius: 50%; flex: none; }

.audit-chip__count {
    background: #f0f0f0;
    border-radius: 0.6rem;
    padding: 0.05rem 0.4rem;
    font-size: 0.72rem;
    color: #5a5a5a;
    font-variant-numeric: tabular-nums;
}

/* ---------- search + contributor toolbar ---------- */
.audit-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.audit-search { position: relative; }

.audit-search__icon {
    position: absolute;
    left: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0.9rem;
    height: 0.9rem;
    fill: none;
    stroke: #9a9a9a;
    stroke-width: 1.4;
    stroke-linecap: round;
    pointer-events: none;
}

.audit-search__input {
    padding: 0.45rem 0.7rem 0.45rem 2rem;
    border: 1px solid #d4d4d4;
    border-radius: 0.3rem;
    font: inherit;
    font-size: 0.82rem;
    width: 19rem;
    max-width: 100%;
    box-sizing: border-box;
}

.audit-contributors {
    padding: 0.45rem 0.7rem;
    border: 1px solid #d4d4d4;
    border-radius: 0.3rem;
    font: inherit;
    font-size: 0.82rem;
    background: #fff;
    cursor: pointer;
}

.audit-search__input:focus,
.audit-contributors:focus {
    outline: none;
    border-color: #0867a3;
    box-shadow: 0 0 0 3px rgba(8, 103, 163, 0.15);
}

/* Print: drop the interactive chrome so the table reads as a report. */
@media print {
    .audit-header__actions,
    .audit-toolbar,
    .audit-stages,
    .audit-pager,
    .audit-col-expand {
        display: none !important;
    }

    /* Undo the fixed-height scrolling layout so every row prints instead of only the ones
       currently inside the scroll viewport. */
    html, body, #app { height: auto; }

    .page {
        max-width: none;
        padding: 0;
        display: block;
        height: auto;
    }

    .audit-table-wrap {
        border: 0;
        overflow: visible;
        min-height: 0;
    }

    .audit-table th { position: static; }
    .audit-table { font-size: 0.75rem; }
    .audit-table tbody tr { page-break-inside: avoid; }
}

/* ---------- landing-page login-style lookup prompt ---------- */
.login-prompt {
    max-width: 26rem;
    margin: 4rem auto 0;
    padding: 2rem;
    border: 1px solid #e3e3e3;
    border-radius: 0.6rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.login-prompt h1 {
    text-align: center;
    font-size: 1.5rem;
}

.login-prompt__subtitle {
    color: #6b6b6b;
    font-size: 0.85rem;
    text-align: center;
    margin: 0 0 1.75rem;
}

.login-prompt__subtitle code {
    background: #f2f2f2;
    padding: 0.05rem 0.3rem;
    border-radius: 0.25rem;
}

.login-prompt__form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-prompt__field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.login-prompt__field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #4a4a4a;
}

.login-prompt__field input,
.login-prompt__field select {
    padding: 0.6rem 0.7rem;
    border: 1px solid #c9c9c9;
    border-radius: 0.35rem;
    font: inherit;
    width: 100%;
    box-sizing: border-box;
}

.login-prompt__field input:focus,
.login-prompt__field select:focus {
    outline: none;
    border-color: #0867a3;
    box-shadow: 0 0 0 3px rgba(8, 103, 163, 0.15);
}

/* Login screen */
.login {
    max-width: 26rem;
    margin: 4rem auto;
    padding: 2rem;
    text-align: center;
    border: 1px solid #e3e3e3;
    border-radius: 0.6rem;
}

.login p { color: #4a4a4a; margin-bottom: 1.5rem; }

/* Provider error code on the unauthorized page -- secondary to the explanation, but
   selectable so a user can quote it to support. */
.login__code {
    font-size: 0.85rem;
    color: #6b6b6b;
}

.login__code code {
    background: #f2f2f2;
    padding: 0.05rem 0.3rem;
    border-radius: 0.25rem;
}

.login__button {
    padding: 0.6rem 1.2rem;
    border: 1px solid #0867a3;
    border-radius: 0.4rem;
    background: #0867a3;
    color: #fff;
    font: inherit;
    cursor: pointer;
}

.login__button:hover { background: #06527f; border-color: #06527f; }

.login__button--block {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 0.7rem 1.2rem;
    font-weight: 600;
}

