/* ---------- Ligrupos · tema claro e neutro ---------- */
:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #111827;         /* preto-quase */
  --ink-2: #374151;
  --muted: #6b7280;
  --dim: #9ca3af;
  --line: #e6e8eb;
  --line-2: #eef0f2;
  --accent: #111827;      /* botão primário = preto */
  --accent-ink: #ffffff;
  --ok: #16a34a;
  --ok-bg: #eaf7ee;
  --warn: #d97706;
  --danger: #dc2626;
  --danger-bg: #fdecec;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  --shadow-lg: 0 10px 30px rgba(16,24,40,.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

#app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 240px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; padding: 0 8px 22px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--ink); color: #fff;
  display: grid; place-items: center; font-size: 14px; font-weight: 700;
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 10px;
  color: var(--ink-2); font-weight: 500; font-size: 14.5px;
  transition: background .15s;
}
.nav a .ico { font-size: 15px; width: 18px; text-align: center; color: var(--muted); }
.nav a:hover { background: var(--line-2); }
.nav a.active { background: var(--ink); color: #fff; }
.nav a.active .ico { color: #fff; }
.sidebar-foot { margin-top: auto; padding-top: 16px; }
.acc-status { font-size: 12.5px; color: var(--muted); padding: 0 8px; }
.acc-status .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

/* ---------- Content ---------- */
.content { flex: 1; padding: 34px 40px 60px; max-width: 1100px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.back { color: var(--muted); font-size: 13.5px; margin-bottom: 8px; display: inline-flex; gap: 6px; align-items: center; }
.back:hover { color: var(--ink); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--dim); background: #fafbfc; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: #000; }
.btn.danger { color: var(--danger); border-color: #f3d2d2; background: var(--danger-bg); }
.btn.danger:hover { background: #fbe0e0; }
.btn.sm { padding: 7px 11px; font-size: 13px; border-radius: 8px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--line-2); color: var(--ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); transition: box-shadow .18s, transform .18s;
}
.card.clickable { cursor: pointer; }
.card.clickable:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.camp-top { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.camp-dot { width: 12px; height: 12px; border-radius: 4px; margin-top: 5px; flex-shrink: 0; }
.camp-name { font-weight: 700; font-size: 17px; line-height: 1.25; }
.camp-desc { color: var(--muted); font-size: 13px; margin-top: 2px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; border-top: 1px solid var(--line-2); padding-top: 14px; }
.stat { text-align: center; }
.stat .n { font-size: 18px; font-weight: 700; }
.stat .l { font-size: 11px; color: var(--muted); margin-top: 2px; text-transform: uppercase; letter-spacing: .03em; }

/* ---------- Link rotativo ---------- */
.linkbox { display: flex; align-items: center; gap: 8px; background: var(--line-2); border-radius: 9px; padding: 8px 8px 8px 12px; margin-top: 14px; }
.linkbox code { font-size: 12.5px; color: var(--ink-2); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Sections / tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; flex-wrap: wrap; }
.tab { padding: 10px 16px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.section { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.section + .section { margin-top: 18px; }
.section h3 { margin: 0 0 4px; font-size: 16px; }
.section .hint { color: var(--muted); font-size: 13px; margin: 0 0 18px; }

/* ---------- Tables / lists ---------- */
.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 14px; padding: 13px 4px; border-bottom: 1px solid var(--line-2); }
.row:last-child { border-bottom: none; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 600; font-size: 14.5px; }
.row .meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.pill { font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 20px; background: var(--line-2); color: var(--ink-2); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: #fef3e2; color: var(--warn); }
.pill.danger { background: var(--danger-bg); color: var(--danger); }
.pill.dim { background: var(--line-2); color: var(--muted); }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink-2); }
.field .desc { font-size: 12px; color: var(--muted); margin: -2px 0 8px; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=datetime-local], textarea, select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 14px; font-family: inherit; color: var(--ink); background: #fff; transition: border .15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--ink); }
textarea { resize: vertical; min-height: 90px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; padding: 10px 0; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 12px; opacity: .5; }
.empty h3 { color: var(--ink); margin: 0 0 6px; font-size: 18px; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(17,24,39,.45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 480px; max-height: 90vh; overflow: auto; box-shadow: var(--shadow-lg); }
.modal.wide { max-width: 620px; }
.modal-head { padding: 22px 24px 0; display: flex; justify-content: space-between; align-items: flex-start; }
.modal-head h2 { margin: 0; font-size: 19px; }
.modal-head .x { cursor: pointer; color: var(--dim); font-size: 22px; line-height: 1; background: none; border: none; }
.modal-body { padding: 18px 24px 24px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 0 24px 24px; }

/* ---------- QR ---------- */
.qr-wrap { text-align: center; padding: 10px 0; }
.qr-wrap img { width: 260px; height: 260px; border-radius: 12px; border: 1px solid var(--line); }
.qr-wrap .status { margin-top: 14px; font-size: 14px; color: var(--muted); }
.spinner { width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--ink); border-radius: 50%; animation: spin 1s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Toast ---------- */
#toast-root { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast { background: var(--ink); color: #fff; padding: 13px 18px; border-radius: 11px; font-size: 14px; box-shadow: var(--shadow-lg); animation: slidein .2s; max-width: 340px; }
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }
@keyframes slidein { from { transform: translateY(10px); opacity: 0; } }

/* ---------- Misc ---------- */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.dot.ok { background: var(--ok); } .dot.off { background: var(--danger); } .dot.wait { background: var(--warn); }
.divider { height: 1px; background: var(--line-2); margin: 20px 0; }
.muted { color: var(--muted); }
.center-load { text-align: center; padding: 80px; }

/* ---------- Main wrap + banner impersonação ---------- */
.main-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#imp-banner:empty { display: none; }
.imp-bar {
  background: #111827; color: #fff; padding: 10px 40px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 13.5px;
}
.imp-bar b { color: #fff; }
.imp-bar .btn { background: #fff; color: #111827; border-color: #fff; padding: 6px 12px; }
.imp-bar .btn:hover { background: #f0f0f0; }

/* ---------- Login ---------- */
.login-bg { position: fixed; inset: 0; background: var(--bg); display: grid; place-items: center; z-index: 60; padding: 20px; }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); width: 100%; max-width: 400px; padding: 34px 32px; }
.login-card .brand { justify-content: center; font-size: 22px; padding-bottom: 8px; }
.login-card h1 { font-size: 20px; text-align: center; margin: 6px 0 4px; }
.login-card p.sub { text-align: center; color: var(--muted); font-size: 13.5px; margin: 0 0 24px; }
.login-card .btn.primary { width: 100%; padding: 13px; margin-top: 6px; }
.login-card .err { color: var(--danger); font-size: 13px; text-align: center; margin-top: 12px; min-height: 18px; }

/* ---------- Super Admin ---------- */
.super-badge { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #fff; background: #111827; padding: 3px 10px; border-radius: 20px; }
.client-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.client-card h3 { margin: 0 0 2px; font-size: 17px; }
.client-card .email { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.mini-stats { display: flex; gap: 18px; margin-bottom: 16px; }
.mini-stats div { font-size: 13px; color: var(--muted); }
.mini-stats b { display: block; font-size: 18px; color: var(--ink); font-weight: 700; }

@media (max-width: 760px) {
  .imp-bar { padding: 10px 18px; }
  .sidebar { width: 64px; padding: 18px 8px; }
  .brand span, .nav a span:not(.ico), .acc-status { display: none; }
  .nav a { justify-content: center; }
  .content { padding: 24px 18px 48px; }
  .two-col { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}
