/* Layout and the few elements BlazorBlueprint doesn't cover (tables, selects, step list). */

/* App colours reuse the BlazorBlueprint theme (themes.css), so tables match the components. */
:root {
    --line: var(--border);
    --ok: oklch(50.8% .118 165.612);
    --bad: var(--destructive);
    --soft: var(--muted);
}

body {
    margin: 0;
    background: var(--soft);
}

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

/* The router focuses the heading after navigation; no ring for that programmatic focus. */
h1:focus {
    outline: none;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.75rem 1.5rem;
    background: white;
    border-bottom: 1px solid var(--line);
}

.brand {
    font-weight: 600;
    color: inherit;
    text-decoration: none;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.topnav {
    display: flex;
    gap: 1rem;
    flex: 1;
}

.topnav a {
    color: var(--muted-foreground);
    text-decoration: none;
    padding: 0.25rem 0;
}

.topnav a.active {
    color: inherit;
    border-bottom: 2px solid currentColor;
}

.user {
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

.signout {
    font-size: 0.875rem;
}

.content {
    max-width: 72rem;
    margin: 0 auto;
    padding: 1.5rem;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.page-header h1 {
    margin: 0;
    font-size: 1.5rem;
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
}

h2 {
    font-size: 1.125rem;
    margin: 2rem 0 0.75rem;
}

.page-message {
    padding: 2rem;
    text-align: center;
}

.muted {
    font-size: 0.875rem;
}

.ok {
    color: var(--ok);
}

.bad,
.error-text {
    color: var(--bad);
}

.empty {
    padding: 2rem;
    text-align: center;
    color: var(--muted-foreground);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

.data-table th {
    font-weight: 500;
    color: var(--muted-foreground);
    background: var(--soft);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table td.details {
    white-space: pre-wrap;
    max-width: 28rem;
}

.details-row td {
    background: var(--soft);
}

.run-list {
    margin: 0 0 0.5rem;
    padding-left: 1.25rem;
}

.form-card {
    max-width: 44rem;
}

.form-error {
    margin-top: 1rem;
}

.actions {
    display: flex;
    gap: 0.5rem;
}

/* Tenant page actions: one block per action, the same space between all of them, every button on the
   right edge. Margins of the parts inside (field, label, paragraph) are reset so only the gaps count. */
.actions-col {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
}
.actions-col > * {
    margin: 0;
}
.actions-col > a,
.actions-col > button {
    align-self: flex-end;
}
.action-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border, hsl(0 0% 90%));
}
.action-form > *,
.action-form label {
    margin: 0;
}
.action-form > button {
    align-self: flex-end;
}

.native-select {
    width: 100%;
    height: 2.25rem;
    padding: 0 0.5rem;
    border: 1px solid var(--line);
    border-radius: 0.375rem;
    background: white;
    font: inherit;
}

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

.section {
    margin-top: 1rem;
}

.facts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.4rem 1rem;
    margin: 0;
    font-size: 0.875rem;
}

.facts dt {
    color: var(--muted-foreground);
}

.facts dd {
    margin: 0;
}

.danger-zone {
    border: 1px solid hsl(0 72% 85%);
    background: hsl(0 86% 98%);
    border-radius: 0.5rem;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    box-sizing: border-box;
    font-size: 0.875rem;
}

.danger-zone p {
    margin: 0;
}
.danger-zone > *,
.danger-zone label {
    margin: 0;
}
.danger-zone > button {
    align-self: flex-end;
}

.filter {
    max-width: 20rem;
    margin-bottom: 1rem;
}

.steps {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: step;
}

.step {
    counter-increment: step;
    padding: 0.5rem 0 0.5rem 2rem;
    border-left: 2px solid var(--line);
    margin-left: 0.75rem;
    position: relative;
}

.step::before {
    content: counter(step);
    position: absolute;
    left: -0.8rem;
    top: 0.45rem;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    background: white;
    border: 2px solid var(--line);
    font-size: 0.75rem;
    display: grid;
    place-items: center;
}

.step-succeeded::before {
    border-color: var(--ok);
    color: var(--ok);
}

.step-failed::before {
    border-color: var(--bad);
    color: var(--bad);
}

.step-head {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.step-name {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.875rem;
}

.step-message,
.step-error {
    margin: 0.4rem 0 0;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    white-space: pre-wrap;
    background: white;
    border: 1px solid var(--line);
}

.step-error {
    border-color: hsl(0 72% 85%);
    color: var(--bad);
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85em;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 0.6rem 1.25rem;
    background: lightyellow;
    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;
}

/* Sign-in pages (ported from the product app). */
.auth-panel {
    max-width: 28rem;
    margin: 4rem auto;
    padding: 2rem;
    border: 1px solid var(--border, #e5e5e5);
    border-radius: 0.5rem;
    background: white;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.auth-panel h1 {
    margin: 0;
}

/* The whole tenant row opens the tenant; the Open button is the visible hint. */
.data-table tr.clickable {
    cursor: pointer;
}

.data-table tr.clickable:hover td {
    background: var(--soft);
}

.data-table td.row-actions {
    width: 1%;
    white-space: nowrap;
}
/* The button renders as a flex box, which ignores text-align: push it to the right edge instead. */
.data-table .row-actions-inner {
    display: flex;
    justify-content: flex-end;
}

.auth-button {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border-radius: 0.375rem;
    background: #2f2f2f;
    color: white;
    text-decoration: none;
}

.auth-error {
    color: #b32121;
}

.signout-form {
    display: inline;
}

.signout-form button {
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    font: inherit;
    color: inherit;
    text-decoration: underline;
}
