:root {
    color-scheme: dark;

    --background: #0b1020;
    --surface: #131a2b;
    --surface-raised: #1a2338;
    --surface-soft: #202a42;
    --border: #303b55;

    --text: #f4f7fb;
    --text-muted: #aab5c8;
    --text-faint: #7d899e;

    --healthy: #42d392;
    --healthy-soft: rgba(66, 211, 146, 0.14);

    --warning: #f6c85f;
    --warning-soft: rgba(246, 200, 95, 0.14);

    --critical: #ff6b6b;
    --critical-soft: rgba(255, 107, 107, 0.14);

    --unknown: #9aa6b8;
    --unknown-soft: rgba(154, 166, 184, 0.14);

    --accent: #78a9ff;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
    --radius-large: 24px;
    --radius-medium: 16px;
    --radius-small: 10px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--background);
}

body {
    min-height: 100vh;
    margin: 0;
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    line-height: 1.5;
    color: var(--text);
    background:
        radial-gradient(
            circle at top right,
            rgba(120, 169, 255, 0.12),
            transparent 30rem
        ),
        var(--background);
}

button,
dialog {
    font: inherit;
}

button {
    color: inherit;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    padding: 1.75rem clamp(1.25rem, 4vw, 4rem);
    border-bottom: 1px solid var(--border);
    background: rgba(11, 16, 32, 0.88);
    backdrop-filter: blur(18px);
}

.site-header h1,
.ups-card h2,
.overall-status h2,
.connection-error h2,
.information-dialog h2 {
    margin: 0;
    line-height: 1.15;
}

.site-header h1 {
    margin-top: 0.2rem;
    font-size: clamp(1.65rem, 3vw, 2.35rem);
}

.eyebrow,
.status-kicker {
    margin: 0;
    font-size: 0.74rem;
    font-weight: 750;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.header-meta {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.phase-badge {
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    background: var(--surface);
}

.dashboard-shell {
    width: min(1120px, calc(100% - 2rem));
    margin: 0 auto;
    padding: clamp(1.25rem, 4vw, 3.5rem) 0 4rem;
}

.overall-status,
.connection-error {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    padding: clamp(1.25rem, 3vw, 2rem);
    border: 1px solid var(--border);
    border-radius: var(--radius-large);
    box-shadow: var(--shadow);
}

.overall-status h2,
.connection-error h2 {
    margin-top: 0.25rem;
    font-size: clamp(1.55rem, 3vw, 2.35rem);
}

.overall-status p,
.connection-error p {
    margin-bottom: 0;
    color: var(--text-muted);
}

.status-healthy {
    border-color: rgba(66, 211, 146, 0.42);
    background: linear-gradient(
        135deg,
        var(--healthy-soft),
        var(--surface)
    );
}

.status-warning {
    border-color: rgba(246, 200, 95, 0.45);
    background: linear-gradient(
        135deg,
        var(--warning-soft),
        var(--surface)
    );
}

.status-critical,
.connection-error {
    border-color: rgba(255, 107, 107, 0.48);
    background: linear-gradient(
        135deg,
        var(--critical-soft),
        var(--surface)
    );
}

.status-unknown {
    border-color: rgba(154, 166, 184, 0.4);
    background: linear-gradient(
        135deg,
        var(--unknown-soft),
        var(--surface)
    );
}

.status-indicator,
.connection-dot {
    display: inline-block;
    flex: 0 0 auto;
    border-radius: 50%;
}

.status-indicator {
    width: 1.25rem;
    height: 1.25rem;
    box-shadow: 0 0 0 0.45rem rgba(255, 255, 255, 0.06);
}

.status-healthy .status-indicator {
    background: var(--healthy);
}

.status-warning .status-indicator {
    background: var(--warning);
}

.status-critical .status-indicator {
    background: var(--critical);
}

.status-unknown .status-indicator {
    background: var(--unknown);
}

.status-refresh {
    min-width: 9rem;
    text-align: right;
}

.status-refresh span,
.status-refresh strong {
    display: block;
}

.status-refresh span {
    color: var(--text-faint);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.status-refresh strong {
    margin-top: 0.2rem;
    font-size: 0.95rem;
}

.ups-card {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-large);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.ups-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: clamp(1.4rem, 3vw, 2rem);
    border-bottom: 1px solid var(--border);
}

.ups-card-header h2 {
    margin-top: 0.25rem;
    font-size: clamp(1.5rem, 3vw, 2rem);
}

.ups-model {
    margin: 0.4rem 0 0;
    color: var(--text-muted);
}

.connection-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.75rem;
    border: 1px solid rgba(66, 211, 146, 0.3);
    border-radius: 999px;
    color: var(--healthy);
    background: var(--healthy-soft);
    font-size: 0.86rem;
    font-weight: 700;
    white-space: nowrap;
}

.connection-dot {
    width: 0.55rem;
    height: 0.55rem;
    background: var(--healthy);
}

.primary-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    padding: clamp(1.25rem, 3vw, 2rem);
}

.metric-feature {
    min-width: 0;
    padding: 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-medium);
    background: var(--surface-raised);
}

.metric-heading,
.metric-value-group {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.metric-heading {
    justify-content: space-between;
    color: var(--text-muted);
    font-weight: 680;
}

.metric-large {
    display: block;
    margin-top: 1rem;
    font-size: clamp(2rem, 6vw, 3.75rem);
    line-height: 1;
    letter-spacing: -0.04em;
}

.metric-caption {
    margin: 0.7rem 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.progress-track {
    position: relative;
    overflow: hidden;
    height: 0.72rem;
    margin-top: 1.25rem;
    border-radius: 999px;
    background: var(--surface-soft);
}

.progress-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--healthy));
}

.metric-list {
    border-top: 1px solid var(--border);
}

.metric-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.1rem clamp(1.25rem, 3vw, 2rem);
    border-bottom: 1px solid var(--border);
}

.metric-name,
.metric-description {
    display: block;
}

.metric-name {
    font-weight: 720;
}

.metric-description {
    margin-top: 0.2rem;
    color: var(--text-muted);
    font-size: 0.86rem;
}

.metric-value-group {
    flex: 0 0 auto;
}

.metric-value-group strong {
    font-size: 1.1rem;
    text-align: right;
}

.info-button {
    display: inline-grid;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--accent);
    background: var(--surface-soft);
    font-family: Georgia, serif;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
}

.info-button:hover,
.info-button:focus-visible {
    border-color: var(--accent);
    outline: none;
    background: rgba(120, 169, 255, 0.14);
}

.ups-card-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    padding: 1rem clamp(1.25rem, 3vw, 2rem);
    color: var(--text-faint);
    background: rgba(0, 0, 0, 0.12);
    font-size: 0.78rem;
}

code {
    padding: 0.14rem 0.35rem;
    border-radius: 0.35rem;
    color: #c6d8ff;
    background: rgba(120, 169, 255, 0.1);
    font-family:
        "SFMono-Regular",
        Consolas,
        "Liberation Mono",
        monospace;
}

.connection-error {
    grid-template-columns: auto 1fr;
}

.error-icon {
    display: grid;
    width: 2.6rem;
    height: 2.6rem;
    place-items: center;
    border-radius: 50%;
    color: #1c0b0b;
    background: var(--critical);
    font-size: 1.45rem;
    font-weight: 900;
}

.information-dialog {
    width: min(520px, calc(100% - 2rem));
    padding: 1.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-large);
    color: var(--text);
    background: var(--surface-raised);
    box-shadow: var(--shadow);
}

.information-dialog::backdrop {
    background: rgba(3, 6, 14, 0.72);
    backdrop-filter: blur(5px);
}

.information-dialog h2 {
    margin-top: 0.35rem;
    font-size: 1.7rem;
}

.information-dialog p {
    color: var(--text-muted);
}

.dialog-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2rem;
    height: 2rem;
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text);
    background: var(--surface-soft);
    cursor: pointer;
}

.source-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.25rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    background: var(--surface);
}

.source-field span {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.phase-note {
    margin: 1.25rem 0 0;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.82rem;
}


/* ============================================================
   Phase 2: Dual-UPS dashboard

   Purpose:
       Arrange independently monitored UPS cards in a balanced
       two-column desktop layout.

   Design decisions:
       - Each UPS remains a self-contained card so a failure of
         one device does not visually suppress the other.
       - Equal-width columns make the two power domains easy to
         compare.
       - Cards collapse to one column on narrower screens.
       - Unavailable devices remain visible with a clear error
         state rather than disappearing from the dashboard.
   ============================================================ */

.ups-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 1.5rem;
}

.ups-grid .ups-card {
    min-width: 0;
    height: 100%;
}

.ups-grid .primary-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 1.25rem;
}

.ups-grid .metric-feature {
    padding: 1rem;
}

.ups-grid .metric-large {
    font-size: clamp(1.9rem, 4vw, 3rem);
}

.ups-grid .metric-row {
    padding-right: 1.25rem;
    padding-left: 1.25rem;
}

.ups-grid .ups-card-footer {
    padding-right: 1.25rem;
    padding-left: 1.25rem;
}

.connection-badge-error {
    border-color: rgba(255, 107, 107, 0.35);
    color: var(--critical);
    background: var(--critical-soft);
}

.connection-badge-error .connection-dot {
    background: var(--critical);
}

.ups-unavailable {
    border-color: rgba(255, 107, 107, 0.42);
}

.ups-error-state {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 1rem;
    min-height: 18rem;
    padding: 2rem;
    background:
        linear-gradient(
            135deg,
            var(--critical-soft),
            transparent
        );
}

.ups-error-state h3 {
    margin: 0;
    font-size: 1.25rem;
}

.ups-error-state p {
    margin: 0.6rem 0 1rem;
    color: var(--text-muted);
}

.ups-error-state code {
    display: block;
    overflow-wrap: anywhere;
    line-height: 1.55;
}

.dashboard-footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.25rem;
    padding: 0 0.25rem;
    color: var(--text-faint);
    font-size: 0.78rem;
}

@media (max-width: 900px) {
    .ups-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .site-header {
        align-items: flex-start;
        padding: 1.25rem;
    }

    .header-meta {
        align-items: flex-end;
        flex-direction: column;
        gap: 0.4rem;
    }

    .dashboard-shell {
        width: min(100% - 1rem, 1120px);
        padding-top: 0.75rem;
    }

    .overall-status {
        grid-template-columns: auto 1fr;
    }

    .status-refresh {
        grid-column: 2;
        text-align: left;
    }

    .primary-metrics {
        grid-template-columns: 1fr;
    }

    .metric-row {
        align-items: flex-start;
    }

    .metric-value-group {
        align-items: flex-end;
        flex-direction: column-reverse;
    }

    .ups-card-footer {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .site-header {
        flex-direction: column;
        gap: 0.8rem;
    }

    .header-meta {
        align-items: flex-start;
        flex-direction: row;
    }

    .ups-card-header {
        flex-direction: column;
    }

    .metric-row {
        gap: 0.8rem;
    }

    .metric-description {
        max-width: 14rem;
    }

    .information-dialog {
        width: calc(100% - 1rem);
        max-height: calc(100vh - 1rem);
        margin-bottom: 0.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
        animation: none !important;
    }
}


/* ============================================================
   Phase 2: Configurable dashboard layout

   Purpose:
       Provide a deliberate editing mode for arranging UPS cards.

   Design decisions:
       - Cards are not draggable during normal dashboard operation.
       - A dedicated handle prevents information buttons and other
         card controls from accidentally initiating a drag.
       - Keyboard buttons provide an accessible alternative to
         pointer and touch-based movement.
       - Visual movement states use borders and opacity rather than
         colour alone.
   ============================================================ */

.layout-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin: 0 0 1.25rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-medium);
    background: var(--surface);
}

.layout-toolbar h2 {
    margin: 0;
    font-size: 1rem;
}

.layout-toolbar p {
    margin: 0.2rem 0 0;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.layout-actions,
.layout-edit-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.layout-button {
    min-height: 2.35rem;
    padding: 0.45rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 0.7rem;
    color: var(--text);
    background: var(--surface-soft);
    font-weight: 700;
    cursor: pointer;
}

.layout-button:hover,
.layout-button:focus-visible {
    border-color: var(--accent);
    outline: none;
}

.layout-button-primary {
    border-color: rgba(66, 211, 146, 0.4);
    color: var(--healthy);
    background: var(--healthy-soft);
}

.layout-button-danger {
    border-color: rgba(255, 107, 107, 0.4);
    color: var(--critical);
    background: var(--critical-soft);
}

.layout-status {
    flex-basis: 100%;
    min-height: 1.2rem;
    margin: 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.layout-toolbar:has(.layout-edit-actions:not([hidden])) {
    flex-wrap: wrap;
    border-color: rgba(120, 169, 255, 0.42);
    background:
        linear-gradient(
            135deg,
            rgba(120, 169, 255, 0.08),
            var(--surface)
        );
}

.card-drag-controls {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-right: 0.35rem;
}

.drag-handle,
.move-card-button {
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--border);
    color: var(--text-muted);
    background: var(--surface-soft);
    cursor: pointer;
}

.drag-handle {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.65rem;
    font-size: 1.25rem;
    cursor: grab;
    touch-action: none;
}

.drag-handle:active {
    cursor: grabbing;
}

.keyboard-move-controls {
    display: flex;
    gap: 0.3rem;
}

.move-card-button {
    width: 2rem;
    height: 2rem;
    border-radius: 0.55rem;
    font-weight: 800;
}

.drag-handle:hover,
.drag-handle:focus-visible,
.move-card-button:hover,
.move-card-button:focus-visible {
    border-color: var(--accent);
    color: var(--accent);
    outline: none;
}

.ups-card-header {
    position: relative;
}

.ups-card-identity {
    min-width: 0;
    flex: 1;
}

.ups-grid.layout-editing .ups-card {
    border-style: dashed;
    border-color: rgba(120, 169, 255, 0.55);
}

.ups-card.is-dragging {
    opacity: 0.45;
    transform: scale(0.985);
}

.ups-card.drag-target-before {
    box-shadow:
        inset 0 0.3rem 0 var(--accent),
        var(--shadow);
}

.ups-card.drag-target-after {
    box-shadow:
        inset 0 -0.3rem 0 var(--accent),
        var(--shadow);
}

@media (max-width: 720px) {
    .layout-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .layout-actions,
    .layout-edit-actions {
        flex-wrap: wrap;
    }
}


/* ============================================================
   Phase 2: Power Centre options menu

   Purpose:
       Keep configuration controls out of the normal operational view.

   Design decisions:
       - A single header control exposes infrequently used options.
       - The menu is positioned relative to the gear button.
       - Layout-editing controls appear only after an explicit action.
       - The HTML hidden attribute always takes precedence over other
         display declarations.
   ============================================================ */

[hidden] {
    display: none !important;
}

.options-control {
    position: relative;
}

.options-button {
    display: inline-grid;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 0.55rem;
    color: var(--text-muted);
    background: transparent;
    cursor: pointer;
}

.options-button:hover,
.options-button:focus-visible,
.options-button[aria-expanded="true"] {
    color: var(--text);
    outline: none;
    background: rgba(120, 169, 255, 0.1);
}

.options-icon {
    width: 1.55rem;
    height: 1.55rem;
    fill: currentColor;
}

.options-menu {
    position: absolute;
    z-index: 20;
    top: calc(100% + 0.65rem);
    right: 0;
    width: min(17rem, calc(100vw - 2rem));
    padding: 0.55rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-medium);
    background: var(--surface-raised);
    box-shadow: var(--shadow);
}

.options-menu-heading {
    margin: 0;
    padding: 0.55rem 0.7rem 0.7rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.options-menu-item {
    display: block;
    width: 100%;
    margin-top: 0.4rem;
    padding: 0.7rem;
    border: 0;
    border-radius: 0.65rem;
    color: var(--text);
    background: transparent;
    text-align: left;
    font-weight: 680;
    cursor: pointer;
}

.options-menu-item:hover,
.options-menu-item:focus-visible {
    outline: none;
    background: var(--surface-soft);
}

.options-menu-item-danger {
    color: var(--critical);
}

@media (max-width: 600px) {
    .options-button {
        width: 2.35rem;
        height: 2.35rem;
    }
}


/* ============================================================
   Runtime value fitting

   Purpose:
       Keep long runtime values on one line where practical so paired
       UPS cards retain matching metric-panel heights.

   Design decisions:
       - Runtime text may shrink more than other primary metrics.
       - The value remains readable and will still wrap as a final
         fallback on genuinely narrow screens.
       - Only runtime values are affected; battery percentages retain
         their existing visual prominence.
   ============================================================ */

.metric-feature .metric-large[data-field="runtime_display"] {
    font-size: clamp(1.9rem, 3.2vw, 3rem);
    line-height: 1.05;
    white-space: nowrap;
    letter-spacing: -0.035em;
}

@media (max-width: 480px) {
    .metric-feature .metric-large[data-field="runtime_display"] {
        font-size: clamp(1.65rem, 8vw, 2.35rem);
        white-space: normal;
        overflow-wrap: anywhere;
    }
}


/* ============================================================
   Runtime figures and units

   Purpose:
       Give runtime figures stronger visual emphasis while retaining
       readable, subordinate hour and minute labels.
   ============================================================ */

.runtime-value {
    display: flex;
    align-items: baseline;
    flex-wrap: nowrap;
    gap: 0.22em;
}

.runtime-number {
    color: var(--text);
}

.runtime-unit {
    color: var(--text-muted);
    font-size: 0.58em;
    font-weight: 650;
    letter-spacing: 0;
}


/* ============================================================
   Phase 3: NUT Power Centre shell and navigation
   ============================================================ */

.header-context {
    margin: 0.35rem 0 0;
    color: var(--text-faint);
    font-size: 0.88rem;
}

.operations-navigation {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid var(--border);
    background: rgba(11, 16, 32, 0.94);
    backdrop-filter: blur(18px);
}

.operations-navigation-inner {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    width: min(1120px, calc(100% - 2rem));
    min-height: 3.75rem;
    margin: 0 auto;
    overflow-x: auto;
    scrollbar-width: thin;
}

.operations-nav-item {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 0.45rem;
    min-height: 2.5rem;
    padding: 0.55rem 0.9rem;
    border: 1px solid transparent;
    border-radius: var(--radius-small);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    transition:
        color 140ms ease,
        border-color 140ms ease,
        background 140ms ease;
}

a.operations-nav-item:hover,
a.operations-nav-item:focus-visible {
    border-color: var(--border);
    color: var(--text);
    background: var(--surface);
    outline: none;
}

.operations-nav-item.is-active {
    border-color: rgba(120, 169, 255, 0.4);
    color: var(--text);
    background: rgba(120, 169, 255, 0.12);
}

.operations-nav-item.is-planned {
    cursor: default;
    color: var(--text-faint);
}

.nav-planned-label {
    padding: 0.12rem 0.35rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-faint);
    font-size: 0.58rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.console-introduction {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 1.5rem;
    padding: 0.25rem 0;
}

.console-introduction h2,
.module-heading h2 {
    margin: 0.25rem 0 0;
    line-height: 1.15;
}

.console-introduction h2 {
    font-size: clamp(1.65rem, 3vw, 2.45rem);
}

.console-introduction p:not(.eyebrow) {
    max-width: 46rem;
    margin: 0.65rem 0 0;
    color: var(--text-muted);
}

.console-release {
    flex: 0 0 auto;
    text-align: right;
}

.console-release span,
.console-release strong {
    display: block;
}

.console-release span {
    color: var(--text-faint);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.console-release strong {
    margin-top: 0.2rem;
    font-size: 1rem;
}

.module-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1.5rem;
    margin: 1.75rem 0 1rem;
    scroll-margin-top: 5rem;
}

.module-heading h2 {
    font-size: clamp(1.35rem, 2.5vw, 1.9rem);
}

.module-heading > p {
    margin: 0;
    color: var(--text-muted);
    text-align: right;
}

@media (max-width: 700px) {
    .operations-navigation-inner {
        width: calc(100% - 1rem);
        min-height: 3.35rem;
    }

    .operations-nav-item {
        min-height: 2.2rem;
        padding: 0.45rem 0.7rem;
        font-size: 0.82rem;
    }

    .nav-planned-label {
        display: none;
    }

    .console-introduction,
    .module-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.75rem;
    }

    .console-release,
    .module-heading > p {
        text-align: left;
    }
}

/* ============================================================
   Phase 3: Operations Summary
   ============================================================ */

.operations-summary { margin: 1.75rem 0 2rem; }
.operations-summary-heading { display:flex; align-items:end; justify-content:space-between; gap:1.5rem; margin-bottom:1rem; }
.operations-summary-heading h2 { margin:.25rem 0 0; font-size:clamp(1.4rem,2.5vw,1.95rem); line-height:1.15; }
.summary-state { display:inline-flex; align-items:center; gap:.55rem; padding:.5rem .8rem; border:1px solid var(--border); border-radius:999px; color:var(--text-muted); background:var(--surface); font-size:.84rem; font-weight:700; }
.summary-state.is-healthy { border-color:rgba(66,211,146,.38); color:var(--healthy); background:var(--healthy-soft); }
.summary-state.is-warning { border-color:rgba(246,200,95,.4); color:var(--warning); background:var(--warning-soft); }
.summary-state-dot,.summary-status-dot { display:inline-block; border-radius:50%; }
.summary-state-dot { width:.62rem; height:.62rem; background:currentColor; }
.summary-card-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:1rem; }
.summary-card { min-width:0; padding:1.15rem; border:1px solid var(--border); border-radius:var(--radius-medium); background:linear-gradient(145deg,rgba(120,169,255,.035),transparent 55%),var(--surface); }
.summary-card-heading { display:flex; align-items:center; justify-content:space-between; gap:.8rem; color:var(--text-muted); font-size:.8rem; font-weight:750; letter-spacing:.04em; text-transform:uppercase; }
.summary-status-dot { flex:0 0 auto; width:.58rem; height:.58rem; background:var(--unknown); box-shadow:0 0 0 .3rem rgba(255,255,255,.035); }
.summary-status-dot.is-healthy { background:var(--healthy); }
.summary-status-dot.is-warning { background:var(--warning); }
.summary-card > strong { display:block; margin-top:.75rem; font-size:1.18rem; line-height:1.25; }
.summary-card > p { margin:.4rem 0 0; color:var(--text-faint); font-size:.86rem; }
.summary-details { display:grid; gap:.45rem; margin:.8rem 0 0; }
.summary-details > div { display:flex; align-items:baseline; justify-content:space-between; gap:.75rem; }
.summary-details dt,.summary-details dd { margin:0; font-size:.8rem; }
.summary-details dt { color:var(--text-faint); }
.summary-details dd { color:var(--text-muted); font-weight:700; text-align:right; }
@media (max-width:980px) { .summary-card-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:620px) { .operations-summary-heading { align-items:flex-start; flex-direction:column; gap:.75rem; } .summary-card-grid { grid-template-columns:1fr; } }


/* ============================================================
   Phase 3: Recent Events panel
   ============================================================ */

.recent-events-panel {
    margin: 2rem 0;
    padding: clamp(1.1rem, 2vw, 1.5rem);
    border: 1px solid var(--border);
    border-radius: var(--radius-large);
    background: var(--surface);
    scroll-margin-top: 5rem;
}

.recent-events-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.recent-events-heading h2 {
    margin: 0.25rem 0 0;
    font-size: clamp(1.35rem, 2.5vw, 1.9rem);
    line-height: 1.15;
}

.events-api-link {
    flex: 0 0 auto;
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
}

.events-api-link:hover,
.events-api-link:focus-visible {
    text-decoration: underline;
}

.recent-events-list {
    display: grid;
    gap: 0.7rem;
}

.recent-event {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
    gap: 0.9rem;
    padding: 0.95rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-medium);
    background: var(--surface-raised);
}

.recent-event-indicator {
    width: 0.65rem;
    height: 0.65rem;
    margin-top: 0.35rem;
    border-radius: 50%;
    background: var(--unknown);
}

.event-severity-info .recent-event-indicator {
    background: var(--accent);
}

.event-severity-warning .recent-event-indicator {
    background: var(--warning);
}

.event-severity-critical .recent-event-indicator {
    background: var(--critical);
}

.recent-event-content {
    min-width: 0;
}

.recent-event-title-row {
    display: flex;
    align-items: baseline;
    gap: 0.65rem;
}

.recent-event-title-row h3 {
    margin: 0;
    font-size: 1rem;
}

.event-severity {
    color: var(--text-faint);
    font-size: 0.66rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.recent-event-content p {
    margin: 0.25rem 0 0;
    color: var(--text-muted);
    font-size: 0.84rem;
}

.recent-event-content code {
    color: var(--text);
}

.recent-event-message {
    color: var(--text-faint) !important;
}

.recent-event time {
    color: var(--text-faint);
    font-size: 0.77rem;
    white-space: nowrap;
}

.recent-events-empty {
    padding: 1.4rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius-medium);
    text-align: center;
}

.recent-events-empty p {
    margin: 0.35rem 0 0;
    color: var(--text-muted);
}

@media (max-width: 700px) {
    .recent-events-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.6rem;
    }

    .recent-event {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .recent-event time {
        grid-column: 2;
        white-space: normal;
    }
}

/* ============================================================
   Phase 3: Canonical UPS presentation state
   ============================================================ */

.ups-card {
    transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.ups-state-online {
    border-color: rgba(66, 211, 146, 0.24);
}

.ups-state-on-battery {
    border-color: rgba(246, 200, 95, 0.58);
    background: linear-gradient(145deg, rgba(246, 200, 95, 0.08), transparent 42%), var(--surface);
}

.ups-state-low-battery,
.ups-state-unavailable {
    border-color: rgba(255, 107, 107, 0.62);
    background: linear-gradient(145deg, rgba(255, 107, 107, 0.09), transparent 42%), var(--surface);
}

.ups-state-unknown {
    border-color: rgba(154, 166, 184, 0.48);
}

.connection-badge-online {
    border-color: rgba(66, 211, 146, 0.3);
    color: var(--healthy);
    background: var(--healthy-soft);
}

.connection-badge-on-battery {
    border-color: rgba(246, 200, 95, 0.42);
    color: var(--warning);
    background: var(--warning-soft);
}

.connection-badge-low-battery,
.connection-badge-unavailable {
    border-color: rgba(255, 107, 107, 0.42);
    color: var(--critical);
    background: var(--critical-soft);
}

.connection-badge-unknown {
    border-color: rgba(154, 166, 184, 0.4);
    color: var(--unknown);
    background: var(--unknown-soft);
}

.connection-badge-online .connection-dot { background: var(--healthy); }
.connection-badge-on-battery .connection-dot { background: var(--warning); }
.connection-badge-low-battery .connection-dot,
.connection-badge-unavailable .connection-dot { background: var(--critical); }
.connection-badge-unknown .connection-dot { background: var(--unknown); }

.ups-operational-message {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin: 1rem 1.25rem 0;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-medium);
    color: var(--text-muted);
}

.ups-operational-message strong {
    flex: 0 0 auto;
    color: var(--text);
}

.ups-operational-message[hidden] { display: none; }

@media (max-width: 620px) {
    .ups-operational-message {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.25rem;
    }
}


/* Phase 3: Latest Events count clarification */

.recent-events-description {
    margin: -0.35rem 0 1rem;
    color: var(--text-faint);
    font-size: 0.84rem;
}
