:root {
  --bg: #0b0d12;
  --panel: #12151c;
  --panel-2: #181c26;
  --line: #242938;
  --text: #e9ecf3;
  --muted: #8b93a8;
  --red: #d62839;
  --red-2: #ef4352;
  --blue: #2a73e8;
  --blue-dark: #12326b;
  --green: #22b55e;
  --amber: #e0a526;
  --radius: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.hidden { display: none !important; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: .9rem; }
.right { margin-left: auto; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Layout ---------- */
.shell { min-height: 100dvh; display: grid; grid-template-columns: 1fr; }
.side { display: none; }
.main { padding: calc(1rem + var(--safe-t)) 1rem calc(5.5rem + var(--safe-b)); max-width: 1100px; width: 100%; margin: 0 auto; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex;
  background: rgba(18,21,28,.96); backdrop-filter: blur(8px); border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b); }
.tabbar a { flex: 1; display: grid; justify-items: center; gap: 2px; padding: .55rem .2rem;
  color: var(--muted); text-decoration: none; font-size: .7rem; }
.tabbar a.on { color: var(--red-2); }
.tabbar svg, .side svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }
.topbar { display: flex; align-items: center; gap: .7rem; margin-bottom: 1rem; }
.topbar img.logo { width: 38px; height: 38px; object-fit: contain; }
.topbar .t { font-weight: 700; letter-spacing: .02em; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  flex-wrap: wrap; margin-bottom: 1rem; }

@media (min-width: 860px) {
  .shell { grid-template-columns: 240px 1fr; }
  .side { display: flex; flex-direction: column; gap: .3rem; padding: 1.2rem .9rem; position: sticky;
    top: 0; height: 100dvh; background: var(--panel); border-right: 1px solid var(--line); }
  .side .brand { display: flex; align-items: center; gap: .6rem; padding: .2rem .5rem 1rem; }
  .side .brand img { width: 44px; height: 44px; object-fit: contain; }
  .side .brand b { display: block; line-height: 1.1; }
  .side a { display: flex; align-items: center; gap: .7rem; padding: .65rem .8rem; border-radius: 10px;
    color: var(--muted); text-decoration: none; }
  .side a:hover { background: var(--panel-2); color: var(--text); }
  .side a.on { background: rgba(214,40,57,.14); color: #fff; box-shadow: inset 3px 0 0 var(--red); }
  .side .foot { margin-top: auto; padding: .5rem; }
  .tabbar { display: none; }
  .main { padding: 1.6rem 2rem 2rem; }
  .topbar { display: none; }
}

/* ---------- Componentes ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.card.accent { border-color: rgba(214,40,57,.5); }
.card h2 { margin-bottom: .6rem; }
.grid { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.stat .v { font-size: 1.7rem; font-weight: 700; margin: .15rem 0; }
.stat .l { color: var(--muted); font-size: .85rem; }
.stat.ok .v { color: var(--green); } .stat.bad .v { color: var(--red-2); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 1px solid var(--line);
  background: var(--panel-2); border-radius: 10px; padding: .6rem 1rem; cursor: pointer; text-decoration: none;
  min-height: 42px; color: var(--text); }
.btn:hover { border-color: #3a4156; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--red-2); }
.btn.blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { border-color: rgba(214,40,57,.6); color: #ff8a94; }
.btn.sm { min-height: 34px; padding: .3rem .7rem; font-size: .88rem; }
.btn.block { width: 100%; }

label.f { display: grid; gap: .3rem; font-size: .86rem; color: var(--muted); }
label.f > span em { color: var(--red-2); font-style: normal; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date],
input[type=number], input[type=search], select, textarea {
  width: 100%; background: #0e1118; border: 1px solid var(--line); border-radius: 10px;
  padding: .62rem .75rem; min-height: 42px; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(42,115,232,.6); border-color: transparent; }
input[type=file] { color: var(--muted); font-size: .85rem; }
.form-grid { display: grid; gap: .8rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .form-grid.two { grid-template-columns: 1fr 1fr; } .form-grid .span2 { grid-column: span 2; } }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: 0; display: grid; gap: .8rem; }
legend { padding: 0 .4rem; color: var(--text); font-weight: 600; }
.check { display: flex; gap: .6rem; align-items: flex-start; color: var(--text); font-size: .9rem; }
.check input { margin-top: .25rem; width: 18px; height: 18px; accent-color: var(--red); flex: none; }
.radios { display: flex; gap: 1rem; }
.radios label { display: flex; gap: .4rem; align-items: center; color: var(--text); }

.tabs { display: flex; gap: .4rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: .6rem .9rem; color: var(--muted);
  cursor: pointer; white-space: nowrap; }
.tabs button.on { color: #fff; border-color: var(--red); }

/* ---------- Etiquetas (status sempre visíveis) ---------- */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .55rem; border-radius: 999px;
  font-size: .74rem; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.b-presidente { background: var(--red); color: #fff; }
.b-vice, .b-diretor_financeiro, .b-diretor_administrativo, .b-diretor_social {
  background: rgba(214,40,57,.16); color: #ff8e98; border-color: rgba(214,40,57,.55); }
.b-secretario { background: var(--blue-dark); color: #b9d2ff; border-color: #234c99; }
.b-sem_cargo { display: none; }
.b-escudado { background: #000; color: #fff; border-color: #fff; }
.b-meio_escudo { background: rgba(42,115,232,.18); color: #9cc2ff; border-color: rgba(42,115,232,.7); }
.b-prospero { background: transparent; color: var(--muted); border: 1px dashed #5d667c; }
.b-ativo { background: rgba(34,181,94,.15); color: #5fd68c; }
.b-inativo { background: rgba(139,147,168,.15); color: var(--muted); }
.b-pendente { background: rgba(224,165,38,.16); color: #f0c15a; }
.b-emdia, .b-paga { background: rgba(34,181,94,.15); color: #5fd68c; }
.b-atrasada { background: rgba(214,40,57,.18); color: #ff8e98; }
.b-em_analise { background: rgba(42,115,232,.18); color: #9cc2ff; }
.badges { display: flex; flex-wrap: wrap; gap: .3rem; }

/* ---------- Avatar, listas ---------- */
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--panel-2);
  display: grid; place-items: center; font-weight: 700; color: var(--muted); flex: none; border: 1px solid var(--line); }
.avatar.lg { width: 84px; height: 84px; font-size: 1.6rem; }
.list { display: grid; gap: .6rem; }
.item { display: flex; gap: .8rem; align-items: center; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .75rem .9rem; }
.item.click { cursor: pointer; }
.item.click:hover { border-color: #3a4156; }
.item .grow { flex: 1; min-width: 0; }
.item .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.kv { display: grid; grid-template-columns: 1fr; gap: .6rem .9rem; }
@media (min-width: 640px) { .kv { grid-template-columns: 1fr 1fr; } }
.kv div > small { display: block; color: var(--muted); font-size: .76rem; }
.kv div > span { word-break: break-word; }

/* ---------- Auth ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 1rem;
  background: radial-gradient(900px 500px at 50% -10%, rgba(42,115,232,.18), transparent 60%),
              radial-gradient(700px 400px at 90% 110%, rgba(214,40,57,.16), transparent 60%), var(--bg); }
.auth .box { width: 100%; max-width: 420px; display: grid; gap: 1rem; }
.auth .box.wide { max-width: 760px; }
.auth .logo { width: 150px; margin: 0 auto; display: block; }
.demo-banner { background: rgba(224,165,38,.12); border: 1px solid rgba(224,165,38,.5); color: #f0c15a;
  border-radius: 10px; padding: .6rem .8rem; font-size: .85rem; }
.notice { border: 1px solid var(--line); border-left: 3px solid var(--blue); border-radius: 10px; padding: .7rem .9rem;
  background: var(--panel); font-size: .9rem; }
.notice.warn { border-left-color: var(--amber); }
.notice.err { border-left-color: var(--red); }

/* ---------- Modal e toast ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.65); display: grid; place-items: end center;
  padding: 0; overflow-y: auto; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 18px 18px 0 0; width: 100%;
  max-width: 640px; max-height: 92dvh; overflow-y: auto; padding: 1.1rem 1.1rem calc(1.1rem + var(--safe-b)); }
.modal .head { display: flex; justify-content: space-between; align-items: start; gap: 1rem; margin-bottom: .8rem; }
@media (min-width: 640px) { .modal-bg { place-items: center; padding: 1rem; } .modal { border-radius: 16px; } }
#toast { position: fixed; left: 50%; bottom: calc(5rem + var(--safe-b)); transform: translateX(-50%); z-index: 80;
  display: grid; gap: .4rem; pointer-events: none; width: min(92vw, 420px); }
@media (min-width: 860px) { #toast { bottom: 1.5rem; } }
.toast { background: #1b2030; border: 1px solid var(--line); border-left: 3px solid var(--green); border-radius: 10px;
  padding: .65rem .9rem; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.toast.err { border-left-color: var(--red); }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--red); border-radius: 50%;
  animation: giro .8s linear infinite; margin: 2rem auto; }
@keyframes giro { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; min-height: 100dvh; }

table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; color: var(--muted); font-size: .78rem; font-weight: 600; padding: .5rem .7rem;
  border-bottom: 1px solid var(--line); }
table.t td { padding: .6rem .7rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: var(--panel-2); }
.only-desktop { display: none; } .only-mobile { display: block; }
@media (min-width: 860px) { .only-desktop { display: block; } .only-mobile { display: none; } }
