/* Permanent owner: Tado X rooms, controls, gas feedback, and responsive presentation. */

/* ── Tado X integration ──────────────────────────────────────────
   Device-code setup surface (desktop modal + mobile sheet) +
   per-room badges used by the Tado page. Kept together so any visual
   tweak lives in one block. */
.tado-setup {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: flex-start;
    padding: 4px 0;
}
.tado-setup p {
    margin: 0;
    color: var(--color-text-soft);
    line-height: 1.45;
}
.tado-code {
    font-family: var(--font-display);
    font-size: 2.1rem;
    font-weight: 600;
    letter-spacing: 0.22em;
    padding: 12px 20px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--color-text);
    align-self: center;
    text-align: center;
    max-width: 100%;
    overflow-wrap: anywhere;
    /* Allow copy/paste of the code for users on a second device. */
    user-select: all;
}
.tado-setup-meta {
    color: var(--color-text-muted);
    font-size: 0.85rem;
}
.tado-setup-success {
    color: var(--color-success-text);
    font-weight: 600;
    font-size: 1.05rem;
}
.mobile-tado-setup .tado-code {
    font-size: 1.7rem;
    letter-spacing: 0.18em;
    padding: 10px 16px;
}

/* Small inline badge that flags Tado "open window detected" next to a
   room name. Stays legible on both the room row (mobile) and the
   device-card header (desktop). */
.tado-room-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    /* Opacity bumped from 0.18 → 0.30 + brighter foreground so the "Raam open"
       chip passes WCAG AA on the dark surface. */
    background: rgba(var(--color-info-light-rgb), 0.30);
    color: var(--color-info, #9ec3fc);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    vertical-align: middle;
}

/* Quick-actions row on the mobile Tado multi-room view. Parity with
   climate-device-block spacing so the two pages feel the same. */
.comfort-quick-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 8px 0 4px;
}

/* Optional desktop hero action row used by Tado.js. */
.hero-actions {
    margin-top: 12px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ─── Tado gas card (Tado-tab heating-gas feedback strip) ───────────────────
   Slotted between the hero and the rooms list. Restrained: matches the
   editorial chrome (eyebrow + Geist label + Geist Mono numerics) so it
   reads as a continuation of the Tado page, not a foreign module. The
   `--gas` accent (warm flame) marks this as a different data class than
   Tado's coral hero without breaking the design system. */

.tado-gas-card {
    --gas: var(--color-gas);
    --gas-soft: color-mix(in srgb, var(--gas) 18%, transparent);
    margin: 0 0 24px;
    padding: 18px 20px;
    border-radius: 14px;
    background: var(--color-card);
    border: 1px solid var(--color-line);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: end;
}

.tado-gas-card-eyebrow {
    grid-column: 1 / -1;
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tado-gas-card-eyebrow::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gas);
    box-shadow: 0 0 8px var(--gas);
    flex: none;
}

.tado-gas-card-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.tado-gas-card-num {
    font-family: var(--font-mono);
    font-size: 56px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0;
    color: var(--color-text);
}

.tado-gas-card-num .unit {
    font-size: 22px;
    font-weight: 500;
    margin-left: 6px;
    color: var(--color-text-muted);
}

.tado-gas-card-delta {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-soft);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tado-gas-card-delta--down { color: var(--color-success-text, #16a34a); }
.tado-gas-card-delta--up   { color: var(--gas); }
.tado-gas-card-delta--flat { color: var(--color-text-muted); }

.tado-gas-card-footnote {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 400;
    color: var(--color-text-muted);
    opacity: 0.8;
    margin-top: 2px;
}

/* Right-side: SVG sparkline + day-of-week labels */
.tado-gas-card-chart {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    flex: none;
}

/* SVG-based 7-day bars. preserveAspectRatio="none" lets the bars stretch to
   the card width without recomputing geometry on resize. */
.tado-gas-card-bars {
    display: block;
    width: 168px;
    height: 64px;
}

.tado-gas-card-bar {
    fill: var(--gas-soft);
    transition: fill 200ms ease;
}

.tado-gas-card-bar--today {
    fill: var(--gas);
    /* SVG drop-shadow approximates the box-shadow glow; CSP-safe. */
    filter: drop-shadow(0 0 4px color-mix(in srgb, var(--gas) 50%, transparent));
}

.tado-gas-card-bar--empty {
    fill: color-mix(in srgb, var(--color-line) 60%, transparent);
}

.tado-gas-card-day-labels {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    column-gap: 6px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: lowercase;
    color: var(--color-text-muted);
}

.tado-gas-card-day-labels span[data-today="true"] {
    color: var(--gas);
    font-weight: 700;
}

.tado-gas-card--empty {
    grid-template-columns: 1fr;
    text-align: center;
}

.tado-gas-card--empty .tado-gas-card-empty-msg {
    font-family: var(--font-display);
    font-size: 13px;
    color: var(--color-text-muted);
    padding: 20px 0 8px;
}

/* ─── End Tado gas card ─── */

.tado-holiday-banner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 16px 18px;
    border: 1px solid rgba(var(--color-solar-rgb), 0.45);
    border-radius: 10px;
    background:
        linear-gradient(135deg, rgba(var(--color-solar-rgb), 0.18), rgba(var(--color-solar-rgb), 0.06)),
        var(--color-bg-soft);
    /* amber accent comes from the tint/border; text stays full-contrast
       (solar-text on this 18% amber tint is only ~3.8:1 in light). */
    color: var(--color-text);
    box-shadow: 0 14px 34px rgba(var(--color-solar-rgb), 0.12);
}

.tado-holiday-banner--below-hero {
    margin: -8px 0 24px;
}

.tado-holiday-banner--mobile {
    margin: 0 0 12px;
}

.tado-holiday-banner-label {
    font-family: var(--font-display);
    font-size: clamp(1.16rem, 0.5vw + 1.02rem, 1.4rem);
    font-weight: 800;
    line-height: 1.15;
}

.tado-holiday-banner-value {
    justify-self: end;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(var(--color-solar-rgb), 0.14);
    font-size: 0.88rem;
    font-weight: 800;
    white-space: nowrap;
}

.tado-room-card {
    --metric-accent: var(--color-tado);
    --metric-accent-soft: var(--color-tado-soft);
    border-color: color-mix(in srgb, var(--color-tado) 14%, var(--color-line));
}

.tado-room-card--heating {
    box-shadow: 0 0 0 1px rgba(var(--color-tado-rgb), 0.16), var(--shadow-card);
}

.tado-room-card--off {
    opacity: 0.84;
}

.tado-room-card .device-metric-value {
    letter-spacing: 0;
    overflow-wrap: anywhere;
}

.tado-room-heading {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.tado-room-subtitle {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    color: var(--color-text-muted);
    font-size: 0.86rem;
    font-weight: 700;
}

.tado-room-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-line-strong);
    box-shadow: 0 0 0 5px var(--color-bg-soft);
}

.tado-room-dot--active {
    background: var(--color-info);
}

.tado-room-dot--heating {
    background: var(--color-tado);
    box-shadow: 0 0 0 5px rgba(var(--color-tado-rgb), 0.12);
}

.tado-power-toggle {
    min-width: 74px;
    height: 40px;
    border: 1px solid var(--color-line);
    border-radius: 999px;
    background: var(--color-bg-soft);
    color: var(--color-text-muted);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 800;
    cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.tado-power-toggle--on {
    background: var(--color-tado);
    border-color: var(--color-tado);
    color: var(--color-on-accent);
}

.tado-room-controls {
    grid-template-columns: minmax(280px, 1fr) minmax(260px, 0.8fr);
    align-items: start;
}

.tado-temp-panel {
    min-height: 96px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--color-line);
    border-radius: 8px;
    background: var(--color-bg-soft);
}

.tado-temp-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
    color: var(--color-text-muted);
    font-size: 0.84rem;
    line-height: 1.35;
}

.tado-temp-state {
    color: var(--color-text);
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
}

.tado-temp-stepper {
    display: grid;
    grid-template-columns: 38px 66px 38px;
    align-items: center;
    border: 1px solid var(--color-line);
    border-radius: 999px;
    background: var(--color-bg);
    overflow: hidden;
}

.tado-step-btn {
    /* Tap target raised 38→52px (2026-05-12) — primary comfort control on
       the most-touched surface, below WCAG 2.5.5 AA (44px) and the AuDHD
       64px floor at 38px. 52px keeps the stepper visually compact while
       clearing AA + matching the +/- buttons on other comfort vendor pages. */
    width: 52px;
    height: 52px;
    border: 0;
    background: transparent;
    color: var(--color-text);
    font: inherit;
    font-size: 1.25rem;
    font-weight: 800;
    cursor: pointer;
}

.tado-step-btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.tado-step-value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 66px;
    height: 38px;
    border-inline: 1px solid var(--color-line);
    color: var(--color-text);
    font-family: var(--font-display);
    font-size: 0.92rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.tado-mode-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tado-mode-buttons .comfort-mode-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    margin: 0;
    padding: 0 13px;
    border: 1px solid var(--color-line);
    border-radius: 999px;
    background: var(--color-bg-soft);
    color: var(--color-text-soft);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.tado-mode-buttons .comfort-mode-pill--active {
    border-color: rgba(var(--color-tado-rgb), 0.4);
    background: var(--color-tado-soft);
    color: var(--color-tado);
}

.tado-mode-buttons .comfort-mode-pill:disabled {
    cursor: not-allowed;
    opacity: 0.42;
}

@media (max-width: 900px) {
    .tado-room-controls {
        grid-template-columns: 1fr;
    }

    /* Stack the gas card on narrow screens — number above, chart below.
       Stays restrained: the bars get full width but height is pinned so the
       card doesn't dominate the page above the rooms list. */
    /* Mobile editorial chrome aligns content to 18px gutters; the gas card
       sits between the hero and a section-header so we match that gutter. */
    .tado-gas-card {
        grid-template-columns: 1fr;
        gap: 14px;
        align-items: stretch;
        margin: 0 18px 16px;
        padding: 16px 18px;
    }

    .tado-gas-card-num {
        font-size: 44px;
    }

    .tado-gas-card-num .unit {
        font-size: 18px;
    }

    .tado-gas-card-bars,
    .tado-gas-card-day-labels {
        width: 100%;
    }

    .tado-gas-card-bars {
        height: 56px;
    }

    .tado-holiday-banner {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .tado-holiday-banner-value {
        justify-self: start;
    }

    .tado-temp-panel {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .tado-temp-stepper {
        width: max-content;
    }
}

/* ── Tado compact room list (desktop only, >1100px) ──────────────── */
.tado-room-list {
    margin-bottom: 32px;
    border: 1px solid var(--color-line);
    border-radius: 16px;
    overflow: hidden;
}

.tado-room-list-header {
    display: grid;
    grid-template-columns: 20px minmax(140px, 220px) 120px 150px 1fr 82px 24px;
    gap: 16px;
    align-items: center;
    padding: 8px 20px;
    border-bottom: 1px solid var(--color-line);
    background: var(--color-bg-soft);
    color: var(--color-text-muted);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.tado-room-row {
    border-bottom: 1px solid var(--color-line);
    display: grid;
    grid-template-columns: minmax(0, 1fr) 82px 24px;
    column-gap: 16px;
    align-items: center;
}

.tado-room-row:last-child {
    border-bottom: none;
}

.tado-row-trigger {
    display: grid;
    grid-template-columns: 20px minmax(140px, 220px) 120px 150px 1fr;
    gap: 16px;
    align-items: center;
    width: 100%;
    padding: 13px 0 13px 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--color-text);
    text-align: left;
    transition: background-color 100ms ease;
    outline: none;
}

.tado-room-list--read-only .tado-room-list-header,
.tado-room-list--read-only .tado-row-trigger {
    grid-template-columns: 20px minmax(140px, 260px) 120px 150px minmax(120px, 1fr);
}

.tado-room-list--read-only .tado-room-row {
    display: block;
}

.tado-room-list--read-only .tado-room-list-header span:nth-last-child(-n + 2),
.tado-room-list--read-only .tado-row-toggle-cell {
    display: none;
}

.tado-room-list--read-only .tado-row-trigger {
    cursor: default;
}

.tado-row-trigger:hover {
    background: var(--color-bg-soft);
}

.tado-room-list--read-only .tado-row-trigger:hover {
    background: transparent;
}

.tado-row-trigger:focus-visible {
    outline: 2px solid rgba(var(--color-tado-rgb), 0.45);
    outline-offset: -2px;
}

.tado-room-row--off .tado-row-trigger {
    opacity: 0.65;
}

.tado-room-row--off .tado-row-trigger:hover {
    opacity: 1;
}

.tado-room-list--read-only .tado-room-row--off .tado-row-trigger:hover {
    opacity: 0.65;
}

.tado-row-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tado-row-temps {
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-variant-numeric: tabular-nums;
}

.tado-row-current {
    font-size: 0.92rem;
    font-weight: 800;
    font-family: var(--font-display);
}

.tado-row-arrow {
    color: var(--color-text-muted);
    font-size: 0.7rem;
}

.tado-row-target {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--color-text-muted);
}

.tado-row-mode {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--color-text-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tado-row-heat {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tado-heat-bar {
    display: block;
    flex: 1;
    height: 10px;
    appearance: none;
    border: 0;
    background: color-mix(in srgb, var(--color-text-muted) 18%, transparent);
    border-radius: 999px;
    overflow: hidden;
    min-width: 60px;
}

[data-theme="light"] .tado-heat-bar {
    background: color-mix(in srgb, var(--color-bg-soft) 20%, transparent);
}

.tado-heat-bar-fill {
    display: block;
    height: 100%;
    min-width: 8px;
    background: var(--color-tado);
    border-radius: 999px;
    transition: width 300ms ease;
    box-shadow: 0 0 8px rgba(var(--color-tado-rgb), 0.45);
}

.tado-heat-bar::-webkit-progress-bar {
    background: transparent;
    border-radius: 999px;
}

.tado-heat-bar::-webkit-progress-value {
    min-width: 8px;
    background: var(--color-tado);
    border-radius: 999px;
    transition: width 300ms ease;
    box-shadow: 0 0 8px rgba(var(--color-tado-rgb), 0.45);
}

.tado-heat-bar::-moz-progress-bar {
    min-width: 8px;
    background: var(--color-tado);
    border-radius: 999px;
    transition: width 300ms ease;
    box-shadow: 0 0 8px rgba(var(--color-tado-rgb), 0.45);
}

.tado-row-heat-val {
    font-size: 0.85rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--color-text);
    min-width: 36px;
    text-align: right;
}

.tado-row-toggle-cell {
    display: flex;
    align-items: center;
    padding: 13px 0;
}

.tado-row-chevron {
    font-size: 1rem;
    color: var(--color-text-muted);
    transition: transform 200ms ease;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-right: 20px;
}

.tado-row-chevron--open {
    transform: rotate(90deg);
}

.tado-row-expanded {
    grid-column: 1 / -1;
    border-top: 1px solid var(--color-line);
    padding: 16px 20px 20px;
    background: var(--color-bg-soft);
}


