:root {
  --bg: #f4f5f7;
  --bg-2: #ffffff;
  --bg-3: #eceef2;
  --line: #dde0e6;
  --text: #14171c;
  --text-2: #555c68;
  --text-3: #8a909b;
  --accent: #2563eb;
  --accent-text: #ffffff;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --err: #b91c1c;
  --err-bg: #fee2e2;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 20, 30, .06), 0 2px 8px rgba(15, 20, 30, .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1116;
    --bg-2: #161a21;
    --bg-3: #1e232c;
    --line: #2a303b;
    --text: #eef0f3;
    --text-2: #a9b0bc;
    --text-3: #6f7784;
    --accent: #3b82f6;
    --ok: #4ade80;
    --ok-bg: #12301f;
    --warn: #fbbf24;
    --warn-bg: #33270c;
    --err: #f87171;
    --err-bg: #3a1515;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1116;
  --bg-2: #161a21;
  --bg-3: #1e232c;
  --line: #2a303b;
  --text: #eef0f3;
  --text-2: #a9b0bc;
  --text-3: #6f7784;
  --accent: #3b82f6;
  --ok: #4ade80;
  --ok-bg: #12301f;
  --warn: #fbbf24;
  --warn-bg: #33270c;
  --err: #f87171;
  --err-bg: #3a1515;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3 { line-height: 1.2; margin: 0; }
a { color: var(--accent); }
[hidden] { display: none !important; }

button, .btn {
  font: inherit;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  min-height: 40px;
}
button:hover, .btn:hover { background: var(--bg-3); }
button:disabled { opacity: .5; cursor: default; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--err); }
button.small { min-height: 32px; padding: 5px 10px; font-size: 13px; }
button.ghost { background: transparent; border-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  min-height: 40px;
  width: 100%;
}
textarea { font-family: var(--mono); font-size: 12px; min-height: 90px; }
label { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: var(--text-2); }

.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-3);
  color: var(--text-2);
  white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--err-bg); color: var(--err); }

.muted { color: var(--text-2); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.stack { display: grid; gap: 12px; }

.toast-area {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  z-index: 100;
  width: min(92vw, 440px);
}
.toast {
  background: #111827;
  color: #fff;
  padding: 11px 14px;
  border-radius: 10px;
  font-weight: 600;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .3);
  animation: toast-in .18s ease-out;
}
.toast.err { background: #991b1b; }
.toast.ok { background: #166534; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- tela de entrada / login ---------- */
.entrada {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.entrada .card { width: min(100%, 420px); padding: 26px; display: grid; gap: 16px; }
.marca { display: flex; align-items: center; gap: 10px; }
.marca-icone {
  width: 38px; height: 38px; border-radius: 10px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 18px; flex: none;
}
.marca h1 { font-size: 19px; }
.marca p { margin: 0; font-size: 13px; color: var(--text-2); }
.abas { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--bg-3); padding: 4px; border-radius: 9px; }
.abas button { border: 0; background: transparent; min-height: 36px; color: var(--text-2); }
.abas button[aria-selected="true"] { background: var(--bg-2); color: var(--text); box-shadow: var(--shadow); }
.erro-form { color: var(--err); font-size: 13px; font-weight: 600; min-height: 18px; margin: 0; }
