/*
 * Dashboard diário: design seguindo a Human Interface Guidelines da Apple (nota "Apple HIG" no vault).
 * Fonte do sistema (SF Pro nos aparelhos Apple), cores semânticas do iOS em claro e escuro (seguem o sistema),
 * materiais translúcidos, controle segmentado, círculos do Reminders, switch, listas inset grouped.
 * A CSP do servidor só aceita estilos deste arquivo: nada de style inline; os ícones são SVG em data: (img-src permite).
 */

/* ---------- Tokens: tema claro (padrão) ---------- */
:root {
  color-scheme: light dark;

  /* Fundos (grouped: a página é cinza e os cartões são brancos) */
  --fundo: #f2f2f7; /* systemGroupedBackground */
  --fundo-cartao: #ffffff; /* secondarySystemGroupedBackground */
  --fundo-cartao-2: #f2f2f7; /* tertiarySystemGroupedBackground */
  --fundo-elevado: #ffffff; /* popovers e tooltips */
  --hover-linha: #f5f5f7; /* opaco: a coluna fixa não pode deixar o conteúdo aparecer por baixo */

  /* Textos (labels) */
  --texto: #000000; /* label */
  --texto-2: rgba(60, 60, 67, 0.6); /* secondaryLabel */
  --texto-3: rgba(60, 60, 67, 0.3); /* tertiaryLabel */
  --texto-4: rgba(60, 60, 67, 0.18); /* quaternaryLabel */

  /* Preenchimentos (fills) e separadores */
  --preenchimento: rgba(120, 120, 128, 0.2); /* systemFill */
  --preenchimento-2: rgba(120, 120, 128, 0.16); /* secondarySystemFill */
  --preenchimento-3: rgba(118, 118, 128, 0.12); /* tertiarySystemFill */
  --preenchimento-4: rgba(116, 116, 128, 0.08); /* quaternarySystemFill */
  --separador: rgba(60, 60, 67, 0.29); /* separator */
  --separador-fraco: rgba(60, 60, 67, 0.12);
  --separador-opaco: #c6c6c8; /* opaqueSeparator */

  /* Cores do sistema (HIG, iOS 26) */
  --azul: #0088ff;
  --verde: #34c759;
  --vermelho: #ff383c;
  --laranja: #ff8d28;
  --amarelo: #ffcc00;
  --rosa: #ff2d55;
  --roxo: #cb30e0;
  --indigo: #6155f5;
  --ciano: #00c0e8;
  --cinza: #8e8e93; /* systemGray */

  /* Tinta para texto e botões: variantes com contraste AA sobre o fundo (systemBlue claro não passa de 3,5:1) */
  --tinta: #0066cc;
  --tinta-botao: #0071e3;
  --verde-texto: #248a3d;
  --perigo: #d70015;
  --foco: #0071e3;

  /* Materiais */
  --material-barra: rgba(255, 255, 255, 0.72);
  --material: rgba(250, 250, 252, 0.82);
  --sombra-cartao: 0 1px 2px rgba(0, 0, 0, 0.04), 0 2px 10px rgba(0, 0, 0, 0.04);
  --sombra-flutuante: 0 0 0 0.5px rgba(0, 0, 0, 0.08), 0 12px 40px rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 0, 0, 0.06);
  --veu: rgba(0, 0, 0, 0.22);

  /* Gráficos: grade discreta, como no Swift Charts; categorias na ordem fixa da paleta do sistema */
  --grade: rgba(60, 60, 67, 0.12);
  --serie-1: #0088ff;
  --serie-2: #ff8d28;
  --serie-3: #00c0e8;
  --serie-4: #ff2d55;
  --serie-5: #34c759;
  --serie-6: #cb30e0;
  --serie-7: #ffcc00;
  --serie-8: #6155f5;

  /* Forma e movimento */
  --raio-cartao: 16px;
  --raio-controle: 10px;
  --raio-pequeno: 8px;
  --altura-linha: 2.5rem;
  --altura-topo: 52px;
  --curva: cubic-bezier(0.32, 0.72, 0, 1); /* desaceleração das sheets do iOS */
  --curva-padrao: cubic-bezier(0.25, 0.1, 0.25, 1);
  --rapido: 160ms;
  --medio: 280ms;

  --fonte: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --fonte-arredondada: ui-rounded, 'SF Pro Rounded', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;

  font-family: var(--fonte);
  font-size: 16px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* ---------- Tokens: tema escuro ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --fundo: #000000;
    --fundo-cartao: #1c1c1e;
    --fundo-cartao-2: #2c2c2e;
    --fundo-elevado: #2c2c2e;
    --hover-linha: #262628;

    --texto: #ffffff;
    --texto-2: rgba(235, 235, 245, 0.6);
    --texto-3: rgba(235, 235, 245, 0.3);
    --texto-4: rgba(235, 235, 245, 0.16);

    --preenchimento: rgba(120, 120, 128, 0.36);
    --preenchimento-2: rgba(120, 120, 128, 0.32);
    --preenchimento-3: rgba(118, 118, 128, 0.24);
    --preenchimento-4: rgba(118, 118, 128, 0.18);
    --separador: rgba(84, 84, 88, 0.6);
    --separador-fraco: rgba(84, 84, 88, 0.35);
    --separador-opaco: #38383a;

    --azul: #0091ff;
    --verde: #30d158;
    --vermelho: #ff4245;
    --laranja: #ff9230;
    --amarelo: #ffd600;
    --rosa: #ff375f;
    --roxo: #db34f2;
    --indigo: #6d7cff;
    --ciano: #3cd3fe;

    --tinta: #0091ff;
    --tinta-botao: #0071e3;
    --verde-texto: #30d158;
    --perigo: #ff4245;
    --foco: #409cff;

    --material-barra: rgba(22, 22, 24, 0.72);
    --material: rgba(44, 44, 46, 0.82);
    --sombra-cartao: none;
    --sombra-flutuante: 0 0 0 0.5px rgba(255, 255, 255, 0.1), 0 12px 40px rgba(0, 0, 0, 0.55);
    --veu: rgba(0, 0, 0, 0.5);

    --grade: rgba(235, 235, 245, 0.1);
    --serie-1: #0091ff;
    --serie-2: #ff9230;
    --serie-3: #3cd3fe;
    --serie-4: #ff375f;
    --serie-5: #30d158;
    --serie-6: #db34f2;
    --serie-7: #ffd600;
    --serie-8: #6d7cff;
  }
}

/* Aumentar contraste (Acessibilidade do sistema): textos secundários e separadores mais fortes. */
@media (prefers-contrast: more) {
  :root {
    --texto-2: rgba(60, 60, 67, 0.85);
    --texto-3: rgba(60, 60, 67, 0.6);
    --separador: rgba(60, 60, 67, 0.5);
    --separador-fraco: rgba(60, 60, 67, 0.3);
  }
}

@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  :root {
    --texto-2: rgba(235, 235, 245, 0.85);
    --texto-3: rgba(235, 235, 245, 0.6);
    --separador: rgba(140, 140, 145, 0.8);
    --separador-fraco: rgba(140, 140, 145, 0.5);
  }
}

/* ---------- Base ---------- */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--fundo);
  color: var(--texto);
}

body {
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

/* Tipografia: escala do iOS (Title 1 28, Title 2 22, Title 3 20, Headline 17, Subheadline 15, Footnote 13, Caption 12).
   O tracking fica com o sistema: no Safari a fonte do sistema já ajusta o espaçamento a cada tamanho. */
h1 {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 1rem;
}

h2 {
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 1.5rem 0 0.75rem;
}

h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 1.25rem 0 0.5rem;
}

a {
  color: var(--tinta);
}

::selection {
  background: color-mix(in srgb, var(--azul) 30%, transparent);
}

:focus-visible {
  outline: 3px solid var(--foco);
  outline-offset: 2px;
}

.pular {
  position: absolute;
  left: -9999px;
  top: 0.5rem;
  z-index: 50;
  padding: 0.5rem 1rem;
  border-radius: var(--raio-controle);
  background: var(--fundo-elevado);
  box-shadow: var(--sombra-flutuante);
  color: var(--tinta);
}

.pular:focus {
  left: 0.5rem;
}

.visualmente-oculto {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Componentes base ---------- */

.cartao {
  background: var(--fundo-cartao);
  border-radius: var(--raio-cartao);
  box-shadow: var(--sombra-cartao);
  padding: 1rem;
  margin-bottom: 0.75rem;
}

/* Botões: cinza (padrão), filled (primário), tinted, plain (fantasma) e destrutivo. */
.botao {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 36px;
  padding: 0 1rem;
  border: 0;
  border-radius: var(--raio-controle);
  background: var(--preenchimento-2);
  color: var(--tinta);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color var(--rapido) var(--curva-padrao),
    transform var(--rapido) var(--curva-padrao),
    opacity var(--rapido) var(--curva-padrao);
}

.botao:hover {
  background: var(--preenchimento);
}

.botao:active:not(:disabled) {
  transform: scale(0.97);
  opacity: 0.85;
}

.botao--primario {
  background: var(--tinta-botao);
  color: #fff;
  font-weight: 600;
}

.botao--primario:hover {
  background: color-mix(in srgb, var(--tinta-botao) 88%, #000);
}

.botao--tinto {
  background: color-mix(in srgb, var(--azul) 15%, transparent);
  color: var(--tinta);
}

.botao--tinto:hover {
  background: color-mix(in srgb, var(--azul) 22%, transparent);
}

.botao--fantasma {
  background: transparent;
}

.botao--fantasma:hover {
  background: var(--preenchimento-4);
}

.botao--perigo {
  background: color-mix(in srgb, var(--vermelho) 14%, transparent);
  color: var(--perigo);
}

.botao--perigo:hover {
  background: color-mix(in srgb, var(--vermelho) 22%, transparent);
}

.botao--pequeno {
  min-height: 30px;
  padding: 0 0.75rem;
  border-radius: 999px;
  font-size: 0.875rem;
}

/* Itens da barra de ferramentas: texto na cor de destaque, sem fundo. */
.botao--barra {
  min-height: 34px;
  padding: 0 0.65rem;
  border-radius: var(--raio-pequeno);
  font-size: 0.9375rem;
  font-weight: 400;
}

.botao:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Botão de fechar das sheets: círculo cinza com o ✕. */
.botao-fechar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--preenchimento-3);
  color: var(--texto-2);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color var(--rapido) var(--curva-padrao);
}

.botao-fechar:hover {
  background: var(--preenchimento);
}

/* Campos: fundo em tertiary fill, sem borda, cantos de 10px. */
input,
select,
textarea {
  font: inherit;
  font-size: 1rem;
  color: var(--texto);
  background: var(--preenchimento-3);
  border: 0;
  border-radius: var(--raio-controle);
  padding: 0.55rem 0.75rem;
  min-height: 40px;
  width: 100%;
}

input::placeholder,
textarea::placeholder {
  color: var(--texto-3);
}

textarea {
  resize: vertical;
  line-height: 1.4;
}

select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 1.9rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='14' viewBox='0 0 10 14'%3E%3Cpath d='M2 5l3-3 3 3M2 9l3 3 3-3' fill='none' stroke='%238e8e93' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  background-size: 10px 14px;
  cursor: pointer;
}

select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

input[type='search'] {
  -webkit-appearance: none;
  appearance: none;
  padding-left: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Ccircle cx='6.8' cy='6.8' r='4.8' fill='none' stroke='%238e8e93' stroke-width='1.8'/%3E%3Cpath d='M10.4 10.4l3.6 3.6' stroke='%238e8e93' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.65rem center;
  background-size: 15px 15px;
}

/* Caixas de seleção: círculo do app Lembretes, preenchido com ✓ quando marcado. */
input[type='checkbox'] {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 22px;
  height: 22px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 1.5px solid var(--texto-3);
  border-radius: 50%;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px 14px;
  cursor: pointer;
  transition:
    background-color var(--rapido) var(--curva-padrao),
    border-color var(--rapido) var(--curva-padrao),
    transform var(--rapido) var(--curva);
}

input[type='checkbox']:hover {
  border-color: var(--texto-2);
}

input[type='checkbox']:checked {
  border-color: var(--azul);
  background-color: var(--azul);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4 8-9' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

input[type='checkbox']:active {
  transform: scale(0.9);
}

/* Ajustes que ligam e desligam (ex.: "Conta no progresso"): switch do iOS. */
.linha-check input[type='checkbox'] {
  width: 51px;
  height: 31px;
  border: 0;
  border-radius: 999px;
  background-color: var(--preenchimento);
  background-image:
    radial-gradient(circle at center, #fff 0 12.5px, transparent 13.5px),
    radial-gradient(circle at center, rgba(0, 0, 0, 0.18) 0 13px, transparent 15px);
  background-size:
    31px 31px,
    31px 33px;
  background-position:
    0 0,
    0 1px;
  transition:
    background-color var(--medio) var(--curva),
    background-position var(--medio) var(--curva);
}

.linha-check input[type='checkbox']:checked {
  background-color: var(--verde);
  background-image:
    radial-gradient(circle at center, #fff 0 12.5px, transparent 13.5px),
    radial-gradient(circle at center, rgba(0, 0, 0, 0.18) 0 13px, transparent 15px);
  background-position:
    20px 0,
    20px 1px;
}

label {
  display: block;
}

.erro {
  color: var(--perigo);
  min-height: 1.4em;
  font-size: 0.875rem;
}

.erro--geral {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.9rem;
  border-radius: var(--raio-controle);
  background: color-mix(in srgb, var(--vermelho) 12%, transparent);
}

.erro--geral:empty {
  display: none;
}

.ajuda {
  color: var(--texto-2);
  font-size: 0.8125rem;
  line-height: 1.35;
}

.acoes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.contador {
  color: var(--texto-2);
  font-weight: 400;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.vazio {
  color: var(--texto-2);
  text-align: center;
  padding: 1rem;
  font-size: 0.9375rem;
}

/* ---------- Login ---------- */

.login {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.login__cartao {
  width: min(100%, 360px);
  display: grid;
  gap: 0.75rem;
  padding: 2rem 1.5rem 1.5rem;
  text-align: center;
}

.login__cartao h1 {
  margin-bottom: 0.5rem;
}

.login__cartao label {
  text-align: left;
  font-size: 0.8125rem;
  color: var(--texto-2);
}

.login__cartao .botao {
  min-height: 44px;
}

/* ---------- Barra superior (material translúcido) ---------- */

.topo {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: var(--altura-topo);
  padding: 0.35rem max(0.75rem, env(safe-area-inset-right)) 0.35rem max(1rem, env(safe-area-inset-left));
  background: var(--fundo);
  border-bottom: 0.5px solid var(--separador);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .topo {
    background: var(--material-barra);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
  }
}

.topo__marca {
  min-width: 0;
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.topo__acoes {
  display: flex;
  flex: none;
  gap: 0.15rem;
}

main {
  max-width: 1480px;
  margin: 0 auto;
  padding: 1rem max(0.75rem, env(safe-area-inset-right)) 3rem max(0.75rem, env(safe-area-inset-left));
}

main:focus {
  outline: none;
}

.titulo-secao {
  margin: 0 0 0.75rem;
  font-size: 1.375rem;
  font-weight: 700;
}

/* ---------- Filtros ---------- */

.filtros {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

.filtros__linha {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.filtros input,
.filtros select {
  min-height: 34px;
  width: auto;
  font-size: 0.9375rem;
  padding-top: 0.3rem;
  padding-bottom: 0.3rem;
}

.filtros input:not([type='search']) {
  padding-left: 0.6rem;
  padding-right: 0.6rem;
}

.filtros__busca {
  flex: 1 1 14rem;
  max-width: 24rem;
}

/* Controle segmentado: trilho em tertiary fill e um "polegar" que desliza até o segmento escolhido. */
.segmentado {
  position: relative;
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  width: min(100%, 27rem);
  padding: 2px;
  border-radius: 9px;
  background: var(--preenchimento-3);
  isolation: isolate;
}

.segmentado__opcao {
  position: relative;
  min-width: 0;
  min-height: 30px;
  padding: 0 0.5rem;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--texto);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition:
    background-color var(--rapido) var(--curva-padrao),
    opacity var(--rapido) var(--curva-padrao);
}

/* Separadores finos entre segmentos não selecionados. */
.segmentado__opcao + .segmentado__opcao::before {
  content: '';
  position: absolute;
  left: 0;
  top: 25%;
  bottom: 25%;
  width: 1px;
  background: var(--separador-fraco);
  transition: opacity var(--rapido) var(--curva-padrao);
}

.segmentado__opcao[aria-pressed='true']::before,
.segmentado__opcao[aria-pressed='true'] + .segmentado__opcao::before {
  opacity: 0;
}

.segmentado__opcao[aria-pressed='true'] {
  font-weight: 600;
  background: var(--fundo-cartao);
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.12),
    0 3px 1px rgba(0, 0, 0, 0.04);
}

.segmentado__opcao:active {
  opacity: 0.6;
}

.segmentado__opcao:focus-visible {
  outline-offset: -1px;
  z-index: 1;
}

/* Com :has, o fundo do selecionado vira um polegar único que desliza (5 segmentos de largura igual). */
@supports selector(:has(*)) {
  .segmentado::after {
    content: '';
    position: absolute;
    z-index: -1;
    top: 2px;
    bottom: 2px;
    left: 2px;
    width: calc((100% - 4px) / 5);
    border-radius: 7px;
    background: var(--fundo-cartao);
    box-shadow:
      0 3px 8px rgba(0, 0, 0, 0.12),
      0 3px 1px rgba(0, 0, 0, 0.04);
    transition: transform var(--medio) var(--curva);
  }

  .segmentado:not(:has([aria-pressed='true']))::after {
    opacity: 0;
  }

  .segmentado .segmentado__opcao[aria-pressed='true'] {
    background: transparent;
    box-shadow: none;
  }

  .segmentado:has(> :nth-child(2)[aria-pressed='true'])::after {
    transform: translateX(100%);
  }
  .segmentado:has(> :nth-child(3)[aria-pressed='true'])::after {
    transform: translateX(200%);
  }
  .segmentado:has(> :nth-child(4)[aria-pressed='true'])::after {
    transform: translateX(300%);
  }
  .segmentado:has(> :nth-child(5)[aria-pressed='true'])::after {
    transform: translateX(400%);
  }
}

@media (prefers-color-scheme: dark) {
  .segmentado__opcao[aria-pressed='true'],
  .segmentado::after {
    background: #636366;
  }

  @supports selector(:has(*)) {
    .segmentado .segmentado__opcao[aria-pressed='true'] {
      background: transparent;
    }
  }
}

.intervalo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9375rem;
  color: var(--texto-2);
}

/* Pop-up button (menu): cinza, com as setas ⌃⌄ do macOS. */
.menu-popup {
  font-weight: 500;
}

.lista-filtros {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.lista-filtros:empty {
  display: none;
}

/* Filtro por propriedade: uma "ficha" tinted, como as tags do Lembretes, com os menus dentro. */
.filtro {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.2rem 0.2rem 0.3rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--azul) 10%, var(--fundo-cartao));
}

.filtros .filtro select,
.filtros .filtro input {
  min-height: 30px;
  border-radius: var(--raio-pequeno);
  background-color: var(--fundo-cartao);
  font-size: 0.875rem;
}

.filtros .filtro__numero {
  width: 6rem;
}

.filtro .botao--pequeno {
  min-height: 28px;
  width: 28px;
  padding: 0;
  color: var(--texto-2);
}

/* ---------- Gráficos ---------- */

.graficos {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.graficos .cartao {
  margin: 0;
  padding: 1rem;
}

.resumo {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  grid-column: 1 / -1;
}

/* Números grandes em SF Pro Rounded, rótulo pequeno em cima (como no app Saúde). */
.resumo .cartao {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 0.2rem;
  padding: 0.85rem 1rem;
}

.resumo strong {
  display: block;
  font-family: var(--fonte-arredondada);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.resumo span {
  color: var(--texto-2);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.25;
}

.resumo .cartao:first-child strong {
  color: var(--tinta);
}

.grafico h3 {
  margin: 0 0 0.15rem;
  font-size: 1rem;
  font-weight: 600;
}

.grafico__sub {
  color: var(--texto-2);
  font-size: 0.8125rem;
  line-height: 1.35;
  margin: 0 0 0.75rem;
}

.grafico__area {
  position: relative;
  height: 180px;
}

.grafico__area--alta {
  height: 220px;
}

.barra {
  height: 8px;
  border-radius: 999px;
  background: var(--preenchimento-3);
  overflow: hidden;
}

.barra__preenchimento {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--azul);
  transition: width var(--medio) var(--curva);
}

.barra--mini {
  height: 4px;
  flex: 1 1 auto;
  min-width: 1.25rem;
}

.barras-h {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.barras-h__topo {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.9375rem;
}

.barras-h__topo strong {
  font-family: var(--fonte-arredondada);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.barras-h__extra {
  color: var(--texto-2);
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

.barras-h .barra {
  margin-top: 0.3rem;
}

/* "Ver dados": disclosure discreto com chevron. */
.dados {
  margin-top: 0.5rem;
  font-size: 0.8125rem;
}

.dados summary {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 28px;
  color: var(--tinta);
  cursor: pointer;
  list-style: none;
}

.dados summary::-webkit-details-marker {
  display: none;
}

.dados summary::after {
  content: '›';
  font-size: 1.1em;
  line-height: 1;
  transition: transform var(--rapido) var(--curva);
}

.dados[open] summary::after {
  transform: rotate(90deg);
}

.dados__rolagem {
  max-height: 240px;
  overflow: auto;
  margin-top: 0.25rem;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-variant-numeric: tabular-nums;
}

th,
td {
  text-align: left;
  padding: 0.35rem 0.5rem;
  border-bottom: 0.5px solid var(--separador);
}

.dados th {
  color: var(--texto-2);
  font-weight: 500;
  font-size: 0.75rem;
}

/* ---------- Histórico em tabela ---------- */

.historico__topo {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.historico__topo .titulo-secao {
  margin-bottom: 0.6rem;
}

/* Rolagem própria nos dois eixos: é o que deixa o cabeçalho (top) e a data (left) fixos.
   Desconta a barra superior para o topo da tabela não ficar escondido sob ela. */
.tabela-rolagem {
  overflow: auto;
  max-height: calc(100vh - var(--altura-topo) - 1.5rem);
  max-height: calc(100dvh - var(--altura-topo) - 1.5rem);
  border-radius: 12px;
  background: var(--fundo-cartao);
  box-shadow: var(--sombra-cartao);
  overscroll-behavior-x: contain;
  scroll-margin-top: calc(var(--altura-topo) + 0.75rem);
}

.tabela {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 0.875rem;
}

.tabela th,
.tabela td {
  padding: 0;
  height: var(--altura-linha);
  border-bottom: 0.5px solid var(--separador);
  border-right: 0.5px solid var(--separador-fraco);
  vertical-align: middle;
  background: var(--fundo-cartao);
  transition: background-color var(--rapido) var(--curva-padrao);
}

.tabela tr > :last-child {
  border-right: 0;
}

.tabela tbody tr:last-child > * {
  border-bottom: 0;
}

.tabela thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: auto;
  padding: 0.55rem 0.4rem 0.45rem;
  background: var(--fundo-cartao);
  border-bottom: 0.5px solid var(--separador);
  border-right-color: transparent;
  color: var(--texto-2);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  vertical-align: bottom;
  cursor: help;
}

.th__nome {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.th__icone {
  margin-right: 0.25rem;
  color: var(--texto-3);
}

/* Coluna da data fixa ao rolar na horizontal. */
.tabela .col-data {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 5.5rem;
  min-width: 5.5rem;
  padding: 0 0.6rem;
  background: var(--fundo-cartao);
  border-right: 0.5px solid var(--separador);
  font-weight: 500;
  white-space: nowrap;
}

.tabela thead .col-data {
  z-index: 3;
}

.tabela tbody tr:hover > * {
  background: var(--hover-linha);
}

.cel-data {
  display: block;
  font-variant-numeric: tabular-nums;
}

.cel-data__semana {
  color: var(--texto-2);
  font-weight: 400;
}

/* Selo "hoje": cápsula tinted. */
.selo {
  display: inline-block;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--azul) 15%, transparent);
  color: var(--tinta);
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.4;
}

.linha--hoje > .col-data {
  box-shadow: inset 3px 0 0 var(--azul);
}

.linha--vazia .cel-data {
  color: var(--texto-2);
}

.linha--erro > .col-data {
  box-shadow: inset 3px 0 0 var(--vermelho);
  color: var(--perigo);
}

/* Larguras compactas: no computador a tabela cabe sem rolagem horizontal. */
.tabela .col-progresso {
  width: 4.75rem;
  min-width: 4.75rem;
}
.tabela .col--checkbox {
  width: 3.5rem;
  min-width: 3.5rem;
}
.tabela .col--numero {
  width: 5rem;
  min-width: 5rem;
}
.tabela .col--hora {
  width: 5.75rem;
  min-width: 5.75rem;
}
.tabela .col--escala {
  width: 3.5rem;
  min-width: 3.5rem;
}
.tabela .col--selecao {
  width: 6.75rem;
  min-width: 6.75rem;
}
.tabela .col--multisselecao {
  width: 8.25rem;
  min-width: 8.25rem;
}
.tabela .col--checklist {
  width: 3.75rem;
  min-width: 3.75rem;
}
.tabela .col--texto {
  width: 9rem;
  min-width: 9rem;
}
.tabela .col--nota {
  min-width: 9rem;
}

/* Controles dentro das células: sem moldura, ocupam a célula toda. */
.tabela input:not([type='checkbox']),
.tabela select,
.tabela textarea {
  min-height: 0;
  height: var(--altura-linha);
  border: 0;
  border-radius: 0;
  background-color: transparent;
  padding: 0 0.5rem;
  font-size: inherit;
}

.tabela select {
  padding-right: 0.5rem;
  background-image: none;
  text-align: center;
  text-align-last: center;
}

.tabela select:hover,
.tabela select:focus {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='14' viewBox='0 0 10 14'%3E%3Cpath d='M2 5l3-3 3 3M2 9l3 3 3-3' fill='none' stroke='%238e8e93' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 0.3rem center;
  background-size: 8px 12px;
  background-repeat: no-repeat;
}

.tabela input:focus-visible,
.tabela select:focus-visible,
.tabela button:focus-visible {
  outline: 2px solid var(--foco);
  outline-offset: -2px;
}

.tabela input[type='checkbox']:focus-visible {
  outline-offset: 2px;
}

.tabela input:not([type='checkbox']):focus,
.tabela select:focus {
  background-color: var(--fundo-cartao);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--azul) 45%, transparent);
}

.cel-check {
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--altura-linha);
  cursor: pointer;
}

.cel-numero {
  display: flex;
  align-items: center;
}

.cel-numero input {
  min-width: 0;
  text-align: right;
  -moz-appearance: textfield;
  appearance: textfield;
}

.cel-numero input::-webkit-inner-spin-button,
.cel-numero input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.cel-unidade {
  color: var(--texto-2);
  font-size: 0.75rem;
  padding-right: 0.45rem;
}

.tabela select.cel-entrada {
  cursor: pointer;
}

.cel-texto {
  text-overflow: ellipsis;
}

.cel-texto[readonly] {
  cursor: pointer;
}

.cel-com-expandir {
  position: relative;
}

.tabela .cel-com-expandir .cel-texto {
  padding-right: 1.8rem;
}

.cel-expandir {
  position: absolute;
  top: 50%;
  right: 0.3rem;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--preenchimento-2);
  color: var(--texto-2);
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition:
    opacity var(--rapido) var(--curva-padrao),
    background-color var(--rapido) var(--curva-padrao);
}

.cel-expandir:hover {
  background: var(--preenchimento);
  color: var(--texto);
}

.cel-com-expandir:hover .cel-expandir,
.cel-com-expandir:focus-within .cel-expandir,
.cel-expandir[aria-expanded='true'] {
  opacity: 1;
}

@media (hover: none) {
  .cel-expandir {
    opacity: 0.7;
  }
}

.cel-botao {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
  height: var(--altura-linha);
  padding: 0 0.45rem;
  border: 0;
  background: transparent;
  color: var(--texto);
  font: inherit;
  font-size: inherit;
  text-align: left;
  overflow: hidden;
  cursor: pointer;
}

.cel-botao:hover,
.cel-botao[aria-expanded='true'] {
  background: var(--preenchimento-4);
}

.col--checklist .cel-botao {
  justify-content: center;
}

.contagem {
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--preenchimento-3);
  color: var(--texto-2);
}

.contagem--zero {
  background: transparent;
  color: var(--texto-3);
}

.contagem--completa {
  background: color-mix(in srgb, var(--verde) 18%, transparent);
  color: var(--verde-texto);
}

.cel-progresso {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 0.5rem;
}

.cel-progresso__valor {
  font-size: 0.75rem;
  color: var(--texto-2);
  font-variant-numeric: tabular-nums;
  min-width: 2.2rem;
  text-align: right;
}

/* Etiquetas (seleção): cápsulas como as tags do Lembretes, na mesma ordem de cores dos gráficos. */
.etiqueta {
  display: inline-block;
  max-width: 100%;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--preenchimento-3);
  background: color-mix(in srgb, var(--cor-etiqueta, var(--cinza)) 18%, transparent);
  color: var(--texto);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
  min-width: 0;
}

.etiqueta--1 {
  --cor-etiqueta: var(--serie-1);
}
.etiqueta--2 {
  --cor-etiqueta: var(--serie-2);
}
.etiqueta--3 {
  --cor-etiqueta: var(--serie-3);
}
.etiqueta--4 {
  --cor-etiqueta: var(--serie-4);
}
.etiqueta--5 {
  --cor-etiqueta: var(--serie-5);
}
.etiqueta--6 {
  --cor-etiqueta: var(--serie-6);
}
.etiqueta--7 {
  --cor-etiqueta: var(--serie-7);
}
.etiqueta--8 {
  --cor-etiqueta: var(--serie-8);
}

#mais-dias {
  display: flex;
  margin: 1rem auto 0;
}

/* ---------- Popover de edição (material, cantos de 14px) ---------- */

.popover {
  position: absolute;
  left: var(--x, 0);
  top: var(--y, 0);
  z-index: 20;
  width: max-content;
  min-width: 13rem;
  max-width: min(92vw, 24rem);
  max-height: 60vh;
  overflow: auto;
  padding: 0.6rem;
  border-radius: 14px;
  background: var(--fundo-elevado);
  box-shadow: var(--sombra-flutuante);
  transform-origin: top left;
  animation: surgir var(--medio) var(--curva);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .popover {
    background: var(--material);
    -webkit-backdrop-filter: saturate(180%) blur(30px);
    backdrop-filter: saturate(180%) blur(30px);
  }
}

.popover__titulo {
  margin: 0.1rem 0.25rem 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--texto-2);
}

.popover__ajuda {
  margin: 0.4rem 0.25rem 0;
  font-size: 0.75rem;
  color: var(--texto-2);
}

.popover__texto {
  width: min(86vw, 22rem);
  min-height: 9rem;
  font-size: 0.9375rem;
  background: var(--fundo-cartao);
}

.popover__lista {
  list-style: none;
  margin: 0 0 0.4rem;
  padding: 0;
  display: grid;
  gap: 1px;
}

.popover__opcao {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 38px;
  padding: 0.25rem 0.5rem;
  border-radius: var(--raio-pequeno);
  cursor: pointer;
  font-size: 0.9375rem;
  transition: background-color var(--rapido) var(--curva-padrao);
}

.popover__opcao:hover {
  background: var(--preenchimento-3);
}

.popover__opcao--botao {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--texto);
  font: inherit;
  text-align: left;
}

/* Opção escolhida: ✓ na cor de destaque, como nos menus do sistema. */
.popover__opcao--botao[aria-pressed='true']::after {
  content: '✓';
  margin-left: auto;
  padding-left: 0.5rem;
  color: var(--tinta);
  font-weight: 600;
}

/* ---------- Status de salvamento (cápsula flutuante) ---------- */

.status-salvar {
  position: fixed;
  right: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  z-index: 30;
  margin: 0;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: var(--fundo-elevado);
  box-shadow: var(--sombra-flutuante);
  color: var(--texto-2);
  font-size: 0.8125rem;
  font-weight: 500;
  pointer-events: none;
  animation: surgir var(--medio) var(--curva);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .status-salvar {
    background: var(--material);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
  }
}

.status-salvar:empty {
  display: none;
}

.status-salvar--ok {
  color: var(--verde-texto);
}

.status-salvar--erro {
  color: var(--perigo);
}

/* ---------- Diálogos: base ---------- */

dialog {
  color: var(--texto);
  border: 0;
  padding: 0;
  background: var(--fundo-elevado);
  box-shadow: var(--sombra-flutuante);
}

dialog::backdrop {
  background: var(--veu);
}

dialog[open] {
  animation: surgir var(--medio) var(--curva);
}

dialog[open]::backdrop {
  animation: aparecer var(--medio) var(--curva-padrao);
}

dialog h2 {
  margin-top: 0;
}

/* ---------- Painel de propriedades: inspector flutuante (computador) / sheet (celular) ---------- */

.painel {
  margin: 0.5rem 0.5rem 0.5rem auto;
  width: min(calc(100vw - 1rem), 30rem);
  max-width: none;
  height: calc(100vh - 1rem);
  height: calc(100dvh - 1rem);
  max-height: none;
  overflow: auto;
  overscroll-behavior: contain;
  border-radius: 18px;
  background: var(--fundo);
}

.painel[open] {
  animation: entrar-direita var(--medio) var(--curva);
}

.painel__conteudo {
  min-height: 100%;
  padding: 0 1rem 2rem;
}

.painel__topo {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0 -1rem 0.5rem;
  padding: 0.85rem 1rem 0.6rem;
  background: var(--fundo);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .painel__topo {
    background: color-mix(in srgb, var(--fundo) 80%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
  }
}

.painel__topo h2 {
  margin: 0;
  font-size: 1.375rem;
}

.painel > .painel__conteudo > .ajuda {
  margin: 0 0.25rem 1rem;
}

/* Lista inset grouped: um cartão só, linhas separadas por separadores finos recuados. */
.props {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  border-radius: 12px;
  background: var(--fundo-cartao);
  overflow: hidden;
}

.props > li {
  position: relative;
}

.props > li + li::before {
  content: '';
  position: absolute;
  top: 0;
  left: 1rem;
  right: 0;
  border-top: 0.5px solid var(--separador);
}

.props .cartao {
  margin: 0;
  border-radius: 0;
  box-shadow: none;
}

.prop {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.7rem 0.75rem 0.7rem 1rem;
}

.prop__info {
  flex: 1 1 160px;
  min-width: 0;
}

.prop__info strong {
  font-weight: 500;
}

.prop__tipo {
  color: var(--texto-2);
  font-size: 0.8125rem;
}

.prop__acoes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.prop__acoes .botao--pequeno {
  min-height: 30px;
  padding: 0 0.65rem;
}

.cabecalho-grupo {
  margin: 1.5rem 1rem 0.4rem;
  color: var(--texto-2);
  font-size: 0.8125rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

#nova-propriedade {
  width: 100%;
  min-height: 44px;
}

.editor {
  display: grid;
  gap: 0.85rem;
  margin-top: 0.75rem;
}

.editor h3 {
  margin: 0;
}

.editor label {
  margin-bottom: 0.3rem;
  color: var(--texto-2);
  font-size: 0.8125rem;
}

.editor input,
.editor select,
.editor textarea {
  background-color: var(--fundo-cartao-2);
}

.editor .linha-check {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-direction: row-reverse;
  gap: 0.75rem;
  margin: 0;
  color: var(--texto);
  font-size: 1rem;
}

/* ---------- Alerta de confirmação ---------- */

.alerta {
  width: min(88vw, 300px);
  border-radius: 14px;
  text-align: center;
  overflow: hidden;
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .alerta {
    background: var(--material);
    -webkit-backdrop-filter: saturate(180%) blur(30px);
    backdrop-filter: saturate(180%) blur(30px);
  }
}

.alerta form {
  padding: 1.25rem 1rem 0;
}

.alerta h2 {
  margin: 0 0 0.35rem;
  font-size: 1.0625rem;
  font-weight: 600;
}

.alerta p {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  line-height: 1.35;
}

.alerta label {
  margin-bottom: 0.4rem;
  font-size: 0.8125rem;
  color: var(--texto-2);
}

.alerta input {
  min-height: 34px;
  font-size: 0.9375rem;
  background-color: var(--fundo-cartao);
}

.alerta .acoes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 1rem -1rem 0;
  border-top: 0.5px solid var(--separador);
}

.alerta .acoes .botao {
  min-height: 44px;
  border-radius: 0;
  background: transparent;
  color: var(--tinta);
  font-size: 1.0625rem;
  font-weight: 400;
}

.alerta .acoes .botao:hover {
  background: var(--preenchimento-4);
}

.alerta .acoes .botao + .botao {
  border-left: 0.5px solid var(--separador);
}

.alerta .acoes .botao--perigo {
  color: var(--perigo);
  font-weight: 600;
}

/* ---------- Animações ---------- */

@keyframes surgir {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes aparecer {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes entrar-direita {
  from {
    opacity: 0.4;
    transform: translateX(2rem);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes subir {
  from {
    transform: translateY(100%);
  }
  to {
    transform: none;
  }
}

/* ---------- Telas maiores ---------- */

@media (min-width: 720px) {
  .topo {
    padding-left: max(1.25rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }

  main {
    padding: 1.5rem 1.25rem 3rem;
  }

  .graficos {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  }

  /* Progresso e constância ocupam a linha inteira. Com os hábitos numa coluna só, a constância
     ficava alta e abria um vão na linha dos gráficos ao lado. */
  .grafico--largo {
    grid-column: 1 / -1;
  }

  .grafico--constancia .barras-h {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.85rem 1.75rem;
  }
}

/* Toque: alvos de pelo menos 44 pt, como pede a HIG. */
@media (pointer: coarse) {
  .botao,
  .botao--barra {
    min-height: 44px;
  }

  .botao--pequeno {
    min-height: 36px;
  }

  .segmentado__opcao {
    min-height: 34px;
  }

  .filtros input,
  .filtros select {
    min-height: 38px;
  }

  /* Abaixo de 16px o Safari do iPhone dá zoom ao focar o campo. */
  input,
  select,
  textarea {
    font-size: 1rem !important;
  }
}

/* ---------- Celular ---------- */

@media (max-width: 640px) {
  .so-largo {
    display: none;
  }

  .topo {
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.25rem, env(safe-area-inset-right));
  }

  .botao--barra {
    padding: 0 0.5rem;
  }

  .segmentado {
    width: 100%;
  }

  .filtros__busca {
    flex-basis: 100%;
    max-width: none;
  }

  .filtros__linha > .menu-popup {
    flex: 1 1 auto;
  }

  .titulo-secao {
    font-size: 1.25rem;
  }

  .resumo {
    gap: 0.5rem;
  }

  .resumo .cartao {
    padding: 0.7rem 0.75rem;
  }

  .resumo strong {
    font-size: 1.35rem;
  }

  .resumo span {
    font-size: 0.75rem;
  }

  /* Popover vira sheet presa embaixo da tela, com o "grabber". */
  .popover {
    position: fixed;
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: auto;
    max-width: none;
    max-height: 70vh;
    max-height: 70dvh;
    padding: 1.25rem 0.75rem calc(0.75rem + env(safe-area-inset-bottom));
    border-radius: 16px 16px 0 0;
    animation: subir var(--medio) var(--curva);
  }

  .popover::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    width: 36px;
    height: 5px;
    margin-left: -18px;
    border-radius: 999px;
    background: var(--texto-3);
  }

  .popover__texto {
    width: 100%;
  }

  .popover__opcao {
    min-height: 44px;
  }

  /* O painel de propriedades também vira sheet de baixo para cima. */
  .painel {
    margin: auto 0 0;
    width: 100%;
    height: calc(100vh - 2.5rem);
    height: calc(100dvh - 2.5rem);
    border-radius: 16px 16px 0 0;
  }

  .painel[open] {
    animation: subir var(--medio) var(--curva);
  }

  .painel__topo {
    padding-top: 1.25rem;
  }

  .painel__topo::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    width: 36px;
    height: 5px;
    margin-left: -18px;
    border-radius: 999px;
    background: var(--texto-3);
  }

  .painel__conteudo {
    padding-bottom: calc(2rem + env(safe-area-inset-bottom));
  }

  .status-salvar {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    animation: none;
  }
}

/* ---------- Movimento reduzido ---------- */

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

  .botao:active:not(:disabled),
  input[type='checkbox']:active {
    transform: none;
  }
}
