/* ── Agenda — folha por dia, com linhas e margem como uma agenda de papel ────
   Reaproveita os blocos do My Money (.mm, .mm__section, .mm__btn…), por isso
   herda o fundo e o tema do painel; aqui as cores seguem as variáveis do tema
   (Liquid --g-*, Aurora --a-*) com as cores da app como base. */
.mm.ag {
  --ag-ink: var(--g-ink, var(--a-ink, #1c2433));
  --ag-ink-2: var(--g-ink-2, var(--a-ink-2, #3d4f63));
  --ag-muted: var(--g-muted, var(--a-muted, #6b7b8d));
  --ag-accent: var(--g-blue, var(--a-violet, #217dbb));
  --ag-strong: var(--g-blue, var(--a-violet, #0b1220));
  --ag-rule: rgba(28, 36, 51, 0.08);
  --ag-margin: color-mix(in srgb, var(--ag-accent) 35%, transparent);
  --ag-hover: rgba(28, 36, 51, 0.05);
  --ag-orange: var(--g-orange-ink, var(--a-sun, #d97706));
  --ag-red: var(--g-red-ink, var(--a-red, #dc2626));
  --ag-vac: var(--a-teal, #0d9488);
  --ag-line: 2.4rem;

  max-width: 1080px;
}

/* ── Botão «Hoje» (sempre no canto superior) ── */
.mm .ag__today-btn {
  height: 2rem;
  padding: 0 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  text-decoration: none;
}

.mm .ag__today-btn.mm__btn--ghost {
  background: #fff;
  color: var(--ag-ink-2);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

/* Sem barra inferior na agenda: a folha vai até ao fundo do ecrã. */
body:has(.ag) .app-main {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ── Pesquisa ── */
.ag__search {
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem 0.25rem 0.85rem;
}

.ag__search-ico {
  flex-shrink: 0;
  color: var(--ag-muted);
}

.ag__search-input {
  flex: 1;
  min-width: 0;
  height: 2.1rem;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ag-ink);
  font: inherit;
  font-size: 0.95rem;
}

.ag__search-input::placeholder {
  color: var(--ag-muted);
}

.ag__search-input::-webkit-search-cancel-button {
  display: none;
}

.ag__search-clear {
  flex-shrink: 0;
  padding: 0.3rem 0.7rem;
  border-radius: 0.85rem;
  color: var(--ag-ink-2);
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
}

.ag__search-clear:hover {
  background: var(--ag-hover);
}

.ag__results {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ag__results .mm__section-title {
  margin-bottom: 0.5rem;
}

.ag__empty {
  margin: 0.5rem 0;
  color: var(--ag-muted);
}

.ag__result {
  display: grid;
  grid-template-columns: 3.75rem 1fr;
  gap: 0.75rem;
  padding: 0.6rem 0.5rem;
  border-top: 1px solid var(--ag-rule);
  border-radius: 0.6rem;
  color: var(--ag-ink);
  text-decoration: none;
}

.ag__result:hover {
  background: var(--ag-hover);
}

.ag__result-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
  color: var(--ag-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ag__result-date strong {
  font-size: 1.35rem;
  color: var(--ag-ink);
  letter-spacing: 0;
}

.ag__result-notes {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.ag__result-note mark {
  border-radius: 0.2em;
  background: color-mix(in srgb, var(--ag-accent) 22%, transparent);
  color: inherit;
}

/* ── Faixa da semana ── */
.mm__view-toggle.ag__week {
  display: grid;
  grid-template-columns: 1.4rem repeat(7, 1fr) 1.4rem;
  align-items: center;
  gap: 0.15rem;
}

.ag__week-arrow,
.ag__page-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ag-muted);
  font-size: 1.5rem;
  line-height: 1;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.ag__week-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  padding: 0.35rem 0 0.3rem;
  border-radius: 0.85rem;
  color: var(--ag-ink);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.ag__week-name {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ag-muted);
}

.ag__week-num {
  font-size: 1rem;
  font-weight: 700;
}

.ag__week-day.is-today .ag__week-num {
  color: var(--ag-accent);
}

.ag__week-day.is-active {
  background: var(--ag-strong);
}

.ag__week-day.is-active .ag__week-name,
.ag__week-day.is-active .ag__week-num {
  color: #fff;
}

.ag__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.ag__dot.is-on {
  background: var(--ag-accent);
}

.ag__week-day.is-active .ag__dot.is-on {
  background: #fff;
}

/* ── Layout ── */
.ag__layout {
  display: grid;
  gap: 1rem;
}

/* ── Coluna lateral: calendário + importantes ── */
.ag__side {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.ag__side > [data-agenda-target="important"]:not(:has(*)) {
  display: none;
}

/* ── Importantes (vermelho, por riscar) ── */
.ag__important .mm__section-title {
  margin-bottom: 0.4rem;
}

.ag__important-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ag-red);
}

.ag__important-count {
  margin-left: auto;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ag-red) 12%, transparent);
  color: var(--ag-red);
  font-size: 0.72rem;
  font-weight: 700;
}

.ag__important-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ag__important-item {
  display: flex;
  gap: 0.6rem;
  padding: 0.5rem 0.4rem;
  border-top: 1px solid var(--ag-rule);
  border-radius: 0.5rem;
  color: var(--ag-ink);
  font-size: 0.9rem;
  line-height: 1.35;
  text-decoration: none;
}

.ag__important-item:hover {
  background: var(--ag-hover);
}

.ag__important-date {
  flex-shrink: 0;
  min-width: 3.6rem;
  color: var(--ag-muted);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.6;
}

.ag__important-item.is-past .ag__important-date {
  color: var(--ag-red);
}

.ag__important-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.ag__important-text strong {
  color: var(--ag-red);
}

/* ── Calendário do mês ── */
.mm__section.ag__month {
  display: none;
}

.mm__section.ag__month.is-open {
  display: block;
}

.mm .mm__month-arrow.ag__cal-btn,
.mm .ag__month-head .mm__month-arrow {
  border-radius: 999px;
}

.ag__month-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.ag__month-head .mm__month-arrow {
  text-decoration: none;
}

.ag__month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.15rem;
  text-align: center;
}

.ag__month-wd {
  padding-bottom: 0.25rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--ag-muted);
}

.ag__month-day {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border-radius: 50%;
  color: var(--ag-ink);
  font-size: 0.85rem;
  text-decoration: none;
}

.ag__month-day:hover {
  background: var(--ag-hover);
}

.ag__month-day.is-out {
  opacity: 0.35;
}

.ag__month-day.is-today {
  color: var(--ag-accent);
  font-weight: 700;
}

.ag__month-day.is-active {
  background: var(--ag-strong);
  color: #fff;
}

.ag__month-day.has-notes::after {
  content: "";
  position: absolute;
  bottom: 12%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--ag-accent);
}

.ag__month-day.is-active.has-notes::after {
  background: #fff;
}

.ag__jump {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--ag-rule);
  font-size: 0.85rem;
  color: var(--ag-muted);
}

.ag__jump input,
.ag-entry__menu-date {
  font: inherit;
  font-size: 0.85rem;
  color: var(--ag-ink);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 0.5rem;
  padding: 0.25rem 0.4rem;
  background: rgba(255, 255, 255, 0.6);
}

/* ── A folha ── */
.mm__section.ag__page {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 15rem);
  padding: 1.4rem 0 0;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

/* argolas da agenda */
.ag__page::before {
  content: "";
  position: absolute;
  top: 0.5rem;
  left: 1.5rem;
  right: 1.5rem;
  height: 0.5rem;
  background: radial-gradient(circle, rgba(28, 36, 51, 0.13) 0.2rem, transparent 0.24rem) 0 50% / 1.6rem 100% repeat-x;
}

.ag__page.is-leaving-left {
  transform: translateX(-18px);
  opacity: 0.4;
}

.ag__page.is-leaving-right {
  transform: translateX(18px);
  opacity: 0.4;
}

.ag__page-head {
  display: grid;
  grid-template-columns: 2.5rem 1fr 2.5rem;
  align-items: center;
  padding: 0.4rem 0.5rem 0.85rem;
  border-bottom: 2px solid var(--ag-margin);
}

.ag__page-arrow {
  height: 2.5rem;
  font-size: 1.9rem;
}

.ag__page-date {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
}

.ag__page-num {
  font-size: 2.9rem;
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--ag-ink);
}

.ag__page-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.ag__page-weekday {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ag-ink);
}

.ag__page-month {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ag-muted);
}

/* ── Notas em blocos; as linhas do papel ficam na zona para escrever e no resto da folha ── */
.ag__add,
.ag__filler {
  background-image: linear-gradient(to bottom, transparent calc(var(--ag-line) - 1px), var(--ag-rule) calc(var(--ag-line) - 1px));
  background-size: 100% var(--ag-line);
}

.ag__lines {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
  padding: 0.75rem 0.75rem 0.5rem;
  list-style: none;
}

.ag__lines:empty {
  padding: 0.25rem 0;
}

.ag-entry {
  --ag-row: 1.5rem;

  position: relative;
  display: grid;
  grid-template-columns: 2rem 1fr auto auto;
  align-items: start;
  padding: 0.55rem 0;
  border: 1px solid rgba(28, 36, 51, 0.07);
  border-radius: 0.9rem;
  background: rgba(28, 36, 51, 0.03);
}

.ag__add {
  position: relative;
  display: grid;
  grid-template-columns: 2.75rem 1fr auto;
  align-items: start;
}

/* linha da margem */
.ag__add::before,
.ag__filler::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 2.75rem;
  width: 1px;
  background: var(--ag-margin);
}

.ag__filler {
  position: relative;
  flex: 1;
  min-height: calc(var(--ag-line) * 3);
  border-radius: 0 0 1.25rem 1.25rem;
}

.ag-entry {
  transition: opacity 0.18s ease, box-shadow 0.15s ease;
}

.ag-entry.is-removing {
  opacity: 0;
}

/* Pega da margem: arrastar por aqui muda a ordem (não choca com escrever nem com deslizar o dia). */
.ag-entry__handle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  margin: -0.55rem 0;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.ag-entry__grip {
  color: var(--ag-muted);
  opacity: 0.35;
}

@media (hover: hover) {
  .ag-entry__grip {
    opacity: 0;
    transition: opacity 0.12s;
  }

  .ag-entry:hover .ag-entry__grip {
    opacity: 0.6;
  }
}

.ag-entry.is-dragging {
  cursor: grabbing;
  box-shadow: 0 10px 24px -10px rgba(20, 30, 60, 0.35);
}

.ag-entry.is-ghost {
  opacity: 0.35;
  background: color-mix(in srgb, var(--ag-accent) 10%, transparent);
}

.ag-entry__line {
  min-width: 0;
  padding: 0 0.25rem 0 0.35rem;
  font-size: 1rem;
  line-height: var(--ag-row);
  color: var(--ag-ink);
  overflow-wrap: anywhere;
}

.ag-entry__time {
  margin-right: 0.45rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ag-accent);
}

.ag-entry.is-editing .ag-entry__time {
  display: none;
}

.ag-entry__text {
  white-space: pre-wrap;
  outline: none;
  cursor: text;
  border-radius: 0.2rem;
}

.ag-entry__text:focus {
  background: var(--ag-hover);
}

.ag-entry__more {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: var(--ag-row);
  padding: 0;
  border: 0;
  background: none;
  color: var(--ag-muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Visto (feito) ao lado do «⋯» */
.ag-entry__check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  margin-top: calc((var(--ag-row) - 1.5rem) / 2);
  padding: 0;
  border: 1.5px solid color-mix(in srgb, var(--ag-muted) 55%, transparent);
  border-radius: 50%;
  background: transparent;
  color: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.ag-entry__check:hover {
  color: var(--ag-muted);
}

.ag-entry.is-done .ag-entry__check {
  border-color: var(--g-green-ink, var(--a-teal, #15803d));
  background: var(--g-green-ink, var(--a-teal, #15803d));
  color: #fff;
}

@media (hover: hover) {
  .ag-entry__more,
  .ag-entry:not(.is-done) .ag-entry__check {
    opacity: 0;
  }

  .ag-entry:hover .ag-entry__more,
  .ag-entry.is-open .ag-entry__more,
  .ag-entry:hover .ag-entry__check {
    opacity: 1;
  }
}

.ag-entry__menu {
  display: none;
  position: absolute;
  z-index: 5;
  top: calc(100% - 0.35rem);
  right: 0.5rem;
  flex-direction: column;
  min-width: 15rem;
  padding: 0.3rem;
  border-radius: 0.9rem;
  background: #fff;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16), 0 1px 3px rgba(0, 0, 0, 0.08);
}

.ag-entry.is-open .ag-entry__menu {
  display: flex;
}

.ag-entry__menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.65rem;
  border: 0;
  border-radius: 0.6rem;
  background: none;
  color: #1c2433;
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}

.ag-entry__menu-item:hover {
  background: #f1f4f8;
}

.ag-entry__menu .ag-entry__menu-del {
  color: #c53030;
}

/* ── Riscado (feito) e importante ── */
.ag-entry.is-done .ag-entry__line,
.ag__result-note.is-done {
  color: var(--ag-muted);
}

.ag-entry.is-done .ag-entry__text,
.ag__result-note.is-done {
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}

.ag-entry.is-done .ag-entry__time {
  color: inherit;
}

.ag-entry.is-mark-orange { --ag-mark: var(--ag-orange); }
.ag-entry.is-mark-red    { --ag-mark: var(--ag-red); }

.ag-entry:is(.is-mark-orange, .is-mark-red) {
  border-color: color-mix(in srgb, var(--ag-mark) 25%, transparent);
  background: color-mix(in srgb, var(--ag-mark) 7%, transparent);
  box-shadow: inset 3px 0 0 var(--ag-mark);
}

.ag-entry.is-done {
  background: transparent;
  border-style: dashed;
}

.ag-entry:is(.is-mark-orange, .is-mark-red):not(.is-done) .ag-entry__line,
.ag-entry:is(.is-mark-orange, .is-mark-red):not(.is-done) .ag-entry__time {
  color: var(--ag-mark);
  font-weight: 600;
}

.ag__result-note.is-mark-orange:not(.is-done) { color: var(--ag-orange); font-weight: 600; }
.ag__result-note.is-mark-red:not(.is-done)    { color: var(--ag-red); font-weight: 600; }

.ag-entry__menu-marks {
  cursor: default;
}

.ag-entry__menu-marks:hover {
  background: none;
}

.ag-entry__marks {
  display: flex;
  gap: 0.5rem;
}

.ag-entry__mark {
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--ag-mark);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
  cursor: pointer;
}

.ag-entry__mark--orange { --ag-mark: var(--ag-orange); }
.ag-entry__mark--red    { --ag-mark: var(--ag-red); }

.ag-entry__mark.is-on {
  box-shadow: 0 0 0 2px var(--ag-mark);
}

/* ── Linha para escrever ── */
.ag__add-plus {
  height: var(--ag-line);
  line-height: var(--ag-line);
  text-align: center;
  font-size: 1.25rem;
  color: var(--ag-muted);
}

.ag__add-input {
  grid-column: 2 / 4;
  display: block;
  width: 100%;
  height: var(--ag-line);
  min-height: var(--ag-line);
  padding: 0 1rem 0 0.7rem;
  resize: none;
  overflow: hidden;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ag-ink);
  font: inherit;
  font-size: 1rem;
  line-height: var(--ag-line);
}

.ag__add-input::placeholder {
  color: var(--ag-muted);
  opacity: 0.7;
}

/* ── Estado da gravação (canto da folha) ── */
.ag__save {
  position: absolute;
  top: 0.35rem;
  right: 0.9rem;
  z-index: 1;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ag-muted);
  pointer-events: none;
}

.ag__save:empty {
  display: none;
}

.ag__save[data-state="saved"] {
  color: var(--g-green-ink, var(--a-teal, #15803d));
}

.ag__save[data-state="error"] {
  background: color-mix(in srgb, var(--ag-red) 12%, transparent);
  color: var(--ag-red);
}

/* Dica ao escrever uma nota nova (por baixo da linha, sem empurrar as linhas) */
.ag__add-hint {
  display: none;
  position: absolute;
  top: 100%;
  right: 0.9rem;
  z-index: 1;
  padding-top: 0.15rem;
  font-size: 0.7rem;
  color: var(--ag-muted);
  pointer-events: none;
}

.ag__add-input:focus:not(:placeholder-shown) ~ .ag__add-hint {
  display: block;
}

/* Notas com várias linhas nas listas de pesquisa e importantes */
.ag__result-note,
.ag__important-text {
  white-space: pre-line;
}

/* ── Férias: nota, etiqueta no cabeçalho e dias no calendário ── */
.ag-entry.is-vacation {
  border-color: color-mix(in srgb, var(--ag-vac) 30%, transparent);
  background: color-mix(in srgb, var(--ag-vac) 9%, transparent);
  box-shadow: inset 3px 0 0 var(--ag-vac);
}

.ag-entry__vac,
.ag__vac-badge {
  display: inline-block;
  margin-right: 0.45rem;
  padding: 0 0.5rem;
  border-radius: 999px;
  background: var(--ag-vac);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.35rem;
  text-transform: uppercase;
  vertical-align: 0.1em;
}

.ag__vac-badge {
  margin: 0 0 0 0.35rem;
}

.ag__vac-badge[hidden] {
  display: none;
}

.ag__week-day.is-vacation,
.ag__month-day.is-vacation {
  background: color-mix(in srgb, var(--ag-vac) 16%, transparent);
}

.ag__week-day.is-vacation .ag__week-num,
.ag__month-day.is-vacation {
  color: var(--ag-vac);
  font-weight: 700;
}

.ag__week-day.is-vacation.is-active,
.ag__month-day.is-vacation.is-active {
  background: var(--ag-vac);
  color: #fff;
}

.ag__week-day.is-vacation.is-active .ag__week-num {
  color: #fff;
}

/* ── Aviso ── */
.ag__toast {
  position: fixed;
  z-index: 300;
  left: 50%;
  bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
  padding: 0.6rem 1rem;
  border-radius: 999px;
  background: #0b1220;
  color: #fff;
  font-size: 0.875rem;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.ag__toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ── Computador: calendário ao lado, sem faixa da semana ── */
@media (min-width: 900px) {
  .mm__view-toggle.ag__week,
  .mm .ag__cal-btn {
    display: none;
  }

  .ag__layout {
    grid-template-columns: 17rem 1fr;
    align-items: start;
  }

  .mm__section.ag__month {
    display: block;
  }

  .ag__side {
    position: sticky;
    top: 1rem;
  }

  .mm__section.ag__page {
    min-height: calc(100vh - 9rem);
  }
}
/* ── Dashboard — CASA-inspired cool blue minimal ──── */
:root {
  --dh-bg: #e8ecf2;
  --dh-text: #1c2433;
  --dh-text-2: #3d4f63;
  --dh-muted: #6b7b8d;
  --dh-muted-2: #8895a7;
  --dh-muted-3: #a0aec0;
  --dh-section-bg: #fff;
  --dh-tile-bg: #eef2f7;
  --dh-tile-bg-hover: #e4eaf2;
  --dh-hairline: rgba(0, 0, 0, 0.06);
  --dh-field-border: #c8d0da;
  --dh-field-border-hover: #a0adc0;
  --dh-field-bg: #f4f6f9;
  --dh-accent: #217dbb;
  --dh-plug-on-bg: #ecf8ef;
  --dh-plug-power-text: var(--dh-text-2);
  --dh-plug-flash-ok-bg: #e8f4ea;
  --dh-plug-flash-ok-text: #2d5a32;
  --dh-plug-flash-err-bg: #fdeaea;
  --dh-plug-flash-err-text: #9b2c2c;
  --dh-danger-text: #c0605a;
  --dh-danger-bg: #fce8e6;
  --dh-danger-bg-2: #fde8e6;
  --dh-warn-text: #92400e;
  --dh-warn-bg: #fef3c7;
  --dh-modal-bg: #fff;
  --dh-modal-border: rgba(15, 23, 42, 0.06);
  --dh-modal-head-bg: linear-gradient(165deg, #fffbeb 0%, #fff 55%);
  --dh-modal-hairline: #f1f5f9;
  --dh-modal-title: #0f172a;
  --dh-modal-sub: #64748b;
  --dh-modal-close-bg: rgba(255, 255, 255, 0.85);
  --dh-modal-close-bg-hover: #fff;
  --dh-modal-field-bg: #f8fafc;
  --dh-modal-field-border: #e2e8f0;
  --dh-modal-input-bg: #fff;
  --dh-modal-input-border: #cbd5e1;
  --dh-modal-label: #94a3b8;
}

:root[data-theme="dark"] {
  --dh-bg: #12171f;
  --dh-text: #eef2f7;
  --dh-text-2: #d3dae4;
  --dh-muted: #a9b6c4;
  --dh-muted-2: #8b9aad;
  --dh-muted-3: #7a8ba0;
  --dh-section-bg: #1c2433;
  --dh-tile-bg: #232d40;
  --dh-tile-bg-hover: #2a3548;
  --dh-hairline: rgba(255, 255, 255, 0.08);
  --dh-field-border: rgba(255, 255, 255, 0.16);
  --dh-field-border-hover: rgba(255, 255, 255, 0.28);
  --dh-field-bg: #232d40;
  --dh-accent: #3d9cf0;
  --dh-plug-on-bg: rgba(52, 211, 153, 0.14);
  --dh-plug-power-text: var(--dh-text-2);
  --dh-plug-flash-ok-bg: rgba(52, 211, 153, 0.14);
  --dh-plug-flash-ok-text: #6ee7b7;
  --dh-plug-flash-err-bg: rgba(240, 113, 105, 0.14);
  --dh-plug-flash-err-text: #f0908a;
  --dh-danger-text: #f0908a;
  --dh-danger-bg: rgba(240, 113, 105, 0.12);
  --dh-danger-bg-2: rgba(240, 113, 105, 0.12);
  --dh-warn-text: #fbbf24;
  --dh-warn-bg: rgba(251, 191, 36, 0.14);
  --dh-modal-bg: #1c2433;
  --dh-modal-border: rgba(255, 255, 255, 0.08);
  --dh-modal-head-bg: linear-gradient(165deg, #2a2410 0%, #1c2433 55%);
  --dh-modal-hairline: rgba(255, 255, 255, 0.08);
  --dh-modal-title: #eef2f7;
  --dh-modal-sub: #a9b6c4;
  --dh-modal-close-bg: rgba(255, 255, 255, 0.06);
  --dh-modal-close-bg-hover: rgba(255, 255, 255, 0.1);
  --dh-modal-field-bg: #232d40;
  --dh-modal-field-border: rgba(255, 255, 255, 0.14);
  --dh-modal-input-bg: #1c2433;
  --dh-modal-input-border: rgba(255, 255, 255, 0.2);
  --dh-modal-label: #8b9aad;
}

body:has(.dash) {
  margin: 0;
  min-height: 100vh;
  background: var(--dh-bg);
}

.dash {
  box-sizing: border-box;
  max-width: 1600px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 0 1.25rem 2.5rem;
  color: var(--dh-text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.45;
}

/* Páginas próprias sem hero (AC, Tomadas, Persianas): respiro no topo antes do primeiro card. */
.dash--standalone {
  padding-top: 0.75rem;
  margin-top: 1rem;
}

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

/* ── Topbar ── */
.dash__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 0 0.5rem;
  margin-bottom: 0.5rem;
}

.dash__title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  color: #1c2433;
  letter-spacing: -0.01em;
}

.dash__title a {
  color: inherit;
  text-decoration: none;
}

.dash__title a:hover {
  color: #217dbb;
}

/* ── Main grid (hero + sections flow) ── */
.dash__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.dash__grid > turbo-frame {
  display: contents;
}

/* Tempo + produção solar: 100% cada em mobile; metade/metade a partir de 640px */
.dash__hero-solar-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.dash__hero-solar-row > turbo-frame {
  display: block;
  min-width: 0;
}

.dash__hero-solar-row > .dash__hero {
  min-width: 0;
}

@media (min-width: 640px) {
  .dash__hero-solar-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }

  .dash__hero-solar-row .dash__hero,
  .dash__hero-solar-row .dash__section {
    height: 100%;
  }

  .dash__hero-solar-row .dash__forecast {
    max-width: 100%;
  }

  .dash__hero-solar-row .dash__hero {
    padding: 0.85rem 0.4rem 0.75rem;
    gap: 0.5rem;
  }

  .dash__hero-solar-row .dash__clock-time {
    font-size: clamp(2.15rem, 4.5vw, 3.75rem);
  }

  .dash__hero-solar-row .dash__weather-temp {
    font-size: clamp(1.25rem, 5vw, 1.8rem);
  }

  /* Previsão na metade estreita: 4 dias em mobile */
  .dash__hero-solar-row .dash__forecast-day:nth-child(n + 5) {
    display: none;
  }
}

@media (min-width: 640px) and (max-width: 767.98px) {
  .dash__hero-solar-row .dash__forecast-day:nth-child(n + 5) {
    display: none;
  }
}

@media (min-width: 768px) {
  .dash__hero-solar-row .dash__forecast-day:nth-child(n + 5) {
    display: flex;
  }

  .dash__hero-solar-row .dash__forecast-day:nth-child(n + 9) {
    display: none;
  }
}

@media (min-width: 640px) {
  .dash__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1400px) {
  .dash__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ── Hero: clock + weather ── */
.dash__hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 0.5rem 1rem;
  background: #fff;
  border-radius: 1.25rem;
}

.dash__clock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}

.dash__clock-time {
  font-size: 3.75rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #1c2433;
  line-height: 1;
  letter-spacing: -0.02em;
}

.dash__clock-time::after {
  content: attr(data-seconds);
  font-size: 0.6rem;
  font-weight: 600;
  color: #a0aec0;
  vertical-align: super;
  margin-left: 0.12rem;
}

.dash__clock-date {
  font-size: 0.72rem;
  font-weight: 500;
  color: #8895a7;
  letter-spacing: 0.02em;
}

/* ── Weather ── */
.dash__weather {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  margin-top: 0.25rem;
}

.dash__weather-icon {
  font-size: 2.2rem;
  line-height: 1;
}

.dash__weather-main {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.dash__weather-temp {
  font-size: 1.8rem;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  color: #1c2433;
  line-height: 1;
  letter-spacing: -0.02em;
}

.dash__weather-desc {
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7b8d;
}

.dash__weather-details {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.2rem;
}

.dash__weather-detail {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.62rem;
  font-weight: 500;
  color: #8895a7;
}

.dash__weather-detail svg {
  flex-shrink: 0;
  opacity: 0.45;
}

.dash__weather-location {
  font-size: 0.56rem;
  font-weight: 600;
  color: #b0bac6;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 0.15rem;
}

/* Rodapé do hero tempo: «Previsão» à esquerda, «Próxima verificação» à direita (como Growatt). */
.dash__hero-weather-footer {
  display: flex;
  align-items: baseline;
  align-self: stretch;
  width: 100%;
  margin-top: auto;
  padding-top: 0.45rem;
  gap: 0.5rem;
}

.dash__hero-weather-footer__left {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-right: auto;
  min-width: 0;
}

.dash__refresh-weather-form {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  display: inline;
}

.dash__refresh-weather-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.dash__refresh-weather-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: rgba(0, 0, 0, 0.6);
}

.dash__refresh-weather-btn--inline {
  position: static;
  flex-shrink: 0;
}

.dash__weather-next {
  flex-shrink: 0;
  text-align: right;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* ── Forecast ──
   A API devolve 10 dias; no cartão: 4 (mobile), 8 (≥768). Link abre os 10. */
.dash__forecast {
  display: flex;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 0.35rem;
  width: 100%;
  max-width: 26rem;
  margin-top: 0.35rem;
}

.dash__forecast-day:nth-child(n + 5) {
  display: none;
}

@media (min-width: 640px) {
  .dash__forecast {
    max-width: 30rem;
    gap: 0.4rem;
  }
}

@media (min-width: 768px) {
  .dash__forecast {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    flex-wrap: unset;
    justify-content: unset;
    row-gap: 0.4rem;
    column-gap: 0.4rem;
    max-width: 44rem;
  }

  .dash__forecast-day:nth-child(n + 5) {
    display: flex;
  }

  .dash__forecast-day:nth-child(n + 9) {
    display: none;
  }
}

@media (min-width: 1280px) {
  .dash__forecast {
    max-width: min(100%, 52rem);
    row-gap: 0.45rem;
    column-gap: 0.45rem;
  }
}

.dash__forecast-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.18rem;
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.3rem;
  border-radius: 0.85rem;
  background: #eef2f7;
  transition: background 0.15s;
}

@media (min-width: 768px) {
  .dash__forecast-day {
    flex: unset;
    width: auto;
  }
}

button.dash__forecast-day {
  appearance: none;
  border: none;
  margin: 0;
  width: 100%;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  text-align: center;
}

button.dash__forecast-day:focus-visible {
  outline: 2px solid #5b8db8;
  outline-offset: 2px;
}

button.dash__forecast-day:hover {
  background: #e4eaf3;
}

button.dash__forecast-day.dash__forecast-day--today:hover {
  background: #cdd9e8;
}

.dash__forecast-day--today {
  background: #d6e0ed;
}

.dash__forecast-label {
  font-size: 0.55rem;
  font-weight: 600;
  color: #8895a7;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dash__forecast-day--today .dash__forecast-label {
  color: #3b6b9a;
}

.dash__forecast-icon {
  font-size: 2.5rem;
  line-height: 1;
}

.dash__forecast-temps {
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  color: #1c2433;
}

.dash__forecast-temps strong {
  font-weight: 700;
}

.dash__forecast-temps small {
  font-weight: 500;
  color: #a0aec0;
  margin-left: 0.15rem;
}

.dash__forecast-rain {
  font-size: 0.5rem;
  font-weight: 600;
  color: #5b8db8;
  padding: 0.1rem 0.3rem;
  background: #d6e4f0;
  border-radius: 999px;
}

.dash__forecast-rain--none {
  opacity: 0.2;
}

.dash__forecast-pv {
  font-size: 0.52rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #2d6a4f;
  margin-top: 0.05rem;
  text-align: center;
  line-height: 1.2;
  max-width: 100%;
}

.dash__forecast-day--today .dash__forecast-pv {
  color: #1b4332;
}

.dash__forecast-pv-hint {
  margin: 0.5rem 0 0;
  max-width: 28rem;
  padding: 0 0.5rem;
  font-size: 0.58rem;
  font-weight: 500;
  line-height: 1.35;
  color: #8895a7;
  text-align: center;
}

.dash__forecast-pv-hint code {
  font-size: 0.9em;
  color: #5a6b7d;
}

/* Link «Previsão 10 dias» — abre modal com a lista completa. */
.dash__forecast-modal-trigger {
  display: block;
}

/* ── Sections ── */
.dash__section {
  background: var(--dh-section-bg);
  border-radius: 1.25rem;
  padding: 0.85rem 1rem 1rem;
}

@media (min-width: 640px) {
  .dash__section--wide {
    grid-column: span 2;
  }
}

.dash__section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0 0 0.55rem;
}

.dash__section-title {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--dh-text-2);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.dash__section-icon {
  flex-shrink: 0;
  color: #d4a843;
  width: 1.15rem;
  height: 1.15rem;
}

.dash__section-title:has(.dash__section-icon[stroke]) .dash__section-icon {
  color: #5b8db8;
}

.dash__section-head-right {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.dash__sensibo-app-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0.18rem 0.45rem;
  border-radius: 0.45rem;
  color: #0aa3c9;
  background: rgba(10, 163, 201, 0.12);
  line-height: 0;
  transition: background 0.15s ease, transform 0.12s ease;
}

.dash__sensibo-app-link:hover {
  background: rgba(10, 163, 201, 0.2);
}

.dash__sensibo-app-link:active {
  transform: scale(0.98);
}

.dash__sensibo-app-logo {
  display: block;
  height: 1.08rem;
  width: auto;
  max-height: 1.35rem;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.dash__section-updated {
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--dh-muted-3);
  padding: 0.15rem 0.45rem;
  background: var(--dh-tile-bg);
  border-radius: 999px;
}

.dash__section-refresh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.22rem;
  border: none;
  border-radius: 0.4rem;
  background: transparent;
  color: var(--dh-muted-3);
  cursor: pointer;
  line-height: 0;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.dash__section-refresh-btn:hover {
  background: var(--dh-tile-bg);
  color: var(--dh-text-2);
}

.dash__section-refresh-btn:active {
  transform: rotate(180deg);
}

.dash__section-count {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--dh-muted-2);
  padding: 0.15rem 0.45rem;
  background: var(--dh-tile-bg);
  border-radius: 999px;
}

.dash__subhead {
  margin: 0.15rem 0 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  font-size: 0.62rem;
  font-weight: 700;
  color: #7b8aa0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.dash__shutters + .dash__subhead {
  margin-top: 0.75rem;
}

.dash__hint {
  margin: 0.5rem 0;
  padding: 0.75rem 0.85rem;
  font-size: 0.78rem;
  color: var(--dh-muted);
  background: var(--dh-tile-bg);
  border-radius: 0.75rem;
}

.dash__hint code {
  font-size: 0.85em;
  color: var(--dh-danger-text);
  padding: 0.1rem 0.3rem;
  background: var(--dh-danger-bg-2);
  border-radius: 0.25rem;
}

.dash__hint--warn {
  color: var(--dh-warn-text);
  background: var(--dh-warn-bg);
}

.dash__error {
  margin: 0.5rem 0;
  padding: 0.55rem 0.75rem;
  font-size: 0.78rem;
  color: var(--dh-danger-text);
  background: var(--dh-danger-bg);
  border-radius: 0.75rem;
}

.dash__section-link {
  padding: 0.45rem 0 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.dash__section-link--next-only {
  justify-content: flex-end;
}

.dash__next-check {
  font-size: 0.58rem;
  color: #b0bec5;
  white-space: nowrap;
}

.dash__link {
  font-size: 0.7rem;
  font-weight: 600;
  color: #5b8db8;
  text-decoration: none;
}

.dash__link:hover {
  text-decoration: underline;
}

/* Botão com aspeto de .dash__link (não usar font: inherit — quebrava tipografia do link). */
button.dash__link--unstyled {
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-align: inherit;
  font-family: inherit;
}

.dash__weather-modal-sub {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.65rem;
  font-weight: 500;
  color: #8895a7;
  letter-spacing: 0.02em;
}

.dash__weather-modal-body {
  padding-top: 0.65rem;
}

.dash__weather-modal-days {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.dash__weather-modal-day {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.75rem;
  background: #fff;
  border: 1px solid #e8ecf2;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.dash__weather-modal-day--today {
  background: #fff;
  border-color: rgba(91, 141, 184, 0.35);
  box-shadow: 0 1px 4px rgba(91, 141, 184, 0.1);
}

.dash__weather-modal-day-main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}

.dash__weather-modal-day-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #1c2433;
}

.dash__weather-modal-day-date {
  display: block;
  margin-top: 0.08rem;
  font-size: 0.62rem;
  font-weight: 500;
  color: #94a3b8;
  text-transform: none;
}

.dash__weather-modal-day-icon {
  flex-shrink: 0;
  font-size: 1.85rem;
  line-height: 1;
}

.dash__weather-modal-day-desc {
  font-size: 0.62rem;
  font-weight: 500;
  color: #64748b;
  line-height: 1.3;
}

.dash__weather-modal-day-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.dash__weather-modal-day-temps {
  font-size: 0.8rem;
  color: #1c2433;
}

.dash__weather-modal-day-temps strong {
  font-weight: 700;
}

.dash__weather-modal-day-tmin {
  margin-left: 0.25rem;
  font-weight: 500;
  color: #94a3b8;
}

.dash__weather-modal-day-rain {
  font-size: 0.58rem;
  font-weight: 600;
  color: #5b8db8;
}

.dash__weather-modal-day-rain--none {
  opacity: 0.2;
}

.dash__weather-modal-day-pv {
  font-size: 0.58rem;
  font-weight: 700;
  color: #2d6a4f;
}

.dash__weather-modal-hint {
  margin: 0.85rem 0 0;
  font-size: 0.65rem;
  line-height: 1.4;
  color: #8895a7;
}

.dash__weather-modal-hint code {
  font-size: 0.9em;
  color: #5a6b7d;
}

/* ── Previsão por horas (modal) ── */
.dash__weather-hourly-modal .dash__home-modal-title span:first-child {
  display: block;
}

.dash__weather-hourly-body {
  padding-top: 0.25rem;
  min-height: 4rem;
}

.dash__weather-hourly-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  border: 1px solid #e2e8f0;
  border-radius: 0.65rem;
  overflow: hidden;
  background: #fff;
}

.dash__weather-hourly-list-head,
.dash__weather-hourly-row {
  display: grid;
  grid-template-columns: 4rem 2.5rem minmax(0, 1fr) 3.25rem;
  align-items: center;
  gap: 0.5rem;
}

.dash__weather-hourly-list--pv .dash__weather-hourly-list-head,
.dash__weather-hourly-list--pv .dash__weather-hourly-row {
  grid-template-columns: 4rem 2.5rem minmax(0, 1fr) 2.85rem 3.35rem;
}

.dash__weather-hourly-list-head {
  padding: 0.4rem 0.65rem 0.35rem;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
}

.dash__weather-hourly-list-head-rain,
.dash__weather-hourly-list-head-fv {
  text-align: right;
}

.dash__weather-hourly-list-head-fv {
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 0.56rem;
  font-weight: 700;
  color: #2d6a4f;
}

.dash__weather-hourly-row {
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid #f1f5f9;
  background: #fff;
}

.dash__weather-hourly-row:last-of-type {
  border-bottom: none;
}

.dash__weather-hourly-row:nth-of-type(even) {
  background: #f8fafc;
}

.dash__weather-hourly-row--current {
  background: #e8f1f9 !important;
  box-shadow: inset 3px 0 0 #5b8db8;
}

.dash__weather-hourly-row-time {
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  font-variant-numeric: tabular-nums;
}

.dash__weather-hourly-row-icon {
  font-size: 1.35rem;
  line-height: 1;
  text-align: center;
}

.dash__weather-hourly-row-temp {
  font-size: 0.88rem;
  font-weight: 700;
  color: #1c2433;
  font-variant-numeric: tabular-nums;
}

.dash__weather-hourly-row-rain {
  font-size: 0.72rem;
  font-weight: 600;
  color: #5b8db8;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Avisos do IPMA nos dias da previsão: etiquetas na modal (cor do nível) e ⚠ no card do tempo. */
.dash__weather-avisos {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.2rem;
}

.dash__weather-aviso {
  display: inline-flex;
  align-items: center;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}

.dash__weather-aviso--yellow { background: #fef08a; color: #713f12; }
.dash__weather-aviso--orange { background: #fdba74; color: #7c2d12; }
.dash__weather-aviso--red { background: #fca5a5; color: #7f1d1d; }

.dash__forecast-aviso {
  margin-left: 0.2rem;
  padding: 0 0.2rem;
  border-radius: 0.3rem;
  font-size: 0.7rem;
}

/* Modais da previsão: botão «atualizar» no cabeçalho, antes do fechar. */
.dash__weather-modal-refresh-form {
  display: inline-flex;
  margin: 0 0 0 auto;
  align-self: center;
}

.dash__weather-modal-refresh {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid #c9d3df;
  border-radius: 999px;
  background: #fff;
  color: #1c2433;
  cursor: pointer;
}

.dash__weather-modal-refresh:hover {
  border-color: #217dbb;
  color: #217dbb;
}

/* A enviar: o ícone roda até a página voltar. */
.dash__weather-modal-refresh-form:has(:disabled) svg,
.dash__weather-modal-refresh-form[aria-busy="true"] svg {
  animation: dash-rodar 0.9s linear infinite;
}

@keyframes dash-rodar {
  to {
    transform: rotate(360deg);
  }
}

/* mm de chuva previstos nessa hora, por baixo da probabilidade. */
.dash__weather-hourly-row-mm {
  display: block;
  font-size: 0.64rem;
  font-weight: 700;
  color: #2563eb;
  white-space: nowrap;
}

.dash__weather-hourly-row-rain--none {
  opacity: 0.35;
}

.dash__weather-hourly-row-pv {
  font-size: 0.72rem;
  font-weight: 700;
  color: #2d6a4f;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.dash__weather-hourly-row-pv--none {
  opacity: 0.4;
}

.dash__weather-hourly-row-pv--na {
  font-weight: 600;
  color: #94a3b8;
  opacity: 0.65;
}

.dash__weather-hourly-empty {
  padding: 1rem 0.35rem 0.5rem;
  text-align: center;
}

.dash__weather-hourly-empty-title {
  margin: 0 0 0.4rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: #1c2433;
}

.dash__weather-hourly-empty-text {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.45;
  color: #64748b;
}

/* ── Confirm modal (dashboard) ── */
.dash__confirm {
  border: none;
  padding: 0;
  width: min(26rem, calc(100vw - 1.25rem));
  border-radius: 1rem;
  background: transparent;
}

.dash__confirm::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.dash__confirm-panel {
  background: #fff;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.18);
}

.dash__confirm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #eef2f7;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.dash__confirm-head-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.dash__confirm-icon {
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 0.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.06);
  color: #0b1220;
  flex: 0 0 auto;
}

.dash__confirm-head-txt {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.dash__confirm-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #1c2433;
  letter-spacing: -0.01em;
}

.dash__confirm-sub {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(71, 85, 105, 0.85);
}

.dash__confirm-x {
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.05);
  color: #3d4f63;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.dash__confirm-x:hover {
  background: rgba(0, 0, 0, 0.09);
}

.dash__confirm-body {
  padding: 0.9rem 1rem 0.4rem;
}

.dash__confirm-kicker {
  margin: 0 0 0.2rem;
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(100, 116, 139, 0.9);
}

.dash__confirm-action {
  margin: 0 0 0.55rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.92rem;
  font-weight: 750;
  color: #0b1220;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash__confirm-action-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash__confirm-preview {
  width: 3.35rem;
  height: 3.75rem;
  border-radius: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.03);
  border: 1px solid rgba(15, 23, 42, 0.10);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.10);
  flex: 0 0 auto;
}

.dash__confirm-preview-window {
  position: relative;
  width: 2.55rem;
  height: 3.05rem;
  border-radius: 0.7rem;
  overflow: hidden;
  border: 2px solid #c8d5e3;
}

.dash__confirm-preview-glass {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #d4eafc 0%, #a8d4f5 100%);
}

.dash__confirm-preview-blind {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0%;
  background: repeating-linear-gradient(
    180deg,
    #8a9bb0 0px,
    #8a9bb0 3px,
    #7b8da2 3px,
    #7b8da2 4px
  );
  border-bottom: 2px solid #6b7d92;
  transition: height 0.2s ease;
}

.dash__confirm-preview-emoji {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  z-index: 1;
  line-height: 1;
}

.dash__confirm-preview--open .dash__confirm-preview-window { border-color: #7cb8d8; }
.dash__confirm-preview--half .dash__confirm-preview-window { border-color: #a0b8cc; }
.dash__confirm-preview--low .dash__confirm-preview-window { border-color: #b0bcc8; }
.dash__confirm-preview--closed .dash__confirm-preview-window { border-color: #a0aab5; }

.dash__confirm-preview--closed .dash__confirm-preview-glass {
  background: linear-gradient(180deg, #c5cdd6 0%, #b0bac4 100%);
}

.dash__confirm-msg {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
  line-height: 1.35;
}

.dash__confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.65rem 1rem 0.95rem;
}

.dash__confirm-btn {
  border: none;
  border-radius: 0.6rem;
  padding: 0.55rem 0.8rem;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
}

.dash__confirm-btn--ghost {
  background: #eef2f7;
  color: #334155;
}

.dash__confirm-btn--ghost:hover {
  background: #e4eaf2;
}

.dash__confirm-btn--primary {
  background: #0b1220;
  color: #fff;
}

.dash__confirm-btn--primary:hover {
  filter: brightness(1.06);
}

/* ── Confirm modal: online check strip ── */
.dash__confirm-online {
  margin: 0;
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  transition: background 0.2s;
}

.dash__confirm-online-inner {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.dash__confirm-online-icon {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.dash__confirm-online--loading {
  color: #64748b;
  background: #f8fafc;
}

.dash__confirm-online--ok {
  color: #15803d;
  background: #f0fdf4;
}

.dash__confirm-online--warn {
  color: #b45309;
  background: #fffbeb;
}

.dash__confirm-online--error {
  color: #b91c1c;
  background: #fef2f2;
}

@keyframes dash-spin {
  to { transform: rotate(360deg); }
}

.dash__confirm-online-spinner {
  animation: dash-spin 1s linear infinite;
}

.dash__confirm-online-devices {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.dash__confirm-online-dev {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  font-weight: 500;
}

.dash__confirm-online-dev small {
  margin-left: auto;
  font-weight: 600;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dash__confirm-online-dot {
  font-size: 0.55rem;
  line-height: 1;
}

.dash__confirm-online-dev--on {
  color: #15803d;
}

.dash__confirm-online-dev--off {
  color: #b91c1c;
}

/* ── Sensibo modal (dashboard) ── */
.dash__sensibo-dialog {
  border: none;
  padding: 0;
  width: min(52rem, calc(100vw - 1.25rem));
  max-height: min(92vh, 56rem);
  max-height: min(92dvh, 56rem);
  border-radius: 1rem;
  background: transparent;
}

.dash__sensibo-dialog::backdrop {
  background: rgba(15, 23, 42, 0.48);
}

.dash__sensibo-dialog-panel {
  display: flex;
  flex-direction: column;
  max-height: min(92vh, 56rem);
  max-height: min(92dvh, 56rem);
  background: #fff;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.14);
  position: relative;
}

.dash__sensibo-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #eef2f7;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.dash__sensibo-dialog-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #1c2433;
  letter-spacing: -0.01em;
}

.dash__sensibo-dialog-close {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.05);
  color: #3d4f63;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s;
}

.dash__sensibo-dialog-close:hover {
  background: rgba(0, 0, 0, 0.09);
}

.dash__sensibo-dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0.85rem 1rem 1.25rem;
  -webkit-overflow-scrolling: touch;
  color: #1c2433;
}

.dash__sensibo-dialog-loading {
  padding: 1rem;
  font-size: 0.85rem;
  color: #64748b;
}

/* O UI do Sensibo (application.css) é dark; no modal do dashboard forçamos "light". */
.dash__sensibo-dialog-body .sensibo {
  background: transparent;
  color: #1c2433;
}

.dash__sensibo-dialog-body .sensibo__option-loader {
  background: rgba(255, 255, 255, 0.9);
}

/* ── Modal: histórico de temperatura (card «Temperaturas») ── */
.dash__temp-tile {
  cursor: pointer;
}

.dash__temp-history-dialog {
  border: none;
  padding: 0;
  width: min(42rem, calc(100vw - 1.25rem));
  max-height: min(92vh, 40rem);
  max-height: min(92dvh, 40rem);
  border-radius: 1rem;
  background: transparent;
}

.dash__temp-history-dialog::backdrop {
  background: rgba(15, 23, 42, 0.48);
}

.dash__temp-history-dialog-panel {
  display: flex;
  flex-direction: column;
  max-height: min(92vh, 40rem);
  max-height: min(92dvh, 40rem);
  background: #fff;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.14);
  position: relative;
}

.dash__temp-history-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #eef2f7;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}

.dash__temp-history-dialog-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #1c2433;
  letter-spacing: -0.01em;
}

.dash__temp-history-dialog-close {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.05);
  color: #3d4f63;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s;
}

.dash__temp-history-dialog-close:hover {
  background: rgba(0, 0, 0, 0.09);
}

.dash__temp-history-dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0.85rem 1rem 1.25rem;
  -webkit-overflow-scrolling: touch;
  color: #1c2433;
}

.dash__temp-history-dialog-loading {
  padding: 1rem;
  font-size: 0.85rem;
  color: #64748b;
}

.dash__temp-history-device-name {
  margin: 0 0 0.15rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #1c2433;
}

.dash__temp-history-range {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  color: #64748b;
}

.dash__temp-history-chart-host {
  position: relative;
  height: 18rem;
}

.dash__temp-history-plot {
  position: relative;
  height: 100%;
}

.dash__temp-history-empty {
  padding: 1rem 0;
  font-size: 0.85rem;
  color: #64748b;
}

/* ── Energy flow diagram ── */
.ef {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 0.25rem 0 0.5rem;
}

.ef__cross {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-rows: auto auto auto;
  grid-template-areas:
    ". top ."
    "left flows right"
    ". bottom .";
  align-items: center;
  justify-items: center;
  column-gap: 0.15rem;
  row-gap: 0;
  width: 100%;
  max-width: 22rem;
  margin-inline: auto;
}

.ef__cross-cell--top { grid-area: top; width: 100%; }
.ef__cross-cell--left { grid-area: left; justify-self: end; }
.ef__cross-cell--flows { grid-area: flows; width: 5.5rem; min-width: 4.75rem; }
.ef__cross-cell--right { grid-area: right; justify-self: start; }
.ef__cross-cell--bottom { grid-area: bottom; width: 100%; }

.ef__col--home,
.ef__col--grid,
.ef__col--battery {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.ef__custo-rede {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  margin-top: 0.1rem;
  padding: 0 0.25rem;
  max-width: 11rem;
  text-align: center;
}

.ef__custo-rede-label {
  font-size: 0.58rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8895a7;
}

.ef__custo-rede-val {
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #b45309;
  line-height: 1.1;
}

.ef__col--grid-interactive {
  cursor: pointer;
  align-self: stretch;
  justify-content: center;
  padding: 0.45rem 0.4rem;
  margin: -0.2rem 0;
  border-radius: 0.55rem;
  transition: background 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.ef__col--grid-interactive:hover {
  background: rgba(148, 163, 184, 0.12);
}

.ef__col--grid-interactive:focus,
.ef__col--grid-interactive:focus-visible {
  outline: none;
}

.ef__col--home-interactive {
  cursor: pointer;
  align-self: stretch;
  justify-content: center;
  padding: 0.45rem 0.4rem;
  margin: -0.2rem 0;
  border-radius: 0.55rem;
  transition: background 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.ef__col--home-interactive:hover {
  background: rgba(91, 141, 184, 0.1);
}

.ef__col--home-interactive:focus,
.ef__col--home-interactive:focus-visible {
  outline: none;
}

.ef__col--battery-interactive {
  cursor: pointer;
  align-self: stretch;
  justify-content: center;
  padding: 0.45rem 0.4rem;
  margin: -0.2rem 0;
  border-radius: 0.55rem;
  transition: background 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.ef__col--battery-interactive:hover {
  background: rgba(34, 197, 94, 0.1);
}

.ef__col--battery-interactive:focus,
.ef__col--battery-interactive:focus-visible {
  outline: none;
}

.ef__flows {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1;
}

.ef__flow-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Esqueleto das três linhas (cinza) */
.ef__flow-bus {
  fill: none;
  stroke: #c8d3e0;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.ef__flow-path {
  fill: none;
  pointer-events: none;
}

.ef__flow-path--active {
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Uma cor por linha: painéis verde, rede vermelho (o sentido dos pontos distingue
   importar/exportar); bateria azul a carregar, vermelho a descarregar */
.ef__flow-path--solar {
  stroke: #2d6a4f;
}

.ef__flow-path--grid-import,
.ef__flow-path--grid-export {
  stroke: #c0605a;
}

.ef__flow-path--battery-charge {
  stroke: #1e4d8c;
}

.ef__flow-path--battery-discharge {
  stroke: #c0605a;
}

.ef__flow-dot {
  pointer-events: none;
}

.ef__flow-dot--solar {
  fill: #4ade80;
  filter: drop-shadow(0 0 2px rgba(74, 222, 128, 0.6));
}

.ef__flow-dot--grid-import,
.ef__flow-dot--grid-export {
  fill: #f87171;
  filter: drop-shadow(0 0 2px rgba(248, 113, 113, 0.5));
}

.ef__flow-dot--battery-charge {
  fill: #60a5fa;
  filter: drop-shadow(0 0 2px rgba(96, 165, 250, 0.55));
}

.ef__flow-dot--battery-discharge {
  fill: #f87171;
  filter: drop-shadow(0 0 2px rgba(248, 113, 113, 0.5));
}

/* Desktop/tablet — cruz central e ícones maiores */
@media (min-width: 541px) {
  .ef__cross-cell--flows {
    width: 8.75rem;
    min-width: 7.75rem;
  }

  .ef__col--grid-interactive,
  .ef__col--battery-interactive,
  .ef__node--battery {
    min-width: 180px;
  }

  .ef__cross-cell--flows .ef__flow-bus {
    stroke-width: 4;
  }

  .ef__cross-cell--flows .ef__flow-path--active {
    stroke-width: 5;
  }

  .ef__cross-cell--flows .ef__flow-dot {
    r: 5.5;
  }

  .ef__node-icon {
    min-height: 7.95rem;
  }

  .ef-icon {
    width: 7.65rem;
    height: 7.85rem;
  }

  .ef-icon--solar {
    width: 8.55rem;
    height: 8.4rem;
  }

  .ef-icon__deck {
    width: 5.6rem;
    height: 5.6rem;
    border-radius: 0.9rem;
  }

  .ef-icon__body {
    bottom: 2.2rem;
  }

  .ef-icon__body svg {
    height: 4.1rem;
  }

  .ef-icon--solar .ef-icon__body svg {
    height: 4.3rem;
  }

  .ef-icon--grid .ef-icon__body svg {
    height: 4.65rem;
  }

  .ef-icon--battery .ef-icon__body svg {
    height: 4.8rem;
  }

  .ef-icon--home .ef-icon__body {
    bottom: 2rem;
  }

  .ef-icon--home .ef-icon__body svg,
  .ef-icon--home .ef-icon__body .ef-home-img {
    height: 5.7rem;
  }
}

/* Ícones 3D — plataforma CSS + figura SVG limpa */
.ef-icon {
  position: relative;
  display: block;
  width: 5.25rem;
  height: 5.35rem;
  margin-inline: auto;
  perspective: 140px;
  perspective-origin: 50% 85%;
}

.ef-icon--solar {
  width: 5.9rem;
  height: 5.75rem;
}

.ef-icon__deck {
  position: absolute;
  left: 50%;
  bottom: 0.1rem;
  width: 4rem;
  height: 4rem;
  border-radius: 0.7rem;
  transform: translateX(-50%) rotateX(58deg) rotateZ(45deg);
  transform-style: preserve-3d;
  background: linear-gradient(145deg, #d4f5e4 0%, #bfe4ff 100%);
  box-shadow:
    0 6px 14px rgba(15, 23, 42, 0.1),
    0 1px 0 rgba(255, 255, 255, 0.7) inset;
}

.ef-icon--grid .ef-icon__deck {
  background: linear-gradient(145deg, #fde2e2 0%, #bfdbfe 100%);
}

.ef-icon__body {
  position: absolute;
  left: 50%;
  bottom: 1.62rem;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(15, 23, 42, 0.08));
}

.ef-icon__body svg {
  display: block;
  width: auto;
  height: 2.8rem;
}

.ef-icon--solar .ef-icon__body svg {
  height: 3rem;
}

.ef-icon--grid .ef-icon__body svg {
  height: 3.25rem;
}

.ef-icon--battery .ef-icon__body svg {
  height: 3.3rem;
}

.ef-icon--home .ef-icon__body {
  bottom: 1.4rem;
}

.ef-icon--home .ef-icon__body svg,
.ef-icon--home .ef-icon__body .ef-home-img {
  height: 3.9rem;
  width: auto;
}

/* Distintivo do carro a carregar no canto inferior direito da Casa (como o 🔌 da bateria) — só com CarroCarga ligado */
.ef-home-car {
  position: absolute;
  bottom: 0.35rem;
  right: -2.45rem;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 2.05rem;
}

.ef-home-car img {
  display: block;
  width: 3.85rem;
  height: auto;
}

/* Potência do carro, em pequeno por cima dele (o distintivo cresce para cima). */
.ef-home-car {
  flex-direction: column;
  justify-content: flex-end;
  height: auto;
}

.ef-home-car-w,
.ef-home-casa-w {
  margin-bottom: 0.05rem;
  padding: 0.05rem 0.3rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: #d64545; /* consumo (vermelho, como o custo da rede) */
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.15);
}

/* O resto da casa (sem o carro), por cima da casa, com o estilo do valor do carro. */
.ef-home-casa-w {
  position: absolute;
  top: -0.6rem;
  left: 50%;
  z-index: 2;
  transform: translateX(-50%);
}

/* Modal «Casa — consumo agora»: a carregar pela tomada BMW, o indicado à mão fica bloqueado. */
.dash__hc-car .dash__tou-switch:disabled,
.dash__hc-car .dash__hc-car-amps:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 540px) {
  .ef-home-car img {
    width: 2.85rem;
  }
}

.ef-home-img {
  display: block;
  object-fit: contain;
  object-position: center bottom;
}

.ef-home-iso {
  overflow: visible;
}

.ef-icon .ef__battery-soc {
  font-family: ui-sans-serif, system-ui, sans-serif;
}

/* Nodes — sem caixas; só ícone + texto */
.ef__node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.35rem 0.25rem;
  background: transparent;
  border: none;
  border-radius: 0;
}

.ef__node--solar {
  min-width: 0;
}

.ef__node--home,
.ef__node--grid,
.ef__node--grid.ef__node--export,
.ef__node--grid.ef__node--import {
  background: transparent;
  border: none;
}

.ef__node-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  min-height: 5.6rem;
}

.ef__node-val {
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #1c2433;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.ef__node-val small {
  font-size: 0.5em;
  font-weight: 500;
  color: #a0aec0;
}

.ef__node-val--pos { color: #3a7a3a; }
.ef__node-val--neg { color: #c0605a; }
/* Consumo da casa: sempre a vermelho. */
.ef__node--home .ef__node-val { color: #d64545; }
.ef__node-val--muted {
  color: #94a3b8;
  font-weight: 600;
}

.ef__node--soon {
  opacity: 0.5;
  pointer-events: none;
}

.ef__node--battery .ef__node-kwh {
  white-space: normal;
  text-align: center;
  max-width: 9rem;
  line-height: 1.25;
}

/* SOC placeholder dentro do ícone da bateria (diagrama Growatt) */
.ef__node--battery svg .ef__battery-soc {
  fill: #334155;
  font-weight: 700;
  font-family: ui-sans-serif, system-ui, sans-serif;
}

.ef__node-soon {
  font-size: 0.52rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #94a3b8;
  margin-top: 0.05rem;
}

.ef__node-label {
  font-size: 0.58rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8895a7;
}

/* Metade do ecrã (tempo + solar): diagrama compacto quando a coluna é estreita */
@media (min-width: 640px) and (max-width: 959px) {
  .dash__hero-solar-row #dash-solar {
    padding-left: 0.45rem;
    padding-right: 0.45rem;
    overflow: visible;
  }

  .dash__hero-solar-row .ef {
    gap: 0.45rem;
    padding: 0.1rem 0 0.3rem;
    overflow: visible;
  }

  .dash__hero-solar-row .ef__cross {
    width: 100%;
    max-width: 100%;
    margin-inline: 0;
    column-gap: 0.65rem;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-areas:
      "top top top"
      "left flows right"
      "bottom bottom bottom";
    overflow: visible;
  }

  .dash__hero-solar-row .ef__cross-cell--flows {
    width: 6.5rem;
    min-width: 6rem;
    justify-self: center;
  }
}

/* Telemóvel — diagrama de fluxo compacto para caber no ecrã */
@media (max-width: 540px) {
  #dash-solar {
    padding-left: 0.45rem;
    padding-right: 0.45rem;
    overflow: visible;
  }

  .ef {
    gap: 0.45rem;
    padding: 0.1rem 0 0.3rem;
    overflow: visible;
  }

  .ef__cross {
    width: 100%;
    max-width: 100%;
    margin-inline: 0;
    column-gap: 1rem;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-areas:
      "top top top"
      "left flows right"
      "bottom bottom bottom";
    overflow: visible;
  }

  .ef__cross-cell--flows {
    width: 7.75rem;
    min-width: 7.25rem;
    justify-self: center;
  }

  .ef__cross-cell--flows .ef__flow-bus {
    stroke-width: 4;
  }

  .ef__cross-cell--flows .ef__flow-path--active {
    stroke-width: 5;
  }

  .ef__cross-cell--flows .ef__flow-dot {
    r: 5.5;
  }

  .ef__cross-cell--left {
    justify-self: start;
    align-self: center;
    max-width: none;
    padding-left: 0;
  }

  .ef__cross-cell--right {
    justify-self: end;
    align-self: center;
    max-width: none;
    padding-right: 0;
  }

  .ef__cross-cell--left .ef__col--grid,
  .ef__cross-cell--right .ef__node--battery {
    align-items: center;
    text-align: center;
  }

  .ef__cross-cell--left .ef__node--grid .ef__node-val,
  .ef__cross-cell--left .ef__node--grid .ef__node-label,
  .ef__cross-cell--right .ef__node--battery .ef__node-val,
  .ef__cross-cell--right .ef__node--battery .ef__node-label,
  .ef__cross-cell--right .ef__node--battery .ef__node-kwh {
    text-align: center;
    width: 100%;
  }

  .ef__cross-cell--top,
  .ef__cross-cell--bottom {
    width: 100%;
    max-width: none;
  }

  .ef__pv-recent-stack {
    flex-wrap: nowrap;
    justify-content: center;
    gap: 0.15rem;
    margin-top: 0.12rem;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .ef__pv-recent-stack::-webkit-scrollbar {
    display: none;
  }

  .ef__pv-reading {
    flex-shrink: 0;
    font-size: 0.62rem;
    padding: 0.1rem 0.3rem;
  }

  .ef__col--grid-interactive,
  .ef__col--home-interactive,
  .ef__col--battery-interactive {
    padding-left: 0;
    padding-right: 0;
    margin: 0;
  }

  .ef__cross-cell--left .ef__col--grid-interactive,
  .ef__cross-cell--right .ef__node--battery {
    overflow: visible;
  }

  .ef__node {
    padding: 0.15rem 0.08rem;
    gap: 0.1rem;
  }

  .ef__node-icon {
    min-height: 4.25rem;
  }

  .ef-icon {
    width: 3.9rem;
    height: 4rem;
  }

  .ef-icon--solar {
    width: 4.4rem;
    height: 4.25rem;
  }

  .ef-icon__deck {
    width: 2.95rem;
    height: 2.95rem;
    border-radius: 0.55rem;
  }

  .ef-icon__body {
    bottom: 1.18rem;
  }

  .ef-icon__body svg {
    height: 2.1rem;
  }

  .ef-icon--solar .ef-icon__body svg {
    height: 2.25rem;
  }

  .ef-icon--grid .ef-icon__body svg {
    height: 2.4rem;
  }

  .ef-icon--battery .ef-icon__body svg {
    height: 2.45rem;
  }

  .ef-icon--home .ef-icon__body {
    bottom: 1rem;
  }

  .ef-icon--home .ef-icon__body svg,
  .ef-icon--home .ef-icon__body .ef-home-img {
    height: 2.85rem;
  }

  .ef__node-val {
    font-size: 0.82rem;
    letter-spacing: -0.035em;
    line-height: 1.05;
  }

  .ef__cross-cell--top .ef__node--solar .ef__node-val {
    font-size: 1.12rem;
  }

  .ef__cross-cell--bottom .ef__node--home .ef__node-val {
    font-size: 1.12rem;
  }

  .ef__cross-cell--top .ef__node--solar .ef__node-label,
  .ef__cross-cell--bottom .ef__node--home .ef__node-label {
    font-size: 0.58rem;
  }

  .ef__node-val small {
    font-size: 0.48em;
  }

  .ef__node-label {
    font-size: 0.5rem;
    letter-spacing: 0.04em;
    line-height: 1.1;
  }

  .ef__node-kwh {
    font-size: 0.56rem;
    white-space: normal;
    text-align: center;
    max-width: 100%;
    line-height: 1.2;
  }

  .ef__node--solar .ef__node-kwh,
  .ef__node--battery .ef__node-kwh,
  .ef__cross-cell--bottom .ef__node-kwh--carga-hoje {
    max-width: 10.5rem;
    font-size: 0.54rem;
    font-weight: 500;
    color: #8895a7;
    white-space: normal;
  }

  .ef__custo-rede {
    max-width: 6.5rem;
    margin-top: 0.05rem;
  }

  .ef__custo-rede-val {
    font-size: 1.05rem;
  }

  .ef__node--grid.ef__node--export .ef__node-val,
  .ef__node--grid.ef__node--import .ef__node-val,
  .ef__cross-cell--right .ef__node--battery .ef__node-val {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: baseline;
    justify-content: center;
    gap: 0.04em;
    box-sizing: border-box;
    max-width: 100%;
    margin-inline: auto;
    font-size: 1.05rem;
    line-height: 1.05;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
  }

  .ef__node--grid.ef__node--export .ef__node-val small,
  .ef__node--grid.ef__node--import .ef__node-val small,
  .ef__cross-cell--right .ef__node--battery .ef__node-val small {
    font-size: 0.46em;
    font-weight: 600;
    flex-shrink: 0;
    line-height: 1;
    align-self: flex-end;
    margin-left: 0.02em;
    color: inherit;
    opacity: 0.82;
  }

  .ef__cross-cell--right .ef__node--battery .ef__node-val--muted small {
    opacity: 1;
    color: #a0aec0;
  }

  .ef__node--grid.ef__node--export .ef__node-label,
  .ef__node--grid.ef__node--import .ef__node-label {
    font-size: 0.62rem;
    letter-spacing: 0.03em;
    line-height: 1.15;
    max-width: 5.5rem;
    white-space: normal;
    text-align: center;
    hyphens: none;
  }
}

@media (max-width: 380px) {
  .ef__cross {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }

  .ef__cross-cell--flows {
    width: 6.75rem;
    min-width: 6.25rem;
  }

  .ef__cross-cell--flows .ef__flow-bus {
    stroke-width: 3.5;
  }

  .ef__cross-cell--flows .ef__flow-path--active {
    stroke-width: 4.5;
  }

  .ef__cross-cell--flows .ef__flow-dot {
    r: 5;
  }

  .ef__node-val {
    font-size: 0.74rem;
  }

  .ef__cross-cell--top .ef__node--solar .ef__node-val,
  .ef__cross-cell--bottom .ef__node--home .ef__node-val {
    font-size: 1rem;
  }

  .ef__node--solar .ef__node-kwh,
  .ef__node--battery .ef__node-kwh,
  .ef__cross-cell--bottom .ef__node-kwh--carga-hoje {
    font-size: 0.5rem;
  }

  .ef__custo-rede-val {
    font-size: 0.96rem;
  }

  .ef__node--grid.ef__node--export .ef__node-val,
  .ef__node--grid.ef__node--import .ef__node-val {
    font-size: 0.96rem;
    letter-spacing: -0.04em;
  }

  .ef__node--grid.ef__node--export .ef__node-val small,
  .ef__node--grid.ef__node--import .ef__node-val small {
    font-size: 0.44em;
  }

  .ef__node--grid.ef__node--export .ef__node-label,
  .ef__node--grid.ef__node--import .ef__node-label {
    font-size: 0.58rem;
    max-width: 5rem;
  }

  .ef__pv-recent-stack {
    gap: 0.1rem;
  }

  .ef__pv-reading {
    font-size: 0.56rem;
    padding: 0.08rem 0.22rem;
  }
}

.ef__node-kwh {
  font-size: 0.68rem;
  font-weight: 500;
  color: #8895a7;
  margin-top: 0.05rem;
  white-space: nowrap;
}

/* Bateria hoje: +carregou (verde) / -descarregou (vermelho) */
.ef__node-kwh-in {
  font-weight: 700;
  color: #16a34a;
}

.ef__node-kwh-out {
  font-weight: 700;
  color: #dc2626;
}

/* Carregamento da rede (TOU) ativo, por baixo de «Descarregou hoje» */
.ef__node-kwh--tou {
  color: #6366f1;
  font-weight: 600;
}

.ef__node-kwh--tou-now {
  color: #4338ca;
}

.ef__node-kwh--tou-aviso {
  color: #b45309;
}

/* Últimas amostras FV na curva — sempre em linha */
.ef__pv-recent-stack {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 0.25rem;
  max-width: 100%;
}

.ef__pv-reading {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.2rem;
  padding: 0.18rem 0.42rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 600;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  border: 1px solid transparent;
}

.ef__pv-reading-arr {
  font-weight: 700;
  font-size: 0.68em;
  line-height: 1;
}

.ef__pv-reading--up {
  color: #1e5631;
  background: #d8f0e0;
  border-color: #9fd4b0;
}

.ef__pv-reading--down {
  color: #9b1c1c;
  background: #fde2e2;
  border-color: #f5b4b4;
}

/* Sob a Casa: consumo da rede no dia */
.ef__cross-cell--bottom .ef__node-kwh--carga-hoje {
  white-space: normal;
  text-align: center;
  max-width: 10.5rem;
  line-height: 1.25;
  color: #8895a7;
  margin-top: 0.15rem;
}

/* ── Growatt cards ── */
.dash__cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.dash__card {
  border-radius: 0.85rem;
  padding: 0.85rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  background: #eef2f7;
  transition: box-shadow 0.15s;
}

.dash__card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.dash__card--solar {
  background: linear-gradient(135deg, #fef8e8 0%, #faf0d8 100%);
}

.dash__card--power {
  background: linear-gradient(135deg, #e6f0e8 0%, #dce9de 100%);
}

.dash__card--consumption {
  background: linear-gradient(135deg, #e4edf6 0%, #dae4f0 100%);
}

.dash__card--balanco-pos {
  background: linear-gradient(135deg, #e6f0e8 0%, #dce9de 100%);
}

.dash__card--balanco-pos .dash__card-value {
  color: #3a7a3a;
}

.dash__card--balanco-neg {
  background: linear-gradient(135deg, #f6e6e4 0%, #f0dbd8 100%);
}

.dash__card--balanco-neg .dash__card-value {
  color: #b85c4a;
}

.dash__card-label {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8895a7;
}

.dash__card-value {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #1c2433;
  line-height: 1.15;
}

.dash__card-value small {
  font-size: 0.55em;
  font-weight: 500;
  color: #a0aec0;
}

.dash__card-duo {
  display: flex;
  gap: 0.65rem;
}

.dash__card-duo-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.dash__card-duo-item + .dash__card-duo-item {
  padding-left: 0.65rem;
  border-left: 1px solid rgba(0, 0, 0, 0.06);
}

/* ── AC grid ── */
.dash__ac-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.5rem;
}

/* ── AC card ── */
/* Frame do card do toalheiro (lista "AC"): o card lá dentro é que é o item da grelha. */
.dash__ac-frame {
  display: contents;
}

.dash__ac {
  border-radius: 0.85rem;
  border: none;
  background: #f5f7fa;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.15s;
}

.dash__ac:hover {
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.04);
  transform: translateY(-1px);
}

.dash__ac--on {
  background: #f5f7fa;
}

.dash__ac--off {
  background: #edf0f5;
}

.dash__ac--off .dash__ac-header {
  background: #e4e9f0;
}

.dash__ac--offline {
  opacity: 0.4;
  pointer-events: none;
}

/* O toalheiro offline continua a abrir o comando (a modal mostra o estado). */
.dash__ac--toalheiro.dash__ac--offline {
  pointer-events: auto;
}

/* ── AC header ── */
.dash__ac-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.8rem;
  background: #eaeff5;
}

.dash__ac--on .dash__ac-header {
  background: #e0ede3;
}

.dash__ac-header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.dash__ac-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.55rem;
  background: rgba(91, 141, 184, 0.08);
  color: #5b8db8;
  flex-shrink: 0;
}

.dash__ac--on .dash__ac-icon {
  color: #3a7a3a;
  background: rgba(58, 122, 58, 0.08);
}

.dash__ac-icon svg {
  width: 16px;
  height: 16px;
}

.dash__ac-name {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: #1c2433;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.dash__ac-status-label {
  display: block;
  font-size: 0.55rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.1rem;
}

.dash__ac-status-label--on { color: #3a7a3a; }
.dash__ac-status-label--off { color: #a0aec0; }
.dash__ac-status-label--offline { color: #a0aec0; }

/* ── AC toggle ── */
.dash__ac-toggle {
  position: relative;
  display: inline-block;
  width: 2.4rem;
  height: 1.3rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.2s;
}

.dash__ac-toggle--on { background: #3a7a3a; }
.dash__ac-toggle--off { background: #c8ced6; }

.dash__ac-toggle-knob {
  position: absolute;
  top: 0.15rem;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  transition: left 0.2s;
}

.dash__ac-toggle--on .dash__ac-toggle-knob { left: calc(100% - 1.15rem); }
.dash__ac-toggle--off .dash__ac-toggle-knob { left: 0.15rem; }

.dash__ac-toggle:hover { filter: brightness(0.95); }

.dash__ac-cmd {
  flex-shrink: 0;
  border: 1px solid rgba(91, 141, 184, 0.45);
  border-radius: 0.55rem;
  padding: 0.32rem 0.55rem;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #3d4f63;
  background: #e4edf6;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, filter 0.12s;
}

.dash__ac-cmd:hover:not(:disabled) {
  background: #d8e6f2;
  border-color: rgba(91, 141, 184, 0.65);
}

.dash__ac-cmd:active:not(:disabled) {
  filter: brightness(0.97);
}

.dash__ac-cmd:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.15);
}

.dash__ac-header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

/* ── AC environment ── */
.dash__ac-env {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.8rem 0.45rem;
}

.dash__ac-env-main {
  display: flex;
  flex-direction: column;
}

.dash__ac-room-temp {
  font-size: 2rem;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  color: #1c2433;
  line-height: 1;
  letter-spacing: -0.02em;
}

.dash__ac-room-label {
  font-size: 0.55rem;
  font-weight: 500;
  color: #a0aec0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.15rem;
}

.dash__ac-env-side {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.55rem;
  background: #dfe8f2;
  border-radius: 999px;
}

.dash__ac-hum-icon {
  color: #5b8db8;
  flex-shrink: 0;
  width: 13px;
  height: 13px;
}

.dash__ac-hum-val {
  font-size: 0.75rem;
  font-weight: 600;
  color: #4a7da6;
  font-variant-numeric: tabular-nums;
}

/* ── AC temp control ── */
.dash__ac-temp-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0 0.8rem 0.55rem;
}

.dash__ac-temp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: #5b8db8;
  background: #e4edf6;
  border: none;
  cursor: pointer;
  transition: background 0.12s, transform 0.1s;
}

.dash__ac-temp-btn:first-child { border-radius: 0.6rem 0 0 0.6rem; }
.dash__ac-temp-btn:last-child { border-radius: 0 0.6rem 0.6rem 0; }

.dash__ac-temp-btn:hover {
  background: #d0dfee;
  transform: scale(1.04);
}

.dash__ac-temp-btn:active {
  transform: scale(0.96);
}

.dash__ac-temp-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 4rem;
  height: 2.4rem;
  padding: 0 0.5rem;
  background: #eaeff5;
}

.dash__ac-temp-val {
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #1c2433;
  line-height: 1;
}

.dash__ac-temp-label {
  font-size: 0.45rem;
  font-weight: 500;
  color: #a0aec0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1;
  margin-top: 0.1rem;
}

/* ── AC pills ── */
.dash__ac-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0 0.8rem 0.55rem;
}

.dash__ac-pill {
  font-size: 0.58rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.dash__ac-pill--mode {
  background: #dfe8f2;
  color: #4a7da6;
}

.dash__ac-pill--fan {
  background: #e3eee5;
  color: #3a7a3a;
}

.dash__ac-pill--temp {
  background: #e4edf6;
  color: #3d4f63;
}

.dash__ac-pill--light {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.45rem;
}

.dash__ac-pill-light-ico {
  display: block;
  opacity: 0.95;
}

.dash__ac-pill--light-on {
  background: #e8f4ea;
  color: #2f6b45;
}

.dash__ac-pill--light-off {
  background: #eef2f7;
  color: #8b9aad;
}

.dash__ac-link {
  font-size: 0.62rem;
  font-weight: 600;
  color: #5b8db8;
  text-decoration: none;
  transition: color 0.12s;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
}

.dash__ac-link:hover {
  text-decoration: underline;
}

/* ── Shutters ── */
.dash__shutters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 0.5rem;
}

/* Estado das Persianas: 4 por linha */
.dash__shutters--status {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 639px) {
  .dash__shutters--status {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ── Modal de controlo de persiana ── */
.dash__blind-modal .dash__home-modal-panel {
  max-width: 22rem;
}

/* Topo: a janela com a persiana e, ao lado, a % em grande e o estado. */
.dash__blind-modal-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.4rem;
  padding: 1.1rem 1rem 1.2rem;
}

.dash__blind-modal-hero .dash__shutter-window--lg {
  flex: none;
  width: 6.2rem;
  height: 7.6rem;
  border-radius: 0.7rem;
  border-width: 3px;
  box-shadow: 0 10px 22px -12px rgba(20, 35, 90, 0.45);
}

.dash__blind-modal-readout {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 5.5rem;
}

.dash__blind-modal-pct {
  font-size: 2.6rem;
  font-weight: 750;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: #1c2433;
}

.dash__blind-modal-state {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7a8c;
}

/* Botões das posições (0 / 35 / 70 / 100%). */
.dash__blind-modal-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0 1rem;
}

.dash__blind-modal-btn {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.55rem 0.5rem;
  border: none;
  border-radius: 0.8rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.12s, transform 0.12s, background 0.12s;
  background: #eef1f5;
  color: #3d4f63;
}

.dash__blind-modal-btn:active {
  transform: scale(0.96);
}

.dash__blind-modal-btn:hover {
  filter: brightness(0.97);
}

/* Slider grosso, com a parte aberta preenchida (--pct posto pelo controller). */
.dash__blind-modal-slider-row {
  display: flex;
  align-items: center;
  padding: 1.1rem 1rem 0.4rem;
}

.dash__blind-modal-slider {
  --pct: 50%;
  flex: 1 1 0%;
  height: 2.25rem;
  margin: 0;
  padding: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}

.dash__blind-modal-slider::-webkit-slider-runnable-track {
  height: 0.7rem;
  border-radius: 999px;
  background: linear-gradient(90deg, #4aa3d8 var(--pct), #dbe4ee var(--pct));
}

.dash__blind-modal-slider::-moz-range-track {
  height: 0.7rem;
  border-radius: 999px;
  background: #dbe4ee;
}

.dash__blind-modal-slider::-moz-range-progress {
  height: 0.7rem;
  border-radius: 999px;
  background: #4aa3d8;
}

.dash__blind-modal-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1.75rem;
  height: 1.75rem;
  margin-top: -0.525rem;
  border-radius: 50%;
  background: #fff;
  border: none;
  box-shadow: 0 2px 8px rgba(20, 35, 90, 0.3), 0 0 0 1px rgba(20, 35, 90, 0.06);
  cursor: pointer;
}

.dash__blind-modal-slider::-moz-range-thumb {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: #fff;
  border: none;
  box-shadow: 0 2px 8px rgba(20, 35, 90, 0.3), 0 0 0 1px rgba(20, 35, 90, 0.06);
  cursor: pointer;
}

/* Posições por baixo do slider. */
.dash__blind-modal-actions--presets {
  align-items: center;
  padding-top: 0.2rem;
  padding-bottom: 0.4rem;
}

.dash__blind-modal-btn--preset {
  padding: 0.4rem 0.5rem;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

/* Zona de comandos: bloqueada (com loader) até o ping confirmar online */
.dash__blind-modal-controls {
  position: relative;
}

.dash__blind-modal-controls--locked .dash__blind-modal-actions,
.dash__blind-modal-controls--locked .dash__blind-modal-slider-row {
  opacity: 0.35;
  filter: grayscale(0.6);
  pointer-events: none;
}

.dash__blind-modal-controls button:disabled,
.dash__blind-modal-controls input:disabled {
  cursor: not-allowed;
}

.dash__blind-modal-lock {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #3d4f63;
  text-align: center;
}

.dash__blind-modal-lock[hidden] {
  display: none;
}

.dash__blind-modal-lock-text {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
}

.dash__blind-modal-lock {
  flex-direction: column;
}

.dash__blind-modal-retry {
  padding: 0.45rem 0.9rem;
  border: none;
  border-radius: 0.55rem;
  background: #4aa3d8;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.dash__blind-modal-retry:hover {
  filter: brightness(0.95);
}

.dash__blind-modal-retry[hidden] {
  display: none;
}

.dash__blind-modal-spinner {
  width: 1.4rem;
  height: 1.4rem;
  border: 3px solid #dbe4ee;
  border-top-color: #4aa3d8;
  border-radius: 50%;
  animation: dash-spin 0.8s linear infinite;
}

.dash__blind-modal-spinner[hidden] {
  display: none;
}

.dash__blind-modal-status {
  min-height: 1.1rem;
  margin: 0.4rem 1rem 0;
  font-size: 0.72rem;
  font-weight: 500;
  color: #64748b;
}

.dash__blind-modal-status--pending {
  color: #b58a2e;
}

.dash__blind-modal-status--ok {
  color: #3a7a3a;
}

.dash__blind-modal-status--error {
  color: #c0605a;
}

/* ── Modal de comando do AC (mesmo género da modal das persianas; compacta, sem scroll) ── */
.dash__ac-modal {
  width: min(27rem, calc(100vw - 1.25rem));
}

.dash__ac-modal .dash__home-modal-head {
  padding: 0.8rem 0.9rem 0.6rem;
}

/* O frame tem o cabeçalho + corpo; o corpo é que faz scroll (só se mesmo não couber). */
.dash__ac-modal-frame {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.dash__ac-modal .dash__ac-modal-body {
  padding: 0.35rem 0.75rem 0.8rem;
}

/* Cor do modo (fluxo de ar, slider, pill ativa). */
.dash__ac-modal-body {
  --ac-accent: #4aa3d8;
}
.dash__ac-modal-body--heat { --ac-accent: #ec8a3c; }
.dash__ac-modal-body--dry { --ac-accent: #26a69a; }
.dash__ac-modal-body--fan { --ac-accent: #5fae6b; }
.dash__ac-modal-body--auto { --ac-accent: #8b7cf0; }
.dash__ac-modal-body--off { --ac-accent: #9aa6b4; }

.dash__ac-modal-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 2rem 1rem;
  font-size: 0.82rem;
  color: #64748b;
}

/* Topo: unidade · temperatura alvo/estado/ambiente · botões redondos Ligar e Luz. */
.dash__ac-modal-hero {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.4rem 0.25rem 0.7rem;
}

.dash__ac-modal-unit {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  width: 4.6rem;
}

.dash__ac-modal-unit-body {
  position: relative;
  width: 100%;
  height: 1.85rem;
  border: 2.5px solid var(--ac-accent);
  border-radius: 0.5rem 0.5rem 0.75rem 0.75rem;
  background: linear-gradient(180deg, #fff 0%, #eef2f7 100%);
  box-shadow: 0 8px 18px -10px rgba(20, 35, 90, 0.45);
  transition: border-color 0.3s ease;
}

.dash__ac-modal-unit-led {
  position: absolute;
  top: 0.3rem;
  right: 0.4rem;
  width: 0.3rem;
  height: 0.3rem;
  border-radius: 50%;
  background: var(--ac-accent);
  box-shadow: 0 0 5px var(--ac-accent);
}

.dash__ac-modal-unit-vent {
  position: absolute;
  left: 0.45rem;
  right: 0.45rem;
  bottom: 0.28rem;
  height: 0.24rem;
  border-radius: 999px;
  background: repeating-linear-gradient(90deg, #8a9bb0 0 2px, #c8d5e3 2px 4px);
}

.dash__ac-modal-air {
  display: flex;
  gap: 0.5rem;
  height: 1.5rem;
}

.dash__ac-modal-air i {
  width: 0.26rem;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--ac-accent), transparent);
  transform-origin: top center;
  animation: dash-ac-air 1.8s ease-in-out infinite;
}

.dash__ac-modal-air i:nth-child(2) { animation-delay: 0.3s; }
.dash__ac-modal-air i:nth-child(3) { animation-delay: 0.6s; }

@keyframes dash-ac-air {
  0%, 100% { opacity: 0.3; transform: scaleY(0.6); }
  50% { opacity: 1; transform: scaleY(1); }
}

.dash__ac-modal-body--off .dash__ac-modal-air i {
  animation: none;
  opacity: 0.18;
  transform: scaleY(0.6);
}

.dash__ac-modal-body--off .dash__ac-modal-unit-led {
  background: #c8d5e3;
  box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  .dash__ac-modal-air i { animation: none; opacity: 0.8; }
}

.dash__ac-modal-readout {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.dash__ac-modal-target {
  font-size: 2.1rem;
  font-weight: 750;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: #1c2433;
}

.dash__ac-modal-state {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ac-accent);
}

.dash__ac-modal-body--off .dash__ac-modal-state {
  color: #6b7a8c;
}

/* Ambiente numa linha: temperatura · humidade · sensação. */
.dash__ac-modal-env {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.55rem;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #3d4f63;
}

.dash__ac-modal-env-item {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  white-space: nowrap;
}

.dash__ac-modal-env-item svg {
  width: 0.8rem;
  height: 0.8rem;
  color: #6b7a8c;
}

.dash__ac-modal-env-item--hum svg {
  color: #4aa3d8;
}

/* Botões redondos (Ligar / Luz do painel): cheios quando ligados. */
/* Grelha 2×2: Ligar · Temporizador / Luz (a luz só aparece com o AC ligado). */
.dash__ac-modal-hero-btns {
  flex: none;
  display: grid;
  grid-template-columns: repeat(2, 2.6rem);
  gap: 0.4rem;
}

.dash__ac-modal-hero-btns--locked {
  opacity: 0.4;
  pointer-events: none;
}

.dash__ac-modal-hero-btn {
  position: relative;
  border-radius: 50%;
}

.dash__ac-modal-round {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: #6b7a8c;
  cursor: pointer;
  box-shadow: 0 2px 6px -2px rgba(20, 35, 90, 0.25);
  transition: filter 0.12s, transform 0.12s, background 0.12s;
}

.dash__ac-modal-round svg {
  width: 1.15rem;
  height: 1.15rem;
}

.dash__ac-modal-round--power.dash__ac-modal-round--on {
  background: #22a35a;
  color: #fff;
  box-shadow: 0 6px 14px -6px rgba(34, 163, 90, 0.9);
}

.dash__ac-modal-round--light.dash__ac-modal-round--on {
  background: #f5b82e;
  color: #fff;
  box-shadow: 0 6px 14px -6px rgba(245, 184, 46, 0.9);
}

.dash__ac-modal-round--timer.dash__ac-modal-round--on {
  background: #ec8a3c;
  color: #fff;
  box-shadow: 0 6px 14px -6px rgba(236, 138, 60, 0.9);
}

.dash__ac-modal-round:hover {
  filter: brightness(0.97);
}

.dash__ac-modal-round--fan.dash__ac-modal-round--on {
  background: #ec8a3c;
  color: #fff;
  box-shadow: 0 6px 14px -6px rgba(236, 138, 60, 0.9);
}

.dash__ac-modal-round--night.dash__ac-modal-round--on {
  background: #6366f1;
  color: #fff;
  box-shadow: 0 6px 14px -6px rgba(99, 102, 241, 0.9);
}

.dash__ac-modal-round--lock.dash__ac-modal-round--on {
  background: #475569;
  color: #fff;
  box-shadow: 0 6px 14px -6px rgba(71, 85, 105, 0.9);
}

/* Toalheiro CREATE (toalheiro/_comando): o desenho do toalheiro no lugar da unidade de AC. */
.dash__towel-unit {
  width: 3.6rem;
  color: var(--ac-accent);
}

.dash__towel-unit svg {
  width: 3.6rem;
  height: 3.6rem;
}

.dash__towel-unit--heating svg {
  filter: drop-shadow(0 0 6px rgba(236, 138, 60, 0.55));
  animation: dash-towel-heat 2s ease-in-out infinite;
}

@keyframes dash-towel-heat {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(236, 138, 60, 0.35)); }
  50% { filter: drop-shadow(0 0 8px rgba(236, 138, 60, 0.75)); }
}

@media (prefers-reduced-motion: reduce) {
  .dash__towel-unit--heating svg { animation: none; }
}

/* Temporizador ativo */
.dash__ac-modal-timer {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.45rem;
  padding: 0.35rem 0.4rem 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(236, 138, 60, 0.14);
  color: #9a4d12;
  font-size: 0.75rem;
  font-weight: 600;
}

.dash__ac-modal-timer--info {
  border-radius: 0.8rem;
  background: rgba(74, 163, 216, 0.14);
  color: #1d5f86;
}

.dash__ac-modal-timer > svg {
  flex: none;
  width: 0.95rem;
  height: 0.95rem;
}

.dash__ac-modal-timer-text {
  flex: 1 1 auto;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

.dash__ac-modal-timer-cancel {
  flex: none;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: #fff;
  color: #c0605a;
  font-size: 0.7rem;
  font-weight: 700;
  text-decoration: none;
}

.dash__ac-modal-timer-cancel:hover {
  filter: brightness(0.97);
}

/* Comandos */
.dash__ac-modal-controls {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.dash__ac-modal-controls--locked .dash__ac-modal-group {
  opacity: 0.35;
  filter: grayscale(0.6);
  pointer-events: none;
}

.dash__ac-modal-body button:disabled,
.dash__ac-modal-body input:disabled {
  cursor: not-allowed;
}

.dash__ac-modal-lock {
  margin: 0 0 0.45rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  font-size: 0.75rem;
  font-weight: 600;
  color: #3d4f63;
  text-align: center;
}

.dash__ac-modal-group {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.4rem 0.5rem 0.45rem;
  border-radius: 0.75rem;
  background: #fff;
}

.dash__ac-modal-group--temp {
  padding: 0.3rem 0.4rem;
  border-radius: 999px;
}

.dash__ac-modal-group-label {
  padding-left: 0.15rem;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7a8c;
}

/* button_to embrulha cada botão num <form>; assim o botão fica item direto do flex. */
.dash__ac-modal-form {
  display: contents;
}

.dash__ac-modal-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.dash__ac-modal-pill {
  flex: 1 1 auto;
  padding: 0.3rem 0.5rem;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  background: #eef1f5;
  color: #3d4f63;
  cursor: pointer;
  transition: filter 0.12s, transform 0.12s, background 0.12s;
}

.dash__ac-modal-pill:hover {
  filter: brightness(0.97);
}

.dash__ac-modal-pill:active,
.dash__ac-modal-step:active,
.dash__ac-modal-round:active {
  transform: scale(0.94);
}

.dash__ac-modal-pill--active,
.dash__ac-modal-pill--active:hover {
  background: var(--ac-accent);
  color: #fff;
  box-shadow: 0 5px 12px -7px var(--ac-accent);
  filter: none;
}

/* Temperatura: − / slider / + */
.dash__ac-modal-temp-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dash__ac-modal-step {
  flex: none;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  background: #eef1f5;
  color: #1c2433;
  cursor: pointer;
  transition: filter 0.12s, transform 0.12s;
}

.dash__ac-modal-step:disabled {
  opacity: 0.4;
}

.dash__ac-modal-slider-form {
  flex: 1 1 0%;
  min-width: 0;
  display: flex;
  margin: 0;
}

.dash__ac-modal-slider {
  --pct: 50%;
  flex: 1 1 0%;
  min-width: 0;
  height: 1.75rem;
  margin: 0;
  padding: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}

.dash__ac-modal-slider::-webkit-slider-runnable-track {
  height: 0.55rem;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--ac-accent) var(--pct), #dbe4ee var(--pct));
}

.dash__ac-modal-slider::-moz-range-track {
  height: 0.55rem;
  border-radius: 999px;
  background: #dbe4ee;
}

.dash__ac-modal-slider::-moz-range-progress {
  height: 0.55rem;
  border-radius: 999px;
  background: var(--ac-accent);
}

.dash__ac-modal-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1.4rem;
  height: 1.4rem;
  margin-top: -0.425rem;
  border: none;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(20, 35, 90, 0.3), 0 0 0 1px rgba(20, 35, 90, 0.06);
  cursor: pointer;
}

.dash__ac-modal-slider::-moz-range-thumb {
  width: 1.4rem;
  height: 1.4rem;
  border: none;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(20, 35, 90, 0.3), 0 0 0 1px rgba(20, 35, 90, 0.06);
  cursor: pointer;
}

/* Loader por grupo enquanto o comando está a ser enviado (sensibo-option-loader). */
.dash__ac-modal-loader {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.75);
}

.dash__ac-modal-loader[hidden] {
  display: none;
}

.dash__ac-modal-hero-btn .dash__blind-modal-spinner {
  width: 1.1rem;
  height: 1.1rem;
}

.dash__ac-modal-status {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
}

.dash__ac-modal-status--error {
  color: #c0605a;
}

/* Tomadas: lista vertical compacta */
.dash__plug-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.dash__shutter-form {
  display: contents;
}

.dash__shutter {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  padding: 0.7rem 0.4rem 0.55rem;
  min-width: 0;
  width: 100%;
  background: #eef2f7;
  border: 2px solid transparent;
  border-radius: 0.85rem;
  cursor: pointer;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, border-color 0.15s, transform 0.12s, box-shadow 0.15s;
}

.dash__shutter:hover {
  background: #e4eaf2;
  border-color: #c8d5e3;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.dash__shutter:active {
  transform: translateY(0) scale(0.97);
  box-shadow: none;
}

.dash__shutter-window {
  position: relative;
  width: 2.6rem;
  height: 3rem;
  border-radius: 0.35rem;
  overflow: hidden;
  border: 2px solid #c8d5e3;
}

.dash__shutter-glass {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #d4eafc 0%, #a8d4f5 100%);
}

.dash__shutter-blind {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: repeating-linear-gradient(
    180deg,
    #8a9bb0 0px,
    #8a9bb0 3px,
    #7b8da2 3px,
    #7b8da2 4px
  );
  border-bottom: 2px solid #6b7d92;
  transition: height 0.3s ease;
}

.dash__shutter--open .dash__shutter-window { border-color: #7cb8d8; }
.dash__shutter--half .dash__shutter-window { border-color: #a0b8cc; }
.dash__shutter--low .dash__shutter-window { border-color: #b0bcc8; }
.dash__shutter--closed .dash__shutter-window { border-color: #a0aab5; }

.dash__shutter--closed .dash__shutter-glass {
  background: linear-gradient(180deg, #c5cdd6 0%, #b0bac4 100%);
}

.dash__shutter-emoji {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  z-index: 1;
  line-height: 1;
}

.dash__shutter-badge {
  position: absolute;
  top: -0.3rem;
  right: -0.3rem;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  animation: shutter-badge-in 0.3s ease;
}

.dash__shutter-badge--ok {
  background: #3a7a3a;
  box-shadow: 0 1px 4px rgba(58, 122, 58, 0.35);
}

.dash__shutter-badge--fail {
  background: #c0605a;
  box-shadow: 0 1px 4px rgba(192, 96, 90, 0.35);
}

@keyframes shutter-badge-in {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

.dash__shutter-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: #3d4f63;
  letter-spacing: 0.02em;
}

/* Tomadas: linhas da lista */
.dash__plug-row {
  display: flex;
  align-items: center;
  background: var(--dh-tile-bg);
  border-radius: 0.65rem;
  padding: 0.55rem 0.7rem;
  min-height: 2.6rem;
  transition: background 0.15s;
}

.dash__plug-row--on {
  background: var(--dh-plug-on-bg);
}

.dash__plug-row--offline {
  opacity: 0.48;
}

.dash__plug-row-form {
  display: contents;
}

/* Linha interior (nome + potência | timer | ligar/desligar) */
.dash__plug-row-line {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  gap: 0.6rem;
}

.dash__plug-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.dash__plug-row-name {
  flex: 1;
  min-width: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--dh-text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Separador «Luzes»: programação da app Smart Life por baixo do nome */
.dash__plug-row-schedule {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.66rem;
  font-weight: 500;
  color: var(--dh-muted-2);
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash__plug-row-name:has(.dash__plug-row-channel--err) {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.dash__plug-row-channel {
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--dh-muted-2);
  margin-left: 0.35rem;
}

.dash__plug-row-channel--tapo {
  color: var(--dh-accent);
}

.dash__plug-row-channel--err {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.35rem;
  max-width: 100%;
  min-width: 0;
}

.dash__plug-row-info-i {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.95rem;
  height: 0.95rem;
  margin-top: 0.05rem;
  border-radius: 50%;
  background: #b3261e;
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
  font-style: italic;
  line-height: 1;
}

.dash__plug-row-err-txt {
  font-style: normal;
  flex: 1;
  min-width: 0;
  white-space: normal;
}

.dash__plug-row-power {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--dh-plug-power-text);
  font-variant-numeric: tabular-nums;
}

/* Pending state for plug rows */
.dash__plug-row-power-btn[disabled] {
  pointer-events: none;
  opacity: 0.72;
}

@keyframes dash-spin {
  to { transform: rotate(360deg); }
}

/* ── Smart plugs (Tuya tomadas / réguas) ── */
.dash__plug-flash {
  font-size: 0.78rem;
  margin: 0 0 0.65rem;
  padding: 0.4rem 0.55rem;
  border-radius: 0.45rem;
  line-height: 1.35;
}

.dash__plug-flash--ok {
  background: var(--dh-plug-flash-ok-bg);
  color: var(--dh-plug-flash-ok-text);
}

.dash__plug-flash--err {
  background: var(--dh-plug-flash-err-bg);
  color: var(--dh-plug-flash-err-text);
}

/* ── Temporizador de tomadas ── */

.dash__plug-row-timer-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  margin-left: 0.25rem;
  border: 1.5px solid var(--dh-field-border);
  border-radius: 0.4rem;
  background: var(--dh-field-bg);
  color: var(--dh-muted);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  padding: 0;
}

.dash__plug-row-timer-btn:hover {
  background: var(--dh-tile-bg-hover);
  border-color: var(--dh-field-border-hover);
  color: var(--dh-text-2);
}

.dash__plug-row-power-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  margin-left: 0.25rem;
  border: 1.5px solid var(--dh-field-border);
  border-radius: 0.4rem;
  background: var(--dh-field-bg);
  color: var(--dh-muted);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  padding: 0;
}

.dash__plug-row-power-btn:hover {
  background: var(--dh-tile-bg-hover);
  border-color: var(--dh-field-border-hover);
  color: var(--dh-text-2);
}

.dash__plug-row-power-btn--on {
  background: #d4f0dc;
  border-color: #7bc99a;
  color: #2d6b42;
}

.dash__plug-row-power-btn--on:hover {
  background: #c4e8d0;
  border-color: #5cb87e;
  color: #1f5a32;
}

.dash__plug-row-timer-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0;
  font-size: 0.62rem;
  font-weight: 700;
  color: #2d6b42;
  background: #d4f0dc;
  border-radius: 0.35rem;
  padding: 0.08rem 0.1rem 0.08rem 0.35rem;
  margin-left: 0.25rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  overflow: hidden;
}

.dash__plug-row-timer-badge-time {
  line-height: 1.2;
  padding-right: 0.15rem;
}

.dash__plug-row-timer-badge-time:empty {
  display: none;
}

.dash__plug-row-timer-badge-time:empty + .dash__plug-row-timer-cancel-btn {
  border-left: none;
}

.dash__plug-row-timer-cancel-form {
  display: contents;
}

.dash__plug-row-timer-cancel-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  border: none;
  border-left: 1px solid rgba(45, 107, 66, 0.18);
  border-radius: 0;
  background: transparent;
  color: #3d7a52;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  padding: 0;
  text-decoration: none;
  box-sizing: border-box;
}

.dash__plug-row-timer-cancel-btn:hover {
  background: rgba(185, 28, 28, 0.1);
  color: #b91c1c;
}

/* Timer modal */
.dash__plug-timer-dialog {
  width: min(22.5rem, calc(100vw - 1.5rem));
  max-height: min(86dvh, 34rem);
}

.dash__plug-timer-dialog::backdrop {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}

.dash__plug-timer-panel {
  position: relative;
  background: var(--dh-modal-bg);
  border: 1px solid var(--dh-modal-border);
  box-shadow:
    0 4px 6px rgba(15, 23, 42, 0.04),
    0 20px 40px rgba(15, 23, 42, 0.12);
}

.dash__plug-timer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1rem 0.9rem;
  background: var(--dh-modal-head-bg);
  border-bottom: 1px solid var(--dh-modal-hairline);
  flex-shrink: 0;
}

.dash__plug-timer-head-main {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  min-width: 0;
}

.dash__plug-timer-head-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.7rem;
  background: linear-gradient(145deg, #fde68a 0%, #fbbf24 100%);
  color: #92400e;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.28);
}

.dash__plug-timer-head-text {
  min-width: 0;
  padding-top: 0.1rem;
}

.dash__plug-timer-head-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--dh-modal-title);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.dash__plug-timer-head-sub {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--dh-modal-sub);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash__plug-timer-close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  margin: 0;
  padding: 0;
  border: 1px solid var(--dh-modal-border);
  border-radius: 0.55rem;
  background: var(--dh-modal-close-bg);
  color: var(--dh-modal-sub);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.dash__plug-timer-close:hover {
  background: var(--dh-modal-close-bg-hover);
  border-color: var(--dh-modal-border);
  color: var(--dh-modal-title);
}

.dash__plug-timer-body {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: 1rem 1rem 1.2rem;
  background: var(--dh-modal-bg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.dash__plug-timer-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.dash__plug-timer-hint {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0;
  padding: 0.65rem 0.75rem;
  border-radius: 0.65rem;
  background: var(--dh-modal-field-bg);
  border: 1px solid var(--dh-modal-field-border);
  font-size: 0.76rem;
  font-weight: 500;
  line-height: 1.45;
  color: var(--dh-accent);
}

.dash__plug-timer-hint-icon {
  flex-shrink: 0;
  display: inline-flex;
  margin-top: 0.05rem;
  color: var(--dh-accent);
}

.dash__plug-timer-section {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.dash__plug-timer-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--dh-modal-label);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dash__plug-timer-action-toggle {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.45rem;
}

.dash__plug-timer-action-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.6rem;
  padding: 0.5rem 0.6rem;
  border: 1.5px solid var(--dh-modal-field-border);
  border-radius: 0.7rem;
  background: var(--dh-modal-field-bg);
  color: var(--dh-modal-title);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.14s ease,
    border-color 0.14s ease,
    color 0.14s ease;
}

.dash__plug-timer-action-option input {
  accent-color: #0284c7;
  margin: 0;
}

.dash__plug-timer-action-option:has(input:checked) {
  background: color-mix(in srgb, var(--dh-accent) 12%, var(--dh-modal-bg));
  border-color: var(--dh-accent);
  color: var(--dh-accent);
}

.dash__plug-timer-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
}

.dash__plug-timer-preset {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.05rem;
  min-height: 3.1rem;
  padding: 0.5rem 0.35rem;
  border: 1.5px solid var(--dh-modal-field-border);
  border-radius: 0.7rem;
  background: var(--dh-modal-field-bg);
  color: var(--dh-modal-title);
  cursor: pointer;
  transition:
    background 0.14s ease,
    border-color 0.14s ease,
    box-shadow 0.14s ease,
    transform 0.1s ease;
}

.dash__plug-timer-preset-val {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--dh-modal-title);
}

.dash__plug-timer-preset-unit {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--dh-modal-sub);
  text-transform: lowercase;
}

.dash__plug-timer-preset:hover {
  background: var(--dh-modal-bg);
  border-color: #fbbf24;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.18);
}

.dash__plug-timer-preset:hover .dash__plug-timer-preset-val {
  color: #b45309;
}

.dash__plug-timer-preset:active {
  transform: scale(0.97);
  background: #fffbeb;
}

.dash__plug-timer-preset:focus-visible {
  outline: 2px solid #f59e0b;
  outline-offset: 2px;
}

.dash__plug-timer-custom-box {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.85rem;
  border-radius: 0.75rem;
  background: var(--dh-modal-field-bg);
  border: 1px solid var(--dh-modal-field-border);
}

.dash__plug-timer-custom-fields {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.35rem;
}

.dash__plug-timer-custom-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  flex: 1;
  max-width: 5.5rem;
}

.dash__plug-timer-custom-field-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--dh-modal-label);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dash__plug-timer-custom-colon {
  flex-shrink: 0;
  padding-bottom: 0.55rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--dh-modal-label);
  line-height: 1;
}

.dash__plug-timer-custom-input {
  width: 100%;
  padding: 0.55rem 0.4rem;
  border: 1.5px solid var(--dh-modal-input-border);
  border-radius: 0.6rem;
  background: var(--dh-modal-input-bg);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--dh-modal-title);
  text-align: center;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
  -moz-appearance: textfield;
}

.dash__plug-timer-custom-input::-webkit-outer-spin-button,
.dash__plug-timer-custom-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.dash__plug-timer-custom-input:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.dash__plug-timer-custom-submit {
  width: 100%;
  padding: 0.62rem 1rem;
  border: none;
  border-radius: 0.6rem;
  background: linear-gradient(180deg, #1e6eb5 0%, #155a9a 100%);
  color: #fff;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(30, 110, 181, 0.28);
  transition: filter 0.12s ease, transform 0.1s ease;
}

.dash__plug-timer-custom-submit:hover {
  filter: brightness(1.06);
}

.dash__plug-timer-custom-submit:active {
  transform: scale(0.98);
}

.dash__plug-timer-custom-submit:focus-visible {
  outline: 2px solid #1e6eb5;
  outline-offset: 2px;
}

.dash__plug-timer-busy {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  padding: 1.25rem;
  text-align: center;
  background: color-mix(in srgb, var(--dh-modal-bg) 92%, transparent);
  backdrop-filter: blur(4px);
}

.dash__plug-timer-dialog--busy .dash__plug-timer-busy {
  display: flex;
}

.dash__plug-timer-busy-spin {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  border: 2.5px solid rgba(245, 158, 11, 0.2);
  border-top-color: #f59e0b;
  animation: dash-plug-timer-spin 0.72s linear infinite;
}

.dash__plug-timer-busy-text {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--dh-modal-sub);
  max-width: 15rem;
  line-height: 1.4;
}

@keyframes dash-plug-timer-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 380px) {
  .dash__plug-timer-presets {
    grid-template-columns: repeat(2, 1fr);
  }

  .dash__plug-timer-head-sub {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

/* ── Smart Life: temperaturas (último card) — estilo discreto ── */
.dash__shutters--temps {
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 0.5rem;
}

@media (max-width: 639px) {
  .dash__shutters--temps {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 8rem), 1fr));
  }
}

.dash__temp-tile {
  display: grid;
  grid-template-columns: 2px 1fr;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  text-align: center;
}

.dash__temp-tile--offline {
  opacity: 0.55;
}

.dash__temp-accent {
  background: #cbd5e1;
  border-radius: 0.75rem 0 0 0.75rem;
}

.dash__temp-tile--offline .dash__temp-accent {
  background: #e8ecf0;
}

.dash__temp-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
  padding: 0.5rem 0.4rem 0.48rem;
  min-width: 0;
}

.dash__temp-tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem;
  width: 100%;
}

.dash__temp-top-left {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.3rem;
  min-width: 0;
}

.dash__temp-batt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 0.45rem;
  background: rgba(148, 163, 184, 0.14);
  border: 1px solid rgba(148, 163, 184, 0.32);
  flex-shrink: 0;
}

.dash__temp-batt-shell {
  position: relative;
  width: 0.95rem;
  height: 0.55rem;
  border-radius: 0.14rem;
  border: 1.5px solid currentColor;
  color: #94a3b8;
  box-sizing: border-box;
}

.dash__temp-batt-shell::after {
  content: "";
  position: absolute;
  right: -0.16rem;
  top: 50%;
  transform: translateY(-50%);
  width: 0.14rem;
  height: 0.22rem;
  border-radius: 0.08rem;
  background: currentColor;
  opacity: 0.95;
}

.dash__temp-batt-bars {
  position: absolute;
  left: 0.09rem;
  right: 0.09rem;
  top: 0.09rem;
  bottom: 0.09rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.07rem;
  align-items: stretch;
}

.dash__temp-batt-bar {
  border-radius: 0.06rem;
  background: currentColor;
  opacity: 0.25;
}

.dash__temp-batt--low .dash__temp-batt-shell { color: #ef4444; }   /* vermelho */
.dash__temp-batt--mid .dash__temp-batt-shell { color: #f59e0b; }   /* laranja */
.dash__temp-batt--high .dash__temp-batt-shell { color: #22c55e; }  /* verde */

.dash__temp-batt--low .dash__temp-batt-bar:nth-child(-n+1) { opacity: 0.95; }
.dash__temp-batt--mid .dash__temp-batt-bar:nth-child(-n+2) { opacity: 0.95; }
.dash__temp-batt--high .dash__temp-batt-bar:nth-child(-n+3) { opacity: 0.95; }

.dash__temp-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #e8edf2;
  color: #8b9aad;
}

.dash__temp-tile--offline .dash__temp-icon-wrap {
  background: #f1f4f8;
  color: #a8b4c4;
  border-color: #e8ecf0;
}

.dash__temp-icon {
  display: block;
  flex-shrink: 0;
}

.dash__temp-offline {
  font-size: 0.48rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
}

.dash__temp-val {
  margin: 0.08rem 0 0;
  width: 100%;
  max-width: 100%;
  padding: 0 0.12rem;
  box-sizing: border-box;
  font-size: clamp(0.92rem, 2.6vw, 1.12rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  color: #334155;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash__temp-hum-mini {
  margin: 0;
  font-size: 0.52rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: #7c8a9a;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.dash__temp-name {
  display: flex;
  flex-direction: column;
  gap: 0.02rem;
  width: 100%;
  max-width: 100%;
  margin-top: 0.06rem;
  min-height: 0;
}

.dash__temp-name-line {
  display: block;
  width: 100%;
  max-width: 100%;
  font-size: 0.54rem;
  font-weight: 600;
  color: #64748b;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Growatt: painéis abrem modal com gráficos ── */
.ef__node--solar-modal {
  cursor: pointer;
  border-radius: 0.85rem;
  transition: background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.ef__node--solar-modal:hover {
  background: rgba(91, 141, 184, 0.08);
}

.ef__node--solar-modal:focus,
.ef__node--solar-modal:focus-visible {
  outline: none;
}

.dash__home-modal {
  border: none;
  padding: 0;
  width: min(36rem, calc(100vw - 1.25rem));
  max-height: min(88vh, 44rem);
  max-height: min(88dvh, 44rem);
  border-radius: 1rem;
  background: transparent;
}

.dash__home-modal::backdrop {
  background: rgba(15, 23, 42, 0.48);
}

.dash__home-modal-panel {
  display: flex;
  flex-direction: column;
  max-height: min(88vh, 44rem);
  max-height: min(88dvh, 44rem);
  background: #fff;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.14);
}

.dash__home-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1rem 0.85rem;
  background: #fff;
  flex-shrink: 0;
}

.dash__home-modal-head-text {
  min-width: 0;
}

.dash__home-modal-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.dash__home-modal-status {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0.35rem 0 0;
  font-size: 0.72rem;
  font-weight: 500;
  color: #64748b;
}

.dash__home-modal-status--muted {
  color: #94a3b8;
}

.dash__home-modal-status-dot {
  flex-shrink: 0;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}

.dash__home-modal-close {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 0.45rem;
  background: #fff;
  color: #475569;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.dash__home-modal-close:hover {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.12);
}

.dash__home-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.65rem 1rem 1.25rem;
  -webkit-overflow-scrolling: touch;
  background: #ececf1;
  color: #0f172a;
}

/* ── Modal consumo rede (dashboard) ── */
.dash__rede-modal-card {
  background: #fff;
  border-radius: 0.75rem;
  padding: 0.75rem 0.85rem 0.95rem;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06);
}

#dash-rede-cost-dialog .dash__rede-modal-card {
  flex-shrink: 0;
}

.dash__rede-modal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.dash__rede-modal-table thead th {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  padding: 0 0 0.45rem;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: bottom;
}

.dash__rede-modal-table thead th:first-child {
  text-align: left;
}

.dash__rede-modal-table thead th.dash__rede-modal-num {
  text-align: right;
  padding-left: 0.5rem;
}

.dash__rede-modal-table tbody th {
  font-weight: 600;
  color: #334155;
  text-align: left;
  padding: 0.45rem 0.35rem 0.45rem 0;
  vertical-align: middle;
}

.dash__rede-modal-table tbody td {
  padding: 0.45rem 0.15rem;
  vertical-align: middle;
  color: #1e293b;
}

.dash__rede-modal-table tbody td.dash__rede-modal-num {
  padding-left: 0.5rem;
  padding-right: 0;
}

.dash__rede-modal-row--note td,
.dash__rede-modal-row--note th {
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  font-weight: 500;
  color: #475569;
}

.dash__rede-modal-note-custo {
  font-size: 0.72rem;
  font-weight: 500;
  color: #64748b;
  white-space: normal;
  line-height: 1.25;
  text-align: right;
}

.dash__rede-modal-hint {
  font-size: 0.72rem;
  font-weight: 400;
  color: #94a3b8;
  white-space: nowrap;
}

.dash__rede-modal-popover {
  position: relative;
  display: inline-block;
  margin-left: 0.25rem;
}

.dash__rede-modal-popover-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  font-size: 0.68rem;
  line-height: 1;
  cursor: pointer;
}

.dash__rede-modal-popover-btn:hover,
.dash__rede-modal-popover-btn:focus-visible {
  background: #cbd5e1;
}

.dash__rede-modal-popover-panel {
  position: fixed;
  z-index: 2147483647;
  padding: 0.5rem 0.65rem;
  border-radius: 0.5rem;
  background: #1e293b;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
  white-space: nowrap;
}

.dash__rede-modal-popover-panel .dash__rede-modal-hint {
  color: #e2e8f0;
}

.dash__rede-modal-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dash__rede-modal-muted {
  color: #64748b;
  font-size: 0.76rem;
}

.dash__rede-modal-strong {
  font-weight: 700;
  color: #b45309;
}

.dash__rede-modal-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid #e2e8f0;
}

.dash__rede-modal-total-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
}

.dash__rede-modal-total-val {
  font-size: 1.05rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #b45309;
  letter-spacing: -0.02em;
}

/* Modal «Rede — consumo hoje»: mobile / ecrãs estreitos */
#dash-rede-cost-dialog.dash__home-modal {
  width: min(36rem, calc(100vw - 1rem - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  max-width: 100%;
  max-height: min(92dvh, 44rem);
  max-height: min(92vh, 44rem);
  height: fit-content;
  margin: auto;
}

#dash-rede-cost-dialog .dash__home-modal-panel {
  max-height: min(92dvh, 44rem);
  max-height: min(92vh, 44rem);
  min-height: 0;
  height: fit-content;
  border-radius: 0.85rem;
}

/* Sem flex-grow: o body não deve ocupar o espaço livre por baixo dos cartões */
#dash-rede-cost-dialog .dash__home-modal-body {
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem 0.75rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

#dash-rede-cost-dialog .dash__home-modal-head {
  flex-shrink: 0;
  padding: 1.2rem 0.75rem 0.75rem;
  padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
  padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
}

#dash-rede-cost-dialog .dash__home-modal-close {
  min-width: 2.75rem;
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Modal «Produção solar — hoje»: mesmo shell visual que Casa / Rede */
#dash-growatt-dialog.dash__home-modal {
  width: min(52rem, calc(100vw - 1rem - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  max-width: 100%;
  max-height: min(92dvh, 56rem);
  max-height: min(92vh, 56rem);
  height: fit-content;
  margin: auto;
}

#dash-growatt-dialog .dash__home-modal-panel {
  max-height: min(92dvh, 56rem);
  max-height: min(92vh, 56rem);
  min-height: 0;
  height: fit-content;
  border-radius: 0.85rem;
}

#dash-growatt-dialog .dash__home-modal-head {
  flex-shrink: 0;
  padding: 1rem 1rem 0.85rem;
  padding-left: max(1rem, env(safe-area-inset-left, 0px));
  padding-right: max(1rem, env(safe-area-inset-right, 0px));
}

#dash-growatt-dialog .dash__home-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.65rem 1rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
  -webkit-overflow-scrolling: touch;
  background: #ececf1;
  color: #0f172a;
}

.dash__rede-modal-table-wrap {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  margin: 0 -0.15rem;
  padding: 0 0.15rem;
}

.dash__rede-modal-table-wrap:focus-visible {
  outline: none;
}

@media (max-width: 520px) {
  #dash-rede-cost-dialog.dash__home-modal {
    width: calc(100vw - 0.5rem - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
    border-radius: 0.75rem;
  }

  #dash-rede-cost-dialog .dash__home-modal-panel {
    border-radius: 0.75rem;
  }

  #dash-rede-cost-dialog .dash__home-modal-title {
    font-size: 0.98rem;
  }

  #dash-rede-cost-dialog .dash__home-modal-status {
    font-size: 0.68rem;
    line-height: 1.4;
    hyphens: auto;
    overflow-wrap: anywhere;
  }

  #dash-growatt-dialog.dash__home-modal {
    width: calc(100vw - 0.5rem - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
    border-radius: 0.75rem;
  }

  #dash-growatt-dialog .dash__home-modal-panel {
    border-radius: 0.75rem;
  }

  #dash-growatt-dialog .dash__home-modal-title {
    font-size: 0.98rem;
  }

  #dash-growatt-dialog .dash__home-modal-status {
    font-size: 0.68rem;
    line-height: 1.4;
    hyphens: auto;
    overflow-wrap: anywhere;
  }

  #dash-growatt-dialog .dash__home-modal-body {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .dash__rede-modal-card {
    padding: 0.6rem 0.55rem 0.75rem;
    border-radius: 0.6rem;
  }

  .dash__rede-modal-table {
    font-size: 0.76rem;
    min-width: 0;
  }

  .dash__rede-modal-table thead th {
    font-size: 0.56rem;
  }

  .dash__rede-modal-table thead th:first-child {
    padding-right: 0.15rem;
  }

  .dash__rede-modal-table thead th.dash__rede-modal-num {
    padding-left: 0.45rem;
    padding-right: 0;
  }

  .dash__rede-modal-table tbody th {
    padding-right: 0.25rem;
    font-size: 0.74rem;
    max-width: none;
    overflow-wrap: anywhere;
    line-height: 1.25;
  }

  .dash__rede-modal-table tbody td {
    padding: 0.4rem 0.15rem;
  }

  .dash__rede-modal-table tbody td.dash__rede-modal-num {
    padding-left: 0.45rem;
    padding-right: 0;
  }

  .dash__rede-modal-total {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    margin-top: 0.55rem;
    padding-top: 0.55rem;
  }

  .dash__rede-modal-total-val {
    font-size: 1.15rem;
    align-self: flex-end;
  }
}

/* ── Casa consumo modal: topo — consumo atual ── */
.dash__hc-hero-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

.dash__hc-stat {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1rem;
  min-height: 5rem;
  background: #fff;
  border-radius: 1rem;
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 6px 18px rgba(0, 0, 0, 0.04);
}

.dash__hc-stat-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.35rem;
  height: 3.35rem;
  border-radius: 50%;
}

/* Consumo + produção dos painéis lado a lado. */
.dash__hc-hero-row--duo {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 480px) {
  .dash__hc-hero-row--duo .dash__hc-stat {
    gap: 0.55rem;
    padding: 0.75rem;
  }
  .dash__hc-hero-row--duo .dash__hc-stat-icon {
    width: 2.5rem;
    height: 2.5rem;
  }
  .dash__hc-hero-row--duo .dash__hc-stat-icon svg {
    width: 22px;
    height: 22px;
  }
}

/* Produção dos painéis a verde (o consumo é sempre a vermelho). */
.dash__hc-stat-icon--solar {
  background: #fff;
  box-shadow: 0 2px 12px rgba(34, 197, 94, 0.14), inset 0 1px 0 rgba(255, 255, 255, 1);
  color: #22c55e;
}

.dash__hc-stat-value--solar {
  color: #16a34a;
}

.dash__hc-stat-value--solar .dash__hc-stat-unit {
  color: #15803d;
}

/* Consumo da casa a vermelho (a produção dos painéis fica a verde ao lado). */
.dash__hc-stat-icon--power {
  background: #fff;
  box-shadow: 0 2px 12px rgba(220, 38, 38, 0.14), inset 0 1px 0 rgba(255, 255, 255, 1);
  color: #ef4444;
}

.dash__hc-stat-text {
  min-width: 0;
  text-align: left;
}

.dash__hc-stat-value {
  margin: 0;
  font-size: clamp(1.35rem, 4.5vw, 1.75rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.dash__hc-stat-value--power {
  color: #dc2626;
}

.dash__hc-stat-value--power .dash__hc-stat-unit {
  color: #b91c1c;
}

.dash__hc-stat-unit {
  font-size: 0.52em;
  font-weight: 600;
  color: #15803d;
  margin-left: 0.08em;
}

.dash__hc-stat-caption {
  margin: 0.28rem 0 0;
  font-size: 0.78rem;
  font-weight: 500;
  color: #64748b;
  line-height: 1.25;
}

.dash__hc-card {
  background: #fff;
  border-radius: 1rem;
  padding: 0.85rem 1rem 1rem;
  margin-bottom: 0.65rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.03);
}

.dash__hc-card:last-child {
  margin-bottom: 0;
}

.dash__hc-card-title {
  margin: 0 0 0.65rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #64748b;
}

.dash__hc-dist-main {
  min-width: 0;
}

.dash__hc-bar {
  display: flex;
  align-items: stretch;
  height: 1.55rem;
  border-radius: 999px;
  overflow: hidden;
  background: #cbd5e1;
  margin-bottom: 0.75rem;
}

.dash__hc-bar-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 100%;
  transition: flex-grow 0.25s ease;
}

.dash__hc-bar-seg:first-child {
  border-radius: 999px 0 0 999px;
}

.dash__hc-bar-seg:last-child {
  border-radius: 0 999px 999px 0;
}

.dash__hc-bar-seg:first-child:last-child {
  border-radius: 999px;
}

.dash__hc-bar-pct {
  padding: 0 0.2rem;
  font-size: 0.68rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
}

.dash__hc-bar-pct--on-green {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
}

.dash__hc-bar-pct--on-gray {
  color: #0f172a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.dash__hc-bar-pct--on-ac {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
}

/* Distribuição do consumo: tudo consumo → tons de vermelho (um por fatia). */
/* Distribuição do consumo: uma cor por tipo, sem vermelhos (o vermelho é só o consumo total no 3D). */
.dash__hc-bar-seg--tomadas {
  background: linear-gradient(90deg, #2dd4bf, #14b8a6);
}

.dash__hc-bar-seg--ac {
  background: linear-gradient(90deg, #60a5fa, #3b82f6);
}

.dash__hc-bar-seg--bomba {
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.dash__hc-bar-seg--bateria {
  background: linear-gradient(90deg, #4ade80, #22c55e);
}

.dash__hc-bar-seg--car {
  background: linear-gradient(90deg, #a78bfa, #8b5cf6);
}

.dash__hc-bar-seg--outros {
  background: #cbd5e1;
}

.dash__hc-legend {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.dash__hc-legend-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
}

.dash__hc-legend-dot {
  flex-shrink: 0;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
}

.dash__hc-legend-dot--tomadas {
  background: #14b8a6;
}

.dash__hc-legend-dot--ac {
  background: #3b82f6;
}

.dash__hc-legend-dot--bomba {
  background: #f59e0b;
}

.dash__hc-legend-dot--bateria {
  background: #22c55e;
}

.dash__hc-legend-dot--car {
  background: #8b5cf6;
}

.dash__hc-legend-dot--outros {
  background: #cbd5e1;
}

.dash__hc-legend-dot--solar {
  background: #f59e0b;
}

.dash__hc-legend-dot--rede {
  background: #6366f1;
}

/* Horário TOU: Load First / Battery First / Grid First */
.dash__hc-legend-dot--tou-0 {
  background: #94a3b8;
}

.dash__hc-legend-dot--tou-1 {
  background: #22c55e;
}

.dash__hc-legend-dot--tou-2 {
  background: #6366f1;
}

.dash__hc-legend-row--now .dash__hc-legend-label {
  color: #0f172a;
}

/* Slot TOU: interruptor ligar/desligar (ao estilo iOS) */
.dash__tou-row--off .dash__hc-legend-label,
.dash__tou-row--off .dash__hc-legend-val {
  color: #94a3b8;
}

.dash__tou-row--off .dash__hc-legend-dot {
  opacity: 0.4;
}

.dash__tou-switch-form {
  margin: 0 0 0 0.4rem;
  flex-shrink: 0;
}

.dash__tou-switch {
  appearance: none;
  position: relative;
  display: block;
  width: 2.1rem;
  height: 1.25rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(120, 120, 128, 0.32);
  cursor: pointer;
  transition: background 0.2s;
}

.dash__tou-switch--on {
  background: #22c55e;
}

.dash__tou-switch-knob {
  position: absolute;
  top: 0.125rem;
  left: 0.125rem;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s;
}

.dash__tou-switch--on .dash__tou-switch-knob {
  transform: translateX(0.85rem);
}

.dash__tou-switch:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* Cartão «Carregamentos da Rede (TOU)»: «Atualizar» no canto superior direito, ao nível do título */
.dash__tou-card {
  position: relative;
}

.dash__tou-head-right {
  position: absolute;
  top: 0.6rem;
  right: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Em mobile a tab «Carregamentos (TOU)» já diz o que é: sem título no cartão */
@media (max-width: 639px) {
  .dash__tou-card > .dash__hc-card-title {
    display: none;
  }
}

.dash__tou-refresh-form {
  margin: 0;
}

/* Espaço entre o cabeçalho (título + Atualizar) e a lista de slots */
.dash__tou-card .dash__hc-legend,
.dash__tou-card .dash__hint {
  margin-top: 1.75rem;
}

/* Interruptor geral «Carregar bateria da Rede» por cima dos slots */
.dash__tou-card .dash__tou-master {
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

/* Em ecrãs estreitos o nome pode partir linha, mas o interruptor fica sempre visível */
.dash__tou-master .dash__hc-legend-label {
  min-width: 0;
}

.dash__tou-explain {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.55rem 0.7rem;
  border-radius: 0.6rem;
  border-left: 3px solid;
  font-size: 0.74rem;
  line-height: 1.35;
}

.dash__tou-explain span {
  font-size: 0.7rem;
  color: #475569;
}

.dash__tou-explain--on {
  color: #166534;
  background: #f0fdf4;
  border-color: #22c55e;
}

.dash__tou-explain--off {
  color: #9a3412;
  background: #fff7ed;
  border-color: #f97316;
}

/* Frase do que vai acontecer (igual à do dashboard) dentro da caixa On/Off */
.dash__tou-explain .dash__tou-explain-now {
  margin-top: 0.25rem;
  padding-top: 0.3rem;
  border-top: 1px dashed currentColor;
  font-size: 0.72rem;
  font-weight: 650;
  color: inherit;
}

.dash__tou-explain .dash__tou-explain-now--aviso {
  margin-left: -0.7rem;
  margin-right: -0.7rem;
  margin-bottom: -0.55rem;
  padding: 0.4rem 0.7rem 0.5rem;
  border-top: 1px solid #fcd34d;
  border-radius: 0 0 0.6rem 0;
  color: #92400e;
  background: #fffbeb;
}

.dash__tou-explain .dash__tou-explain-dica {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.68rem;
  font-weight: 500;
}

.dash__tou-subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}

/* Corpo do cartão: predefinições, interruptor geral, avisos e slots, em coluna */
.dash__tou-card .dash__tou-body {
  margin-top: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.dash__tou-card .dash__tou-body .dash__hc-legend,
.dash__tou-card .dash__tou-body .dash__hint {
  margin: 0;
}

/* Carga da rede automática: interruptor + slider da % a que desliga */
.dash__tou-auto {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.55rem 0.7rem 0.65rem;
  border-radius: 0.6rem;
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.dash__tou-auto .dash__hc-legend-label {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dash__tou-auto-hint {
  font-size: 0.68rem;
  font-weight: 500;
  color: #64748b;
}

.dash__tou-auto-form {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0;
}

.dash__tou-auto--off .dash__tou-auto-form {
  opacity: 0.55;
}

.dash__tou-auto-label {
  font-size: 0.74rem;
  color: #334155;
}

.dash__tou-auto-label output {
  font-weight: 700;
  color: #166534;
}

.dash__tou-auto-range {
  width: 100%;
  accent-color: #22c55e;
}

/* % mínima da bateria com rede: título e valor na mesma linha, por cima do slider. */
.dash__tou-minimo {
  margin-bottom: 0.5rem;
}

.dash__tou-minimo .dash__tou-auto-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.dash__tou-minimo .dash__tou-auto-label output {
  font-size: 0.95rem;
}

.dash__tou-refresh {
  appearance: none;
  padding: 0.35rem 0.8rem;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 650;
  color: #0f172a;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 999px;
  cursor: pointer;
}

.dash__tou-refresh:hover {
  background: #f1f5f9;
}

.dash__tou-refresh:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* Sub-linhas (ex.: origem da carga da bateria) — indentadas e mais discretas */
.dash__hc-legend-row--sub {
  padding-left: 0.9rem;
  font-size: 0.74rem;
}

.dash__hc-legend-row--sub .dash__hc-legend-label,
.dash__hc-legend-row--sub .dash__hc-legend-val {
  font-weight: 500;
  color: #64748b;
}

.dash__hc-legend-label {
  flex: 1;
  font-weight: 600;
  color: #334155;
}

.dash__hc-legend-val {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #0f172a;
  white-space: nowrap;
}

.dash__hc-legend-pct {
  font-weight: 700;
  color: #475569;
  margin-left: 0.15rem;
}

.dash__hc-ac {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.dash__hc-ac-icon {
  flex-shrink: 0;
  width: 2.6rem;
  height: 2.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #e0f2fe 0%, #bae6fd 100%);
  font-size: 1.15rem;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  margin-top: 22px;
}

.dash__hc-ac-text {
  min-width: 0;
}

.dash__hc-ac-title {
  margin: 0 0 0.35rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #64748b;
}

.dash__hc-ac-status {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: #0f172a;
}

.dash__hc-battery-note {
  margin: 0;
  font-size: 0.85rem;
  color: #334155;
  line-height: 1.35;
}

.dash__hc-ac-desc {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: #64748b;
}

.dash__hc-ac-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.dash__hc-ac-item {
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}

.dash__hc-ac-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.dash__hc-ac-item-name {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  color: #0f172a;
}

.dash__hc-ac-item-meta {
  min-width: 0;
  font-size: 0.72rem;
  color: #64748b;
  line-height: 1.3;
}

.dash__hc-ac-item-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-top: 0.12rem;
}

.dash__hc-ac-item-w {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #d64545; /* consumo: sempre a vermelho */
}

.dash__hc-ac-total-est {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #0f172a;
}

.dash__hc-ac-footnote {
  margin: 0.35rem 0 0;
  font-size: 0.68rem;
  line-height: 1.35;
  color: #94a3b8;
}

.dash__hc-empty {
  margin: 0;
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.35;
}

.dash__hc-device-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.dash__hc-device-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  align-items: center;
  gap: 0.45rem 0.55rem;
  padding: 0.55rem 0.45rem;
  border-radius: 0.65rem;
  background: #f8fafc;
  border: 1px solid rgba(226, 232, 240, 0.95);
}

.dash__hc-device-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 0.4rem;
  background: rgba(34, 197, 94, 0.14);
  color: #16a34a;
}

.dash__hc-device-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.dash__hc-device-badge {
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  padding: 0.12rem 0.38rem;
  border-radius: 0.35rem;
  background: rgba(148, 163, 184, 0.18);
}

.dash__hc-device-w {
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #d64545; /* consumo: sempre a vermelho */
  white-space: nowrap;
}

.dash__hc-device-chev {
  font-size: 1.1rem;
  font-weight: 600;
  color: #ef4444;
  line-height: 1;
}

/* «BMW iX2» — carregamento do carro indicado à mão (carro_carga_controller) */
.dash__hc-car {
  grid-template-columns: auto 1fr auto auto auto;
  margin-bottom: 0.35rem;
}

.dash__hc-car-icon {
  background: rgba(148, 163, 184, 0.18);
}

/* Mesma caixa dos outros ícones (1.85rem); a foto encaixa sem deformar. */
.dash__hc-car-icon img {
  width: 1.6rem;
  height: 1.6rem;
  object-fit: contain;
  display: block;
}

.dash__hc-car.is-on .dash__hc-car-icon {
  background: rgba(34, 197, 94, 0.14);
}

.dash__hc-car-amps {
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.3rem;
  border-radius: 0.4rem;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: #fff;
  color: #0f172a;
}

.dash__hc-car:not(.is-on) .dash__hc-car-amps,
.dash__hc-car:not(.is-on) .dash__hc-car-w {
  opacity: 0.55;
}

.dash__hc-car:not(.is-on) .dash__hc-car-w {
  color: #64748b;
  font-weight: 600;
}

.dash__growatt-modal {
  border: none;
  padding: 0;
  width: min(52rem, calc(100vw - 1.25rem));
  max-height: min(92vh, 56rem);
  max-height: min(92dvh, 56rem);
  border-radius: 1rem;
  background: transparent;
}

.dash__growatt-modal::backdrop {
  background: rgba(15, 23, 42, 0.48);
}

.dash__growatt-modal-panel {
  display: flex;
  flex-direction: column;
  max-height: min(92vh, 56rem);
  max-height: min(92dvh, 56rem);
  background: #fff;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.14);
}

.dash__growatt-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #eef2f7;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}

.dash__growatt-modal-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #1c2433;
  letter-spacing: -0.01em;
}

.dash__growatt-modal-close {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.05);
  color: #3d4f63;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s;
}

.dash__growatt-modal-close:hover {
  background: rgba(0, 0, 0, 0.09);
}

.dash__growatt-modal-body {
  flex: 1 1 auto;
  min-height: 0; /* permite scroll no filho flex; sem isto o fundo corta a bi-horária */
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.85rem 1rem 1.75rem;
  -webkit-overflow-scrolling: touch;
  color: #1c2433;
}

/* Gráficos Growatt no fundo claro do dashboard */
/* Sobrescreve .growatt-app (application.css, carregado depois): min-height:100vh e padding largos
   partiam o layout da modal e cortavam a bi-horária no fundo. */
.dash__growatt-modal-body.growatt-app,
#dash-growatt-dialog .dash__home-modal-body.growatt-app {
  --gt-chart-color: #475569;
  --gt-chart-legend: rgba(30, 41, 59, 0.92);
  --gt-chart-tick: rgba(71, 85, 105, 0.88);
  --gt-chart-grid: rgba(148, 163, 184, 0.22);
  --gt-chart-grid-x: rgba(148, 163, 184, 0.18);
  --gt-chart-border: rgba(100, 116, 139, 0.45);
  --gt-chart-title: rgba(51, 65, 85, 0.9);
  min-height: 0;
  max-width: none;
  margin: 0;
  padding: 0.85rem 1rem calc(2rem + env(safe-area-inset-bottom, 0px));
  color: #1c2433;
  isolation: auto;
}

#dash-growatt-dialog .dash__home-modal-body.growatt-app {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.dash__growatt-modal-section {
  margin-bottom: 1rem;
}

.dash__growatt-modal-section:last-of-type {
  margin-bottom: 0.5rem;
}

.dash__growatt-modal-h4 {
  font-size: 0.88rem !important;
  margin-bottom: 0.45rem !important;
}

.dash__growatt-modal-chart-host .growatt-app__chart-host {
  min-height: 12rem;
}

.dash__growatt-modal-chart-host .growatt-app__chart-plot {
  min-height: 16rem;
}

.dash__growatt-modal-body .growatt-app__nota,
#dash-growatt-dialog .dash__home-modal-body .growatt-app__nota {
  color: #5a6a7e;
}

#dash-growatt-dialog .growatt-app__fv-dia {
  margin: 0;
}

/* Tabs Potência / FV / Consumo (modal dashboard) */
.dash__growatt-chart-tabs {
  display: flex;
  gap: 0;
  margin: 0 0 0.65rem;
  padding: 0;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #fff;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.dash__growatt-chart-tab {
  flex: 1;
  margin: 0;
  padding: 0.55rem 0.35rem;
  border: none;
  border-right: 1px solid rgba(15, 23, 42, 0.08);
  background: transparent;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease;
}

.dash__growatt-chart-tab:last-child {
  border-right: none;
}

.dash__growatt-chart-tab:hover {
  color: #0f172a;
  background: rgba(241, 245, 249, 0.9);
}

.dash__growatt-chart-tab:focus-visible {
  outline: 2px solid #0ea5e9;
  outline-offset: -2px;
  z-index: 1;
}

.dash__growatt-chart-tab--on {
  color: #0f172a;
  background: linear-gradient(180deg, rgba(224, 242, 254, 0.95) 0%, rgba(186, 230, 253, 0.75) 100%);
  font-weight: 700;
}

#dash-growatt-dialog .growatt-app__fv-dia .growatt-app__chart-host--fv-hora {
  min-height: 12rem;
}

#dash-growatt-dialog .growatt-app__fv-dia .growatt-app__chart-plot--fv-hora {
  min-height: 14rem;
}

/* Modal Produção solar: resumo energia (mesmo cartão branco que na modal Rede) */
#dash-growatt-dialog .growatt-app__energy {
  margin: 0;
  padding: 0.75rem 0.85rem 0.95rem;
  background: #fff;
  border: none;
  border-radius: 0.75rem;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06);
  backdrop-filter: none;
}

#dash-growatt-dialog .growatt-app__energy .growatt-app__energy-head {
  margin: 0.5rem 0 0.32rem;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.25;
  color: #0f172a;
  text-shadow: none;
}

#dash-growatt-dialog .growatt-app__energy .growatt-app__energy-head:first-child {
  margin-top: 0;
}

#dash-growatt-dialog .growatt-app__energy .growatt-app__stackbar {
  margin-bottom: 0.12rem;
}

#dash-growatt-dialog .growatt-app__energy .growatt-app__stackbar:last-of-type {
  margin-bottom: 0;
}

#dash-growatt-dialog .growatt-app__energy .growatt-app__stackbar-track {
  height: 1.35rem;
  background: #e2e8f0;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
}

#dash-growatt-dialog .growatt-app__energy .growatt-app__stackbar-labels {
  margin-top: 0.35rem;
  font-size: 0.68rem;
  color: #64748b;
}

#dash-growatt-dialog .growatt-app__energy .growatt-app__stackbar-labels strong {
  color: #475569;
}

#dash-growatt-dialog .growatt-app__energy .growatt-app__hint {
  font-size: 0.68rem;
  margin: 0.4rem 0 0;
  color: #64748b;
}

/* Modal Rede: 3 cartões empilhados (tabela + barras energia + bi-horária), como mockup */
.dash__rede-modal-growatt.growatt-app {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 0;
  max-width: none;
  margin: 0;
  padding: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  color: #0f172a;
  isolation: auto;
}

.dash__rede-modal-growatt .growatt-app__energy {
  margin: 0;
  padding: 0.75rem 0.85rem 0.95rem;
  background: #fff;
  border: none;
  border-radius: 0.75rem;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06);
  backdrop-filter: none;
}

.dash__rede-modal-growatt .growatt-app__energy-head,
.dash__rede-modal-growatt .growatt-app__chart-card {
  color: #0f172a;
  text-shadow: none;
}

.dash__rede-modal-growatt .growatt-app__energy-head {
  margin: 0.5rem 0 0.32rem;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.25;
}

.dash__rede-modal-growatt .growatt-app__energy-head:first-child {
  margin-top: 0;
}

.dash__rede-modal-growatt .growatt-app__stackbar {
  margin-bottom: 0.12rem;
}

.dash__rede-modal-growatt .growatt-app__stackbar:last-of-type {
  margin-bottom: 0;
}

.dash__rede-modal-growatt .growatt-app__stackbar-track {
  height: 1.35rem;
  background: #e2e8f0;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
}

.dash__rede-modal-growatt .growatt-app__stackbar-labels {
  margin-top: 0.35rem;
  font-size: 0.68rem;
  color: #64748b;
}

.dash__rede-modal-growatt .growatt-app__stackbar-labels strong {
  color: #475569;
}

.dash__rede-modal-growatt .growatt-app__hint {
  font-size: 0.68rem;
  margin: 0.4rem 0 0;
  color: #64748b;
}

.dash__rede-modal-growatt .growatt-app__bi.growatt-app__chart-card {
  margin: 0;
  padding: 0.75rem 0.85rem 0.95rem;
  background: #fff;
  border: none;
  border-radius: 0.75rem;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06);
}

.dash__rede-modal-growatt .growatt-app__bi .growatt-app__bi-first-head {
  font-size: 0.8rem;
  margin-top: 0;
}

.dash__rede-modal-growatt .growatt-app__bi .growatt-app__bi-hint-tight {
  margin-top: 0.2rem;
  margin-bottom: 0.4rem;
  font-size: 0.68rem;
  color: #64748b;
}

.dash__rede-modal-growatt .growatt-app__stackbar-labels--tri {
  padding-bottom: 0.1rem;
}

/* ── Money / Orçamento card ── */
.dash__money-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.dash__money-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.6rem 0.65rem;
  border-radius: 0.75rem;
  background: #eef2f7;
}

.dash__money-label {
  font-size: 0.55rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8895a7;
}

.dash__money-val {
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.dash__money-val--pos { color: #2d6b42; }
.dash__money-val--neg { color: #c0605a; }

.dash__money-saldo {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.dash__money-saldo-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.dash__money-saldo-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: #3d4f63;
}

.dash__money-saldo-val {
  font-size: 1.25rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.dash__money-saldo-val--pos { color: #2d6b42; }
.dash__money-saldo-val--neg { color: #c0605a; }

.dash__money-bar {
  height: 0.3rem;
  background: #eef2f7;
  border-radius: 999px;
  overflow: hidden;
}

.dash__money-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}

.dash__money-bar-fill--low  { background: linear-gradient(90deg, #34d058 0%, #2d6b42 100%); }
.dash__money-bar-fill--mid  { background: linear-gradient(90deg, #f5a623 0%, #b45309 100%); }
.dash__money-bar-fill--high { background: linear-gradient(90deg, #f56565 0%, #c0605a 100%); }

.dash__money-pct {
  font-size: 0.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  align-self: flex-end;
}

.dash__money-pct--low  { color: #2d6b42; }
.dash__money-pct--mid  { color: #b45309; }
.dash__money-pct--high { color: #c0605a; }

/* ── Temperaturas + dicas: metade/metade (tablet+); empilhado em mobile ── */
.dash__tips-temps-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.dash__tips-temps-row > turbo-frame {
  display: block;
  min-width: 0;
}

@media (min-width: 640px) {
  .dash__tips-temps-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    align-items: stretch;
  }

  .dash__tips-temps-row .dash__section {
    height: 100%;
  }
}

/* ── Dicas / recomendações ── */

.dash__tips-head-right {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dash__tips-refresh-form {
  display: inline;
  margin: 0;
  padding: 0;
}

.dash__tips-refresh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #8a9aab;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.dash__tips-refresh-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #3d4f63;
}

.dash__tips-refresh-btn:disabled {
  opacity: 0.45;
  cursor: wait;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.dash__tips-badge {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b7c8f;
  background: #eef2f6;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}

.dash__tips-empty {
  margin: 0;
  font-size: 0.78rem;
  color: #6b7c8f;
  line-height: 1.45;
}

.dash__tips-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.dash__tip {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.85rem;
  background: #f7f9fb;
  border: 1px solid #e8edf2;
}

.dash__tip-icon {
  flex-shrink: 0;
  font-size: 1.25rem;
  line-height: 1.2;
}

.dash__tip-body {
  min-width: 0;
}

.dash__tip-title {
  margin: 0 0 0.15rem;
  font-size: 0.8rem;
  font-weight: 650;
  color: #2c3e50;
}

.dash__tip-text {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.4;
  color: #5a6b7d;
}

.dash__tip--solar {
  background: linear-gradient(135deg, #fffbeb 0%, #fef9e8 100%);
  border-color: #f0e4b8;
}

.dash__tip--solar .dash__tip-title { color: #7a5f12; }

.dash__tip--savings {
  background: linear-gradient(135deg, #f0fdf6 0%, #ecfdf5 100%);
  border-color: #b8e6cf;
}

.dash__tip--savings .dash__tip-title { color: #166534; }

.dash__tip--warning {
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border-color: #fed7aa;
}

.dash__tip--warning .dash__tip-title { color: #9a3412; }

.dash__tip--weather {
  background: linear-gradient(135deg, #eff6ff 0%, #e0f2fe 100%);
  border-color: #bae6fd;
}

.dash__tip--weather .dash__tip-title { color: #0369a1; }

.dash__tip--info .dash__tip-title { color: #3d4f63; }

/* ── Rodapé do dashboard (Definições) ── */
.dash__footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.25rem 0 0.5rem;
}

.dash__footer-settings {
  flex: 1 1 calc(50% - 0.25rem);
  max-width: calc(50% - 0.25rem);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--dh-muted);
  text-decoration: none;
  background: var(--dh-section-bg);
  border: 1px solid var(--dh-hairline);
  border-radius: 999px;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.dash__footer-settings:hover {
  color: var(--dh-accent);
  border-color: rgba(33, 125, 187, 0.35);
  background: var(--dh-section-bg);
}

.dash__footer-settings-icon {
  flex-shrink: 0;
  opacity: 0.85;
}

/* ── Responsive ── */
@media (max-width: 519px) {
  .dash {
    padding: 0 0.75rem 2rem;
  }

  .dash__topbar {
    flex-wrap: wrap;
  }

  .dash__title {
    font-size: 1.25rem;
    flex: 1 1 100%;
  }
}

/* Botão ↻ dentro de um turbo-frame (ex. Temperaturas): roda enquanto o frame carrega. */
turbo-frame[busy] .dash__refresh-weather-btn svg {
  animation: dash-refresh-rodar 0.8s linear infinite;
}

@keyframes dash-refresh-rodar {
  to { transform: rotate(360deg); }
}

/* Separadores em link (ex. Hoje / 3 dias / 7 dias na evolução da temperatura). */
a.dash__growatt-chart-tab {
  display: block;
  text-align: center;
  text-decoration: none;
}

/* Modal «Rede — consumo hoje»: cartão da poupança de hoje (painéis + bateria), com as contas. */
.dash__rede-modal-poupanca {
  margin-top: 0.75rem;
}

.dash__rede-modal-sub {
  margin: 0 0 0.45rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: #0f172a;
}

.dash__rede-modal-total-label small {
  display: block;
  font-weight: 500;
  color: #64748b;
}

.dash__rede-modal-total-val--poupanca {
  color: #15803d;
}

.dash__rede-modal-poupanca-nota {
  margin: 0.6rem 0 0;
  font-size: 0.74rem;
  line-height: 1.45;
  color: #64748b;
}

/* Previsão 10 dias: cada dia é um botão que abre a «Previsão por horas» desse dia. */
button.dash__weather-modal-day {
  width: 100%;
  font: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
}

button.dash__weather-modal-day:hover {
  border-color: rgba(91, 141, 184, 0.45);
}

.dash__weather-modal-day-chev {
  margin-left: 0.15rem;
  font-size: 1.1rem;
  line-height: 1;
  color: #94a3b8;
}

/* «Gastos de hoje»: título e o botão «Histórico» (abre a modal «Gastos por dia») na mesma linha. */
.dash__rede-modal-sub-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.dash__rede-modal-sub-row .dash__rede-modal-sub {
  margin: 0;
}

.dash__gastos-historico-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 999px;
  background: #fff;
  color: #217dbb;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 650;
  cursor: pointer;
}

.dash__gastos-historico-btn:hover {
  border-color: #217dbb;
}

/* Modal «Gastos por dia»: a turbo-frame ocupa o painel (o corpo é que rola) e fica esbatida a carregar. */
.dash__gastos-dia-modal .dash__home-modal-panel {
  max-width: 30rem;
}

.dash__gastos-dia-frame {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  transition: opacity 0.15s;
}

.dash__gastos-dia-frame[busy] {
  opacity: 0.5;
  pointer-events: none;
}

.dash__gastos-dia-quando {
  margin: 0 0 0.6rem;
  font-size: 0.8rem;
  color: #475569;
}

.dash__gastos-dia-quando strong {
  color: #0f172a;
}

/* .growatt-app só para as cores das setas: sem a altura/margens da página /growatt. */
.dash__gastos-dia-nav.growatt-app,
html[data-growatt-theme="light"] .dash__gastos-dia-nav.growatt-app {
  min-height: 0;
  max-width: none;
  margin: 0.35rem 0 0.25rem;
  padding: 0;
  background: transparent;
}

/* Filtro Dia | Mês no início da modal «Gastos» (os separadores são links da turbo-frame). */
.dash__gastos-escala {
  margin-bottom: 0.15rem;
}

.dash__gastos-escala a.dash__growatt-chart-tab {
  text-decoration: none;
  text-align: center;
}

.dash__gastos-dia-nav .growatt-app__date-row {
  padding: 0.25rem 0;
}

/* Tabela dos gastos: linha «Total» no fim das colunas (kWh e €), afastada da última linha. */
.dash__rede-modal-table tfoot th {
  padding: 0.45rem 0.35rem 0.45rem 0;
  text-align: left;
  vertical-align: middle;
}

.dash__rede-modal-table tfoot td {
  padding: 0.45rem 0.15rem;
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}

.dash__rede-modal-table tbody tr:last-child th,
.dash__rede-modal-table tbody tr:last-child td {
  padding-bottom: 0.8rem;
}

.dash__rede-modal-table tfoot .dash__rede-modal-total-row th,
.dash__rede-modal-table tfoot .dash__rede-modal-total-row td {
  padding-top: 0.8rem;
  padding-bottom: 0.7rem;
  border-top: 2px solid rgba(15, 23, 42, 0.18);
  font-weight: 700;
  color: #0f172a;
}

/* Mês de faturação: aluguer do contador e, em destaque, o total a pagar. */
.dash__rede-modal-table tfoot .dash__rede-modal-contador-row th,
.dash__rede-modal-table tfoot .dash__rede-modal-contador-row td {
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
  color: #475569;
}

.dash__rede-modal-contador-row small {
  font-weight: 500;
  color: #94a3b8;
}

.dash__rede-modal-table tfoot .dash__rede-modal-pagar-row th,
.dash__rede-modal-table tfoot .dash__rede-modal-pagar-row td {
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
  border-top: 1px solid rgba(15, 23, 42, 0.12);
  background: #eaf4fc;
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
}

.dash__rede-modal-table tfoot .dash__rede-modal-pagar-row th {
  padding-left: 0.6rem;
  border-radius: 0.45rem 0 0 0.45rem;
}

.dash__rede-modal-table tfoot .dash__rede-modal-pagar-row td {
  padding-right: 0.6rem;
  border-radius: 0 0.45rem 0.45rem 0;
  color: #217dbb;
}
/* Casa 3D: usa o esqueleto .mm (Money/Agenda); aqui só o cartão que ocupa o resto do ecrã. */
/* Presa ao ecrã (fixed): fica sempre do tamanho exato da parte visível, mesmo com o que o layout
   põe à volta (ex. o espaço da barra inferior, que aqui não existe) — sem isto, no tablet o fundo
   ficava cortado, já que a página não tem scroll. */
.mm.home3d {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  height: auto;
  min-height: 0;
  margin: 0 auto;
  padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
}

/* A página do 3D nunca se mexe: sem scroll nem «elástico» (iPhone). O scroll dentro das modais não
   passa para ela quando chega ao fim. */
html:has(.mm.home3d),
html:has(.mm.home3d) body {
  overflow: hidden;
  overscroll-behavior: none;
  /* Sem zoom da página (beliscar / duplo toque): ficava tudo fora do sítio. Arrastar continua a
     funcionar; o zoom das câmaras e o do 3D são da app (camera_zoom / OrbitControls). */
  touch-action: pan-x pan-y;
}

.home3d dialog,
.home3d dialog * {
  overscroll-behavior: contain;
}

/* O 3D ocupa o cartão todo (sem título nem margens). */
.mm.home3d .home3d__card {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.home3d__stage {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: inherit;
  overflow: hidden;
  touch-action: none;
}

.home3d__stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.home3d__status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  font-size: 0.85rem;
  color: #3d4f63;
  pointer-events: none;
}

.home3d__status[hidden] {
  display: none;
}

/* Etiquetas presas ao modelo — produção solar e rede (CSS2DRenderer, por cima do canvas). */
.home3d__labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.home3d__chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  padding: 0.2rem 0.45rem 0.25rem;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 2px 10px rgba(11, 18, 32, 0.18);
  color: #1c2433;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  white-space: nowrap;
  transform: translateY(-1.2rem);
}

.home3d__chip-nome {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.58rem;
  font-weight: 600;
  line-height: 1.2;
  color: #5b6878;
}

.home3d__chip-nome svg {
  width: 11px;
  height: 11px;
  color: #f0a500;
}

.home3d__chip-valor {
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.2;
}

.home3d__chip.is-off svg {
  color: #9aa6b4;
}

.home3d__chip--rede svg {
  color: #217dbb;
}

/* Rede: só o valor, a vermelho a consumir e a verde a exportar. */
.home3d__chip--rede.is-import .home3d__chip-valor,
.home3d__chip--rede.is-import svg {
  color: #d64545;
}

.home3d__chip--rede.is-export .home3d__chip-valor,
.home3d__chip--rede.is-export svg {
  color: #2e9d5b;
}

.home3d__chip--bateria svg {
  color: #217dbb;
}

.home3d__chip--bateria.is-carga svg {
  color: #2e9d5b;
}

.home3d__chip--bateria.is-descarga svg {
  color: #e08a1e;
}

.home3d__chip--bateria.is-fraca svg {
  color: #d64545;
}

.home3d__chip--bomba svg {
  color: #c2410c;
}

/* Auto / Dia / Noite (na modal «Opções»), como um interruptor de três posições. */
.home3d__modos {
  display: inline-flex;
  gap: 0.15rem;
  padding: 0.15rem;
  border-radius: 0.6rem;
  background: #eef2f7;
}

/* Mais específico do que .mm__btn--ghost e os temas do painel. */
.home3d .home3d__modos .home3d__modo[aria-pressed="false"] {
  background: transparent;
  color: #3d4f63;
}

.home3d .home3d__modos .home3d__modo[aria-pressed="true"] {
  background: #0b1220;
  color: #fff;
}

.home3d__chip--toalheiro svg {
  color: #c2410c;
}

/* Fluxo da bateria: −1,5 kW a vermelho a descarregar, +1,2 kW a verde a carregar. */
.home3d__fluxo {
  margin-left: 0.1rem;
}

.home3d__chip--bateria.is-descarga .home3d__fluxo {
  color: #d64545;
}

.home3d__chip--bateria.is-carga .home3d__fluxo {
  color: #2e9d5b;
}

/* BMW a carregar: consumo, a vermelho como a rede a importar. */
.home3d__chip--carro svg,
.home3d__chip--carro .home3d__chip-valor {
  color: #d64545;
}

/* Bomba de calor, toalheiros e ACs a consumir: o valor também a vermelho. */
.home3d__chip--bomba .home3d__chip-valor,
.home3d__chip--toalheiro .home3d__chip-valor,
.home3d__chip--ac .home3d__chip-valor,
.home3d__chip--ac .home3d__chip-linha b {
  color: #d64545;
}

.home3d__chip--ac .home3d__chip-nome svg {
  color: #217dbb;
}

/* Várias coisas na mesma etiqueta (ACs do recanto): nome à esquerda, valor à direita. */
.home3d__chip-linha {
  display: flex;
  align-self: stretch; /* com vários ACs, os valores alinham à direita */
  justify-content: space-between;
  gap: 0.4rem;
  font-size: 0.64rem;
  line-height: 1.3;
}

.home3d__chip-linha b {
  font-weight: 700;
}

.home3d__chip-linha span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.home3d__chip-linha svg {
  width: 11px;
  height: 11px;
}

/* Etiquetas clicáveis: abrem a modal correspondente do dashboard. */
.home3d__chip[data-abre] {
  pointer-events: auto;
  cursor: pointer;
}

.home3d__chip-linha[data-ac] {
  cursor: pointer;
}

/* Bloco «Produção Solar» do dashboard carregado só pelas modais: tudo invisível menos os <dialog>
   (que abrem na top layer, fora deste recorte). */
.home3d__modais {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  visibility: hidden;
  pointer-events: none;
}

.home3d__modais dialog {
  visibility: visible;
  pointer-events: auto;
}

/* Cards no céu: resumo da produção solar de hoje, por cima do 3D. */
.home3d__ceu {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  pointer-events: none;
}

.home3d__ceu[hidden] {
  display: none;
}

.home3d .home3d__ceu-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  min-width: 8.5rem;
  padding: 0.5rem 0.75rem 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.78);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(11, 18, 32, 0.16);
  color: #1c2433;
  font: inherit;
  text-align: left;
  cursor: pointer;
  pointer-events: auto;
}

.home3d__ceu-card:hover {
  background: rgba(255, 255, 255, 0.92);
}

.home3d__ceu-nome {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #5b6878;
}

.home3d__ceu-nome svg {
  width: 13px;
  height: 13px;
  color: #f0a500;
}

.home3d__ceu-valor {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.2;
}

.home3d__ceu-sub {
  font-size: 0.7rem;
  color: #5b6878;
}

.home3d__ceu-barra {
  align-self: stretch;
  height: 4px;
  margin-top: 0.2rem;
  border-radius: 2px;
  background: linear-gradient(90deg, #f0a500 var(--pct), rgba(91, 104, 120, 0.2) var(--pct));
}

/* Telemóvel: uma fila que desliza na horizontal em vez de tapar o céu todo. */
@media (max-width: 640px) {
  .home3d__ceu {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    pointer-events: auto;
    scrollbar-width: none;
  }

  .home3d .home3d__ceu-card {
    flex: none;
    min-width: 7.5rem;
  }
}

/* Consumo agora: consumo é sempre a vermelho (o saldo tem a sua cor: is-defice / is-excedente). */
.home3d__ceu-card--casa .home3d__ceu-nome svg,
.home3d__ceu-card--casa .home3d__ceu-linha:not(.home3d__ceu-linha--rodape) b {
  color: #d64545;
}






/* Cenas do dashboard dentro da modal: sem o cartão por fora. */
.home3d__cenas .dash__section {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
}

.home3d__cenas .dash__section-head {
  display: none;
}

/* Temperatura e humidade de cada divisão, à frente da janela (sem clique: deixa abrir a persiana). */
.home3d__temp {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: rgba(11, 18, 32, 0.72);
  color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 0.72rem;
  white-space: nowrap;
}

.home3d__temp b {
  font-weight: 700;
}

.home3d__temp span {
  color: #9fd3ff;
  font-size: 0.66rem;
}

.home3d__temp.is-offline {
  background: rgba(91, 104, 120, 0.7);
}

.home3d__temp.is-offline span {
  color: #d6dde5;
}


/* Painéis a produzir: «+525 W» a verde. */
.home3d__chip--solar.is-producao .home3d__chip-valor {
  color: #2e9d5b;
}

.home3d__ceu-card--bateria .home3d__ceu-nome svg {
  color: #217dbb;
}

.home3d__ceu-card--bateria .home3d__ceu-barra {
  background: linear-gradient(90deg, #2e9d5b var(--pct), rgba(91, 104, 120, 0.2) var(--pct));
}


/* Bateria: a frase dos carregamentos da rede (TOU), em até duas linhas. */
.home3d__ceu-tou {
  max-width: 11.5rem;
  margin-top: 0.15rem;
  font-size: 0.68rem;
  line-height: 1.25;
  color: #5b6878;
  white-space: normal;
}

.home3d__ceu-tou.is-carga {
  color: #217dbb;
}

.home3d__ceu-tou.is-agora {
  font-weight: 700;
}

.home3d__ceu-tou.is-aviso {
  color: #c2410c;
}

/* Consumo agora: as 3 coisas a gastar mais (nome à esquerda, W à direita). */
.home3d__ceu-linha {
  display: flex;
  align-self: stretch;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.7rem;
  line-height: 1.3;
  color: #5b6878;
}

.home3d__ceu-linha span {
  max-width: 8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home3d__ceu-linha b {
  color: #1c2433;
  font-weight: 700;
}

/* Tempo: mais largo (descrição, hoje/amanhã e o sol). */
.home3d .home3d__ceu-card--tempo {
  min-width: 12.5rem;
}

/* Destrancar portão / porta (videoporteiro). */
.home3d__chip--trinco svg {
  color: #b45309;
}

.home3d__chip--trinco .home3d__chip-valor {
  color: #b45309;
}

/* Trincos: só o cadeado, num botão redondo por cima do portão / da porta. */
html .mm.home3d .home3d__chip.home3d__chip--trinco.home3d__chip--icone {
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border-radius: 999px;
}

html .mm.home3d .home3d__chip.home3d__chip--trinco.home3d__chip--icone svg {
  width: 1.4rem;
  height: 1.4rem;
}

/* Ar condicionado: ícone do modo antes da temperatura pretendida; desligados a cinzento. */
.home3d__ceu-card--ac .home3d__ceu-nome svg {
  color: #217dbb;
}

.home3d__ceu-linha b {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.home3d__ceu-linha b svg {
  width: 12px;
  height: 12px;
}

.home3d__ceu-linha.is-off b {
  color: #9aa6b4;
  font-weight: 600;
}

.home3d__ceu-linha[data-ac]:hover span {
  color: #1c2433;
  text-decoration: underline;
}

/* Consumo agora: o custo de hoje em rodapé, separado das 3 maiores. */
.home3d__ceu-linha--rodape {
  margin-top: 0.25rem;
  padding-top: 0.25rem;
  border-top: 1px solid rgba(91, 104, 120, 0.2);
  cursor: pointer;
}

.home3d__ceu-linha--rodape:hover span {
  color: #1c2433;
  text-decoration: underline;
}

.home3d__ceu-linha--rodape b {
  color: #d64545;
}

/* Produção hoje: a poupança (painéis, bateria) em rodapé, a verde; só a primeira linha leva o traço. */
.home3d__ceu-linha--rodape.is-poupanca b {
  color: #1f8a4c;
}

.home3d__ceu-card > .home3d__ceu-linha--rodape.is-seguinte {
  margin-top: 0;
  padding-top: 0.1rem;
  border-top: 0;
}

.home3d__ceu-card > .home3d__ceu-linha--rodape ~ .home3d__ceu-barra {
  margin-top: 0.4rem;
}

/* ══ Tema «Liquid Glass» (a Casa 3D usa-o sempre; variáveis --g-* em solar_skin_liquid.css) ══ */

/* O cartão do 3D: o canvas tapa-o todo, por isso sem desfoque (só custava a desenhar). */
html .mm.home3d.solar-skin--liquid .home3d__card {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  overflow: hidden;
}

/* Cards no céu: vidro com aresta especular. */
html .mm.home3d.solar-skin--liquid .home3d__ceu-card {
  color: var(--g-ink);
  background: var(--g-sheen), rgba(255, 255, 255, 0.5);
  border: 1px solid var(--g-edge);
  border-radius: 1.4rem;
  box-shadow: var(--g-shadow), var(--g-spec);
  -webkit-backdrop-filter: blur(14px) saturate(1.8);
  backdrop-filter: blur(14px) saturate(1.8);
}

html .mm.home3d.solar-skin--liquid .home3d__ceu-card:hover {
  background: var(--g-sheen), var(--g-fill-hover);
}

html .mm.home3d.solar-skin--liquid .home3d__ceu-nome {
  color: var(--g-muted);
}

html .mm.home3d.solar-skin--liquid .home3d__ceu-valor {
  font-family: var(--g-round);
  letter-spacing: -0.02em;
}

html .mm.home3d.solar-skin--liquid :is(.home3d__ceu-sub, .home3d__ceu-linha, .home3d__ceu-tou) {
  color: var(--g-ink-2);
}

html .mm.home3d.solar-skin--liquid .home3d__ceu-linha b {
  color: var(--g-ink);
}

html .mm.home3d.solar-skin--liquid .home3d__ceu-linha.is-off b {
  color: var(--g-muted);
}

html .mm.home3d.solar-skin--liquid .home3d__ceu-linha--rodape {
  border-top-color: rgba(255, 255, 255, 0.8);
}

html .mm.home3d.solar-skin--liquid .home3d__ceu-linha--rodape b {
  color: var(--g-red-ink);
}

html .mm.home3d.solar-skin--liquid .home3d__ceu-linha--rodape.is-poupanca b {
  color: var(--g-green-ink);
}

html .mm.home3d.solar-skin--liquid .home3d__ceu-tou.is-carga {
  color: var(--g-blue-ink);
}

html .mm.home3d.solar-skin--liquid .home3d__ceu-barra {
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--g-orange) var(--pct), rgba(255, 255, 255, 0.65) var(--pct));
}

html .mm.home3d.solar-skin--liquid .home3d__ceu-card--bateria .home3d__ceu-barra {
  background: linear-gradient(90deg, var(--g-green) var(--pct), rgba(255, 255, 255, 0.65) var(--pct));
}


/* Etiquetas no modelo: cápsulas de vidro mais opacas (sem desfoque: mexem-se com a câmara). */
html .mm.home3d.solar-skin--liquid .home3d__chip {
  color: var(--g-ink);
  font-family: var(--g-font);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.78));
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 0.85rem;
  box-shadow: 0 10px 24px -12px rgba(20, 35, 90, 0.45), inset 0 1px 0 #fff, inset 0 -6px 12px -10px rgba(20, 40, 110, 0.2);
}

html .mm.home3d.solar-skin--liquid .home3d__chip-nome {
  color: var(--g-muted);
}

html .mm.home3d.solar-skin--liquid .home3d__chip-valor {
  font-family: var(--g-round);
}

html .mm.home3d.solar-skin--liquid .home3d__chip--solar.is-producao .home3d__chip-valor,
html .mm.home3d.solar-skin--liquid .home3d__chip--rede.is-export .home3d__chip-valor,
html .mm.home3d.solar-skin--liquid .home3d__chip--bateria.is-carga .home3d__fluxo {
  color: var(--g-green-ink);
}

html .mm.home3d.solar-skin--liquid .home3d__chip--carro .home3d__chip-valor,
html .mm.home3d.solar-skin--liquid .home3d__chip--bomba .home3d__chip-valor,
html .mm.home3d.solar-skin--liquid .home3d__chip--toalheiro .home3d__chip-valor,
html .mm.home3d.solar-skin--liquid .home3d__chip--ac :is(.home3d__chip-valor, .home3d__chip-linha b),
html .mm.home3d.solar-skin--liquid .home3d__ceu-card--casa .home3d__ceu-linha:not(.home3d__ceu-linha--rodape) b,
html .mm.home3d.solar-skin--liquid .home3d__chip--rede.is-import .home3d__chip-valor,
html .mm.home3d.solar-skin--liquid .home3d__chip--bateria.is-descarga .home3d__fluxo {
  color: var(--g-red-ink);
}

html .mm.home3d.solar-skin--liquid .home3d__chip--trinco :is(svg, .home3d__chip-valor) {
  color: var(--g-orange-ink);
}

/* Câmaras do anexo: botão mais pequeno. */
html .mm.home3d .home3d__chip.home3d__chip--trinco.home3d__chip--icone.home3d__chip--pequeno {
  width: 2rem;
  height: 2rem;
}

html .mm.home3d .home3d__chip.home3d__chip--trinco.home3d__chip--icone.home3d__chip--pequeno svg {
  width: 1rem;
  height: 1rem;
}

/* Câmaras de segurança (mesmo botão redondo dos trincos): ícone azul. */
.home3d__chip--camara svg,
html .mm.home3d.solar-skin--liquid .home3d__chip--trinco.home3d__chip--camara svg {
  color: var(--g-blue-ink, #217dbb);
}

html .mm.home3d.solar-skin--liquid .home3d__temp {
  font-family: var(--g-font);
  background: rgba(10, 15, 31, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

/* Topo: Auto / Dia / Noite como o seletor de vista do My Money. */
html .mm.home3d.solar-skin--liquid .home3d__modos {
  background: var(--g-sheen), var(--g-fill);
  border: 1px solid var(--g-edge);
  border-radius: 999px;
  box-shadow: var(--g-shadow), var(--g-spec);
}

html .mm.home3d.solar-skin--liquid .home3d__modos .home3d__modo {
  border-radius: 999px;
}

html .mm.home3d.solar-skin--liquid .home3d__modos .home3d__modo[aria-pressed="false"] {
  color: var(--g-ink-2);
  background: transparent;
}

html .mm.home3d.solar-skin--liquid .home3d__modos .home3d__modo[aria-pressed="true"] {
  color: var(--g-blue);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 14px -6px rgba(20, 35, 90, 0.35), inset 0 1px 0 #fff;
}


/* % das persianas: logo abaixo da temperatura (mesmo ponto; o padding-top empurra-a no ecrã), em
   vidro claro para se distinguir dela. */
.home3d__pct-ancora {
  padding-top: 3rem;
  pointer-events: none;
}

.home3d .home3d__pct {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 0.72rem;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.88);
  color: #1c2433;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.95);
}

.home3d__pct svg {
  width: 11px;
  height: 11px;
  color: #3d4f63;
}

/* Cabeça do card Persianas: nome à esquerda, botão «%» à direita. */
.home3d__ceu-cabeca {
  display: flex;
  align-self: stretch;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.home3d .home3d__ceu-toggle {
  padding: 0.1rem 0.5rem;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  color: #3d4f63;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 0 0 1px rgba(255, 255, 255, 0.75);
}

.home3d .home3d__ceu-toggle[aria-pressed="true"] {
  color: #fff;
  background: #0a84ff;
  box-shadow: 0 4px 10px -4px rgba(10, 132, 255, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.home3d .home3d__pct {
  pointer-events: auto;
  cursor: pointer;
}

/* Área de toque maior do que o balão (no telemóvel acerta-se melhor). */
.home3d .home3d__pct {
  position: relative;
}

.home3d .home3d__pct::after {
  content: "";
  position: absolute;
  inset: -0.6rem -0.5rem;
}

/* % escondida: só um ponto a pulsar a meio da janela, com 44 px de área de toque. */
.home3d__pct-ancora.is-ponto {
  padding-top: 0;
}

.home3d .home3d__pct-ancora.is-ponto .home3d__pct {
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 0;
  box-shadow: none;
}

.home3d .home3d__pct-ancora.is-ponto .home3d__pct svg {
  display: none;
}

.home3d .home3d__pct-ancora.is-ponto .home3d__pct::before {
  content: "";
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: #217dbb;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(11, 18, 32, 0.35);
  animation: home3d-ponto 2.4s ease-out infinite;
}

.home3d .home3d__pct-ancora.is-ponto .home3d__pct:hover::before {
  background: #0b5d99;
}

@keyframes home3d-ponto {
  0% { box-shadow: 0 1px 4px rgba(11, 18, 32, 0.35), 0 0 0 0 rgba(33, 125, 187, 0.55); }
  70% { box-shadow: 0 1px 4px rgba(11, 18, 32, 0.35), 0 0 0 0.6rem rgba(33, 125, 187, 0); }
  100% { box-shadow: 0 1px 4px rgba(11, 18, 32, 0.35), 0 0 0 0 rgba(33, 125, 187, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .home3d .home3d__pct-ancora.is-ponto .home3d__pct::before {
    animation: none;
  }
}

/* «Atualizado às 10:22» (leitura do inversor) no canto inferior esquerdo do 3D. */
.home3d__atualizado {
  position: absolute;
  left: 0.9rem;
  bottom: 0.9rem;
  z-index: 2;
  margin: 0;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #3d4f63;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 14px -8px rgba(20, 35, 90, 0.35), inset 0 1px 0 #fff;
}

.home3d__atualizado {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding-right: 0.3rem;
}

.home3d .home3d__verificar {
  display: inline-grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  color: #0a84ff;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 0 0 1px rgba(10, 132, 255, 0.25);
  cursor: pointer;
}

.home3d .home3d__verificar:hover {
  background: #fff;
}

.home3d__verificar.is-a-verificar svg {
  animation: home3d-rodar 0.8s linear infinite;
}

@keyframes home3d-rodar {
  to { transform: rotate(360deg); }
}

/* ══ Cards no céu uniformes: grelha à largura toda, mesma largura e altura em todos ══ */
.home3d__ceu {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  align-items: stretch;
}

.home3d .home3d__ceu-card,
.home3d .home3d__ceu-card--tempo {
  min-width: 0;
  padding: 0.6rem 0.8rem 0.65rem;
}

/* O que fecha o card (barra, rodapé do custo) fica sempre no fundo, alinhado entre cards. */
.home3d__ceu-card > .home3d__ceu-barra,
.home3d__ceu-card > .home3d__ceu-linha--rodape {
  margin-top: auto;
}

.home3d__ceu-card > .home3d__ceu-linha--rodape {
  padding-top: 0.3rem;
}

.home3d__ceu-tou {
  max-width: none;
}

.home3d__ceu-linha span {
  max-width: none;
  min-width: 0;
}

/* Cabeças com o mesmo alto, com ou sem botão («°C», «%»). */
.home3d__ceu-cabeca,
.home3d__ceu-card > .home3d__ceu-nome {
  min-height: 1.3rem;
}

.home3d .home3d__ceu-toggle {
  line-height: 1.2;
}


@media (max-width: 640px) {
  .home3d__ceu {
    display: flex;
  }

  .home3d .home3d__ceu-card,
  .home3d .home3d__ceu-card--tempo {
    flex: none;
    width: 10.5rem;
  }
}


/* Mudou: brilho a pulsar duas vezes à volta, o valor a crescer e voltar e uma seta ▲/▼ (4 s). Nas
   etiquetas do 3D não se mexe no transform do elemento (é o CSS2DRenderer que o usa). */
@keyframes home3d-mudou-brilho {
  0% { box-shadow: 0 0 0 0 rgba(10, 132, 255, 0.85); }
  70% { box-shadow: 0 0 0 14px rgba(10, 132, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(10, 132, 255, 0); }
}

@keyframes home3d-mudou-valor {
  0% { transform: scale(1); }
  20% { transform: scale(1.2); }
  45% { transform: scale(1); }
  100% { transform: scale(1); }
}

.home3d .is-mudou {
  animation: home3d-mudou-brilho 1.3s ease-out 2;
}

.home3d .is-mudou :is(.home3d__chip-valor, .home3d__ceu-valor),
.home3d .home3d__temp.is-mudou b {
  display: inline-block;
  transform-origin: left center;
  animation: home3d-mudou-valor 1.6s ease-out;
}

.home3d__seta {
  display: inline-block;
  margin-left: 0.3rem;
  font-size: 0.7em;
  vertical-align: middle;
  animation: home3d-aviso 0.25s ease-out;
}

.home3d__seta.is-sobe {
  color: #0a84ff;
}

.home3d__seta.is-desce {
  color: #b25e00;
}

/* Com «reduzir movimento» ligado no dispositivo: sem pulso nem zoom, só a seta ▲/▼. */
@media (prefers-reduced-motion: reduce) {
  .home3d .is-mudou,
  .home3d .is-mudou :is(.home3d__chip-valor, .home3d__ceu-valor),
  .home3d .home3d__temp.is-mudou b {
    animation: none;
  }
}

/* Card AC: lista em 3 colunas (nome · temperatura da divisão · estado), linhas separadas. */
.home3d__ceu-linha--lista {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto 2rem;
  align-items: center;
  gap: 0.5rem;
  padding: 0.22rem 0;
  font-size: 0.74rem;
  border-bottom: 1px solid rgba(91, 104, 120, 0.12);
  cursor: pointer;
}

.home3d__ceu-linha--lista:last-child {
  border-bottom: none;
}

.home3d__ceu-linha--lista > .home3d__ceu-quem {
  font-weight: 600;
  color: #1c2433;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home3d__ceu-meio {
  color: #5b6878;
  font-variant-numeric: tabular-nums;
}

.home3d__ceu-linha--lista > b {
  justify-content: flex-end;
}

.home3d__ceu-linha--lista > b svg {
  width: 14px;
  height: 14px;
}

.home3d__ceu-icone {
  display: inline-flex;
}

.home3d__ceu-icone svg {
  width: 14px;
  height: 14px;
}

/* Desligado: só o ícone, a vermelho. */
.home3d .home3d__ceu-linha--lista.is-off .home3d__ceu-icone {
  color: #d0261c;
}

/* Valor grande dos cards. */
.home3d .home3d__ceu-valor {
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.2;
}

/* Bateria: o fluxo ao lado da %, mais pequeno, verde a carregar e vermelho a descarregar. */
.home3d__ceu-extra {
  font-size: 1rem;
  font-weight: 700;
}

.home3d__ceu-extra.is-carga {
  color: #138a3a;
}

.home3d__ceu-extra.is-descarga {
  color: #d0261c;
}

/* Consumo agora: saldo painéis − casa, vermelho quando falta (bateria / rede) e verde quando sobra. */
.home3d .home3d__ceu-valor.is-defice {
  color: #d0261c;
}

.home3d .home3d__ceu-valor.is-excedente {
  color: #138a3a;
}

html .mm.home3d.solar-skin--liquid .home3d__ceu-valor.is-defice {
  color: var(--g-red-ink);
}

html .mm.home3d.solar-skin--liquid .home3d__ceu-valor.is-excedente {
  color: var(--g-green-ink);
}

/* Card AC: ícone · nome · pretendida · temperatura da divisão encostada à direita. */
.home3d .home3d__ceu-linha--lista {
  grid-template-columns: 14px minmax(0, 1fr) auto 2.6rem;
}

.home3d__ceu-linha--lista > b {
  color: #1c2433;
}

.home3d__ceu-linha--lista > .home3d__ceu-meio {
  text-align: right;
}

/* Os cards ficam sempre numa só linha: dividem a largura e, se não couberem (cada um precisa de
   ~10rem), a fila desliza para o lado em vez de passar para uma segunda linha. */
.home3d__ceu {
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: minmax(10rem, 1fr);
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.6rem; /* espaço para a sombra dos cards (o overflow corta-a) */
  scrollbar-width: none;
  pointer-events: auto;
}

.home3d__ceu::-webkit-scrollbar {
  display: none;
}

/* Aviso do botão «verificar» (no lugar de «Atualizado às» durante uns segundos). */
.home3d__aviso {
  animation: home3d-aviso 0.25s ease-out;
}

.home3d__aviso.is-novo {
  color: #138a3a;
}

.home3d__aviso.is-erro {
  color: #d0261c;
}

@keyframes home3d-aviso {
  from { opacity: 0; }
  to { opacity: 1; }
}


/* Balão de temperatura com histórico: clicável (abre a evolução da temperatura). */
.home3d .home3d__temp.is-clicavel {
  pointer-events: auto;
  cursor: pointer;
}


/* Card «Casa»: uma linha por modal (Luzes, Tomadas, Persianas) com o resumo e uma seta. */
.home3d .home3d__ceu-atalho-modal {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.4rem 0.5rem;
  border: none;
  border-radius: 0.7rem;
  font: inherit;
  font-size: 0.78rem;
  text-align: left;
  color: #1c2433;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 0 0 1px rgba(255, 255, 255, 0.7);
  cursor: pointer;
}

.home3d .home3d__ceu-atalho-modal:hover {
  background: rgba(255, 255, 255, 0.9);
}

.home3d__ceu-atalho-modal svg {
  width: 14px;
  height: 14px;
  color: #3d4f63;
}

.home3d__ceu-atalho-modal .home3d__ceu-quem {
  font-weight: 600;
}

.home3d__ceu-seta-modal {
  font-size: 1rem;
  line-height: 1;
  color: #9aa6b4;
}

.home3d__ceu-atalho-modal .home3d__ceu-quem {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home3d__ceu-atalho-modal .home3d__ceu-meio {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Sem a barra de cima: o 3D ocupa a página toda; o botão das opções no canto inferior direito. */
.mm.home3d {
  padding-top: calc(0.75rem + env(safe-area-inset-top, 0px));
}

.home3d .home3d__opcoes-btn {
  position: absolute;
  right: 0.9rem;
  bottom: 0.9rem;
  z-index: 2;
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  color: #3d4f63;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 6px 14px -8px rgba(20, 35, 90, 0.35), inset 0 1px 0 #fff;
  cursor: pointer;
}

.home3d .home3d__opcoes-btn svg {
  display: block;
}

/* Atualizar: à esquerda do botão das opções. */
.home3d .home3d__recarregar-btn {
  right: calc(0.9rem + 2.5rem + 0.5rem);
}

html .mm.home3d.solar-skin--liquid .home3d__opcoes-btn {
  background: var(--g-sheen), var(--g-fill);
  border: 1px solid var(--g-edge);
  box-shadow: var(--g-shadow), var(--g-spec);
  color: var(--g-ink-2, #3d4f63);
}

/* Modal «Opções»: grupos (Céu, No 3D, Desempenho) com interruptores e, no fim, voltar à aplicação. */
.home3d__opcoes {
  width: min(24rem, calc(100vw - 1.25rem));
}

.home3d__opcoes-corpo {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0 1rem 1rem;
  overflow-y: auto;
}

.home3d__opcoes-grupo {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.home3d__opcoes-titulo {
  margin: 0 0 0.15rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}

/* Céu: Auto / Dia / Noite a toda a largura. */
.home3d .home3d__opcoes .home3d__modos {
  display: flex;
}

.home3d .home3d__opcoes .home3d__modo {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.home3d .home3d__opcao {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 0.75rem;
  background: #f8fafc;
  font: inherit;
  text-align: left;
  color: #0f172a;
  cursor: pointer;
}

.home3d__opcao-texto {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.home3d__opcao-nome {
  font-size: 0.88rem;
  font-weight: 600;
}

.home3d__opcao-texto small {
  font-size: 0.72rem;
  color: #64748b;
}

/* Interruptor (desenhado: o botão é que tem o aria-pressed). */
.home3d__opcao-interruptor {
  position: relative;
  flex-shrink: 0;
  width: 2.4rem;
  height: 1.4rem;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background 0.15s;
}

.home3d__opcao-interruptor::after {
  content: "";
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.3);
  transition: transform 0.15s;
}

.home3d__opcao[aria-pressed="true"] .home3d__opcao-interruptor {
  background: #0a84ff;
}

.home3d__opcao[aria-pressed="true"] .home3d__opcao-interruptor::after {
  transform: translateX(1rem);
}

.home3d .home3d__opcoes-voltar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.75rem;
  background: #0b1220;
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}

/* Opções «Esconder pontos» e «Esconder caixas» (home-3d põe sem-pontos / sem-caixas). Os botões
   redondos (trincos, câmaras, luz da escada) ficam. */
html .mm.home3d.sem-pontos .home3d__pct-ancora.is-ponto,
html .mm.home3d.sem-caixas .home3d__chip:not(.home3d__chip--icone) {
  visibility: hidden;
}

/* Modo leve (is-leve, posto pelo home-3d): nada de vidro desfocado por cima do 3D — o browser
   tinha de voltar a desfocar o canvas por trás de cada card a cada frame. Fundo branco mais opaco
   no lugar do desfoque. */
html .mm.home3d.is-leve .home3d__stage *,
html .mm.home3d.is-leve .home3d__stage *::before,
html .mm.home3d.is-leve .home3d__stage *::after {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

html .mm.home3d.is-leve .home3d__ceu-card {
  background: var(--g-sheen, none), rgba(255, 255, 255, 0.86);
}

/* Modo leve: os pontos das persianas não pulsam (animação contínua por cima do 3D). */
html .mm.home3d.is-leve .home3d__pct-ancora.is-ponto .home3d__pct::before {
  animation: none;
}

/* Diagnóstico de desempenho (?diag=1), por cima do «Atualizado às». */
.home3d__diag {
  position: absolute;
  left: 0.6rem;
  bottom: 3.6rem;
  z-index: 5;
  margin: 0;
  padding: 0.4rem 0.6rem;
  border-radius: 0.5rem;
  background: rgba(11, 18, 32, 0.82);
  color: #e6edf6;
  font: 600 0.68rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  max-width: calc(100% - 1.2rem);
  pointer-events: none;
}

.home3d__diag-botoes {
  position: absolute;
  left: 0.6rem;
  top: 50%;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.home3d__diag-botoes button {
  padding: 0.45rem 0.7rem;
  border: 0;
  border-radius: 0.5rem;
  background: rgba(11, 18, 32, 0.82);
  color: #e6edf6;
  font: 600 0.75rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: left;
}

/* Modo leve: etiquetas escondidas enquanto a vista roda (home-3d põe/tira is-a-mexer). */
.home3d__labels.is-a-mexer {
  visibility: hidden;
}

/* Linha «ACs» do card Casa: só em telemóvel (no computador há o card «Ar condicionado»). */
.home3d .home3d__ceu-atalho-modal--mobile {
  display: none;
}

/* Modal «Ar condicionado» (telemóvel): um botão por AC; desligado com o ícone a vermelho. */
.home3d .home3d__lista-ac {
  margin-top: 0.5rem;
  padding: 0.7rem 0.8rem;
  font-size: 0.95rem;
  background: rgba(91, 104, 120, 0.08);
}

.home3d .home3d__lista-ac > svg {
  width: 18px;
  height: 18px;
}

/* Pretendida · da divisão: colunas de largura fixa, alinhadas em todas as linhas. */
.home3d .home3d__lista-ac .home3d__ceu-meio {
  display: grid;
  grid-template-columns: 2.6rem 4.4rem;
  gap: 0.5rem;
  align-items: center;
}

.home3d .home3d__lista-ac-alvo {
  text-align: right;
}

.home3d .home3d__lista-ac-sala {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
  font-weight: 500;
  color: #5b6878;
}

.home3d .home3d__lista-ac-sala svg {
  width: 14px;
  height: 14px;
  flex: none;
  color: #8a96a6;
}

/* Ligado: linha a verde, como as tomadas e as luzes ligadas. */
.home3d .home3d__lista-ac:not(.is-off) {
  background: var(--dh-plug-on-bg, #ecf8ef);
}

.home3d .home3d__lista-ac.is-off > svg {
  color: #d0261c;
}

.home3d .home3d__lista-ac.is-off .home3d__ceu-meio {
  font-weight: 500;
  color: #5b6878;
}

/* Consumo agora: por baixo do saldo, ☀ painéis a produzir e ⌂ casa a gastar, lado a lado. */
.home3d__ceu-paineis {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.6rem;
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #3d4f63;
}

.home3d__ceu-paineis > span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.home3d__ceu-paineis svg {
  width: 14px;
  height: 14px;
}

.home3d__ceu-paineis .is-paineis svg {
  color: #f0a500;
}

.home3d__ceu-paineis .is-casa svg {
  color: #3d4f63;
}

/* Bateria a descarregar: quando chega aos 20%, por baixo da %. */
.home3d__ceu-minimo {
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #3d4f63;
}

/* Custo hoje: barra repartida (vazio / fora do vazio / bateria pela rede) e a legenda por baixo. */
.home3d__ceu-dist {
  display: flex;
  gap: 2px;
  align-self: stretch;
  height: 8px;
  margin: 0.55rem 0 0.5rem;
  border-radius: 4px;
  overflow: hidden;
}

.home3d__ceu-dist > span {
  flex-grow: 0;
  flex-shrink: 1;
  min-width: 3px;
}

/* A legenda ocupa o resto da altura do card (igual à dos vizinhos), com as linhas espalhadas. */
.home3d__ceu-dist-legenda {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: space-evenly;
  align-self: stretch;
  gap: 0.3rem;
}

/* Linha da legenda, numa linha: ■ nome (Noite / Dia / Bateria) · à direita kWh · €. */
.home3d__ceu-dist-linha {
  display: grid;
  grid-template-columns: 8px max-content minmax(0, 1fr);
  column-gap: 0.4rem;
  align-items: center;
  font-size: 0.74rem;
  line-height: 1.3;
  color: #5b6878;
}

.home3d__ceu-dist-linha::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--cor);
}

.home3d__ceu-dist-linha > span {
  white-space: nowrap;
}

.home3d__ceu-dist-linha b {
  justify-self: end;
  color: #1c2433;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.home3d__ceu-dist-kwh {
  font-weight: 600;
  color: #5b6878;
}

/* Cores: noite / vazio (índigo), dia / fora do vazio (laranja), bateria carregada pela rede (azul-petróleo). */
:is(.home3d__ceu-dist > span, .home3d__ceu-dist-linha).is-vazio { --cor: #5e5ce6; }
:is(.home3d__ceu-dist > span, .home3d__ceu-dist-linha).is-fora { --cor: #ff9f0a; }
:is(.home3d__ceu-dist > span, .home3d__ceu-dist-linha).is-bateria { --cor: #30b0c7; }

.home3d__ceu-dist > span {
  background: var(--cor);
}

/* Cards pequenos de ACs / Luzes / Tomadas / Persianas: só em telemóvel (no lugar do card Casa). */
.home3d .home3d__ceu .home3d__ceu-card--mobile {
  display: none;
}

/* Telemóvel: os cards de valor (tempo, consumo, produção, bateria) só com o nome e o número
   grande, 2 por linha; o «Ar condicionado» e o «Casa» saem e no lugar deles fica uma linha de 4
   cards pequenos (ACs, Luzes, Tomadas, Persianas), 2 por baixo da produção e 2 da bateria; cada um
   abre a sua modal. */
@media (max-width: 640px) {
  .home3d .home3d__ceu-card:not(.home3d__ceu-card--casa-atalhos) :is(.home3d__ceu-sub, .home3d__ceu-linha, .home3d__ceu-tou, .home3d__ceu-barra, .home3d__ceu-dist, .home3d__ceu-dist-legenda) {
    display: none;
  }

  .home3d .home3d__ceu .home3d__ceu-card--ac,
  .home3d .home3d__ceu .home3d__ceu-card--casa-atalhos {
    display: none;
  }

  /* Grelha de 4 colunas: os cards de valor ocupam 2 (2 por linha), os pequenos 1. */
  .home3d .home3d__ceu {
    display: grid;
    /* 60 colunas: valor = 30 (2 por linha), Tempo/Hoje = 15 (4 por linha) e os pequenos = 12 (5 por
       linha: ACs, Luzes, Tomadas, Persianas, Temperaturas) ou 10 (6, com o card das câmaras). */
    grid-template-columns: repeat(60, minmax(0, 1fr));
    grid-auto-flow: row;
    grid-auto-columns: auto;
    overflow: visible;
    padding-bottom: 0;
    /* Sem espaço entre colunas (com 60 colunas, 59 × 0,5rem passava a largura do ecrã): o espaço
       entre cards é a margem de cada um (0,25rem de cada lado) e a grelha alarga o mesmo para fora. */
    column-gap: 0;
    margin-inline: -0.25rem;
  }

  .home3d .home3d__ceu > * {
    margin-inline: 0.25rem;
  }

  .home3d .home3d__ceu .home3d__ceu-card,
  .home3d .home3d__ceu .home3d__ceu-card--tempo {
    grid-column: span 30;
    width: auto;
    min-width: 0;
  }

  /* Ordem em telemóvel: Tempo · Produção hoje / Consumo agora · Bateria / os 4 pequenos. */
  .home3d .home3d__ceu > .home3d__ceu-card { order: 6; }
  .home3d .home3d__ceu > .home3d__ceu-card--tempo { order: 1; }
  .home3d .home3d__ceu > .home3d__ceu-card--rede { order: 2; }
  .home3d .home3d__ceu > .home3d__ceu-card--solar { order: 3; }
  .home3d .home3d__ceu > .home3d__ceu-card--casa { order: 4; }
  .home3d .home3d__ceu > .home3d__ceu-card--bateria { order: 5; }

  /* Tempo e custo de hoje: pequenos (1 coluna cada), lado a lado antes da produção. */
  .home3d .home3d__ceu .home3d__ceu-card.home3d__ceu-card--tempo,
  .home3d .home3d__ceu .home3d__ceu-card.home3d__ceu-card--rede {
    display: flex;
    grid-column: span 15;
    padding: 0.5rem 0.55rem;
  }

  .home3d .home3d__ceu :is(.home3d__ceu-card--tempo, .home3d__ceu-card--rede) .home3d__ceu-nome {
    font-size: 0.62rem;
    letter-spacing: 0.02em;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  /* Produção hoje: o valor do mesmo tamanho do Tempo e do Hoje (estão na mesma linha). */
  .home3d .home3d__ceu :is(.home3d__ceu-card--tempo, .home3d__ceu-card--rede, .home3d__ceu-card--solar) .home3d__ceu-valor {
    font-size: 1.15rem;
    white-space: nowrap;
  }

  /* Consumo agora: painéis e casa sempre na mesma linha, um pouco mais pequenos. */
  .home3d .home3d__ceu-paineis {
    gap: 0.45rem;
    font-size: 0.72rem;
  }

  .home3d .home3d__ceu-paineis > span {
    gap: 0.2rem;
  }

  .home3d .home3d__ceu-paineis svg {
    width: 12px;
    height: 12px;
  }

  .home3d .home3d__ceu .home3d__ceu-card--mobile {
    grid-column: span 12;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 0.5rem;
    cursor: pointer;
    pointer-events: auto;
  }

  .home3d .home3d__ceu .home3d__ceu-card--mobile svg {
    width: 24px;
    height: 24px;
    color: #3d4f63;
  }

  /* Com o card das câmaras: 6 pequenos na mesma linha. */
  .home3d .home3d__ceu:has(> .home3d__ceu-card--cameras) .home3d__ceu-card--mobile {
    grid-column: span 10;
  }

  /* O botão flutuante das câmaras dá lugar ao card na fila. */
  .home3d .home3d__ceu-card.home3d__cameras-btn {
    display: none;
  }
}


/* Câmaras: botão redondo por baixo do card do tempo (top/left postos pelo JS) e a modal. */
.home3d .home3d__ceu-card.home3d__cameras-btn {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 2;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  min-width: 0;
  width: 3.6rem;
  padding: 0.7rem 0.5rem;
}

.home3d .home3d__ceu-card.home3d__cameras-btn svg {
  width: 24px;
  height: 24px;
  color: #3d4f63;
}

.home3d__cameras-modal.dash__home-modal {
  width: min(72rem, calc(100vw - 1.25rem));
  max-height: 96dvh;
}

.home3d__cameras-modal .dash__home-modal-panel {
  max-height: 96dvh;
}

/* Fora do telemóvel a modal ocupa o que a grelha precisar (largura calculada no JS para caber na
   altura do ecrã, sem scroll). */
@media (min-width: 560px) {
  .home3d__cameras-modal.dash__home-modal {
    width: fit-content;
    min-width: min(36rem, 98vw);
    max-width: 98vw;
  }

  .home3d__cameras-modal .tapo__grid {
    grid-template-columns: repeat(var(--cols, 2), 1fr);
    margin: 0 auto;
  }
}

.home3d__cameras-modal .tapo__grid {
  padding-top: 0;
}

/* Na modal o vídeo ocupa o card todo: nome no canto inferior esquerdo, botão HD no superior
   direito, sem «Ao vivo». */
.home3d__cameras-modal .dash__home-modal-body {
  padding: 0.5rem;
}

.home3d__cameras-modal .tapo__grid {
  gap: 0.5rem;
}

.home3d__cameras-modal .tapo__cam {
  position: relative;
  padding: 0;
  overflow: hidden;
  border: none;
  border-radius: 0.5rem;
  background: #000;
}

.home3d__cameras-modal .tapo__cam-frame {
  border-radius: 0;
}

.home3d__cameras-modal .tapo__cam-head {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  pointer-events: none;
}

/* Nome em baixo à esquerda, numa etiqueta; o nível do zoom noutra, à frente dele. */
.home3d__cameras-modal .tapo__cam-head .tapo__card-head {
  position: absolute;
  bottom: 0.5rem;
  left: 0.5rem;
  display: flex;
  flex-direction: row; /* o tapo.css põe-nas em coluna */
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  white-space: nowrap;
}

.home3d__cameras-modal .tapo__card-name {
  padding: 0.1rem 0.45rem;
  font-size: 0.75rem;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 0.3rem;
}

.home3d__cameras-modal .tapo__cam-qualities {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: none; /* com todas as câmaras ficam na mais leve; ver a regra com --uma abaixo */
}

/* Rodar a câmara: como as resoluções, só com uma câmara sozinha no ecrã. */
.home3d__cameras-modal .tapo__ptz {
  display: none;
}

@media (min-width: 560px) {
  .home3d__cameras-modal .home3d__cam-grid--uma .tapo__cam-qualities,
  .home3d__cameras-modal .home3d__cam-grid--uma .tapo__ptz {
    display: flex;
  }

  .home3d__cameras-modal .home3d__cam-grid--uma .home3d__cam-item:has(.tapo__ptz) .home3d__cam-max {
    right: 2.75rem; /* à esquerda do botão de rodar */
  }
}

.home3d__cameras-modal .tapo__cam-quality {
  pointer-events: auto;
  color: #fff;
  background: rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.45);
}

.home3d__cameras-modal .tapo__cam-quality--on {
  color: #fff;
  background: #217dbb;
  border-color: #217dbb;
}

.home3d__cameras-modal .tapo__cam-live {
  display: none !important;
}

/* Escolha «Todas / uma câmara» no cabeçalho da modal (escondida no telemóvel). */
.home3d__cam-vista {
  display: none;
}

@media (min-width: 560px) {
  .home3d__cameras-modal .dash__home-modal-head {
    align-items: center;
  }

  .home3d__cam-vista {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-left: auto;
  }

  .home3d__cam-vista-btn {
    appearance: none;
    padding: 0.3rem 0.7rem;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    color: #475569;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    cursor: pointer;
  }

  .home3d__cam-vista-btn:hover {
    color: #217dbb;
  }

  .home3d__cam-vista-btn[aria-pressed="true"] {
    color: #fff;
    background: #217dbb;
    border-color: #217dbb;
  }
}

/* Reiniciar o go2rtc: à direita no cabeçalho, antes do fechar (a seguir à escolha das câmaras). */
.home3d .home3d__cam-reiniciar {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
  padding: 0.3rem 0.7rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.home3d .home3d__cam-reiniciar:hover:not(:disabled) {
  color: #217dbb;
}

.home3d .home3d__cam-reiniciar:disabled {
  cursor: default;
  opacity: 0.75;
}

.home3d .home3d__cam-reiniciar.is-a-reiniciar svg {
  animation: home3d-rodar 0.9s linear infinite;
}

@keyframes home3d-rodar {
  to {
    transform: rotate(360deg);
  }
}

@media (min-width: 560px) {
  .home3d .home3d__cam-vista ~ .home3d__cam-reiniciar {
    margin-left: 0;
  }
}

/* Registo das câmaras: por cima da grelha, duas colunas (browser e servidor) com scroll próprio. */
.home3d__cam-registo {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  background: #f8fafc;
  font-size: 0.74rem;
  color: #334155;
}

.home3d__cam-registo[hidden] {
  display: none;
}

@media (min-width: 560px) {
  .home3d__cam-registo {
    grid-template-columns: 1fr 1.4fr;
  }
}

.home3d__cam-registo-col {
  min-width: 0;
  max-height: 16rem;
  overflow: auto;
}

.home3d__cam-registo h4 {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #64748b;
}

.home3d__cam-registo h4 small {
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.home3d__cam-registo h5 {
  margin: 0.5rem 0 0.2rem;
  font-size: 0.74rem;
  font-weight: 700;
}

.home3d__cam-registo-lista {
  margin: 0;
  padding: 0;
  list-style: none;
}

.home3d__cam-registo-lista li {
  padding: 0.15rem 0;
  border-bottom: 1px solid #eef2f7;
}

.home3d__cam-registo-lista time {
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}

.home3d__cam-registo pre {
  margin: 0.15rem 0 0;
  padding: 0.35rem 0.45rem;
  border-radius: 0.4rem;
  background: #0b1220;
  color: #cbd5e1;
  font: 0.68rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-all;
}

.home3d__cam-registo-stream {
  margin-top: 0.3rem;
  color: #64748b;
}

.home3d__cam-registo-stream.is-ativo b {
  color: #15803d;
}

.home3d__cam-registo .is-erro {
  color: #b91c1c;
}

.home3d .home3d__cam-registo-btn[aria-pressed="true"] {
  color: #fff;
  background: #217dbb;
  border-color: #217dbb;
}

/* Os dois botões juntos: só o primeiro empurra para a direita. */
.home3d .home3d__cam-reiniciar + .home3d__cam-reiniciar {
  margin-left: 0;
}

/* Zoom digital (camera_zoom_controller.js), só com uma câmara à vista: o browser não faz scroll
   nem zoom da página por cima do vídeo; indicador «2,5×» no canto de baixo à esquerda. */
.home3d__cam-grid--uma .tapo__cam-frame,
.home3d__zoom {
  touch-action: none;
  cursor: zoom-in;
}

.home3d__cam-grid--uma .tapo__cam-video {
  will-change: transform;
}

.home3d .home3d__cam-zoom {
  position: absolute;
  left: 0.5rem;
  bottom: 0.5rem;
  z-index: 3;
  padding: 0.2rem 0.55rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: rgba(15, 23, 42, 0.65);
  border: none;
  border-radius: 999px;
  cursor: pointer;
}

/* Etiqueta própria à frente da do nome da câmara (a do nome não recebe toques; esta sim). */
.home3d .home3d__cam-zoom--nome {
  position: static;
  padding: 0.1rem 0.45rem;
  font-size: 0.75rem;
  line-height: inherit;
  border-radius: 0.3rem;
  background: rgba(0, 0, 0, 0.5);
  pointer-events: auto;
}

.home3d .home3d__cam-zoom[hidden] {
  display: none;
}

.home3d .home3d__cam-todas[hidden] {
  display: none;
}

/* Fora do telemóvel já há «Todas» nos botões do cabeçalho (.home3d__cam-vista): este é só para o telemóvel. */
@media (min-width: 560px) {
  .home3d .home3d__cam-todas {
    display: none;
  }
}

/* Telemóvel com «Todas» escondido: o reiniciar volta a ir para a direita. */
@media (max-width: 559.98px) {
  .home3d .home3d__cam-todas[hidden] + .home3d__cam-reiniciar {
    margin-left: auto;
  }
}

/* «Ver na horizontal»: só no telemóvel, com uma câmara à vista, no canto inferior direito da
   imagem (aí as setas de rodar não aparecem); na horizontal mostra o ícone de voltar. */
.home3d .home3d__cam-horizontal {
  display: none;
}

@media (max-width: 559.98px) {
  .home3d .home3d__cam-grid--uma .home3d__cam-horizontal {
    position: absolute;
    right: 0.5rem;
    bottom: 0.5rem;
    z-index: 6;
    display: inline-grid;
    place-items: center;
    width: 2.2rem;
    height: 2.2rem;
    padding: 0;
    border: none;
    border-radius: 999px;
    color: #fff;
    background: rgba(15, 23, 42, 0.6);
    cursor: pointer;
  }
}

.home3d .home3d__cam-horizontal-sair,
.home3d .is-horizontal .home3d__cam-horizontal-entrar {
  display: none;
}

.home3d .is-horizontal .home3d__cam-horizontal-sair {
  display: block;
}

/* Horizontal: a câmara à vista roda 90° (com o telemóvel deitado vê-se direita) e a modal fica do
   tamanho dela, sem cabeçalho: 90% da largura do ecrã e a altura que o vídeo 16:9 pede (até 90% da
   altura), para não ficarem barras pretas; vê-se o fundo à volta. */
.home3d__cameras-modal.is-horizontal {
  --horiz-curto: 90dvw;
  --horiz-longo: min(90dvh, 90dvw * 16 / 9);
}

html .home3d .home3d__cameras-modal.is-horizontal.dash__home-modal {
  inset: 0;
  width: var(--horiz-curto);
  max-width: none;
  height: var(--horiz-longo);
  max-height: none;
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 0.8rem;
  overflow: hidden;
  background: #000;
}

html .home3d .home3d__cameras-modal.is-horizontal .dash__home-modal-panel {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #000;
}

.home3d__cameras-modal.is-horizontal .dash__home-modal-head {
  display: none;
}

.home3d__cameras-modal.is-horizontal .home3d__cam-item:not(.home3d__cam-item--oculta) {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 5;
  /* Do tamanho da modal, rodada. */
  width: var(--horiz-longo);
  height: var(--horiz-curto);
  transform: translate(-50%, -50%) rotate(90deg);
  overflow: hidden;
  border-radius: 0.8rem;
  background: #000;
}

.home3d__cameras-modal.is-horizontal .home3d__cam-item .tapo__cam {
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
}

.home3d__cameras-modal.is-horizontal .home3d__cam-item .tapo__cam-frame {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border-radius: 0;
}

/* Câmaras que não sejam bem 16:9: enche na mesma (corta um pouco nas pontas), sem barras. */
.home3d__cameras-modal.is-horizontal .home3d__cam-item :is(.tapo__cam-video, .tapo__cam-congelado) {
  object-fit: cover;
}

.home3d__cameras-modal.is-horizontal .home3d__cam-max {
  display: none !important; /* há regras mais específicas que o mostram com uma câmara só */
}

/* Reiniciar só com o ícone: botão redondo. */
.home3d .home3d__cam-reiniciar--icone {
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
}

/* Só uma câmara (escolhida no cabeçalho ou pelo ponto dela no 3D): as outras saem, também no
   telemóvel (aí o botão «Câmaras» abre-as todas). */
.home3d__cam-item--oculta {
  display: none;
}

/* Cabeçalho compacto: mais altura para as câmaras. */
.home3d__cameras-modal .dash__home-modal-head {
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem 0.35rem 0.75rem;
}

.home3d__cameras-modal .dash__home-modal-title {
  font-size: 0.9rem;
}

.home3d__cameras-modal .dash__home-modal-close {
  width: 1.6rem;
  height: 1.6rem;
  font-size: 1.05rem;
}

.home3d__cameras-modal .home3d__cam-vista-btn {
  padding: 0.15rem 0.6rem;
  font-size: 0.72rem;
}

/* Cantos de 1rem, também com o tema liquid (que põe 2rem em todas as modais:
   solar_skin_liquid.css, «html :is(.dash, .home3d).solar-skin--liquid .dash__home-modal-panel»). */
html .home3d .home3d__cameras-modal.dash__home-modal,
html .home3d .home3d__cameras-modal.dash__home-modal .dash__home-modal-panel {
  border-radius: 1rem;
}

/* Botão maximizar em cada câmara (canto inferior direito; escondido no telemóvel, onde não há
   escolha de câmara). */
.home3d__cam-item {
  position: relative;
}

/* Com todas à vista, clicar numa câmara mostra só essa. */
.home3d__cam-grid:not(.home3d__cam-grid--uma) .home3d__cam-item {
  cursor: pointer;
}

/* EZVIZ sem imagem: reinício forçado, ao centro em baixo do vídeo (só aparece quando falha). */
.home3d .home3d__cam-forcar {
  position: absolute;
  left: 50%;
  bottom: 0.75rem;
  z-index: 3;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  background: #b91c1c;
  box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  white-space: nowrap;
}

.home3d .home3d__cam-forcar[hidden] {
  display: none;
}

/* Câmara sozinha no ecrã: de onde vem o vídeo (RTSP / go2rtc / Local / Cloud / Frigate) no canto de cima à esquerda. */
.home3d .home3d__cam-fonte {
  display: none;
}

.home3d .home3d__cam-grid--uma .home3d__cam-fonte {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 4;
  display: inline-flex;
  gap: 0.2rem;
  padding: 0.15rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
}

.home3d .home3d__cam-fonte-btn {
  padding: 0.15rem 0.55rem;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
  background: transparent;
  cursor: pointer;
}

.home3d .home3d__cam-fonte-btn[aria-pressed="true"] {
  color: #0f172a;
  background: #fff;
}

/* Câmara offline: aviso no mesmo sítio do «Reiniciar câmara» (que aí não aparece). */
.home3d .home3d__cam-offline {
  position: absolute;
  left: 50%;
  bottom: 0.75rem;
  z-index: 3;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  background: rgba(15, 23, 42, 0.8);
  white-space: nowrap;
  pointer-events: none;
}

.home3d .home3d__cam-offline[hidden] {
  display: none;
}

.home3d .home3d__cam-forcar[data-confirmar] {
  background: #7f1d1d;
}

.home3d .home3d__cam-forcar.is-a-reiniciar {
  cursor: default;
  background: #475569;
}

.home3d .home3d__cam-forcar.is-a-reiniciar svg {
  animation: home3d-rodar 0.9s linear infinite;
}

.home3d__cam-max {
  display: none;
}

@media (min-width: 560px) {
  .home3d__cam-max {
    position: absolute;
    right: 0.5rem; /* no canto; com o botão de rodar visível, passa para a esquerda dele (abaixo) */
    bottom: 0.5rem;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    padding: 0;
    color: #fff;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 0.4rem;
    cursor: pointer;
  }

  .home3d__cam-max:hover {
    background: #217dbb;
    border-color: #217dbb;
  }

  .home3d__cam-max-fechar,
  .home3d__cam-grid--uma .home3d__cam-max-abrir {
    display: none;
  }

  .home3d__cam-grid--uma .home3d__cam-max-fechar {
    display: block;
  }
}

/* Confirmação «Destrancar portão» com a câmara do portão ao vivo. */
.home3d__trinco.home3d__trinco--camera {
  width: min(40rem, calc(100vw - 1.25rem));
}

.home3d__trinco-camera {
  margin: 0 0 0.75rem;
}

.home3d__trinco-camera .smart-life__camera-player {
  margin: 0;
}

/* Sem mensagem (antes de destrancar), a caixa do texto não aparece. */
.home3d__trinco .dash__confirm-action[hidden] {
  display: none;
}

/* Modal dos painéis solares: botão para a página Growatt (o mesmo partial do dashboard, onde não aparece). */
.dash__growatt-modal-pagina {
  display: none;
}

/* Só o símbolo da Growatt, num botão redondo. */
.home3d .dash__growatt-modal-pagina {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid #c9d3df;
  border-radius: 999px;
  background: #fff;
  color: #1c2433;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

/* Nas modais «Consumo agora», «Bateria» e «Rede — consumo hoje»: ao lado do fechar, ao meio da altura. */
.home3d .dash__home-modal-head > .dash__growatt-modal-pagina {
  flex-shrink: 0;
  align-self: center;
  white-space: nowrap;
}

.home3d .dash__growatt-logo {
  display: block;
  object-fit: contain;
}

.home3d .dash__growatt-modal-pagina:hover {
  border-color: #217dbb;
  color: #217dbb;
}

/* Modal com a página /growatt: quase o ecrã todo. */
.home3d__growatt-modal {
  width: min(80rem, calc(100vw - 1.25rem));
  height: min(92vh, 60rem);
  height: min(92dvh, 60rem);
  max-height: none;
}

.home3d__growatt-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: none; /* as outras modais param nos 44rem */
}

.home3d__growatt-iframe {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  border: 0;
  background: #fff;
}

/* Luzes da escada da entrada (mesmo botão redondo dos trincos): lâmpada cinzenta apagada, amarela acesa. */
html .mm.home3d .home3d__chip.home3d__chip--luz svg {
  color: #8a8f96;
}

html .mm.home3d .home3d__chip.home3d__chip--luz.is-on svg {
  color: #f59e0b;
  filter: drop-shadow(0 0 4px rgba(245, 158, 11, 0.7));
}

/* Botão das luzes da escada mais pequeno do que os dos trincos/câmaras. */
html .mm.home3d .home3d__chip.home3d__chip--trinco.home3d__chip--icone.home3d__chip--luz {
  width: 1.9rem;
  height: 1.9rem;
}

html .mm.home3d .home3d__chip.home3d__chip--trinco.home3d__chip--icone.home3d__chip--luz svg {
  width: 1rem;
  height: 1rem;
}


/* Modal «Temperaturas» (card Casa): separador das divisões e do impacto dos ACs. */
.home3d__temps-modal {
  width: min(34rem, calc(100vw - 1.25rem));
}

.home3d__temps {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
}

/* Com scroll e altura limitada, os filhos não encolhem (a barra dos separadores tem overflow
   hidden e ficava com 0 de altura quando a lista era alta). */
.home3d__temps > *,
.home3d__temps > [data-tab] > * {
  flex-shrink: 0;
}

.home3d__temps > [data-tab]:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.home3d__temps .dash__growatt-chart-tabs {
  margin: 0;
}

.home3d__temp-chip {
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: #f1f5f9;
  font-size: 0.66rem;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
}

.home3d__temp-chip.is-ligado {
  background: #ffedd5;
  color: #c2410c;
}

.home3d__temps-vazio {
  margin: 0;
  font-size: 0.78rem;
  color: #94a3b8;
}

.home3d__temps-nota {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.45;
  color: #64748b;
}

/* Impacto dos ACs: um cartão por AC, cada vez que esteve ligado com a tabela das divisões. */
.home3d__impacto-ac {
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 0.8rem;
  background: #fff;
}

.home3d__impacto-cab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.home3d__impacto-cab h4 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
}

.home3d__impacto-sessao {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid #eef2f7;
}

.home3d__impacto-quando {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
}

.home3d__impacto-outros {
  margin: 0.15rem 0 0;
  font-size: 0.72rem;
  color: #b45309;
}

.home3d__impacto-tabela {
  width: 100%;
  margin-top: 0.4rem;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.home3d__impacto-tabela th {
  padding: 0.2rem 0;
  font-size: 0.66rem;
  font-weight: 600;
  text-align: right;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.home3d__impacto-tabela th:first-child,
.home3d__impacto-tabela td:first-child {
  text-align: left;
}

.home3d__impacto-tabela td {
  padding: 0.22rem 0;
  border-top: 1px solid #f1f5f9;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #64748b;
}

.home3d__impacto-tabela td:first-child span {
  color: #0f172a;
  font-weight: 500;
}

.home3d__impacto-tabela td small {
  color: #94a3b8;
}

.home3d__impacto-tabela td.is-sobe {
  color: #c2410c;
  font-weight: 700;
}

.home3d__impacto-tabela td.is-desce {
  color: #1d4ed8;
  font-weight: 700;
}

/* Várias vezes ligado: separadores (uma tabela de cada vez). */
.home3d__impacto-abas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.5rem;
}

.home3d .home3d__impacto-aba {
  appearance: none;
  padding: 0.22rem 0.6rem;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #f8fafc;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.home3d .home3d__impacto-aba[aria-selected="true"] {
  border-color: #217dbb;
  background: #217dbb;
  color: #fff;
}

.home3d__impacto-sessao[hidden] {
  display: none;
}

/* Divisões: tabela (nome, hoje às 0/8/12/16/20/24 h e agora). */
.home3d__temp-tabela-caixa {
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 0.8rem;
  background: #fff;
  overflow-x: auto;
}

/* Colunas «Divisão» e «Agora» fixas à esquerda no scroll horizontal (com fundo, para as horas
   passarem por baixo, e uma sombra a separar). A «Divisão» tem largura fixa, para o «Agora»
   saber onde ficar. */
.home3d__temp-tabela {
  --temp-nome-w: 8.5rem;
}

.home3d__temp-tabela :is(th, td):is(:first-child, .is-agora) {
  position: sticky;
  z-index: 1;
  background: #fff;
}

.home3d__temp-tabela :is(th, td):first-child {
  left: 0;
  box-sizing: border-box;
  width: var(--temp-nome-w);
  min-width: var(--temp-nome-w);
  max-width: var(--temp-nome-w);
}

.home3d__temp-tabela :is(th, td).is-agora {
  left: var(--temp-nome-w);
  box-shadow: 4px 0 6px -4px rgba(15, 23, 42, 0.12);
}

.home3d__temp-tabela th:is(:first-child, .is-agora),
.home3d__temp-tabela tr.is-exterior td:is(:first-child, .is-agora),
.home3d__temp-tabela tr.is-clicavel:hover td:is(:first-child, .is-agora) {
  background: #f8fafc;
}

.home3d__temp-tabela {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.home3d__temp-tabela th {
  padding: 0.45rem 0.3rem;
  background: #f8fafc;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  color: #64748b;
  white-space: nowrap;
}

.home3d__temp-tabela th:first-child {
  padding-left: 0.7rem;
  text-align: left;
}

.home3d__temp-tabela th.is-ontem small {
  display: block;
  font-size: 0.6rem;
  font-weight: 400;
  color: #94a3b8;
}

.home3d__temp-tabela td {
  padding: 0.5rem 0.3rem;
  border-top: 1px solid #f1f5f9;
  text-align: center;
  color: #475569;
  white-space: nowrap;
}

.home3d__temp-tabela tr.is-clicavel {
  cursor: pointer;
}

.home3d__temp-tabela tr.is-clicavel:hover td {
  background: #f8fafc;
}

.home3d__temp-tabela tr.is-exterior td {
  background: #f8fafc;
}

.home3d__temp-tabela td.home3d__temp-nome {
  padding-left: 0.7rem;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  font-weight: 600;
  color: #0f172a;
}

.home3d__temp-ac.is-ligado {
  margin-left: 0.3rem;
  padding: 0 0.3rem;
  border-radius: 0.3rem;
  background: #ffedd5;
  font-size: 0.6rem;
  font-weight: 700;
  color: #c2410c;
  vertical-align: middle;
}

.home3d__temp-tabela td.is-frio { color: #2563eb; }
.home3d__temp-tabela td.is-bom { color: #15803d; }
.home3d__temp-tabela td.is-quente { color: #c2410c; }
.home3d__temp-tabela td.is-vazio { color: #cbd5e1; }

/* Agora: em destaque logo a seguir à divisão, separado das horas, com a humidade por baixo. */
.home3d__temp-tabela :is(th, td).is-agora {
  padding-right: 0.6rem;
  padding-left: 0.6rem;
  border-right: 1px solid #eef2f7;
  text-align: center;
}

.home3d__temp-tabela td.is-agora b {
  display: block;
  font-size: 0.98rem;
  line-height: 1.1;
}

/* A subir (verde) / a descer (vermelho), antes da temperatura de agora. */
.home3d__temp-tend {
  margin-right: 0.15rem;
  font-size: 0.8rem;
  font-weight: 800;
}

.home3d__temp-tend.is-sobe { color: #16a34a; }
.home3d__temp-tend.is-desce { color: #dc2626; }

.home3d__temp-tabela td.is-agora small {
  display: block;
  font-size: 0.64rem;
  color: #94a3b8;
}

/* Sensor offline: nome a cinzento e «offline» a vermelho no lugar da temperatura de agora. */
.home3d__temp-tabela tr.is-offline td.home3d__temp-nome {
  color: #94a3b8;
}

/* Divisões com o sensor offline: fora da tabela, logo abaixo dela, a vermelho. */
.home3d__temps-nota.home3d__temps-offline {
  font-weight: 600;
  color: #dc2626;
}

.home3d__temp-tabela td.is-agora.is-offline b {
  font-size: 0.72rem;
  font-weight: 700;
  color: #dc2626;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Card «Custo hoje»: ícone do histórico dos gastos no canto superior direito. */
.home3d .home3d__ceu-historico {
  display: inline-grid;
  place-items: center;
  padding: 0.2rem;
  color: #217dbb;
}

.home3d .home3d__ceu-historico svg {
  display: block;
}

/* MSE / HLS ao lado do nome, na modal das câmaras. */
.home3d__cameras-modal .tapo__cam-fonte {
  align-self: center;
  opacity: 0.85;
}
body:has(.logs) {
  margin: 0;
  min-height: 100vh;
  background: #e8ecf2;
}

.logs {
  box-sizing: border-box;
  max-width: 36rem;
  margin: 0 auto;
  min-height: 100vh;
  padding: 0 1.25rem calc(2rem + env(safe-area-inset-bottom, 0px));
  color: #1c2433;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.45;
}

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

.logs__section {
  padding: 0;
  overflow: hidden;
}

.logs__list {
  display: flex;
  flex-direction: column;
}

/* ── Tabs ── */
.logs__tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}

.logs__tab {
  padding: 0.35rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 650;
  border-radius: 2rem;
  border: 1px solid rgba(28, 36, 51, 0.14);
  background: #fff;
  color: #5a6578;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.logs__tab:hover {
  background: #f0f4f8;
  color: #2c3545;
}

.logs__tab--active {
  background: #217dbb;
  border-color: #1a6a9e;
  color: #fff;
  cursor: default;
}

.logs__tab--active:hover {
  background: #217dbb;
  color: #fff;
}

/* ── Linhas de sistema ── */
.logs__sysrow {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.6rem 1.1rem;
  border-bottom: 1px solid rgba(28, 36, 51, 0.07);
}

.logs__sysrow:last-child {
  border-bottom: none;
}

.logs__sysrow--warn { background: rgba(192, 96, 90, 0.04); }
.logs__sysrow--error { background: rgba(192, 96, 90, 0.08); }

.logs__sysmeta {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.logs__systag {
  font-size: 0.65rem;
  font-weight: 700;
  color: #9eaab8;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.logs__systime {
  font-size: 0.7rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #b0bcc8;
  margin-left: auto;
}

.logs__sysrow--warn .logs__systag,
.logs__sysrow--error .logs__systag {
  color: #a84842;
}

.logs__sysbody {
  font-size: 0.78rem;
  color: #2c3545;
  line-height: 1.45;
  word-break: break-word;
}

/* ── Navegação de data ── */
.logs__date-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.logs__date-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  flex-shrink: 0;
  border-radius: 0.6rem;
  color: #3d4f63;
  background: #fff;
  border: 1px solid rgba(28, 36, 51, 0.1);
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s;
}

.logs__date-arrow:hover {
  background: #f0f4f8;
  border-color: rgba(28, 36, 51, 0.2);
}

.logs__date-arrow--disabled {
  color: #c0cad4;
  background: transparent;
  border-color: transparent;
  pointer-events: none;
}

.logs__date-form {
  flex: 1;
  margin: 0;
}

.logs__date-input {
  width: 100%;
  padding: 0.45rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #1c2433;
  background: #fff;
  border: 1px solid rgba(28, 36, 51, 0.1);
  border-radius: 0.6rem;
  text-align: center;
  cursor: pointer;
}

.logs__date-input:focus {
  outline: 2px solid rgba(33, 125, 187, 0.4);
  outline-offset: 1px;
}

/* ── Row ── */
.logs__row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1.1rem;
  border-bottom: 1px solid rgba(28, 36, 51, 0.07);
}

.logs__row:last-child {
  border-bottom: none;
}

.logs__row--erro {
  background: rgba(192, 96, 90, 0.04);
}

/* ── Ícone ── */
.logs__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.6rem;
  margin-top: 0.05rem;
}

.logs__icon--plug {
  background: rgba(91, 141, 184, 0.1);
  color: #5b8db8;
}

.logs__icon--ac {
  background: rgba(58, 122, 58, 0.1);
  color: #3a7a3a;
}

.logs__icon--timer {
  background: rgba(180, 130, 50, 0.1);
  color: #9a6d1a;
}

.logs__icon--scene {
  background: rgba(130, 80, 180, 0.1);
  color: #7c4daa;
}

.logs__icon--battery {
  background: rgba(34, 160, 90, 0.1);
  color: #1f8a4c;
}

.logs__row--erro .logs__icon {
  background: rgba(192, 96, 90, 0.1);
  color: #a84842;
}

/* ── Body ── */
.logs__body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  flex: 1;
}

/* ── Actor (nome do dispositivo) ── */
.logs__actor {
  font-size: 0.85rem;
  font-weight: 650;
  color: #1c2433;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Action ── */
.logs__action {
  font-size: 0.75rem;
  color: #5a6578;
}

.logs__action--erro {
  color: #a84842;
}

/* ── Meta (detalhes + hora) ── */
.logs__row-meta {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.2rem;
}

.logs__details {
  font-size: 0.68rem;
  color: #8a9ab0;
  min-width: 0;
}

.logs__time {
  font-size: 0.65rem;
  font-variant-numeric: tabular-nums;
  color: #b0bcc8;
  white-space: nowrap;
  margin-left: auto;
}

@media (max-width: 639px) {
  .logs {
    padding: 0 0.5rem calc(6rem + env(safe-area-inset-bottom, 0px));
  }

  .logs__row {
    padding: 0.65rem 0.6rem;
  }
}
/* ── My Money — Orçamento pessoal ──── */
body:has(.mm) {
  margin: 0;
  min-height: 100vh;
  background: #e8ecf2;
}

.mm {
  box-sizing: border-box;
  max-width: 1600px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 0 1.25rem 2.5rem;
  color: #1c2433;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.45;
}

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

/* ── Topbar (ritmo visual alinhado ao dashboard .dash) ── */
.mm__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0 0.5rem;
  margin-bottom: 0.5rem;
}

.mm__title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #1c2433;
  letter-spacing: -0.02em;
}

.mm__title a {
  color: inherit;
  text-decoration: none;
}

.mm__title a:hover {
  color: #217dbb;
}

.mm__topbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── Month selector ── */
.mm__month-form {
  display: flex;
  align-items: center;
  gap: 0;
}

.mm__month-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #fff;
  color: #3d4f63;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
}

.mm__month-arrow:first-of-type {
  border-radius: 0.5rem 0 0 0.5rem;
  border-right: none;
}

.mm__month-arrow:last-of-type {
  border-radius: 0 0.5rem 0.5rem 0;
  border-left: none;
}

.mm__month-arrow:hover {
  background: #eef2f7;
}

.mm__month-select {
  height: 2rem;
  padding: 0 0.6rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  color: #1c2433;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  text-align: center;
  min-width: 9rem;
}

.mm__month-select:focus {
  outline: 2px solid #5b8db8;
  outline-offset: -1px;
}

/* ── Flash ── */
.mm__flash {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 0.75rem;
  line-height: 1.35;
  animation: mm-flash-in 0.3s ease-out;
}

@keyframes mm-flash-in {
  0%   { opacity: 0; transform: translateY(-6px); }
  100% { opacity: 1; transform: translateY(0); }
}

.mm__flash--ok {
  background: #d4edda;
  color: #1b5e20;
  border-left: 4px solid #34d058;
}

.mm__flash--err {
  background: #fce8e6;
  color: #c0605a;
  border-left: 4px solid #f56565;
}

/* ── Layout ── */
.mm__layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .mm__layout {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .mm__summary {
    grid-column: 1 / -1;
  }

  .mm__section--charts {
    grid-column: 1;
  }
}

/* ── Column wrapper ── */
.mm__col {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ── Charts section ── */
.mm__section--charts {
  background: #fff;
  border-radius: 1.25rem;
  padding: 0.85rem 1rem 1rem;
}

.mm__charts-row {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.mm__chart-block {
  flex: 1;
}

.mm__chart-title {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #3d4f63;
}

.mm__pie-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mm__pie {
  width: 90px;
  height: 90px;
  flex-shrink: 0;
  transform: rotate(-90deg);
}

.mm__pie-legend {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: #4a5568;
}

.mm__pie-legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.mm__pie-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.mm__cat-bars {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.mm__cat-row {
  display: grid;
  grid-template-columns: 6rem 1fr auto;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.75rem;
}

.mm__cat-name {
  color: #4a5568;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mm__cat-bar-track {
  height: 0.5rem;
  background: #f0f2f5;
  border-radius: 0.25rem;
  overflow: hidden;
}

.mm__cat-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #f56565, #e53e3e);
  border-radius: 0.25rem;
  transition: width 0.3s ease;
}

.mm__cat-val {
  font-weight: 600;
  color: #c0605a;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ── Summary card (mesmo “cartão” que .dash__section) ── */
.mm__summary {
  background: #fff;
  border-radius: 1.25rem;
  padding: 0.85rem 1rem 1rem;
}

.mm__summary-title {
  margin: 0 0 0.1rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #3d4f63;
  letter-spacing: 0;
}

.mm__summary-month {
  margin: 0 0 0.85rem;
  font-size: 0.62rem;
  font-weight: 500;
  color: #a0aec0;
  padding: 0.15rem 0.45rem;
  background: #eef2f7;
  border-radius: 999px;
  display: inline-block;
}

.mm__summary-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mm__summary-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mm__summary-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.mm__summary-divider {
  height: 1px;
  background: #e8ecf2;
  margin: 0.15rem 0;
}

@media (min-width: 768px) {
  .mm__summary-body {
    flex-direction: row;
    gap: 1.5rem;
  }

  .mm__summary-col {
    flex: 1;
  }

  .mm__summary-divider {
    width: 1px;
    height: auto;
    align-self: stretch;
    margin: 0;
  }
}

.mm__summary-label {
  font-size: 0.72rem;
  font-weight: 500;
  color: #6b7b8d;
}

.mm__summary-val {
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.mm__summary-val--big {
  font-size: 1.35rem;
}

.mm__summary-val--pos {
  color: #2d6b42;
}

.mm__summary-val--neg {
  color: #c0605a;
}

.mm__summary-pct {
  font-size: 1.25rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.mm__summary-pct--low {
  color: #2d6b42;
}

.mm__summary-pct--mid {
  color: #b45309;
}

.mm__summary-pct--high {
  color: #c0605a;
}

/* Progress bar */
.mm__summary-bar {
  margin-top: 0.25rem;
  height: 0.4rem;
  background: #eef2f7;
  border-radius: 999px;
  overflow: hidden;
}

.mm__summary-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}

.mm__summary-bar-fill--low {
  background: linear-gradient(90deg, #34d058 0%, #2d6b42 100%);
}

.mm__summary-bar-fill--mid {
  background: linear-gradient(90deg, #f5a623 0%, #b45309 100%);
}

.mm__summary-bar-fill--high {
  background: linear-gradient(90deg, #f56565 0%, #c0605a 100%);
}

/* Duplicate month */
.mm__summary-dup {
  margin-top: 1.15rem;
  padding-top: 0.85rem;
  border-top: 1px solid #eef2f7;
}

.mm__summary-dup-hint {
  margin: 0 0 0.45rem;
  font-size: 0.65rem;
  font-weight: 500;
  color: #8895a7;
  line-height: 1.35;
}

.mm__summary-dup-form {
  display: inline-block;
  margin: 0 0.25rem 0.25rem 0;
}

/* ── Sections (Receitas / Despesas) ── */
.mm__section {
  background: #fff;
  border-radius: 1.25rem;
  padding: 0.85rem 1rem 1rem;
}

.mm__section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0 0 0.55rem;
}

.mm__section-title {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: #3d4f63;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.mm__section-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.mm__section-dot--pos {
  background: #34d058;
}

.mm__section-dot--neg {
  background: #f56565;
}

.mm__section-count {
  font-size: 0.62rem;
  font-weight: 600;
  color: #8895a7;
  padding: 0.15rem 0.45rem;
  background: #eef2f7;
  border-radius: 999px;
}

/* ── Table ── */
.mm__table {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.mm__table-header {
  display: grid;
  grid-template-columns: 1fr 3rem 7rem 2.5rem;
  gap: 0.5rem;
  padding: 0 0.15rem 0.35rem;
  border-bottom: 1px solid #e8ecf2;
}

.mm__th {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8895a7;
}

.mm__th--day {
  text-align: center;
}

.mm__th--val {
  text-align: right;
}

.mm__th--actions {
  text-align: center;
}

.mm__th--sort {
  cursor: pointer;
  user-select: none;
  transition: color 0.12s;
}

.mm__th--sort:hover {
  color: #1c2433;
}

.mm__sort-icon {
  font-size: 0.6rem;
  font-weight: 800;
  color: #5b8db8;
}

.mm__table-row {
  display: grid;
  grid-template-columns: 1fr 3rem 7rem 2.5rem;
  gap: 0.5rem;
  align-items: center;
  padding: 0.3rem 0.15rem;
  border-bottom: 1px solid #f3f5f8;
  transition: background 0.12s;
}

.mm__table-row:has(+ .mm__table-row--total) {
  border-bottom: none;
}

.mm__table-row:hover {
  background: #fafbfd;
}

/* Highlight newly added entry */
.mm__table-row--new {
  animation: mm-row-highlight 2s ease-out;
}

@keyframes mm-row-highlight {
  0%   { background: #d4edda; box-shadow: inset 3px 0 0 #34d058; }
  70%  { background: #e8f5e9; box-shadow: inset 3px 0 0 #34d058; }
  100% { background: transparent; box-shadow: none; }
}

.mm__table-row--total {
  border-bottom: none;
  border-top: 2px solid #e2e8f0;
  margin-top: 0.15rem;
  padding-top: 0.55rem;
  background: transparent !important;
}

/* Row form: display contents so grid flows through */
.mm__row-form {
  display: contents;
}

.mm__row-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
}

.mm__total-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #3d4f63;
}

.mm__total-val {
  font-size: 0.92rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: right;
  letter-spacing: -0.01em;
}

.mm__total-val--pos {
  color: #2d6b42;
}

.mm__total-val--neg {
  color: #c0605a;
}

/* ── Inputs ── */
.mm__input {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  color: #1c2433;
  border: 1px solid transparent;
  border-radius: 0.4rem;
  padding: 0.3rem 0.4rem;
  background: transparent;
  transition: border-color 0.15s, background 0.15s;
}

.mm__input:focus {
  outline: none;
  border-color: #5b8db8;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(91, 141, 184, 0.15);
}

.mm__input:hover:not(:focus) {
  background: #f3f5f8;
}

.mm__input--name {
  min-width: 0;
}

.mm__input--day {
  text-align: center;
  width: 100%;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}

.mm__input--day::-webkit-inner-spin-button,
.mm__input--day::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.mm__input--val {
  text-align: right;
  width: 100%;
  font-variant-numeric: tabular-nums;
  padding-right: 1.4rem;
}

.mm__val-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.mm__val-wrap::after {
  content: "€";
  position: absolute;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.72rem;
  font-weight: 600;
  color: #8895a7;
  pointer-events: none;
  z-index: 1;
  line-height: 1;
}

/* Hide number input spinners */
.mm__input--val::-webkit-inner-spin-button,
.mm__input--val::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.mm__input--val {
  -moz-appearance: textfield;
}

/* ── Icon buttons ── */
.mm__btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border: none;
  border-radius: 0.35rem;
  background: transparent;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  padding: 0;
}

.mm__btn-icon--save {
  color: #5b8db8;
}

.mm__btn-icon--save:hover {
  background: #e4edf6;
  color: #3a6d96;
}

.mm__btn-icon--del {
  color: #b0bcc8;
}

.mm__btn-icon--del:hover {
  background: #fce8e6;
  color: #c0605a;
}

/* ── Section head right (count + add btn) ── */
.mm__section-head-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ── Buttons ── */
.mm__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  border: none;
  border-radius: 0.5rem;
  padding: 0.45rem 0.75rem;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s, filter 0.12s;
  white-space: nowrap;
}

.mm__btn--add {
  background: #2d6b42;
  color: #fff;
  width: 1.8rem;
  height: 1.8rem;
  padding: 0;
  font-size: 1.1rem;
  font-weight: 400;
  line-height: 1;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(45, 107, 66, 0.25);
}

.mm__btn--add:hover {
  background: #236835;
  box-shadow: 0 2px 6px rgba(45, 107, 66, 0.35);
}

.mm__btn--add:active {
  transform: scale(0.93);
}

.mm__btn--ghost {
  background: #eef2f7;
  color: #3d4f63;
}

.mm__btn--ghost:hover {
  background: #e2e8f0;
}

.mm__btn--primary {
  background: #0b1220;
  color: #fff;
  padding: 0.5rem 1.1rem;
  font-size: 0.75rem;
}

.mm__btn--primary:hover {
  filter: brightness(1.1);
}

.mm__btn--pos {
  background: #2d6b42;
}

.mm__btn--neg {
  background: #c0605a;
}

.mm__btn--sm {
  padding: 0.3rem 0.55rem;
  font-size: 0.62rem;
}

/* ── Modal ── */
.mm__modal {
  border: none;
  padding: 0;
  width: min(24rem, calc(100vw - 1.5rem));
  border-radius: 1.25rem;
  background: transparent;
}

.mm__modal::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.mm__modal-panel {
  background: #fff;
  border-radius: 1.25rem;
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.18);
}

.mm__modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #eef2f7;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.mm__modal-title {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: #3d4f63;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.mm__modal-close {
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 0.45rem;
  background: rgba(0, 0, 0, 0.05);
  color: #3d4f63;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.mm__modal-close:hover {
  background: rgba(0, 0, 0, 0.09);
}

.mm__modal-form {
  display: flex;
  flex-direction: column;
}

.mm__modal-body {
  padding: 1rem 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.mm__modal-row {
  display: flex;
  gap: 0.65rem;
}

.mm__modal-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.mm__modal-field--grow {
  flex: 1;
}

.mm__modal-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8895a7;
}

.mm__modal-input {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: #1c2433;
  border: 1px solid #d0d7e2;
  border-radius: 0.5rem;
  padding: 0.5rem 0.6rem;
  background: #fff;
  transition: border-color 0.15s;
  width: 100%;
}

.mm__modal-input:focus {
  outline: none;
  border-color: #5b8db8;
  box-shadow: 0 0 0 2px rgba(91, 141, 184, 0.15);
}

.mm__modal-input--short {
  width: 4.5rem;
  text-align: center;
}

.mm__modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1rem 1rem;
}

/* ── Import button ── */
.mm__btn--import {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid #d0d7e2;
  border-radius: 0.5rem;
  background: #fff;
  color: #3d4f63;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  padding: 0;
}

.mm__btn--import:hover {
  background: #eef2f7;
  border-color: #b0bcc8;
}

/* ── Import modal ── */
.mm__modal--import {
  width: min(28rem, calc(100vw - 1.5rem));
  transition: width 0.25s ease;
}
.mm__modal--import.mm__modal--preview {
  width: min(52rem, calc(100vw - 1.5rem));
}

.mm__import-msg-host {
  margin-bottom: 0.35rem;
}
.mm__import-msg-host[hidden] {
  display: none !important;
}

.mm__import-msg {
  border-radius: 0.65rem;
  padding: 0.85rem 1rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: #3d4f63;
}

.mm__import-msg--warn {
  background: linear-gradient(145deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #e9d89c;
  box-shadow: 0 1px 2px rgba(146, 64, 14, 0.06);
}

.mm__import-msg--err {
  background: linear-gradient(145deg, #fef2f2 0%, #fee2e2 100%);
  border: 1px solid #e8b4b4;
  color: #7f1d1d;
}

.mm__import-msg-title {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: inherit;
}

.mm__import-msg-lead {
  margin: 0;
  opacity: 0.95;
}

.mm__import-msg-list {
  margin: 0.5rem 0 0.35rem;
  padding-left: 1.15rem;
}

.mm__import-msg-list li {
  margin-bottom: 0.28rem;
}

.mm__import-msg-foot {
  margin: 0.55rem 0 0;
  font-size: 0.72rem;
  color: #8895a7;
}

.mm__import-msg--warn .mm__import-msg-title {
  color: #92400e;
}

.mm__import-msg--err .mm__import-msg-title {
  color: #991b1b;
}

.mm__import-msg--warn .mm__import-msg-foot {
  color: #a16207;
}

/* ── Drop zone ── */
.mm__import-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 2rem 1rem;
  border: 2px dashed #d0d7e2;
  border-radius: 0.85rem;
  background: #fafbfd;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}

.mm__import-drop--over {
  border-color: #5b8db8;
  background: #e8f0f7;
}

.mm__import-drop--has-file {
  border-color: #34d058;
  background: #f0faf3;
}

.mm__import-drop-icon {
  color: #b0bcc8;
  margin-bottom: 0.25rem;
}

.mm__import-drop--over .mm__import-drop-icon {
  color: #5b8db8;
}

.mm__import-drop--has-file .mm__import-drop-icon {
  color: #2d6b42;
}

.mm__import-drop-text {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: #3d4f63;
}

.mm__import-drop-hint {
  margin: 0;
  font-size: 0.68rem;
  color: #8895a7;
}

.mm__import-drop-selected {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
  padding: 0.35rem 0.7rem;
  background: #d4edda;
  border-radius: 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #1b5e20;
}

/* ── Import preview ── */
.mm__modal-body--preview {
  padding: 0.75rem 0.75rem 0.25rem;
  gap: 0.5rem;
}

.mm__import-info {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.mm__import-info:empty { display: none; }

.mm__import-info-item {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 0.35rem;
}
.mm__import-info-item--skip {
  background: #fef3cd;
  color: #856404;
}
.mm__import-info-item--dup {
  background: #e8ecf2;
  color: #4a5568;
}

.mm__import-preview-actions-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.mm__import-select-all {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #3d4f63;
  cursor: pointer;
}
.mm__import-select-all input {
  accent-color: #5b8db8;
  width: 14px;
  height: 14px;
}

.mm__import-counter {
  font-size: 0.68rem;
  font-weight: 600;
  color: #8895a7;
}

.mm__import-preview-scroll {
  max-height: min(50vh, 400px);
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 0.6rem;
}

.mm__import-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.mm__import-th {
  position: sticky;
  top: 0;
  background: #eef2f7;
  padding: 0.4rem 0.5rem;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8895a7;
  text-align: left;
  border-bottom: 1px solid #d0d7e2;
  z-index: 1;
}
.mm__import-th--check { width: 2rem; text-align: center; }
.mm__import-th--type { width: 5rem; }
.mm__import-th--day { width: 3.5rem; text-align: center; }
.mm__import-th--val { width: 6rem; text-align: right; }

.mm__import-td {
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid #f0f3f7;
  vertical-align: middle;
}
.mm__import-td--check { text-align: center; }
.mm__import-td--check input {
  accent-color: #5b8db8;
  width: 14px;
  height: 14px;
  cursor: pointer;
}
.mm__import-td--day { text-align: center; }
.mm__import-td--val { text-align: right; }

.mm__import-row { transition: opacity 0.15s; }
.mm__import-row--unchecked {
  opacity: 0.35;
}
.mm__import-row--receita { background: #f8fcf9; }
.mm__import-row--despesa { background: #fffbfb; }
.mm__import-row:hover { background: #f0f5fa; }
.mm__import-row--unchecked:hover { background: #f5f5f5; }

.mm__import-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.4rem;
  border-radius: 0.3rem;
}
.mm__import-badge--receita {
  background: #d4edda;
  color: #1b5e20;
}
.mm__import-badge--despesa {
  background: #fde8e8;
  color: #9b2c2c;
}

.mm__import-input {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  color: #1c2433;
  border: 1px solid transparent;
  border-radius: 0.35rem;
  padding: 0.25rem 0.35rem;
  background: transparent;
  width: 100%;
  transition: border-color 0.12s, background 0.12s;
}
.mm__import-input:hover {
  border-color: #d0d7e2;
  background: #fff;
}
.mm__import-input:focus {
  outline: none;
  border-color: #5b8db8;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(91, 141, 184, 0.12);
}
.mm__import-input--day {
  width: 3rem;
  text-align: center;
}
.mm__import-input--val {
  width: 5.5rem;
  text-align: right;
}

/* ── Import loading ── */
.mm__import-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 3rem 1rem;
}
.mm__import-loading p {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: #5b8db8;
}
.mm__import-spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid #e2e8f0;
  border-top-color: #5b8db8;
  border-radius: 50%;
  animation: mm-spin 0.7s linear infinite;
}
@keyframes mm-spin {
  to { transform: rotate(360deg); }
}

/* ── Stats page ── */
.mm__stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.mm__stats-card {
  background: #fff;
  border-radius: 1rem;
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.mm__stats-card-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8895a7;
}

.mm__stats-card-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: #1c2433;
  font-variant-numeric: tabular-nums;
}

.mm__stats-card-val--neg {
  color: #c0605a;
}

.mm__stats-card-val--pos {
  color: #2d6b42;
}

.mm__stats-card-sub {
  font-size: 0.72rem;
  font-weight: 500;
  color: #8895a7;
  margin-top: 0.1rem;
}

.mm__stats-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

/* Vertical bar chart */
.mm__stats-bars {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
  height: 12rem;
  padding: 0 0.25rem;
}

.mm__stats-bars--days {
  height: 8rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.mm__stats-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  min-width: 0;
}

.mm__stats-bar-col--narrow {
  flex: 0 0 auto;
  width: 1.6rem;
}

.mm__stats-bar-track {
  width: 100%;
  flex: 1;
  background: transparent;
  border-radius: 0.3rem;
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 0.15rem;
}

.mm__stats-bar-fill {
  flex: 1;
  background: linear-gradient(180deg, #e8a4a0 0%, #c0605a 100%);
  border-radius: 0.3rem 0.3rem 0.15rem 0.15rem;
  transition: height 0.4s ease;
}

.mm__stats-bar-fill--pos {
  background: linear-gradient(180deg, #8ee0a1 0%, #34d058 100%);
}

.mm__stats-bar-fill--neg {
  background: linear-gradient(180deg, #e8a4a0 0%, #c0605a 100%);
}

.mm__stats-bar-label {
  font-size: 0.58rem;
  font-weight: 700;
  color: #8895a7;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mm__stats-bar-val {
  font-size: 0.55rem;
  font-weight: 600;
  color: #6b7b8d;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.mm__stats-bar-val--pos {
  color: #2d6b42;
}

.mm__stats-bars-legend {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
}

.mm__stats-legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: #6b7b8d;
}

.mm__stats-legend-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
}

.mm__stats-legend-dot--pos {
  background: #34d058;
}

.mm__stats-legend-dot--neg {
  background: #c0605a;
}

/* Stats list */
.mm__stats-list {
  display: flex;
  flex-direction: column;
}

.mm__stats-list-row {
  display: grid;
  grid-template-columns: 1.5rem 1fr auto auto;
  gap: 0.4rem;
  align-items: center;
  padding: 0.4rem 0.25rem;
  border-bottom: 1px solid #f3f5f8;
  font-size: 0.75rem;
}

.mm__stats-list-row:last-child {
  border-bottom: none;
}

.mm__stats-list-row--grouped {
  grid-template-columns: minmax(0, 1fr) 2.5rem 1fr auto;
  gap: 0.5rem;
  padding: 0.5rem 0.25rem;
}

.mm__stats-rank {
  font-size: 0.62rem;
  font-weight: 800;
  color: #b0bcc8;
  text-align: center;
}

.mm__stats-list-name {
  font-weight: 500;
  color: #1c2433;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mm__stats-list-day {
  font-size: 0.65rem;
  color: #8895a7;
  white-space: nowrap;
}

.mm__stats-list-val {
  font-weight: 700;
  color: #c0605a;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.mm__stats-list-occ {
  font-size: 0.62rem;
  font-weight: 600;
  color: #8895a7;
  white-space: nowrap;
  text-align: right;
}

.mm__stats-grouped-bar-wrap {
  height: 0.35rem;
  background: #eef2f7;
  border-radius: 999px;
  overflow: hidden;
}

.mm__stats-grouped-bar {
  height: 100%;
  background: linear-gradient(90deg, #f56565 0%, #c0605a 100%);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.mm__stats-empty {
  font-size: 0.78rem;
  color: #8895a7;
  margin: 0.5rem 0;
}

@media (max-width: 519px) {
  .mm__stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .mm__stats-two-col {
    grid-template-columns: 1fr;
  }

  .mm__stats-card-val {
    font-size: 1.1rem;
  }
}

@media (min-width: 520px) and (max-width: 767px) {
  .mm__stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .mm__stats-two-col {
    grid-template-columns: 1fr;
  }
}

/* ── Table view ── */
.mmt__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.mmt__search-wrap {
  position: relative;
  flex: 1;
  max-width: 20rem;
}

.mmt__search-icon {
  position: absolute;
  left: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  color: #b0bcc8;
  pointer-events: none;
}

.mmt__search {
  width: 100%;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  color: #1c2433;
  border: 1px solid #d0d7e2;
  border-radius: 0.5rem;
  padding: 0.5rem 0.6rem 0.5rem 2rem;
  background: #fff;
  transition: border-color 0.15s;
}

.mmt__search:focus {
  outline: none;
  border-color: #5b8db8;
  box-shadow: 0 0 0 2px rgba(91, 141, 184, 0.15);
}

.mmt__month-filter {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  color: #1c2433;
  background: #fff;
  border: 1px solid #d0d7e2;
  border-radius: 0.5rem;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
}

.mmt__month-filter:focus {
  outline: none;
  border-color: #5b8db8;
  box-shadow: 0 0 0 2px rgba(91, 141, 184, 0.15);
}

.mmt__info {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 600;
  color: #8895a7;
  white-space: nowrap;
}

.mmt__table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.mmt__table {
  width: 100%;
  border-collapse: collapse;
}

.mmt__th {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #8895a7;
  padding: 0.45rem 0.4rem;
  text-align: left;
  border-bottom: 2px solid #e8ecf2;
  white-space: nowrap;
}

.mmt__th--day { text-align: center; width: 3.5rem; }
.mmt__th--val { text-align: right; width: 7rem; }
.mmt__th--type { width: 5rem; }
.mmt__th--month { width: 6.5rem; text-align: center; }
.mmt__th--actions { width: 2.5rem; }
.mmt__th--id { width: 3rem; text-align: right; }
.mmt__td--id { text-align: right; font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.mmt__td--month { text-align: center; font-size: 0.82rem; color: var(--muted); }

.mmt__row {
  transition: background 0.12s, opacity 0.2s;
}

.mmt__row:hover {
  background: #fafbfd;
}

.mmt__td {
  padding: 0.25rem 0.4rem;
  border-bottom: 1px solid #f3f5f8;
  vertical-align: middle;
}

.mmt__badge {
  display: inline-block;
  font-size: 0.58rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mmt__badge--pos {
  background: #d4edda;
  color: #1b5e20;
}

.mmt__badge--neg {
  background: #fce8e6;
  color: #c0605a;
}

.mmt__input {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  color: #1c2433;
  border: 1px solid transparent;
  border-radius: 0.35rem;
  padding: 0.3rem 0.4rem;
  background: transparent;
  width: 100%;
  transition: border-color 0.15s, background 0.15s, outline 0.15s;
}

.mmt__input:focus {
  outline: none;
  border-color: #5b8db8;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(91, 141, 184, 0.15);
}

.mmt__input:hover:not(:focus) {
  background: #f3f5f8;
}

.mmt__input--month {
  text-align: center;
  cursor: pointer;
  padding: 0.25rem 0.15rem;
}

.mmt__input--center {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.mmt__input--right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.mmt__input--center::-webkit-inner-spin-button,
.mmt__input--center::-webkit-outer-spin-button,
.mmt__input--right::-webkit-inner-spin-button,
.mmt__input--right::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.mmt__input--center { -moz-appearance: textfield; }
.mmt__input--right  { -moz-appearance: textfield; }

/* ── Delete confirmation ── */
.mm__modal-head--del {
  background: #fef2f2;
  border-bottom-color: rgba(192, 96, 90, 0.12);
}

.mm__del-msg {
  margin: 0;
  font-size: 0.85rem;
  color: #3d4f63;
  line-height: 1.5;
}

.mm__del-msg strong {
  color: #1c2433;
}

/* ── View toggle: cartão branco como grelha do dashboard ── */
.mm__view-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
  padding: 0.35rem;
  background: #fff;
  border-radius: 1.25rem;
}

.mm__view-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.42rem 0.7rem;
  border-radius: 0.85rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: #6b7b8d;
  text-decoration: none;
  background: transparent;
  border: none;
  transition: background 0.12s, color 0.12s;
  cursor: pointer;
  font-family: inherit;
}

.mm__view-btn:hover {
  background: #f1f5f9;
  color: #1c2433;
}

.mm__view-btn--active {
  background: #eef2f7;
  color: #1c2433;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
  cursor: default;
}

/* ── Year comparison table ── */
.mm__section--year {
  grid-column: 1 / -1;
  margin-top: 0.75rem;
}

.mmy__table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.mmy__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.mmy__th {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #8895a7;
  padding: 0.45rem 0.5rem;
  text-align: right;
  border-bottom: 1px solid #e8ecf2;
  white-space: nowrap;
}

.mmy__th--month {
  text-align: left;
}

.mmy__th--bar {
  text-align: left;
  width: 10rem;
}

.mmy__row {
  transition: background 0.12s;
}

.mmy__row:hover {
  background: #fafbfd;
}

.mmy__row--empty {
  opacity: 0.45;
}

.mmy__row--total {
  border-top: 2px solid #e2e8f0;
  background: transparent !important;
}

.mmy__td {
  padding: 0.5rem 0.5rem;
  border-bottom: 1px solid #f3f5f8;
  white-space: nowrap;
}

.mmy__td--month {
  font-weight: 600;
  color: #1c2433;
}

.mmy__td--val {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.mmy__td--pos {
  color: #2d6b42;
}

.mmy__td--neg {
  color: #c0605a;
}

.mmy__td--saldo {
  font-weight: 700;
}

.mmy__td--total {
  font-weight: 800;
  font-size: 0.82rem;
}

.mmy__td--total-label {
  font-weight: 800;
  font-size: 0.82rem;
  color: #3d4f63;
}

.mmy__td--bar-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mmy__month-link {
  color: #217dbb;
  text-decoration: none;
  font-weight: 600;
}

.mmy__month-link:hover {
  text-decoration: underline;
}

.mmy__month-empty {
  color: #b0bcc8;
}

.mmy__bar {
  flex: 1;
  height: 0.4rem;
  background: #eef2f7;
  border-radius: 999px;
  overflow: hidden;
  min-width: 4rem;
}

.mmy__bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}

.mmy__bar-fill--low  { background: linear-gradient(90deg, #34d058 0%, #2d6b42 100%); }
.mmy__bar-fill--mid  { background: linear-gradient(90deg, #f5a623 0%, #b45309 100%); }
.mmy__bar-fill--high { background: linear-gradient(90deg, #f56565 0%, #c0605a 100%); }

.mmy__bar-label {
  font-size: 0.68rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #8895a7;
  min-width: 2.5rem;
}

.mmy__bar-label--low  { color: #2d6b42; }
.mmy__bar-label--mid  { color: #b45309; }
.mmy__bar-label--high { color: #c0605a; }

/* ── Responsive ── */
@media (max-width: 519px) {
  .mm {
    padding: 0 0.75rem 2rem;
  }

  .mm__topbar {
    flex-wrap: wrap;
  }

  .mm__title {
    font-size: 1.25rem;
  }

  .mm__btn--import,
  .mm__view-btn--table,
  .mm__section--charts {
    display: none;
  }

  .mm__table-header,
  .mm__table-row {
    grid-template-columns: 1fr 5.5rem 0.6rem;
    gap: 0.3rem;
    padding-right: 0.1rem;
  }

  /* Ocultar coluna Dia (mantém dados para PATCH ao guardar nome/valor) */
  .mm__th--day,
  .mm__input--day {
    display: none !important;
  }

  .mm__table-row--total > span:nth-child(2) {
    display: none;
  }

  .mm__val-wrap {
    min-height: 1.75rem;
  }

  .mm__input--val {
    padding-right: 1.5rem;
    font-size: 0.75rem;
  }

  .mm__val-wrap::after {
    right: 0.15rem;
    font-size: 0.6rem;
  }

  .mm__row-actions {
    justify-content: flex-end;
  }

  .mm__btn-icon {
    width: 0.75rem;
    height: 0.75rem;
    padding: 0;
  }

  .mm__btn-icon svg {
    width: 10px;
    height: 10px;
  }

  .mmy__th--bar,
  .mmy__td--bar-cell {
    display: none;
  }

  .mmy__td,
  .mmy__th {
    padding: 0.4rem 0.3rem;
    font-size: 0.7rem;
  }
}

@media (max-width: 400px) {
  .mm__table-header,
  .mm__table-row {
    grid-template-columns: 1fr 4.5rem 0.6rem;
    gap: 0.2rem;
  }

  .mm__input {
    font-size: 0.72rem;
    padding: 0.25rem 0.3rem;
  }
}
/* ── Sensibo ─────────────────────────────────────────── */
body:has(.sensibo) {
  background: #e8ecf2;
}

.sensibo {
  box-sizing: border-box;
  max-width: 1200px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 0 0.75rem 2rem;
  background: #fff;
  color: #1c2430;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.45;
}

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

/* ── Topbar ── */
.sensibo__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.25rem 0.6rem;
  border-bottom: 1px solid #dce2ea;
  margin-bottom: 0.75rem;
}

.sensibo__title {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  color: #1c2430;
  letter-spacing: -0.01em;
}

.sensibo__count {
  font-size: 0.75rem;
  font-weight: 600;
  color: #7a8799;
  padding: 0.2rem 0.55rem;
  background: #f0f3f8;
  border-radius: 999px;
}

/* ── Flash ── */
.sensibo__flash {
  margin: 0 0 0.65rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.8rem;
  border-radius: 0.4rem;
}

.sensibo__flash--notice {
  color: #065f46;
  background: #d1fae5;
  border: 1px solid #6ee7b7;
}

.sensibo__flash--alert {
  color: #991b1b;
  background: #fee2e2;
  border: 1px solid #fca5a5;
}

/* ── Empty state ── */
.sensibo__empty {
  margin: 1rem 0;
  padding: 1.5rem;
  font-size: 0.85rem;
  color: #5c6b7f;
  background: #f6f8fb;
  border-radius: 0.55rem;
  border: 1px solid #e4e8ee;
  line-height: 1.6;
}

.sensibo__empty code {
  font-size: 0.85em;
  color: #c0392b;
  padding: 0.1rem 0.35rem;
  background: #fee2e2;
  border-radius: 0.25rem;
}

.sensibo__empty a {
  color: #217dbb;
}

.sensibo__empty ul {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

/* ── Grid ── */
.sensibo__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  padding-top: 0.5rem;
}

@media (min-width: 640px) {
  .sensibo__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1000px) {
  .sensibo__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ── Card ── */
.sensibo__card {
  border-radius: 0.65rem;
  border: 1px solid #e4e8ee;
  background: #fff;
  overflow: hidden;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.sensibo__card:hover {
  border-color: #bbdefb;
  box-shadow: 0 2px 12px rgba(33, 125, 187, 0.08);
}

.sensibo__card--offline {
  opacity: 0.55;
}

.sensibo__card--off {
  border-color: #e4e8ee;
}

.sensibo__card--off .sensibo__measurements {
  opacity: 0.7;
}

/* ── Card head ── */
.sensibo__card-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.75rem;
  background: #f8fafc;
  border-bottom: 1px solid #eef1f5;
}

.sensibo__card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 0.5rem;
  background: #e3f2fd;
  color: #2563eb;
  flex-shrink: 0;
}

.sensibo__card-icon svg {
  width: 18px;
  height: 18px;
}

.sensibo__card-info {
  flex: 1;
  min-width: 0;
}

.sensibo__card-name {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: #1c2430;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sensibo__card-model {
  display: block;
  font-size: 0.62rem;
  font-weight: 600;
  color: #94a3b8;
  margin-top: 0.1rem;
}

.sensibo__card-updated {
  font-weight: 500;
  color: #b0bac6;
}

.sensibo__card-updated::before {
  content: " · ";
}

.sensibo__card-status {
  flex-shrink: 0;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
}

.sensibo__card-status--on {
  color: #065f46;
  background: #d1fae5;
}

.sensibo__card-status--off {
  color: #6b7280;
  background: #f3f4f6;
}

/* ── Medições ambiente ── */
.sensibo__measurements {
  display: flex;
  gap: 0.35rem;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid #eef1f5;
}

.sensibo__measure {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.35rem 0.25rem;
  background: #f6f8fb;
  border-radius: 0.45rem;
}

.sensibo__measure-icon {
  color: #7a8799;
  display: flex;
}

.sensibo__measure-icon svg {
  width: 14px;
  height: 14px;
}

.sensibo__measure-value {
  font-size: 0.95rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #1c2430;
}

.sensibo__measure-label {
  font-size: 0.58rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── AC state ── */
.sensibo__ac-state {
  padding: 0.55rem 0.75rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sensibo__ac-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid #f3f5f8;
}

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

.sensibo__ac-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: #7a8799;
  flex-shrink: 0;
  padding-top: 0.25rem;
}

.sensibo__ac-control {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sensibo__ac-control--loading > *:not(.sensibo__option-loader) {
  pointer-events: none;
}

.sensibo__ac-control--btns {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.25rem;
}

.sensibo__ac-value {
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sensibo__ac-value--on {
  color: #16a34a;
}

.sensibo__ac-value--off {
  color: #9ca3af;
}

/* ── Toggle switch ── */
.sensibo__toggle-btn {
  position: relative;
  display: inline-block;
  width: 2.6rem;
  height: 1.4rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
  padding: 0;
  flex-shrink: 0;
}

.sensibo__toggle-btn--on {
  background: #16a34a;
}

.sensibo__toggle-btn--off {
  background: #d1d5db;
}

.sensibo__toggle-knob {
  position: absolute;
  top: 0.15rem;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: left 0.2s;
}

.sensibo__toggle-btn--on .sensibo__toggle-knob {
  left: calc(100% - 1.25rem);
}

.sensibo__toggle-btn--off .sensibo__toggle-knob {
  left: 0.15rem;
}

.sensibo__toggle-btn:hover {
  filter: brightness(0.92);
}

/* ── Mode / fan / swing buttons ── */
.sensibo__mode-btn {
  display: inline-block;
  padding: 0.28rem 0.45rem;
  font-size: 0.62rem;
  font-weight: 700;
  color: #5c6b7f;
  background: #f0f3f8;
  border: 1px solid #dce2ea;
  border-radius: 0.35rem;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.sensibo__mode-btn:hover {
  background: #e3f2fd;
  color: #217dbb;
  border-color: #bbdefb;
}

.sensibo__mode-btn--active {
  color: #fff;
  background: #2563eb;
  border-color: #1d4ed8;
}

.sensibo__mode-btn--active:hover {
  background: #1d4ed8;
  color: #fff;
}

/* ── Loader por opção (POST dentro do control) ── */
/* display:none por defeito: `display:flex` directo anulava o atributo HTML `hidden`. */
.sensibo__option-loader {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(248, 250, 252, 0.88);
  border-radius: 0.45rem;
  backdrop-filter: blur(2px);
}

.sensibo__ac-control--loading .sensibo__option-loader {
  display: flex;
}

.sensibo__option-loader-spin {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  border: 2px solid rgba(37, 99, 235, 0.2);
  border-top-color: rgba(37, 99, 235, 0.95);
  animation: sensibo-option-spin 0.75s linear infinite;
}

@keyframes sensibo-option-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Temperature control ── */
.sensibo__temp-control {
  display: flex;
  align-items: center;
  gap: 0;
}

.sensibo__temp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  font-size: 1rem;
  font-weight: 700;
  color: #2563eb;
  background: #e3f2fd;
  border: 1px solid #bbdefb;
  cursor: pointer;
  transition: background 0.12s;
}

/* O botão está dentro de <form> (button_to); há inputs hidden antes dele, por isso :first-child no botão falha. */
.sensibo__temp-control form:first-of-type .sensibo__temp-btn {
  border-radius: 0.4rem 0 0 0.4rem;
}

.sensibo__temp-control form:last-of-type .sensibo__temp-btn {
  border-radius: 0 0.4rem 0.4rem 0;
}

.sensibo__temp-btn:hover {
  background: #bfdbfe;
}

.sensibo__temp-value {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 3.5rem;
  height: 2rem;
  padding: 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #1c2430;
  background: #f8fafc;
  border-top: 1px solid #dce2ea;
  border-bottom: 1px solid #dce2ea;
}

/* ── Responsive ── */
@media (max-width: 519px) {
  .sensibo__topbar {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .sensibo__title {
    font-size: 1.3rem;
    flex: 1 1 100%;
  }

  .sensibo__ac-row {
    flex-direction: column;
    gap: 0.25rem;
  }

  .sensibo__ac-control--btns {
    justify-content: flex-start;
  }
}
/* Login page — matches dashboard :root tokens from application.css */

.sessions-layout {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem calc(2rem + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(ellipse 90% 60% at 50% -15%, rgba(61, 156, 240, 0.22) 0%, transparent 55%),
    linear-gradient(165deg, var(--bg) 0%, #141c28 100%);
  color: var(--text);
}

.sessions-layout__main {
  width: 100%;
  max-width: 22rem;
}

.sessions-card {
  padding: 1.75rem 1.5rem 1.85rem;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
}

.sessions-card__title {
  margin: 0 0 0.6rem;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.sessions-card__hint {
  margin: 0 0 1.25rem;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--muted);
}

.sessions-card__code {
  font-size: 0.78em;
  padding: 0.12em 0.35em;
  border-radius: 0.25rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.sessions-card__flash {
  margin: 0 0 1rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.82rem;
  border-radius: var(--radius);
  line-height: 1.35;
}

.sessions-card__flash--alert {
  color: #fecaca;
  background: rgba(240, 113, 120, 0.12);
  border: 1px solid rgba(240, 113, 120, 0.35);
}

.sessions-card__flash--notice {
  color: #a7f3d0;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.35);
}

.sessions-card__form {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.sessions-card__label {
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.sessions-card__input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.65rem 0.85rem;
  font-size: 1rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sessions-card__input:focus {
  border-color: rgba(61, 156, 240, 0.55);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.sessions-card__input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.sessions-card__submit {
  margin-top: 0.35rem;
  padding: 0.72rem 1rem;
  font-size: 0.92rem;
  font-weight: 650;
  color: #0b1628;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius);
  background: linear-gradient(145deg, var(--accent) 0%, #2b8fd9 100%);
  box-shadow: 0 4px 16px rgba(61, 156, 240, 0.35);
  transition: filter 0.15s ease, transform 0.1s ease;
}

.sessions-card__submit:hover {
  filter: brightness(1.06);
}

.sessions-card__submit:active {
  transform: translateY(1px);
}

.sessions-card__submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
  transform: none;
}
/* ── Definições (notificações, sessão) ── */
:root {
  --s-bg: #e8ecf2;
  --s-text: #1c2433;
  --s-muted: #6b7c8f;
  --s-muted-2: #9eaab8;
  --s-section-bg: #fff;
  --s-section-border: rgba(28, 36, 51, 0.06);
  --s-hairline: rgba(28, 36, 51, 0.08);
  --s-field-bg: #f4f6f9;
  --s-field-border: rgba(28, 36, 51, 0.18);
  --s-accent: #217dbb;
  --s-accent-hover: #1a6a9e;
  --s-track-bg: rgba(28, 36, 51, 0.18);
  --s-danger: #a84842;
  --s-danger-bg: rgba(192, 96, 90, 0.08);
  --s-danger-border: rgba(192, 96, 90, 0.35);
  --s-danger-bg-hover: rgba(192, 96, 90, 0.14);
  --s-danger-border-hover: rgba(192, 96, 90, 0.5);
}

:root[data-theme="dark"] {
  --s-bg: #12171f;
  --s-text: #eef2f7;
  --s-muted: #8b9aad;
  --s-muted-2: #6b7c8f;
  --s-section-bg: #1c2433;
  --s-section-border: rgba(255, 255, 255, 0.08);
  --s-hairline: rgba(255, 255, 255, 0.08);
  --s-field-bg: #232d40;
  --s-field-border: rgba(255, 255, 255, 0.14);
  --s-accent: #3d9cf0;
  --s-accent-hover: #5aacf5;
  --s-track-bg: rgba(255, 255, 255, 0.18);
  --s-danger: #f0908a;
  --s-danger-bg: rgba(240, 113, 105, 0.12);
  --s-danger-border: rgba(240, 113, 105, 0.4);
  --s-danger-bg-hover: rgba(240, 113, 105, 0.18);
  --s-danger-border-hover: rgba(240, 113, 105, 0.55);
}

body:has(.settings) {
  margin: 0;
  min-height: 100vh;
  background: var(--s-bg);
}

.settings {
  box-sizing: border-box;
  max-width: 36rem;
  margin: 0 auto;
  min-height: 100vh;
  padding: 0 1.25rem calc(2rem + env(safe-area-inset-bottom, 0px));
  color: var(--s-text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.45;
}

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

.settings__head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 1rem 0 1.1rem;
}

.settings__back {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--s-accent);
  text-decoration: none;
}

.settings__back:hover {
  color: var(--s-accent-hover);
}

.settings__title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--s-text);
}

.settings__section {
  background: var(--s-section-bg);
  border-radius: 1.25rem;
  padding: 1rem 1.1rem 1.15rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--s-section-border);
}

.settings__section--muted {
  opacity: 0.92;
}

.settings__section-title {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
  font-weight: 650;
  color: var(--s-text);
}

.settings__section-desc {
  margin: 0 0 0.85rem;
  font-size: 0.78rem;
  color: var(--s-muted);
  line-height: 1.5;
}

.settings__section-desc code {
  font-size: 0.72rem;
}

.settings__push {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.7rem;
}

.settings__push--inactive,
.settings__push--active {
  /* estado aplicado pelo JS após connect() */
}

.settings__push--inactive [data-growatt-push-target="unsubscribeBtn"] { display: none; }

.settings__push-group {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: 100%;
  padding-top: 0.7rem;
  border-top: 1px solid var(--s-hairline);
}

.settings__push-group-title {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--s-muted-2);
}

.settings__interval-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--s-muted);
}

.settings__push-name {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
}

.settings__name-input {
  appearance: none;
  width: 100%;
  padding: 0.45rem 0.7rem;
  font: inherit;
  font-size: 0.82rem;
  color: var(--s-text);
  background: var(--s-field-bg);
  border: 1px solid var(--s-field-border);
  border-radius: 0.65rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.settings__name-input::placeholder {
  color: var(--s-muted-2);
}

.settings__name-input:focus {
  border-color: var(--s-accent);
  box-shadow: 0 0 0 3px rgba(33, 125, 187, 0.12);
}

.settings__push-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
}

.settings__push-status {
  margin: 0;
  min-height: 1.2em;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--s-muted);
}

.settings__toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  cursor: pointer;
}

.settings__toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.settings__toggle-track {
  flex: none;
  position: relative;
  width: 2.4rem;
  height: 1.4rem;
  margin-top: 0.05rem;
  background: var(--s-track-bg);
  border-radius: 1rem;
  transition: background 0.15s ease;
}

.settings__toggle-track::before {
  content: "";
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 1.1rem;
  height: 1.1rem;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}

.settings__toggle input:checked + .settings__toggle-track {
  background: var(--s-accent);
}

.settings__toggle input:checked + .settings__toggle-track::before {
  transform: translateX(1rem);
}

.settings__toggle-label {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--s-text);
}

.settings__toggle-label small {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--s-muted);
  line-height: 1.4;
}

.settings__btn {
  appearance: none;
  margin: 0;
  padding: 0.55rem 1rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 650;
  border-radius: 0.75rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.settings__btn--primary {
  background: var(--s-accent);
  color: #fff;
  border-color: var(--s-accent-hover);
}

.settings__btn--primary:hover {
  background: var(--s-accent-hover);
}

.settings__btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.settings__btn--ghost {
  background: transparent;
  color: var(--s-muted);
  border-color: var(--s-field-border);
}

.settings__btn--ghost:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--s-text);
}

.settings__devices {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.settings__device {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  background: var(--s-field-bg);
  border-radius: 0.75rem;
}

.settings__device-icon {
  flex-shrink: 0;
  color: var(--s-accent);
  display: flex;
}

.settings__device-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.settings__device-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--s-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings__device-next {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--s-muted-2);
}

.settings__device-types {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0.15rem 0;
}

.settings__device-type-tag {
  font-size: 0.65rem;
  font-weight: 650;
  padding: 0.1rem 0.45rem;
  border-radius: 1rem;
  background: rgba(33, 125, 187, 0.12);
  color: var(--s-accent-hover);
}

.settings__device-type-tag--off {
  background: rgba(28, 36, 51, 0.08);
  color: var(--s-muted-2);
}

.settings__device-delete {
  appearance: none;
  flex-shrink: 0;
  margin: 0;
  padding: 0.25rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--s-muted-2);
  display: flex;
  border-radius: 0.4rem;
  transition: color 0.12s ease, background 0.12s ease;
}

.settings__device-delete:hover {
  color: #c0605a;
  background: rgba(192, 96, 90, 0.08);
}

.settings__logout-form {
  margin: 0;
}

.settings__logout-btn {
  appearance: none;
  margin: 0;
  padding: 0.55rem 1.15rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 650;
  cursor: pointer;
  border-radius: 0.75rem;
  border: 1px solid var(--s-danger-border);
  background: var(--s-danger-bg);
  color: var(--s-danger);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.settings__logout-btn:hover {
  background: var(--s-danger-bg-hover);
  border-color: var(--s-danger-border-hover);
}

@media (max-width: 639px) {
  .settings {
    padding-bottom: calc(6rem + env(safe-area-inset-bottom, 0px));
  }
}

/* ── Tema do painel (página Solar) ── */
.settings__skins {
  display: grid;
  gap: 0.4rem;
  width: 100%;
}

.settings__skin {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--s-field-border);
  border-radius: 0.85rem;
  background: var(--s-field-bg);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.settings__skin--on {
  border-color: var(--s-accent);
  box-shadow: 0 0 0 1px var(--s-accent) inset;
}

.settings__skin-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.settings__skin-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.settings__skin-text small {
  font-size: 0.74rem;
  color: var(--s-muted);
}

.settings__skin-apply {
  appearance: none;
  margin: 0;
  padding: 0.35rem 0.8rem;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 650;
  color: #fff;
  background: var(--s-accent);
  border: 1px solid var(--s-accent-hover);
  border-radius: 0.6rem;
  cursor: pointer;
  flex-shrink: 0;
}

.settings__skin-apply:hover {
  background: var(--s-accent-hover);
}

.settings__skin-current {
  font-size: 0.76rem;
  font-weight: 650;
  color: var(--s-accent);
  padding: 0.35rem 0.4rem;
  flex-shrink: 0;
}

.settings__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.settings__links .settings__btn {
  text-decoration: none;
}

/* ── Menu de tópicos ── */
.settings__menu {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.75rem;
  background: var(--s-section-bg);
  border: 1px solid var(--s-section-border);
  border-radius: 1.25rem;
  overflow: hidden;
}

.settings__menu-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.85rem 1rem 0.85rem 1.1rem;
  color: var(--s-text);
  text-decoration: none;
  transition: background 0.12s ease;
}

.settings__menu-item + .settings__menu-item {
  border-top: 1px solid var(--s-hairline);
}

.settings__menu-item:hover,
.settings__menu-item:focus-visible {
  background: var(--s-field-bg);
}

.settings__menu-icon {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 0.7rem;
  background: rgba(33, 125, 187, 0.12);
  color: var(--s-accent);
}

.settings__menu-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.settings__menu-name {
  font-size: 0.9rem;
  font-weight: 650;
}

.settings__menu-text small {
  font-size: 0.74rem;
  color: var(--s-muted);
}

.settings__menu-chevron {
  flex: none;
  color: var(--s-muted-2);
}

.settings__flash {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--s-accent);
  background: rgba(33, 125, 187, 0.1);
  border-radius: 0.75rem;
}
/* ── Smart Life ─────────────────────────────────────────── */
body:has(.smart-life) {
  background: #e8ecf2;
}

.smart-life {
  box-sizing: border-box;
  max-width: 1200px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 0 0.75rem 2rem;
  background: #fff;
  color: #1c2430;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.45;
}

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

/* ── Topbar ── */
.smart-life__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.25rem 0.6rem;
  border-bottom: 1px solid #dce2ea;
  margin-bottom: 0.75rem;
}

.smart-life__title {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  color: #1c2430;
  letter-spacing: -0.01em;
}

.smart-life__title a {
  color: inherit;
  text-decoration: none;
}

.smart-life__nav {
  display: flex;
  gap: 0.35rem;
}

.smart-life__nav-link {
  padding: 0.35rem 0.7rem;
  border-radius: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #5c6b7f;
  text-decoration: none;
  background: #f0f3f8;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s;
}

.smart-life__nav-link:hover {
  background: #e3f2fd;
  color: #217dbb;
}

.smart-life__nav-link--on {
  color: #217dbb;
  background: #e3f2fd;
  border-color: #bbdefb;
}

/* ── Header ── */
.smart-life__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.25rem 0.75rem;
}

.smart-life__subtitle {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #2c3e50;
}

.smart-life__count {
  font-size: 0.75rem;
  font-weight: 600;
  color: #7a8799;
  padding: 0.2rem 0.55rem;
  background: #f0f3f8;
  border-radius: 999px;
}

/* ── Flash ── */
.smart-life__flash {
  margin: 0 0 0.65rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.8rem;
  border-radius: 0.4rem;
}

.smart-life__flash--notice {
  color: #065f46;
  background: #d1fae5;
  border: 1px solid #6ee7b7;
}

.smart-life__flash--alert {
  color: #991b1b;
  background: #fee2e2;
  border: 1px solid #fca5a5;
}

/* ── Empty state ── */
.smart-life__empty {
  margin: 1rem 0;
  padding: 1.5rem;
  font-size: 0.85rem;
  color: #5c6b7f;
  background: #f6f8fb;
  border-radius: 0.55rem;
  border: 1px solid #e4e8ee;
  line-height: 1.6;
}

.smart-life__empty code {
  font-size: 0.85em;
  color: #c0392b;
  padding: 0.1rem 0.35rem;
  background: #fee2e2;
  border-radius: 0.25rem;
}

.smart-life__empty a {
  color: #217dbb;
}

.smart-life__empty ul {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.smart-life__empty li {
  margin-bottom: 0.35rem;
}

.smart-life__empty ol {
  margin: 0.5rem 0;
  padding-left: 1.35rem;
}

.smart-life__empty--hint {
  margin-top: 0.75rem;
}

/* ── Scenes ── */
.smart-life__scenes {
  margin-bottom: 0.85rem;
}

.smart-life__scenes-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.55rem 0.25rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #2c3e50;
}

.smart-life__scenes-icon {
  color: #eab308;
  flex-shrink: 0;
}

.smart-life__scenes-empty {
  margin: 0;
  padding: 0.65rem 0.75rem;
  font-size: 0.78rem;
  color: #7a8799;
  background: #f6f8fb;
  border: 1px solid #e4e8ee;
  border-radius: 0.45rem;
}

.smart-life__scenes-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

@media (min-width: 520px) {
  .smart-life__scenes-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 900px) {
  .smart-life__scenes-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.smart-life__scene-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.65rem 0.7rem;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fcd34d;
  border-radius: 0.6rem;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.smart-life__scene-card:hover {
  border-color: #f59e0b;
  box-shadow: 0 3px 14px rgba(245, 158, 11, 0.15);
  transform: translateY(-1px);
}

.smart-life__scene-info {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.smart-life__scene-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 0.4rem;
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
  flex-shrink: 0;
}

.smart-life__scene-icon-wrap svg {
  width: 14px;
  height: 14px;
}

.smart-life__scene-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: #78350f;
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.smart-life__scene-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.4rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border: none;
  border-radius: 0.4rem;
  cursor: pointer;
  transition: filter 0.12s, transform 0.1s;
  letter-spacing: 0.02em;
}

.smart-life__scene-btn:hover {
  filter: brightness(1.08);
  transform: scale(1.02);
}

.smart-life__scene-btn:active {
  transform: scale(0.97);
}

/* ── Grupos por tipo (collapse; fechados por defeito) ── */
.smart-life__groups {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.smart-life__group {
  border: 1px solid #e4e8ee;
  border-radius: 0.55rem;
  background: #f6f8fb;
  overflow: hidden;
}

.smart-life__group-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.55rem;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
  list-style: none;
  font-size: 0.88rem;
  font-weight: 700;
  color: #2c3e50;
  user-select: none;
}

.smart-life__group-summary::-webkit-details-marker {
  display: none;
}

.smart-life__group-summary::after {
  content: "";
  margin-left: auto;
  width: 0.4rem;
  height: 0.4rem;
  border-right: 2px solid #7a8799;
  border-bottom: 2px solid #7a8799;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.smart-life__group[open] .smart-life__group-summary::after {
  transform: rotate(-135deg);
  margin-top: 0.2rem;
}

.smart-life__group[open] .smart-life__group-summary {
  background: #eef2f8;
  border-bottom: 1px solid #e4e8ee;
}

.smart-life__group-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #217dbb;
}

.smart-life__group-icon svg {
  width: 1.35rem;
  height: 1.35rem;
}

.smart-life__group-title {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.smart-life__group-code {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
  padding: 0.15rem 0.4rem;
  background: #fff;
  border-radius: 0.25rem;
  border: 1px solid #e4e8ee;
  flex-shrink: 0;
}

.smart-life__group-count {
  font-size: 0.68rem;
  font-weight: 700;
  color: #5c6b7f;
  padding: 0.2rem 0.5rem;
  background: #fff;
  border-radius: 999px;
  border: 1px solid #dce2ea;
  flex-shrink: 0;
}

.smart-life__group-body {
  padding: 0.65rem 0.65rem 0.75rem;
  background: #fff;
}

/* ── Grid de cards ── */
.smart-life__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}

@media (min-width: 520px) {
  .smart-life__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .smart-life__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ── Card ── */
.smart-life__card {
  border-radius: 0.65rem;
  border: 1px solid #e4e8ee;
  background: #fff;
  overflow: hidden;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.smart-life__card:hover {
  border-color: #bbdefb;
  box-shadow: 0 2px 12px rgba(33, 125, 187, 0.08);
}

.smart-life__card--offline {
  opacity: 0.6;
}

.smart-life__card--offline:hover {
  opacity: 0.75;
}

.smart-life__card-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.75rem;
  background: #f8fafc;
  border-bottom: 1px solid #eef1f5;
}

.smart-life__card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 0.5rem;
  background: #e3f2fd;
  color: #2563eb;
  flex-shrink: 0;
}

.smart-life__card-icon svg {
  width: 18px;
  height: 18px;
}

.smart-life__card-info {
  flex: 1;
  min-width: 0;
}

.smart-life__card-name {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: #1c2430;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.smart-life__card-cat {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  color: #7a8799;
  margin-top: 0.1rem;
}

.smart-life__card-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.62rem;
  font-weight: 500;
  color: #94a3b8;
  line-height: 1.35;
  max-width: 14rem;
}

.smart-life__card-status {
  flex-shrink: 0;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
}

.smart-life__card-status--on {
  color: #065f46;
  background: #d1fae5;
}

.smart-life__card-status--off {
  color: #6b7280;
  background: #f3f4f6;
}

/* ── Data points ── */
.smart-life__card-data {
  padding: 0.55rem 0.75rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.smart-life__datum {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid #f3f5f8;
}

.smart-life__datum:last-child {
  border-bottom: none;
}

.smart-life__datum-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: #7a8799;
  flex-shrink: 0;
}

.smart-life__datum-value {
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #2c3e50;
  text-align: right;
}

.smart-life__datum-value--highlight {
  font-size: 1rem;
  color: #e67e22;
}

.smart-life__datum-value--on {
  color: #16a34a;
}

.smart-life__datum-value--off {
  color: #9ca3af;
}

/* ── Toggle switch ── */
.smart-life__datum--switch {
  padding: 0.4rem 0;
}

.smart-life__datum-switch-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.smart-life__toggle-btn {
  position: relative;
  display: inline-block;
  width: 2.6rem;
  height: 1.4rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
  padding: 0;
  flex-shrink: 0;
}

.smart-life__toggle-btn--on {
  background: #16a34a;
}

.smart-life__toggle-btn--off {
  background: #d1d5db;
}

.smart-life__toggle-knob {
  position: absolute;
  top: 0.15rem;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: left 0.2s;
}

.smart-life__toggle-btn--on .smart-life__toggle-knob {
  left: calc(100% - 1.25rem);
}

.smart-life__toggle-btn--off .smart-life__toggle-knob {
  left: 0.15rem;
}

.smart-life__toggle-btn:hover {
  filter: brightness(0.92);
}

/* ── Persiana / cortina (control, percent_control) ── */
.smart-life__datum--curtain {
  flex-wrap: wrap;
  align-items: flex-start;
}

.smart-life__curtain-row {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
  flex: 1;
  min-width: 0;
}

.smart-life__curtain-row--percent {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.smart-life__curtain-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: flex-end;
}

.smart-life__curtain-btns--legacy {
  margin-top: 0.15rem;
}

.smart-life__curtain-legacy-hint {
  margin: 0.35rem 0 0;
  width: 100%;
  text-align: right;
  font-size: 0.58rem;
  font-weight: 600;
  color: #94a3b8;
}

.smart-life__cmd-btn--small {
  padding: 0.22rem 0.4rem;
  font-size: 0.58rem;
}

.smart-life__cmd-btn {
  display: inline-block;
  padding: 0.32rem 0.55rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: #1c2430;
  background: #e8f4fc;
  border: 1px solid #9dcfed;
  border-radius: 0.35rem;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.smart-life__cmd-btn:hover {
  background: #d7ebf9;
}

.smart-life__cmd-btn--muted {
  background: #f0f3f8;
  border-color: #dce2ea;
  color: #5c6b7f;
}

.smart-life__cmd-btn--compact {
  padding: 0.32rem 0.5rem;
}

.smart-life__percent-form {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
}

.smart-life__percent-input {
  width: 3.25rem;
  padding: 0.28rem 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  border: 1px solid #dce2ea;
  border-radius: 0.35rem;
  color: #1c2430;
}

/* ── Sensor temp/hum: + info modal ── */
.smart-life__more-wrap {
  margin-top: 0.15rem;
  padding-top: 0.4rem;
  border-top: 1px solid #eef1f6;
}

.smart-life__more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.45rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #217dbb;
  background: #e8f4fc;
  border: 1px solid #c5e3f6;
  border-radius: 0.4rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.smart-life__more-btn:hover {
  background: #d7ebf9;
  border-color: #9dcfed;
}

.smart-life__dialog {
  margin: auto;
  padding: 0;
  border: none;
  border-radius: 0.65rem;
  max-width: calc(100vw - 1.5rem);
  width: min(22rem, 100%);
  background: transparent;
  box-shadow: none;
}

.smart-life__dialog::backdrop {
  background: rgba(28, 36, 48, 0.48);
  backdrop-filter: blur(2px);
}

.smart-life__dialog-panel {
  background: #fff;
  border-radius: 0.65rem;
  border: 1px solid #dce2ea;
  box-shadow: 0 18px 48px rgba(28, 36, 48, 0.18);
  overflow: hidden;
}

.smart-life__dialog-head {
  padding: 0.85rem 1rem 0.5rem;
  border-bottom: 1px solid #eef1f6;
}

.smart-life__dialog-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #1c2430;
  line-height: 1.3;
}

.smart-life__dialog-sub {
  margin: 0.25rem 0 0;
  font-size: 0.68rem;
  font-weight: 600;
  color: #7a8799;
}

.smart-life__dialog-body {
  padding: 0.35rem 0.75rem 0.5rem;
  max-height: min(55vh, 20rem);
  overflow-y: auto;
}

.smart-life__dialog-body .smart-life__datum:last-child {
  border-bottom: none;
}

.smart-life__dialog-actions {
  margin: 0;
  padding: 0.55rem 0.75rem 0.75rem;
  border-top: 1px solid #eef1f6;
}

.smart-life__dialog-close {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #2c3e50;
  background: #f0f3f8;
  border: 1px solid #dce2ea;
  border-radius: 0.4rem;
  cursor: pointer;
}

.smart-life__dialog-close:hover {
  background: #e4e9f0;
}

/* ── Câmara / vídeo em direto ── */
.smart-life__camera-row {
  padding: 0.35rem 0.75rem 0.5rem;
  border-top: 1px solid #eef1f6;
}

.smart-life__camera-link {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background: #217dbb;
  text-decoration: none;
  padding: 0.4rem 0.65rem;
  border-radius: 0.4rem;
  border: 1px solid #1a6a9e;
  transition: filter 0.12s;
}

.smart-life__camera-link:hover {
  filter: brightness(1.06);
  color: #fff;
}

.smart-life--camera .smart-life__camera-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0.25rem 0.85rem;
}

.smart-life__camera-title {
  flex: 1 1 auto;
  margin: 0;
}

.smart-life__camera-actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.smart-life__camera-back,
.smart-life__camera-refresh {
  font-size: 0.72rem;
  font-weight: 700;
  text-decoration: none;
  padding: 0.3rem 0.55rem;
  border-radius: 0.35rem;
}

.smart-life__camera-back {
  color: #5c6b7f;
  background: #f0f3f8;
  border: 1px solid #dce2ea;
}

.smart-life__camera-back:hover {
  color: #217dbb;
  background: #e8f4fc;
}

.smart-life__camera-refresh {
  color: #065f46;
  background: #d1fae5;
  border: 1px solid #6ee7b7;
}

.smart-life__camera-refresh:hover {
  filter: brightness(0.97);
}

.smart-life__camera-player {
  margin: 0 0 1rem;
  border-radius: 0.55rem;
  overflow: hidden;
  border: 1px solid #dce2ea;
  background: #0f1419;
}

.smart-life__camera-video {
  display: block;
  width: 100%;
  max-height: min(70vh, 520px);
  margin: 0;
  vertical-align: middle;
}

.smart-life__camera-hint {
  margin: 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  color: #fecaca;
  background: #450a0a;
}

.smart-life__camera-footnote {
  margin: 0.5rem 0 0;
  padding: 0 0.15rem;
  font-size: 0.68rem;
  line-height: 1.45;
  color: #7a8799;
}

@media (max-width: 519px) {
  .smart-life__topbar {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .smart-life__title {
    font-size: 1.3rem;
    flex: 1 1 100%;
  }

  .smart-life__nav {
    flex: 1 1 100%;
  }
}

.smart-life__code-block {
  margin: 0.5rem 0;
  padding: 0.75rem 1rem;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 0.45rem;
  font-size: 0.82rem;
  font-family: ui-monospace, "Cascadia Code", "Fira Code", monospace;
  white-space: pre;
  overflow-x: auto;
  line-height: 1.6;
}

/* ── Câmaras ao vivo (RTSP local) ── */
.smart-life__live-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 0.75rem;
  margin: 0 0 1rem;
}

.smart-life__live {
  margin: 0;
}

.smart-life__live-player {
  position: relative;
  margin: 0;
  aspect-ratio: 16 / 9;
}

.smart-life__live-player .smart-life__camera-video {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  cursor: zoom-in;
}

.smart-life__live-hint {
  position: absolute;
  inset: auto 0 0 0;
  margin: 0;
  padding: 0.45rem 0.7rem;
  font-size: 0.75rem;
  color: #e5e7eb;
  background: rgb(15 20 25 / 0.75);
}

.smart-life__live-hint[hidden] {
  display: none;
}

.smart-life__live-hint--erro {
  color: #fecaca;
  background: rgb(69 10 10 / 0.85);
}

.smart-life__live-name {
  padding: 0.35rem 0.15rem 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: #2c3e50;
}
/* ── Tapo (tomadas locais KLAP) ───────────────────────── */
:root {
  --tp-bg: #e8ecf2;
  --tp-surface: #fff;
  --tp-text: #1c2430;
  --tp-muted: #7a8799;
  --tp-border: #dce2ea;
  --tp-accent: #217dbb;
  --tp-nav-off: #5c6b7f;
  --tp-chip-bg: #f0f3f8;
  --tp-empty-bg: #f6f8fb;
  --tp-empty-border: #e4e8ee;
  --tp-code-bg: #eef1f6;
  --tp-card-bg: #fafbfd;
  --tp-card-border: #e4e8ee;
  --tp-card-error-bg: #fff5f5;
  --tp-card-error-border: #fca5a5;
  --tp-flash-notice-bg: #d1fae5;
  --tp-flash-notice-border: #6ee7b7;
  --tp-flash-notice-text: #065f46;
  --tp-flash-alert-bg: #fee2e2;
  --tp-flash-alert-border: #fca5a5;
  --tp-flash-alert-text: #991b1b;
  --tp-btn-off-bg: #e5e7eb;
  --tp-btn-off-bg-hover: #d1d5db;
  --tp-btn-off-text: #374151;
  --tp-btn-ghost-bg: #f0f3f8;
  --tp-btn-ghost-bg-hover: #e4eaf2;
}

:root[data-theme="dark"] {
  --tp-bg: #12171f;
  --tp-surface: #1c2433;
  --tp-text: #eef2f7;
  --tp-muted: #8b9aad;
  --tp-border: rgba(255, 255, 255, 0.1);
  --tp-accent: #3d9cf0;
  --tp-nav-off: #8b9aad;
  --tp-chip-bg: #232d40;
  --tp-empty-bg: #232d40;
  --tp-empty-border: rgba(255, 255, 255, 0.1);
  --tp-code-bg: #2a3548;
  --tp-card-bg: #232d40;
  --tp-card-border: rgba(255, 255, 255, 0.1);
  --tp-card-error-bg: rgba(240, 113, 105, 0.1);
  --tp-card-error-border: rgba(240, 113, 105, 0.4);
  --tp-flash-notice-bg: rgba(52, 211, 153, 0.14);
  --tp-flash-notice-border: rgba(52, 211, 153, 0.4);
  --tp-flash-notice-text: #6ee7b7;
  --tp-flash-alert-bg: rgba(240, 113, 105, 0.14);
  --tp-flash-alert-border: rgba(240, 113, 105, 0.4);
  --tp-flash-alert-text: #f0908a;
  --tp-btn-off-bg: #364255;
  --tp-btn-off-bg-hover: #3f4c62;
  --tp-btn-off-text: #eef2f7;
  --tp-btn-ghost-bg: #232d40;
  --tp-btn-ghost-bg-hover: #2a3548;
}

body:has(.tapo) {
  background: var(--tp-bg);
}

.tapo {
  box-sizing: border-box;
  max-width: 960px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 0 0.75rem 2rem;
  background: var(--tp-surface);
  color: var(--tp-text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.45;
}

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

.tapo__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.25rem 0.6rem;
  border-bottom: 1px solid var(--tp-border);
  margin-bottom: 0.75rem;
}

.tapo__title {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--tp-text);
  letter-spacing: -0.01em;
}

.tapo__title a {
  color: inherit;
  text-decoration: none;
}

.tapo__title a:hover {
  color: var(--tp-accent);
}

.tapo__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  align-items: center;
  justify-content: flex-end;
}

.tapo__nav-link {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--tp-accent);
  text-decoration: none;
}

.tapo__nav-link:hover {
  text-decoration: underline;
}

.tapo__nav-link--on {
  color: var(--tp-nav-off);
  pointer-events: none;
}

.tapo__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.tapo__subtitle {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--tp-text);
}

.tapo__count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--tp-muted);
  padding: 0.2rem 0.55rem;
  background: var(--tp-chip-bg);
  border-radius: 999px;
}

.tapo__flash {
  margin: 0 0 0.65rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.8rem;
  border-radius: 0.4rem;
}

.tapo__flash--notice {
  color: var(--tp-flash-notice-text);
  background: var(--tp-flash-notice-bg);
  border: 1px solid var(--tp-flash-notice-border);
}

.tapo__flash--alert {
  color: var(--tp-flash-alert-text);
  background: var(--tp-flash-alert-bg);
  border: 1px solid var(--tp-flash-alert-border);
}

.tapo__empty {
  margin: 1rem 0;
  padding: 1.5rem;
  font-size: 0.85rem;
  color: var(--tp-nav-off);
  background: var(--tp-empty-bg);
  border-radius: 0.55rem;
  border: 1px solid var(--tp-empty-border);
  line-height: 1.6;
}

.tapo__empty code {
  font-size: 0.85em;
  color: var(--tp-text);
  padding: 0.1rem 0.35rem;
  background: var(--tp-code-bg);
  border-radius: 0.25rem;
  word-break: break-all;
}

.tapo__hint {
  margin: 1rem 0 0;
  font-size: 0.8rem;
  color: var(--tp-nav-off);
}

.tapo__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  padding-top: 0.5rem;
}

@media (min-width: 560px) {
  .tapo__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.tapo__card {
  padding: 1rem;
  border: 1px solid var(--tp-card-border);
  border-radius: 0.65rem;
  background: var(--tp-card-bg);
}

.tapo__card--error {
  border-color: var(--tp-card-error-border);
  background: var(--tp-card-error-bg);
}

.tapo__card-head {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.75rem;
}

.tapo__card-name {
  font-weight: 700;
  font-size: 1rem;
}

.tapo__card-ip {
  font-size: 0.75rem;
  color: var(--tp-muted);
  font-family: ui-monospace, monospace;
}

.tapo__card-error {
  margin: 0;
  font-size: 0.85rem;
  color: var(--tp-flash-alert-text);
}

.tapo__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.tapo__stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.tapo__stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tp-muted);
}

.tapo__stat-value {
  font-size: 1.05rem;
  font-weight: 600;
}

.tapo__meta {
  margin: 0 0 0.85rem;
  font-size: 0.75rem;
  color: var(--tp-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tapo__actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tapo__btn {
  appearance: none;
  border: none;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 0.45rem;
  cursor: pointer;
}

.tapo__btn--on {
  background: #059669;
  color: #fff;
}

.tapo__btn--on:hover {
  background: #047857;
}

.tapo__btn--off {
  background: var(--tp-btn-off-bg);
  color: var(--tp-btn-off-text);
}

.tapo__btn--off:hover {
  background: var(--tp-btn-off-bg-hover);
}

.tapo__btn--ghost {
  background: var(--tp-btn-ghost-bg);
  color: var(--tp-text);
  border: 1px solid var(--tp-border);
}

.tapo__btn--ghost:hover {
  background: var(--tp-btn-ghost-bg-hover);
}

.tapo__empty--inline {
  margin: 0.75rem 0 1.25rem;
  padding: 1rem 1.25rem;
}

/* ── Câmaras (HLS ao vivo) ─────────────────────────────── */
.tapo__cams {
  margin-bottom: 1.5rem;
}

.tapo__cam {
  padding: 0.75rem;
}

.tapo__cam-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.tapo__cam-head .tapo__card-head {
  margin-bottom: 0.6rem;
}

.tapo__cam-qualities {
  display: flex;
  flex-shrink: 0;
  gap: 0.25rem;
}

.tapo__cam-quality {
  appearance: none;
  flex-shrink: 0;
  padding: 0.2rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--tp-muted);
  background: var(--tp-btn-ghost-bg);
  border: 1px solid var(--tp-border);
  border-radius: 999px;
  cursor: pointer;
}

.tapo__cam-quality:hover {
  background: var(--tp-btn-ghost-bg-hover);
}

.tapo__cam-quality--on {
  color: #fff;
  background: var(--tp-accent);
  border-color: var(--tp-accent);
}

.tapo__cam-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
  border-radius: 0.45rem;
}

.tapo__cam-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* Última imagem por cima do vídeo enquanto troca de qualidade (tapo_camera_controller.js#_congelar). */
.tapo__cam-congelado {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.tapo__cam-status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 1rem;
  font-size: 0.8rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.tapo__cam-status[hidden] {
  display: none;
}

.tapo__cam-live {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.1rem 0.45rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 0.3rem;
  pointer-events: none;
}

.tapo__cam-live::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #ef4444;
}

.tapo__cam-live[hidden] {
  display: none;
}

/* Rodar a câmara: botão no canto inferior direito do vídeo; abre as setas e os pontos de vista. */
.tapo__ptz {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
}

/* Com os controlos nativos do vídeo (página /tapo): por cima da barra deles. */
.tapo__cam-video[controls] ~ .tapo__ptz {
  bottom: 3.25rem;
}

.tapo__ptz-painel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 0.6rem;
}

.tapo__ptz-painel[hidden] {
  display: none;
}

.tapo__ptz-pad {
  display: grid;
  grid-template-columns: repeat(3, 1.9rem);
  grid-template-rows: repeat(3, 1.9rem);
  gap: 0.15rem;
}

.tapo__ptz-presets {
  display: flex;
  gap: 0.25rem;
}

.tapo__ptz-presets:empty {
  display: none;
}

.tapo__ptz-toggle,
.tapo__ptz-seta,
.tapo__ptz-preset {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: #fff;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 0.4rem;
  cursor: pointer;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.tapo__ptz-toggle {
  width: 1.9rem;
  height: 1.9rem;
}

.tapo__ptz-seta {
  width: 1.9rem;
  height: 1.9rem;
}

.tapo__ptz-preset {
  width: 1.4rem;
  height: 1.4rem;
}

.tapo__ptz-toggle:hover,
.tapo__ptz-seta:hover,
.tapo__ptz-preset:hover,
.tapo__ptz-seta:active,
.tapo__ptz-toggle--on {
  background: #217dbb;
  border-color: #217dbb;
}

@media (max-width: 640px) {
  .tapo__ptz-pad {
    grid-template-columns: repeat(3, 1.6rem);
    grid-template-rows: repeat(3, 1.6rem);
  }

  .tapo__ptz-seta {
    width: 1.6rem;
    height: 1.6rem;
  }

  .tapo__ptz-preset {
    width: 1.25rem;
    height: 1.25rem;
  }
}

/* Saúde do vídeo ao vivo (saude_video.js): «atraso de 4,2 s» a âmbar, «com falhas» a vermelho; ao
   lado do nome da câmara ou, no leitor do portão / /ezviz, por cima do vídeo (canto de cima). */
.camera-saude {
  display: inline-flex;
  align-items: center;
  margin-left: 0.4rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  vertical-align: middle;
}

.camera-saude[hidden] {
  display: none;
}

.camera-saude--atraso {
  color: #7c2d12;
  background: #fde68a;
}

.camera-saude--falhas {
  color: #fff;
  background: #dc2626;
}

.camera-saude--sobre {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 2;
  margin: 0;
  box-shadow: 0 4px 10px -4px rgba(0, 0, 0, 0.5);
}

/* De onde vem o vídeo (tapo_camera_controller#_mostrarFonte): MSE (websocket do go2rtc) ou HLS, e a resolução. */
.tapo__cam-fonte {
  align-self: flex-start;
  padding: 0.05rem 0.35rem;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  color: #fff;
  background: #2f8f4e;
  border-radius: 0.25rem;
}

.tapo__cam-fonte--hls {
  background: #8a6d1f;
}

.tapo__cam-fonte[hidden] {
  display: none;
}
/* ── /tiny_tuya — reaproveita o estilo dash__shutter do dashboard;
   aqui só ficam os extras específicos desta página (badge de ping, IP). ── */

.tiny-tuya__badge {
  display: inline-block;
  margin-top: 0.3rem;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
}

.tiny-tuya__ip-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.2rem 0 0;
}

.tiny-tuya__ip-row .tiny-tuya__ip {
  margin: 0;
}

.tiny-tuya__ip-row .tiny-tuya__badge {
  margin-top: 0;
}

.tiny-tuya__badge--online {
  background: rgba(52, 211, 153, 0.2);
  color: #067a4c;
}

.tiny-tuya__badge--offline {
  background: rgba(148, 163, 184, 0.25);
  color: #64748b;
}

.tiny-tuya__badge--pending {
  background: rgba(251, 191, 36, 0.2);
  color: #b45309;
}

.tiny-tuya__ip {
  margin: 0.2rem 0 0;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: #7c8ba1;
}

@media (prefers-color-scheme: dark) {
  .tiny-tuya__ip {
    color: #6b7d93;
  }
}
body:has(.tips-page) {
  margin: 0;
  min-height: 100vh;
  background: #e8ecf2;
}

.tips-page {
  box-sizing: border-box;
  max-width: 36rem;
  margin: 0 auto;
  min-height: 100vh;
  padding: 0 1.25rem calc(2rem + env(safe-area-inset-bottom, 0px));
  color: #1c2433;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.45;
}

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

.tips-page__head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.tips-page__head-row .settings__title {
  margin: 0;
}

.tips-page__refresh-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  border-radius: 0.75rem;
  cursor: pointer;
  border: 1px solid rgba(28, 36, 51, 0.16);
  background: #fff;
  color: #3d4f63;
  transition: background 0.12s, border-color 0.12s;
}

.tips-page__refresh-btn:hover {
  background: #f0f4f8;
  border-color: rgba(28, 36, 51, 0.25);
}

.tips-page__updated {
  margin: 0.15rem 0 0;
  font-size: 0.72rem;
  color: #a0aec0;
}

.tips-page__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.tips-page__tip {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: #fff;
  border-radius: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(28, 36, 51, 0.06);
}

.tips-page__tip-icon {
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 0.05rem;
}

.tips-page__tip-body {
  min-width: 0;
}

.tips-page__tip-title {
  margin: 0 0 0.2rem;
  font-size: 0.88rem;
  font-weight: 650;
  color: #1c2433;
}

.tips-page__tip-text {
  margin: 0;
  font-size: 0.78rem;
  color: #5a6578;
  line-height: 1.5;
}

/* Cores por accent */
.tips-page__tip--green  { border-left: 3px solid #3a7a3a; }
.tips-page__tip--blue   { border-left: 3px solid #3b82f6; }
.tips-page__tip--yellow { border-left: 3px solid #d97706; }
.tips-page__tip--red    { border-left: 3px solid #dc2626; }
.tips-page__tip--gray   { border-left: 3px solid #94a3b8; }

@media (max-width: 639px) {
  .tips-page {
    padding: 0 0.5rem calc(6rem + env(safe-area-inset-bottom, 0px));
  }
}
/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *


 */

:root {
  --bg: #1e2a3a;
  --surface: #2a3548;
  --surface-2: #364255;
  --text: #eef2f7;
  --muted: #8b9aad;
  --accent: #3d9cf0;
  --accent-dim: rgba(61, 156, 240, 0.12);
  --danger: #f07178;
  --radius: 12px;
  --radius-lg: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.growatt-fluxo-dia {
  margin: 1.25rem 0 0;
  padding: 1rem 1.1rem 1.15rem;
  border-radius: 0.75rem;
  background: rgba(8, 20, 40, 0.45);
  border: 1px solid rgba(79, 209, 255, 0.15);
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.growatt-fluxo-dia__title {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.88);
}

.growatt-fluxo-dia__form {
  margin: 0 0 0.85rem;
  padding: 0.75rem 0 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.growatt-fluxo-dia__form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
}

.growatt-fluxo-dia__form-label {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.65);
}

.growatt-fluxo-dia__form-input {
  min-width: 11rem;
}

.growatt-fluxo-dia__form-submit {
  margin: 0;
}

.growatt-fluxo-dia__nota {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  color: rgba(255, 200, 120, 0.95);
}

.growatt-fluxo-dia__grid {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: 1fr;
}

@media (min-width: 520px) {
  .growatt-fluxo-dia__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .growatt-fluxo-dia__grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.growatt-fluxo-dia__metric {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border-radius: 0.45rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.growatt-fluxo-dia__metric-label {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.03em;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.25;
}

.growatt-fluxo-dia__metric-value {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.95);
}

.growatt-fluxo-dia__unit {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.45);
}

.growatt-fluxo-dia__hint {
  margin: 0.75rem 0 0;
  font-size: 0.75rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.45);
}

.growatt-tempo-real {
  margin: 1rem 0 0;
  padding: 1rem 1.1rem 1.15rem;
  border-radius: 0.75rem;
  background: rgba(8, 20, 40, 0.45);
  border: 1px solid rgba(79, 209, 255, 0.18);
  backdrop-filter: blur(14px);
  box-shadow: 0 0 32px rgba(79, 209, 255, 0.08), 0 8px 32px rgba(0, 0, 0, 0.3);
}

.growatt-tempo-real__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}

.growatt-tempo-real__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.88);
}

.growatt-tempo-real__refresh {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.growatt-tempo-real__refresh:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
}

.growatt-tempo-real__refresh-ico {
  font-size: 1rem;
  line-height: 1;
}

.growatt-tempo-real__nota {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  color: rgba(255, 200, 120, 0.95);
}

.growatt-tempo-real__grid {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: 1fr;
}

@media (min-width: 520px) {
  .growatt-tempo-real__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.growatt-tempo-real__metric {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border-radius: 0.45rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.growatt-tempo-real__label {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.25;
}

.growatt-tempo-real__value {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.95);
}

.growatt-tempo-real__unit {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.45);
}

.growatt-tempo-real__meta {
  margin: 0.65rem 0 0;
  font-size: 0.72rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.42);
}

/* —— Growatt: painel glass (estilo automóvel / energia) —— */
body:has(.growatt-app) {
  margin: 0;
  min-height: 100vh;
  color-scheme: light;
  background: radial-gradient(120% 80% at 50% -10%, #e0f2fe 0%, transparent 55%),
    radial-gradient(90% 60% at 100% 40%, rgba(14, 165, 233, 0.16) 0%, transparent 50%),
    linear-gradient(165deg, #f8fafc 0%, #f1f5f9 45%, #e2e8f0 100%);
  color: #0f172a;
}

.growatt-app {
  --g-cyan: #4fd1ff;
  --g-cyan-dim: rgba(79, 209, 255, 0.15);
  --g-orange: #ff9a3c;
  --g-glass: rgba(255, 255, 255, 0.06);
  --g-glass-border: rgba(255, 255, 255, 0.14);
  --g-glow-cyan: 0 0 24px rgba(79, 209, 255, 0.35);
  --g-glow-warm: 0 0 20px rgba(255, 154, 60, 0.45), 0 0 40px rgba(255, 154, 60, 0.12);
  position: relative;
  box-sizing: border-box;
  max-width: 1200px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 0 0.75rem 5rem;
  color: rgba(232, 244, 255, 0.95);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.45;
  isolation: isolate;
}

.growatt-app__ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse 80% 50% at 50% 35%, rgba(30, 90, 140, 0.25) 0%, transparent 55%),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 40px,
      rgba(79, 209, 255, 0.03) 40px,
      rgba(79, 209, 255, 0.03) 41px
    );
  opacity: 0.9;
}

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

.growatt-app__back {
  font-size: 0.82rem;
  font-weight: 600;
  color: #3498db;
  text-decoration: none;
}

.growatt-app__back:hover {
  text-decoration: underline;
}

.growatt-app__site {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.growatt-app__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  font-size: 1.1rem;
  line-height: 1;
  color: #3498db;
  text-decoration: none;
  border: 1px solid #d0dbe8;
  background: #f8fafc;
}

.growatt-app__icon-btn:hover {
  background: #eef5fc;
}

.growatt-app__tabs-main {
  display: flex;
  margin: 0;
  padding: 0 0.5rem;
  border-bottom: 1px solid rgba(79, 209, 255, 0.12);
}

.growatt-app__tab-main {
  flex: 1;
  text-align: center;
  padding: 0.75rem 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(160, 195, 220, 0.55);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.growatt-app__tab-main--on {
  color: var(--g-cyan);
  border-bottom-color: var(--g-cyan);
  text-shadow: 0 0 16px rgba(79, 209, 255, 0.35);
}

.growatt-app__tabs-scale {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.5rem 0.25rem 0.65rem;
  justify-content: center;
}

.growatt-app__pill {
  padding: 0.45rem 1rem;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(200, 230, 255, 0.55);
  text-decoration: none;
  background: var(--g-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--g-glass-border);
  clip-path: polygon(6% 0, 100% 0, 94% 100%, 0 100%);
  transition: color 0.2s, box-shadow 0.2s, border-color 0.2s, background 0.2s;
}

.growatt-app__pill:hover {
  color: rgba(232, 244, 255, 0.9);
  border-color: rgba(79, 209, 255, 0.35);
  background: rgba(79, 209, 255, 0.08);
}

.growatt-app__pill--on {
  color: #0a1628;
  background: linear-gradient(135deg, rgba(79, 209, 255, 0.95) 0%, rgba(56, 189, 248, 0.85) 100%);
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: var(--g-glow-cyan), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.growatt-app__topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0.35rem 1rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid rgba(79, 209, 255, 0.12);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

.growatt-app__brand {
  min-width: 0;
}

.growatt-app__brand-kicker {
  margin: 0 0 0.15rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(79, 209, 255, 0.75);
}

.growatt-app__title {
  margin: 0;
  font-size: clamp(1.35rem, 4vw, 1.85rem);
  font-weight: 700;
  color: #f0f9ff;
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-shadow: 0 0 40px rgba(79, 209, 255, 0.25);
  padding: 0;
}

.growatt-app__title a {
  color: inherit;
  text-decoration: none;
}

.growatt-app__title a:hover {
  color: var(--g-cyan);
}

.growatt-app__title-link {
  display: inline-flex;
  align-items: center;
  gap: 0.52rem;
  max-width: 100%;
}

.growatt-app__title-icon {
  display: block;
  flex-shrink: 0;
  width: clamp(1.72rem, 4.6vw, 2.1rem);
  height: clamp(1.72rem, 4.6vw, 2.1rem);
  filter: drop-shadow(0 0 14px rgba(79, 209, 255, 0.38));
}

.growatt-app__title-link:hover .growatt-app__title-icon {
  filter: drop-shadow(0 0 20px rgba(79, 209, 255, 0.52));
}

.growatt-app__topbar-actions {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
  margin-top: 15px;
}

.growatt-app__last-updated {
  margin: 0.35rem 0 0;
  font-size: 0.68rem;
  color: rgba(180, 210, 235, 0.55);
}

.growatt-app__last-updated time {
  color: rgba(232, 244, 255, 0.75);
  font-variant-numeric: tabular-nums;
}

.growatt-app__btn-purge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.42rem 0.9rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: #061018;
  background: linear-gradient(145deg, var(--g-cyan) 0%, #38bdf8 50%, #0ea5e9 100%);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 0.4rem;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--g-glow-cyan), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: transform 0.12s, box-shadow 0.15s, filter 0.15s;
  margin-right: 0;
}

.growatt-app__btn-purge:hover {
  filter: brightness(1.08);
  box-shadow: 0 0 28px rgba(79, 209, 255, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transform: translateY(-1px);
}

.growatt-app__btn-purge:active {
  transform: translateY(0);
}

.growatt-app__btn-refresh {
  background: linear-gradient(145deg, #34d399 0%, #10b981 55%, #059669 100%);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 20px rgba(52, 211, 153, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  text-decoration: none;
}

.growatt-app__btn-refresh:hover {
  filter: brightness(1.08);
  box-shadow: 0 0 26px rgba(52, 211, 153, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.growatt-app__btn-refresh:active {
  transform: translateY(0);
}

.growatt-app__btn-refresh--wait {
  background: linear-gradient(145deg, rgba(100, 116, 139, 0.9) 0%, rgba(51, 65, 85, 0.95) 100%);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: none;
  color: rgba(226, 232, 240, 0.85);
  cursor: default;
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.growatt-app__btn-refresh--wait:hover {
  filter: none;
  transform: none;
}

@media (max-width: 600px) {
  .growatt-app__topbar {
    flex-wrap: nowrap;
    gap: 0.45rem;
  }

  .growatt-app__brand {
    flex: 1 1 0%;
    min-width: 0;
  }

  .growatt-app__topbar-actions {
    flex: 0 0 auto;
    justify-content: flex-end;
  }

  .growatt-app__btn-purge {
    font-size: 0.62rem;
    padding: 0.4rem 0.65rem;
  }

  .growatt-app__chart-zoom-hint {
    display: none;
  }
}

.growatt-app__btn--hidden {
  display: none;
}

.growatt-app__flash-notice {
  margin: 0.35rem 0;
  padding: 0.55rem 0.85rem;
  font-size: 0.78rem;
  color: #a7f3d0;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.35);
  border-radius: 0.45rem;
  backdrop-filter: blur(10px);
  box-shadow: 0 0 20px rgba(52, 211, 153, 0.12);
}

.growatt-app__flash-alert {
  margin: 0.35rem 0;
  padding: 0.55rem 0.85rem;
  font-size: 0.78rem;
  color: #fecaca;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.4);
  border-radius: 0.45rem;
  backdrop-filter: blur(10px);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.12);
}

.growatt-app__date-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.4rem 0.25rem 0.9rem;
}

.growatt-app__chev {
  min-width: 2.35rem;
  height: 2.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 300;
  color: var(--g-cyan);
  text-decoration: none;
  line-height: 1;
  background: var(--g-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--g-glass-border);
  border-radius: 0.45rem;
  transition: box-shadow 0.2s, color 0.2s, border-color 0.2s;
}

.growatt-app__chev:hover {
  box-shadow: var(--g-glow-cyan);
  border-color: rgba(79, 209, 255, 0.45);
}

.growatt-app__chev--off {
  color: rgba(120, 150, 180, 0.35);
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.06);
  pointer-events: none;
  box-shadow: none;
}

.growatt-app__date-form {
  flex: 1;
  margin: 0;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.growatt-app__date-input {
  max-width: 100%;
  padding: 0.4rem 0.85rem;
  font-size: 0.92rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: #f0f9ff;
  border: 1px solid rgba(79, 209, 255, 0.25);
  border-radius: 999px;
  background: rgba(0, 20, 40, 0.45);
  backdrop-filter: blur(12px);
  box-shadow: inset 0 0 20px rgba(79, 209, 255, 0.06), 0 0 24px rgba(79, 209, 255, 0.08);
}

.growatt-app__placeholder {
  margin: 0 0.25rem 0.75rem;
  padding: 0.65rem 0.85rem;
  font-size: 0.82rem;
  color: rgba(180, 210, 235, 0.75);
  background: var(--g-glass);
  border-radius: 0.5rem;
  border: 1px solid var(--g-glass-border);
  backdrop-filter: blur(12px);
}

.growatt-app__now {
  border-radius: 0.5rem;
}

.growatt-app__now-head {
  display: flex;
  justify-content: flex-end;
  margin: -0.15rem 0 0.5rem;
}

.growatt-app__now-refresh {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.32rem 0.6rem;
  border-radius: 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(232, 244, 255, 0.9);
  text-decoration: none;
  border: 1px solid rgba(79, 209, 255, 0.3);
  background: rgba(79, 209, 255, 0.08);
  backdrop-filter: blur(8px);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.growatt-app__now-refresh:hover {
  background: rgba(79, 209, 255, 0.15);
  border-color: rgba(79, 209, 255, 0.5);
  box-shadow: 0 0 16px rgba(79, 209, 255, 0.2);
}

.growatt-app__now-refresh-ico {
  font-size: 0.95rem;
  line-height: 1;
}

.growatt-app__now-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

@media (min-width: 520px) {
  .growatt-app__now-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
  }

  .growatt-app__now-card--wide {
    grid-column: 1 / -1;
  }
}

@media (min-width: 900px) {
  .growatt-app__now-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.65rem;
  }

  .growatt-app__now-card--wide {
    grid-column: auto;
  }
}

.growatt-app__now-card {
  position: relative;
  overflow: hidden;
  border-radius: 0.65rem;
  padding: 0.65rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  border: 1px solid var(--g-glass-border);
  background: var(--g-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

@media (min-width: 480px) {
  .growatt-app__now-card {
    padding: 0.7rem 0.9rem;
  }
}

.growatt-app__now-card--solar {
  border-color: rgba(251, 191, 36, 0.35);
  box-shadow: 0 0 28px rgba(251, 191, 36, 0.12), 0 8px 32px rgba(0, 0, 0, 0.25);
}

.growatt-app__now-card--solar .growatt-app__now-card-icon {
  color: rgba(251, 191, 36, 0.45);
}

/* Consumo: sempre a vermelho. */
.growatt-app__now-card--consumo {
  border-color: rgba(239, 68, 68, 0.4);
  box-shadow: 0 0 28px rgba(239, 68, 68, 0.12), 0 8px 32px rgba(0, 0, 0, 0.25);
}

.growatt-app__now-card--consumo .growatt-app__now-card-icon {
  color: rgba(239, 68, 68, 0.55);
}

.growatt-app__now-card--balanco {
  border-color: rgba(52, 211, 153, 0.4);
  box-shadow: 0 0 28px rgba(52, 211, 153, 0.1), 0 8px 32px rgba(0, 0, 0, 0.25);
}

.growatt-app__now-card--balanco .growatt-app__now-card-icon {
  color: rgba(52, 211, 153, 0.45);
}

.growatt-app__now-card--balanco-neg {
  border-color: rgba(248, 113, 113, 0.45);
  box-shadow: 0 0 28px rgba(248, 113, 113, 0.12), 0 8px 32px rgba(0, 0, 0, 0.25);
}

.growatt-app__now-card--balanco-neg .growatt-app__now-card-icon {
  color: rgba(248, 113, 113, 0.45);
}

.growatt-app__now-card--potencia {
  border-color: rgba(79, 209, 255, 0.35);
  box-shadow: var(--g-glow-cyan), 0 8px 32px rgba(0, 0, 0, 0.3);
}

.growatt-app__now-trio {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

@media (min-width: 360px) {
  .growatt-app__now-trio {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }
}

.growatt-app__now-trio-item {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.3rem;
}

@media (min-width: 360px) {
  .growatt-app__now-trio-item {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.15rem;
  }
}

.growatt-app__now-trio-label {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.65rem;
  font-weight: 600;
  color: rgba(160, 195, 220, 0.65);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.growatt-app__now-trio-val {
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #f0f9ff;
}

.growatt-app__now-trio-val small {
  font-size: 0.65rem;
  font-weight: 600;
  color: rgba(160, 195, 220, 0.55);
}

.growatt-app__now-card--poupanca {
  border-color: rgba(52, 211, 153, 0.4);
  box-shadow: 0 0 24px rgba(52, 211, 153, 0.1), 0 8px 32px rgba(0, 0, 0, 0.25);
}

.growatt-app__now-card--poupanca .growatt-app__now-card-icon {
  color: rgba(52, 211, 153, 0.45);
}

.growatt-app__now-val--poupanca {
  color: #6ee7b7;
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
}

.growatt-app__now-card--custo {
  border-color: rgba(167, 139, 250, 0.45);
  box-shadow: 0 0 24px rgba(167, 139, 250, 0.12), 0 8px 32px rgba(0, 0, 0, 0.25);
}

.growatt-app__now-card--custo .growatt-app__now-card-icon {
  color: rgba(167, 139, 250, 0.45);
}

.growatt-app__now-val--custo {
  color: #c4b5fd;
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
}

.growatt-app__now-card-icon {
  position: absolute;
  bottom: -0.4rem;
  right: -0.3rem;
  opacity: 0.12;
  pointer-events: none;
  line-height: 0;
}

@media (max-width: 479px) {
  .growatt-app__now-card-icon svg {
    width: 52px;
    height: 52px;
  }
}

.growatt-app__now-card-settings {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  border: none;
  border-radius: 0.4rem;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(224, 242, 254, 0.75);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.growatt-app__now-card-settings:hover,
.growatt-app__now-card-settings:focus-visible {
  background: rgba(255, 255, 255, 0.16);
  color: #f0f9ff;
}

.growatt-app__battery-modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.growatt-app__battery-modal-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
}

.growatt-app__battery-modal-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.growatt-app__battery-modal-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.growatt-app__battery-modal-row dt {
  font-size: 0.82rem;
  font-weight: 600;
  color: #5a6a7e;
}

.growatt-app__battery-modal-row dd {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: #1c2433;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.growatt-app__battery-modal-hint {
  margin: 0;
  font-size: 0.78rem;
  color: #5a6a7e;
}

.growatt-app__now-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(160, 195, 220, 0.65);
  margin-bottom: 0.2rem;
}

.growatt-app__now-val {
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
  color: #f0f9ff;
}

.growatt-app__now-val small {
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(160, 195, 220, 0.55);
}

.growatt-app__now-val--positivo {
  color: #34d399;
  text-shadow: 0 0 14px rgba(52, 211, 153, 0.5);
}

.growatt-app__now-val--negativo {
  color: #ef4444;
  text-shadow: 0 0 14px rgba(239, 68, 68, 0.5);
}

.growatt-app__now-tendencia {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.7rem;
  font-weight: 600;
  margin-top: 0.15rem;
  padding: 0.15rem 0.4rem;
  border-radius: 0.3rem;
  width: fit-content;
}

.growatt-app__now-tendencia--subir {
  background: rgba(52, 211, 153, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(52, 211, 153, 0.25);
}

.growatt-app__now-tendencia--descer {
  background: rgba(248, 113, 113, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(248, 113, 113, 0.25);
}

.growatt-app__now-tendencia--estavel {
  background: rgba(148, 163, 184, 0.12);
  color: rgba(200, 215, 235, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.growatt-app__now-meta {
  margin: 0.55rem 0 0;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.72rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: rgba(160, 195, 220, 0.55);
  text-align: center;
  line-height: 1.35;
}

.growatt-app__now-meta time {
  color: inherit;
}

.growatt-app__nota {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  color: #fda4af;
}

.growatt-app__chart-card {
  margin: 0.5rem 0 1rem;
  padding: 0.85rem 1rem 1rem;
  border-radius: 0.75rem;
  background: rgba(8, 20, 40, 0.5);
  border: 1px solid rgba(79, 209, 255, 0.18);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 0 40px rgba(79, 209, 255, 0.08), 0 12px 40px rgba(0, 0, 0, 0.35);
}

.growatt-app__tabs-chart {
  display: flex;
  gap: 0;
  margin: 0 0 0.85rem;
  padding: 0;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid rgba(79, 209, 255, 0.2);
  background: rgba(4, 12, 28, 0.45);
}

.growatt-app__chart-host--fv-hora {
  min-height: 14rem;
}

.growatt-app__chart-plot--fv-hora {
  min-height: 16rem;
}

.growatt-app__ano-fv-total {
  margin-top: 1rem;
}

.growatt-app__mes-dias-chart {
  margin: 0 0 1rem;
  padding: 0 0 0.5rem;
  border-bottom: 1px solid rgba(79, 209, 255, 0.1);
}

.growatt-app__mes-dias-chart__title {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: rgba(220, 235, 255, 0.95);
}

.growatt-app__mes-dias-chart__hint {
  margin: 0 0 0.65rem;
}

.growatt-app__mes-dias-chart-host {
  min-height: 12rem;
}

.growatt-app__chart-plot--mes-dias {
  min-height: 18rem;
}

.growatt-app__ano-meses-chart {
  margin: 0 0 1rem;
  padding: 0 0 0.75rem;
  border-bottom: 1px solid rgba(79, 209, 255, 0.1);
}

.growatt-app__ano-meses-chart-host {
  min-height: 12rem;
}

.growatt-app__chart-plot--ano-meses {
  min-height: 18rem;
}

.growatt-app__tab-chart {
  flex: 1;
  text-align: center;
  padding: 0.55rem 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(160, 195, 220, 0.65);
  text-decoration: none;
  border-right: 1px solid rgba(79, 209, 255, 0.12);
  transition: color 0.15s, background 0.15s;
}

.growatt-app__tab-chart:last-child {
  border-right: none;
}

.growatt-app__tab-chart:hover {
  color: rgba(232, 244, 255, 0.92);
  background: rgba(79, 209, 255, 0.08);
}

.growatt-app__tab-chart--on {
  color: #0a1628;
  background: linear-gradient(135deg, rgba(79, 209, 255, 0.88) 0%, rgba(56, 189, 248, 0.75) 100%);
}

.growatt-app__fv-acum__intro {
  margin: 0 0 1rem;
  line-height: 1.45;
}

.growatt-app__fv-acum__intro strong {
  color: rgba(220, 235, 255, 0.95);
  font-weight: 650;
}

.growatt-app__fv-acum__destaque {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.5rem;
  background: rgba(46, 204, 113, 0.12);
  border: 1px solid rgba(46, 204, 113, 0.28);
}

.growatt-app__fv-acum__destaque-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(200, 230, 210, 0.9);
}

.growatt-app__fv-acum__destaque-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: rgb(129, 230, 180);
  letter-spacing: 0.02em;
}

.growatt-app__fv-acum__destaque-hint {
  flex-basis: 100%;
  margin: 0;
  font-size: 0.68rem;
  color: rgba(160, 195, 220, 0.55);
  line-height: 1.35;
}

.growatt-app__chart-host {
  position: relative;
  min-height: 15rem;
}

.growatt-app__chart-empty {
  margin: 0;
  padding: 2rem 0.75rem;
  text-align: center;
  font-size: 0.82rem;
  color: rgba(160, 195, 220, 0.55);
  line-height: 1.5;
}

.growatt-app__chart-plot {
  height: auto;
  min-height: 20rem;
  width: 100%;
}

.growatt-app__chart-plot canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.growatt-app__chart-zoom-hint {
  margin: 0.35rem 0 0;
  padding: 0 0.15rem;
  font-size: 0.68rem;
  line-height: 1.35;
  color: rgba(160, 195, 220, 0.45);
  text-align: center;
}

.growatt-app__energy {
  margin: 0 0.15rem 1rem;
  padding: 0.85rem 1rem 1rem;
  border-radius: 0.75rem;
  background: rgba(8, 20, 40, 0.35);
  border: 1px solid rgba(79, 209, 255, 0.12);
  backdrop-filter: blur(14px);
}

.growatt-app__energy-head {
  margin: 0.85rem 0 0.45rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: rgba(240, 249, 255, 0.95);
  text-shadow: 0 0 20px rgba(79, 209, 255, 0.15);
}

.growatt-app__energy-head:first-child {
  margin-top: 0;
}

.growatt-app__stackbar {
  margin-bottom: 0.15rem;
}

.growatt-app__stackbar-track {
  display: flex;
  height: 1.45rem;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.35);
  box-sizing: border-box;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(79, 209, 255, 0.2);
  transform: translateZ(0);
}

.growatt-app__stackbar-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 100%;
  padding: 0 0.2rem;
  box-sizing: border-box;
  transition: width 0.25s ease;
}

.growatt-app__stackbar-seg-lbl {
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.growatt-app__stackbar-labels {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.4rem;
  font-size: 0.72rem;
  color: rgba(180, 210, 235, 0.65);
}

.growatt-app__stackbar-labels--tri {
  flex-wrap: wrap;
  justify-content: flex-start;
  column-gap: 1rem;
  row-gap: 0.35rem;
}

.growatt-app__stackbar-labels--tri > span {
  flex: 1 1 7.5rem;
  min-width: 0;
}

.growatt-app__stackbar-labels strong {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  color: rgba(232, 244, 255, 0.88);
  margin-bottom: 0.08rem;
}

.growatt-app__stackbar-seg--teal {
  background: linear-gradient(180deg, #5eead4 0%, #14b8a6 100%);
  box-shadow: 0 0 12px rgba(20, 184, 166, 0.45);
}

.growatt-app__stackbar-seg--green {
  background: linear-gradient(180deg, #4ade80 0%, #22c55e 100%);
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.4);
}

.growatt-app__stackbar-seg--gold {
  background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.45);
}

.growatt-app__stackbar-seg--purple {
  background: linear-gradient(180deg, #c4b5fd 0%, #8b5cf6 100%);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.45);
}

.growatt-app__stackbar-seg--muted {
  background: rgba(51, 65, 85, 0.6);
}

.growatt-app__hint {
  margin: 0.65rem 0 0;
  font-size: 0.72rem;
  line-height: 1.45;
  color: rgba(160, 195, 220, 0.55);
}

.growatt-app__empty {
  margin: 1rem 0.25rem;
  padding: 0.9rem 1rem;
  font-size: 0.85rem;
  color: rgba(180, 210, 235, 0.75);
  background: var(--g-glass);
  border: 1px solid var(--g-glass-border);
  border-radius: 0.55rem;
  backdrop-filter: blur(12px);
}

.growatt-app__empty code {
  font-size: 0.88em;
  color: #fda4af;
}

/* Bi-horário: mesmo "look" do resumo de energia. */
.growatt-app__bi.growatt-app__chart-card {
  margin: 0 0.15rem 1rem;
  padding: 0.85rem 1rem 1rem;
}

.growatt-app__bi .growatt-app__bi-first-head {
  margin-top: 0;
}

.growatt-app__bi .growatt-app__bi-hint-tight {
  margin-top: 0.2rem;
  margin-bottom: 0.45rem;
}

.growatt-app__custo-topo {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.25rem 0.6rem;
  margin: 0 0.15rem 0.85rem;
  padding: 0.65rem 0.9rem;
  background: var(--g-glass);
  border: 1px solid rgba(255, 154, 60, 0.25);
  border-radius: 0.65rem;
  backdrop-filter: blur(14px);
  box-shadow: var(--g-glow-warm);
}

.growatt-app__custo-topo-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255, 200, 150, 0.75);
  flex: 1 1 100%;
}

.growatt-app__custo-topo-valor {
  font-size: 1.35rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--g-cyan);
  text-shadow: 0 0 24px rgba(79, 209, 255, 0.35);
}

.growatt-app__custo-topo-detalhe {
  font-size: 0.72rem;
  color: rgba(180, 210, 235, 0.6);
  align-self: center;
}

.growatt-app__bi-resumo-dia {
  margin: 0.75rem 0 0;
  padding: 0.55rem 0.65rem 0.65rem;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(79, 209, 255, 0.12);
}

.growatt-app__bi-resumo-dia-label {
  margin: 0 0 0.2rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(160, 195, 220, 0.55);
}

.growatt-app__bi-resumo-dia-total {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--g-cyan);
}

.growatt-app__bi-resumo-dia-parts {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.45;
  color: rgba(180, 210, 235, 0.65);
}

.growatt-app__bi-resumo-dia-note {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.65rem;
  font-style: italic;
  color: rgba(160, 195, 220, 0.45);
}

.growatt-app__growatt-scale {
  margin: 0 0.65rem 0.65rem;
  padding: 0 0.15rem;
  justify-content: center;
}

.growatt-app__date-row--mes {
  margin-bottom: 0.35rem;
}

.growatt-app__date-input--mes {
  min-width: 10rem;
  text-align: center;
}

.growatt-app__mes-filtro {
  margin: 0 0.15rem 0.65rem;
  padding: 0.65rem 0.85rem;
  background: var(--g-glass);
  border: 1px solid var(--g-glass-border);
  border-radius: 0.65rem;
  backdrop-filter: blur(14px);
}

.growatt-app__mes-filtro-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem 0.75rem;
}

.growatt-app__mes-filtro-label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(160, 195, 220, 0.65);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.growatt-app__mes-filtro-input {
  padding: 0.35rem 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #f0f9ff;
  border: 1px solid rgba(79, 209, 255, 0.25);
  border-radius: 0.4rem;
  background: rgba(0, 15, 35, 0.6);
}

.growatt-app input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1) brightness(1.15);
  opacity: 0.95;
  cursor: pointer;
}

.growatt-app input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

.growatt-app__mes-filtro-btn {
  padding: 0.42rem 0.9rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #061018;
  background: linear-gradient(145deg, var(--g-cyan) 0%, #38bdf8 50%, #0ea5e9 100%);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 0.4rem;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--g-glow-cyan), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: transform 0.12s, box-shadow 0.15s, filter 0.15s;
}

.growatt-app__mes-filtro-btn:hover {
  filter: brightness(1.08);
  box-shadow: 0 0 28px rgba(79, 209, 255, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transform: translateY(-1px);
}

.growatt-app__mes-filtro-btn:active {
  transform: translateY(0);
}

@media (max-width: 479px) {
  .growatt-app__mes-filtro-fields {
    flex-direction: column;
    align-items: stretch;
  }

  .growatt-app__mes-filtro-input {
    width: 100%;
  }

  .growatt-app__mes-filtro-btn {
    align-self: flex-start;
  }
}

.growatt-app__date-label-ano {
  display: inline-block;
  min-width: 5rem;
  text-align: center;
  font-size: 0.92rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: #f0f9ff;
  letter-spacing: 0.04em;
}

.growatt-app__mes-bi.growatt-app__chart-card {
  margin-left: 0.15rem;
  margin-right: 0.15rem;
}

.growatt-app__mes-bi {
  margin-bottom: 1rem;
}

.growatt-app__mes-bi-warn {
  display: block;
  margin-top: 0.35rem;
  color: #fda4af;
  font-weight: 600;
}

.growatt-app__mes-resumo-wrap {
  margin-bottom: 1rem;
}

.growatt-app__mes-resumo-heading {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(160, 195, 220, 0.82);
}

.growatt-app__mes-resumo-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.55rem;
}

@media (max-width: 1100px) {
  .growatt-app__mes-resumo-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .growatt-app__mes-resumo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.growatt-app__mes-resumo-card {
  padding: 0.55rem 0.65rem;
  border-radius: 0.55rem;
  border: 1px solid rgba(79, 209, 255, 0.18);
  background: rgba(0, 28, 58, 0.55);
  backdrop-filter: blur(10px);
}

.growatt-app__mes-resumo-label {
  display: block;
  margin: 0 0 0.2rem;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(160, 195, 220, 0.72);
  line-height: 1.25;
}

.growatt-app__mes-resumo-ico {
  margin-right: 0.35em;
  font-size: 1.15em;
  font-style: normal;
  letter-spacing: 0;
  text-transform: none;
}

.growatt-app__mes-resumo-val {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #f0f9ff;
  letter-spacing: 0.02em;
}

.growatt-app__mes-resumo-unit {
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(125, 211, 252, 0.85);
  margin-left: 0.15rem;
}

.growatt-app__mes-resumo-card--pagar {
  border-color: rgba(239, 68, 68, 0.42);
  background: rgba(40, 12, 18, 0.55);
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.12);
}

.growatt-app__mes-resumo-val--euro {
  font-size: 1.15rem;
  color: #fecaca;
  text-shadow: 0 0 14px rgba(239, 68, 68, 0.35);
}

.growatt-app__mes-bi-table-wrap {
  overflow-x: auto;
  margin: 0 -0.15rem;
  padding: 0 0.15rem 0.25rem;
  -webkit-overflow-scrolling: touch;
}

.growatt-mes-col--hidden {
  display: none !important;
}

/* Modal «colunas» (reutiliza .dash__growatt-modal do dashboard.css) */
.dash__growatt-modal--mes-cols {
  width: min(26rem, calc(100vw - 1.25rem));
  max-height: min(88vh, 36rem);
}

.dash__growatt-modal--mes-cols .dash__growatt-modal-panel {
  max-height: min(88vh, 36rem);
}

.growatt-app__mes-bi-table-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.75rem;
  flex-wrap: wrap;
}

.growatt-app__mes-bi-table-card__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: rgba(240, 249, 255, 0.95);
  letter-spacing: 0.02em;
}

.growatt-app__mes-bi-config {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
  padding: 0.35rem 0.7rem;
  border-radius: 0.55rem;
  border: 1px solid rgba(79, 209, 255, 0.38);
  background: rgba(79, 209, 255, 0.12);
  color: rgba(220, 245, 255, 0.98);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.2;
  transition: background 0.12s, border-color 0.12s;
}

.growatt-app__mes-bi-config:hover {
  background: rgba(79, 209, 255, 0.22);
  border-color: rgba(79, 209, 255, 0.55);
}

.growatt-app__mes-bi-config:focus-visible {
  outline: 2px solid rgba(79, 209, 255, 0.65);
  outline-offset: 2px;
}

.growatt-app__mes-bi-config__ico {
  flex-shrink: 0;
  opacity: 0.92;
}

.growatt-app__mes-cols-dialog-hint {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: rgba(71, 85, 105, 0.9);
}

.growatt-app__mes-cols-dialog-body .growatt-app__mes-cols-toolbar {
  margin: 0 0 0.65rem;
}

.growatt-app__mes-cols-dialog-body .growatt-app__mes-cols-reset {
  padding: 0.35rem 0.75rem;
  border-radius: 0.45rem;
  border: 1px solid rgba(14, 165, 233, 0.35);
  background: rgba(224, 242, 254, 0.55);
  color: rgba(12, 74, 110, 0.95);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
}

.growatt-app__mes-cols-dialog-body .growatt-app__mes-cols-reset:hover {
  background: rgba(186, 230, 253, 0.88);
}

.growatt-app__mes-cols-dialog-body .growatt-app__mes-cols-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  padding: 0 0 0.35rem;
}

.growatt-app__mes-cols-dialog-body .growatt-app__mes-cols-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  user-select: none;
  color: rgba(30, 41, 59, 0.92);
  font-size: 0.82rem;
}

.growatt-app__mes-cols-dialog-body .growatt-app__mes-cols-label input {
  accent-color: #0ea5e9;
}

.growatt-app__mes-bi-table {
  width: 100%;
  min-width: 56rem;
  border-collapse: collapse;
  font-size: 0.72rem;
  color: rgba(220, 235, 250, 0.88);
}

.growatt-app__mes-bi-table th,
.growatt-app__mes-bi-table td {
  padding: 0.35rem 0.4rem;
  border-bottom: 1px solid rgba(79, 209, 255, 0.1);
  vertical-align: top;
}

.growatt-app__mes-bi-table thead th {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: rgba(160, 195, 220, 0.75);
  text-align: left;
  background: rgba(0, 25, 50, 0.85);
  position: sticky;
  top: 0;
  z-index: 1;
}

.growatt-app__mes-bi-table thead th.num,
.growatt-app__mes-bi-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.growatt-app__mes-bi-table tbody th[scope="row"] {
  font-weight: 600;
  color: rgba(240, 249, 255, 0.92);
}

.growatt-app__mes-bi-dia-link {
  color: var(--g-cyan);
  font-weight: 700;
  text-decoration: none;
}

.growatt-app__mes-bi-dia-link:hover {
  text-decoration: underline;
  text-shadow: 0 0 12px rgba(79, 209, 255, 0.4);
}

.growatt-app__mes-bi-pago {
  font-weight: 700;
  color: #7dd3fc;
}

.growatt-app__mes-bi-tfoot th,
.growatt-app__mes-bi-tfoot td {
  border-bottom: none;
  border-top: 2px solid rgba(79, 209, 255, 0.2);
  padding-top: 0.5rem;
  background: rgba(0, 20, 45, 0.6);
  font-weight: 700;
}

.growatt-app__mes-bi-tfoot__euro {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.growatt-app__mes-bi-tfoot__euro--cost {
  font-size: 1.15em;
  color: #f87171;
  text-shadow: 0 0 14px rgba(239, 68, 68, 0.5);
}

.growatt-app__mes-bi-tfoot__euro--fv {
  font-size: 1em;
  color: #6ee7b7;
  text-shadow: 0 0 12px rgba(52, 211, 153, 0.35);
}

.growatt-app__mes-bi-tfoot__euro--grand {
  font-size: 1.65em;
  color: #ef4444;
  text-shadow: 0 0 22px rgba(239, 68, 68, 0.6);
}

.growatt-app__mes-bi-footnote {
  margin: 0.5rem 0 0;
  font-size: 0.65rem !important;
  color: rgba(160, 195, 220, 0.5) !important;
}

.growatt-app__mes-bi-total-pagar {
  margin: 1rem 0 0;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(239, 68, 68, 0.45);
  border-radius: 0.65rem;
  background: rgba(40, 10, 15, 0.5);
  backdrop-filter: blur(10px);
  max-width: 28rem;
  box-shadow: 0 0 24px rgba(239, 68, 68, 0.15);
}

.growatt-app__mes-bi-total-pagar__line {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  color: rgba(200, 220, 240, 0.8);
}

.growatt-app__mes-bi-total-pagar__grand {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin: 0.6rem 0 0;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(239, 68, 68, 0.35);
}

.growatt-app__mes-bi-total-pagar__label {
  flex: 1;
  min-width: 0;
}

.growatt-app__mes-bi-total-pagar__val {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.growatt-app__mes-bi-total-pagar__amount {
  font-size: 1.35rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #ef4444;
  white-space: nowrap;
  text-shadow: 0 0 22px rgba(239, 68, 68, 0.6);
}

/* ── Vista Ano ─────────────────────────────────────────── */
.growatt-app__ano-table-wrap {
  overflow-x: auto;
  margin: 0 -0.15rem;
  padding: 0 0.15rem 0.25rem;
  -webkit-overflow-scrolling: touch;
}

.growatt-app__ano-table {
  width: 100%;
  min-width: 46rem;
  border-collapse: collapse;
  font-size: 0.72rem;
  color: rgba(220, 235, 250, 0.88);
}

.growatt-app__ano-table th,
.growatt-app__ano-table td {
  padding: 0.38rem 0.45rem;
  border-bottom: 1px solid rgba(79, 209, 255, 0.1);
  vertical-align: middle;
}

.growatt-app__ano-table thead th {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: rgba(160, 195, 220, 0.75);
  background: rgba(0, 25, 50, 0.85);
  border-bottom: 2px solid rgba(79, 209, 255, 0.2);
  white-space: nowrap;
}

.growatt-app__ano-table thead th.num,
.growatt-app__ano-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.growatt-app__ano-table tbody th[scope="row"] {
  font-weight: 600;
  color: rgba(240, 249, 255, 0.92);
}

.growatt-app__ano-mes-link {
  color: var(--g-cyan);
  text-decoration: none;
  font-weight: 600;
}

.growatt-app__ano-mes-link:hover {
  text-decoration: underline;
  text-shadow: 0 0 12px rgba(79, 209, 255, 0.4);
}

.growatt-app__ano-col-pago {
  font-weight: 700;
  color: #7dd3fc;
}

.growatt-app__ano-tfoot th,
.growatt-app__ano-tfoot td {
  border-bottom: none;
  border-top: 2px solid rgba(79, 209, 255, 0.2);
  padding-top: 0.5rem;
  background: rgba(0, 20, 45, 0.6);
  font-weight: 700;
}

.growatt-app__bottom {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 28rem;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  padding: 0.4rem 0 calc(0.4rem + env(safe-area-inset-bottom, 0));
  margin: 0;
  background: rgba(6, 12, 24, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(79, 209, 255, 0.15);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.45);
  z-index: 20;
}

.growatt-app__bottom-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.25rem 0.2rem;
  font-size: 0.58rem;
  font-weight: 600;
  color: rgba(160, 195, 220, 0.55);
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
}

.growatt-app__bottom-item--on {
  color: var(--g-cyan);
  text-shadow: 0 0 12px rgba(79, 209, 255, 0.45);
}

.growatt-app__bottom-item--disabled {
  opacity: 0.38;
  cursor: default;
  pointer-events: none;
}

.growatt-app__bottom-ico {
  font-size: 1.15rem;
  line-height: 1;
}

/* ── Nav links (Growatt / Smart Life) ── */
.growatt-app__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.45rem;
}

.growatt-app__nav-link {
  padding: 0.35rem 0.75rem;
  border-radius: 0.4rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(200, 230, 255, 0.55);
  text-decoration: none;
  background: var(--g-glass);
  border: 1px solid var(--g-glass-border);
  backdrop-filter: blur(12px);
  transition: color 0.15s, border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

button.growatt-app__nav-link {
  font: inherit;
  cursor: pointer;
  appearance: none;
}

.growatt-app__nav-link:hover {
  background: rgba(79, 209, 255, 0.1);
  color: rgba(232, 244, 255, 0.95);
  border-color: rgba(79, 209, 255, 0.35);
}

.growatt-app__nav-link--on {
  color: #061018;
  background: linear-gradient(135deg, var(--g-cyan) 0%, #38bdf8 100%);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: var(--g-glow-cyan);
}

/* Cores dos gráficos Chart.js (lidas em JS via getComputedStyle) */
html {
  --gt-chart-color: #a8c4e8;
  --gt-chart-legend: rgba(200, 225, 245, 0.85);
  --gt-chart-tick: rgba(160, 195, 220, 0.65);
  --gt-chart-grid: rgba(79, 209, 255, 0.08);
  --gt-chart-grid-x: rgba(79, 209, 255, 0.08);
  --gt-chart-border: rgba(79, 209, 255, 0.15);
  --gt-chart-title: rgba(200, 225, 245, 0.75);
}

/* ── Footer ── */
.growatt-app__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 0 1rem;
  margin-top: 1.5rem;
  border-top: 1px solid var(--g-glass-border);
}

.growatt-app__footer-ip {
  font-size: 0.7rem;
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  color: rgba(60, 80, 100, 0.5);
  letter-spacing: 0.03em;
}

/* ── Tema: selector de aparência (painel Growatt) ── */
.growatt-app__theme {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.12rem;
  padding: 0.22rem;
  border-radius: 0.45rem;
  background: var(--g-glass);
  border: 1px solid var(--g-glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.growatt-app__theme-label {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(160, 195, 220, 0.55);
  padding: 0 0.3rem 0 0.2rem;
}

.growatt-app__theme-btn {
  padding: 0.3rem 0.48rem;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: none;
  border-radius: 0.3rem;
  cursor: pointer;
  background: transparent;
  color: rgba(180, 210, 235, 0.7);
  transition: background 0.15s, color 0.15s;
}

.growatt-app__theme-btn:hover {
  color: rgba(232, 244, 255, 0.95);
  background: rgba(79, 209, 255, 0.12);
}

.growatt-app__theme-btn--on {
  color: #061018;
  background: linear-gradient(135deg, var(--g-cyan) 0%, #38bdf8 100%);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: var(--g-glow-cyan);
}

.growatt-app__theme-btn--on:hover {
  color: #061018;
  filter: brightness(1.05);
}

/* ── Growatt tema claro (+ sistema quando OS prefere claro) ── */
html[data-growatt-theme="light"] {
  --gt-chart-color: #475569;
  --gt-chart-legend: rgba(30, 41, 59, 0.92);
  --gt-chart-tick: rgba(71, 85, 105, 0.88);
  --gt-chart-grid: rgba(148, 163, 184, 0.22);
  --gt-chart-grid-x: rgba(148, 163, 184, 0.18);
  --gt-chart-border: rgba(100, 116, 139, 0.45);
  --gt-chart-title: rgba(51, 65, 85, 0.9);
}

@media (prefers-color-scheme: light) {
  html[data-growatt-theme="system"] {
    --gt-chart-color: #475569;
    --gt-chart-legend: rgba(30, 41, 59, 0.92);
    --gt-chart-tick: rgba(71, 85, 105, 0.88);
    --gt-chart-grid: rgba(148, 163, 184, 0.22);
    --gt-chart-grid-x: rgba(148, 163, 184, 0.18);
    --gt-chart-border: rgba(100, 116, 139, 0.45);
    --gt-chart-title: rgba(51, 65, 85, 0.9);
  }
}

html[data-growatt-theme="light"] body:has(.growatt-app) {
  color-scheme: light;
  background: radial-gradient(120% 80% at 50% -10%, #e0f2fe 0%, transparent 55%),
    radial-gradient(90% 60% at 100% 40%, rgba(14, 165, 233, 0.16) 0%, transparent 50%),
    linear-gradient(165deg, #f8fafc 0%, #f1f5f9 45%, #e2e8f0 100%);
  color: #0f172a;
}

html[data-growatt-theme="light"] .growatt-app {
  --g-glass: rgba(255, 255, 255, 0.82);
  --g-glass-border: rgba(15, 23, 42, 0.12);
  --g-glow-cyan: 0 4px 24px rgba(14, 165, 233, 0.2);
  --g-glow-warm: 0 4px 20px rgba(245, 158, 11, 0.16);
  color: rgba(15, 23, 42, 0.92);
}

html[data-growatt-theme="light"] .growatt-app__ambient {
  background: radial-gradient(ellipse 80% 50% at 50% 35%, rgba(56, 189, 248, 0.16) 0%, transparent 55%),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 40px,
      rgba(14, 165, 233, 0.04) 40px,
      rgba(14, 165, 233, 0.04) 41px
    );
  opacity: 1;
}

html[data-growatt-theme="light"] .growatt-app__topbar {
  border-bottom-color: rgba(14, 165, 233, 0.2);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

html[data-growatt-theme="light"] .growatt-app__brand-kicker {
  color: rgba(2, 132, 199, 0.85);
}

html[data-growatt-theme="light"] .growatt-app__title {
  color: #0c4a6e;
  text-shadow: none;
}

html[data-growatt-theme="light"] .growatt-app__last-updated {
  color: rgba(71, 85, 105, 0.75);
}

html[data-growatt-theme="light"] .growatt-app__last-updated time {
  color: rgba(15, 23, 42, 0.88);
}

html[data-growatt-theme="light"] .growatt-app__theme-label {
  color: rgba(71, 85, 105, 0.65);
}

html[data-growatt-theme="light"] .growatt-app__theme-btn {
  color: rgba(71, 85, 105, 0.85);
}

html[data-growatt-theme="light"] .growatt-app__theme-btn:hover {
  color: #0f172a;
  background: rgba(14, 165, 233, 0.12);
}

html[data-growatt-theme="light"] .growatt-app__pill {
  color: rgba(51, 65, 85, 0.72);
}

html[data-growatt-theme="light"] .growatt-app__pill:hover {
  color: #0f172a;
}

html[data-growatt-theme="light"] .growatt-app__chev--off {
  color: rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.04);
  border-color: rgba(15, 23, 42, 0.08);
}

html[data-growatt-theme="light"] .growatt-app__date-input,
html[data-growatt-theme="light"] .growatt-app__date-label-ano {
  color: #0f172a;
  border-color: rgba(14, 165, 233, 0.35);
  background: rgba(255, 255, 255, 0.75);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 0 rgba(255, 255, 255, 0.9);
}

html[data-growatt-theme="light"] .growatt-app__now-card {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(148, 163, 184, 0.3);
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.1), 0 1px 0 rgba(255, 255, 255, 0.95);
}

html[data-growatt-theme="light"] .growatt-app__now-card--solar {
  background: linear-gradient(135deg, rgba(255, 251, 235, 0.95), rgba(254, 243, 199, 0.8));
  border-color: rgba(245, 158, 11, 0.35);
  box-shadow: 0 4px 18px rgba(245, 158, 11, 0.12), 0 1px 0 rgba(255, 255, 255, 0.9);
}

html[data-growatt-theme="light"] .growatt-app__now-card--solar .growatt-app__now-card-icon {
  color: rgba(245, 158, 11, 0.5);
}

html[data-growatt-theme="light"] .growatt-app__now-card--potencia.growatt-app__now-card--balanco {
  background: linear-gradient(135deg, rgba(236, 253, 245, 0.95), rgba(209, 250, 229, 0.8));
  border-color: rgba(16, 185, 129, 0.35);
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.12), 0 1px 0 rgba(255, 255, 255, 0.9);
}

html[data-growatt-theme="light"] .growatt-app__now-card--potencia.growatt-app__now-card--balanco-neg {
  background: linear-gradient(135deg, rgba(254, 242, 242, 0.95), rgba(254, 226, 226, 0.8));
  border-color: rgba(239, 68, 68, 0.35);
  box-shadow: 0 4px 18px rgba(239, 68, 68, 0.12), 0 1px 0 rgba(255, 255, 255, 0.9);
}

html[data-growatt-theme="light"] .growatt-app__now-card--poupanca {
  background: linear-gradient(135deg, rgba(236, 253, 245, 0.95), rgba(209, 250, 229, 0.8));
  border-color: rgba(16, 185, 129, 0.35);
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.12), 0 1px 0 rgba(255, 255, 255, 0.9);
}

html[data-growatt-theme="light"] .growatt-app__now-card--custo {
  background: linear-gradient(135deg, rgba(248, 250, 252, 0.95), rgba(241, 245, 249, 0.85));
  border-color: rgba(148, 163, 184, 0.35);
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08), 0 1px 0 rgba(255, 255, 255, 0.9);
}

html[data-growatt-theme="light"] .growatt-app__now-trio-label,
html[data-growatt-theme="light"] .growatt-app__now-label {
  color: rgba(71, 85, 105, 0.78);
}

html[data-growatt-theme="light"] .growatt-app__now-trio-val,
html[data-growatt-theme="light"] .growatt-app__now-val {
  color: #0f172a;
}

html[data-growatt-theme="light"] .growatt-app__now-trio-val small,
html[data-growatt-theme="light"] .growatt-app__now-val small {
  color: rgba(71, 85, 105, 0.65);
}

html[data-growatt-theme="light"] .growatt-app__now-val--positivo {
  color: #059669;
  text-shadow: none;
}

html[data-growatt-theme="light"] .growatt-app__now-val--negativo {
  color: #dc2626;
  text-shadow: none;
}

html[data-growatt-theme="light"] .growatt-app__now-tendencia--estavel {
  background: rgba(148, 163, 184, 0.18);
  color: rgba(51, 65, 85, 0.85);
  border-color: rgba(148, 163, 184, 0.35);
}

html[data-growatt-theme="light"] .growatt-app__now-meta {
  border-top-color: rgba(15, 23, 42, 0.08);
  color: rgba(71, 85, 105, 0.65);
}

html[data-growatt-theme="light"] .growatt-app__chart-card {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(14, 165, 233, 0.22);
  box-shadow: 0 4px 28px rgba(15, 23, 42, 0.08), 0 1px 0 rgba(255, 255, 255, 0.9);
}

html[data-growatt-theme="light"] .growatt-app__tabs-chart {
  border-color: rgba(15, 23, 42, 0.1);
  background: #fff;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

html[data-growatt-theme="light"] .growatt-app__tab-chart {
  color: #64748b;
  border-right-color: rgba(15, 23, 42, 0.08);
}

html[data-growatt-theme="light"] .growatt-app__tab-chart:hover {
  color: #0f172a;
  background: rgba(241, 245, 249, 0.9);
}

html[data-growatt-theme="light"] .growatt-app__tab-chart--on {
  background: #0b1220;
  color: #fff;
  font-weight: 700;
  border-right-color: rgba(255, 255, 255, 0.12);
}

html[data-growatt-theme="light"] .growatt-app__tab-chart--on:hover {
  background: #111827;
  color: #fff;
}

html[data-growatt-theme="light"] .growatt-app__mes-dias-chart__title {
  color: rgba(15, 23, 42, 0.92);
}

html[data-growatt-theme="light"] .growatt-app__chart-empty,
html[data-growatt-theme="light"] .growatt-app__chart-zoom-hint {
  color: rgba(71, 85, 105, 0.65);
}

html[data-growatt-theme="light"] .growatt-app__energy {
  background: rgba(255, 255, 255, 0.55);
  border-color: rgba(14, 165, 233, 0.18);
}

html[data-growatt-theme="light"] .growatt-app__energy-head {
  color: rgba(15, 23, 42, 0.92);
  text-shadow: none;
}

html[data-growatt-theme="light"] .growatt-app__stackbar-track {
  background: rgba(15, 23, 42, 0.08);
  box-shadow: inset 0 0 8px rgba(15, 23, 42, 0.06), 0 0 0 1px rgba(14, 165, 233, 0.15);
}

html[data-growatt-theme="light"] .growatt-app__stackbar-labels {
  color: rgba(71, 85, 105, 0.78);
}

html[data-growatt-theme="light"] .growatt-app__stackbar-labels strong {
  color: rgba(15, 23, 42, 0.9);
}

html[data-growatt-theme="light"] .growatt-app__stackbar-seg--muted {
  background: rgba(148, 163, 184, 0.35);
}

html[data-growatt-theme="light"] .growatt-app__hint {
  color: rgba(71, 85, 105, 0.7);
}

html[data-growatt-theme="light"] .growatt-app__empty {
  color: rgba(51, 65, 85, 0.85);
}

html[data-growatt-theme="light"] .growatt-app__fv-acum__intro strong {
  color: rgba(15, 23, 42, 0.92);
}

html[data-growatt-theme="light"] .growatt-app__fv-acum__destaque-hint {
  color: rgba(71, 85, 105, 0.65);
}

html[data-growatt-theme="light"] .growatt-app__custo-topo-detalhe,
html[data-growatt-theme="light"] .growatt-app__bi-resumo-dia-parts,
html[data-growatt-theme="light"] .growatt-app__bi-resumo-dia-label {
  color: rgba(71, 85, 105, 0.72);
}

html[data-growatt-theme="light"] .growatt-app__mes-filtro-label {
  color: rgba(71, 85, 105, 0.75);
}

html[data-growatt-theme="light"] .growatt-app__mes-filtro-input {
  color: #0f172a;
  border-color: rgba(14, 165, 233, 0.3);
  background: rgba(255, 255, 255, 0.9);
}

html[data-growatt-theme="light"] .growatt-app input[type="date"]::-webkit-calendar-picker-indicator {
  filter: none;
  opacity: 0.55;
}

html[data-growatt-theme="light"] .growatt-app__mes-bi-table-card__title {
  color: rgba(51, 65, 85, 0.95);
}

html[data-growatt-theme="light"] .growatt-app__mes-bi-config {
  border-color: rgba(14, 165, 233, 0.38);
  background: rgba(255, 255, 255, 0.9);
  color: rgba(12, 74, 110, 0.96);
}

html[data-growatt-theme="light"] .growatt-app__mes-bi-config:hover {
  background: rgba(224, 242, 254, 0.92);
}

html[data-growatt-theme="light"] .growatt-app__mes-bi-table,
html[data-growatt-theme="light"] .growatt-app__ano-table {
  color: rgba(15, 23, 42, 0.88);
}

html[data-growatt-theme="light"] .growatt-app__mes-bi-table th,
html[data-growatt-theme="light"] .growatt-app__mes-bi-table td,
html[data-growatt-theme="light"] .growatt-app__ano-table th,
html[data-growatt-theme="light"] .growatt-app__ano-table td {
  border-bottom-color: rgba(14, 165, 233, 0.12);
}

html[data-growatt-theme="light"] .growatt-app__mes-bi-table thead th,
html[data-growatt-theme="light"] .growatt-app__ano-table thead th {
  color: rgba(51, 65, 85, 0.85);
  background: rgba(241, 245, 249, 0.95);
  border-bottom-color: rgba(14, 165, 233, 0.2);
}

html[data-growatt-theme="light"] .growatt-app__mes-bi-table tbody th[scope="row"],
html[data-growatt-theme="light"] .growatt-app__ano-table tbody th[scope="row"] {
  color: rgba(15, 23, 42, 0.92);
}

html[data-growatt-theme="light"] .growatt-app__mes-bi-tfoot th,
html[data-growatt-theme="light"] .growatt-app__mes-bi-tfoot td,
html[data-growatt-theme="light"] .growatt-app__ano-tfoot th,
html[data-growatt-theme="light"] .growatt-app__ano-tfoot td {
  background: rgba(248, 250, 252, 0.95);
  border-top-color: rgba(14, 165, 233, 0.22);
}

html[data-growatt-theme="light"] .growatt-app__mes-resumo-heading {
  color: rgba(71, 85, 105, 0.85);
}

html[data-growatt-theme="light"] .growatt-app__mes-resumo-card {
  background: rgba(248, 250, 252, 0.92);
  border-color: rgba(14, 165, 233, 0.18);
}

html[data-growatt-theme="light"] .growatt-app__mes-resumo-label {
  color: rgba(100, 116, 139, 0.82);
}

html[data-growatt-theme="light"] .growatt-app__mes-resumo-val {
  color: #0f172a;
}

html[data-growatt-theme="light"] .growatt-app__mes-resumo-unit {
  color: rgba(14, 116, 144, 0.88);
}

html[data-growatt-theme="light"] .growatt-app__mes-resumo-card--pagar {
  background: rgba(254, 242, 242, 0.95);
  border-color: rgba(220, 38, 38, 0.22);
  box-shadow: 0 0 14px rgba(220, 38, 38, 0.06);
}

html[data-growatt-theme="light"] .growatt-app__mes-resumo-val--euro {
  color: #dc2626;
  text-shadow: none;
}

html[data-growatt-theme="light"] .growatt-app__mes-bi-footnote {
  color: rgba(100, 116, 139, 0.75) !important;
}

html[data-growatt-theme="light"] .growatt-app__mes-bi-total-pagar {
  background: rgba(254, 242, 242, 0.85);
  border-color: rgba(220, 38, 38, 0.2);
  box-shadow: 0 0 18px rgba(220, 38, 38, 0.06);
}

html[data-growatt-theme="light"] .growatt-app__mes-bi-total-pagar__line {
  color: rgba(51, 65, 85, 0.85);
}

html[data-growatt-theme="light"] .growatt-app__mes-bi-total-pagar__grand {
  border-top-color: rgba(220, 38, 38, 0.18);
}

html[data-growatt-theme="light"] .growatt-app__mes-bi-total-pagar__amount {
  color: #dc2626;
  text-shadow: none;
}

html[data-growatt-theme="light"] .growatt-app__bottom {
  background: rgba(255, 255, 255, 0.92);
  border-top-color: rgba(14, 165, 233, 0.2);
  box-shadow: 0 -6px 28px rgba(15, 23, 42, 0.08);
}

html[data-growatt-theme="light"] .growatt-app__bottom-item {
  color: rgba(71, 85, 105, 0.65);
}

html[data-growatt-theme="light"] .growatt-app__nav-link {
  color: rgba(51, 65, 85, 0.72);
}

html[data-growatt-theme="light"] .growatt-app__nav-link:hover {
  color: #0f172a;
}

html[data-growatt-theme="light"] .growatt-app__flash-notice {
  color: #047857;
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(5, 150, 105, 0.35);
}

html[data-growatt-theme="light"] .growatt-app__flash-alert {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(220, 38, 38, 0.35);
}

/* ── Growatt: Tesla UI claro (overrides) ───────────────────────────────── */
html[data-growatt-theme="light"] .growatt-app {
  --g-cyan: #111827;
  --g-cyan-dim: rgba(17, 24, 39, 0.08);
  --g-orange: #f59e0b;
  --g-glass: rgba(255, 255, 255, 0.92);
  --g-glass-border: rgba(15, 23, 42, 0.10);
  --g-glow-cyan: 0 10px 28px rgba(15, 23, 42, 0.08);
  --g-glow-warm: 0 10px 26px rgba(245, 158, 11, 0.10);
  color: rgba(15, 23, 42, 0.92);
  max-width: 1320px;
  padding: 0 1rem 4.5rem;
}

html[data-growatt-theme="light"] .growatt-app__ambient {
  opacity: 0.35;
  background:
    radial-gradient(ellipse 70% 45% at 50% 10%, rgba(15, 23, 42, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 12% 65%, rgba(14, 165, 233, 0.08) 0%, transparent 55%),
    radial-gradient(ellipse 55% 35% at 90% 65%, rgba(245, 158, 11, 0.07) 0%, transparent 55%);
}

html[data-growatt-theme="light"] .growatt-app__topbar {
  border-bottom-color: rgba(15, 23, 42, 0.10);
  box-shadow: none;
  padding: 0.95rem 0.25rem 0.85rem;
}

html[data-growatt-theme="light"] .growatt-app__brand-kicker {
  color: rgba(15, 23, 42, 0.55);
  letter-spacing: 0.22em;
}

html[data-growatt-theme="light"] .growatt-app__title {
  color: #0b1220;
  font-weight: 750;
  letter-spacing: -0.03em;
}

html[data-growatt-theme="light"] .growatt-app__btn-purge {
  background: #0b1220;
  color: #fff;
  border-color: rgba(15, 23, 42, 0.16);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  text-transform: none;
  letter-spacing: 0.02em;
}

html[data-growatt-theme="light"] .growatt-app__btn-refresh {
  background: #111827;
}

html[data-growatt-theme="light"] .growatt-app__mes-filtro-btn {
  background: #0b1220;
  color: #fff;
  border-color: rgba(15, 23, 42, 0.16);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  text-transform: none;
  letter-spacing: 0.02em;
}

/* Tabs escala: segmented control (minimal Tesla-ish) */
html[data-growatt-theme="light"] .growatt-app__tabs-scale {
  justify-content: center;
  gap: 0;
  padding: 0.4rem 0.25rem 0.85rem;
}

html[data-growatt-theme="light"] .growatt-app__pill {
  clip-path: none;
  border-radius: 999px;
  border-color: rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.75);
  color: rgba(15, 23, 42, 0.62);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.95);
  letter-spacing: 0.12em;
}

html[data-growatt-theme="light"] .growatt-app__pill + .growatt-app__pill {
  margin-left: 0.4rem;
}

html[data-growatt-theme="light"] .growatt-app__pill--on {
  background: #0b1220;
  color: #fff;
  border-color: rgba(15, 23, 42, 0.22);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.16);
}

/* Cards: branco, radius maior, sombra suave */
html[data-growatt-theme="light"] .growatt-app__now-card,
html[data-growatt-theme="light"] .growatt-app__chart-card,
html[data-growatt-theme="light"] .growatt-app__energy,
html[data-growatt-theme="light"] .growatt-fluxo-dia,
html[data-growatt-theme="light"] .growatt-tempo-real {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(15, 23, 42, 0.10);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-radius: 1.1rem;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

html[data-growatt-theme="light"] .growatt-app__now-label,
html[data-growatt-theme="light"] .growatt-app__now-trio-label,
html[data-growatt-theme="light"] .growatt-app__energy-head {
  color: rgba(15, 23, 42, 0.62);
  text-shadow: none;
}

html[data-growatt-theme="light"] .growatt-app__now-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

html[data-growatt-theme="light"] .growatt-app__now-val {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0b1220;
}

/* “Speed-like” destaque no card potência */
html[data-growatt-theme="light"] .growatt-app__now-card--potencia .growatt-app__now-label {
  letter-spacing: 0.18em;
}

html[data-growatt-theme="light"] .growatt-app__now-trio-val {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0b1220;
}

html[data-growatt-theme="light"] .growatt-app__now-val--positivo { color: #0f766e; }
html[data-growatt-theme="light"] .growatt-app__now-val--negativo { color: #b91c1c; }

html[data-growatt-theme="light"] .growatt-app__placeholder {
  color: rgba(51, 65, 85, 0.8);
}

html[data-growatt-theme="light"] .growatt-app__now-refresh {
  color: rgba(15, 23, 42, 0.88);
  border-color: rgba(14, 165, 233, 0.35);
  background: rgba(14, 165, 233, 0.08);
}

@media (prefers-color-scheme: light) {
  html[data-growatt-theme="system"] body:has(.growatt-app) {
    color-scheme: light;
    background: radial-gradient(120% 80% at 50% -10%, #e0f2fe 0%, transparent 55%),
      radial-gradient(90% 60% at 100% 40%, rgba(14, 165, 233, 0.16) 0%, transparent 50%),
      linear-gradient(165deg, #f8fafc 0%, #f1f5f9 45%, #e2e8f0 100%);
    color: #0f172a;
  }

  html[data-growatt-theme="system"] .growatt-app {
    --g-glass: rgba(255, 255, 255, 0.82);
    --g-glass-border: rgba(15, 23, 42, 0.12);
    --g-glow-cyan: 0 4px 24px rgba(14, 165, 233, 0.2);
    --g-glow-warm: 0 4px 20px rgba(245, 158, 11, 0.16);
    color: rgba(15, 23, 42, 0.92);
  }

  html[data-growatt-theme="system"] .growatt-app__ambient {
    background: radial-gradient(ellipse 80% 50% at 50% 35%, rgba(56, 189, 248, 0.16) 0%, transparent 55%),
      repeating-linear-gradient(
        -12deg,
        transparent,
        transparent 40px,
        rgba(14, 165, 233, 0.04) 40px,
        rgba(14, 165, 233, 0.04) 41px
      );
    opacity: 1;
  }

  html[data-growatt-theme="system"] .growatt-app__topbar {
    border-bottom-color: rgba(14, 165, 233, 0.2);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
  }

  html[data-growatt-theme="system"] .growatt-app__brand-kicker {
    color: rgba(2, 132, 199, 0.85);
  }

  html[data-growatt-theme="system"] .growatt-app__title {
    color: #0c4a6e;
    text-shadow: none;
  }

  html[data-growatt-theme="system"] .growatt-app__last-updated {
    color: rgba(71, 85, 105, 0.75);
  }

  html[data-growatt-theme="system"] .growatt-app__last-updated time {
    color: rgba(15, 23, 42, 0.88);
  }

  html[data-growatt-theme="system"] .growatt-app__theme-label {
    color: rgba(71, 85, 105, 0.65);
  }

  html[data-growatt-theme="system"] .growatt-app__theme-btn {
    color: rgba(71, 85, 105, 0.85);
  }

  html[data-growatt-theme="system"] .growatt-app__theme-btn:hover {
    color: #0f172a;
    background: rgba(14, 165, 233, 0.12);
  }

  html[data-growatt-theme="system"] .growatt-app__pill {
    color: rgba(51, 65, 85, 0.72);
  }

  html[data-growatt-theme="system"] .growatt-app__pill:hover {
    color: #0f172a;
  }

  html[data-growatt-theme="system"] .growatt-app__chev--off {
    color: rgba(148, 163, 184, 0.45);
    background: rgba(15, 23, 42, 0.04);
    border-color: rgba(15, 23, 42, 0.08);
  }

  html[data-growatt-theme="system"] .growatt-app__date-input,
  html[data-growatt-theme="system"] .growatt-app__date-label-ano {
    color: #0f172a;
    border-color: rgba(14, 165, 233, 0.35);
    background: rgba(255, 255, 255, 0.75);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 0 rgba(255, 255, 255, 0.9);
  }

  html[data-growatt-theme="system"] .growatt-app__now-card {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(148, 163, 184, 0.3);
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.1), 0 1px 0 rgba(255, 255, 255, 0.95);
  }

  html[data-growatt-theme="system"] .growatt-app__now-card--solar {
    background: linear-gradient(135deg, rgba(255, 251, 235, 0.95), rgba(254, 243, 199, 0.8));
    border-color: rgba(245, 158, 11, 0.35);
    box-shadow: 0 4px 18px rgba(245, 158, 11, 0.12), 0 1px 0 rgba(255, 255, 255, 0.9);
  }

  html[data-growatt-theme="system"] .growatt-app__now-card--solar .growatt-app__now-card-icon {
    color: rgba(245, 158, 11, 0.5);
  }

  html[data-growatt-theme="system"] .growatt-app__now-card--potencia.growatt-app__now-card--balanco {
    background: linear-gradient(135deg, rgba(236, 253, 245, 0.95), rgba(209, 250, 229, 0.8));
    border-color: rgba(16, 185, 129, 0.35);
    box-shadow: 0 4px 18px rgba(16, 185, 129, 0.12), 0 1px 0 rgba(255, 255, 255, 0.9);
  }

  html[data-growatt-theme="system"] .growatt-app__now-card--potencia.growatt-app__now-card--balanco-neg {
    background: linear-gradient(135deg, rgba(254, 242, 242, 0.95), rgba(254, 226, 226, 0.8));
    border-color: rgba(239, 68, 68, 0.35);
    box-shadow: 0 4px 18px rgba(239, 68, 68, 0.12), 0 1px 0 rgba(255, 255, 255, 0.9);
  }

  html[data-growatt-theme="system"] .growatt-app__now-card--poupanca {
    background: linear-gradient(135deg, rgba(236, 253, 245, 0.95), rgba(209, 250, 229, 0.8));
    border-color: rgba(16, 185, 129, 0.35);
    box-shadow: 0 4px 18px rgba(16, 185, 129, 0.12), 0 1px 0 rgba(255, 255, 255, 0.9);
  }

  html[data-growatt-theme="system"] .growatt-app__now-card--custo {
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.95), rgba(241, 245, 249, 0.85));
    border-color: rgba(148, 163, 184, 0.35);
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08), 0 1px 0 rgba(255, 255, 255, 0.9);
  }

  html[data-growatt-theme="system"] .growatt-app__now-trio-label,
  html[data-growatt-theme="system"] .growatt-app__now-label {
    color: rgba(71, 85, 105, 0.78);
  }

  html[data-growatt-theme="system"] .growatt-app__now-trio-val,
  html[data-growatt-theme="system"] .growatt-app__now-val {
    color: #0f172a;
  }

  html[data-growatt-theme="system"] .growatt-app__now-trio-val small,
  html[data-growatt-theme="system"] .growatt-app__now-val small {
    color: rgba(71, 85, 105, 0.65);
  }

  html[data-growatt-theme="system"] .growatt-app__now-val--positivo {
    color: #059669;
    text-shadow: none;
  }

  html[data-growatt-theme="system"] .growatt-app__now-val--negativo {
    color: #dc2626;
    text-shadow: none;
  }

  html[data-growatt-theme="system"] .growatt-app__now-tendencia--estavel {
    background: rgba(148, 163, 184, 0.18);
    color: rgba(51, 65, 85, 0.85);
    border-color: rgba(148, 163, 184, 0.35);
  }

  html[data-growatt-theme="system"] .growatt-app__now-meta {
    border-top-color: rgba(15, 23, 42, 0.08);
    color: rgba(71, 85, 105, 0.65);
  }

  html[data-growatt-theme="system"] .growatt-app__chart-card {
    background: rgba(255, 255, 255, 0.72);
    border-color: rgba(14, 165, 233, 0.22);
    box-shadow: 0 4px 28px rgba(15, 23, 42, 0.08), 0 1px 0 rgba(255, 255, 255, 0.9);
  }

  html[data-growatt-theme="system"] .growatt-app__tabs-chart {
    border-color: rgba(15, 23, 42, 0.1);
    background: #fff;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
  }

  html[data-growatt-theme="system"] .growatt-app__tab-chart {
    color: #64748b;
    border-right-color: rgba(15, 23, 42, 0.08);
  }

  html[data-growatt-theme="system"] .growatt-app__tab-chart:hover {
    color: #0f172a;
    background: rgba(241, 245, 249, 0.9);
  }

  html[data-growatt-theme="system"] .growatt-app__tab-chart--on {
    background: #0b1220;
    color: #fff;
    font-weight: 700;
    border-right-color: rgba(255, 255, 255, 0.12);
  }

  html[data-growatt-theme="system"] .growatt-app__tab-chart--on:hover {
    background: #111827;
    color: #fff;
  }

  html[data-growatt-theme="system"] .growatt-app__mes-dias-chart__title {
    color: rgba(15, 23, 42, 0.92);
  }

  html[data-growatt-theme="system"] .growatt-app__chart-empty,
  html[data-growatt-theme="system"] .growatt-app__chart-zoom-hint {
    color: rgba(71, 85, 105, 0.65);
  }

  html[data-growatt-theme="system"] .growatt-app__energy {
    background: rgba(255, 255, 255, 0.55);
    border-color: rgba(14, 165, 233, 0.18);
  }

  html[data-growatt-theme="system"] .growatt-app__energy-head {
    color: rgba(15, 23, 42, 0.92);
    text-shadow: none;
  }

  html[data-growatt-theme="system"] .growatt-app__stackbar-track {
    background: rgba(15, 23, 42, 0.08);
    box-shadow: inset 0 0 8px rgba(15, 23, 42, 0.06), 0 0 0 1px rgba(14, 165, 233, 0.15);
  }

  html[data-growatt-theme="system"] .growatt-app__stackbar-labels {
    color: rgba(71, 85, 105, 0.78);
  }

  html[data-growatt-theme="system"] .growatt-app__stackbar-labels strong {
    color: rgba(15, 23, 42, 0.9);
  }

  html[data-growatt-theme="system"] .growatt-app__stackbar-seg--muted {
    background: rgba(148, 163, 184, 0.35);
  }

  html[data-growatt-theme="system"] .growatt-app__hint {
    color: rgba(71, 85, 105, 0.7);
  }

  html[data-growatt-theme="system"] .growatt-app__empty {
    color: rgba(51, 65, 85, 0.85);
  }

  html[data-growatt-theme="system"] .growatt-app__fv-acum__intro strong {
    color: rgba(15, 23, 42, 0.92);
  }

  html[data-growatt-theme="system"] .growatt-app__fv-acum__destaque-hint {
    color: rgba(71, 85, 105, 0.65);
  }

  html[data-growatt-theme="system"] .growatt-app__custo-topo-detalhe,
  html[data-growatt-theme="system"] .growatt-app__bi-resumo-dia-parts,
  html[data-growatt-theme="system"] .growatt-app__bi-resumo-dia-label {
    color: rgba(71, 85, 105, 0.72);
  }

  html[data-growatt-theme="system"] .growatt-app__mes-filtro-label {
    color: rgba(71, 85, 105, 0.75);
  }

  html[data-growatt-theme="system"] .growatt-app__mes-filtro-input {
    color: #0f172a;
    border-color: rgba(14, 165, 233, 0.3);
    background: rgba(255, 255, 255, 0.9);
  }

  html[data-growatt-theme="system"] .growatt-app__mes-filtro-btn {
    background: #0b1220;
    color: #fff;
    border-color: rgba(15, 23, 42, 0.16);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.18);
    text-transform: none;
    letter-spacing: 0.02em;
  }

  html[data-growatt-theme="system"] .growatt-app input[type="date"]::-webkit-calendar-picker-indicator {
    filter: none;
    opacity: 0.55;
  }

  html[data-growatt-theme="system"] .growatt-app__mes-bi-table-card__title {
    color: rgba(51, 65, 85, 0.95);
  }

  html[data-growatt-theme="system"] .growatt-app__mes-bi-config {
    border-color: rgba(14, 165, 233, 0.38);
    background: rgba(255, 255, 255, 0.9);
    color: rgba(12, 74, 110, 0.96);
  }

  html[data-growatt-theme="system"] .growatt-app__mes-bi-config:hover {
    background: rgba(224, 242, 254, 0.92);
  }

  html[data-growatt-theme="system"] .growatt-app__mes-bi-table,
  html[data-growatt-theme="system"] .growatt-app__ano-table {
    color: rgba(15, 23, 42, 0.88);
  }

  html[data-growatt-theme="system"] .growatt-app__mes-bi-table th,
  html[data-growatt-theme="system"] .growatt-app__mes-bi-table td,
  html[data-growatt-theme="system"] .growatt-app__ano-table th,
  html[data-growatt-theme="system"] .growatt-app__ano-table td {
    border-bottom-color: rgba(14, 165, 233, 0.12);
  }

  html[data-growatt-theme="system"] .growatt-app__mes-bi-table thead th,
  html[data-growatt-theme="system"] .growatt-app__ano-table thead th {
    color: rgba(51, 65, 85, 0.85);
    background: rgba(241, 245, 249, 0.95);
    border-bottom-color: rgba(14, 165, 233, 0.2);
  }

  html[data-growatt-theme="system"] .growatt-app__mes-bi-table tbody th[scope="row"],
  html[data-growatt-theme="system"] .growatt-app__ano-table tbody th[scope="row"] {
    color: rgba(15, 23, 42, 0.92);
  }

  html[data-growatt-theme="system"] .growatt-app__mes-bi-tfoot th,
  html[data-growatt-theme="system"] .growatt-app__mes-bi-tfoot td,
  html[data-growatt-theme="system"] .growatt-app__ano-tfoot th,
  html[data-growatt-theme="system"] .growatt-app__ano-tfoot td {
    background: rgba(248, 250, 252, 0.95);
    border-top-color: rgba(14, 165, 233, 0.22);
  }

  html[data-growatt-theme="system"] .growatt-app__mes-resumo-heading {
    color: rgba(71, 85, 105, 0.85);
  }

  html[data-growatt-theme="system"] .growatt-app__mes-resumo-card {
    background: rgba(248, 250, 252, 0.92);
    border-color: rgba(14, 165, 233, 0.18);
  }

  html[data-growatt-theme="system"] .growatt-app__mes-resumo-label {
    color: rgba(100, 116, 139, 0.82);
  }

  html[data-growatt-theme="system"] .growatt-app__mes-resumo-val {
    color: #0f172a;
  }

  html[data-growatt-theme="system"] .growatt-app__mes-resumo-unit {
    color: rgba(14, 116, 144, 0.88);
  }

  html[data-growatt-theme="system"] .growatt-app__mes-resumo-card--pagar {
    background: rgba(254, 242, 242, 0.95);
    border-color: rgba(220, 38, 38, 0.22);
    box-shadow: 0 0 14px rgba(220, 38, 38, 0.06);
  }

  html[data-growatt-theme="system"] .growatt-app__mes-resumo-val--euro {
    color: #dc2626;
    text-shadow: none;
  }

  html[data-growatt-theme="system"] .growatt-app__mes-bi-footnote {
    color: rgba(100, 116, 139, 0.75) !important;
  }

  html[data-growatt-theme="system"] .growatt-app__mes-bi-total-pagar {
    background: rgba(254, 242, 242, 0.85);
    border-color: rgba(220, 38, 38, 0.2);
    box-shadow: 0 0 18px rgba(220, 38, 38, 0.06);
  }

  html[data-growatt-theme="system"] .growatt-app__mes-bi-total-pagar__line {
    color: rgba(51, 65, 85, 0.85);
  }

  html[data-growatt-theme="system"] .growatt-app__mes-bi-total-pagar__grand {
    border-top-color: rgba(220, 38, 38, 0.18);
  }

  html[data-growatt-theme="system"] .growatt-app__mes-bi-total-pagar__amount {
    color: #dc2626;
    text-shadow: none;
  }

  html[data-growatt-theme="system"] .growatt-app__bottom {
    background: rgba(255, 255, 255, 0.92);
    border-top-color: rgba(14, 165, 233, 0.2);
    box-shadow: 0 -6px 28px rgba(15, 23, 42, 0.08);
  }

  html[data-growatt-theme="system"] .growatt-app__bottom-item {
    color: rgba(71, 85, 105, 0.65);
  }

  html[data-growatt-theme="system"] .growatt-app__nav-link {
    color: rgba(51, 65, 85, 0.72);
  }

  html[data-growatt-theme="system"] .growatt-app__nav-link:hover {
    color: #0f172a;
  }

  html[data-growatt-theme="system"] .growatt-app__flash-notice {
    color: #047857;
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(5, 150, 105, 0.35);
  }

  html[data-growatt-theme="system"] .growatt-app__flash-alert {
    color: #b91c1c;
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(220, 38, 38, 0.35);
  }

  html[data-growatt-theme="system"] .growatt-app__placeholder {
    color: rgba(51, 65, 85, 0.8);
  }

  html[data-growatt-theme="system"] .growatt-app__now-refresh {
    color: rgba(15, 23, 42, 0.88);
    border-color: rgba(14, 165, 233, 0.35);
    background: rgba(14, 165, 233, 0.08);
  }
}

/*
 * Dashboard: .growatt-app dentro de modais não deve usar o padding/max-width da página Growatt
 * (html[data-growatt-theme="light"] .growatt-app acima). require_self faz este bloco aparecer por último.
 */
html[data-growatt-theme="light"] .dash__rede-modal-growatt.growatt-app {
  padding: 0;
  max-width: none;
}

html[data-growatt-theme="light"] .dash__growatt-modal-body.growatt-app,
html[data-growatt-theme="light"] #dash-growatt-dialog .dash__home-modal-body.growatt-app {
  padding: 0.85rem 1rem calc(2rem + env(safe-area-inset-bottom, 0px));
  max-width: none;
}

/* ── Navegação mobile: barra inferior flutuante (“pill”) ─────────────────── */
@media (min-width: 640px) {
  .app-tab-bar {
    display: none;
  }
}

@media (max-width: 639px) {
  .app-main {
    padding-bottom: calc(6rem + env(safe-area-inset-bottom, 0px));
  }

  .growatt-app {
    padding-bottom: 0.65rem;
  }

  html[data-growatt-theme="light"] .growatt-app {
    padding-bottom: 0.65rem;
  }

  /* Âncoras da tab bar: respiro em cima e em baixo (pill fixa) */
  .dash [id^="dash-"] {
    scroll-margin-top: calc(0.7rem + env(safe-area-inset-top, 0px));
    scroll-margin-bottom: 6rem;
  }
}

.app-tab-bar {
  position: fixed;
  z-index: 200;
  left: 0;
  right: 0;
  bottom: 20px;
  display: flex;
  justify-content: center;
  pointer-events: none;
  padding: 0 0.75rem calc(0.55rem + env(safe-area-inset-bottom, 0px));
}

.app-tab-bar__track {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.06rem;
  width: 100%;
  max-width: min(100%, 30rem);
  padding: 0.28rem 0.35rem;
  border-radius: 9999px;
  background: rgba(17, 17, 20, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 4px 6px rgba(0, 0, 0, 0.07),
    0 18px 40px rgba(0, 0, 0, 0.28);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.app-tab-bar__link {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.08rem;
  min-width: 0;
  padding: 0.15rem 0.1rem;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.5);
  -webkit-tap-highlight-color: transparent;
}

.app-tab-bar__link:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
  border-radius: 0.75rem;
}

.app-tab-bar__hit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  transition: background 0.18s ease, color 0.18s ease, transform 0.15s ease;
}

.app-tab-bar__ico {
  flex-shrink: 0;
}

.app-tab-bar__link--active .app-tab-bar__hit {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.app-tab-bar__link:not(.app-tab-bar__link--active) .app-tab-bar__hit {
  background: transparent;
  color: rgba(255, 255, 255, 0.58);
}

.app-tab-bar__label {
  font-size: 0.5rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  line-height: 1.1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.92;
}

.app-tab-bar__link--active .app-tab-bar__label {
  color: rgba(255, 255, 255, 0.95);
  font-weight: 700;
}

@media print {
  .app-tab-bar {
    display: none !important;
  }

  .app-main {
    padding-bottom: 0 !important;
  }

}

/* Barra de instalação PWA (beforeinstallprompt) */
.pwa-install-bar {
  position: fixed;
  bottom: env(safe-area-inset-bottom, 0);
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  padding: 0.65rem 1rem;
  z-index: 900;
  pointer-events: none;
}

.pwa-install-bar__btn {
  pointer-events: auto;
  appearance: none;
  margin: 0;
  padding: 0.6rem 1.4rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 650;
  cursor: pointer;
  border-radius: 999px;
  border: none;
  background: #fbbf24;
  color: #0f172a;
  box-shadow: 0 2px 12px rgba(0,0,0,0.22);
  transition: background 0.15s ease, transform 0.1s ease;
}

.pwa-install-bar__btn:hover {
  background: #f59e0b;
  transform: translateY(-1px);
}

/* ── Loader de navegação (Turbo): overlay em vez da barra de progresso padrão ── */
.turbo-progress-bar {
  display: none !important;
}

.nav-loader {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(232, 236, 242, 0.65);
  backdrop-filter: blur(1px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease;
}

.nav-loader.nav-loader--visible {
  opacity: 1;
  visibility: visible;
}

.nav-loader__spinner {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 3px solid rgba(28, 36, 51, 0.15);
  border-top-color: #217dbb;
  animation: nav-loader-spin 0.7s linear infinite;
}

@keyframes nav-loader-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Puxar para atualizar (pull_refresh_controller) ── */
.pull-refresh {
  --pull: 0px;
  --pull-rot: 0deg;
  position: fixed;
  z-index: 950;
  top: calc(env(safe-area-inset-top, 0px) - 2.75rem);
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #6b7c8f;
  box-shadow: 0 6px 18px -6px rgba(20, 35, 90, 0.35);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, var(--pull));
  transition: opacity 0.15s ease, color 0.15s ease;
}

.pull-refresh--visible {
  opacity: 1;
}

.pull-refresh--ready {
  color: #217dbb;
}

.pull-refresh__icon {
  transform: rotate(var(--pull-rot));
}

/* Atualizar por botão (pull_refresh#recarregar): o indicador fica a rodar até a página recarregar. */
.pull-refresh--a-girar .pull-refresh__icon {
  animation: nav-loader-spin 0.8s linear infinite;
}

/* Página aberta dentro de um iframe (modal do 3D): sem a navegação/instalação da app. */
.is-embed .app-tab-bar,
.is-embed .pwa-install-bar,
.is-embed .pull-refresh {
  display: none !important;
}

.is-embed .app-main {
  padding-bottom: 0 !important;
}

/* growatt-poll: «a atualizar…» ao lado do título das modais do bloco Growatt enquanto lê dados novos. */
.growatt-a-atualizar {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: 0.5rem;
  font-size: 0.7rem;
  font-weight: 500;
  color: #64748b;
  white-space: nowrap;
  vertical-align: middle;
}

.growatt-a-atualizar::before {
  content: "";
  width: 0.6rem;
  height: 0.6rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: nav-loader-spin 0.8s linear infinite;
}
