:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #eaf0fb;
  --ink: #223442;
  --ink-soft: #5a6b78;
  --ink-faint: #8798a3;
  --line: #dce4ee;
  --accent: #0755f7;
  --accent-ink: #ffffff;
  --accent-soft: #e3ebfd;
  --teal: #0e8f86;
  --teal-soft: #e1f5f3;
  --danger: #d63a2c;
  --danger-soft: #fbe6e3;
  --ok: #1e9e5a;
  --ok-soft: #e4f6ec;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.5;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 960px; margin: 0 auto; padding: 24px; }
.wrap-narrow { max-width: 440px; margin: 0 auto; padding: 24px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.topbar .brand { font-weight: 700; letter-spacing: 0.02em; }
.topbar .brand span { color: var(--accent); }
.topbar nav { display: flex; gap: 18px; align-items: center; font-size: 14px; }
.topbar form { margin: 0; }
.topbar button.link {
  background: none; border: none; color: var(--ink-soft); cursor: pointer; font-size: 14px; font-family: inherit;
}
.topbar button.link:hover { color: var(--ink); }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 22px;
}
.card + .card { margin-top: 16px; }

h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 14px; }
.subtitle { color: var(--ink-soft); margin: 0 0 24px; font-size: 14px; }

label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; }
input[type="text"], input[type="password"], input[type="file"], textarea, select {
  width: 100%; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink);
  border-radius: 6px; padding: 10px 12px; font-size: 14px; font-family: inherit; margin-bottom: 16px;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); border-color: var(--accent); }

button, .btn {
  display: inline-block; background: var(--accent); color: var(--accent-ink); border: none;
  padding: 10px 18px; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
}
button:hover, .btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn-secondary { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.btn-danger { background: var(--danger); }
.btn-block { display: block; width: 100%; text-align: center; }

.error { background: var(--danger-soft); border: 1px solid var(--danger); color: #7a2318; padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }

.success { background: var(--ok-soft); border: 1px solid var(--ok); color: #145c34; padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.success strong { font-variant-numeric: tabular-nums; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-off { background: var(--danger-soft); color: var(--danger); }
.badge-wait { background: var(--accent-soft); color: var(--accent); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid a.tile {
  display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 20px; color: var(--ink); transition: border-color .15s;
}
.grid a.tile:hover { border-color: var(--accent); text-decoration: none; }
.tile .tile-title { font-weight: 700; font-size: 15px; }
.tile .tile-desc { font-size: 13px; color: var(--ink-soft); }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; color: var(--ink-faint); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: 0.04em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }

.msg-in { color: var(--teal); }
.msg-out { color: var(--accent); }

.stat-row { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; min-width: 110px; }
.stat .n { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 11px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.04em; }

.qr-box { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 20px 0; }
.qr-box img { width: 260px; height: 260px; border-radius: 8px; background: #fff; padding: 10px; border: 1px solid var(--line); }

.hint { font-size: 13px; color: var(--ink-faint); }
.progress-bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.progress-bar .fill { height: 100%; background: var(--accent); transition: width .3s; }

.brand-logo { display: block; margin: 0 auto 18px; height: 64px; width: auto; }
.topbar .brand { display: flex; align-items: center; gap: 8px; }
.topbar .brand-icon { height: 26px; width: auto; }

.footer { max-width: 960px; margin: 40px auto 0; padding: 20px 24px 32px; text-align: center; color: var(--ink-faint); font-size: 12px; border-top: 1px solid var(--line); }

.role-badge { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 8px; border-radius: 999px; }
.role-badge.admin { background: var(--accent-soft); color: var(--accent); }
.role-badge.user { background: var(--surface-2); color: var(--ink-soft); }

.password-field { position: relative; }
.password-field input { padding-right: 42px; }
.toggle-senha {
  position: absolute; right: 4px; top: 0; height: 100%; display: flex; align-items: center;
  background: none; border: none; cursor: pointer; font-size: 16px; padding: 0 10px;
  color: var(--ink-faint); line-height: 1;
}
.toggle-senha:hover { color: var(--ink-soft); }

.checkbox-row { display: flex; align-items: center; gap: 8px; margin: -6px 0 18px; font-size: 13px; color: var(--ink-soft); }
.checkbox-row input[type="checkbox"] { width: auto; margin: 0; }
.checkbox-row label { margin: 0; color: inherit; }
