#app-frame {
    display: none;
}

[x-cloak] {
    display: none !important;
}

.app-frame-navbar {
    height: 50px;
    width: 100%;
    background-color: #1e293b;
    display: flex;
    padding: 0 0.5rem;
    gap: 0.5rem;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    min-width: 0;
}

.app-frame-navbar .left {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
}

.app-frame-navbar.has-page-title .left {
    flex: 1 1 auto;
}

.app-frame-navbar .right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 0 0 auto;
    min-width: 0;
}

.navbar-menu-btn {
    flex-shrink: 0;
    padding: 0.25rem 0.5rem;
}

.navbar-page-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.action-btn-navbar {
    white-space: nowrap;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.pwa-install-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border-radius: 8px;
    font-weight: 500;
    background: rgba(59, 130, 246, 0.22);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.45);
    cursor: pointer;
    animation: pwa-install-glow 2.4s ease-in-out infinite;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.pwa-install-btn[hidden] {
    display: none !important;
}

.pwa-install-btn:hover {
    background: rgba(59, 130, 246, 0.38);
    color: #93c5fd;
    box-shadow:
        0 0 10px rgba(59, 130, 246, 0.55),
        0 0 22px rgba(59, 130, 246, 0.35);
}

@keyframes pwa-install-glow {
    0%,
    100% {
        box-shadow:
            0 0 6px rgba(59, 130, 246, 0.35),
            0 0 14px rgba(59, 130, 246, 0.18);
    }

    50% {
        box-shadow:
            0 0 10px rgba(59, 130, 246, 0.55),
            0 0 22px rgba(59, 130, 246, 0.3);
    }
}

.pwa-hint {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
}

.pwa-hint[hidden] {
    display: none !important;
}

.pwa-hint-card {
    max-width: 20rem;
    width: 100%;
    padding: 1.25rem;
    border-radius: 12px;
    background: #1e293b;
    border: 1px solid rgba(59, 130, 246, 0.45);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    text-align: center;
    color: #e2e8f0;
}

.pwa-hint-title {
    margin: 0 0 0.5rem;
    font-weight: 600;
    color: #93c5fd;
}

.pwa-hint-text {
    margin: 0 0 1rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

.pwa-hint-close {
    padding: 0.45rem 1.1rem;
    border-radius: 8px;
    font-weight: 500;
    background: rgba(59, 130, 246, 0.22);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.45);
    cursor: pointer;
}

.pwa-hint-close:hover {
    background: rgba(59, 130, 246, 0.38);
    color: #93c5fd;
}

.navbar-entity-group {
    display: flex;
    align-items: center;
    min-width: 0;
}

.navbar-entity-select {
    font-size: 13px;
    min-width: 0;
}

.sidebar-entity-group {
    display: none;
}

.sidebar-entity-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94a3b8;
    margin-bottom: 0.4rem;
}

.sidebar-entity-select {
    font-size: 13px;
}

.navbar-page-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 0.75rem;
    padding-left: 0.75rem;
    border-left: 1px solid rgba(148, 163, 184, 0.2);
    min-width: 0;
    overflow: hidden;
}

.navbar-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 6px;
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.15s ease, background-color 0.15s ease;
    flex-shrink: 0;
}

.navbar-back-btn:hover {
    color: #e2e8f0;
    background-color: rgba(148, 163, 184, 0.12);
}

.navbar-page-title-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: #e2e8f0;
    letter-spacing: 0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.change-log-panel {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

.change-log-header {
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.change-log-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.change-log-subtitle {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.65);
}

.change-log-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.change-log-table-wrap {
    overflow-x: auto;
}

.change-log-table th,
.change-log-table td {
    vertical-align: middle;
}

.change-log-subject {
    display: flex;
    align-items: center;
    gap: 6px;
}

.change-log-metadata {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 12px;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.8);
    white-space: pre-wrap;
}

.navbar-page-loading {
    font-size: 0.75rem;
    color: #94a3b8;
}

.app-frame-navbar .logo {
    padding: 3px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.app-frame-navbar .logo img {
    display: block;
    height: 36px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
}

@media (max-width: 767.98px) {
    .app-frame-navbar.has-page-title .logo {
        display: none;
    }

    .app-frame-navbar.has-page-title .left {
        flex: 1 1 auto;
        min-width: 0;
    }

    .app-frame-navbar .right {
        flex: 0 0 auto;
        min-width: 0;
    }

    .app-frame-navbar.has-page-title .navbar-page-title {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
    }

    .navbar-page-loading {
        display: none;
    }

    .action-btn-navbar-label {
        display: none;
    }

    .action-btn-navbar {
        width: 2rem;
        height: 2rem;
        padding: 0;
        justify-content: center;
    }

    .pwa-install-btn.action-btn-navbar {
        width: auto;
        height: auto;
        padding: 0.35rem 0.65rem;
    }

    .navbar-entity-group {
        display: none;
    }

    .sidebar-entity-group {
        display: block;
        padding: 0.75rem 7px 1rem;
        border-bottom: 1px solid rgba(148, 163, 184, 0.15);
    }

    .sidebar-entity-group .form-select {
        width: 100%;
        font-size: 13px;
    }
}

.app-frame-sidebar {
    display: flex;
    background-color: #1e293b;
    flex-direction: column;
    justify-content: space-between;
    align-content: space-between;
    max-height: 100%;
    width: 250px;
    position: sticky;
    flex-shrink: 0;
    transition: width 0.2s ease;
    z-index: 900;
}

.app-frame-sidebar-backdrop {
    display: none;
    position: fixed;
    top: 50px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 890;
    border: 0;
    padding: 0;
    margin: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    transition: opacity 0.2s ease;
    cursor: pointer;
}

body.sidenav-open {
    overflow: hidden;
}

.sidebar-nav-section {
    display: flex;
    flex-direction: column;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(148, 163, 184, 0.15);
}

.sidebar-nav-section-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    padding: 0.35rem 0.65rem 0.45rem;
    white-space: nowrap;
}

.app-frame-sidebar .nav-btn {
    position: relative;
    justify-content: flex-start !important;
    gap: 0;
    border-radius: 6px;
    color: #cbd5e1;
}

.app-frame-sidebar .nav-btn .nav-btn-label {
    text-align: left;
}

.app-frame-sidebar .nav-btn.is-active {
    color: #f1f5f9;
    background-color: rgba(59, 130, 246, 0.18);
}

.app-frame-sidebar .nav-btn.is-active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.35rem;
    bottom: 0.35rem;
    width: 3px;
    border-radius: 0 2px 2px 0;
    background-color: #60a5fa;
}

@media (min-width: 768px) {
    .app-frame-sidebar {
        display: flex;
        transform: none !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }

    .app-frame-sidebar.is-collapsed {
        width: 64px;
    }

    .app-frame-sidebar.is-collapsed .sidebar-entity-group,
    .app-frame-sidebar.is-collapsed .sidebar-nav-section-label,
    .app-frame-sidebar.is-collapsed .nav-btn-label,
    .app-frame-sidebar.is-collapsed .gemtech-sidebar-logo {
        display: none;
    }

    .app-frame-sidebar.is-collapsed .top {
        padding: 0.5rem 0.35rem;
        align-items: stretch;
    }

    .app-frame-sidebar.is-collapsed .bottom {
        padding: 0.5rem 0.35rem;
        align-items: stretch;
    }

    .app-frame-sidebar.is-collapsed .nav-btn {
        justify-content: center !important;
        padding-left: 0.35rem;
        padding-right: 0.35rem;
    }

    .app-frame-sidebar.is-collapsed .nav-btn .ti {
        margin-right: 0 !important;
    }

    .app-frame-sidebar.is-collapsed .sidebar-nav-section {
        margin-top: 0.35rem;
        padding-top: 0.35rem;
    }

    .app-frame-sidebar-backdrop {
        display: none !important;
    }
}

@media (max-width: 767.98px) {
    .app-frame-sidebar {
        position: fixed;
        top: 50px;
        left: 0;
        width: min(100%, 300px);
        height: calc(100vh - 50px);
        height: calc(100dvh - 50px);
        max-height: calc(100dvh - 50px - env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
        transform: translateX(-105%);
        visibility: hidden;
        pointer-events: none;
        transition: transform 0.2s ease, visibility 0.2s ease;
        box-shadow: 8px 0 24px rgba(0, 0, 0, 0.35);
    }

    .app-frame-sidebar.is-open {
        transform: translateX(0);
        visibility: visible;
        pointer-events: auto;
    }

    .app-frame-sidebar-backdrop {
        display: block;
        pointer-events: none;
    }

    .app-frame-sidebar-backdrop.is-visible {
        opacity: 1;
        pointer-events: auto;
    }

    .gemtech-sidebar-logo {
        max-width: 300px;
    }
}

.gemtech-sidebar-logo {
    padding: 3px;
    opacity: 0.6;
    max-width: 100%;
    height: auto;
}

.app-frame-sidebar .top {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 7px;
}

.app-frame-sidebar .bottom {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 7px;
    flex-shrink: 0;
}

.app-frame-sidebar .bottom .gemtech-sidebar-logo {
    margin-top: 0.5rem;
    align-self: center;
}

.main-content-view {
    height: 100%;
    width: 100%;
    overflow-y: auto;
    min-width: 0;
}

.horizontal-components {
    display: flex;
    height: calc(100vh - 50px);
    height: calc(100dvh - 50px);
    position: relative;
}

.modal-icon {
    font-size: 65pt;
}

/* Blur all Bootstrap/Tabler modal backdrops */
.modal-backdrop.show {
    --tblr-backdrop-bg: rgba(15, 23, 42, 0.35);
    --tblr-backdrop-opacity: 1;

    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Device Management */
.device-management {
    padding: 1rem;
    max-width: 1440px;
    margin: 0 auto;
}

@media (min-width: 576px) {
    .device-management {
        padding: 1.25rem;
    }
}

.device-management > .alert {
    margin-bottom: 1rem;
}

.device-management-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    align-items: stretch;
}

@media (min-width: 992px) {
    .device-management-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.gateway-card {
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(30, 41, 59, 0.45);
    border-radius: 16px;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.12),
        0 8px 24px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.gateway-card:hover {
    border-color: rgba(96, 165, 250, 0.28);
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.14),
        0 12px 32px rgba(0, 0, 0, 0.22);
    transform: translateY(-1px);
}

.gateway-card-header {
    display: grid;
    grid-template-columns: 2.5rem 1fr;
    grid-template-areas:
        "icon identity"
        "toolbar toolbar";
    gap: 0.75rem 0.875rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.85));
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

@media (min-width: 576px) {
    .gateway-card-header {
        grid-template-columns: auto 1fr auto;
        grid-template-areas: "icon identity toolbar";
        align-items: center;
        gap: 0.875rem 1rem;
        padding: 1.125rem 1.25rem;
    }
}

.gateway-card-icon {
    grid-area: icon;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.16);
    color: #60a5fa;
    font-size: 1.2rem;
    flex-shrink: 0;
    align-self: start;
}

@media (min-width: 576px) {
    .gateway-card-icon {
        width: 2.75rem;
        height: 2.75rem;
        border-radius: 12px;
        font-size: 1.35rem;
        align-self: center;
    }
}

.gateway-card-identity {
    grid-area: identity;
    min-width: 0;
}

.gateway-card-header-toolbar {
    grid-area: toolbar;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
}

@media (min-width: 576px) {
    .gateway-card-header-toolbar {
        padding-top: 0;
        border-top: none;
        justify-content: flex-end;
    }
}

.gateway-configure-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.45rem 0.85rem;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.5);
    color: #cbd5e1;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
}

.gateway-configure-btn-label {
    white-space: nowrap;
}

.gateway-configure-btn:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(96, 165, 250, 0.35);
    color: #f1f5f9;
}

.gateway-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: #f8fafc;
    margin: 0;
    line-height: 1.25;
    letter-spacing: 0.01em;
    word-break: break-word;
}

@media (min-width: 576px) {
    .gateway-card-title {
        font-size: 1.05rem;
        line-height: 1.3;
    }
}

.gateway-last-seen {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 0.35rem;
    line-height: 1.3;
}

.gateway-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

@media (min-width: 576px) {
    .gateway-status {
        padding: 0.35rem 0.75rem;
        font-size: 0.72rem;
    }
}

.gateway-status-dot {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 6px currentColor;
}

.gateway-status--online {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.gateway-status--offline {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.gateway-card-body {
    background: rgba(15, 23, 42, 0.35);
    padding: 1rem 1.25rem 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.gateway-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.gateway-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 500;
    color: #94a3b8;
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.gateway-meta-chip i {
    font-size: 0.8rem;
    opacity: 0.8;
}

.gateway-last-log {
    border: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(148, 163, 184, 0.05);
    border-radius: 10px;
    padding: 0.65rem 0.75rem;
}

.gateway-last-log-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.65rem;
    margin-bottom: 0.4rem;
}

.gateway-last-log-label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #94a3b8;
}

.gateway-last-log-type {
    font-size: 0.7rem;
    font-weight: 600;
    color: #cbd5e1;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.12);
}

.gateway-last-log-time {
    font-size: 0.7rem;
    color: #64748b;
    margin-left: auto;
}

.gateway-last-log-data {
    margin: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.68rem;
    line-height: 1.35;
    color: #94a3b8;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 4.2em;
    overflow: hidden;
}

.gateway-last-log-empty {
    margin: 0;
    font-size: 0.75rem;
    color: #64748b;
}

.gateway-empty-state {
    margin: 0;
    padding: 1.5rem;
    text-align: center;
    font-size: 0.85rem;
    color: #64748b;
    background: rgba(148, 163, 184, 0.05);
    border: 1px dashed rgba(148, 163, 184, 0.15);
    border-radius: 12px;
}

.gateway-node-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.875rem;
    align-items: stretch;
}

@media (min-width: 576px) {
    .gateway-node-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

.gateway-node-item {
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: rgba(51, 65, 85, 0.25);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.15s ease;
}

.gateway-node-item:hover {
    border-color: rgba(96, 165, 250, 0.25);
}

.gateway-node-item-card {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.gateway-node-item-card > .node-device-card {
    flex: 1;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

.gateway-node-item-card > .node-device-card:hover {
    transform: none;
    box-shadow: none;
    border-color: transparent;
}

.gateway-node-item-actions {
    display: flex;
    justify-content: flex-end;
    padding: 0.5rem 0.75rem;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
    background: rgba(15, 23, 42, 0.35);
}

.node-device-configure-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: transparent;
    color: #94a3b8;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.node-device-configure-btn:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(96, 165, 250, 0.35);
    color: #f1f5f9;
}

.node-device-configure-btn i {
    font-size: 0.85rem;
}

.node-device-card {
    background: linear-gradient(160deg, rgba(51, 65, 85, 0.6), rgba(30, 41, 59, 0.8));
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 12px;
    padding: 1rem 1.125rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    height: 100%;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.node-device-card:hover {
    border-color: rgba(96, 165, 250, 0.3);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 4px 12px rgba(0, 0, 0, 0.15);
}

.node-device-card-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.node-device-card-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.18);
    color: #60a5fa;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.node-device-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.3;
    color: #f1f5f9;
}

.node-device-card-id {
    font-size: 0.68rem;
    color: #94a3b8;
    font-family: ui-monospace, monospace;
    margin-top: 0.2rem;
}

.node-device-card-type {
    font-size: 0.68rem;
    color: #94a3b8;
    margin-top: 0.2rem;
}

.node-device-card-metric {
    flex: 1;
    min-height: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0.75rem;
    background: rgba(15, 23, 42, 0.35);
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.08);
}

.node-device-card-metric-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    margin-bottom: 0.4rem;
}

.node-device-card-metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #f8fafc;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.node-device-card-metric-inline {
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    line-height: inherit;
}

.node-device-card-unit {
    font-size: 0.85rem;
    font-weight: 500;
    color: #94a3b8;
    margin-left: 0.2rem;
}

.node-device-card-footer {
    font-size: 0.7rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding-top: 0.5rem;
}

.node-device-status {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    width: fit-content;
}

.node-device-status-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 6px currentColor;
}

.node-device-status--on {
    background: rgba(34, 197, 94, 0.16);
    color: #4ade80;
}

.node-device-status--off {
    background: rgba(239, 68, 68, 0.16);
    color: #f87171;
}

.node-device-kv-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.node-device-kv {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
}

.node-device-kv-key {
    color: #94a3b8;
}

.node-device-kv-value {
    color: #f1f5f9;
    font-weight: 500;
    font-family: ui-monospace, monospace;
}

.node-device-override-badge {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.65rem;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 600;
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.25);
}

.configure-modal,
.override-modal {
    background: rgba(30, 41, 59, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.configure-modal-device {
    margin-bottom: 1.25rem;
}

.configure-modal-device .text-secondary {
    margin-left: 0.5rem;
    font-family: ui-monospace, monospace;
    font-size: 0.85rem;
}

.configure-option-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.configure-option {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    width: 100%;
    padding: 0.875rem 1rem;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.55);
    color: #f1f5f9;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.configure-option:hover {
    border-color: rgba(96, 165, 250, 0.4);
    background: rgba(30, 41, 59, 0.8);
}

.configure-option--warning:hover {
    border-color: rgba(251, 191, 36, 0.45);
}

.configure-option-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.16);
    color: #60a5fa;
    flex-shrink: 0;
}

.configure-option--warning .configure-option-icon {
    background: rgba(251, 191, 36, 0.16);
    color: #fbbf24;
}

.configure-option-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.configure-option-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.configure-option-desc {
    font-size: 0.8rem;
    color: #94a3b8;
    line-height: 1.4;
}

.configure-option-arrow {
    color: #64748b;
    flex-shrink: 0;
}

.override-modal-device {
    margin-bottom: 1.25rem;
}

.override-modal-device .text-secondary {
    margin-left: 0.5rem;
    font-family: ui-monospace, monospace;
    font-size: 0.85rem;
}

.override-modal-section {
    margin-bottom: 1.25rem;
}

.override-blocked-actions {
    margin-bottom: 1.25rem;
    padding: 0.875rem 1rem;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.override-blocked-actions-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #fca5a5;
    margin-bottom: 0.65rem;
}

.override-blocked-actions-header i {
    font-size: 1.1rem;
}

.override-blocked-actions-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.override-blocked-actions-list li {
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.15);
    color: #f1f5f9;
    font-weight: 600;
}

.override-blocked-actions-empty {
    font-size: 0.85rem;
    color: #94a3b8;
}

.override-modal-warning {
    display: flex;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 10px;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.25);
    color: #fde68a;
    margin-bottom: 1.25rem;
}

.override-modal-warning i {
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.override-modal-warning p {
    font-size: 0.85rem;
    color: #fcd34d;
    margin-top: 0.25rem;
}

.override-action-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.override-action-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.15);
}

.override-action-title {
    font-weight: 500;
    color: #f1f5f9;
}

.override-action-role {
    font-size: 0.72rem;
    color: #94a3b8;
    text-align: right;
    flex-shrink: 0;
}

.override-modal-ack .form-check-label {
    font-size: 0.85rem;
    color: #cbd5e1;
}

/* Action Management */

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

.action-page-title {
    font-size: 1.35rem;
    font-weight: 600;
    color: #f1f5f9;
    margin: 0;
}

.action-page-subtitle {
    font-size: 0.85rem;
    color: #94a3b8;
    margin: 0;
}

.action-card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    align-items: stretch;
}

@media (min-width: 992px) {
    .action-card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.action-card {
    background: rgba(30, 41, 59, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.action-card:hover {
    border-color: rgba(148, 163, 184, 0.3);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

.action-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.action-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #f1f5f9;
    margin: 0;
}

.action-card-body {
    padding: 1rem 1.25rem;
    margin-top: auto;
}

.action-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.82rem;
    color: #94a3b8;
}

.action-card-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.action-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

.action-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    box-shadow: 0 0 6px currentColor;
}

.action-status--active {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.action-status--active .action-status-dot {
    background: #4ade80;
}

.action-status--blocked {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.action-status--blocked .action-status-dot {
    background: #f87171;
}

.action-status--override-blocked {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

.action-status--override-blocked .action-status-dot {
    background: #fbbf24;
}

.action-block-reason {
    display: block;
    max-width: 14rem;
    font-size: 0.72rem;
    line-height: 1.35;
    color: #fbbf24;
    text-align: right;
}

.action-override-blocked-callout {
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border-radius: 10px;
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.25);
}

.action-override-blocked-callout--card {
    margin: 0 1.25rem 1rem;
}

.action-override-blocked-callout-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: #fbbf24;
    font-size: 0.9rem;
}

.action-override-blocked-callout-body {
    font-size: 0.85rem;
    color: #e2e8f0;
}

.action-override-blocked-list {
    margin: 0.75rem 0 0;
    padding-left: 1.25rem;
    font-size: 0.82rem;
    color: #cbd5e1;
}

.action-override-blocked-list-meta {
    color: #94a3b8;
    margin-left: 0.35rem;
}

.action-override-blocked-callout-actions {
    margin-top: 0.85rem;
}

.action-btn-remove-overrides {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.35);
    cursor: pointer;
    transition: background 0.15s ease;
}

.action-btn-remove-overrides:hover:not(:disabled) {
    background: rgba(251, 191, 36, 0.28);
}

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

.action-status--initialising {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
}

.action-status--initialising .action-status-dot {
    background: #94a3b8;
}

.action-cooldown-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    background: rgba(251, 191, 36, 0.12);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.25);
}

.action-section {
    background: rgba(30, 41, 59, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 12px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.action-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    background: linear-gradient(180deg, rgba(51, 65, 85, 0.4) 0%, transparent 100%);
}

.action-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: #f1f5f9;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.action-section-body {
    padding: 1.25rem;
}

.action-settings-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 768px) {
    .action-settings-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.action-form-field label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94a3b8;
    margin-bottom: 0.4rem;
}

.action-form-field .form-control,
.action-form-field .form-select {
    background: rgba(15, 23, 42, 0.6);
    border-color: rgba(148, 163, 184, 0.2);
    color: #f1f5f9;
}

.action-form-field .form-control:focus,
.action-form-field .form-select:focus {
    background: rgba(15, 23, 42, 0.8);
    border-color: rgba(96, 165, 250, 0.5);
    color: #f1f5f9;
    box-shadow: 0 0 0 0.2rem rgba(96, 165, 250, 0.15);
}

.action-rule-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.action-rule-card {
    position: relative;
    padding: 0.9rem 1rem 0.9rem 1.1rem;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.75) 0%, rgba(30, 41, 59, 0.45) 100%);
    border: 1px solid rgba(148, 163, 184, 0.14);
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.action-rule-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
}

.action-rule-card--condition::before {
    background: linear-gradient(180deg, #60a5fa 0%, #3b82f6 100%);
}

.action-rule-card--execution::before {
    background: linear-gradient(180deg, #34d399 0%, #10b981 100%);
}

.action-rule-card:hover {
    border-color: rgba(148, 163, 184, 0.28);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.action-rule-card-delete {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: rgba(239, 68, 68, 0.08);
    color: #f87171;
    opacity: 0;
    cursor: pointer;
    transition: opacity 0.15s ease, background 0.15s ease;
}

.action-rule-card:hover .action-rule-card-delete,
.action-rule-card-delete:focus {
    opacity: 1;
}

.action-rule-card-delete:hover {
    background: rgba(239, 68, 68, 0.2);
}

.action-rule-card-device {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    margin-bottom: 0.75rem;
    padding-right: 2rem;
}

.action-rule-card-device-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    background: rgba(51, 65, 85, 0.6);
    color: #94a3b8;
    flex-shrink: 0;
}

.action-rule-card--condition .action-rule-card-device-icon {
    color: #60a5fa;
    background: rgba(59, 130, 246, 0.12);
}

.action-rule-card--execution .action-rule-card-device-icon {
    color: #34d399;
    background: rgba(16, 185, 129, 0.12);
}

.action-rule-card-device-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.action-rule-card-gateway {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
}

.action-rule-card-node {
    font-size: 0.9rem;
    font-weight: 500;
    color: #f1f5f9;
    line-height: 1.3;
}

.action-rule-card-node-id {
    display: inline-block;
    margin-left: 0.35rem;
    font-family: ui-monospace, monospace;
    font-size: 0.75rem;
    font-weight: 400;
    color: #64748b;
}

.action-rule-card-expression {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.08);
}

.action-rule-card-lead {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    margin-right: 0.15rem;
}

.action-rule-card-arrow {
    color: #475569;
    font-size: 0.8rem;
    line-height: 1;
}

.action-rule-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: ui-monospace, monospace;
    line-height: 1.3;
}

.action-rule-chip--field {
    background: rgba(51, 65, 85, 0.7);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.action-rule-chip--operator {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.25);
    font-weight: 600;
    min-width: 1.75rem;
    justify-content: center;
}

.action-rule-chip--value {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.22);
    font-weight: 600;
}

.action-rule-card--execution .action-rule-chip--value {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.25);
}

.action-rule-empty {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.35);
    border: 1px dashed rgba(148, 163, 184, 0.15);
    font-size: 0.85rem;
    color: #64748b;
}

.action-rule-empty i {
    font-size: 1.1rem;
    opacity: 0.6;
}

.action-rule-form {
    padding: 1rem;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px dashed rgba(148, 163, 184, 0.2);
}

.action-rule-form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .action-rule-form-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.action-empty-state {
    text-align: center;
    padding: 2.5rem 1.5rem;
    color: #94a3b8;
}

.action-empty-state i {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.action-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.35);
    text-decoration: none;
    transition: background 0.15s ease;
}

.action-btn-primary:hover {
    background: rgba(59, 130, 246, 0.35);
    color: #93c5fd;
}

.action-btn-danger-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border-radius: 6px;
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.25);
    flex-shrink: 0;
    cursor: pointer;
    transition: background 0.15s ease;
}

.action-btn-danger-sm:hover {
    background: rgba(239, 68, 68, 0.25);
}

.action-detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 992px) {
    .action-detail-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.action-info-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    padding: 1rem 1.25rem;
    background: rgba(30, 41, 59, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.action-info-item dt {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 0.2rem;
}

.action-info-item dd {
    font-size: 0.9rem;
    color: #e2e8f0;
    margin: 0;
}