:root {
    color-scheme: dark;
    font-family: "Helvetica Neue", Arial, sans-serif;
    --app-surface: var(--acuity-card);
    --app-surface-alt: rgba(255, 255, 255, 0.05);
    --app-surface-muted: rgba(255, 255, 255, 0.02);
    --app-border: var(--acuity-border);
    --app-border-strong: var(--acuity-border-strong);
    --app-text: var(--acuity-text);
    --app-text-muted: var(--acuity-text-muted);
    --app-heading: #ffffff;
    --app-primary: var(--acuity-blue);
    --app-accent: var(--acuity-clean-green);
    --app-warning: var(--acuity-yellow);
    --app-danger: var(--acuity-red);
    --app-success: var(--acuity-clean-green);
    --acuity-action-amber: #f5a623;
    --app-shadow: 0 22px 42px rgba(0, 0, 0, 0.45);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background-color: var(--acuity-bg);
    color: var(--app-text);
    font-family: "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--app-accent);
    text-decoration: none;
}

a:hover,
a:focus {
    color: #00c987;
    text-decoration: underline;
}

#blazor-error-ui {
    display: none !important;
}

h1,
h2,
h3,
h4 {
    margin: 0;
    font-weight: 600;
    color: var(--app-heading);
    letter-spacing: 0.04em;
}

p {
    margin: 0;
}

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: inherit;
}

.container {
    width: min(1200px, 100%);
    margin: 0 auto;
    padding: 0 24px;
}

.page-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 0 0 4rem;
}

.login-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    padding: 1rem;
}

.login-card {
    width: 40vw;
    max-width: 520px;
    min-width: 280px;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--app-shadow);
}

.login-card .login-body {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 1.75rem;
}

.login-card .login-body label {
    margin-top: 20px;
    display: block;
}

.login-submit {
    width: 100%;
    margin-top: 20px;
}

.login-support {
    margin-top: 20px;
    text-align: center;
    font-size: 0.9rem;
}

.login-progress {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 20px;
}

.login-progress-inner {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
}

.login-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    overflow: hidden;
}

.login-progress-meter {
    display: block;
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, rgba(0, 177, 118, 0.6), rgba(0, 177, 118, 1));
    animation: login-progress 1.2s ease-in-out infinite;
}

.login-spinner {
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-top-color: rgba(255, 255, 255, 0.9);
    animation: login-spin 0.8s linear infinite;
}

@keyframes login-progress {
    0% {
        width: 0%;
        margin-left: 0%;
    }

    50% {
        width: 70%;
        margin-left: 15%;
    }

    100% {
        width: 0%;
        margin-left: 100%;
    }
}

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

/* Welcome Screen */
.welcome-screen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--acuity-bg);
    color: var(--acuity-text);
    text-align: center;
    padding: 2rem;
}

.welcome-logo {
    height: 56px;
    margin-bottom: 1.5rem;
}

.welcome-title {
    font-size: 1.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: var(--acuity-text-muted);
    margin: 0 0 0.75rem 0;
}

.welcome-version {
    font-size: 0.9rem;
    color: var(--acuity-text-muted);
    margin-bottom: 2.5rem;
}

.welcome-version a {
    color: inherit;
    text-decoration: underline;
}

.welcome-version a:hover {
    color: var(--acuity-clean-green);
}

.signin-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--acuity-clean-green);
    background: transparent;
    border: 2px solid var(--acuity-clean-green);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.signin-button:hover,
.signin-button:focus-visible {
    background: var(--acuity-clean-green);
    color: #ffffff;
    box-shadow: 0 12px 28px rgba(0, 177, 118, 0.4);
    transform: translateY(-1px);
    outline: none;
}

.alert {
    background: var(--app-surface-alt);
    border: 1px solid var(--app-border);
    border-radius: 14px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--app-text);
    line-height: 1.45;
}

.alert-error {
    background: rgba(225, 82, 62, 0.22);
    border-color: rgba(225, 82, 62, 0.45);
    color: var(--app-danger);
}

.alert-success {
    background: rgba(0, 177, 118, 0.22);
    border-color: rgba(0, 177, 118, 0.45);
    color: var(--app-success);
    animation: alert-fade-out 5s ease-in-out forwards;
}

.alert-error {
    animation: alert-fade-out 5s ease-in-out forwards;
}

@keyframes alert-fade-out {
    0% {
        opacity: 1;
    }

    70% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        visibility: hidden;
    }
}

.card {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 24px;
    box-shadow: var(--app-shadow);
    margin-bottom: 0;
    color: var(--app-text);
    overflow: visible;
    backdrop-filter: blur(6px);
}

.card:last-of-type {
    margin-bottom: 0;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.35rem 1.75rem;
    background: var(--app-surface-alt);
    border-bottom: 1px solid var(--app-border-strong);
    color: var(--app-heading);
}

.card-header h2 {
    font-size: 1.05rem;
    text-transform: uppercase;
}

.card-body {
    padding: 1.75rem;
}

button.card-header.collapsible {
    width: 100%;
    background: transparent;
    border: none;
    padding: 1.35rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    cursor: pointer;
    color: inherit;
    font: inherit;
    text-align: left;
    border-bottom: 1px solid var(--app-border-strong);
    transition: background 0.25s ease, border-color 0.25s ease;
}

button.card-header.collapsible .header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

button.card-header.collapsible .header-actions {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

button.card-header.collapsible .actions-divider {
    color: var(--app-text-muted);
    font-weight: 600;
}

button.card-header.collapsible .collapse-icon {
    font-size: 1.6rem;
    line-height: 1;
    color: var(--app-text-muted);
    transition: transform 0.2s ease, color 0.2s ease;
}

button.card-header.collapsible:hover,
button.card-header.collapsible:focus-visible {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--app-border);
    outline: none;
}

button.card-header.collapsible:hover .collapse-icon,
button.card-header.collapsible:focus-visible .collapse-icon {
    color: var(--app-accent);
}

.collapsible-body {
    padding: 0;
    border-top: 1px solid var(--app-border);
    transition: max-height 0.25s ease, opacity 0.25s ease;
    max-height: none;
    opacity: 1;
    overflow: visible;
}

.collapsible-body.collapsed {
    max-height: 0;
    opacity: 0;
    border-top-color: transparent;
    overflow: hidden;
}

.status-card .card-body,
.control-card .card-body,
.settings-card .card-body {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.control-card .card-body {
    padding: 20px;
}

.meter-config-section {
    overflow: visible;
}

.subsection-body {
    overflow: visible;
}

.reload-banner {
    padding: 0.75rem 1rem;
    margin: 0 1.35rem 0.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    text-align: center;
}

.reload-banner-success {
    color: var(--app-success);
    background: rgba(0, 200, 130, 0.15);
}

.reload-banner-error {
    color: var(--app-danger);
    background: rgba(255, 122, 99, 0.14);
}

.force-progress {
    margin: 0 1.35rem 0.5rem;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
}

.force-progress-bar {
    width: 100%;
    height: 100%;
    background: var(--app-accent);
    animation: force-progress-slide 1.2s linear infinite;
    transform: translateX(-100%);
}

@keyframes force-progress-slide {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(0, 177, 118, 0.22);
    color: var(--app-success);
}

.status-pill.processing {
    background: rgba(15, 135, 220, 0.24);
    color: var(--app-primary);
}

.status-pill.waiting {
    background: rgba(255, 199, 25, 0.24);
    color: var(--app-warning);
}

.status-link {
    margin-left: auto;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #5bc0ff;
}

.status-link:hover,
.status-link:focus-visible {
    color: #8ad5ff;
    text-decoration: underline;
}

.toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--app-text);
}

.toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.countdown-row {
    display: grid;
    grid-template-columns: minmax(120px, 160px) 1fr minmax(90px, 140px);
    gap: 1.1rem;
    align-items: center;
    font-size: 0.95rem;
}

.countdown-label {
    font-weight: 600;
    color: var(--app-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.progress {
    display: block;
    position: relative;
    height: 10px;
    background: var(--app-surface-muted);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0, 177, 118, 0.65), rgba(0, 201, 135, 1));
    transition: width 0.35s ease;
}

.countdown-time {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--app-heading);
}

.status-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem 1.5rem;
    margin: 0;
}

.status-meta dt {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--app-text-muted);
}

.status-meta dd {
    margin: 0;
    font-size: 0.95rem;
    color: var(--app-text);
}

.status-note {
    color: var(--app-text-muted);
    font-size: 0.9rem;
    background: var(--app-surface-alt);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--app-border);
}

.status-error {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    background: rgba(225, 82, 62, 0.15);
    border: 1px solid rgba(225, 82, 62, 0.4);
    color: var(--app-danger);
    transition: opacity 0.6s ease;
}

.status-error.fade-out {
    opacity: 0;
}

.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem 1.5rem;
    margin: 0;
}

.data-grid dt {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--app-text-muted);
}

.data-grid dd {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--app-heading);
}

.history-card .card-header {
    align-items: flex-end;
}

.history-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.history-controls input[type="date"] {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--app-border);
    border-radius: 12px;
    padding: 0.55rem 0.75rem;
    color: var(--app-text);
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.history-controls input[type="date"]:focus {
    outline: none;
    border-color: var(--app-primary);
    box-shadow: 0 0 0 0.2rem rgba(15, 135, 220, 0.35);
}

.history-body {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.history-chart-wrapper {
    background: var(--app-surface-alt);
    border: 1px solid var(--app-border);
    border-radius: 18px;
    padding: 1rem;
}

.history-chart-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 10 / 3;
}

.history-chart-stage canvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    border-radius: 12px;
}

.history-chart-skeleton {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.25rem;
    border: 1px dashed var(--app-border);
    border-radius: 16px;
    background: var(--app-surface-muted);
    color: var(--app-text-muted);
}

.history-chart-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    background: var(--app-surface);
}

.skeleton-line {
    height: 14px;
    border-radius: 7px;
    background: linear-gradient(90deg, rgba(30, 139, 247, 0.2) 0%, rgba(30, 139, 247, 0.5) 50%, rgba(30, 139, 247, 0.2) 100%);
    background-size: 220% 100%;
    animation: skeleton-shimmer 1.6s ease-in-out infinite;
}

.skeleton-short {
    max-width: 160px;
}

.skeleton-medium {
    max-width: 240px;
}

.skeleton-chart-placeholder {
    display: grid;
    grid-template-columns: repeat(12, minmax(20px, 1fr));
    align-items: end;
    gap: 0.5rem;
    height: 200px;
    padding: 0.5rem 0;
}

.skeleton-bar {
    width: 100%;
    border-radius: 6px 6px 0 0;
    background: linear-gradient(90deg, rgba(30, 139, 247, 0.15) 0%, rgba(30, 139, 247, 0.4) 50%, rgba(30, 139, 247, 0.15) 100%);
    background-size: 220% 100%;
    animation: skeleton-shimmer 1.6s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
    0% {
        background-position: 220% 0;
    }

    100% {
        background-position: -220% 0;
    }
}

.skeleton-loading-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--app-text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.skeleton-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(30, 139, 247, 0.3);
    border-top-color: var(--acuity-clearsky-blue);
    border-radius: 50%;
    animation: skeleton-spin 0.8s linear infinite;
}

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

button.primary,
button.secondary,
a.secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

button.primary {
    background: linear-gradient(135deg, rgba(0, 177, 118, 0.85), rgba(0, 201, 135, 1));
    border: none;
    border-radius: 999px;
    color: #ffffff;
    padding: 0.65rem 1.8rem;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    box-shadow: 0 16px 30px rgba(0, 177, 118, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

button.primary:hover,
button.primary:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 20px 38px rgba(0, 177, 118, 0.45);
    outline: none;
}

button.primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    background: rgba(0, 177, 118, 0.2);
    color: var(--app-text-muted);
}

button.secondary,
a.secondary {
    background: transparent;
    border: 1px solid var(--app-border);
    border-radius: 999px;
    color: var(--app-text-muted);
    padding: 0.55rem 1.15rem;
    font-size: 0.9rem;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    text-decoration: none;
}

button.secondary:hover,
button.secondary:focus-visible,
a.secondary:hover,
a.secondary:focus-visible {
    border-color: var(--app-success);
    color: var(--app-heading);
    background: rgba(0, 177, 118, 0.16);
    outline: none;
}

button.secondary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: transparent;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.storage-grid {
    grid-template-columns: 1fr 1fr;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.text-input,
.select-input,
.number-input {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border-radius: 12px;
    border: 1px solid var(--app-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--app-text);
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    appearance: none;
}

.text-input::placeholder,
.number-input::placeholder {
    color: rgba(245, 245, 245, 0.55);
}

.text-input:focus,
.select-input:focus,
.number-input:focus {
    outline: none;
    border-color: var(--app-primary);
    box-shadow: 0 0 0 0.2rem rgba(15, 135, 220, 0.35);
    background: rgba(255, 255, 255, 0.08);
}

.text-input:disabled,
.select-input:disabled,
.number-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Compact form variants */
.form-group.compact label {
    font-size: 0.8rem;
}

.form-grid.compact {
    gap: 0.75rem 1rem;
}

.form-grid.compact .form-group {
    gap: 0.35rem;
}

.text-input.compact,
.select-input.compact,
.number-input.compact {
    padding: 0.45rem 0.65rem;
    font-size: 0.85rem;
    border-radius: 8px;
}

.compact-section .text-input,
.compact-section .select-input,
.compact-section .number-input {
    padding: 0.45rem 0.65rem;
    font-size: 0.85rem;
    border-radius: 8px;
}

.compact-section .form-grid {
    gap: 0.75rem 1rem;
}

.compact-section .form-group {
    gap: 0.35rem;
}

.compact-section h4 {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.hint,
.form-hint {
    font-size: 0.8rem;
    color: var(--app-text-muted);
}

.control-alert {
    background: rgba(255, 199, 25, 0.12);
    border: 1px solid rgba(255, 199, 25, 0.4);
    border-radius: 14px;
    padding: 1rem 1.25rem;
    color: var(--app-warning);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.poll-rate-control {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    max-width: 240px;
}

.poll-rate-control label {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--app-text-muted);
}

.dispatch-mode-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.mode-switch {
    position: relative;
    width: 48px;
    height: 24px;
    display: inline-flex;
}

.mode-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.mode-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    transition: background 0.2s ease;
}

.mode-slider::before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: var(--app-surface);
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.mode-switch input:checked+.mode-slider {
    background: rgba(0, 200, 130, 0.5);
}

.mode-switch input:checked+.mode-slider::before {
    transform: translateX(24px);
}

.dispatch-mode-caption {
    font-size: 0.8rem;
    color: var(--app-text-muted);
}

.manual-command-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.inverter-section {
    margin-top: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.inverter-section header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.inverter-section h3 {
    font-size: 1rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--app-heading);
}

.link-button {
    background: none;
    border: none;
    color: var(--app-accent);
    cursor: pointer;
    padding: 0;
    font: inherit;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.link-button:hover,
.link-button:focus-visible {
    color: #00c987;
    outline: none;
}

.link-button.link-edit {
    color: var(--app-warning);
}

.link-button.link-edit:hover,
.link-button.link-edit:focus-visible {
    color: #ffd24d;
}

.link-button.link-remove {
    color: var(--app-danger);
}

.link-button.link-remove:hover,
.link-button.link-remove:focus-visible {
    color: #ff7a63;
}

.log-copy-button {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.log-copy-icon {
    display: inline-flex;
    align-items: center;
    width: 1em;
    height: 1em;
}

.log-copy-icon-diagnostics {
    color: var(--app-success);
}

.register-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--app-border);
    border-radius: 16px;
    overflow: hidden;
    font-size: 0.95rem;
    background: var(--app-surface);
}

.register-table th,
.register-table td {
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid var(--app-border);
    text-align: left;
}

.register-table th {
    background: var(--app-surface-alt);
    color: var(--app-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.8rem;
}

.register-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.register-table tbody tr:hover {
    background: rgba(15, 135, 220, 0.12);
}

.register-table.compact {
    font-size: 0.85rem;
    border-radius: 10px;
}

.register-table.compact th,
.register-table.compact td {
    padding: 0.25rem 0.5rem;
}

.register-table.compact th {
    font-size: 0.7rem;
}

.register-action-cell {
    white-space: nowrap;
}

.register-list-compact {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.85rem 1.5rem;
    border-top: 1px solid var(--app-border);
    background: var(--app-surface-muted);
    color: var(--app-text-muted);
    font-size: 0.88rem;
}

.register-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    background: rgba(15, 135, 220, 0.16);
    border: 1px solid rgba(15, 135, 220, 0.4);
    color: var(--app-primary);
    font-variant-numeric: tabular-nums;
}

.reporting-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.reporting-toggle {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.25rem;
}

.reporting-run-time {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 140px;
}

.reporting-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.reporting-section-header {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.reporting-recipient-input {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.recipient-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.recipient-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--app-border);
    background: var(--app-surface-alt);
    font-size: 0.85rem;
}

.recipient-badge button {
    background: none;
    border: none;
    color: var(--app-danger);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}

.reporting-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem 1.5rem;
}

.reporting-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.reporting-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--app-border);
}

.reporting-table th,
.reporting-table td {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--app-border);
    text-align: left;
}

.reporting-table th {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.75rem;
    color: var(--app-text-muted);
    background: var(--app-surface-alt);
}

.reporting-actions-cell {
    text-align: right;
    white-space: nowrap;
}

.reporting-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.reporting-col {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.reporting-settings {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.25rem;
}

.smtp-summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.reporting-divider {
    height: 1px;
    background: var(--app-border);
    margin: 1.25rem 0;
    opacity: 0.6;
}

button.compact-button {
    padding: 0.5rem 1.25rem;
}

.recipient-badges.sky .recipient-badge {
    background: rgba(91, 192, 255, 0.2);
    border-color: rgba(91, 192, 255, 0.5);
    color: #e0f4ff;
}

.sky-link {
    color: #5bc0ff;
}

.sky-link:hover,
.sky-link:focus-visible {
    color: #8ad5ff;
}

.badge-clean-green {
    background: rgba(0, 177, 118, 0.2);
    color: var(--app-success);
}

.badge-bumblebee {
    background: rgba(255, 199, 25, 0.25);
    color: #ffc719;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge.success {
    background: rgba(0, 177, 118, 0.22);
    color: var(--app-success);
}

.status-badge.failure {
    background: rgba(225, 82, 62, 0.22);
    color: var(--app-danger);
}

.status-badge.queued {
    background: rgba(91, 192, 255, 0.18);
    color: #5bc0ff;
}

.status-badge.idle {
    background: rgba(255, 255, 255, 0.12);
    color: var(--app-text-muted);
}

.status-badge.badge-clean-green {
    border: 1px solid rgba(0, 177, 118, 0.4);
    background: rgba(0, 177, 118, 0.1);
    color: var(--app-success);
}

.status-badge.badge-bumblebee {
    border: 1px solid rgba(255, 199, 25, 0.4);
    background: rgba(255, 199, 25, 0.1);
    color: #ffc719;
}

.status-badge.badge-error {
    border: 1px solid rgba(225, 82, 62, 0.4);
    background: rgba(225, 82, 62, 0.1);
    color: var(--app-danger);
}

.host-summary {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    padding: 20px;
}

.host-summary-meta {
    font-size: 0.85rem;
    color: var(--app-text-muted);
}

.manual-summary-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.host-summary-card {
    border: 1px solid var(--app-border);
    border-radius: 16px;
    background: var(--app-surface-alt);
    padding: 1rem 1.25rem;
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.35);
}

.host-summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.host-summary-title {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.host-summary-sub {
    font-size: 0.8rem;
    color: var(--app-text-muted);
}

.host-summary-body {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    color: var(--app-text);
    font-size: 0.92rem;
}

.host-summary-condition {
    font-weight: 600;
}

.host-summary-condition.positive {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    background: rgba(0, 177, 118, 0.2);
    color: var(--app-success);
}

.host-summary-condition.negative {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    background: rgba(225, 82, 62, 0.2);
    color: var(--app-danger);
}

.host-summary-condition.neutral {
    color: var(--app-text-muted);
}

.host-summary-command {
    line-height: 1.35;
    color: var(--app-text-muted);
}

.host-summary-sent {
    font-size: 0.78rem;
    color: var(--app-text-muted);
}

.host-summary-sent.stale {
    font-weight: 600;
    color: var(--app-danger);
}

.host-summary-sent-warning {
    display: inline-flex;
    align-items: center;
    margin-left: 0.4rem;
    font-size: 0.72rem;
    color: var(--app-danger);
}

.host-grid {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) minmax(240px, 2fr) minmax(120px, 1fr) minmax(120px, 1fr) auto;
    gap: 1rem 1.25rem;
    align-items: end;
}

.host-grid>div:not(.host-add-button) {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.host-add-button {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 0.5rem;
}

.host-add-button .link-button {
    white-space: nowrap;
}

.register-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem 1.5rem;
}

.register-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.register-type-card {
    padding: 1rem 1.25rem;
    border: 1px solid var(--app-border);
    border-radius: 14px;
    background: var(--app-surface-alt);
    color: var(--app-text);
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.register-type-card h4 {
    margin: 0 0 0.4rem 0;
    font-size: 1rem;
    color: var(--app-heading);
}

.register-type-card p {
    margin: 0;
    font-size: 0.88rem;
    color: var(--app-text-muted);
}

.register-type-card:hover,
.register-type-card:focus-visible {
    border-color: var(--app-primary);
    box-shadow: 0 14px 28px rgba(15, 135, 220, 0.28);
    transform: translateY(-2px);
    outline: none;
}

.register-type-card.selected {
    border-color: var(--app-accent);
    box-shadow: 0 16px 30px rgba(0, 177, 118, 0.35);
    background: rgba(0, 177, 118, 0.12);
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.form-field label {
    font-weight: 600;
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--app-text-muted);
}

.form-field.readonly span {
    padding: 0.7rem 0.9rem;
    border-radius: 12px;
    background: var(--app-surface-alt);
    color: var(--app-text);
    font-size: 0.95rem;
    border: 1px solid var(--app-border);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 3, 3, 0.78);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1100;
    backdrop-filter: blur(8px);
}

.modal-dialog {
    width: min(720px, 92vw);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    background: var(--app-surface);
    border-radius: 20px;
    border: 1px solid var(--app-border);
    box-shadow: var(--app-shadow);
    pointer-events: auto;
    overflow: hidden;
    color: var(--app-text);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.35rem 1.75rem 1rem;
    border-bottom: 1px solid var(--app-border-strong);
    background: var(--app-surface-alt);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--app-heading);
}

.modal-close {
    background: none;
    border: none;
    color: var(--app-text-muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
}

.modal-close:hover,
.modal-close:focus-visible {
    color: var(--app-accent);
    transform: scale(1.05);
    outline: none;
}

.modal-body {
    padding: 1.5rem 1.75rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.logs-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.logs-control p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--app-text-muted);
}

.log-output {
    border-radius: 16px;
    border: 1px solid var(--app-border);
    background: var(--app-surface-alt);
    font-family: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 0.9rem;
    padding: 1rem;
    max-height: 52vh;
    overflow: auto;
    color: var(--app-text);
    white-space: pre-wrap;
}

.log-output pre {
    margin: 0;
    font-family: inherit;
    color: inherit;
    white-space: inherit;
}

.modal-footer {
    padding: 1rem 1.75rem 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    border-top: 1px solid var(--app-border-strong);
}

.modal-error {
    margin: 0;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    background: rgba(225, 82, 62, 0.16);
    border: 1px solid rgba(225, 82, 62, 0.4);
    color: var(--app-danger);
    font-size: 0.9rem;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 900px) {
    .host-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }

    .host-add-button {
        justify-content: flex-start;
    }
}

@media (max-width: 720px) {
    .container {
        padding: 0 18px;
    }

    .card {
        border-radius: 18px;
    }

    .card-header,
    button.card-header.collapsible {
        padding: 1.1rem 1.25rem;
    }

    .card-body {
        padding: 1.25rem;
    }

    .countdown-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .history-controls input[type="date"] {
        width: 100%;
    }

    .host-add-button {
        justify-self: stretch;
    }

    .host-add-button .link-button {
        width: 100%;
    }
}

@media (max-width: 540px) {
    .history-controls {
        width: 100%;
    }

    .form-actions {
        justify-content: stretch;
    }

    button.primary,
    button.secondary {
        width: 100%;
    }
}

.watchdog-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font: inherit;
    font-size: inherit;
}

.watchdog-indicator.healthy .watchdog-label {
    color: var(--app-success);
}

.watchdog-indicator.watchdog-alert .watchdog-label {
    color: var(--acuity-terra-red);
}

.watchdog-indicator.watchdog-alert .watchdog.text-muted {
    color: var(--acuity-ash) !important;
}

/* Battery Visualization */
.battery-viz-wrapper {
    position: relative;
    width: 100px;
    /* Width of the rotated container (height of battery) */
    height: 220px;
    /* Height of the rotated container (width of battery) */
    display: flex;
    align-items: center;
    justify-content: center;
    /* margin: 0 auto; Removed to allow flex alignment */
    margin-top: 30px;
    /* Move Viz Down 30px */
}

.battery-viz-rotated {
    transform: rotate(-90deg);
    width: 200px;
    /* Length of the battery */
    height: 100px;
    /* Thickness of the battery */
    position: relative;
    display: flex;
    align-items: center;
}

.battery-icon {
    width: 100%;
    height: auto;
    fill: none;
    stroke: var(--acuity-text-muted);
    stroke-width: 2;
    position: relative;
    z-index: 2;
}

.battery-fill {
    position: absolute;
    background-color: var(--acuity-clearsky-blue);
    height: 96px;
    top: 50%;
    transform: translateY(-50%);
    left: 1%;
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
    z-index: 1;
    border: 4px solid #141414;
}

.soc-line {
    position: absolute;
    top: -10px;
    /* Extend slightly outside */
    bottom: -10px;
    width: 0;
    border-left: 3px dashed;
    z-index: 10;
    transition: left 0.3s ease;
}

.power-bar-container {
    position: absolute;
    top: -80px;
    /* Move 50px left (was -30px) */
    /* 100px height + 50px margin */
    left: 0;
    width: 200px;
    height: 16px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.power-bar-zero {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateX(-50%);
    z-index: 1;
}

.power-bar-fill {
    position: absolute;
    top: 0;
    bottom: 0;
    transition: all 0.3s ease;
}

.soc-line.min-soc {
    border-color: var(--acuity-terra-red);
}

.soc-line.max-soc {
    border-color: var(--acuity-yellow);
}

.soc-label {
    position: absolute;
    transform-origin: 0 0;
    transform: rotate(90deg) translateX(0);
    left: 11px;
    /* Moved 3px up (was 8px) */
    top: 130px;
    /* Moved 20px right (was 110px) */
    font-weight: bold;
    font-size: 14px;
    white-space: nowrap;
}

/* Power bar limit lines for demand reduction indicators */
.power-bar-limit-line {
    position: absolute;
    left: -8px;
    right: -8px;
    height: 0;
    border-top: 2px dashed var(--acuity-orange);
    z-index: 20;
    pointer-events: none;
}

.power-bar-limit-label {
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    font-weight: bold;
    color: var(--acuity-orange);
    white-space: nowrap;
}

/* Microgrid Visualization Headers */
.viz-header {
    /* Using relative positioning for grid layout */
    position: relative;
    white-space: nowrap;
    font-weight: bold;
    font-size: 14px;
    color: var(--acuity-text);
    text-align: center;
}

/* Legacy storage header styling - deprecated */
.viz-header-storage {
    /* Using relative positioning for grid layout */
}

.viz-label-charge {
    /* Using relative positioning for grid layout */
    position: relative;
    text-align: center;
    font-weight: bold;
    font-size: 14px;
    color: var(--acuity-text);
    white-space: nowrap;
}

.viz-label-power {
    /* Using relative positioning for grid layout */
    position: relative;
    text-align: center;
    font-weight: bold;
    font-size: 14px;
    color: var(--acuity-text);
    white-space: nowrap;
}

/* Microgrid Visualization Bars */
.microgrid-viz-bar {
    /* Using relative positioning for flex layout */
    position: relative;
    width: auto;
    height: auto;
}

/* These left values are deprecated - using flex layout now */
.viz-utility,
.viz-load,
.viz-pv {
    /* No longer using absolute positioning */
}

.viz-label-utility,
.viz-label-load,
.viz-label-pv {
    /* Now using relative positioning within flex containers */
    position: relative;
    white-space: nowrap;
    font-weight: bold;
    font-size: 14px;
    color: var(--acuity-text);
    text-align: center;
}

/* Reuse power-bar-track and power-bar-fill from existing styles, 
   but ensure they work within the new containers */
.microgrid-viz-bar .power-bar-track {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: #333;
    border-radius: 8px;
    overflow: hidden;
}

.microgrid-viz-bar .power-bar-fill {
    position: absolute;
    width: 100%;
    left: 0;
    transition: height 0.3s ease, top 0.3s ease;
}

.microgrid-viz-bar .power-bar-center-line {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%);
    z-index: 10;
}

.min-soc .soc-label {
    color: var(--acuity-terra-red);
}

.max-soc .soc-label {
    color: var(--acuity-yellow);
}

.watchdog-icon {
    font-size: 1.5rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.watchdog-indicator.healthy .watchdog-icon {
    color: var(--app-success);
    animation: heartbeat 0.9s ease-in-out infinite;
}

.watchdog-indicator.watchdog-alert .watchdog-icon {
    color: var(--acuity-terra-red);
    animation: none;
}

.watchdog-label {
    font-size: inherit;
    text-transform: none;
    letter-spacing: normal;
}

@keyframes heartbeat {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }
}

/* Meter Status Styles */
.meter-status-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.75rem;
    padding: 20px;
}

.meter-status-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    background: var(--app-surface-alt);
    border: 1px solid var(--app-border);
    border-radius: 12px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.meter-status-chip.badge-clean-green {
    border-color: rgba(0, 177, 118, 0.4);
    background: rgba(0, 177, 118, 0.1);
}

.meter-status-chip.badge-bumblebee {
    border-color: rgba(255, 199, 25, 0.4);
    background: rgba(255, 199, 25, 0.1);
}

.meter-status-chip.badge-error {
    border-color: rgba(225, 82, 62, 0.4);
    background: rgba(225, 82, 62, 0.1);
}

.meter-status-chip.badge-muted,
.meter-status-chip.badge-sky {
    border-color: var(--app-border);
    background: var(--app-surface-alt);
    opacity: 0.8;
}

.meter-status-chip.badge-clearsky {
    border-color: rgba(30, 139, 247, 0.4);
    background: rgba(30, 139, 247, 0.1);
}

.meter-status-chip.badge-terra {
    border-color: rgba(183, 65, 14, 0.4);
    background: rgba(183, 65, 14, 0.1);
}

.meter-status-chip.badge-disabled {
    border-color: rgba(128, 128, 128, 0.4);
    background: rgba(128, 128, 128, 0.1);
}

.meter-name {
    font-weight: 600;
    color: var(--app-heading);
    margin-right: auto;
}

.meter-value {
    font-family: "JetBrains Mono", monospace;
    color: var(--app-text);
    margin-right: 1rem;
    font-weight: 600;
}

.meter-response {
    font-size: 0.8rem;
    color: var(--app-text-muted);
    min-width: 45px;
    text-align: right;
}

/* Tab Navigation */
.tabs-header {
    display: flex;
    gap: 1.5rem;
}

.tab-button {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--app-text-muted);
    padding: 0.75rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
    text-transform: uppercase;
}

.tab-button:hover,
.tab-button:focus-visible {
    color: var(--app-heading);
    outline: none;
}

.tab-button.active {
    color: var(--app-accent);
    border-bottom-color: var(--app-accent);
}

.ems-tab-content {
    margin-top: 1.5rem;
}

/* BESS Status Badge Colors */
.status-badge.badge-blue {
    border: 1px solid rgba(30, 139, 247, 0.5);
    background: rgba(30, 139, 247, 0.15);
    color: var(--acuity-clearsky-blue);
}

.status-badge.badge-purple {
    border: 1px solid rgba(109, 74, 255, 0.5);
    background: rgba(109, 74, 255, 0.15);
    color: var(--acuity-purple);
}

.status-badge.badge-red {
    border: 1px solid rgba(225, 82, 62, 0.5);
    background: rgba(225, 82, 62, 0.15);
    color: var(--acuity-red);
}

.status-badge.badge-gray {
    border: 1px solid rgba(160, 160, 160, 0.4);
    background: rgba(160, 160, 160, 0.12);
    color: #a0a0a0;
}

/* BESS Status Section Layout */
.bess-status-section {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 200px;
    padding-right: 2rem;
}

.bess-status-group {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.bess-status-heading {
    font-size: 0.85rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--acuity-text);
    margin-bottom: 3px;
}

.bess-status-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: flex-start;
    padding-left: 10px;
}

.bess-status-row .status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem;
    font-size: 0.75rem;
    white-space: nowrap;
}

.bess-status-row .status-badge i {
    font-size: 0.85rem;
}

.energy-storage-layout {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

/* MICROGRID Card Collapsed Layout */
/* 6-Column Grid Layout for MICROGRID card */
.microgrid-grid-layout {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
    width: 100%;
    padding: 20px;
    /* 20px buffer on all sides */
    box-sizing: border-box;
    min-height: 320px;
}

/* Each grid column - top and center justified */
.grid-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    /* Top justified */
}

/* Headers - uniform styling */
.microgrid-grid-layout .viz-header {
    font-weight: bold;
    font-size: 14px;
    color: var(--acuity-text);
    text-align: center;
    margin-bottom: 8px;
    white-space: nowrap;
}

/* Vertical power bars - uniform size */
.microgrid-grid-layout .power-bar-track {
    width: 16px;
    height: 200px;
    background-color: #333;
    border-radius: 8px;
    overflow: visible;
    position: relative;
}

/* Power bar fill - visible color in the track */
.microgrid-grid-layout .power-bar-fill {
    position: absolute;
    left: 0;
    width: 100%;
    border-radius: 4px;
    transition: all 0.3s ease;
}

/* Power bar center line */
.microgrid-grid-layout .power-bar-center-line {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%);
}

/* Bottom labels - uniform styling */
.microgrid-grid-layout .viz-label {
    font-weight: bold;
    font-size: 14px;
    color: var(--acuity-text);
    text-align: center;
    margin-top: 8px;
    white-space: nowrap;
}

/* Energy Storage power bar container (horizontal bar) */
.power-bar-container-vertical {
    width: 16px;
    height: 200px;
    background-color: #333;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

/* Battery column - aligned with power bar columns */
.grid-col-battery {
    min-width: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 25px;
}

/* 
 * Battery wrapper inside grid - overrides base .battery-viz-wrapper styles
 * Height set to 200px to match power bar track height, so label stacks naturally below
 */
.grid-col-battery .battery-viz-wrapper {
    height: 200px;
    width: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0;
    /* No extra margin - wrapper height handles positioning */
}

/* Battery rotation preserved, no extra margins needed */
.grid-col-battery .battery-viz-rotated {
    /* Inherits base rotation styles */
}

/* kWh label stacks naturally below the wrapper */
.grid-col-battery .viz-label-charge {
    font-weight: bold;
    font-size: 14px;
    color: var(--acuity-text);
    text-align: center;
    padding-top: 10px;
}

/* Badges column */
.grid-col-badges {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.bess-compact .bess-status-group {
    gap: 0.35rem;
}

.bess-compact .bess-status-heading {
    font-size: 0.75rem;
    margin-bottom: 0.15rem;
}

.bess-compact .bess-status-row {
    margin-bottom: 0.05rem;
}

/* Compact badge styles */
.status-badge.badge-compact {
    padding: 0.2rem 0.5rem;
    font-size: 0.5rem;
    border-radius: 6px;
    width: 120px;
    text-align: left;
    padding-left: 10px;
}

.status-badge.badge-compact i {
    font-size: 0.75rem;
}

/* Toggle Switch */
.toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.toggle-switch input {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background-color: #3a3b3c;
    /* Darker background for off state */
    border: 1px solid var(--app-border);
    border-radius: 999px;
    transition: background-color 0.2s, border-color 0.2s;
    flex-shrink: 0;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background-color: var(--app-text-muted);
    border-radius: 50%;
    transition: transform 0.2s, background-color 0.2s;
}

.toggle-switch input:checked+.toggle-slider {
    background-color: rgba(0, 177, 118, 0.22);
    border-color: rgba(0, 177, 118, 0.45);
}

.toggle-switch input:checked+.toggle-slider::after {
    transform: translateX(20px);
    background-color: var(--app-success);
}

.toggle-label-text {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--app-text-muted);
    min-width: 180px;
    /* Ensure consistent width for labels */
    text-align: right;
}

.toggle-switch input:checked~.toggle-label-text {
    color: var(--app-success);
}

/* Segmented Control Styles */
.segmented-control {
    display: flex;
    border: 1px solid var(--app-border);
    border-radius: 6px;
    overflow: hidden;
    height: 36px;
}

.segmented-control.compact {
    height: 28px;
}

.segmented-control button {
    flex: 1;
    border: none;
    border-right: 1px solid var(--app-border);
    background: transparent;
    color: var(--app-text);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    padding: 0 0.75rem;
    white-space: nowrap;
}

.segmented-control.compact button {
    font-size: 0.75rem;
}

.segmented-control button:last-child {
    border-right: none;
}

.segmented-control button.active {
    background: var(--app-accent);
    color: white;
}

/* Compact Table Override */
.register-table.compact th,
.register-table.compact td {
    padding: 0.25rem 0.5rem;
}

/* Strict Compact Sizes */
.register-table.compact .select-input.compact,
.register-table.compact .number-input.compact {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    height: 28px;
    line-height: 1;
}

.register-table.compact .toggle-switch.compact {
    transform: scale(0.8);
    transform-origin: left center;
}

.register-table.compact td {
    vertical-align: middle;
}

/* Force nowrap on segmented buttons */
.segmented-control button {
    white-space: nowrap;
}

/* Input with Suffix Decoration */
.input-suffix-group {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.input-suffix-group input {
    padding-right: 2.25rem !important;
    /* Make room for suffix, override compact padding if needed */
}

.input-suffix-group .suffix {
    position: absolute;
    right: 0.65rem;
    color: var(--app-text-muted);
    font-size: 0.8rem;
    pointer-events: none;
    user-select: none;
}

.btn-bumblebee {
    background: transparent;
    border: 1px solid var(--acuity-yellow);
    color: var(--acuity-yellow);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-bumblebee:hover:not(:disabled) {
    background: var(--acuity-yellow);
    color: var(--acuity-midnight);
    box-shadow: 0 0 10px rgba(255, 199, 25, 0.4);
}

.btn-bumblebee:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    border-color: var(--app-text-muted);
    color: var(--app-text-muted);
}

/* Sync Status Indicator */
.sync-indicator {
    position: absolute;
    top: -6px;
    right: -6px;
    font-size: 0.9rem;
    z-index: 10;
}

.sync-indicator.synced {
    color: var(--acuity-clean-green);
}

.sync-indicator.dirty {
    color: var(--acuity-yellow);
}

/* Control wrapper for indicator positioning */
.control-with-indicator {
    position: relative;
    display: inline-block;
}

/* Commit Button - Full Width */
.btn-commit {
    width: 100%;
    background: transparent;
    border: 2px solid var(--acuity-yellow);
    color: var(--acuity-yellow);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
}

.btn-commit:hover:not(:disabled) {
    background: var(--acuity-yellow);
    color: var(--acuity-midnight);
    box-shadow: 0 0 15px rgba(255, 199, 25, 0.5);
}

.btn-commit:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: var(--app-text-muted);
    color: var(--app-text-muted);
}

/* Mode-specific action buttons (Standby, System Reset, Soft Shutdown, Hard Shutdown) */
.mode-action-btn {
    width: 100%;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    background: transparent;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.mode-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Standby - Yellow */
.mode-btn-standby {
    border: 2px solid var(--acuity-yellow);
    color: var(--acuity-yellow);
}

.mode-btn-standby:hover:not(:disabled) {
    background: var(--acuity-yellow);
    color: #000000;
    box-shadow: 0 0 15px rgba(255, 199, 25, 0.4);
}

/* System Reset - Blue */
.mode-btn-reset {
    border: 2px solid var(--acuity-clearsky-blue);
    color: var(--acuity-clearsky-blue);
}

.mode-btn-reset:hover:not(:disabled) {
    background: var(--acuity-clearsky-blue);
    color: #ffffff;
    box-shadow: 0 0 15px rgba(30, 139, 247, 0.4);
}

/* Soft Shutdown - Orange */
.mode-btn-soft-shutdown {
    border: 2px solid var(--acuity-orange);
    color: var(--acuity-orange);
}

.mode-btn-soft-shutdown:hover:not(:disabled) {
    background: var(--acuity-orange);
    color: #000000;
    box-shadow: 0 0 15px rgba(247, 138, 30, 0.4);
}

/* Hard Shutdown - Red */
.mode-btn-hard-shutdown {
    border: 2px solid var(--acuity-terra-red);
    color: var(--acuity-terra-red);
}

.mode-btn-hard-shutdown:hover:not(:disabled) {
    background: var(--acuity-terra-red);
    color: #ffffff;
    box-shadow: 0 0 15px rgba(183, 65, 14, 0.4);
}

/* Header User Section - inline with version */
.header-user-section {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-left: 0.25rem;
}

.header-separator {
    color: var(--app-text-muted);
    margin: 0 0.25rem;
}

.header-user-pip {
    color: var(--acuity-clean-green);
    font-size: 0.4rem;
}

.header-username {
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--acuity-clean-green);
}

.header-logout-btn {
    background: transparent;
    border: none;
    color: var(--app-text-muted);
    padding: 0.2rem 0.3rem;
    cursor: pointer;
    transition: color 0.2s ease;
    display: inline-flex;
    align-items: center;
    margin-left: 0.25rem;
}

.header-logout-btn:hover {
    color: var(--app-text);
}

.header-logout-btn i {
    font-size: 0.85rem;
}

/* Auto-Log Badge in Header */
.auto-log-badge {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 199, 25, 0.2);
    color: var(--acuity-yellow, #ffc719);
    border: 1px solid rgba(255, 199, 25, 0.4);
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 0.35rem;
}

.auto-log-badge:hover {
    background: rgba(255, 199, 25, 0.35);
    box-shadow: 0 0 8px rgba(255, 199, 25, 0.3);
}

/* Auto-Log Fading Banner */
.auto-log-banner {
    position: fixed;
    top: 48px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 199, 25, 0.15);
    border: 1px solid rgba(255, 199, 25, 0.35);
    color: var(--acuity-yellow, #ffc719);
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 999;
    pointer-events: none;
    animation: autoLogFade 3s ease forwards;
    backdrop-filter: blur(8px);
    white-space: nowrap;
}

@keyframes autoLogFade {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(-8px);
    }

    10% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    75% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

/* Vertical 2-Position Switch for Control Modes */
.vertical-switch {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
}

.vertical-switch-option {
    position: relative;
    padding: 1rem 1.25rem;
    background: var(--app-surface-alt);
    border: 1px solid var(--app-border);
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.vertical-switch-option:first-child {
    border-radius: 12px 12px 0 0;
    border-bottom: none;
}

.vertical-switch-option:last-child {
    border-radius: 0 0 12px 12px;
}

.vertical-switch-option:hover {
    background: rgba(255, 255, 255, 0.04);
}

.vertical-switch-option.active {
    background: linear-gradient(135deg, rgba(0, 177, 118, 0.12), rgba(0, 177, 118, 0.05));
    border-color: rgba(0, 177, 118, 0.4);
}

.vertical-switch-option.active:first-child {
    border-bottom: none;
}

.vertical-switch-option.active+.vertical-switch-option {
    border-top-color: rgba(0, 177, 118, 0.4);
}

.vertical-switch-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--app-border);
    background: var(--app-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.25s ease;
}

.vertical-switch-option.active .vertical-switch-indicator {
    border-color: var(--app-success);
    background: transparent;
}

.vertical-switch-option.active .vertical-switch-indicator::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--app-success);
}

.vertical-switch-content {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.vertical-switch-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--app-text);
    transition: color 0.25s ease;
}

.vertical-switch-option.active .vertical-switch-title {
    color: var(--app-success);
}

.vertical-switch-description {
    font-size: 0.8rem;
    color: var(--app-text-muted);
    line-height: 1.3;
}

.vertical-switch-option.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.vertical-switch-option.disabled .vertical-switch-indicator {
    border-color: var(--app-border);
}

.vertical-switch-option.disabled .vertical-switch-title {
    color: var(--app-text-muted);
}

.vertical-switch-badge {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: rgba(255, 199, 25, 0.15);
    color: var(--app-warning);
    margin-left: 0.5rem;
}

/* Input prefix (for currency inputs) */
.input-suffix-group .prefix {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--app-text-muted);
    pointer-events: none;
    font-size: 0.9rem;
}

.input-suffix-group:has(.prefix) input {
    padding-left: 1.75rem;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ── AI Timezone Finder ─────────────────────────────── */
.ai-tz-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    background: linear-gradient(135deg, #7c3aed, #a855f7, #c084fc);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    width: 100%;
    justify-content: center;
    height: 38px;
}

.ai-tz-btn:hover {
    background: linear-gradient(135deg, #6d28d9, #9333ea, #a855f7);
    box-shadow: 0 0 16px rgba(168, 85, 247, 0.4);
    transform: translateY(-1px);
}

.ai-tz-btn:active {
    transform: translateY(0);
}

.ai-tz-btn svg {
    fill: rgba(255, 255, 255, 0.9);
    stroke: none;
}

.ai-tz-popover {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 1000;
    min-width: 340px;
    background: #1e1e2e;
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 10px;
    padding: 0.75rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(168, 85, 247, 0.15);
}

.ai-tz-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: #2a2a3e;
    border: 1px solid #444;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}

.ai-tz-input:focus {
    border-color: #a855f7;
}

.ai-tz-input::placeholder {
    color: #666;
}

.ai-tz-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    border: none;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
}

.ai-tz-search-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #6d28d9, #9333ea);
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.3);
}

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

.ai-tz-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.ai-tz-results {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ai-tz-result {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: #2a2a3e;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #e0e0e0;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
}

.ai-tz-result:hover {
    background: #333352;
    border-color: rgba(168, 85, 247, 0.4);
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.15);
}

.ai-tz-result-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #c084fc;
}

.ai-tz-result-reason {
    font-size: 0.75rem;
    color: #888;
}