/* ── Reset & Variables ────────────────────────────────────────── */
:root {
    --bg: #F2F0EC;
    --surface: #FAFAF8;
    --surface2: #EEECEA;
    --border: rgba(0,0,0,0.08);
    --border2: rgba(0,0,0,0.13);
    --text: #1A1A18;
    --text2: #6B6B66;
    --text3: #A0A09A;
    --heat: #C84B1A;
    --heat-bg: #FAEDE7;
    --cool: #1A6BC8;
    --cool-bg: #E7EEFA;
    --off: #A0A09A;
    --radius: 14px;
    --radius-sm: 8px;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: transparent;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #0071c1;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}





/* ── App shell ────────────────────────────────────────────────── */
.app {
    display: flex;
    flex-direction: column;
    height: 100svh;
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg);
}

.page {
    background: var(--bg);
}

/* ── Header ───────────────────────────────────────────────────── */
.header {
    padding: 20px 20px 0;
    flex-shrink: 0;
}

.header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 18px;
}

.header-title {
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.5px;
    line-height: 1;
}

.header-title span {
    font-size: 18px;
    color: var(--text2)
}

.header-sub {
    font-size: 13px;
    color: var(--text2);
    margin-top: 3px;
    font-family: 'DM Mono', monospace;
}

.season-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    flex-shrink: 0;
    border: 1px solid transparent;
    transition: all 0.2s;
}

    .season-badge.heat {
        background: var(--heat-bg);
        color: var(--heat);
        border-color: rgba(200,75,26,0.15);
    }

    .season-badge.cool {
        background: var(--cool-bg);
        color: var(--cool);
        border-color: rgba(26,107,200,0.15);
    }

/* ── Summary ──────────────────────────────────────────────────── */
.summary-row {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
}

.summary-chip {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.sc-val {
    font-size: 18px;
    font-weight: 600;
    font-family: 'DM Mono', monospace;
}

    .sc-val span {
        font-size: 11px;
        font-weight: 400;
        color: var(--text2);
    }

.sc-lbl {
    font-size: 10px;
    color: var(--text3);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

/* ── Tabs ─────────────────────────────────────────────────────── */
.tabs-wrap {
    display: flex;
    gap: 4px;
    padding-bottom: 1px;
    overflow-x: auto;
    scrollbar-width: none;
}

    .tabs-wrap::-webkit-scrollbar {
        display: none;
    }

.tab-btn {
    padding: 7px 14px;
    border-radius: 20px;
    border: 1px solid transparent;
    background: transparent;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: var(--text2);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.18s;
    flex-shrink: 0;
}

    .tab-btn.active {
        background: var(--text);
        color: #fff;
        border-color: var(--text);
    }

/* ── Content ──────────────────────────────────────────────────── */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px 24px;
    scrollbar-width: none;
}

    .content::-webkit-scrollbar {
        display: none;
    }

/* ── Zone grid ────────────────────────────────────────────────── */
.zone-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

    .zone-grid.single .zcard {
        grid-column: span 2;
    }

/* ── Zone card ────────────────────────────────────────────────── */
/* ---- Zone card (New Mockup Style) ---- */
.zcard {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 13px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s;
}

.zcard:active {
    transform: scale(0.97);
}

/* strip colorata top */
.zcard::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius) var(--radius) 0 0;
}

.zcard.heating {
    border-color: rgba(200, 75, 26, 0.35);
    background: linear-gradient(160deg, rgba(200, 75, 26, 0.04) 0%, var(--surface) 55%);
}

.zcard.heating::before {
    background: var(--heat);
}

.zcard.cooling {
    border-color: rgba(26, 107, 200, 0.35);
    background: linear-gradient(160deg, rgba(26, 107, 200, 0.04) 0%, var(--surface) 55%);
}

.zcard.cooling::before {
    background: var(--cool);
}

.zcard.idle {
    border-color: rgba(200, 75, 26, 0.2);
}

.zcard.idle::before {
    background: var(--border2);
}

.zcard.powered-off {
    opacity: 0.65;
}

.zcard.powered-off::before {
    background: var(--border2);
}

/* ---- Header ---- */
.zc-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 8px;
}

.zc-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.zc-icon {
    font-size: 18px;
    display: inline-block;
    margin-right: 4px;
    line-height: 1;
}

.zc-name {
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

/* badge manuale */
.zc-manual {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    border-radius: 6px;
    background: #FFF8E1;
    border: 1px solid rgba(180, 130, 0, 0.3);
    font-size: 9px;
    font-weight: 700;
    color: #7A5500;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ---- Temperatura + Umidità ---- */
.zc-temp-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.zc-temp-box {
    display: flex;
    align-items: center;
    gap: 4px;
}

.zc-temp-icon {
    font-size: 16px;
    display: inline-block;
    line-height: 1;
}

.zc-temp {
    font-size: 52px;
    font-weight: 700;
    line-height: 1;
    font-family: monospace;
}

.zc-temp.t-heat {
    color: var(--heat);
}

.zc-temp.t-cool {
    color: var(--cool);
}

.zc-temp.t-ok {
    color: var(--text);
}

.zc-unit {
    font-size: 14px;
    color: var(--text2);
    margin-left: 2px;
}

/* ---- Umidità Box ---- */
.zc-hum-box {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    padding: 4px 0;
}

.zc-hum-label {
    font-size: 9px;
    color: var(--text3);
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.zc-hum-value {
    font-size: 32px;
    font-weight: 600;
    color: var(--text2);
    font-family: monospace;
    display: flex;
    align-items: center;
    gap: 3px;
}

/* ---- Setpoint Row ---- */
.zc-setpoint-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 0;
    padding: 0;
}

.zc-sp-label {
    font-size: 9px;
    color: var(--text3);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.3px;
    min-width: 40px;
}

.zc-sp-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    font-family: monospace;
}

/* Switch badge aligned to right */
.zc-setpoint-row .zc-switch {
    flex-shrink: 0;
}

.zc-hum-icon {
    font-size: 16px;
    display: inline-block;
    line-height: 1;
}
.zc-sensors {
    display: none;
}

/* ---- Bottom ---- */
.zc-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* switch stato */
.zc-switch {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
}

.zc-switch.s-heat {
    background: var(--heat-bg);
    color: var(--heat);
}

.zc-switch.s-cool {
    background: var(--cool-bg);
    color: var(--cool);
}

.zc-switch.s-off {
    background: var(--surface2);
    color: var(--text3);
}

.zc-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}

@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

.zc-switch.s-heat .zc-dot,
.zc-switch.s-cool .zc-dot {
    animation: pulse-dot 1.5s ease-in-out infinite;
}

/* power stato */
.zc-power {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    color: var(--text3);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.zc-power.p-on {
    color: #2E7D32;
}

.zc-pdot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ── Detail panel ─────────────────────────────────────────────── */
.detail-panel {
    display: none;
    margin-top: 4px;
    grid-column: span 2;
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    overflow: hidden;
}

    .detail-panel.visible {
        display: block;
    }

.dp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--border);
}

.dp-title {
    font-size: 15px;
    font-weight: 600;
}

.dp-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--surface2);
    border: none;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text2);
}

.dp-sensors {
    display: flex;
    border-bottom: 1px solid var(--border);
}

.dp-sensor {
    flex: 1;
    padding: 12px 16px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 1px;
}

    .dp-sensor:last-child {
        border-right: none;
    }

.dp-s-lbl {
    font-size: 10px;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: .4px;
}

.dp-s-val {
    font-size: 20px;
    font-weight: 600;
    font-family: 'DM Mono', monospace;
}

    .dp-s-val span {
        font-size: 12px;
        font-weight: 400;
        color: var(--text2);
    }

.dp-s-delta {
    font-size: 11px;
    font-family: 'DM Mono', monospace;
}

    .dp-s-delta.pos {
        color: var(--heat);
    }

    .dp-s-delta.neg {
        color: var(--cool);
    }

    .dp-s-delta.zero {
        color: var(--text3);
    }

.dp-setpoint {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.dp-sp-lbl {
    font-size: 12px;
    color: var(--text2);
    font-weight: 500;
}

.dp-sp-controls {
    display: flex;
    align-items: center;
    gap: 14px;
}

.dp-sp-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border2);
    background: var(--surface2);
    font-size: 20px;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

    .dp-sp-btn:active {
        transform: scale(0.94);
    }

.dp-sp-val {
    font-size: 20px;
    font-weight: 600;
    font-family: 'DM Mono', monospace;
    min-width: 58px;
    text-align: center;
}

.dp-presets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-bottom: 1px solid var(--border);
}

.dp-preset {
    padding: 10px 8px;
    text-align: center;
    cursor: pointer;
    border-right: 1px solid var(--border);
    transition: background 0.12s;
}

    .dp-preset:last-child {
        border-right: none;
    }

    .dp-preset.active {
        background: var(--surface2);
    }

        .dp-preset.active .dp-p-name {
            color: var(--text);
            font-weight: 600;
        }

.dp-p-icon {
    font-size: 16px;
    display: block;
    margin-bottom: 3px;
}

.dp-p-name {
    font-size: 11px;
    color: var(--text2);
    display: block;
    font-weight: 500;
}

.dp-p-temp {
    font-size: 10px;
    color: var(--text3);
    display: block;
    font-family: 'DM Mono', monospace;
    margin-top: 1px;
}

.dp-preset.active .dp-p-temp {
    color: var(--heat);
}

.dp-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    gap: 8px;
}

.dp-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

    .dp-status.heat {
        background: var(--heat-bg);
        color: var(--heat);
    }

    .dp-status.cool {
        background: var(--cool-bg);
        color: var(--cool);
    }

    .dp-status.off {
        background: var(--surface2);
        color: var(--text3);
    }

.dp-s-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

@keyframes pdot {
    0%,100% {
        opacity: 1
    }

    50% {
        opacity: .3
    }
}

.dp-status.heat .dp-s-dot,
.dp-status.cool .dp-s-dot {
    animation: pdot 1.5s ease-in-out infinite;
}

.dp-right-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fan-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--border2);
    background: transparent;
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: var(--text2);
    cursor: pointer;
}

    .fan-toggle.on {
        background: var(--cool-bg);
        border-color: rgba(26,107,200,.3);
        color: var(--cool);
    }

@keyframes spin {
    from {
        transform: rotate(0deg)
    }

    to {
        transform: rotate(360deg)
    }
}

.fan-toggle.on .fan-ic {
    animation: spin 1.5s linear infinite;
    display: inline-block;
}

.pwr-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border2);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--text2);
}

    .pwr-btn.on-heat {
        border-color: rgba(200,75,26,.4);
        color: var(--heat);
        background: var(--heat-bg);
    }

    .pwr-btn.on-cool {
        border-color: rgba(26,107,200,.4);
        color: var(--cool);
        background: var(--cool-bg);
    }

/* ── Setup screen ─────────────────────────────────────────────── */
.setup-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100svh;
    padding: 24px;
    background: var(--bg);
}

.setup-card {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    padding: 32px 24px;
    width: 100%;
    max-width: 400px;
}

.setup-icon {
    font-size: 40px;
    text-align: center;
    margin-bottom: 16px;
}

.setup-title {
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 6px;
}

.setup-sub {
    font-size: 13px;
    color: var(--text2);
    text-align: center;
    margin-bottom: 28px;
}

.setup-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.setup-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.setup-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text2);
}

.setup-input {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border2);
    background: var(--bg);
    font-family: 'DM Mono', monospace;
    font-size: 13px;
    color: var(--text);
    outline: none;
    transition: border-color 0.15s;
}

    .setup-input:focus {
        border-color: var(--text);
    }

.setup-hint {
    font-size: 11px;
    color: var(--text3);
}

.setup-error {
    font-size: 12px;
    color: var(--heat);
    background: var(--heat-bg);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
}

.setup-btn {
    padding: 12px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--text);
    color: #fff;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
}

    .setup-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

.logout-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border2);
    background: transparent;
    color: #7E57C2;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    transition: all 0.15s;
}

    .logout-btn:active {
        background: var(--surface2);
        color: #311B92;
    }

/* ── Zone Detail page ────────────────────────────────────────── */
.detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

    .detail-header > div {
        flex: 1;
    }

.detail-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.back-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border2);
    background: var(--surface);
    font-size: 18px;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}

    .back-btn:active {
        background: var(--surface2);
    }

.detail-sensors {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}

.detail-sensor-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
}

.dsc-label {
    font-size: 10px;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: .4px;
}

.dsc-value {
    font-size: 32px;
    font-weight: 600;
    line-height: 1.1;
    font-family: 'DM Mono', monospace;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

    .dsc-value .dsc-icon {
        font-size: 18px;
        display: inline-block;
        line-height: 1;
    }

    .dsc-value span {
        font-size: 18px;
        font-weight: 400;
        color: var(--text2);
        margin-left: 2px;
    }

.dsc-delta {
    font-size: 12px;
    font-family: 'DM Mono', monospace;
    margin-top: 4px;
}

    .dsc-delta.pos {
        color: var(--heat);
    }

    .dsc-delta.neg {
        color: var(--cool);
    }

    .dsc-delta.zero {
        color: var(--text3);
    }

.detail-section {
    margin-bottom: 12px;
}

.detail-section-title {
    font-size: 11px;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 10px;
    font-weight: 500;
}

/* ---- Switch State (Stato dell'impianto) ---- */
.detail-switch-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 4px;
    border-radius: var(--radius);
    border: 2px solid;
    font-size: 14px;
    font-weight: 600;
    text-transform: capitalize;
    letter-spacing: 0.4px;
}

.detail-switch-state.dss-heat {
    background: linear-gradient(135deg, rgba(200, 75, 26, 0.1) 0%, rgba(200, 75, 26, 0.04) 100%);
    border-color: var(--heat);
    color: var(--heat);
}

.detail-switch-state.dss-cool {
    background: linear-gradient(135deg, rgba(26, 107, 200, 0.1) 0%, rgba(26, 107, 200, 0.04) 100%);
    border-color: var(--cool);
    color: var(--cool);
}

.detail-switch-state.dss-off {
    background: var(--surface2);
    border-color: var(--border2);
    color: var(--text3);
}

.dss-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse-dot 1.5s ease-in-out infinite;
}

.detail-switch-state.dss-off .dss-dot {
    animation: none;
    opacity: 0.6;
}

.dss-label {
    display: inline-block;
}

.detail-setpoint {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 20px;
}

.detail-sp-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--border2);
    background: var(--surface2);
    font-size: 26px;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.12s;
}

    .detail-sp-btn:active {
        background: var(--border2);
        transform: scale(0.94);
    }

.detail-sp-value {
    font-size: 28px;
    font-weight: 600;
    font-family: 'DM Mono', monospace;
    color: var(--text);
    background: var(--surface2);
    padding: 12px 24px;
    border-radius: calc(var(--radius) * 0.8);
}

.detail-presets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.detail-preset {
    padding: 8px 8px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

    .detail-preset.active {
        border-color: var(--heat);
        background: var(--heat-bg);
    }

.detail-preset-icon {
    font-size: 22px;
}

.detail-preset-name {
    font-size: 13px;
    color: var(--text2);
    font-weight: 500;
}

.detail-preset.active .detail-preset-name {
    color: var(--heat);
    font-weight: 600;
}

.detail-preset-temp {
    font-size: 12px;
    color: var(--text3);
    font-family: 'DM Mono', monospace;
}

.detail-preset.active .detail-preset-temp {
    color: var(--heat);
}

.detail-not-found {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100svh;
    color: var(--text2);
    font-size: 14px;
}

/*.fan-big-toggle {
    width: 100%;
    padding: 20px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    border: 1px solid var(--border2);
    background: var(--surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

    .fan-big-toggle.on {
        background: var(--cool-bg);
        border-color: rgba(26,107,200,0.35);
    }

.fan-big-ic {
    font-size: 36px;
    display: block;
    transition: transform 0.3s;
}

.fan-big-toggle.on .fan-big-ic {
    animation: spin 1.2s linear infinite;
    display: inline-block;
}*/


.fan-big-toggle {
    width: 100%;
    padding: 12px 16px; /* era 20px, ora 12px */
    border-radius: var(--radius);
    cursor: pointer;
    border: 1px solid var(--border2);
    background: var(--surface);
    display: flex;
    align-items: center;
    gap: 14px; /* row invece di column */
    transition: all 0.2s;
}

.fan-big-ic {
    font-size: 28px;
    flex-shrink: 0;
}
/* era 36px */
.fan-big-label {
    font-size: 13px;
    color: var(--text2);
    font-weight: 500;
    flex: 1;
    text-align: left;
}

.fan-big-state {
    font-size: 16px;
    font-weight: 700;
    font-family: 'DM Mono', monospace;
    color: var(--text3);
}

.fan-big-toggle.on .fan-big-state {
    color: var(--cool);
}

.fan-big-toggle.on .fan-big-label {
    color: var(--cool);
}

.fan-big-toggle.on {
    background: var(--cool-bg);
    border-color: rgba(26,107,200,0.35);
}

    .fan-big-toggle.on .fan-big-ic {
        animation: spin 1.2s linear infinite;
        display: inline-block;
    }

.fan-big-label {
    font-size: 13px;
    color: var(--text2);
    font-weight: 500;
}

.fan-big-state {
    font-size: 18px;
    font-weight: 700;
    font-family: 'DM Mono', monospace;
    color: var(--text3);
}

.fan-big-toggle.on .fan-big-state {
    color: var(--cool);
}

.fan-big-toggle.on .fan-big-label {
    color: var(--cool);
}







/* ── Tab + fan row ───────────────────────────────────────────── */
/*.tab-fan-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0;
}

    .tab-fan-row .tabs-wrap {
        flex: 1;
    }

.fan-pill {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px 7px 9px;
    margin-left: 8px;
    border-radius: 20px;
    border: 1px solid var(--border2);
    background: var(--surface);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
}

    .fan-pill.on {
        background: var(--cool-bg);
        border-color: rgba(26,107,200,0.35);
    }

.fan-pill-ic {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--surface2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.fan-pill.on .fan-pill-ic {
    background: rgba(26,107,200,0.12);
    animation: spin 2s linear infinite;
}

.fan-pill-text {
    display: flex;
    flex-direction: column;
}

.fan-pill-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text2);
    line-height: 1.2;
}

.fan-pill-state {
    font-size: 10px;
    color: var(--text3);
    font-family: 'DM Mono', monospace;
}

.fan-pill.on .fan-pill-name {
    color: var(--cool);
}

.fan-pill.on .fan-pill-state {
    color: var(--cool);
}*/

/* ── Fan bar (opzione B) ─────────────────────────────────────── */
.fan-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-top: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

    .fan-bar.on {
        background: var(--cool-bg);
        border-color: rgba(26,107,200,0.25);
    }

.fan-bar-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.fan-bar.on .fan-bar-icon {
    background: rgba(26,107,200,0.12);
    animation: spin 2s linear infinite;
}

.fan-bar-text {
    flex: 1;
}

.fan-bar-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.fan-bar.on .fan-bar-name {
    color: var(--cool);
}

.fan-bar-sub {
    font-size: 11px;
    color: var(--text3);
    margin-top: 2px;
}

.fan-bar.on .fan-bar-sub {
    color: rgba(26,107,200,0.6);
}

.fan-bar-badge {
    font-size: 12px;
    font-weight: 700;
    font-family: 'DM Mono', monospace;
    color: var(--text3);
    background: var(--surface2);
    padding: 5px 10px;
    border-radius: 20px;
    border: 1px solid var(--border2);
    flex-shrink: 0;
    transition: all 0.2s;
}

    .fan-bar-badge.on {
        color: var(--cool);
        background: rgba(26,107,200,0.12);
        border-color: rgba(26,107,200,0.25);
    }

/* ── Comfort levels ──────────────────────────────────────────── */
.comfort-cold {
    color: #1A6BC8;
}
/* blu  — freddo  */
.comfort-ok {
    color: #2E7D32;
}
/* verde — ok      */
.comfort-hot {
    color: #C84B1A;
}
/* arancione — caldo */
.comfort-dry {
    color: #B8860B;
}
/* giallo scuro — secco */
.comfort-humid {
    color: #1565C0;
}
/* blu scuro — umido */

.dsc-comfort-icon {
    font-size: 18px;
    margin-top: 2px;
}

.config-reload-error,
.config-reload-ok {
    font-size: 11px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    margin-top: 8px;
    text-align: center;
}

.config-reload-error {
    background: var(--heat-bg);
    color: var(--heat);
}

.config-reload-ok {
    background: var(--cool-bg);
    /*color: var(--cool);*/
    color: #2E7D32;
}


/*.logout-btn i,
.back-btn i,
.pwr-btn i {
    font-size: 16px;
}
*/

