:root {
  --bg: #0f1115;
  --card: #171a21;
  --line: #262b36;
  --text: #e8eaf0;
  --muted: #8b93a7;
  --accent: #25d366;
  --accent-ink: #06210f;
  --bad: #ff5c6c;
  --warn: #f5b73b;
  --radius: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.err { color: var(--bad); min-height: 1.4em; margin: 8px 0 0; }

/* login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); display: grid; gap: 10px; padding: 24px; }
.login-card h1 { font-size: 22px; margin-bottom: 6px; }

/* cabeçalho */
.top { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px 6px; max-width: 920px; margin: 0 auto; }
.brand { font-size: 17px; flex: 1; }
.tabs { display: flex; gap: 4px; padding: 0 12px 8px; overflow-x: auto; max-width: 920px; margin: 0 auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; padding: 7px 14px; border-radius: 999px; border: 1px solid transparent;
  background: none; color: var(--muted); font: inherit; cursor: pointer;
}
.tab[aria-current="page"] { background: var(--card); color: var(--text); border-color: var(--line); }
.tab:focus-visible, .btn:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.pill { font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.pill.ok { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.pill.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.pill.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }

/* conteúdo */
.view { max-width: 920px; margin: 0 auto; padding: 16px; display: grid; gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.stack { display: grid; gap: 10px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.tile b { display: block; font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile span { color: var(--muted); font-size: 13px; }

.code { font: 700 32px/1.1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; padding: 14px 16px; background: var(--bg); border: 1px dashed var(--accent); border-radius: 10px; text-align: center; user-select: all; }
.qr { background: #fff; padding: 8px; border-radius: 10px; width: 280px; max-width: 100%; height: auto; }

/* listas */
.list { display: grid; gap: 8px; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.item .title { font-weight: 600; overflow-wrap: anywhere; }
.item .sub { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); margin-left: 6px; vertical-align: 1px; }
.badge.bad { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }
.badge.ok { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }

/* controles */
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], input[type=tel], textarea {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; font: inherit;
}
textarea { resize: vertical; min-height: 90px; line-height: 1.45; }
.btn {
  font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 9px; cursor: pointer;
  background: var(--card); color: var(--text); border: 1px solid var(--line); min-height: 40px;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--bad); }
.btn.ghost { background: none; }
.btn.small { padding: 5px 12px; min-height: 32px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: background .15s; pointer-events: none; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 20px); opacity: 0;
  background: #222836; border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px;
  transition: .2s; pointer-events: none; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: var(--bad); color: var(--bad); }

.empty { text-align: center; color: var(--muted); padding: 28px 12px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
