h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

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

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

.portal-input {
    box-sizing: border-box;
    width: 100%;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background-color: var(--mud-palette-surface, #16202b);
    color: var(--mud-palette-text-primary, #e6edf7);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.portal-input:focus {
    outline: none;
    border-color: var(--mud-palette-primary, #4ec9b0);
    box-shadow: 0 0 0 0.15rem rgba(78, 201, 176, 0.25);
}

.portal-input.invalid {
    border-color: var(--mud-palette-error, #ef4444);
}

/* Blazor's built-in reconnection UI (shown when the SignalR circuit drops - a lost connection, an idle
   tab reconnecting, a server restart). Left alone, Blazor auto-creates its own plain white/default-styled
   dialog inside a closed Shadow DOM that no page CSS can reach - the "white box unrelated to the site"
   users notice on a flaky connection. Providing our own #components-reconnect-modal element here (with
   the exact id/child-id/class names Blazor's JS looks for - see blazor.web.js's Go/DefaultReconnectDisplay
   classes) makes Blazor use this real, styleable element instead of creating its own hidden one. */
#components-reconnect-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    align-items: center;
    justify-content: center;
    background-color: rgba(6, 10, 16, 0.72);
    font-family: inherit;
}

    #components-reconnect-modal.components-reconnect-show,
    #components-reconnect-modal.components-reconnect-retrying,
    #components-reconnect-modal.components-reconnect-failed,
    #components-reconnect-modal.components-reconnect-rejected,
    #components-reconnect-modal.components-reconnect-paused,
    #components-reconnect-modal.components-reconnect-resume-failed {
        display: flex;
    }

.reconnect-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    min-width: 280px;
    max-width: 90vw;
    padding: 2rem 2.5rem;
    border-radius: 12px;
    background-color: var(--mud-palette-surface, #16202b);
    color: var(--mud-palette-text-primary, #e6edf7);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.reconnect-spinner {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--mud-palette-primary, #4ec9b0);
    animation: reconnect-spin 0.8s linear infinite;
}

@keyframes reconnect-spin {
    to {
        transform: rotate(360deg);
    }
}

.reconnect-card p {
    display: none;
    margin: 0;
}

.reconnect-card button {
    display: none;
    margin-top: 0.25rem;
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
}

.reconnect-retry-button, .reconnect-resume-button, .reconnect-reload-button {
    background-color: var(--mud-palette-primary, #4ec9b0);
    color: var(--mud-palette-primary-text, #0f141b);
}

/* Connecting/retrying: spinner + message only. */
#components-reconnect-modal.components-reconnect-show .reconnect-status-connecting,
#components-reconnect-modal.components-reconnect-retrying .reconnect-status-connecting {
    display: block;
}

/* Failed (network problem) and resume-failed: message + manual Retry. */
#components-reconnect-modal.components-reconnect-failed .reconnect-spinner,
#components-reconnect-modal.components-reconnect-resume-failed .reconnect-spinner {
    display: none;
}

#components-reconnect-modal.components-reconnect-failed .reconnect-status-failed,
#components-reconnect-modal.components-reconnect-resume-failed .reconnect-status-failed {
    display: block;
    color: var(--mud-palette-error, #ef4444);
}

#components-reconnect-modal.components-reconnect-failed .reconnect-retry-button,
#components-reconnect-modal.components-reconnect-resume-failed .reconnect-retry-button {
    display: inline-block;
}

/* Rejected: the server didn't recognize this session at all (e.g. restarted) - resuming is pointless,
   only a full page reload starts a fresh one. */
#components-reconnect-modal.components-reconnect-rejected .reconnect-spinner {
    display: none;
}

#components-reconnect-modal.components-reconnect-rejected .reconnect-status-rejected {
    display: block;
    color: var(--mud-palette-error, #ef4444);
}

#components-reconnect-modal.components-reconnect-rejected .reconnect-reload-button {
    display: inline-block;
}

/* Paused: the server explicitly paused the circuit (not a failure) - Resume, not Retry. */
#components-reconnect-modal.components-reconnect-paused .reconnect-spinner {
    display: none;
}

#components-reconnect-modal.components-reconnect-paused .reconnect-status-paused {
    display: block;
}

#components-reconnect-modal.components-reconnect-paused .reconnect-resume-button {
    display: inline-block;
}

/* Shared mini stat-grid tile - a Location's/Area's power/consumption/temperature figures on the
   Organization dashboard's Location tiles and the Location overview's Area tiles alike, so both drill-down
   levels of the same hierarchy look identical. */
.loopmi-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.loopmi-stat-box {
    border-radius: 8px;
    padding: 0.4rem 0.55rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    min-width: 0;
}

.loopmi-stat-box-warning {
    background: rgba(var(--mud-palette-warning-rgb), 0.12);
    border-color: rgba(var(--mud-palette-warning-rgb), 0.35);
}

.loopmi-stat-box-info {
    background: rgba(var(--mud-palette-info-rgb), 0.12);
    border-color: rgba(var(--mud-palette-info-rgb), 0.35);
}

.loopmi-stat-box-empty {
    opacity: 0.55;
}

.loopmi-stat-label {
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.loopmi-stat-value {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* A server-paged table reads its rows behind the page's own LoopMi mark, so the table's built-in loading bar is hidden. */
.loopmi-spinner-table .mud-progress-linear { display: none; }

/* The bar Blazor shows after an unhandled error (all layouts): a card in the Portal's own look instead of the framework's yellow strip. The [data-nosnippet] part makes these rules win over MudBlazor's own #blazor-error-ui rule (red, loaded later). */
#blazor-error-ui[data-nosnippet] {
    display: none;
    position: fixed;
    left: 50%;
    bottom: 1.25rem;
    transform: translateX(-50%);
    box-sizing: border-box;
    width: min(640px, calc(100% - 2rem));
    padding: 0.85rem 3rem 0.85rem 1.1rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 4px solid var(--mud-palette-error, #f6685e);
    border-radius: 12px;
    background-color: var(--mud-palette-surface, #1a2331);
    color: var(--mud-palette-text-primary, #e6edf5);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    font-size: 0.9rem;
    z-index: 2100;
}

#blazor-error-ui[data-nosnippet] .reload {
    margin-left: 0.5rem;
    color: var(--mud-palette-primary, #1d9e75);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-decoration: none;
    text-transform: uppercase;
}

#blazor-error-ui[data-nosnippet] .reload:hover {
    text-decoration: underline;
}

#blazor-error-ui[data-nosnippet] .dismiss {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    opacity: 0.7;
}

#blazor-error-ui[data-nosnippet] .dismiss:hover {
    opacity: 1;
}
