/* Escalas e componentes compartilhados pelas telas. */
:root {
  --esp-1: 4px;
  --esp-2: 8px;
  --esp-3: 12px;
  --esp-4: 16px;
  --esp-5: 24px;
  --esp-6: 32px;
  --raio-p: 6px;
  --raio-m: 10px;
  --raio-g: 14px;
  --fonte-pp: 11px;
  --fonte-p: 12px;
  --fonte-m: 14px;
  --fonte-g: 16px;
  --fonte-gg: 20px;
  --fonte-xl: 28px;
  --botao-p: 28px;
  --botao-m: 36px;
  --botao-g: 48px;
}

html { background: var(--fundo); -webkit-text-size-adjust: 100%; }
body:not(.tv):not(.leve) { background-image: radial-gradient(ellipse at 14% 0, var(--brilho), transparent 60%); }
:where(*) { scrollbar-width: thin; scrollbar-color: var(--barra) transparent; }
:where(*):hover { scrollbar-color: var(--barra-ativa) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--barra); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--barra-ativa); }

:where(button, a, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--foco);
  outline-offset: 2px;
}
input:focus, select:focus, textarea:focus { outline-color: var(--foco); }
button, a, summary { touch-action: manipulation; }
button { -webkit-tap-highlight-color: transparent; }
:where(input, select, textarea) { color-scheme: inherit; max-width: 100%; }
input::placeholder, textarea::placeholder { color: var(--texto-3); opacity: 1; }
select:not([multiple]):not([size]) {
  appearance: none;
  padding-inline-end: 28px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--texto-2) 50%),
    linear-gradient(135deg, var(--texto-2) 50%, transparent 50%);
  background-position: right 15px center, right 10px center;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.tab-edit select:not([multiple]):not([size]) { padding-inline-end: 28px; }
input:is([type="checkbox"], [type="radio"]) { accent-color: var(--primaria-borda); }
input[type="file"] { font-size: var(--fonte-p); }
input::file-selector-button {
  background: var(--superficie-3);
  color: var(--texto-1);
  border: 1px solid var(--borda);
  border-radius: var(--raio-p);
  padding: var(--esp-1) var(--esp-2);
  margin-inline-end: var(--esp-2);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn {
  min-block-size: var(--botao-m);
  border-radius: var(--raio-m);
}
.btn.peq { min-block-size: var(--botao-p); }
.btn.pri { background-color: var(--primaria); border-color: var(--primaria-borda); color: var(--branco); }
.btn.ok { background-color: var(--sucesso); border-color: var(--sucesso); color: var(--branco); }
.btn.perigo { background-color: var(--perigo); border-color: var(--perigo); color: var(--branco); }
.btn.fantasma { background: transparent; color: var(--texto-1); }
.btn.pendente { background-color: var(--aviso); border-color: var(--aviso); color: var(--branco); }
.topo .quem button { color: var(--texto-1); }

.card, .kpis > div, .ficha, .modal .caixa, .conta,
.menu-pessoas > div, .tema-menu > .tema-controle, .fc-mmenu, .rel-c,
.kc, .cc, .mq, .fl-ch, .ac-lista {
  --fundo-vidro: var(--vidro);
  background-color: var(--superficie-1);
  border-color: var(--borda-vidro);
  box-shadow: 0 8px 22px var(--sombra);
}
.topo, .cel-topo {
  --fundo-vidro: var(--vidro-topo);
  background-color: var(--fundo);
  box-shadow: 0 4px 14px var(--sombra);
}
.card, .kpis > div, .conta, .rel-c { border-radius: var(--raio-g); }
@supports (backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px)) {
  body:not(.tv):not(.leve):not(.com-ficha) :is(.card, .kpis > div, .modal .caixa, .conta,
    .menu-pessoas > div, .tema-menu > .tema-controle, .fc-mmenu, .rel-c, .kc, .cc, .mq, .fl-ch, .ac-lista, .topo, .cel-topo) {
    background-color: var(--fundo-vidro);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
}

.ficha-fundo > .ficha { background-color: var(--superficie-1); }

:where(.modal, .ficha-fundo, .conta-fundo, dialog) { overscroll-behavior: contain; }
.modal { overflow: hidden; }
.modal .caixa { max-height: 92vh; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; }
.modal .caixa > header { position: sticky; top: 0; z-index: 2; }
.modal .caixa > footer { position: sticky; bottom: 0; z-index: 2; }
body:has(> .modal:not(.oculto):not([hidden])), body:has(> .conta-fundo) { overflow: hidden; }
.conta { overscroll-behavior: contain; }
.quadro { align-items: start; }
.quadro .kol-c { max-height: none; overflow: visible; }
.pr-corpo .pr-lado, .qr-lista { max-height: none; overflow: visible; }
.tab-wrap {
  max-height: none;
  max-width: 100%;
  overflow-x: auto;
  background:
    linear-gradient(to right, var(--p1) 30%, transparent),
    linear-gradient(to left, var(--p1) 30%, transparent) right,
    linear-gradient(to right, var(--sombra), transparent),
    linear-gradient(to left, var(--sombra), transparent) right;
  background-repeat: no-repeat;
  background-size: 30px 100%, 30px 100%, 10px 100%, 10px 100%;
  background-attachment: local, local, scroll, scroll;
}
:is(.tab-wrap, .quadro) > :first-child { min-width: 0; }

.chip-cor { background-color: var(--c); color: var(--t); border: 1px solid var(--cor-origem); white-space: normal; overflow-wrap: anywhere; }
button.fc-st, button.fc-conf { border-color: var(--cor-origem); }
[data-tema="claro"] :is(button.fc-st, button.fc-conf) { border-color: var(--borda); }
[data-tema] .fc-st:focus-visible { outline-color: var(--foco); }
[data-tema="claro"] .chip-cor { border-color: color-mix(in srgb, var(--cor-origem), var(--tinta) 33%); }
.usuario-topo { display: flex; align-items: center; gap: var(--esp-2); min-width: 0; }
.tema-menu { position: relative; }
.tema-menu summary {
  cursor: pointer;
  border: 1px solid var(--borda);
  border-radius: var(--raio-p);
  padding: var(--esp-1) var(--esp-2);
  color: var(--texto-1);
}
.tema-menu > .tema-controle {
  position: absolute;
  right: 0;
  z-index: 3;
  min-width: 170px;
  margin-block-start: var(--esp-1);
  padding: var(--esp-3);
  border: 1px solid var(--borda);
  border-radius: var(--raio-m);
}
.tema-controle small { display: block; color: var(--sucesso-texto); }
.tema-controle small.erro { color: var(--perigo-texto); }
.tema-controle small:not(:empty) { margin-top: var(--esp-1); }
.conta .tema-controle { padding: var(--esp-2); border: 1px solid var(--borda); border-radius: var(--raio-m); }
.pg-cel:has(.cel-rodape) .usuario-topo { display: none; }

.componentes-vazio { color: var(--texto-2); text-align: center; padding: var(--esp-5); }
.esqueleto {
  display: block;
  color: var(--texto-2);
  background: var(--superficie-2);
  border-radius: var(--raio-p);
  padding: var(--esp-2) var(--esp-3);
}

@media (max-width: 600px) {
  .usuario-topo { margin-inline-start: auto; flex-wrap: wrap; }
  .pg-cel :is(input:not([type="file"]), select, textarea) { font-size: var(--fonte-g); }
  .pg-cel .btn.grande { min-block-size: var(--botao-g); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-property: opacity !important;
    animation: none !important;
  }
}

@media print {
  body { background-image: none !important; }
  body :is(.card, .ficha, .rel-c, .modal .caixa) {
    background-color: var(--papel);
    color: var(--tinta);
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
