@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap");

*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --dashboard-scale: 1;

    --bg-main: #2b2b2a;
    --bg-sidebar: #1f1f1e;
    --bg-card: #1f1f1e;
    --bg-inner: #2b2b2a;

    --text-primary: #e9e6e2;
    --text-soft: #e9e7e2;
    --text-secondary: #c9c5be;
    --text-muted: #b8b2a5;
    --text-muted-soft: #b8b3a6;
    --text-low: #8a877f;

    --accent-orange: #c16e4e;
    --accent-orange-dark: #b5644a;
    --accent-red: #d46b5a;
    --accent-blue: #2e507d;
    --accent-blue-dark: #18406c;
    --accent-blue-light: #7992bc;
    --accent-green: #8fb295;
    --accent-grey: #99938a;

    --stroke: #4b4946;
    --stroke-strong: #45433f;
    --switch-bg: #20201e;
    --switch-knob: #45433f;
}

html { min-height: 100%; }

body {
    min-height: 100vh;
    margin: 0;
    background: #171716;
    color: var(--text-primary);
    font-family: "Montserrat", sans-serif;
    overflow: auto;
}

button {
    border: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

button:focus-visible {
    outline: 3px solid rgba(233, 230, 226, 0.78);
    outline-offset: 4px;
}

.dashboard-shell {
    width: calc(1920px * var(--dashboard-scale));
    height: calc(1080px * var(--dashboard-scale));
    margin: 0 auto;
    position: relative;
}

.dashboard {
    position: relative;
    width: 1920px;
    height: 1080px;
    overflow: hidden;
    background: var(--bg-main);
    transform: scale(var(--dashboard-scale));
    transform-origin: top left;
}

/* SIDEBAR */

.sidebar {
    position: absolute;
    left: 0;
    top: 0;
    width: 320px;
    height: 1080px;
    background: var(--bg-sidebar);
}

.brand-mark {
    position: absolute;
    left: 31px;
    top: 26px;
    width: 77px;
    height: 90px;
    overflow: visible;
}


.logo {
    position: absolute;
    left: 128px;
    top: 45px;
    z-index: 2;
    color: var(--text-primary);
    font-size: 45.35px;
    line-height: 1;
    font-weight: 500;
    letter-spacing: 0.086em;
    white-space: nowrap;
}

.logo-subtitle {
    position: absolute;
    left: 132px;
    top: 103px;
    color: var(--text-muted-soft);
    font-size: 13.9px;
    line-height: 1;
    font-weight: 500;
    letter-spacing: 0.17em;
    white-space: nowrap;
}

.nav {
    position: absolute;
    left: 35.65px;
    top: 172px;
    width: 247.43px;
}

.nav__item {
    position: absolute;
    left: 0;
    width: 247.43px;
    height: 59.29px;
    border: 1px solid var(--stroke);
    border-radius: 29.65px;
    color: var(--text-secondary);
    font-size: 15.2px;
    line-height: 1;
    font-weight: 600;
    letter-spacing: 0.168em;
    text-transform: uppercase;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 28px;
    text-align: left;
    transition:
        transform 180ms ease,
        color 180ms ease,
        border-color 180ms ease,
        background-color 180ms ease;
}

.nav__item:nth-child(1) { top: 0; }
.nav__item:nth-child(2) { top: 73.48px; }
.nav__item:nth-child(3) { top: 146.96px; }
.nav__item:nth-child(4) { top: 220.96px; }

.nav__item:hover {
    transform: translate3d(4px, 0, 0);
    color: var(--text-primary);
    border-color: #625f59;
}

.nav__item--active {
    border-color: transparent;
    background: var(--stroke-strong);
    color: var(--text-primary);
}

.sidebar-divider {
    position: absolute;
    left: 28px;
    top: 678.5px;
    width: 266px;
    height: 1px;
    background: rgba(184, 179, 166, 0.18);
}

.device-panel {
    position: absolute;
    left: 36px;
    top: 709px;
    width: 251px;
}

.device-panel__label {
    margin: 0 0 22px;
    color: var(--text-low);
    font-size: 16px;
    line-height: 1;
    font-weight: 400;
    letter-spacing: 0.19em;
}

.device-panel__row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 15px;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 22.68px;
    line-height: 1;
    font-weight: 600;
    letter-spacing: -0.015em;
    white-space: nowrap;
}

.device-panel__online {
    position: relative;
    padding-left: 21px;
    color: var(--accent-green);
}

.device-panel__online::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 12.5px;
    height: 12.5px;
    border-radius: 50%;
    background: currentColor;
    transform: translate3d(0, -50%, 0);
}

body[data-connection="online"] .device-panel__online {
    color: var(--accent-green);
}

body[data-connection="offline"] .device-panel__online,
body[data-connection="timeout"] .device-panel__online {
    color: var(--accent-red);
}

body[data-connection="loading"] .device-panel__online,
body[data-connection="demo"] .device-panel__online {
    color: var(--text-muted);
}

.live-panel {
    position: absolute;
    left: 37px;
    top: 880px;
    color: var(--text-low);
}

.live-panel p {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
    color: var(--text-low);
    font-size: 16px;
    line-height: 1;
    font-weight: 400;
    letter-spacing: 0.07em;
}

.live-panel > span {
    display: block;
    padding-left: 22px;
    font-size: 16px;
    line-height: 1;
    font-weight: 400;
    letter-spacing: 0.08em;
}

.live-panel__dot {
    width: 12.5px;
    height: 12.5px;
    border-radius: 50%;
    background: var(--accent-red);
}

.theme-switch {
    position: absolute;
    left: 36.66px;
    top: 949.47px;
    width: 120.31px;
    height: 65.98px;
    border-radius: 32.99px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.theme-switch__svg {
    display: block;
    width: 120.31px;
    height: 65.98px;
}

.content {
    position: absolute;
    left: 320px;
    top: 0;
    width: 1600px;
    height: 1080px;
}

.topbar { position: absolute; left: 0; top: 0; }

.topbar__meta {
    position: absolute;
    left: 56.9px;
    top: 54px;
    width: 520px;
    margin: 0;
    color: var(--text-low);
    font-size: 15.7px;
    line-height: 1;
    font-weight: 400;
    letter-spacing: 0.23em;
    white-space: nowrap;
}

.topbar h1 {
    position: absolute;
    left: 56.32px;
    top: 96px;
    width: 620px;
    margin: 0;
    color: var(--accent-red);
    font-size: 45.35px;
    line-height: 1.13;
    font-weight: 600;
    letter-spacing: -0.017em;
    white-space: nowrap;
}

.topbar__line {
    position: absolute;
    left: 56.92px;
    top: 171px;
    width: 976.32px;
    height: 2.83px;
    border-radius: 999px;
    background: var(--stroke-strong);
}

.period-switch {
    position: absolute;
    left: 1182.33px;
    top: 49.36px;
    width: 381.71px;
    height: 65.98px;
    border-radius: 32.99px;
    background: var(--switch-bg);
}

.period-switch__button {
    position: absolute;
    top: 7.07px;
    width: 183.79px;
    height: 51.84px;
    border-radius: 25.92px;
    color: var(--text-secondary);
    font-size: 13.2px;
    line-height: 1;
    font-weight: 500;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    white-space: nowrap;
    transition:
        background-color 180ms ease,
        color 180ms ease,
        transform 180ms ease;
}

.period-switch__button[data-period="daily"] { left: 7.07px; }
.period-switch__button[data-period="weekly"] { left: 190.86px; }

.period-switch__button:hover { color: var(--text-primary); }

.period-switch__button--active {
    background: var(--switch-knob);
    color: var(--text-primary);
}

.indicator {
    position: absolute;
    top: 171.48px;
    width: 216.45px;
    height: 562px;
}

.indicator--temperature {
    left: 91.7px;
    --indicator-color: var(--accent-orange);
    --sphere-top: 173.51px;
}

.indicator--humidity {
    left: 435.17px;
    --indicator-color: var(--accent-blue-light);
    --sphere-top: 217.63px;
}

.indicator--co2 {
    left: 778.64px;
    --indicator-color: var(--accent-grey);
    --sphere-top: 300.43px;
}

.indicator__tube {
    position: absolute;
    left: 0;
    top: 0;
    width: 216.45px;
    height: 518.5px;
    border: 2.13px solid var(--indicator-color);
    border-radius: 0 0 108.23px 108.23px;
}

.indicator h2 {
    position: absolute;
    top: 20.8px;
    width: 216.45px;
    margin: 0;
    color: var(--text-primary);
    font-size: 19.84px;
    line-height: 1;
    font-weight: 600;
    text-align: center;
}

.indicator p {
    position: absolute;
    top: 51.7px;
    width: 216.45px;
    margin: 0;
    color: var(--indicator-color);
    font-size: 17.01px;
    line-height: 1;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
}

.indicator__sphere {
    position: absolute;
    left: 108.23px;
    top: var(--sphere-top);
    width: 176px;
    height: 176px;
    border-radius: 50%;
    transform: translate3d(-50%, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    will-change: transform, top;
}

.indicator--temperature .indicator__sphere {
    background:
        radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.26), transparent 22%),
        linear-gradient(180deg, var(--accent-orange), var(--accent-orange-dark));
}

.indicator--humidity .indicator__sphere {
    background:
        radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.2), transparent 22%),
        linear-gradient(180deg, var(--accent-blue), var(--accent-blue-dark));
}

.indicator--co2 .indicator__sphere {
    background:
        radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.16), transparent 22%),
        linear-gradient(180deg, var(--accent-grey), #77736d);
    flex-direction: column;
}

.indicator__sphere strong {
    color: var(--text-primary);
    font-size: 48.19px;
    line-height: 1;
    font-weight: 600;
    letter-spacing: -0.017em;
}

.indicator__sphere span {
    margin-left: 7px;
    color: var(--text-primary);
    font-size: 31.18px;
    line-height: 1;
    font-weight: 600;
    letter-spacing: -0.035em;
    transform: translate3d(0, 8px, 0);
}

.indicator--co2 .indicator__sphere span {
    margin-left: 0;
    margin-top: 6px;
    font-size: 31.18px;
    transform: none;
}

.indicator small {
    position: absolute;
    left: 0;
    top: 533.5px;
    width: 216.45px;
    color: var(--text-low);
    font-size: 14px;
    line-height: 1;
    font-weight: 400;
    text-align: center;
    white-space: nowrap;
}

.recommendations {
    position: absolute;
    left: 1086.2px;
    top: 168.88px;
    width: 478.64px;
    height: 561.1px;
    border-radius: 40.24px;
    background: var(--bg-card);
}

.recommendations h2 {
    position: absolute;
    left: 40.94px;
    top: 33.7px;
    margin: 0;
    color: var(--text-muted);
    font-size: 31.18px;
    line-height: 1;
    font-weight: 600;
}

.recommendations__list {
    position: absolute;
    left: 19.71px;
    top: 85.94px;
    display: flex;
    flex-direction: column;
    gap: 47.93px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.recommendations__list li {
    position: relative;
    width: 433.18px;
    height: 109.53px;
    border-radius: 27.36px;
    background: var(--bg-inner);
}

.recommendations__list li::before {
    content: "";
    position: absolute;
    left: 21.23px;
    top: 26.9px;
    width: 55.87px;
    height: 55.87px;
    border-radius: 50%;
}

.recommendations__list li:nth-child(1)::before { background: var(--accent-orange); }
.recommendations__list li:nth-child(2)::before { background: var(--accent-blue-dark); }
.recommendations__list li:nth-child(3)::before { background: var(--accent-grey); }

.recommendations__list span {
    position: absolute;
    left: 21.23px;
    top: 26.9px;
    z-index: 1;
    width: 55.87px;
    height: 55.87px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    font-size: 19.84px;
    line-height: 1;
    font-weight: 500;
    text-align: center;
}

.recommendations__list div {
    position: absolute;
    left: 90.58px;
    top: 29.5px;
}

.recommendations__list p {
    margin: 0 0 15px;
    color: var(--text-primary);
    font-size: 24.4px;
    line-height: 1;
    font-weight: 400;
    white-space: nowrap;
}

.recommendations__list small {
    font-size: 14px;
    line-height: 1;
    font-weight: 400;
    letter-spacing: 0.12em;
}

.recommendations__list li:nth-child(1) small {
    color: var(--accent-orange);
}

.recommendations__list li:nth-child(2) small {
    color: var(--accent-blue-light);
}

.recommendations__list li:nth-child(3) small {
    color: var(--text-muted-soft);
}

.status-card {
    position: absolute;
    left: 1090.11px;
    top: 786.77px;
    width: 473.74px;
    height: 257.36px;
    border-radius: 35.45px;
    background: var(--bg-card);
}

.status-card h2 {
    position: absolute;
    left: 39.62px;
    top: 73px;
    margin: 0;
    color: var(--text-muted);
    font-size: 31.18px;
    line-height: 1;
    font-weight: 600;
    white-space: nowrap;
}

.status-card p {
    position: absolute;
    left: 37.73px;
    top: 129.8px;
    margin: 0;
    color: var(--text-soft);
    font-size: 22.68px;
    line-height: 1.2;
    font-weight: 400;
}

.history-card {
    position: absolute;
    left: 55.42px;
    top: 727.76px;
    width: 976.32px;
    height: 315.72px;
    border-radius: 26.19px;
    background: var(--bg-card);
}

.history-card h2 {
    position: absolute;
    left: 39.69px;
    top: 38.2px;
    margin: 0;
    color: var(--text-muted);
    font-size: 31.18px;
    line-height: 1;
    font-weight: 600;
    white-space: nowrap;
}

.legend {
    position: absolute;
    left: 476.63px;
    top: 40.2px;
    display: flex;
    align-items: center;
    gap: 48px;
}

.legend__item {
    position: relative;
    padding-left: 44px;
    color: var(--text-primary);
    font-size: 13.37px;
    line-height: 1;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}

.legend__item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 28.04px;
    height: 4.01px;
    border-radius: 999px;
    transform: translate3d(0, -50%, 0);
}

.legend__item--temperature::before { background: var(--accent-orange); }
.legend__item--humidity::before { background: var(--accent-blue); }
.legend__item--co2::before { background: var(--text-low); }

.history-chart {
    position: absolute;
    left: 39.69px;
    top: 105.24px;
    width: 861.86px;
    height: 170px;
    overflow: visible;
}

.history-chart line {
    stroke: var(--text-muted-soft);
    stroke-width: 0.57;
    opacity: 0.4;
}

.history-chart__line {
    fill: none;
    stroke-width: 2.73;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.history-chart__line--temperature { stroke: var(--accent-orange); }
.history-chart__line--humidity { stroke: var(--accent-blue); }
.history-chart__line--co2 { stroke: var(--text-low); }

.history-chart__dot--temperature { fill: var(--accent-orange); }
.history-chart__dot--humidity { fill: var(--accent-blue); }
.history-chart__dot--co2 { fill: var(--text-low); }

.chart-days {
    position: absolute;
    left: 39.69px;
    top: 273px;
    width: 861.86px;
    height: 18px;
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.chart-days span {
    position: absolute;
    top: 0;
    width: 58px;
    text-align: center;
    transform: translate3d(-50%, 0, 0);
}

.chart-days span:nth-child(1) {
    left: 0;
    text-align: left;
    transform: translate3d(0, 0, 0);
}

.chart-days span:nth-child(2) {
    left: 143.64px;
}

.chart-days span:nth-child(3) {
    left: 287.29px;
}

.chart-days span:nth-child(4) {
    left: 430.93px;
}

.chart-days span:nth-child(5) {
    left: 574.57px;
}

.chart-days span:nth-child(6) {
    left: 718.22px;
}

.chart-days span:nth-child(7) {
    left: 861.86px;
    text-align: right;
    transform: translate3d(-100%, 0, 0);
}



/* =========================
   LIGHT THEME — added on top of STEP 5C
   Dark mode remains the default STEP 5C appearance.
========================= */

.theme-switch__track {
    fill: #46443f;
    transform-box: fill-box;
    transform-origin: center;
    transition: transform 220ms ease, fill 220ms ease;
}

.theme-switch__knob-svg {
    fill: #1f1f1e;
    transition: transform 220ms ease, fill 220ms ease;
    transform-box: fill-box;
    transform-origin: center;
}

.theme-switch__moon-svg {
    transition: transform 220ms ease, stroke 220ms ease;
    transform-box: fill-box;
    transform-origin: center;
}

.theme-switch__moon-svg,
.theme-switch__sun-svg rect,
.theme-switch__sun-svg line {
    fill: none;
    stroke: #ffffff;
    stroke-linecap: round;
    stroke-miterlimit: 10;
    stroke-width: .70866;
}

.dashboard,
.sidebar,
.nav__item,
.period-switch,
.period-switch__button,
.recommendations,
.recommendations__list li,
.status-card,
.history-card,
.topbar__line,
.indicator__tube,
.logo,
.logo-subtitle,
.device-panel__label,
.device-panel__row,
.live-panel,
.live-panel p,
.live-panel > span,
.chart-days,
.history-chart line,
.status-card p,
.recommendations__list p,
.history-card h2,
.recommendations h2,
.status-card h2,
.legend__item,
.indicator h2,
.indicator p,
.indicator small {
    transition:
        background-color 220ms ease,
        color 220ms ease,
        border-color 220ms ease,
        stroke 220ms ease,
        fill 220ms ease,
        opacity 220ms ease;
}

body[data-theme="light"] {
    --bg-main: #f5f3ed;
    --bg-sidebar: #e7e4df;
    --bg-card: #e7e4df;
    --bg-inner: #f5f3ed;

    --text-primary: #6f6a60;
    --text-soft: #6f6a60;
    --text-secondary: #6f6a60;
    --text-muted: #6f6a60;
    --text-muted-soft: #8b857a;
    --text-low: #8d887d;

    --stroke: #6f6a60;
    --stroke-strong: #6f6a60;
    --switch-bg: #e7e4df;
    --switch-knob: #6f6a60;

    background: #f5f3ed;
}

body[data-theme="light"] .dashboard {
    background: #f5f3ed;
}

body[data-theme="light"] .sidebar {
    background: #e7e4df;
}

body[data-theme="light"] .logo,
body[data-theme="light"] .brand-mark {
    color: #6f6a60;
}

body[data-theme="light"] .brand-mark rect {
    fill: #6f6a60;
}

body[data-theme="light"] .brand-mark line {
    stroke: #6f6a60;
}

body[data-theme="light"] .brand-mark__dot--orange {
    fill: #c16e4e;
}

body[data-theme="light"] .brand-mark__dot--blue {
    fill: #2e507d;
}

body[data-theme="light"] .brand-mark__dot--grey {
    fill: #8a877f;
}

body[data-theme="light"] .nav__item {
    color: #6f6a60;
    border-color: #6f6a60;
}

body[data-theme="light"] .nav__item--active {
    color: #f5f3ed;
    background: #6f6a60;
    border-color: #6f6a60;
}

body[data-theme="light"] .topbar__meta,
body[data-theme="light"] .logo-subtitle,
body[data-theme="light"] .device-panel__label,
body[data-theme="light"] .live-panel,
body[data-theme="light"] .live-panel p,
body[data-theme="light"] .live-panel > span,
body[data-theme="light"] .indicator small {
    color: #8d887d;
}

body[data-theme="light"] .topbar h1 {
    color: #b94f53;
}

body[data-theme="light"] .topbar__line {
    background: #6f6a60;
}

body[data-theme="light"] .period-switch {
    background: #e7e4df;
}

body[data-theme="light"] .period-switch__button {
    color: #8d887d;
}

body[data-theme="light"] .period-switch__button--active {
    color: #f5f3ed;
    background: #6f6a60;
}

body[data-theme="light"] .indicator__tube {
    background: transparent;
    border-color: #6f6a60; /* Cambia il bordo da chiaro a scuro in modalità light */
}

body[data-theme="light"] .indicator__sphere strong,
body[data-theme="light"] .indicator__sphere span {
    color: #f5f3ed;
}

body[data-theme="light"] .indicator--temperature p {
    color: #c16e4e;
}

body[data-theme="light"] .indicator--humidity p {
    color: #18406c;
}

body[data-theme="light"] .indicator--co2 p {
    color: #8a877f;
}

body[data-theme="light"] .recommendations,
body[data-theme="light"] .status-card {
    background: #e7e4df;
    border: 1.35px solid #6f6a60;
}

/* === INIZIO CORREZIONI === */

body[data-theme="light"] .history-card {
    border: 1.35px solid #6f6b60; /* Correzione 1: bordo allo storico */
}

body[data-theme="light"] .status-card h2,
body[data-theme="light"] .status-card p {
    color: #6f6b60; /* Correzione 2: testo scuro leggibile per ambiente equilibrato */
}

body[data-theme="light"] .history-card h2,
body[data-theme="light"] .legend__item,
body[data-theme="light"] .chart-days span,
body[data-theme="light"] .chart-days {
    color: #6f6a60 !important;
}

/* Colore di default (Dark Mode) */
.logo-word-fill  {
  fill: #e9e6e2;
}
.logo-path {
  fill: #e9e6e2;
}
.righetta {
  fill: #e9e6e2;
}

/* Colore quando si attiva la Light Mode */
body[data-theme="light"] .logo-word-fill {
    fill: #6f6a60;
}
body[data-theme="light"] .righetta {
    fill: #6f6a60;
}
body[data-theme="light"] .logo-path {
    fill: #6f6a60;
}

/* === FINE CORREZIONI === */

body[data-theme="light"] .recommendations__list li {
    background: #f5f3ed;
}

body[data-theme="light"] .recommendations__list li {
    background: #f5f3ed;
}

body[data-theme="light"] .history-card {
    background: #e7e4df;
}

body[data-theme="light"] .history-chart line {
    stroke: #c9c4ba;
    opacity: .55;
}

body[data-theme="light"] .history-chart__line--co2 {
    stroke: #8a877f;
}

body[data-theme="light"] .history-chart__dot--co2 {
    fill: #8a877f;
}

body[data-theme="light"] .theme-switch__track {
    fill: #6f6b60;
    transform: translateX(-1.00015px);
    transform-box: fill-box;
}

body[data-theme="light"] .theme-switch__knob-svg {
    fill: #edeae5;
    transform: translateX(48.15727px);
    transform-box: fill-box;
}

body[data-theme="light"] .theme-switch__moon-svg {
    stroke: #fbf9f4;
    transform: translateX(1.00005px);
    transform-box: fill-box;
}

body[data-theme="light"] .theme-switch__sun-svg rect,
body[data-theme="light"] .theme-switch__sun-svg line {
    stroke: #6f6b60;
}



/* =========================
   SVG-ACCURATE RECOMMENDATION COLORS
========================= */

.recommendations__list span {
    color: #e9e6e2;
}

body[data-theme="light"] .recommendations__list span {
    color: #e9e6e2;
}

body[data-theme="light"] .recommendations__list li:nth-child(1)::before {
    background: #c16e4e;
}

body[data-theme="light"] .recommendations__list li:nth-child(2)::before {
    background: #2e507d;
}

body[data-theme="light"] .recommendations__list li:nth-child(3)::before {
    background: #b8b3a6;
}

body[data-theme="light"] .recommendations__list li:nth-child(1) small {
    color: #c16e4e;
}

body[data-theme="light"] .recommendations__list li:nth-child(2) small {
    color: #7992bc;
}

body[data-theme="light"] .recommendations__list li:nth-child(3) small {
    color: #827f77;
}

body[data-theme="light"] .recommendations__list p {
    color: #6f6b60;
}

body[data-theme="light"] .recommendations h2 {
    color: #6f6b60;
}

body[data-theme="light"] .recommendations {
    background: #edeae5;
    border-color: #6f6b60;
}

body[data-theme="light"] .recommendations__list li {
    background: #fbf9f4;
}



/* =========================
   DYNAMIC ENVIRONMENT TITLE
========================= */

#environmentTitle {
    transition: color 220ms ease;
}

#environmentTitle.environment-title--bad {
    color: #D46B5A;
}

#environmentTitle.environment-title--acceptable {
    color: #E4B25B;
}

#environmentTitle.environment-title--optimal {
    color: #71BE90;
}



/* =========================
   INTERACTIVE CHART HOVER
========================= */

.history-card {
    transition:
        background-color 220ms ease,
        border-color 220ms ease,
        transform 220ms ease,
        box-shadow 220ms ease;
}

.history-card:hover {
    transform: translate3d(0, -2px, 0);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.16);
}

.history-card:hover .history-chart__line {
    opacity: .74;
}

.history-card:hover .history-chart__dot {
    r: 5.8;
}

.history-chart__line,
.history-chart__dot {
    transition:
        opacity 180ms ease,
        r 180ms ease,
        stroke-width 180ms ease;
}

.chart-hover {
    position: absolute;
    left: 39.69px;
    top: 104.24px;
    width: 861.86px;
    height: 170px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 160ms ease;
}

.history-card.is-hovering .chart-hover {
    opacity: 1;
}

.chart-hover__line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1.3px;
    border-radius: 999px;
    background: rgba(233, 230, 226, 0.42);
    transform: translate3d(0, 0, 0);
}

.chart-hover__tooltip {
    position: absolute;
    top: -12px;
    min-width: 152px;
    padding: 13px 15px 12px;
    border-radius: 17px;
    background: rgba(31, 31, 30, 0.94);
    border: 1px solid rgba(233, 230, 226, 0.12);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.24);
    color: var(--text-primary);
    transform: translate3d(14px, -100%, 0);
    backdrop-filter: blur(10px);
}

.chart-hover__tooltip strong {
    display: block;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1;
    font-weight: 600;
    letter-spacing: 0.12em;
}

.chart-tooltip__row {
    display: grid;
    grid-template-columns: 9px 1fr auto;
    align-items: center;
    gap: 8px;
    min-height: 20px;
    color: var(--text-muted-soft);
    font-size: 12px;
    line-height: 1;
    font-weight: 500;
}

.chart-tooltip__row i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.chart-tooltip__row b {
    color: var(--text-primary);
    font-size: 12px;
    line-height: 1;
    font-weight: 600;
}

.chart-tooltip__row--temperature i {
    background: var(--accent-orange);
}

.chart-tooltip__row--humidity i {
    background: var(--accent-blue);
}

.chart-tooltip__row--co2 i {
    background: var(--accent-grey);
}

body[data-theme="light"] .history-card:hover {
    box-shadow: 0 20px 45px rgba(111, 107, 96, 0.16);
}

body[data-theme="light"] .chart-hover__line {
    background: rgba(111, 107, 96, 0.36);
}

body[data-theme="light"] .chart-hover__tooltip {
    background: rgba(251, 249, 244, 0.96);
    border-color: rgba(111, 107, 96, 0.18);
    box-shadow: 0 18px 38px rgba(111, 107, 96, 0.18);
}

body[data-theme="light"] .chart-hover__tooltip strong,
body[data-theme="light"] .chart-tooltip__row b {
    color: #6f6b60;
}

body[data-theme="light"] .chart-tooltip__row {
    color: #8d887d;
}



/* =========================================================
   STEP 9 — latest SVG/PDF alignment overrides
   Reference: LIFT Dashboard 1 definitiva copia
========================================================= */

:root {
    --bg-main: #343435;
    --bg-sidebar: #1e1e1f;
    --bg-card: #1e1e1f;
    --bg-inner: #2b2b2a;

    --text-primary: #e9e6e2;
    --text-soft: #e9e6e2;
    --text-secondary: #e9e6e2;
    --text-muted: #e9e6e2;
    --text-muted-soft: #b8b3a6;
    --text-low: #b8b3a6;

    --accent-orange: #c16e4e;
    --accent-orange-dark: #c16e4e;
    --accent-red: #b14f5d;
    --accent-blue: #7992bc;
    --accent-blue-dark: #7992bc;
    --accent-blue-light: #7992bc;
    --accent-green: #6ca67d;
    --accent-grey: #588289;

    --stroke: #e9e6e2;
    --stroke-strong: #e9e6e2;
    --switch-bg: #343435;
    --switch-knob: #1e1e1f;
}

body {
    background: #1e1e1f;
}

.dashboard {
    background: #343435;
}

.sidebar {
    background: #1e1e1f;
}

.brand-mark {
    left: 37px;
    top: 35.97px;
    width: 64.33px;
    height: 75.34px;
}

.logo {
    left: 117px;
    top: 39px;
    font-size: 58px;
    line-height: 1;
    font-weight: 500;
    letter-spacing: 0.105em;
    color: #e9e6e2;
}

.logo-subtitle {
    display: none;
}

.nav {
    left: 35.65px;
    top: 170.42px;
}

.nav__item {
    border-color: #e9e6e2;
    color: #e9e6e2;
}

.nav__item--active {
    background: #343435;
    border-color: #343435;
    color: #e9e6e2;
}

.sidebar-divider {
    background: rgba(233, 230, 226, 0.18);
}

.device-panel__online {
    color: #6ca67d;
}

.live-panel__dot {
    background: #b14f5d;
}

.theme-switch__track {
    fill: #343435;
}

.theme-switch__knob-svg {
    fill: #1e1e1f;
}

.period-switch {
    display: none;
}

.topbar__meta {
    color: #e9e6e2;
    opacity: 0.88;
}

.topbar h1 {
    color: #b14f5d;
}

#environmentTitle.environment-title--bad {
    color: #b14f5d;
}

.topbar__line {
    left: 56.92px;
    top: 170.55px;
    width: 976.32px;
    height: 1.5px;
    background: #e9e6e2;
}

.indicator__tube {
    border-color: #e9e6e2;
    border-width: 1.5px;
    height: 517.11px;
}

.indicator--temperature {
    --indicator-color: #c16e4e;
}

.indicator--humidity {
    --indicator-color: #7992bc;
}

.indicator--co2 {
    --indicator-color: #588289;
}

.indicator--temperature .indicator__sphere {
    background:
        radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.26), transparent 22%),
        #c16e4e;
}

.indicator--humidity .indicator__sphere {
    background:
        radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.18), transparent 22%),
        #7992bc;
}

.indicator--co2 .indicator__sphere {
    background:
        radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.14), transparent 22%),
        #588289;
}

.indicator small {
    color: #b8b3a6;
}

.recommendations {
    left: 1086.20px;
    top: 168.88px;
    width: 478.64px;
    height: 521.12px;
    border-radius: 25px;
    background: #1e1e1f;
}

.recommendations h2 {
    left: 40.94px;
    top: 32px;
    color: #e9e6e2;
}

.recommendations__list {
    left: 19.71px;
    top: 103.58px;
    gap: 24.28px;
}

.recommendations__list li {
    width: 433.18px;
    height: 109.53px;
    border-radius: 54.77px;
    background: #2b2b2a;
}

.recommendations__list li:nth-child(1)::before {
    background: #c16e4e;
}

.recommendations__list li:nth-child(2)::before {
    background: #7992bc;
}

.recommendations__list li:nth-child(3)::before {
    background: #588289;
}

.recommendations__list span {
    color: #e9e6e2;
}

.recommendations__list li:nth-child(1) small {
    color: #c16e4e;
}

.recommendations__list li:nth-child(2) small {
    color: #7992bc;
}

.recommendations__list li:nth-child(3) small {
    color: #588289;
}

.status-card {
    left: 1090.11px;
    top: 728px;
    width: 473.74px;
    height: 316.13px;
    border-radius: 25px;
    background: #1e1e1f;
}

.status-card h2 {
    left: 54px;
    top: 54px;
    color: #e9e6e2;
}

.status-card p {
    left: 54px;
    top: 100px;
    right: 100px;
    color: #e9e6e2;
}

.history-card {
    left: 55.42px;
    top: 728px;
    width: 976.32px;
    height: 315.48px;
    border-radius: 25px;
    background: #1e1e1f;
}

.history-card h2 {
    color: #e9e6e2;
}

.legend__item {
    color: #e9e6e2;
}

.legend__item--temperature::before {
    background: #c16e4e;
}

.legend__item--humidity::before {
    background: #7992bc;
}

.legend__item--co2::before {
    background: #588289;
}

.history-chart line {
    stroke: #b8b3a6;
}

.history-chart__line--temperature {
    stroke: #c16e4e;
}

.history-chart__line--humidity {
    stroke: #7992bc;
}

.history-chart__line--co2 {
    stroke: #588289;
}

.history-chart__dot--temperature {
    fill: #c16e4e;
}

.history-chart__dot--humidity {
    fill: #7992bc;
}

.history-chart__dot--co2 {
    fill: #588289;
}

.chart-tooltip__row--co2 i {
    background: #588289;
}

.chart-days span {
    color: #e9e6e2;
}

body[data-theme="light"] .period-switch {
    display: none;
}



/* =========================================================
   STEP 10 — final refinements from the latest SVG/PDF
========================================================= */

/* Exact vector LIFT wordmark from the SVG. */
.logo {
    display: none;
}

.logo-word {
    position: absolute;
    left: 117.26px;
    top: 49.09px;
    width: 138.25px;
    height: 50.91px;
    overflow: visible;
}

.logo-word path {
    fill: #e9e6e2;
}

/* Typography tuning: Montserrat for UI, Myriad-style feeling for the mark is handled as SVG path. */
body {
    font-family: "Montserrat", "Myriad Pro", Arial, sans-serif;
}

.topbar__meta,
.device-panel__label,
.live-panel,
.live-panel p,
.live-panel > span,
.indicator small,
.chart-days,
.legend__item,
.recommendations__list small {
    font-weight: 400;
}

.nav__item,
.indicator h2,
.indicator__sphere strong,
.indicator__sphere span,
.recommendations h2,
.status-card h2,
.history-card h2 {
    font-weight: 600;
}

/* Latest SVG: all three spheres are flat fills, without glossy gradients. */
.indicator--temperature .indicator__sphere {
    background: #c16e4e;
}

.indicator--humidity .indicator__sphere {
    background: #7992bc;
}

.indicator--co2 .indicator__sphere {
    background: #588289;
}

/* Match the reference: CO2 status color and recommendation color are teal, not grey. */
.indicator--co2 p,
.recommendations__list li:nth-child(3) small {
    color: #588289;
}

.chart-tooltip__row--co2 i {
    background: #588289;
}

/* More faithful title/card text sizing and spacing. */
.topbar__meta {
    left: 56.9px;
    top: 51px;
    font-size: 15.7px;
    letter-spacing: 0.23em;
}

.topbar h1 {
    top: 81px;
    font-size: 45.35px;
    line-height: 1.16;
    letter-spacing: -0.015em;
}

.indicator h2 {
    top: 22px;
    font-size: 19.84px;
}

.indicator p {
    top: 54px;
    font-size: 17.01px;
}

.indicator small {
    top: 533.5px;
    font-size: 14px;
}

.recommendations h2 {
    font-size: 31.18px;
    letter-spacing: 0;
}

.recommendations__list p {
    font-size: 24px;
    font-weight: 400;
}

.recommendations__list small {
    font-size: 14px;
    letter-spacing: 0.12em;
}

.status-card h2 {
    font-size: 31.18px;
}

.status-card p {
    font-size: 22.68px;
    line-height: 1.2;
}

.history-card h2 {
    font-size: 31.18px;
}

.chart-days {
    font-size: 16px;
}

/* Exact daily chart geometry from the latest SVG. */
.history-chart {
    left: 39.687px;
    top: 105.00057px;
    width: 861.85726px;
    height: 170px;
}

.chart-hover {
    left: 39.687px;
    top: 105.00057px;
    width: 861.85726px;
}

.chart-days {
    left: 39.687px;
    top: 273px;
    width: 861.85726px;
}

/* Slightly more faithful line weight and legend line weight. */
.history-chart__line {
    stroke-width: 2.72632;
}

.legend__item::before {
    width: 28.04px;
    height: 4.25px;
}

/* Remove old hover lift effect: the reference card should remain visually stable. */
.history-card:hover {
    transform: none;
    box-shadow: none;
}



/* =========================================================
   STEP 11 — Dynamic ApexCharts history chart
========================================================= */

.history-apex {
    position: absolute;
    left: 39.687px;
    top: 95px;
    width: 861.85726px;
    height: 205px;
}

.history-apex .apexcharts-canvas,
.history-apex svg {
    overflow: visible;
}

.history-apex .apexcharts-gridline {
    stroke: rgba(184, 179, 166, 0.28);
}

.history-apex .apexcharts-xaxis text,
.history-apex .apexcharts-tooltip,
.history-apex .apexcharts-tooltip-title {
    font-family: "Montserrat", "Myriad Pro", Arial, sans-serif !important;
}

.history-apex .apexcharts-xaxis text {
    fill: #e9e6e2;
    font-size: 16px;
    font-weight: 400;
}

.history-apex .apexcharts-tooltip {
    border: 1px solid rgba(233, 230, 226, 0.12) !important;
    border-radius: 16px !important;
    background: rgba(30, 30, 31, 0.96) !important;
    color: #e9e6e2 !important;
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.24) !important;
}

.history-apex .apexcharts-tooltip-title {
    background: transparent !important;
    border-bottom: 1px solid rgba(233, 230, 226, 0.12) !important;
    color: #e9e6e2 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    letter-spacing: 0.08em;
}

.history-apex .apexcharts-tooltip-series-group {
    color: #e9e6e2 !important;
}

.chart-days,
.history-chart,
.chart-hover {
    display: none !important;
}

.history-card:hover {
    transform: none;
    box-shadow: none;
}

body[data-theme="light"] .history-apex .apexcharts-xaxis text {
    fill: #6f6b60;
}

body[data-theme="light"] .history-apex .apexcharts-gridline {
    stroke: rgba(111, 107, 96, 0.22);
}

body[data-theme="light"] .history-apex .apexcharts-tooltip {
    background: rgba(251, 249, 244, 0.96) !important;
    color: #6f6b60 !important;
    border-color: rgba(111, 107, 96, 0.18) !important;
    box-shadow: 0 18px 38px rgba(111, 107, 96, 0.18) !important;
}

body[data-theme="light"] .history-apex .apexcharts-tooltip-title {
    color: #6f6b60 !important;
    border-bottom-color: rgba(111, 107, 96, 0.18) !important;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}


/* STEP 10A — remove target labels under indicators */
.indicator small {
    display: none !important;
}


/* ApexCharts custom tooltip content */
.apex-tooltip-custom {
    min-width: 150px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(30, 30, 31, 0.96);
    color: #e9e6e2;
    font-family: "Montserrat", "Myriad Pro", Arial, sans-serif;
}

.apex-tooltip-custom strong {
    display: block;
    margin-bottom: 9px;
    font-size: 13px;
    line-height: 1;
    font-weight: 600;
    letter-spacing: 0.12em;
}

.apex-tooltip-custom span {
    display: grid;
    grid-template-columns: 9px 1fr auto;
    align-items: center;
    gap: 8px;
    min-height: 20px;
    font-size: 12px;
    line-height: 1;
    color: #b8b3a6;
}

.apex-tooltip-custom i {
    display: block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.apex-tooltip-custom b {
    color: #e9e6e2;
    font-size: 12px;
    font-weight: 600;
}

body[data-theme="light"] .apex-tooltip-custom {
    background: rgba(251, 249, 244, 0.96);
    color: #6f6b60;
}

body[data-theme="light"] .apex-tooltip-custom span {
    color: #8d887d;
}

body[data-theme="light"] .apex-tooltip-custom b {
    color: #6f6b60;
}

/* =========================================================
   FORZATURA FINALE LOGO (Risoluzione Conflitto Step 9/10)
========================================================= */

/* 1. Colore di default in Dark Mode (opzionale, per sicurezza) */
.logo-path,
.logo-word-fill {
    fill: #e9e6e2 !important;
}

/* 2. Regola vincente che si attiva in Light Mode */
body[data-theme="light"] .logo-path,
body[data-theme="light"] .logo-word-fill {
    fill: #6f6a60 !important;
}

/* 3. Correzione per le tre linee verticali del logo (stroke) */
body[data-theme="light"] .righetta {
    stroke: #6f6a60 !important;
}