/* Sistema visual do Ponto do Gabinete — tokens, base e componentes compartilhados.
   Fonte do sistema (funciona sem internet). Modo escuro automático. */
:root {
  color-scheme: light dark;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bg: #f3f5f9; --surface: #ffffff; --surface-2: #f8fafc;
  --text: #0f172a; --muted: #475569;
  --border-soft: #e2e8f0; --control-border: #64748b;
  --brand: #1e3a8a; --on-brand: #ffffff;
  --action: #1d4ed8; --action-hover: #1e40af; --on-action: #ffffff;
  --late: #b45309; --late-hover: #92400e;
  --ok-bg: #dcfce7; --ok: #14532d;
  --warn-bg: #fef3c7; --warn: #78350f;
  --bad-bg: #fee2e2; --bad: #7f1d1d; --bad-solid: #b91c1c;
  --info-bg: #dbeafe; --info: #1e3a8a;
  --neu-bg: #e2e8f0; --neu: #1e293b;
  --ring: #1d4ed8; --scrim: rgba(15, 23, 42, .6);
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 14px rgba(15, 23, 42, .06);
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220; --surface: #131c2e; --surface-2: #182338;
    --text: #e8edf7; --muted: #a8b5c9;
    --border-soft: #26344d; --control-border: #8a9bb5;
    --brand: #0f1b3d;
    --action: #2563eb; --action-hover: #1d4ed8;
    --ok-bg: #0f3d24; --ok: #86efac;
    --warn-bg: #432a07; --warn: #fcd34d;
    --bad-bg: #4a1414; --bad: #fca5a5; --bad-solid: #f87171;
    --info-bg: #172554; --info: #bfdbfe;
    --neu-bg: #26344d; --neu: #cbd5e1;
    --ring: #93c5fd; --scrim: rgba(0, 0, 0, .72);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--text); background: var(--bg); min-height: 100vh; padding-bottom: env(safe-area-inset-bottom); }
h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 6px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--surface); color: var(--text); padding: 8px 14px; border-radius: var(--r-sm); z-index: 100; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ícones (SVG, traço 2px, um só estilo) */
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic-sm { width: 16px; height: 16px; } .ic-lg { width: 24px; height: 24px; }

/* barra superior */
.appbar { background: var(--brand); color: var(--on-brand); padding: calc(12px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left)); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; gap: 12px; align-items: center; min-width: 0; }
.logo { width: 40px; height: 40px; border-radius: 12px; background: rgba(255, 255, 255, .16); display: grid; place-items: center; flex: none; }
.brand-name { font-weight: 700; font-size: 16px; line-height: 1.25; }
.brand-sub { font-size: 13px; opacity: .92; }
.appbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 16px; border-radius: var(--r-md); border: 1.5px solid transparent; font-weight: 600; line-height: 1.2; cursor: pointer; text-decoration: none; transition: background-color .15s, border-color .15s, filter .15s, opacity .15s; -webkit-tap-highlight-color: transparent; }
.btn:active { filter: brightness(.9); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--action); color: var(--on-action); } .btn-primary:hover:not([disabled]) { background: var(--action-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--control-border); } .btn-secondary:hover:not([disabled]) { background: var(--surface-2); }
.btn-late { background: var(--late); color: #fff; } .btn-late:hover:not([disabled]) { background: var(--late-hover); }
.btn-onbrand { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .6); } .btn-onbrand:hover { background: rgba(255, 255, 255, .14); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-block { width: 100%; }
.btn.icon { padding: 0; width: 44px; flex: none; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 14px; }
@media (pointer: coarse), (max-width: 720px) { .btn-sm { min-height: 44px; } }

/* selos de situação: sempre ícone + texto, nunca só cor */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 3px 10px 3px 8px; border-radius: 999px; white-space: nowrap; line-height: 1.4; }
.b-ok { background: var(--ok-bg); color: var(--ok); } .b-warn { background: var(--warn-bg); color: var(--warn); }
.b-bad { background: var(--bad-bg); color: var(--bad); } .b-info { background: var(--info-bg); color: var(--info); }
.b-neu { background: var(--neu-bg); color: var(--neu); }

/* formulários */
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.field > label, .lbl-strong { font-size: 14px; font-weight: 600; }
.input { width: 100%; min-height: 48px; padding: 10px 14px; border: 1.5px solid var(--control-border); border-radius: var(--r-md); background: var(--surface); font-size: 16px; }
.input:focus-visible { outline: 3px solid var(--ring); outline-offset: 1px; border-color: var(--ring); }
.input[aria-invalid="true"] { border-color: var(--bad-solid); }
textarea.input { min-height: 88px; resize: vertical; }
.hint { font-size: 13px; color: var(--muted); }
.field-error { display: flex; gap: 8px; align-items: flex-start; background: var(--bad-bg); color: var(--bad); padding: 10px 12px; border-radius: var(--r-sm); font-size: 14px; font-weight: 600; margin-top: 12px; }

/* cartões, carregamento, avisos */
.card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow); }
.spin { width: 18px; height: 18px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--border-soft), var(--surface-2), var(--border-soft)); background-size: 200% 100%; animation: sk 1.3s ease-in-out infinite; border-radius: var(--r-sm); }
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.banner { background: var(--warn-bg); color: var(--warn); padding: 10px 16px; display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; font-weight: 600; font-size: 14px; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 24px 12px; color: var(--muted); }
.empty-state .ic { width: 32px; height: 32px; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: var(--r-md); font-size: 14px; font-weight: 600; z-index: 80; max-width: 92vw; display: flex; gap: 8px; align-items: center; box-shadow: var(--shadow); }

/* janelas (diálogos) */
.scrim { position: fixed; inset: 0; background: var(--scrim); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.dialog { background: var(--surface); border-radius: var(--r-lg); padding: 24px; width: 100%; max-width: 480px; max-height: 92vh; overflow: auto; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
.dialog h2 { font-size: 20px; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
@media (max-width: 600px) {
  .scrim { align-items: flex-end; padding: 0; }
  .dialog { border-radius: 20px 20px 0 0; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .dialog-actions { flex-direction: column-reverse; } .dialog-actions .btn { width: 100%; }
}

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