/* A peça de Indicadores (os números reais do sistema, os/metricas) e a folha de escolher. A peça usa a faixa de medidas da área
   de trabalho (mesa.css): o separador em degradê entre os números vale aqui também, nas colunas e entre as linhas. */

/* ------------------------------------------------------------ a peça */
.w.w-indicadores, .w-solto.w-indicadores { position: relative; padding: 0; justify-content: center; }
.w-ind-grade { display: grid; grid-template-columns: repeat(var(--colunas, 1), minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); width: 100%; height: 100%; }
.w-ind-grade.carregando { min-height: 88px; }
.w-ind { justify-content: center; gap: 4px; min-height: 0; padding: 12px 18px; text-align: left; border-radius: 10px; transition: background-color .16s ease; }
.w-ind.linha-nova::before { display: none; }
.w-ind.abaixo::after { content: ""; position: absolute; top: 0; left: 12%; right: 12%; height: 1px; background: linear-gradient(90deg, rgba(var(--f), 0), rgba(var(--f), .24) 28%, rgba(var(--f), .24) 72%, rgba(var(--f), 0)); }
@media (hover: hover) and (pointer: fine) { .w-ind:hover { background: rgba(var(--f), .06); } }
.w-ind:focus-visible { outline: 1.5px solid rgba(var(--f), .5); outline-offset: -1.5px; }
.w-ind-nome { display: flex; align-items: center; min-width: 0; font-size: 12.5px; color: var(--tinta-2); }
.w-ind-n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-ind-p { flex: none; white-space: pre; color: var(--tinta-3); }
.w-ind-nome .ico { flex: none; margin-left: 5px; color: var(--tinta-3); }
.w-ind.sob-botao .w-ind-nome { padding-right: 22px; }
.w-ind-linha { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.w-ind-linha b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 26px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.w-ind.vazio .w-ind-linha b { font-size: 15px; font-weight: 500; letter-spacing: 0; color: var(--tinta-3); }
.w-ind.erro .w-ind-linha b { color: var(--tinta-3); }
.w-ind-var { flex: none; font-style: normal; font-size: 12px; font-weight: 600; white-space: nowrap; color: var(--tinta-2); }
.w-ind-var.bom { color: #30d158; } .w-ind-var.ruim { color: #ff6b5e; }
.w-solto .w-ind-var.bom { color: #6ee58c; } .w-solto .w-ind-var.ruim { color: #ff8f84; }
:root[data-tema="claro"] .w .w-ind-var.bom { color: #1a7f37; } :root[data-tema="claro"] .w .w-ind-var.ruim { color: #c0271a; }
.w-ind-pe { display: flex; align-items: center; height: 16px; min-width: 0; margin-top: 2px; }
.w-ind-serie { display: block; flex: 1; width: 100%; height: 16px; overflow: visible; }
.w-ind-serie polyline { fill: none; stroke: currentColor; stroke-width: 1.500; stroke-linecap: round; stroke-linejoin: round; opacity: .42; }
.w-ind-meta { flex: 1; margin-top: 0; }
.w-ind-meta.cheio i { background: #30d158; }
.w-ind-aviso { min-width: 0; font-size: 11.5px; color: var(--erro); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-ind.velho .w-ind-linha b { opacity: .72; }
.w-ind-escolher { position: absolute; z-index: 1; top: 6px; right: 6px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; color: var(--tinta-2); opacity: 0; transition: opacity .16s ease, background-color .16s ease; }
.w-ind-escolher:hover { background: rgba(var(--f), .1); color: var(--tinta); }
.pc:hover .w-ind-escolher, .w-ind-escolher:focus-visible { opacity: 1; }
@media (hover: none) { .w-ind-escolher { opacity: 1; } }
.w-indicadores-vazio { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; height: 100%; padding: 0 18px; font-size: 14px; color: var(--tinta-2); }

/* a dica ao passar o mouse: o que o número conta, o período anterior, a meta e o estado da leitura */
.w-dica { position: fixed; z-index: 950; max-width: 300px; padding: 10px 12px; border-radius: 8px; font-size: 12.5px; line-height: 1.4; color: var(--tinta); background: var(--sup-menu); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%); box-shadow: var(--brilho), 0 14px 32px -14px rgba(0, 0, 0, .8); pointer-events: none; animation: w-dica .14s var(--ease-out) both; }
@keyframes w-dica { from { opacity: 0; transform: translateY(3px); } }
.w-dica[data-lado="baixo"] { animation-name: w-dica-baixo; }
@keyframes w-dica-baixo { from { opacity: 0; transform: translateY(-3px); } }
.w-dica-titulo { display: block; font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.w-dica-detalhe { color: var(--tinta-2); }
.w-dica p + p { margin-top: 4px; }
.w-dica p:not(.w-dica-detalhe):not(.w-dica-erro):not(.w-dica-velho) { display: flex; justify-content: space-between; gap: 12px; }
.w-dica p span { color: var(--tinta-3); }
.w-dica-erro { color: var(--erro); }
.w-dica-velho { color: var(--tinta-3); }
:root[data-tema="claro"] .w-dica { color-scheme: light; --f: 0, 0, 0; --tinta: #1d1d1f; --tinta-2: rgba(29, 29, 31, .76); --tinta-3: rgba(29, 29, 31, .64); --erro: #c0271a; --brilho: inset 0 1px 0 rgba(255, 255, 255, .85), inset 0 0 0 1px rgba(0, 0, 0, .07); }

/* ------------------------------------------------------------ a folha de escolher */
.mesa-folha { position: fixed; z-index: 700; left: 50%; top: 50%; width: min(620px, calc(100vw - 24px)); max-height: min(560px, calc(100vh - 80px)); transform: translate(-50%, -50%); display: flex; flex-direction: column; border-radius: 10px; color: var(--tinta); background: var(--sup-folha); -webkit-backdrop-filter: blur(40px) saturate(180%); backdrop-filter: blur(40px) saturate(180%); box-shadow: var(--brilho), 0 40px 90px -30px rgba(0, 0, 0, .8); animation: mesa-folha .26s var(--ease-out) both; }
@keyframes mesa-folha { from { opacity: 0; transform: translate(-50%, calc(-50% + 10px)) scale(.98); } }
.mesa-folha.saindo { opacity: 0; transform: translate(-50%, calc(-50% + 6px)) scale(.99); transition: opacity .16s ease, transform .16s var(--ease-out); }
.mesa-folha header { flex: none; display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 10px 0 18px; }
.mesa-folha header h2 { flex: 1; font-size: 17px; font-weight: 600; }
.mesa-folha footer { flex: none; display: flex; align-items: center; gap: 8px; padding: 10px 12px 12px; }
.mesa-folha footer .espaco { flex: 1; }
:root[data-tema="claro"] .mesa-folha { color-scheme: light; color: var(--tinta); --f: 0, 0, 0; --tinta: #1d1d1f; --tinta-2: rgba(29, 29, 31, .76); --tinta-3: rgba(29, 29, 31, .64); --laranja-claro: var(--marca-no-claro); --erro: #c0271a; --brilho: inset 0 1px 0 rgba(255, 255, 255, .85), inset 0 0 0 1px rgba(0, 0, 0, .07); }

.met-folha { width: min(820px, calc(100vw - 24px)); height: min(620px, calc(100vh - 80px)); max-height: none; }
.met-corpo { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: 12px; padding: 0 12px; }
.met-lado { min-height: 0; display: flex; flex-direction: column; border-radius: 8px; background: var(--poco); }
.met-lado h3 { flex: none; display: flex; align-items: baseline; gap: 6px; padding: 12px 14px 8px; font-size: 13px; font-weight: 600; color: var(--tinta-2); }
.met-lado h3 .num { color: var(--tinta-3); font-weight: 500; }

/* o que está na peça, na ordem dela */
.met-lista { position: relative; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; list-style: none; margin: 0; padding: 0 6px 8px; }
.met-item { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto 104px 30px; align-items: center; gap: 6px; min-height: 48px; padding: 4px 4px 4px 0; border-radius: 7px; background: transparent; transition: transform .18s var(--ease-out), background-color .16s ease; }
.met-item + .met-item { border-top: 1px solid rgba(var(--f), .06); }
.met-item.arrastando { z-index: 2; transition: none; background: var(--sup-folha); box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .7), inset 0 0 0 1px rgba(var(--f), .1); border-top-color: transparent; }
.met-item.arrastando + .met-item { border-top-color: transparent; }
.met-pega { display: grid; place-items: center; width: 28px; height: 36px; border-radius: 6px; color: var(--tinta-3); cursor: grab; touch-action: none; }
.met-item.arrastando .met-pega { cursor: grabbing; }
.met-pega:hover { color: var(--tinta); }
.met-item-nome { display: flex; flex-direction: column; min-width: 0; }
.met-item-nome b { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.met-item-nome small { font-size: 11.5px; color: var(--tinta-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.met-periodo { display: inline-flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 76px; height: 30px; padding: 0 8px 0 10px; border-radius: 6px; font-size: 13px; color: var(--tinta); background: rgba(var(--f), .08); }
.met-periodo:hover, .met-periodo[aria-expanded="true"] { background: rgba(var(--f), .13); }
.met-periodo.fixo { justify-content: flex-start; color: var(--tinta-3); background: none; }
.met-periodo .c-seta { flex: none; color: var(--tinta-3); }
.met-meta { width: 100%; min-width: 0; height: 30px; padding: 0 8px; border: 0; border-radius: 6px; font-size: 13px; font-variant-numeric: tabular-nums; text-align: right; color: var(--tinta); background: rgba(var(--f), .06); box-shadow: inset 0 0 0 1px rgba(var(--f), .08); }
.met-meta::placeholder { color: var(--tinta-3); text-align: right; }
.met-meta:focus-visible { outline: none; box-shadow: inset 0 0 0 1px rgba(var(--f), .34); }
.met-meta.invalido { box-shadow: inset 0 0 0 1px var(--erro); }
.met-tirar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 6px; color: var(--tinta-3); }
.met-tirar:hover { color: var(--erro); background: rgba(var(--f), .08); }
.met-vazio { padding: 18px 14px; font-size: 13px; color: var(--tinta-3); list-style: none; }

/* o catálogo, por grupo, com a busca no alto */
.met-busca { flex: none; height: 34px; margin: 12px 12px 6px; padding: 0 10px; border: 0; border-radius: 7px; font-size: 14px; color: var(--tinta); background: rgba(var(--f), .07); box-shadow: inset 0 0 0 1px rgba(var(--f), .08); }
.met-busca::placeholder { color: var(--tinta-3); }
.met-busca:focus-visible { outline: none; box-shadow: inset 0 0 0 1px rgba(var(--f), .34); }
/* cada opção tem fundo próprio no ponteiro: o respiro entre elas vem do gap */
.met-grupos { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; overscroll-behavior: contain; padding: 0 6px 10px; }
.met-grupos > * { flex: none; }
.met-grupos h4 { margin: 12px 8px 4px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--tinta-3); }
.met-grupos h4:first-child { margin-top: 4px; }
.met-opcao { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 7px 8px; border-radius: 7px; text-align: left; transition: background-color .12s ease; }
.met-opcao:hover { background: rgba(var(--f), .07); }
.met-opcao:focus-visible { outline: 1.5px solid rgba(var(--f), .5); outline-offset: -1.5px; }
.met-marca { flex: none; display: grid; place-items: center; width: 18px; height: 18px; margin-top: 1px; border-radius: 5px; color: transparent; box-shadow: inset 0 0 0 1.5px rgba(var(--f), .38); transition: background-color .12s ease, box-shadow .12s ease; }
.met-opcao[aria-checked="true"] .met-marca { color: #fff; background: var(--laranja); box-shadow: none; }
.met-opcao-txt { display: flex; flex-direction: column; min-width: 0; }
.met-opcao-txt b { font-size: 14px; font-weight: 500; }
.met-opcao-txt small { font-size: 12px; line-height: 1.35; color: var(--tinta-3); }

@media (max-width: 860px) {
  .w-ind { padding: 12px 14px; min-height: 88px; }
  .w-ind-linha b { font-size: 22px; }
  .w-ind-escolher { width: 36px; height: 36px; top: 2px; right: 2px; }
  .w-ind.sob-botao .w-ind-nome { padding-right: 30px; }
  /* no celular, a folha sobe do pé da tela e cobre a dock */
  .met-folha { z-index: 800; left: 0; right: 0; top: auto; bottom: 0; width: 100%; height: calc(100dvh - 56px); transform: none; border-radius: 12px 12px 0 0; padding-bottom: env(safe-area-inset-bottom); animation-name: met-folha-sobe; }
  .met-folha.saindo { transform: translateY(14px); }
  body.com-folha-de-indicadores .dock { opacity: 0; pointer-events: none; }
  .met-corpo { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(160px, 1fr) minmax(200px, 1fr); padding: 0 8px; }
  .met-item { grid-template-columns: 36px minmax(0, 1fr) auto 36px; grid-template-rows: auto auto; row-gap: 2px; padding: 6px 4px 6px 0; }
  .met-pega { width: 36px; height: 40px; grid-row: 1 / span 2; }
  .met-item-nome { grid-column: 2; }
  .met-periodo { grid-column: 3; min-height: 36px; }
  .met-tirar { grid-column: 4; grid-row: 1 / span 2; width: 36px; height: 36px; }
  .met-meta { grid-column: 2 / span 2; grid-row: 2; height: 36px; font-size: 16px; }
  .met-busca { height: 40px; font-size: 16px; }
  .met-opcao { min-height: 44px; }
}
@keyframes met-folha-sobe { from { opacity: 0; transform: translateY(24px); } }
@media (prefers-reduced-motion: reduce) { .mesa-folha, .w-dica { animation: none; } .met-item, .w-ind, .w-ind-escolher { transition: none; } }
