/* Base: reset leve, tipografia e utilitários de layout. */

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--label);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.no-scroll { overflow: hidden; }
#root { height: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Barras de rolagem discretas, como no macOS */
* { scrollbar-width: thin; scrollbar-color: var(--separator-strong) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--separator-strong); border-radius: 9px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--label-3); border: 2px solid transparent; background-clip: padding-box; }

/* Campos numéricos sem os spinners do navegador (o valor é digitado) */
input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { appearance: none; margin: 0; }
button { cursor: pointer; }
a { color: var(--blue); text-decoration: none; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0; }

/* Utilitários */
.muted { color: var(--label-2); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.gap-4 { gap: 4px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; }
.hidden { display: none !important; }
.error-text { color: var(--red); font-size: 12.5px; }
.hint { font-size: 12px; color: var(--label-2); }

/* Boot / spinner */
.boot { height: 100%; min-height: 200px; display: grid; place-content: center; text-align: center; gap: 12px; color: var(--label-2); }
.spinner {
  width: 22px; height: 22px; margin: 0 auto;
  border: 2.5px solid var(--separator); border-top-color: var(--blue); border-radius: 50%;
  animation: spin .8s linear infinite;
}
.spinner.sm { width: 14px; height: 14px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toasts */
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; pointer-events: none; }
.toast { pointer-events: auto; padding: 10px 16px; border-radius: 12px; background: var(--label); color: var(--bg); font-size: 13px; font-weight: 500; box-shadow: var(--shadow); animation: rise .2s ease-out; max-width: 520px; }
.toast.error { background: var(--red); color: #fff; }
.toast.success { background: var(--green); color: #fff; }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* Falha de renderização (error boundary) */
.crash { margin: 24px auto; max-width: 720px; padding: 18px 20px; border-radius: var(--radius); background: var(--tint-red); color: var(--red); }
.crash pre { margin: 10px 0 0; white-space: pre-wrap; font-family: var(--mono); font-size: 12px; color: var(--label); }
