/* Componentes comuns. Tamanhos relativos (em): cada tela define a escala. */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--f-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 400; line-height: 1.2; text-wrap: balance; letter-spacing: -.005em; }
p { margin: 0; }
p + p { margin-top: .75em; }
strong, b { font-weight: 600; }
a { color: var(--accent); text-underline-offset: 3px; }
img { max-width: 100%; display: block; }
code { font-family: var(--f-mono); }
.tnum { font-variant-numeric: tabular-nums; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
/* títulos e caixas que recebem foco por script não são controles: sem anel */
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { outline: none; }

.sr {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus { left: 1em; top: 1em; z-index: 99; background: var(--accent); color: var(--accent-ink); padding: .6em 1em; border-radius: var(--r); }

/* botoes */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: var(--toque); padding: .55em 1.25em;
  font: inherit; font-weight: 600; line-height: 1.2; text-align: center; text-decoration: none;
  border-radius: 100px; border: 2px solid var(--accent);
  background: var(--accent); color: var(--accent-ink); cursor: pointer;
  transition: filter var(--dur) ease, background-color var(--dur) ease;
}
.btn:hover { filter: brightness(1.08); }
.btn.fantasma { background: transparent; color: var(--accent); }
.btn.fantasma:hover { background: var(--wash); filter: none; }
.btn.neutro { background: var(--surface); color: var(--ink); border-color: var(--rule-strong); }
.btn.neutro:hover { border-color: var(--accent); background: var(--wash); filter: none; }
.btn.pare { background: var(--stop); border-color: var(--stop); color: var(--stop-ink); }
.btn.pare.fantasma { background: transparent; color: var(--stop); }
.btn:disabled, .btn[aria-disabled="true"] {
  cursor: not-allowed; filter: none;
  background: var(--surface-3); border-color: var(--rule); color: var(--muted);
}
.acoes { display: flex; flex-wrap: wrap; gap: .75em; margin-top: 1.5em; }

/* campos */
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; font-weight: 600; }
.campo { display: block; margin-top: 1em; }
.campo > span { display: block; font-weight: 600; color: var(--ink-2); margin-bottom: .35em; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="number"], input:not([type]), select, textarea {
  width: 100%; min-height: var(--toque); font: inherit; padding: .55em .75em;
  border: 1px solid var(--rule-strong); border-radius: var(--r);
  background: var(--surface); color: var(--ink);
}
textarea { min-height: 7em; resize: vertical; line-height: 1.5; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }

/* avisos */
.nota {
  border-left: 3px solid var(--accent); background: var(--wash); color: var(--ink);
  padding: .85em 1em; border-radius: 0 var(--r) var(--r) 0;
}
.nota.atencao { border-color: var(--warn); background: var(--warn-wash); }
.nota.pare { border-color: var(--stop); background: var(--stop-wash); }
.nota > b:first-child, .nota > strong:first-child { display: block; margin-bottom: .2em; }

.erro-caixa {
  border: 2px solid var(--stop); background: var(--stop-wash); color: var(--ink);
  border-radius: var(--r); padding: 1em 1.1em; margin-bottom: 1.25em;
}
.erro-caixa h2 { font-family: var(--f-body); font-weight: 600; font-size: 1em; color: var(--stop); }
.erro-caixa p { margin-top: .35em; }
.erro-caixa .acoes { margin-top: .9em; }

.cartao {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r);
  padding: 1.25em 1.3em; box-shadow: var(--shadow);
}

/* tabela */
.tabela-rolagem { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
caption { text-align: left; color: var(--muted); font-weight: 600; padding-bottom: .6em; }
th, td { text-align: left; padding: .65em .75em; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
thead th { color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--rule); white-space: nowrap; }
tbody td { color: var(--ink-2); }

.entra { animation: entra .18s ease-out both; }
@keyframes entra { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
}

@media print {
  .faixa, .side, .acoes, .skip { display: none !important; }
  body { background: #fff; color: #000; }
}

/* estado "em ordem" — acrescentado ao template para o calendário e o cofre */
.nota.ok { border-color: var(--ok); background: var(--ok-wash); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
