﻿/* ========================================
   DASHBOARD EDITOR - CSS COMPLETO CORRETTO
   ======================================== */

/* === PAGE LAYOUT === */
.dashboard-editor-page {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    background: #0a0a14;
    overflow: hidden;
}

.editor-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* === LOADING OVERLAY === */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 20, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* === TOOLBAR === */
.editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
    border-bottom: 1px solid #334155;
    height: 56px;
    flex-shrink: 0;
}

.toolbar-left,
.toolbar-center,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toolbar-title h5 {
    margin: 0;
    font-weight: 500;
    letter-spacing: 0.3px;
    color: #fff;
}

.editor-toolbar .btn-outline-light {
    border-color: rgba(255, 255, 255, 0.3);
}

    .editor-toolbar .btn-outline-light:hover,
    .editor-toolbar .btn-outline-light.active {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.5);
    }

/* === TAGS PANEL === */
.tags-panel {
    width: 320px;
    min-width: 320px;
    background: #1e293b;
    border-right: 1px solid #334155;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    overflow: hidden;
    flex-shrink: 0;
}

    .tags-panel.hidden {
        width: 0;
        min-width: 0;
        border-right: none;
    }

.tags-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #0f172a;
    border-bottom: 1px solid #334155;
    color: #fff;
}

.tags-panel-search {
    padding: 12px 16px;
    border-bottom: 1px solid #334155;
}

.tags-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.tags-panel-footer {
    padding: 12px 16px;
    background: #0f172a;
    border-top: 1px solid #334155;
    text-align: center;
}

/* === TAG GROUPS === */
.tag-group {
    margin-bottom: 4px;
}

.tag-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #0f172a;
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background 0.2s;
}

    .tag-group-header:hover {
        background: #1e3a5f;
        color: #fff;
    }

.tag-group-items {
    padding: 4px 8px;
}

/* === TAG ITEMS === */
.tag-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin: 4px 0;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 6px;
    cursor: grab;
    transition: all 0.2s ease;
}

    .tag-item:hover {
        border-color: #3b82f6;
        background: #1e3a5f;
        transform: translateX(4px);
    }

    .tag-item:active {
        cursor: grabbing;
    }

.tag-item-content {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.tag-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.tag-id {
    color: #60a5fa;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tag-name {
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.drag-handle {
    color: #475569;
    font-size: 0.9rem;
}

/* ========================================
   CANVAS - STRUTTURA CRITICA
   ======================================== */

/* Contenitore principale del canvas */
.canvas-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
    background: #0a0a14;
}

/* Canvas Wrapper - centra il canvas con aspect-ratio dinamico */
.canvas-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #0a0a14;
    height: 100%;
}

/* Frame canvas - aspect-ratio settato inline da JS per matchare il viewer */
.canvas-scroll-area {
    position: relative;
    width: 100%;
    max-height: 100%;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    /* aspect-ratio viene settato inline da Blazor/JS */
}

/* Canvas vero - POSITION ABSOLUTE + INSET 0 è CRITICO */
.dashboard-canvas {
    position: absolute;
    inset: 0;
    background: #0f172a;
    border-radius: 8px;
    overflow: hidden;
    container-type: inline-size;
    --rpx: min(0.0521cqi, 0.0926vh);        /* 1px @1920x1080; su ultrawide vh limita */
}

    /* Griglia editor */
    .dashboard-canvas.show-grid {
        background-image: linear-gradient(rgba(59, 130, 246, 0.08) 1px, transparent 1px), linear-gradient(90deg, rgba(59, 130, 246, 0.08) 1px, transparent 1px);
        background-size: 1% 2%;
    }

/* === BACKGROUND === */
.canvas-background-img,
.canvas-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* === CANVAS ELEMENTS === */
.canvas-element {
    position: absolute;
    cursor: move;
    transition: box-shadow 0.2s ease;
    /*z-index: 10;*/
}

    .canvas-element.editable {
        cursor: move;
    }

    .canvas-element:hover {
        /*z-index: 20;*/
    }

    .canvas-element.selected {
        /*z-index: 30;*/
        box-shadow: 0 0 0 2px #3b82f6, 0 0 20px rgba(59, 130, 246, 0.3);
    }

    .canvas-element.dragging {
        opacity: 0.7;
        /*z-index: 100;*/
        cursor: grabbing;
    }

/* === ELEMENT CONTENT === */
.element-content {
    /* Rimosso min-width/height - gestito per tipo */
}

.is-circle-element .element-content,
.canvas-element.is-circle-element .element-content {
    min-width: 0 !important;
    min-height: 0 !important;
}

.canvas-element:not(.is-circle-element):not(.is-container) .element-content {
    min-width: 0;
    min-height: 0;
}

.canvas-element.is-container .element-content {
    min-width: 0;
    min-height: 0;
}

/* === ELEMENT HOVER MENU === */
.element-hover-menu {
    position: absolute;
    top: -40px;
    right: 0;
    display: flex;
    gap: 4px;
    background: #1e293b;
    padding: 4px 8px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 50;
}

.canvas-element:hover .element-hover-menu {
    opacity: 1;
}

.element-hover-menu button {
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

    .element-hover-menu button:hover {
        background: #334155;
        color: #fff;
    }

    .element-hover-menu button.delete:hover {
        background: #ef4444;
        color: #fff;
    }

/* === ELEMENT TOOLBAR === */
.element-toolbar {
    z-index: 50 !important;
}

/* === RESIZE HANDLES === */
.resize-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #3b82f6;
    border: 2px solid #fff;
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.2s;
    /*z-index: 60;*/
}

.canvas-element.selected .resize-handle {
    opacity: 1;
}

.resize-handle.nw {
    top: -5px;
    left: -5px;
    cursor: nw-resize;
}

.resize-handle.ne {
    top: -5px;
    right: -5px;
    cursor: ne-resize;
}

.resize-handle.sw {
    bottom: -5px;
    left: -5px;
    cursor: sw-resize;
}

.resize-handle.se {
    bottom: -5px;
    right: -5px;
    cursor: se-resize;
}

/* === ELEMENT TYPE LABEL === */
.element-type-label {
    position: absolute;
    bottom: -18px;
    left: 0;
    font-size: 0.6rem;
    color: #64748b;
    white-space: nowrap;
}

.element-type-badge {
    display: inline-block;
    padding: 1px 4px;
    border-radius: 2px;
    font-weight: 600;
    margin-right: 4px;
}

.type-component .element-type-badge {
    background: #3b82f6;
    color: #fff;
}

.type-gauge .element-type-badge {
    background: #22c55e;
    color: #fff;
}

.type-vtag .element-type-badge {
    background: #f59e0b;
    color: #fff;
}

/* === DROP INDICATOR === */
.drop-indicator {
    position: absolute;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 80px;
    background: rgba(59, 130, 246, 0.2);
    border: 2px dashed #3b82f6;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #3b82f6;
    font-size: 0.85rem;
    pointer-events: none;
    z-index: 1000;
    animation: pulse 1s ease-in-out infinite;
}

    .drop-indicator i {
        font-size: 1.5rem;
        margin-bottom: 4px;
    }

.drag-ghost {
    position: absolute;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 40px;
    background: rgba(59, 130, 246, 0.3);
    border: 2px solid #3b82f6;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3b82f6;
    pointer-events: none;
    z-index: 999;
}

/* === EMPTY STATE === */
.empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #475569;
    pointer-events: none;
}

    .empty-state h5 {
        color: #64748b;
    }

/* === SCADA COMPONENT STYLES === */
.scada-component {
    background: rgba(15, 23, 42, 0.95);
    border-radius: 6px;
    overflow: hidden;
    backdrop-filter: blur(4px);
}

.component-header {
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.3px;
}

.component-body {
    padding: 6px;
    display: flex;
    gap: 4px;
}

    .component-body.flex-column {
        flex-direction: column;
    }

    .component-body.flex-row {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .component-body.flex-wrap {
        flex-wrap: wrap;
    }

.feature-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    border-radius: 4px;
    min-width: 0;
    gap: 8px;
}

.feature-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    opacity: 0.8;
}

.feature-value {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.8rem;
    font-weight: 600;
}

.feature-bit {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

    .feature-bit.on {
        background: #22c55e;
    }

    .feature-bit.off {
        background: #ef4444;
    }

/* === GAUGE PREVIEW === */
.gauge-preview {
    background: rgba(15, 23, 42, 0.95);
    border-radius: 6px;
    padding: 12px;
    text-align: center;
    min-width: 120px;
}

.gauge-header {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.gauge-arc {
    position: relative;
    width: 100px;
    margin: 0 auto;
}

.gauge-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    font-family: 'Roboto Mono', monospace;
}

.gauge-unit {
    font-size: 0.7rem;
    color: #64748b;
    margin-top: 4px;
}

/* === VTAG PREVIEW === */
.vtag-preview {
    background: rgba(15, 23, 42, 0.95);
    border-radius: 6px;
    padding: 8px 12px;
    text-align: center;
    min-width: 80px;
}

.vtag-header {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-bottom: 6px;
}

.vtag-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin: 0 auto;
    transition: all 0.3s;
}

    .vtag-circle.active {
        box-shadow: inset 0 1px 0 rgba(255,255,255,0.15);
    }

.vtag-value {
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.85rem;
    color: #fff;
}

/* === MISSING DATA === */
.missing-data {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px dashed #ef4444;
    border-radius: 6px;
    color: #ef4444;
    min-width: 100px;
    min-height: 60px;
}

    .missing-data i {
        font-size: 1.2rem;
        margin-bottom: 4px;
    }

    .missing-data span {
        font-size: 0.75rem;
    }

/* === SCROLLBARS === */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1e293b;
}

::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: #475569;
    }

/* ========================================
   LIGHT MODE OVERRIDES
   Sovrascrivono i colori dark quando
   data-bs-theme="light" è attivo
   ======================================== */

[data-bs-theme="light"] .tags-panel {
    background: var(--bs-secondary-bg);
    border-right-color: var(--bs-border-color);
}

[data-bs-theme="light"] .tags-panel-header {
    background: var(--bs-tertiary-bg);
    border-bottom-color: var(--bs-border-color);
    color: var(--bs-emphasis-color);
}

[data-bs-theme="light"] .tags-panel-search {
    border-bottom-color: var(--bs-border-color);
}

[data-bs-theme="light"] .tags-panel-footer {
    background: var(--bs-tertiary-bg);
    border-top-color: var(--bs-border-color);
}

[data-bs-theme="light"] .tag-group-header {
    background: var(--bs-tertiary-bg);
    color: var(--bs-secondary-color);
}

[data-bs-theme="light"] .tag-group-header:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--bs-emphasis-color);
}

[data-bs-theme="light"] .tag-item {
    background: var(--bs-body-bg);
    border-color: var(--bs-border-color);
}

[data-bs-theme="light"] .tag-item:hover {
    background: rgba(59, 130, 246, 0.08);
    border-color: #3b82f6;
}

[data-bs-theme="light"] .drag-handle {
    color: var(--bs-secondary-color);
}

[data-bs-theme="light"] ::-webkit-scrollbar-track {
    background: var(--bs-secondary-bg);
}

[data-bs-theme="light"] ::-webkit-scrollbar-thumb {
    background: var(--bs-border-color);
}

[data-bs-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: var(--bs-secondary-color);
}

/* === LIGHT MODE - Main Structure === */
[data-bs-theme="light"] .dashboard-editor-page {
    background: var(--bs-body-bg);
}

[data-bs-theme="light"] .editor-main {
    background: var(--bs-body-bg);
}

[data-bs-theme="light"] .canvas-container {
    background: var(--bs-tertiary-bg);
}

[data-bs-theme="light"] .canvas-wrapper {
    background: var(--bs-tertiary-bg);
}

[data-bs-theme="light"] .canvas-scroll-area {
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.15);
}

[data-bs-theme="light"] .loading-overlay {
    background: rgba(255, 255, 255, 0.95);
}

[data-bs-theme="light"] .loading-overlay .text-light {
    color: var(--bs-body-color) !important;
}

[data-bs-theme="light"] .editor-toolbar {
    background: linear-gradient(135deg, #e2e8f0 0%, #f1f5f9 100%);
    border-bottom-color: var(--bs-border-color);
}

[data-bs-theme="light"] .toolbar-title h5 {
    color: var(--bs-emphasis-color);
}

[data-bs-theme="light"] .editor-toolbar .btn-outline-light {
    border-color: var(--bs-border-color);
    color: var(--bs-body-color);
}

[data-bs-theme="light"] .editor-toolbar .btn-outline-light:hover,
[data-bs-theme="light"] .editor-toolbar .btn-outline-light.active {
    background: rgba(0, 0, 0, 0.08);
    border-color: var(--bs-border-color);
}

[data-bs-theme="light"] .element-hover-menu {
    background: var(--bs-body-bg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

[data-bs-theme="light"] .element-hover-menu button {
    color: var(--bs-body-color);
}

[data-bs-theme="light"] .element-hover-menu button:hover {
    background: var(--bs-secondary-bg);
    color: var(--bs-emphasis-color);
}

[data-bs-theme="light"] .empty-state {
    color: var(--bs-secondary-color);
}

[data-bs-theme="light"] .empty-state h5 {
    color: var(--bs-secondary-color);
}

/* === TOASTS === */
.toast-container {
    z-index: 9999;
}

.toast {
    min-width: 300px;
}

/* === UTILITIES === */
.bg-purple {
    background-color: #8b5cf6 !important;
}

.text-purple {
    color: #8b5cf6 !important;
}

/* === ANIMATIONS === */
@keyframes pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.05);
        opacity: 0.8;
    }
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .tags-panel {
        position: absolute;
        left: 0;
        top: 56px;
        bottom: 0;
        z-index: 100;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
    }

        .tags-panel.hidden {
            transform: translateX(-100%);
        }

    .canvas-container {
        padding: 10px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOT DASHBOARD WIDGET (ldw-*)
   Compact panel for lot management — used as dashboard element
   ═══════════════════════════════════════════════════════════════════════════ */
.ldw {
    width: 100%;
    height: 100%;
    color: #e2e8f0;
    font-size: .78rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ── Style: Glass (default) ─────────────────────────────── */
.ldw--glass {
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

/* ── Style: Solid ───────────────────────────────────────── */
.ldw--solid {
    background: #1e293b;
    border: 2px solid #334155;
    border-radius: 4px;
}
.ldw--solid .ldw-header { border-bottom-color: #334155; }
.ldw--solid .ldw-active { border-left-width: 4px; }
.ldw--solid .ldw-new-form { border-bottom-color: #334155; }

/* ── Style: Minimal ─────────────────────────────────────── */
.ldw--minimal {
    background: transparent;
    border: none;
    border-radius: 0;
}
.ldw--minimal .ldw-header {
    border-bottom: none;
    padding-bottom: 4px;
}
.ldw--minimal .ldw-active {
    border-left: none;
    background: transparent;
    padding-left: 0;
}
.ldw--minimal .ldw-new-form { border-bottom: none; }
.ldw--minimal .ldw-queue-item { border-bottom-color: rgba(255,255,255,.06); }

/* Loading */
.ldw-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--bs-primary);
}

/* Header */
.ldw-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.ldw-header-icon { font-size: .8rem; opacity: .6; }
.ldw-title {
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .1em;
    opacity: .7;
    flex: 1;
}
.ldw-count {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 1px 7px;
    font-size: .62rem;
    font-weight: 600;
}

/* Buttons (generic) */
.ldw-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all .12s;
    color: #e2e8f0;
    background: transparent;
    padding: 0;
}
.ldw-btn--add {
    width: 22px; height: 22px;
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
    font-size: .65rem;
}
.ldw-btn--add:hover { background: rgba(34, 197, 94, 0.35); }

/* Quick add form */
.ldw-new-form {
    display: flex;
    gap: 4px;
    padding: 6px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    align-items: flex-end;
}
.ldw-new-fields {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
}
.ldw-new-extra {
    font-size: .65rem !important;
    opacity: .8;
}
.ldw-new-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 5px;
    color: #e2e8f0;
    padding: 3px 8px;
    font-size: .72rem;
    outline: none;
    min-width: 0;
}
.ldw-new-input::placeholder { color: rgba(226, 232, 240, 0.35); }
.ldw-new-input:focus { border-color: rgba(99, 102, 241, 0.5); }
.ldw-btn--go {
    width: 26px; height: 26px;
    background: rgba(34, 197, 94, 0.25);
    color: #22c55e;
    font-size: .68rem;
    flex-shrink: 0;
}
.ldw-btn--go:hover { background: rgba(34, 197, 94, 0.4); }
.ldw-btn--go:disabled { opacity: .3; cursor: not-allowed; }

/* Active lot */
.ldw-active {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 3px solid #22c55e;
    background: rgba(34, 197, 94, 0.06);
}
.ldw-active.paused {
    border-left-color: #6366f1;
    background: rgba(99, 102, 241, 0.06);
}
.ldw-active-top {
    display: flex;
    align-items: center;
    gap: 6px;
}
.ldw-active-name {
    font-weight: 700;
    font-size: .82rem;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ldw-active-extra {
    font-size: .65rem;
    opacity: .5;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Pulse dot */
.ldw-pulse {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #22c55e;
    flex-shrink: 0;
    animation: ldw-pulse-anim 1.5s ease-in-out infinite;
}
.ldw-pulse.paused {
    background: #6366f1;
    animation: none;
}
@keyframes ldw-pulse-anim {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
    50% { opacity: .7; box-shadow: 0 0 0 5px rgba(34, 197, 94, 0); }
}

/* Status badge */
.ldw-status-badge {
    font-size: .58rem;
    font-weight: 600;
    letter-spacing: .04em;
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    flex-shrink: 0;
}
.badge-running { background: rgba(34, 197, 94, 0.2); color: #22c55e; }
.badge-paused  { background: rgba(99, 102, 241, 0.2); color: #818cf8; }

/* Controls */
.ldw-controls {
    display: flex;
    gap: 4px;
    margin-top: 6px;
}
.ldw-ctrl {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 24px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: .68rem;
    transition: all .12s;
}
.ldw-ctrl:disabled { opacity: .3; cursor: not-allowed; }
.ldw-ctrl--play {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}
.ldw-ctrl--play:hover:not(:disabled) { background: rgba(34, 197, 94, 0.35); }
.ldw-ctrl--pause {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}
.ldw-ctrl--pause:hover:not(:disabled) { background: rgba(99, 102, 241, 0.35); }
.ldw-ctrl--stop {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}
.ldw-ctrl--stop:hover:not(:disabled) { background: rgba(239, 68, 68, 0.3); }

/* Empty state */
.ldw-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px 10px;
    opacity: .35;
    font-size: .72rem;
}
.ldw-empty i { font-size: 1.2rem; }

/* Queue */
.ldw-queue {
    max-height: 140px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.1) transparent;
}
.ldw-queue-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.ldw-queue-item:last-child { border-bottom: none; }
.ldw-queue-name {
    flex: 1;
    font-size: .72rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ldw-queue-status {
    font-size: .58rem;
    opacity: .5;
    text-transform: uppercase;
    letter-spacing: .04em;
    flex-shrink: 0;
}
.ldw-btn--start-queue {
    width: 20px; height: 18px;
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
    font-size: .58rem;
    flex-shrink: 0;
}
.ldw-btn--start-queue:hover:not(:disabled) { background: rgba(34, 197, 94, 0.4); }
.ldw-queue-more {
    text-align: center;
    font-size: .62rem;
    opacity: .35;
    padding: 3px 0;
}

/* Error */
.ldw-error {
    padding: 4px 10px 6px;
    font-size: .65rem;
    color: #f87171;
    background: rgba(239, 68, 68, 0.08);
}

/* ═══════════════════════════════════════════════════════════════════════════
   UNIFIED COMPONENT RENDERER — moved from UnifiedComponentRenderer.razor
   All dimensions use var(--rpx) for responsive scaling.
   ═══════════════════════════════════════════════════════════════════════════ */

.unified-component {
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    /* font-size: calc(12 * var(--rpx, 1px));*/
}

.unified-component.no-border { border: none !important; }

.unified-component.is-circle {
    border-radius: 50% !important;
    aspect-ratio: 1;
    padding: calc(1 * var(--rpx));
    box-sizing: border-box;
}

/* Header */
.cmp-header {
    padding: calc(5 * var(--rpx)) calc(10 * var(--rpx));
    font-size: calc(12 * var(--rpx));
    font-weight: 700;
    letter-spacing: calc(1 * var(--rpx));
    text-transform: uppercase;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cmp-header.header-compact {
    padding: calc(2 * var(--rpx)) calc(6 * var(--rpx));
    font-size: calc(9.6 * var(--rpx));
}

.cmp-header.header-clickable {
    cursor: pointer;
    transition: filter 0.15s ease;
}

.cmp-header.header-clickable:hover { filter: brightness(1.2); }

/* Body */
.cmp-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: var(--cmp-pad, calc(4 * var(--rpx)));
    gap: calc(2 * var(--rpx));
}

.cmp-body.circle-body { padding: 0; border-radius: 50%; overflow: hidden; }

/* Feature rows */
.feature-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--row-pad, calc(3 * var(--rpx))) calc(6 * var(--rpx));
    border-radius: 3px;
    min-height: calc(20 * var(--rpx));
    font-size: calc(12 * var(--rpx));
    overflow: hidden;
}

.cmp-body.has-custom-size .feature-row,
.cmp-body.has-custom-size .feature-label,
.cmp-body.has-custom-size .feature-value {
    font-size: inherit;
}

.clickable-feature { cursor: pointer; transition: all 0.15s ease; }
.clickable-feature:hover { background: rgba(59, 130, 246, 0.15) !important; }
.clickable-feature:hover .write-icon-btn { opacity: 1; }

.write-icon-btn {
    flex-shrink: 0;
    opacity: 0.45;
    font-size: 0.8em;
    margin-right: calc(4 * var(--rpx));
    color: #38bdf8;
    transition: opacity 0.15s;
}

.cmd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: calc(4 * var(--rpx));
    border: none;
    border-radius: 3px;
    padding: calc(2 * var(--rpx)) calc(8 * var(--rpx));
    font-size: calc(10 * var(--rpx));
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: calc(0.5 * var(--rpx));
    transition: filter 0.15s, transform 0.1s;
    white-space: nowrap;
}

.cmd-btn:hover { filter: brightness(1.15); }
.cmd-btn:active { transform: scale(0.97); }
.cmd-icon { font-size: 0.85em; }

.bit-cmd-toggle {
    display: inline-flex;
    align-items: center;
    gap: calc(4 * var(--rpx));
    font-size: calc(11 * var(--rpx));
    font-weight: 600;
    padding: calc(2 * var(--rpx)) calc(8 * var(--rpx));
    border-radius: 3px;
}

.bit-cmd-on { color: #4ade80; background: rgba(34,197,94,.15); }
.bit-cmd-off { color: #94a3b8; background: rgba(148,163,184,.1); }

.feature-label {
    opacity: 0.75;
    flex: 1;
    min-width: 0;
    margin-right: calc(8 * var(--rpx));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: uppercase;
    letter-spacing: calc(0.5 * var(--rpx));
    font-size: 0.92em;
    font-weight: 500;
}

.feature-value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: right;
    flex-shrink: 0;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.feature-value.full-width { text-align: center; }

.bit-indicator-dot {
    display: inline-block;
    width: 1.2em;
    height: 1.2em;
    border-radius: 50%;
    border: calc(2 * var(--rpx)) solid rgba(255,255,255,0.5);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.35), inset 0 1px 2px rgba(255,255,255,0.15);
    transition: all 0.3s ease;
    vertical-align: middle;
}

.bit-indicator-dot.on {
    border-color: rgba(255,255,255,0.75);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.35), inset 0 1px 2px rgba(255,255,255,0.2);
}

/* Circle */
.circle-fill {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.circle-value {
    font-size: calc(16 * var(--rpx));
    font-weight: bold;
    font-variant-numeric: tabular-nums;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.circle-label {
    font-size: calc(8 * var(--rpx));
    color: rgba(255,255,255,0.8);
    text-transform: uppercase;
    margin-top: calc(2 * var(--rpx));
}

.container-hint {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.empty-cmp {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #64748b;
    font-size: calc(11.2 * var(--rpx));
    padding: calc(8 * var(--rpx));
}

.more-indicator {
    text-align: center;
    color: #64748b;
    font-size: calc(9.6 * var(--rpx));
    padding: calc(2 * var(--rpx));
}

/* Gauge */
.unified-gauge {
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: calc(3 * var(--rpx)) solid #334155;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);
}

.gauge-header { font-size: calc(10.4 * var(--rpx)); color: #94a3b8; text-transform: uppercase; }
.gauge-arc-container { position: relative; width: 80%; max-width: calc(100 * var(--rpx)); }
.gauge-arc { width: 100%; }

.gauge-value-overlay {
    position: absolute;
    bottom: calc(2 * var(--rpx));
    left: 50%;
    transform: translateX(-50%);
    font-size: calc(17.6 * var(--rpx));
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.gauge-simple { display: flex; flex-direction: column; align-items: center; }
.gauge-value { font-size: calc(19.2 * var(--rpx)); font-weight: bold; font-variant-numeric: tabular-nums; }
.gauge-unit { font-size: calc(9.6 * var(--rpx)); color: #64748b; margin-top: calc(2 * var(--rpx)); }

/* Virtual tag */
.unified-vtag {
    width: 100%;
    height: 100%;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.vtag-header {
    padding: calc(4 * var(--rpx)) calc(8 * var(--rpx));
    font-size: calc(10.4 * var(--rpx));
    color: rgba(255,255,255,0.7);
    background: rgba(0,0,0,0.2);
}

.vtag-value {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(16 * var(--rpx));
    font-weight: bold;
    color: white;
    font-variant-numeric: tabular-nums;
}

.vtag-circle { border-radius: 50%; margin: auto; transition: all 0.3s; }
.vtag-circle.active { box-shadow: inset 0 1px 0 rgba(255,255,255,0.15); }

.vtag-img { max-width: 60%; max-height: 60%; object-fit: contain; margin: auto; }

.vtag-manual { cursor: pointer; position: relative; }
.vtag-manual:hover { outline: 1px solid rgba(56, 189, 248, 0.4); outline-offset: -1px; }

.vtag-edit-hint {
    position: absolute;
    top: 2px;
    right: 3px;
    font-size: calc(10 * var(--rpx));
    color: rgba(56, 189, 248, 0.5);
    pointer-events: none;
    transition: opacity 0.15s;
}

.vtag-manual:hover .vtag-edit-hint { color: rgba(56, 189, 248, 0.9); }

/* Dynamic image */
.unified-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: opacity 0.3s ease;
}

.unified-image img { max-width: none !important; max-height: none !important; pointer-events: none; }
.unified-image img[src$=".gif"] { image-rendering: auto; }

.unified-image .image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: calc(6 * var(--rpx));
    color: #64748b;
    font-size: calc(11.2 * var(--rpx));
    background: rgba(30, 58, 95, 0.3);
    border: calc(2 * var(--rpx)) dashed #334155;
    border-radius: calc(6 * var(--rpx));
    width: 100%;
    height: 100%;
    padding: calc(8 * var(--rpx));
    text-align: center;
}

.image-placeholder i { opacity: 0.5; }
.image-placeholder small { font-size: calc(9.6 * var(--rpx)); }

/* Editor mode override */
.mode-editor .unified-component { border-width: 1px; }
.mode-editor .cmp-body.circle-body { padding: 0 !important; overflow: hidden !important; }

/* Preview mode (fixed px) */
.mode-preview { font-size: 13px; }
.mode-preview .cmp-header { padding: 2px 5px; font-size: 9px; }
.mode-preview .cmp-body { padding: 3px; gap: 2px; }
.mode-preview .feature-row { padding: 2px 4px; font-size: 9px; min-height: 16px; }
.mode-preview .feature-label { font-size: 8px; margin-right: 6px; }
.mode-preview .circle-value { font-size: 12px; }
.mode-preview .circle-label { font-size: 7px; }
.mode-preview .unified-gauge { border-width: 2px; }
.mode-preview .gauge-header { font-size: 8px; }
.mode-preview .gauge-value { font-size: 14px; }
.mode-preview .gauge-value-overlay { font-size: 12px; }
.mode-preview .gauge-unit { font-size: 8px; }
.mode-preview .vtag-header { padding: 3px 6px; font-size: 8px; }
.mode-preview .vtag-value { font-size: 12px; }

/* Feature icon (inline sx della label, demo-style) */
.feature-icon {
    flex-shrink: 0;
    margin-right: calc(8 * var(--rpx));
    font-size: calc(13 * var(--rpx));
    color: #38bdf8;
    width: calc(18 * var(--rpx));
    text-align: center;
}

.cmp-body.has-custom-size .feature-icon { font-size: inherit; }

/* Feature leading (big icon + label/value stacked, card demo bottom) */
.feature-row-leading {
    display: flex;
    align-items: center;
    gap: calc(10 * var(--rpx));
    padding: calc(6 * var(--rpx)) calc(8 * var(--rpx));
    min-height: calc(36 * var(--rpx));
}

.feature-icon-big {
    flex-shrink: 0;
    font-size: calc(26 * var(--rpx));
    width: calc(34 * var(--rpx));
    text-align: center;
    opacity: 0.95;
}

.feature-stack {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    min-width: 0;
    gap: calc(2 * var(--rpx));
}

.feature-label-stack {
    font-size: calc(9 * var(--rpx));
    letter-spacing: calc(0.5 * var(--rpx));
    text-transform: uppercase;
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.feature-value-stack {
    font-size: calc(16 * var(--rpx));
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    white-space: nowrap;
}

.cmp-body.has-custom-size .feature-value-stack,
.cmp-body.has-custom-size .feature-label-stack {
    font-size: inherit;
}

/* Header status badge */
.cmp-header.has-status .cmp-header-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cmp-status-badge {
    display: inline-flex;
    align-items: center;
    gap: calc(5 * var(--rpx));
    font-size: 1em;
    font-weight: 800;
    letter-spacing: calc(0.5 * var(--rpx));
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

.cmp-status-dot {
    width: calc(9 * var(--rpx));
    height: calc(9 * var(--rpx));
    border-radius: 50%;
    animation: statusDotPulse 2s ease-in-out infinite;
}

@keyframes statusDotPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.6; }
}

/* Row dividers (None / Inset / Full) */
.unified-component.dividers-inset .cmp-body,
.unified-component.dividers-full .cmp-body,
.unified-component.dividers-inset .feature-row,
.unified-component.dividers-full .feature-row {
    overflow: visible;
}

.unified-component.dividers-full .cmp-body:not([style*="flex-direction: row"]) .feature-row + .feature-row {
    border-top: 1px solid var(--divider-color, rgba(148,163,184,0.25));
    padding-top: calc(var(--row-pad, calc(3 * var(--rpx))) + calc(1 * var(--rpx)));
}

.unified-component.dividers-inset .cmp-body:not([style*="flex-direction: row"]) .feature-row + .feature-row {
    background-image: linear-gradient(
        to right,
        transparent 0,
        transparent calc(10 * var(--rpx)),
        var(--divider-color, rgba(148,163,184,0.25)) calc(10 * var(--rpx)),
        var(--divider-color, rgba(148,163,184,0.25)) calc(100% - 10 * var(--rpx)),
        transparent calc(100% - 10 * var(--rpx))
    );
    background-repeat: no-repeat;
    background-size: 100% 1px;
    background-position: top left;
    padding-top: calc(var(--row-pad, calc(3 * var(--rpx))) + calc(1 * var(--rpx)));
}

.unified-component.dividers-full .cmp-body[style*="flex-direction: row"] .feature-row + .feature-row {
    border-left: 1px solid var(--divider-color, rgba(148,163,184,0.25));
    padding-left: calc(var(--row-pad, calc(3 * var(--rpx))) + calc(1 * var(--rpx)));
}

.unified-component.dividers-inset .cmp-body[style*="flex-direction: row"] .feature-row + .feature-row {
    background-image: linear-gradient(
        to bottom,
        transparent 0,
        transparent calc(10 * var(--rpx)),
        var(--divider-color, rgba(148,163,184,0.25)) calc(10 * var(--rpx)),
        var(--divider-color, rgba(148,163,184,0.25)) calc(100% - 10 * var(--rpx)),
        transparent calc(100% - 10 * var(--rpx))
    );
    background-repeat: no-repeat;
    background-size: 1px 100%;
    background-position: left center;
    padding-left: calc(var(--row-pad, calc(3 * var(--rpx))) + calc(1 * var(--rpx)));
}

/* Inline gauges */
.inline-gauge {
    display: inline-flex;
    align-items: center;
    margin-left: calc(8 * var(--rpx));
    flex-shrink: 0;
}

.inline-bar {
    width: calc(85 * var(--rpx));
    height: calc(12 * var(--rpx));
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: calc(6 * var(--rpx));
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}

.inline-bar-fill {
    display: block;
    height: 100%;
    border-radius: calc(5 * var(--rpx));
    transition: width 0.4s ease, background 0.4s ease;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.15);
    background-image: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 50%);
}

.inline-signal {
    gap: calc(2.5 * var(--rpx));
    height: calc(18 * var(--rpx));
    align-items: flex-end;
}

.inline-signal .sig-bar {
    display: block;
    width: calc(5 * var(--rpx));
    border-radius: calc(1.5 * var(--rpx));
    background: rgba(148, 163, 184, 0.25);
    transition: all 0.3s;
}

.inline-signal .sig-bar:nth-child(1) { height: 30%; }
.inline-signal .sig-bar:nth-child(2) { height: 55%; }
.inline-signal .sig-bar:nth-child(3) { height: 80%; }
.inline-signal .sig-bar:nth-child(4) { height: 100%; }

.inline-signal .sig-bar.on {
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.15);
}

.inline-dots { gap: calc(4 * var(--rpx)); }
.inline-dots .dot {
    display: block;
    width: calc(8 * var(--rpx));
    height: calc(8 * var(--rpx));
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    transition: background 0.3s;
}

.inline-battery { align-items: center; }
.inline-battery .battery-body {
    display: block;
    width: calc(30 * var(--rpx));
    height: calc(14 * var(--rpx));
    border: calc(1.5 * var(--rpx)) solid rgba(255,255,255,0.6);
    border-radius: calc(2 * var(--rpx));
    padding: calc(1.5 * var(--rpx));
    position: relative;
    box-sizing: border-box;
}

.inline-battery .battery-fill {
    display: block;
    height: 100%;
    border-radius: calc(1 * var(--rpx));
    transition: width 0.3s, background 0.3s;
}

.inline-battery .battery-cap {
    display: block;
    width: calc(2.5 * var(--rpx));
    height: calc(7 * var(--rpx));
    background: rgba(255,255,255,0.6);
    border-radius: 0 calc(1 * var(--rpx)) calc(1 * var(--rpx)) 0;
    margin-left: calc(1 * var(--rpx));
}

/* Preview fallback for small --rpx */
.mode-preview .feature-icon { font-size: 9px; width: 12px; margin-right: 4px; }
.mode-preview .cmp-status-badge { font-size: 8px; gap: 3px; }
.mode-preview .cmp-status-dot { width: 5px; height: 5px; }

.mode-preview .inline-gauge { margin-left: 5px; }
.mode-preview .inline-bar { width: 45px; height: 7px; border-radius: 3px; }
.mode-preview .inline-bar-fill { border-radius: 3px; }

.mode-preview .inline-signal { gap: 1.5px; height: 10px; }
.mode-preview .inline-signal .sig-bar { width: 2.5px; border-radius: 1px; }

.mode-preview .inline-dots { gap: 3px; }
.mode-preview .inline-dots .dot { width: 5px; height: 5px; }

.mode-preview .inline-battery .battery-body { width: 20px; height: 9px; border-width: 1px; padding: 1px; }
.mode-preview .inline-battery .battery-cap { width: 1.5px; height: 4px; }

.mode-preview .unified-component.dividers-inset .feature-row + .feature-row {
    background-image: linear-gradient(
        to right,
        transparent 0,
        transparent 6px,
        var(--divider-color, rgba(255,255,255,0.2)) 6px,
        var(--divider-color, rgba(255,255,255,0.2)) calc(100% - 6px),
        transparent calc(100% - 6px)
    );
    padding-top: 3px;
}

.mode-preview .unified-component.dividers-full .feature-row + .feature-row {
    padding-top: 3px;
}

.mode-preview .feature-row-leading { gap: 6px; padding: 4px 5px; min-height: 22px; }
.mode-preview .feature-icon-big { font-size: 16px; width: 20px; }
.mode-preview .feature-label-stack { font-size: 7px; letter-spacing: 0.3px; }
.mode-preview .feature-value-stack { font-size: 11px; }


/* ========================================
   EVENTS LOG WIDGET
   ======================================== */
.elw {
    --elw-accent: #3b82f6;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid #334155;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #e2e8f0;
    font-size: calc(11 * var(--rpx, 1px));
}
.elw-header {
    display: flex;
    align-items: center;
    gap: calc(6 * var(--rpx, 1px));
    padding: calc(6 * var(--rpx, 1px)) calc(10 * var(--rpx, 1px));
    background: #1e293b;
    border-bottom: 1px solid #334155;
    flex-shrink: 0;
}
.elw-header-icon { color: var(--elw-accent); font-size: calc(13 * var(--rpx, 1px)); }
.elw-title {
    flex: 1;
    font-weight: 700;
    font-size: calc(11 * var(--rpx, 1px));
    letter-spacing: calc(0.5 * var(--rpx, 1px));
    text-transform: uppercase;
    color: var(--elw-accent);
}
.elw-count {
    background: var(--elw-accent);
    color: #fff;
    padding: calc(1 * var(--rpx, 1px)) calc(6 * var(--rpx, 1px));
    border-radius: calc(8 * var(--rpx, 1px));
    font-size: calc(9 * var(--rpx, 1px));
    font-weight: 700;
}
.elw-body {
    flex: 1;
    overflow-y: auto;
    padding: calc(2 * var(--rpx, 1px)) 0;
}
.elw-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #64748b;
    gap: calc(4 * var(--rpx, 1px));
    font-size: calc(11 * var(--rpx, 1px));
}
.elw-empty i { font-size: calc(22 * var(--rpx, 1px)); opacity: 0.5; }
.elw-row {
    display: flex;
    align-items: flex-start;
    gap: calc(8 * var(--rpx, 1px));
    padding: calc(4 * var(--rpx, 1px)) calc(10 * var(--rpx, 1px));
    border-bottom: 1px solid rgba(51, 65, 85, 0.4);
}
.elw-row:last-child { border-bottom: none; }
.elw-icon {
    font-size: calc(10 * var(--rpx, 1px));
    margin-top: calc(3 * var(--rpx, 1px));
    flex-shrink: 0;
}
.elw-text { flex: 1; min-width: 0; }
.elw-msg {
    font-size: calc(11 * var(--rpx, 1px));
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.elw-time {
    font-size: calc(9 * var(--rpx, 1px));
    color: #64748b;
    margin-top: calc(1 * var(--rpx, 1px));
}

/* === STILI === */

/* 1. dark — default */

/* 2. light */
.elw--light { background: #ffffff; border-color: #e2e8f0; color: #1e293b; }
.elw--light .elw-header { background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.elw--light .elw-msg { color: #1e293b; }
.elw--light .elw-time { color: #94a3b8; }
.elw--light .elw-row { border-bottom-color: rgba(226,232,240,0.7); }

/* 3. glass */
.elw--glass {
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-color: rgba(148, 163, 184, 0.25);
}
.elw--glass .elw-header { background: rgba(30, 41, 59, 0.5); border-bottom-color: rgba(148,163,184,0.25); }

/* 4. minimal */
.elw--minimal { background: transparent; border: none; }
.elw--minimal .elw-header { background: transparent; border-bottom: 1px solid currentColor; padding: calc(3 * var(--rpx, 1px)) calc(6 * var(--rpx, 1px)); }
.elw--minimal .elw-row { border-bottom: none; padding: calc(3 * var(--rpx, 1px)) calc(6 * var(--rpx, 1px)); }

/* 5. card */
.elw--card { background: transparent; border: none; padding: calc(4 * var(--rpx, 1px)); }
.elw--card .elw-header { background: transparent; border: none; padding-bottom: calc(8 * var(--rpx, 1px)); }
.elw--card .elw-row {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid #334155;
    border-left: calc(3 * var(--rpx, 1px)) solid var(--elw-accent);
    border-radius: calc(4 * var(--rpx, 1px));
    padding: calc(6 * var(--rpx, 1px)) calc(8 * var(--rpx, 1px));
    margin: calc(3 * var(--rpx, 1px)) 0;
}

/* 6. compact */
.elw--compact .elw-header { padding: calc(3 * var(--rpx, 1px)) calc(8 * var(--rpx, 1px)); }
.elw--compact .elw-row { padding: calc(2 * var(--rpx, 1px)) calc(8 * var(--rpx, 1px)); }
.elw--compact .elw-time { display: none; }

/* 7. timeline */
.elw--timeline .elw-body { position: relative; padding-left: calc(20 * var(--rpx, 1px)); }
.elw--timeline .elw-body::before {
    content: "";
    position: absolute;
    left: calc(12 * var(--rpx, 1px));
    top: 0;
    bottom: 0;
    width: calc(2 * var(--rpx, 1px));
    background: var(--elw-accent);
    opacity: 0.3;
}
.elw--timeline .elw-row { position: relative; border-bottom: none; }
.elw--timeline .elw-row .elw-icon {
    position: absolute;
    left: calc(-14 * var(--rpx, 1px));
    background: #0f172a;
    border-radius: 50%;
    padding: calc(2 * var(--rpx, 1px));
    margin-top: calc(2 * var(--rpx, 1px));
    box-shadow: 0 0 0 calc(2 * var(--rpx, 1px)) var(--elw-accent);
}

/* 8. industrial — HMI */
.elw--industrial {
    background: #2a2a2a;
    border: calc(2 * var(--rpx, 1px)) solid #404040;
    border-radius: 0;
}
.elw--industrial .elw-header {
    background: linear-gradient(180deg, #4a4a4a, #2a2a2a);
    border-bottom: calc(2 * var(--rpx, 1px)) solid var(--elw-accent);
}
.elw--industrial .elw-count { border-radius: 0; }
.elw--industrial .elw-row { border-bottom: 1px solid rgba(64,64,64,0.6); }
.elw--industrial .elw-row:nth-child(odd) { background: rgba(64,64,64,0.4); }
