/* ==========================================================================
   Opentrack: base visual (painel e laudo). A mesma linguagem do site da Open House:
   noite #0b0b0a, traço cor de maquete #c8c5b5 (o champanhe da logo) e um único acento,
   a luz âmbar de uma janela acesa. Nos mapas, o calor é essa luz.
   ========================================================================== */

:root {
  --noite: #0b0b0a;
  --grafite: #121110;
  --grafite-2: #1a1916;
  --grafite-3: #24221e;
  --concreto: #8e8b7f;
  --maquete: #c8c5b5;
  --gesso: #ebe8dc;
  --luz: #f3c98b;
  --brasa: #c9762a;
  --alerta: #e5664a;
  --salvia: #a9bf9c;

  --linha: rgba(200, 197, 181, 0.14);
  --linha-forte: rgba(200, 197, 181, 0.32);
  --luz-fraca: rgba(243, 201, 139, 0.14);

  --font: "Archivo", ui-sans-serif, system-ui, sans-serif;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
  --raio: 3px;

  --t-xs: 0.75rem;
  --t-sm: 0.8125rem;
  --t-base: 0.9375rem;
  --t-lg: 1.0625rem;
  --t-h3: 1.25rem;
  --t-h2: clamp(1.5rem, 2.1vw, 2rem);
  --t-h1: clamp(1.9rem, 3vw, 2.8rem);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--noite); scrollbar-width: thin; scrollbar-color: #3a3934 var(--noite); }
body {
  margin: 0;
  background: var(--noite);
  color: var(--maquete);
  font-family: var(--font);
  font-size: var(--t-base);
  font-weight: 350;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
::selection { background: var(--luz); color: var(--noite); }
:focus-visible { outline: 2px solid var(--luz); outline-offset: 2px; border-radius: 2px; }
[hidden] { display: none !important; }

/* ---------- tipografia ---------- */

.display {
  font-size: var(--t-h1);
  font-weight: 250;
  font-stretch: 125%;
  line-height: 1.08;
  letter-spacing: -0.012em;
  color: var(--gesso);
  text-wrap: balance;
}
.titulo {
  font-size: var(--t-h2);
  font-weight: 280;
  font-stretch: 118%;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--gesso);
  text-wrap: balance;
}
.subtitulo { font-size: var(--t-h3); font-weight: 400; font-stretch: 108%; line-height: 1.3; color: var(--gesso); }
.apoio { color: var(--concreto); max-width: 62ch; }
.pequeno { font-size: var(--t-sm); }
.mudo { color: var(--concreto); }
.forte { color: var(--gesso); font-weight: 450; }
.numero { font-stretch: 85%; font-weight: 300; color: var(--gesso); letter-spacing: -0.01em; }

/* ---------- botões e campos ---------- */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border: 1px solid var(--linha-forte);
  border-radius: var(--raio);
  background: transparent;
  font-size: var(--t-sm);
  font-weight: 420;
  font-stretch: 110%;
  color: var(--gesso);
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease), color 0.3s var(--ease);
}
.btn:hover { border-color: var(--maquete); background: rgba(200, 197, 181, 0.06); }
.btn--luz { background: var(--luz); border-color: var(--luz); color: #1a1408; font-weight: 520; }
.btn--luz:hover { background: #f7d6a3; border-color: #f7d6a3; }
.btn--perigo { border-color: rgba(229, 102, 74, 0.5); color: #f2a493; }
.btn--perigo:hover { border-color: var(--alerta); background: rgba(229, 102, 74, 0.08); }
.btn--mini { height: 32px; padding: 0 12px; font-size: var(--t-xs); }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

.campo { display: grid; gap: 6px; }
.campo > span { font-size: var(--t-sm); color: var(--maquete); }
.campo > small { font-size: var(--t-xs); color: var(--concreto); }
.entrada, select.entrada, textarea.entrada {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--linha-forte);
  border-radius: var(--raio);
  background: var(--grafite);
  color: var(--gesso);
  font-size: var(--t-base);
  transition: border-color 0.2s;
}
textarea.entrada { min-height: 96px; resize: vertical; line-height: 1.5; }
.entrada:hover { border-color: rgba(200, 197, 181, 0.5); }
.entrada:focus { outline: none; border-color: var(--luz); }
select.entrada { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--maquete) 50%), linear-gradient(135deg, var(--maquete) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }

/* seletor segmentado (aparelho, tipo de mapa) */
.segmentos { display: inline-flex; padding: 3px; border: 1px solid var(--linha); border-radius: calc(var(--raio) + 2px); background: var(--grafite); }
.segmentos button {
  height: 32px; padding: 0 14px; border: 0; border-radius: var(--raio); background: none;
  font-size: var(--t-sm); color: var(--concreto); cursor: pointer; white-space: nowrap;
}
.segmentos button:hover { color: var(--gesso); }
.segmentos button[aria-pressed="true"] { background: var(--grafite-3); color: var(--gesso); box-shadow: inset 0 0 0 1px var(--linha-forte); }

.chave { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--t-sm); }
.chave input { appearance: none; width: 34px; height: 20px; border-radius: 20px; background: var(--grafite-3); border: 1px solid var(--linha-forte); position: relative; cursor: pointer; transition: background 0.2s; flex: none; }
.chave input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--maquete); transition: transform 0.2s var(--ease), background 0.2s; }
.chave input:checked { background: rgba(243, 201, 139, 0.25); border-color: var(--luz); }
.chave input:checked::after { transform: translateX(14px); background: var(--luz); }

/* ---------- etiquetas de gravidade (sempre com texto, nunca só cor) ---------- */

.etiqueta { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 20px; font-size: var(--t-xs); font-weight: 450; white-space: nowrap; border: 1px solid; }
.etiqueta::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.etiqueta--3 { color: #f2a493; border-color: rgba(229, 102, 74, 0.45); background: rgba(229, 102, 74, 0.08); }
.etiqueta--2 { color: var(--luz); border-color: rgba(243, 201, 139, 0.4); background: rgba(243, 201, 139, 0.07); }
.etiqueta--1 { color: var(--maquete); border-color: var(--linha-forte); }
.etiqueta--acerto { color: var(--salvia); border-color: rgba(169, 191, 156, 0.4); background: rgba(169, 191, 156, 0.07); }
.etiqueta--obs { color: var(--maquete); border-color: var(--linha-forte); }

/* ---------- tabelas ---------- */

.tabela { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.tabela th { text-align: left; font-weight: 400; color: var(--concreto); padding: 0 12px 10px; border-bottom: 1px solid var(--linha-forte); white-space: nowrap; }
.tabela td { padding: 11px 12px; border-bottom: 1px solid var(--linha); vertical-align: top; }
.tabela th:first-child, .tabela td:first-child { padding-left: 0; }
.tabela .n { text-align: right; white-space: nowrap; }
.tabela tbody tr[data-acao] { cursor: pointer; }
.tabela tbody tr[data-acao]:hover td { background: rgba(200, 197, 181, 0.035); }
.rolavel { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* barra fina com ponta arredondada (alcance, partes do total) */
.barra { position: relative; height: 6px; border-radius: 3px; background: rgba(200, 197, 181, 0.08); overflow: hidden; }
.barra > i { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--luz); }
.barra--mudo > i { background: var(--maquete); opacity: 0.7; }

/* ficha técnica: rótulo à esquerda, valor à direita, linha fina entre os itens */
.ficha { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); column-gap: 40px; }
.ficha > div { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--linha); }
.ficha dt { color: var(--concreto); font-size: var(--t-sm); }
.ficha dd { font-size: 1.35rem; font-stretch: 88%; font-weight: 320; color: var(--gesso); white-space: nowrap; }
.ficha dd small { font-size: var(--t-xs); color: var(--concreto); font-stretch: 100%; margin-left: 6px; }

.cartao { border: 1px solid var(--linha); border-radius: 6px; background: var(--grafite); padding: 22px; }
.vazio { padding: 48px 24px; text-align: center; color: var(--concreto); border: 1px dashed var(--linha-forte); border-radius: 6px; }
.vazio strong { display: block; color: var(--gesso); font-weight: 450; margin-bottom: 6px; font-size: var(--t-lg); }

.aviso { padding: 12px 16px; border-left: 2px solid var(--luz); background: var(--luz-fraca); color: var(--gesso); font-size: var(--t-sm); border-radius: 0 var(--raio) var(--raio) 0; }
.aviso--erro { border-color: var(--alerta); background: rgba(229, 102, 74, 0.08); }

.dica-grafico {
  position: fixed; z-index: 50; pointer-events: none; max-width: 240px; padding: 9px 12px;
  background: rgba(18, 17, 16, 0.97); border: 1px solid var(--linha-forte); border-radius: 6px;
  font-size: var(--t-xs); line-height: 1.5; color: var(--maquete); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
.dica-grafico b { display: block; color: var(--gesso); font-weight: 500; font-size: var(--t-sm); }

.carregando { display: flex; align-items: center; gap: 12px; padding: 40px 0; color: var(--concreto); font-size: var(--t-sm); }
.carregando::before { content: ""; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--linha-forte); border-top-color: var(--luz); animation: girar 0.9s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }

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