/* ══════════════════════════════════════════════════════════════
   Heater pages (/heater*) — global, prefix htr-
   Built on Metronic vars + dcc-tokens.css (spacing, radius, motion, elevation).
   ══════════════════════════════════════════════════════════════ */

.htr {
    --s-1: var(--bs-card-bg, #fff);
    --s-2: var(--bs-gray-100, #f7f8fa);
    --s-3: var(--bs-gray-200, #eef0f4);
    --line: var(--bs-border-color, #e9ecef);
    --txt: var(--bs-heading-color, #181c32);
    --muted: var(--bs-gray-600, #7e8299);
    --acc: var(--dcc-accent, #10b981);
    --acc-2: var(--dcc-accent-2, #06b6d4);
    --warm: #f97316;
    --warm-2: #ef4444;
    --cool: #3b82f6;
    --ok: var(--dcc-ok, #22c55e);
    --err: var(--dcc-err, #f1416c);
    --pend: #f59e0b;
    --tint-acc: rgba(16, 185, 129, .10);
    --tint-acc-2: rgba(16, 185, 129, .22);
    --tint-warm: rgba(249, 115, 22, .10);
    --tint-warm-2: rgba(249, 115, 22, .24);
    --tint-cool: rgba(59, 130, 246, .10);
    --tint-err: rgba(241, 65, 108, .10);
    --tint-pend: rgba(245, 158, 11, .16);
    display: flex;
    flex-direction: column;
    gap: var(--dcc-s-5);
    color: var(--txt);
    font-size: var(--dcc-fs-md);
    padding-block-end: var(--dcc-s-7);
}

[data-bs-theme="dark"] .htr {
    --tint-acc: rgba(16, 185, 129, .14);
    --tint-acc-2: rgba(16, 185, 129, .30);
    --tint-warm: rgba(249, 115, 22, .14);
    --tint-warm-2: rgba(249, 115, 22, .32);
    --tint-cool: rgba(59, 130, 246, .16);
    --tint-err: rgba(241, 65, 108, .16);
    --tint-pend: rgba(245, 158, 11, .22);
}

.htr .ltr { direction: ltr; unicode-bidi: isolate; }
.htr .muted { color: var(--muted); }

/* ── hero ─────────────────────────────────────────────────────── */
.htr-hero {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--dcc-s-5);
    padding: var(--dcc-s-5) var(--dcc-s-6);
    border: 1px solid var(--line);
    border-radius: var(--dcc-r-xl);
    background: var(--s-1);
    box-shadow: var(--dcc-el-2);
    overflow: hidden;
    isolation: isolate;
}

    .htr-hero::before {
        content: "";
        position: absolute;
        inset: -40% auto auto -10%;
        width: 55%;
        height: 180%;
        background: radial-gradient(closest-side, var(--tint-warm-2), transparent 70%);
        z-index: -1;
        pointer-events: none;
    }

    .htr-hero::after {
        content: "";
        position: absolute;
        inset: auto -8% -60% auto;
        width: 45%;
        height: 160%;
        background: radial-gradient(closest-side, var(--tint-acc-2), transparent 70%);
        z-index: -1;
        pointer-events: none;
    }

.htr-hero-avatar {
    position: relative;
    display: grid;
    place-items: center;
    width: 60px;
    height: 60px;
    border-radius: var(--dcc-r-md);
    font-size: 1.5rem;
    color: #fff;
    background: linear-gradient(140deg, var(--warm), var(--warm-2));
    box-shadow: 0 8px 22px var(--tint-warm-2);
}

.htr-beacon {
    position: absolute;
    inset-block-end: -3px;
    inset-inline-end: -3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--ok);
    border: 3px solid var(--s-1);
}

    .htr-beacon.is-off { background: var(--muted); }

.htr-hero-id { min-width: 0; }

    .htr-hero-id .htr-eyebrow {
        font-size: var(--dcc-fs-xs);
        font-weight: 700;
        letter-spacing: var(--dcc-tracking-caps);
        color: var(--warm);
        text-transform: uppercase;
    }

    .htr-hero-id h1 {
        margin: var(--dcc-s-1) 0 var(--dcc-s-2);
        font-size: var(--dcc-fs-hero);
        font-weight: 800;
        line-height: var(--dcc-lh-tight);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

.htr-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--dcc-s-2) var(--dcc-s-4);
    font-size: var(--dcc-fs-sm);
    color: var(--muted);
}

    .htr-hero-meta span { display: inline-flex; align-items: center; gap: 6px; }

.htr-hero-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--dcc-s-2);
}

.htr-seg-label {
    font-size: var(--dcc-fs-xs);
    font-weight: 700;
    color: var(--muted);
}

/* ── segmented block picker ───────────────────────────────────── */
.htr-seg {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    border-radius: var(--dcc-r-sm);
    background: var(--s-2);
    border: 1px solid var(--line);
}

    .htr-seg button {
        min-width: 44px;
        height: var(--dcc-h-sm);
        padding: 0 var(--dcc-s-3);
        border: 0;
        border-radius: var(--dcc-r-xs);
        background: transparent;
        color: var(--muted);
        font-weight: 800;
        font-size: var(--dcc-fs-sm);
        transition: background var(--dcc-t-base) var(--dcc-e-std), color var(--dcc-t-base) var(--dcc-e-std);
    }

        .htr-seg button:hover { color: var(--txt); }

    .htr-seg.is-block { display: flex; width: 100%; }

        .htr-seg.is-block button { flex: 1; }

        .htr-seg button.is-active {
            background: linear-gradient(135deg, var(--acc), var(--acc-2));
            color: #fff;
            box-shadow: 0 4px 12px var(--tint-acc-2);
        }

/* ── section nav + sub nav ────────────────────────────────────── */
.htr-nav {
    display: flex;
    gap: var(--dcc-s-2);
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: var(--dcc-r-lg);
    background: var(--s-1);
    box-shadow: var(--dcc-el-1);
    overflow-x: auto;
    scrollbar-width: none;
}

    .htr-nav::-webkit-scrollbar { display: none; }

    .htr-nav a {
        flex: 1 0 auto;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: var(--dcc-s-2);
        height: var(--dcc-h-lg);
        padding: 0 var(--dcc-s-5);
        border-radius: var(--dcc-r-md);
        color: var(--muted);
        font-weight: 700;
        white-space: nowrap;
        text-decoration: none;
        transition: background var(--dcc-t-base) var(--dcc-e-std), color var(--dcc-t-base) var(--dcc-e-std);
    }

        .htr-nav a:hover { background: var(--s-2); color: var(--txt); }

        .htr-nav a.is-active {
            background: linear-gradient(135deg, var(--acc), var(--acc-2));
            color: #fff;
            box-shadow: 0 6px 16px var(--tint-acc-2);
        }

.htr-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--dcc-s-2);
}

    .htr-subnav a {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        height: var(--dcc-h-md);
        padding: 0 var(--dcc-s-4);
        border: 1px solid var(--line);
        border-radius: var(--dcc-r-pill);
        background: var(--s-1);
        color: var(--muted);
        font-size: var(--dcc-fs-sm);
        font-weight: 700;
        text-decoration: none;
        transition: all var(--dcc-t-base) var(--dcc-e-std);
    }

        .htr-subnav a:hover { color: var(--acc); border-color: var(--acc); }

        .htr-subnav a.is-active {
            color: var(--acc);
            border-color: var(--acc);
            background: var(--tint-acc);
        }

/* ── page head + cards ────────────────────────────────────────── */
.htr-page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--dcc-s-3);
}

    .htr-page-head h2 {
        margin: 0;
        font-size: var(--dcc-fs-xl);
        font-weight: 800;
    }

    .htr-page-head p {
        margin: var(--dcc-s-1) 0 0;
        color: var(--muted);
        font-size: var(--dcc-fs-sm);
    }

.htr-card {
    border: 1px solid var(--line);
    border-radius: var(--dcc-r-lg);
    background: var(--s-1);
    box-shadow: var(--dcc-el-1);
    overflow: hidden;
}

.htr-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--dcc-s-3);
    padding: var(--dcc-s-4) var(--dcc-s-5);
    border-bottom: 1px solid var(--line);
}

    .htr-card-head h3 {
        display: inline-flex;
        align-items: center;
        gap: var(--dcc-s-2);
        margin: 0;
        font-size: var(--dcc-fs-lg);
        font-weight: 800;
    }

.htr-card-ico {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: var(--dcc-r-xs);
    font-size: .95rem;
    background: var(--tint-acc);
    color: var(--acc);
}

    .htr-card-ico.tone-warning { background: var(--tint-warm); color: var(--warm); }
    .htr-card-ico.tone-danger { background: var(--tint-err); color: var(--err); }
    .htr-card-ico.tone-info { background: var(--tint-cool); color: var(--cool); }

.htr-card-body { padding: var(--dcc-s-5); }

    .htr-card-body.is-flush { padding: 0; }

.htr-note {
    display: flex;
    align-items: center;
    gap: var(--dcc-s-3);
    padding: var(--dcc-s-4) var(--dcc-s-5);
    border-radius: var(--dcc-r-md);
    border: 1px dashed var(--line);
    background: var(--s-2);
    color: var(--muted);
    font-size: var(--dcc-fs-sm);
    line-height: var(--dcc-lh-base);
}

    .htr-note i { color: var(--acc-2); font-size: 1.1rem; }

    .htr-note.is-warn { border-color: var(--pend); background: var(--tint-pend); color: var(--txt); }

        .htr-note.is-warn i { color: var(--pend); }

/* ── grids ────────────────────────────────────────────────────── */
.htr-grid {
    display: grid;
    gap: var(--dcc-s-4);
}

.htr-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.htr-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.htr-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.htr-grid-auto { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.htr-grid-auto-sm { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.htr-split { display: grid; gap: var(--dcc-s-4); grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.htr-span-2 { grid-column: 1 / -1; }
.htr-grid.is-tight, .htr-stack.is-tight { gap: var(--dcc-s-2); }
.htr-hint { color: var(--muted); font-size: var(--dcc-fs-xs); }
.htr-fail-text { color: var(--err); font-weight: 700; }
.htr .is-failed.htr-switch, .htr .is-failed.htr-mode, .htr .is-failed.htr-input, .htr .is-failed.htr-input-group { box-shadow: 0 0 0 2px var(--tint-err); border: 1px solid var(--err); }
.htr-stack { display: flex; flex-direction: column; gap: var(--dcc-s-4); min-width: 0; }
.htr-section-title { margin: var(--dcc-s-2) 0 0; font-size: var(--dcc-fs-lg); font-weight: 800; display: flex; align-items: center; gap: var(--dcc-s-2); }

/* ── stat tile ────────────────────────────────────────────────── */
.htr-tile {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--dcc-s-3);
    padding: var(--dcc-s-4);
    border: 1px solid var(--line);
    border-radius: var(--dcc-r-md);
    background: var(--s-1);
    min-width: 0;
    overflow: hidden;
    transition: transform var(--dcc-t-base) var(--dcc-e-out), box-shadow var(--dcc-t-base) var(--dcc-e-out);
}

    .htr-tile:hover { transform: translateY(-2px); box-shadow: var(--dcc-el-2); }

.htr-tile-ico {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: var(--dcc-r-sm);
    background: var(--tint-acc);
    color: var(--acc);
    font-size: 1.05rem;
}

.htr-tile.tone-warning .htr-tile-ico { background: var(--tint-warm); color: var(--warm); }
.htr-tile.tone-danger .htr-tile-ico { background: var(--tint-err); color: var(--err); }
.htr-tile.tone-info .htr-tile-ico { background: var(--tint-cool); color: var(--cool); }

.htr-tile-body { min-width: 0; flex: 1; }

.htr-tile-label {
    font-size: var(--dcc-fs-xs);
    font-weight: 700;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.htr-tile-value {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-top: 2px;
    font-size: 1.35rem;
    font-weight: 800;
    direction: ltr;
    justify-content: flex-end;
}

[dir="ltr"] .htr-tile-value { justify-content: flex-start; }

    .htr-tile-value small {
        font-size: var(--dcc-fs-xs);
        font-weight: 700;
        color: var(--muted);
    }

.htr-tile-sub {
    margin-top: 2px;
    font-size: var(--dcc-fs-2xs);
    color: var(--muted);
}

.htr-tile.is-faulty { border-style: dashed; }

    .htr-tile.is-faulty .htr-tile-value { color: var(--muted); }

.htr-tile.is-compact { padding: var(--dcc-s-3) var(--dcc-s-4); }

    .htr-tile.is-compact .htr-tile-value { font-size: 1.05rem; }

.htr-highlight {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--dcc-s-3);
    padding: var(--dcc-s-4) var(--dcc-s-5);
    border-radius: var(--dcc-r-md);
    border: 1px solid var(--acc);
    background: var(--tint-acc);
    font-weight: 800;
}

    .htr-highlight .v { font-size: 1.5rem; direction: ltr; }

        .htr-highlight .v small { font-size: var(--dcc-fs-xs); color: var(--muted); }

/* ── status pills / badges ────────────────────────────────────── */
.htr-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 26px;
    padding: 0 10px;
    border-radius: var(--dcc-r-pill);
    font-size: var(--dcc-fs-xs);
    font-weight: 800;
    white-space: nowrap;
    background: var(--s-3);
    color: var(--muted);
}

    .htr-pill::before {
        content: "";
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: currentColor;
    }

    .htr-pill.is-ok { background: var(--tint-acc); color: var(--acc); }
    .htr-pill.is-err { background: var(--tint-err); color: var(--err); }
    .htr-pill.is-warn { background: var(--tint-pend); color: #b45309; }
    .htr-pill.is-info { background: var(--tint-cool); color: var(--cool); }

[data-bs-theme="dark"] .htr-pill.is-warn { color: var(--pend); }

.htr-mode {
    display: inline-grid;
    place-items: center;
    min-width: 40px;
    height: 34px;
    border-radius: var(--dcc-r-xs);
    border: 1px solid transparent;
    font-weight: 900;
    font-size: 1rem;
    background: var(--tint-cool);
    color: var(--cool);
    cursor: pointer;
    transition: all var(--dcc-t-base) var(--dcc-e-std);
}

    .htr-mode.is-manual { background: var(--tint-warm); color: var(--warm); }
    .htr-mode:disabled { opacity: .55; cursor: not-allowed; }

/* ── switch ───────────────────────────────────────────────────── */
.htr-switch {
    position: relative;
    display: inline-block;
    flex: 0 0 auto;
    width: 46px;
    height: 26px;
    border: 0;
    padding: 0;
    border-radius: var(--dcc-r-pill);
    background: var(--s-3);
    cursor: pointer;
    transition: background var(--dcc-t-base) var(--dcc-e-std);
}

    .htr-switch::after {
        content: "";
        position: absolute;
        top: 3px;
        inset-inline-start: 3px;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
        transition: inset-inline-start var(--dcc-t-base) var(--dcc-e-spring);
    }

    .htr-switch.is-on { background: var(--acc); }

        .htr-switch.is-on::after { inset-inline-start: 23px; }

    .htr-switch:disabled { opacity: .5; cursor: not-allowed; }

/* ── pending / failed states (shared) ─────────────────────────── */
.htr .is-pending {
    background: var(--tint-pend) !important;
    border-color: var(--pend) !important;
}

    .htr .is-pending .htr-pend-ico { display: inline-flex; }

.htr .is-failed { border-color: var(--err) !important; }

.htr-pend-ico {
    display: none;
    align-items: center;
    gap: 4px;
    font-size: var(--dcc-fs-2xs);
    font-weight: 700;
    color: #b45309;
}

    .htr-pend-ico i { animation: htr-spin 1s linear infinite; }

[data-bs-theme="dark"] .htr-pend-ico { color: var(--pend); }

/* ── temperature stepper ──────────────────────────────────────── */
.htr-stepper-card {
    display: flex;
    flex-direction: column;
    gap: var(--dcc-s-3);
    padding: var(--dcc-s-4);
    border: 1px solid var(--line);
    border-radius: var(--dcc-r-md);
    background: var(--s-1);
    transition: background var(--dcc-t-base) var(--dcc-e-std), border-color var(--dcc-t-base) var(--dcc-e-std);
}

.htr-stepper-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--dcc-s-2);
    font-weight: 800;
}

.htr-stepper {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: var(--dcc-s-2);
    direction: ltr;
}

    .htr-stepper button {
        height: var(--dcc-h-lg);
        border: 0;
        border-radius: var(--dcc-r-sm);
        font-size: .95rem;
        cursor: pointer;
        transition: transform var(--dcc-t-instant) var(--dcc-e-std), filter var(--dcc-t-base);
    }

        .htr-stepper button:active { transform: scale(.94); }
        .htr-stepper button.is-down { background: var(--tint-cool); color: var(--cool); }
        .htr-stepper button.is-up { background: var(--tint-warm); color: var(--warm); }
        .htr-stepper button:disabled { opacity: .45; cursor: not-allowed; }

    .htr-stepper input {
        width: 100%;
        height: var(--dcc-h-lg);
        border: 1px solid var(--line);
        border-radius: var(--dcc-r-sm);
        background: var(--s-2);
        color: var(--txt);
        text-align: center;
        font-size: 1.15rem;
        font-weight: 800;
        outline: none;
    }

        .htr-stepper input:focus { border-color: var(--acc); box-shadow: 0 0 0 3px var(--tint-acc); }

.htr-stepper-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--dcc-s-2);
    font-size: var(--dcc-fs-2xs);
    color: var(--muted);
}

.htr-apply {
    border: 0;
    border-radius: var(--dcc-r-xs);
    padding: 4px 10px;
    font-size: var(--dcc-fs-xs);
    font-weight: 800;
    background: var(--acc);
    color: #fff;
}

    .htr-apply:disabled { opacity: .4; }

/* ── overview table (8 rows) ──────────────────────────────────── */
.htr-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

    .htr-table th {
        padding: var(--dcc-s-3);
        font-size: var(--dcc-fs-xs);
        font-weight: 800;
        color: var(--muted);
        text-align: center;
        background: var(--s-2);
        border-bottom: 1px solid var(--line);
        white-space: nowrap;
    }

    .htr-table td {
        padding: var(--dcc-s-3);
        text-align: center;
        border-bottom: 1px solid var(--line);
        vertical-align: middle;
    }

    .htr-table tr:last-child td { border-bottom: 0; }

    .htr-table tr.is-off td { opacity: .55; }

.htr-unit-name {
    display: flex;
    align-items: center;
    gap: var(--dcc-s-3);
    font-weight: 800;
    white-space: nowrap;
}

.htr-unit-badge {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: var(--dcc-r-xs);
    background: var(--s-3);
    font-weight: 900;
    font-size: var(--dcc-fs-sm);
}

.htr-temp {
    font-weight: 800;
    direction: ltr;
    white-space: nowrap;
}

    .htr-temp small { color: var(--muted); font-weight: 700; margin-inline-start: 2px; }

.htr-device {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    border-radius: var(--dcc-r-sm);
    border: 1px solid var(--line);
    background: var(--s-2);
    color: var(--muted);
    font-weight: 800;
    font-size: var(--dcc-fs-xs);
    transition: all var(--dcc-t-base) var(--dcc-e-std);
}

    .htr-device.is-on.kind-heater { background: var(--tint-warm); border-color: var(--warm); color: var(--warm); }
    .htr-device.is-on.kind-fan { background: var(--tint-cool); border-color: var(--cool); color: var(--cool); }
    .htr-device.is-on.kind-fan i { animation: htr-spin 1.2s linear infinite; }
    .htr-device:not(:disabled) { cursor: pointer; }
    .htr-device:disabled { cursor: default; }

@media (max-width: 991.98px) {
    .htr-table thead { display: none; }

    .htr-table, .htr-table tbody, .htr-table tr, .htr-table td { display: block; width: 100%; }

        .htr-table tr {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: var(--dcc-s-2);
            margin: var(--dcc-s-3);
            width: auto;
            padding: var(--dcc-s-3);
            border: 1px solid var(--line);
            border-radius: var(--dcc-r-md);
        }

        .htr-table td {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 6px;
            border: 0;
            border-radius: var(--dcc-r-sm);
            background: var(--s-2);
        }

            .htr-table td::before {
                content: attr(data-label);
                font-size: var(--dcc-fs-2xs);
                font-weight: 700;
                color: var(--muted);
            }

            .htr-table td.is-head { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; background: transparent; }

                .htr-table td.is-head::before { display: none; }
}

/* ── sensor matrix ────────────────────────────────────────────── */
.htr-matrix-wrap { overflow-x: auto; }

.htr-matrix {
    width: 100%;
    min-width: 760px;
    border-collapse: separate;
    border-spacing: 0;
}

    .htr-matrix th, .htr-matrix td {
        padding: var(--dcc-s-2) var(--dcc-s-3);
        border-bottom: 1px solid var(--line);
        text-align: center;
    }

    .htr-matrix th {
        background: var(--s-2);
        font-size: var(--dcc-fs-xs);
        color: var(--muted);
        font-weight: 800;
    }

    .htr-matrix th.is-start { text-align: start; }
    .htr-matrix tbody th { background: transparent; color: var(--txt); font-size: inherit; }
    .htr-matrix tr.is-off { opacity: .5; }

.htr-sensor-head { display: flex; flex-direction: column; align-items: center; gap: 4px; }

    .htr-sensor-head .htr-temp { font-size: var(--dcc-fs-sm); color: var(--txt); }

.htr-dot-btn {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px dashed var(--line);
    background: transparent;
    color: transparent;
    cursor: pointer;
    transition: all var(--dcc-t-base) var(--dcc-e-spring);
}

    .htr-dot-btn:hover { border-color: var(--acc); }

    .htr-dot-btn.is-on {
        border: 0;
        background: linear-gradient(135deg, var(--acc), var(--acc-2));
        color: #fff;
        box-shadow: 0 4px 12px var(--tint-acc-2);
    }

    .htr-dot-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── 24h schedule ─────────────────────────────────────────────── */
.htr-sched-band {
    display: grid;
    grid-template-columns: repeat(24, minmax(0, 1fr));
    align-items: end;
    gap: 4px;
    height: 120px;
    padding: var(--dcc-s-3) var(--dcc-s-4) 0;
}

.htr-sched-band.is-compact { height: 80px; }

.htr-sched-bar {
    position: relative;
    border-radius: 6px 6px 0 0;
    background: linear-gradient(180deg, var(--warm), var(--acc-2));
    opacity: .85;
    min-height: 6px;
    transition: height var(--dcc-t-slow) var(--dcc-e-out);
}

    .htr-sched-bar.is-now { opacity: 1; box-shadow: 0 0 0 2px var(--s-1), 0 0 0 4px var(--warm); }

.htr-sched-axis {
    display: grid;
    grid-template-columns: repeat(24, minmax(0, 1fr));
    gap: 4px;
    padding: 4px var(--dcc-s-4) var(--dcc-s-3);
    font-size: 10px;
    color: var(--muted);
    text-align: center;
    direction: ltr;
}

.htr-sched-row {
    display: grid;
    grid-template-columns: 70px minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--dcc-s-3);
    padding: var(--dcc-s-2) var(--dcc-s-4);
    border-bottom: 1px solid var(--line);
    transition: background var(--dcc-t-base);
}

    .htr-sched-row:last-child { border-bottom: 0; }

    .htr-sched-row.is-now { background: var(--tint-warm); }

    .htr-sched-row .htr-hour {
        font-weight: 800;
        direction: ltr;
        font-variant-numeric: tabular-nums;
    }

    .htr-sched-row .htr-stepper { grid-template-columns: 36px minmax(0, 1fr) 36px; }

        .htr-sched-row .htr-stepper button, .htr-sched-row .htr-stepper input { height: var(--dcc-h-md); }

.htr-sched-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(12, auto); grid-auto-flow: column; }

    .htr-sched-list .htr-sched-row:nth-child(12) { border-bottom: 0; }
    .htr-sched-list .htr-sched-row:nth-child(n+13) { border-inline-start: 1px solid var(--line); }

@media (max-width: 991.98px) {
    .htr-sched-list { grid-template-columns: 1fr; grid-template-rows: none; grid-auto-flow: row; }

        .htr-sched-list .htr-sched-row:nth-child(12) { border-bottom: 1px solid var(--line); }
        .htr-sched-list .htr-sched-row:nth-child(n+13) { border-inline-start: 0; }
}

.htr-dot-btn.is-pending { color: var(--pend); }

.htr-detail-link {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: var(--dcc-r-sm);
    background: var(--s-2);
    color: var(--muted);
    transition: all var(--dcc-t-base);
}

    .htr-detail-link:hover { background: var(--tint-acc); color: var(--acc); }

[dir="rtl"] .htr-detail-link i { transform: scaleX(-1); }

/* ── hold-to-confirm ──────────────────────────────────────────── */
.htr-hold {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: var(--dcc-h-lg);
    border: 1px solid var(--line);
    border-radius: var(--dcc-r-sm);
    background: var(--s-2);
    color: var(--txt);
    font-weight: 800;
    font-size: var(--dcc-fs-sm);
    user-select: none;
    touch-action: none;
    cursor: pointer;
}

    .htr-hold.is-danger { border-color: var(--err); color: var(--err); background: var(--tint-err); }

    .htr-hold .htr-hold-fill {
        position: absolute;
        inset-block: 0;
        inset-inline-start: 0;
        width: 0;
        background: var(--tint-err);
        z-index: 0;
    }

    .htr-hold.is-holding .htr-hold-fill { width: 100%; transition: width 5s linear; background: rgba(241, 65, 108, .28); }

    .htr-hold.is-done { border-color: var(--acc); color: var(--acc); background: var(--tint-acc); }

    .htr-hold span { position: relative; z-index: 1; }

/* ── rows / lists ─────────────────────────────────────────────── */
.htr-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--dcc-s-3);
    padding: var(--dcc-s-3) var(--dcc-s-4);
    border: 1px solid var(--line);
    border-radius: var(--dcc-r-sm);
    background: var(--s-1);
    transition: background var(--dcc-t-base), border-color var(--dcc-t-base);
}

    .htr-row .htr-row-title { font-weight: 800; min-width: 0; }

    .htr-row .htr-row-sub { font-size: var(--dcc-fs-2xs); color: var(--muted); }

    .htr-row.is-disabled { background: var(--s-2); }

        .htr-row.is-disabled .htr-row-title { color: var(--muted); text-decoration: line-through; }

.htr-input {
    height: var(--dcc-h-md);
    width: 96px;
    border: 1px solid var(--line);
    border-radius: var(--dcc-r-xs);
    background: var(--s-2);
    color: var(--txt);
    text-align: center;
    font-weight: 800;
    direction: ltr;
    outline: none;
}

    .htr-input:focus { border-color: var(--acc); box-shadow: 0 0 0 3px var(--tint-acc); }

    .htr-input.is-wide { width: 100%; }

.htr-input-group {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: var(--dcc-r-xs);
    overflow: hidden;
    direction: ltr;
}

    .htr-input-group .htr-input { border: 0; border-radius: 0; }

    .htr-input-group span {
        padding: 0 10px;
        font-size: var(--dcc-fs-xs);
        font-weight: 700;
        color: var(--muted);
        background: var(--s-3);
        align-self: stretch;
        display: grid;
        place-items: center;
    }

/* ── errors ───────────────────────────────────────────────────── */
.htr-err-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--dcc-s-3);
    padding: var(--dcc-s-4);
    border: 1px solid var(--line);
    border-radius: var(--dcc-r-md);
    background: var(--s-1);
    overflow: hidden;
}

    .htr-err-card::before {
        content: "";
        position: absolute;
        inset-block: 0;
        inset-inline-start: 0;
        width: 4px;
        background: var(--acc);
    }

    .htr-err-card.is-active { background: var(--tint-err); border-color: var(--err); }

        .htr-err-card.is-active::before { background: var(--err); }

    .htr-err-card.is-disabled::before { background: var(--muted); }

    .htr-err-card.is-disabled { opacity: .7; }

.htr-counter {
    display: flex;
    align-items: center;
    gap: var(--dcc-s-4);
}

    .htr-counter .n {
        display: grid;
        place-items: center;
        min-width: 72px;
        height: 72px;
        border-radius: var(--dcc-r-md);
        font-size: 2rem;
        font-weight: 900;
        background: var(--tint-acc);
        color: var(--acc);
    }

        .htr-counter .n.is-err { background: var(--tint-err); color: var(--err); }
        .htr-counter .n i { font-size: 1.6rem; }

.htr-err-ico.is-active { color: var(--err); }
.htr-err-ico.is-ok { color: var(--acc); }
.htr-err-ico.is-off { color: var(--muted); }

.htr-check {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-radius: var(--dcc-r-sm);
    border: 1px solid var(--line);
    font-size: 1rem;
    cursor: pointer;
    background: var(--s-2);
    color: var(--muted);
    transition: all var(--dcc-t-base) var(--dcc-e-spring);
}

    .htr-check.is-on { background: var(--tint-acc); border-color: var(--acc); color: var(--acc); }
    .htr-check.is-off { background: var(--tint-err); border-color: var(--err); color: var(--err); }

/* ── advanced: outputs / inputs / clock ───────────────────────── */
.htr-board-title {
    font-weight: 800;
    font-size: var(--dcc-fs-md);
    margin-bottom: var(--dcc-s-3);
    display: flex;
    align-items: center;
    gap: var(--dcc-s-2);
}

.htr-code-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    gap: var(--dcc-s-2);
    direction: ltr;
}

.htr-code {
    display: flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: var(--dcc-r-xs);
    overflow: hidden;
    background: var(--s-1);
}

    .htr-code label {
        min-width: 46px;
        padding: 0 8px;
        align-self: stretch;
        display: grid;
        place-items: center;
        background: var(--s-3);
        font-weight: 800;
        font-size: var(--dcc-fs-xs);
        font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
        color: var(--muted);
    }

    .htr-code input {
        width: 100%;
        min-width: 0;
        height: 34px;
        border: 0;
        background: transparent;
        color: var(--txt);
        text-align: center;
        font-weight: 800;
        outline: none;
    }

.htr-code-grid.is-wide { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.htr-code-cell { gap: 4px; }
.htr-code-hint { min-height: 1em; font-size: var(--dcc-fs-2xs); color: var(--muted); direction: ltr; text-align: start; }
.htr-code.is-compact { direction: ltr; }
.htr-code.is-compact label { min-width: auto; }
.htr-code.is-compact input { width: 56px; }
.htr-chan-list { display: flex; flex-wrap: wrap; align-items: center; gap: var(--dcc-s-2); min-width: 0; }
.htr-cal-table th.is-name { font-weight: 700; color: var(--txt); background: transparent; font-size: inherit; padding: var(--dcc-s-2) var(--dcc-s-4); border-top: 1px solid var(--line); }

.htr-ref-table {
    width: 100%;
    border-collapse: collapse;
    direction: ltr;
    font-size: var(--dcc-fs-xs);
}

    .htr-ref-table td {
        padding: 6px 8px;
        border: 1px solid var(--line);
    }

        .htr-ref-table td.code {
            width: 44px;
            text-align: center;
            font-weight: 900;
            color: var(--acc);
            background: var(--tint-acc);
        }

.htr-clock {
    display: grid;
    place-items: center;
    gap: 6px;
    padding: var(--dcc-s-5);
    border-radius: var(--dcc-r-md);
    background: linear-gradient(135deg, var(--tint-acc), var(--tint-cool));
    text-align: center;
}

    .htr-clock .t {
        font-size: 2rem;
        font-weight: 900;
        letter-spacing: .06em;
        direction: ltr;
        font-variant-numeric: tabular-nums;
        font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    }

.htr-field-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--dcc-s-2);
}

    .htr-field-row label {
        display: block;
        margin-bottom: 4px;
        font-size: var(--dcc-fs-2xs);
        font-weight: 700;
        color: var(--muted);
    }

.htr-cal-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

    .htr-cal-table th {
        padding: var(--dcc-s-2) var(--dcc-s-4);
        font-size: var(--dcc-fs-2xs);
        font-weight: 800;
        color: var(--muted);
        background: var(--s-2);
        text-align: start;
    }

    .htr-cal-table td {
        padding: var(--dcc-s-2) var(--dcc-s-4);
        border-top: 1px solid var(--line);
    }

.htr-reading {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    padding: 6px 10px;
    border-radius: var(--dcc-r-xs);
    background: var(--tint-cool);
    color: var(--cool);
    font-weight: 800;
    direction: ltr;
    white-space: nowrap;
}

    .htr-reading small { font-size: 10px; opacity: .8; }

/* ── landing: schematic ───────────────────────────────────────── */
.htr-schematic {
    position: relative;
    padding: var(--dcc-s-5);
    border-radius: var(--dcc-r-xl);
    border: 1px solid var(--line);
    background:
        radial-gradient(ellipse at 20% 0%, var(--tint-warm), transparent 60%),
        radial-gradient(ellipse at 90% 100%, var(--tint-acc), transparent 55%),
        var(--s-1);
    box-shadow: var(--dcc-el-2);
    overflow: hidden;
}

    .htr-schematic svg { display: block; width: 100%; height: auto; }

.htr-sch-house { fill: var(--s-2); stroke: var(--line); stroke-width: 2; }
.htr-sch-roof { fill: none; stroke: var(--muted); stroke-width: 2; opacity: .5; stroke-dasharray: 3 8; }
.htr-sch-sun { fill: #fbbf24; }
.htr-sch-ray { stroke: #fbbf24; stroke-width: 3; stroke-linecap: round; }
.htr-sch-fan-ring { fill: none; stroke: var(--txt); stroke-opacity: .15; }
.htr-sch-err-mark { fill: #fff; font-size: 12px; font-weight: 900; text-anchor: middle; opacity: 0; }
.htr-sch-unit.is-err .htr-sch-err-mark { opacity: 1; }
.htr-sch-temp.is-sm { font-size: 11px; }
.htr-sch-label.is-xs { font-size: 10px; }
.htr-sch-sensors g:nth-child(2) .htr-sch-sensor-ring { animation-delay: .35s; }
.htr-sch-sensors g:nth-child(3) .htr-sch-sensor-ring { animation-delay: .7s; }
.htr-sch-sensors g:nth-child(4) .htr-sch-sensor-ring { animation-delay: 1.05s; }
.htr-sch-sensors g:nth-child(5) .htr-sch-sensor-ring { animation-delay: 1.4s; }
.htr-sch-sensors g:nth-child(6) .htr-sch-sensor-ring { animation-delay: 1.75s; }
.htr-sch-floor { stroke: var(--line); stroke-width: 3; }
.htr-sch-duct { stroke: var(--s-3); stroke-width: 10; stroke-linecap: round; }
.htr-sch-body { fill: var(--s-1); stroke: var(--line); stroke-width: 2; }
.htr-sch-unit.is-heat .htr-sch-body { stroke: var(--warm); }
.htr-sch-unit.is-err .htr-sch-body { stroke: var(--err); fill: var(--tint-err); }
.htr-sch-unit.is-off { opacity: .35; }
.htr-sch-label { fill: var(--muted); font-size: 12px; font-weight: 800; text-anchor: middle; }
.htr-sch-temp { fill: var(--txt); font-size: 13px; font-weight: 800; text-anchor: middle; direction: ltr; }
.htr-sch-flame { fill: var(--warm); transform-box: fill-box; transform-origin: 50% 100%; opacity: 0; }
.htr-sch-unit.is-heat .htr-sch-flame { opacity: 1; animation: htr-flicker 1.1s ease-in-out infinite alternate; }
.htr-sch-flame-core { fill: #fde047; }
.htr-sch-fan { fill: var(--muted); transform-box: fill-box; transform-origin: center; }
.htr-sch-unit.is-fan .htr-sch-fan { fill: var(--cool); animation: htr-spin 1.2s linear infinite; }
.htr-sch-air { stroke: var(--cool); stroke-width: 2; fill: none; stroke-dasharray: 4 6; opacity: 0; }
.htr-sch-unit.is-fan .htr-sch-air { opacity: .7; animation: htr-dash 1s linear infinite; }
.htr-sch-err { fill: var(--err); opacity: 0; }
.htr-sch-unit.is-err .htr-sch-err { opacity: 1; }
.htr-sch-sensor { fill: var(--acc); }
.htr-sch-sensor-ring { fill: none; stroke: var(--acc); stroke-width: 2; opacity: .5; transform-box: fill-box; transform-origin: center; animation: htr-pulse 2.4s ease-out infinite; }

.htr-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--dcc-s-2) var(--dcc-s-4);
    margin-top: var(--dcc-s-3);
    font-size: var(--dcc-fs-xs);
    color: var(--muted);
}

    .htr-legend span { display: inline-flex; align-items: center; gap: 6px; }

    .htr-legend i.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
    .htr-legend i.sw.is-heat { background: var(--warm); }
    .htr-legend i.sw.is-fan { background: var(--cool); }
    .htr-legend i.sw.is-err { background: var(--err); }
    .htr-legend i.sw.is-off { background: var(--muted); opacity: .4; }
    .htr-legend i.sw.is-sensor { background: var(--acc); border-radius: 50%; }

.htr-shortcut {
    display: flex;
    align-items: center;
    gap: var(--dcc-s-3);
    padding: var(--dcc-s-4);
    border: 1px solid var(--line);
    border-radius: var(--dcc-r-md);
    background: var(--s-1);
    color: var(--txt);
    text-decoration: none;
    transition: all var(--dcc-t-base) var(--dcc-e-out);
}

    .htr-shortcut:hover { border-color: var(--acc); transform: translateY(-2px); box-shadow: var(--dcc-el-2); color: var(--txt); }

    .htr-shortcut.is-sm { padding: 6px 14px; }

    .htr-shortcut .t { font-weight: 800; }

    .htr-shortcut .d { font-size: var(--dcc-fs-2xs); color: var(--muted); }

    .htr-shortcut .go { margin-inline-start: auto; color: var(--muted); }

[dir="rtl"] .htr-shortcut .go { transform: scaleX(-1); }

.htr-mode-card {
    display: flex;
    align-items: center;
    gap: var(--dcc-s-4);
    padding: var(--dcc-s-4) var(--dcc-s-5);
}

    .htr-mode-card.is-bare { padding: 0 0 var(--dcc-s-3); }

    .htr-mode-card .big {
        font-size: 1.1rem;
        font-weight: 800;
    }

/* ── motion ───────────────────────────────────────────────────── */
@keyframes htr-spin { to { transform: rotate(360deg); } }
@keyframes htr-flicker { 0% { transform: scaleY(.85) scaleX(1.05); } 100% { transform: scaleY(1.12) scaleX(.94); } }
@keyframes htr-dash { to { stroke-dashoffset: -20; } }
@keyframes htr-pulse { 0% { transform: scale(.6); opacity: .7; } 100% { transform: scale(2.2); opacity: 0; } }

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

/* ── responsive ───────────────────────────────────────────────── */
@media (max-width: 1199.98px) {
    .htr-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .htr-split { grid-template-columns: 1fr; }
}

@media (max-width: 991.98px) {
    .htr-grid-3 { grid-template-columns: 1fr; }
    .htr-hero { grid-template-columns: auto minmax(0, 1fr); }
    .htr-hero-side { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; }
}

@media (max-width: 767.98px) {
    .htr-grid-2 { grid-template-columns: 1fr; }
    .htr-hero { padding: var(--dcc-s-4); gap: var(--dcc-s-3); }
    .htr-hero-avatar { width: 48px; height: 48px; font-size: 1.2rem; }
    .htr-nav a { padding: 0 var(--dcc-s-3); }
    .htr-field-row { grid-template-columns: 1fr 1fr 1fr; }
    .htr-sched-band { height: 80px; }
    .htr-sched-axis span:nth-child(odd) { visibility: hidden; }
}

@media (max-width: 575.98px) {
    .htr-grid-4 { grid-template-columns: 1fr 1fr; }
    .htr-card-body { padding: var(--dcc-s-4); }
}
