/* Componentes básicos — só usam tokens de tokens.css */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 400 var(--t-md)/1.45 var(--f-sans); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--f-mono); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }

/* Botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: var(--hit); padding: 0 14px; white-space: nowrap; border: 1px solid transparent; border-radius: var(--r-md); background: transparent; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn--primary { background: var(--acc); color: var(--on-acc); font-weight: 700; }
.btn--secondary { border-color: var(--line); background: var(--surf); }
.btn--soft { background: var(--acc-soft); color: var(--acc-ink); font-weight: 700; }
.btn--ghost { color: var(--ink-2); }
.btn--danger { background: var(--bad); color: var(--surf); font-weight: 700; }
.btn--lg { min-height: 54px; font-size: var(--t-lg); }
.btn--block { width: 100%; }
.btn--split { justify-content: space-between; }
.btn:disabled { background: var(--surf-2); color: var(--ink-2); border-color: transparent; cursor: not-allowed; }
.btn-icon { width: var(--hit); padding: 0; }
kbd { font: 500 var(--t-xs) var(--f-mono); border: 1px solid currentColor; border-radius: 6px; padding: 1px 7px; opacity: 0.8; }

/* Selos de status */
.badge { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; border-radius: 7px; font-size: var(--t-sm); font-weight: 600; white-space: nowrap; }
.tone-ok { background: var(--ok-bg); color: var(--ok); }
.tone-bad { background: var(--bad-bg); color: var(--bad); }
.tone-warn { background: var(--warn-bg); color: var(--warn); }
.tone-info { background: var(--info-bg); color: var(--info); }
.tone-mute { background: var(--mute-bg); color: var(--mute); }
.fg-ok { color: var(--ok); } .fg-bad { color: var(--bad); } .fg-warn { color: var(--warn); } .fg-mute { color: var(--ink-2); } .fg-acc { color: var(--acc-ink); }
.tone-acc { background: var(--acc-soft); color: var(--acc-ink); }

/* Frescor */
.fresh { display: inline-flex; align-items: center; gap: 7px; font-size: var(--t-sm); font-weight: 600; color: var(--ink-2); }
.fresh::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--fresh-dot, var(--ok)); }
.fresh--warn { color: var(--warn); --fresh-dot: var(--warn); }
.fresh--bad { color: var(--bad); --fresh-dot: var(--bad); }
.fresh--mute { --fresh-dot: var(--ink-2); }
.fresh--acc { --fresh-dot: var(--acc); }
.banner { padding: 10px var(--s-4); font-size: 14px; font-weight: 600; }

/* Campos */
.field { position: relative; display: flex; align-items: center; }
.field svg { position: absolute; left: 14px; color: var(--ink-2); pointer-events: none; }
.field kbd { position: absolute; right: 10px; color: var(--ink-2); display: none; }
@media (min-width: 1024px) { .field kbd { display: inline; } }
/* Celular: busca fica fixa no topo da lista ao rolar */
.search-sticky { position: sticky; top: 0; z-index: 1; padding: 6px 0; background: var(--bg); }
@media (min-width: 1024px) { .search-sticky { position: static; padding: 0; } }
.input { width: 100%; height: 46px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surf); padding: 0 var(--s-4); font-size: 16px; }
.field .input { padding-left: 42px; }
/* text-indent compensa o espaçamento que sobra depois do último dígito, para centralizar de verdade. */
.input--code { height: 64px; border: 2px solid var(--acc); font: 600 30px var(--f-mono); letter-spacing: 0.45em; text-align: center; text-indent: 0.45em; }
.input--error { border-color: var(--bad); }

/* Cartões, listas e vazios */
.card { background: var(--surf); border: 1px solid var(--line); border-radius: var(--r-lg); }
.list { display: flex; flex-direction: column; overflow: hidden; }
.empty { margin: 0; padding: var(--s-6) var(--s-4); border: 1px dashed var(--line); border-radius: var(--r-lg); color: var(--ink-2); text-align: center; }
.skel { border-radius: var(--r-md); background: var(--skel); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }
.alert { padding: var(--s-3) 14px; border-radius: var(--r-md); font-size: 14px; line-height: 1.45; }

/* Diálogo: bottom sheet no celular, modal centrado no desktop */
dialog.sheet { border: 0; padding: 0; max-width: none; width: 100%; margin: auto 0 0; background: var(--surf); color: var(--ink); border-radius: var(--r-xl) var(--r-xl) 0 0; max-height: 92vh; }
dialog.sheet::backdrop { background: var(--scrim); }
.sheet__grab { display: block; width: 40px; height: 5px; margin: var(--s-2) auto 0; border-radius: 3px; background: var(--line); }
.sheet__body { padding: var(--s-3) var(--s-5) 28px; display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 1024px) {
  dialog.sheet { margin: auto; width: min(780px, calc(100% - 32px)); border-radius: var(--r-xl); }
  dialog.sheet--sm { width: min(520px, calc(100% - 32px)); }
  .sheet__grab { display: none; }
  .sheet__body { padding: var(--s-6); }
}
