:root {
    --h56-navy: #182430;
    --h56-nav-label: #8894a3;
    --h56-accent: #c1622d;
    --h56-bg: #f7f5f1;
    --h56-surface: #ffffff;
    --h56-surface-hover: #f2efe8;
    --h56-card-border: #e7e3db;
    --h56-text: #1f2937;
    --h56-text-muted: #7a8494;
    --h56-green: #1e7a46;
    --h56-green-bg: #dcefe3;
    --h56-amber-text: #8a5a1b;
    --h56-amber-bg: #f3e4c8;
    --h56-peach-text: #b0562e;
    --h56-peach-bg: #f7dfd3;
    --h56-red-text: #b3261e;
    --h56-red-bg: #fbdedc;
}

:root.dark {
    --h56-navy: #0e151d;
    --h56-nav-label: #8894a3;
    --h56-accent: #d9793f;
    --h56-bg: #12181f;
    --h56-surface: #1b232c;
    --h56-surface-hover: #232d38;
    --h56-card-border: #2b3540;
    --h56-text: #e7eaee;
    --h56-text-muted: #98a2b0;
    --h56-green: #4cbf7f;
    --h56-green-bg: #17332390;
    --h56-amber-text: #e0ab5f;
    --h56-amber-bg: #3a2f1990;
    --h56-peach-text: #e0865f;
    --h56-peach-bg: #3a231990;
    --h56-red-text: #f2897f;
    --h56-red-bg: #4a201d90;
}

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: var(--h56-bg);
    color: var(--h56-text);
    transition: background-color 0.15s ease, color 0.15s ease;
}

/* Sidebar NavLink styling lives here (global), not in NavMenu.razor.css (scoped):
   <NavLink> renders its own <a> internally, which does not receive the parent
   component's CSS-isolation scope attribute, so a scoped .nav-link rule never
   matches it and Bootstrap's own .nav-link (blue) wins instead. */
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: #c3ccd6;
    font-size: 0.88rem;
    font-weight: 500;
    padding: 0.6rem 0.75rem;
    border-radius: 0.5rem;
    text-decoration: none;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.nav-link.active {
    background: #eef0f2;
    color: var(--h56-navy);
    font-weight: 600;
}

.customer-link {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
}

.toast-success {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: var(--h56-green);
    color: #fff;
    padding: 0.75rem 1.25rem;
    border-radius: 0.6rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    max-width: 360px;
    z-index: 1000;
    animation: toast-in 0.2s ease-out;
}

.toast-icon {
    font-weight: 700;
}

@keyframes toast-in {
    from { transform: translateY(0.5rem); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ── H56 shared components ─────────────────────────────────── */
.header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.75rem;
}

/* Action controls (e.g. Approve/Cancel) pinned to the header's top-right instead of a bottom
   bar a user would have to scroll all the way down to reach past a long table. */
.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
    row-gap: 0.5rem;
}

.header-actions .subtitle {
    margin: 0;
    white-space: nowrap;
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.subtitle {
    color: var(--h56-text-muted);
    font-size: 0.85rem;
    margin: 0.25rem 0 0;
}

.alert-banner {
    background: #fdecea;
    color: #a33327;
    border: 1px solid #f3c6c1;
    border-radius: 0.6rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
}

.alert-banner-success {
    background: #e8f5e9;
    color: #2e6b32;
    border-color: #c3e6c5;
}

.customer-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.customer-info {
    flex: 1;
    min-width: 0;
}

.customer-name {
    font-weight: 700;
    font-size: 1rem;
}

.customer-sub {
    color: var(--h56-text-muted);
    font-size: 0.8rem;
    margin-top: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.loading-text, .empty-state {
    color: var(--h56-text-muted);
    padding: 2rem;
    text-align: center;
}

/* Shared period-picker / search / filter-pill UI — used by Availability Overview, Pending
   Approval, and Availability History. Lives globally (not per-page scoped CSS) so all three
   pages can reuse it. */
.period-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    margin-bottom: 1rem;
}

.period-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--h56-text-muted);
}

.period-pills {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    flex: 1;
}

.period-pill {
    border: 1px solid var(--h56-card-border);
    background: var(--h56-surface);
    color: var(--h56-text);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.4rem 0.9rem;
    border-radius: 1rem;
    cursor: pointer;
}

.period-pill.active {
    background: var(--h56-navy);
    border-color: var(--h56-navy);
    color: #fff;
}

.period-pill.locked {
    opacity: 0.45;
    cursor: not-allowed;
}

.period-pill .lock-icon {
    font-size: 0.7rem;
    margin-right: 0.25rem;
}

.period-lock-note {
    margin: -0.5rem 0 1rem;
    font-size: 0.78rem;
}

.export-btn {
    margin-left: auto;
}

.filter-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.search-input {
    flex: 1;
    border: 1px solid var(--h56-card-border);
    border-radius: 0.6rem;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    background: var(--h56-surface);
    color: var(--h56-text);
}

.search-input:focus {
    outline: none;
    border-color: var(--h56-navy);
}

.column-filter-row th {
    padding: 0.4rem 0.6rem 0.75rem;
    border-bottom: 1px solid var(--h56-card-border);
}

.column-filter-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--h56-card-border);
    border-radius: 0.6rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    background: var(--h56-surface);
    color: var(--h56-text);
}

.column-filter-input:focus {
    outline: none;
    border-color: var(--h56-navy);
}

.filter-pills {
    display: flex;
    gap: 0.4rem;
    background: var(--h56-surface);
    border: 1px solid var(--h56-card-border);
    border-radius: 0.6rem;
    padding: 0.25rem;
}

.filter-pill {
    border: none;
    background: transparent;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--h56-text-muted);
    padding: 0.4rem 0.85rem;
    border-radius: 0.45rem;
    cursor: pointer;
}

.filter-pill.active {
    background: var(--h56-navy);
    color: #fff;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.55rem 1rem;
    border-radius: 0.6rem;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

.btn-outline {
    background: var(--h56-surface);
    border-color: var(--h56-card-border);
    color: var(--h56-text);
}

.btn-outline:hover {
    background: var(--h56-surface-hover);
}

.btn-accent {
    background: var(--h56-accent);
    color: #fff;
}

.btn-accent:hover {
    background: #a8531f;
    color: #fff;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-sm {
    padding: 0.35rem 0.7rem;
    font-size: 0.78rem;
}

.muted {
    color: var(--h56-text-muted);
    font-size: 0.8rem;
}

.count-badge {
    background: rgba(255, 255, 255, 0.25);
    padding: 0.05rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
}

.card {
    /* Explicit color needed: Bootstrap's own .card class (same name) sets
       color: var(--bs-body-color), which otherwise silently wins since our
       rule never touched that property. */
    color: var(--h56-text);
    background: var(--h56-surface);
    border: 1px solid var(--h56-card-border);
    border-radius: 0.85rem;
}

/* Shared scroll wrapper for any page with a wide table (Availability History, Environment
   Intelligence, Monthly Trend) — global, not page-scoped, since Blazor's CSS isolation means a
   .razor.css rule only applies to elements literally authored in that one component.
   Table can be 20+ rows tall, so a scrollbar at its natural bottom edge is invisible until
   scrolled all the way down. Flipping the wrapper 180° moves the browser's native horizontal
   scrollbar to the top edge instead; flipping the table back (below) cancels the visual flip
   so content still reads normally, left to right, top to bottom. */
.table-scroll-x {
    overflow-x: auto;
    transform: rotateX(180deg);
}

/* Any direct <table> child — not named per table class — so a future page (like
   MonthlyTrend's .trend-table) that reuses .table-scroll-x doesn't silently render upside
   down for missing this counter-flip, exactly what happened the first time. */
.table-scroll-x > table {
    transform: rotateX(180deg);
}

.history-table {
    width: 100%;
    min-width: max-content;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.history-table th {
    text-align: left;
    color: var(--h56-text-muted);
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--h56-card-border);
    white-space: nowrap;
}

.history-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--h56-card-border);
    white-space: nowrap;
}

/* Simple "list + add new" forms (Customers, Rigs management) — global since the same markup
   pattern is reused across more than one page. */
.manage-form {
    margin-top: 1.25rem;
    padding: 1.25rem 1.5rem;
}

.manage-form-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 0.85rem;
}

.manage-form-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* Generic two-panel "searchable list + detail/action panel" layout — Environment Status,
   Customers, Rigs all share this (global, not page-scoped, since more than one page renders it). */
.split-layout {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.split-list {
    flex: 0 0 22rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.split-select {
    width: 100%;
}

.split-rows {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 26rem;
    overflow-y: auto;
}

.split-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid transparent;
    background: var(--h56-bg);
    color: var(--h56-text);
    border-radius: 0.5rem;
    padding: 0.55rem 0.75rem;
    text-align: left;
    font-size: 0.8rem;
    cursor: pointer;
}

.split-row-primary {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.split-row-secondary {
    flex-shrink: 0;
    color: var(--h56-text-muted);
    font-size: 0.7rem;
}

.split-row:hover {
    border-color: var(--h56-accent);
}

.split-row.active {
    border-color: var(--h56-accent);
    background: var(--h56-surface-hover);
}

.split-clear {
    align-self: stretch;
}

.split-panel {
    flex: 1;
    padding: 1.25rem 1.5rem;
    min-width: 0;
}

.split-panel-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 1rem;
    word-break: break-all;
}

.split-panel-note {
    font-size: 0.8rem;
    color: var(--h56-text-muted);
    margin: -0.5rem 0 1rem;
}

/* Bold "Total X: N" display in a page's top-right header corner (Customers, Rigs). */
.header-total {
    font-size: 1rem;
    font-weight: 700;
    color: var(--h56-text);
    white-space: nowrap;
}

.split-detail-fields {
    display: grid;
    grid-template-columns: 10rem 1fr;
    row-gap: 0.75rem;
    column-gap: 1rem;
    margin: 0;
}

.split-detail-fields dt {
    color: var(--h56-text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.split-detail-fields dd {
    margin: 0;
    font-size: 0.9rem;
    word-break: break-all;
}

/* Add-new form rendered inside the right-hand .split-panel (Customers, Rigs) */
.split-panel .manage-form-row {
    flex-direction: column;
    align-items: stretch;
    max-width: 24rem;
}

.split-panel .manage-form-row .search-input {
    max-width: none;
}

.manage-form-row .search-input {
    max-width: 22rem;
}

/* Bold stat cards — Availability Overview's clickable filter cards, and Missing Environments'
   plain (non-clickable) count display. Global since more than one page renders these. */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-cards--single {
    grid-template-columns: minmax(0, 18rem);
}

/* Puts a lone stat card and a set of page-level actions (e.g. Approve/Cancel) on the same row,
   actions aligned to the far right at the stat card's vertical position — not up in the header
   next to the title, and not down at the bottom of the page past a long table. */
.stat-cards-row {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-cards-row .stat-cards {
    margin-bottom: 0;
    flex: 0 0 auto;
}

.stat-cards-row .header-actions {
    flex: 1;
    justify-content: flex-end;
}

.stat-card {
    /* Some render as <button> (clickable filters) — reset the browser's default button chrome
       so they still look like plain cards. Others render as a plain <div> (read-only count). */
    display: block;
    width: 100%;
    text-align: left;
    font: inherit;
    color: inherit;
    padding: 1.1rem 1.25rem;
    border-top: 3px solid transparent;
    transition: box-shadow 0.15s ease;
}

button.stat-card {
    cursor: pointer;
}

.stat-card:hover {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.stat-card.active {
    box-shadow: 0 0 0 2px var(--h56-navy) inset;
}

.stat-card--full { border-top-color: var(--h56-green); }
.stat-card--partial { border-top-color: var(--h56-amber-text); }
.stat-card--pending { border-top-color: var(--h56-accent); }
.stat-card--missing { border-top-color: var(--h56-accent); }

.stat-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--h56-text-muted);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin: 0.4rem 0 0.15rem;
}

.stat-value--full { color: var(--h56-green); }
.stat-value--partial { color: var(--h56-amber-text); }
.stat-value--pending { color: var(--h56-accent); }
.stat-value--missing { color: var(--h56-accent); }

.stat-hint {
    font-size: 0.75rem;
    color: var(--h56-text-muted);
}

.avatar-square {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.6rem;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-badge.pending {
    background: var(--h56-amber-bg);
    color: var(--h56-amber-text);
}

.status-badge.approved {
    background: var(--h56-peach-bg);
    color: var(--h56-peach-text);
}

.status-badge.confirmed {
    background: var(--h56-green-bg);
    color: var(--h56-green);
}

.sla-value {
    font-size: 1.4rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.sla-value.full {
    color: var(--h56-green);
}

.sla-value.partial {
    color: var(--h56-peach-text);
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #0071c1;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

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

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

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

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41ND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IGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

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

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

    .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;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

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

code {
    color: #c02d76;
}

.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;
}