/* ==========================================================================
   ABLACC · Folha de Estilos do Sistema Administrativo & Componentes Base
   Design System Editorial & Acadêmico Premium (WCAG 2.1 AA/AAA Compliant)
   ========================================================================== */

:root {
  /* Escala Heráldica: Azul Marinho Acadêmico */
  --brand:         #0b254e;
  --brand-950:     #06152d;
  --brand-600:     #123774;
  --brand-500:     #1a4c9c;
  --brand-50:      #eef3fa;

  /* Escala Heráldica: Ouro Caatinga */
  --accent:        #e8b632;
  --accent-hover:  #f0c246;
  --accent-text:   #8d5a04;
  --accent-border: #d4a017;
  --accent-light:  #fbf6e8;

  /* Superfícies & Textos */
  --ink:           #0f172a;
  --ink-soft:      #334155;
  --muted:         #526077;
  --line:          #e2e8f0;
  --line-strong:   #cbd5e1;
  --bg:            #f7f9fc;
  --card:          #ffffff;

  /* Estados Funcionais */
  --ok:            #15803d;
  --ok-bg:         #f0fdf4;
  --ok-line:       #bbf7d0;

  --err:           #b91c1c;
  --err-bg:        #fef2f2;
  --err-line:      #fecaca;

  --warn:          #b45309;
  --warn-bg:       #fffbeb;
  --warn-line:     #fde68a;

  --info:          #1d4ed8;
  --info-bg:       #eff6ff;
  --info-line:     #bfdbfe;

  /* Geometria & Elevação */
  --radius-sm:     8px;
  --radius:        14px;
  --radius-lg:     20px;
  --radius-full:   9999px;

  --shadow-xs:     0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow:        0 1px 3px rgba(15, 23, 42, 0.05), 0 8px 24px -4px rgba(15, 23, 42, 0.06);
  --shadow-md:     0 4px 12px rgba(15, 23, 42, 0.07), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-lg:     0 14px 34px -4px rgba(15, 23, 42, 0.12);

  --transition:    all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--brand); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--brand-500); }

h1, h2, h3, h4 {
  margin: 0;
  color: var(--ink);
  letter-spacing: -0.02em;
  font-weight: 700;
}

/* ==========================================================================
   Botões Premium
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font: 600 14px inherit;
  cursor: pointer;
  background: var(--brand);
  color: #ffffff;
  transition: var(--transition);
  box-shadow: var(--shadow-xs);
  line-height: 1.3;
}
.btn:hover {
  background: var(--brand-600);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  color: #ffffff;
}
.btn:active {
  transform: translateY(0);
}
.btn.ghost {
  background: #ffffff;
  color: var(--brand);
  border: 1px solid var(--line);
}
.btn.ghost:hover {
  background: var(--brand-50);
  border-color: var(--brand);
}
.btn.danger {
  background: var(--err);
  color: #ffffff;
}
.btn.danger:hover {
  background: #991b1b;
}
.btn.gold {
  background: var(--accent);
  color: var(--brand-950);
  font-weight: 700;
}
.btn.gold:hover {
  background: var(--accent-hover);
  color: var(--brand-950);
}
.btn.sm {
  padding: 6px 13px;
  font-size: 13px;
  border-radius: 6px;
}

[hidden] { display: none !important; }

/* ==========================================================================
   Formulários & Campos
   ========================================================================== */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}
.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}
.field input, .field select, .field textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font: inherit;
  color: var(--ink);
  background: #ffffff;
  outline: 0;
  transition: var(--transition);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.02);
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(11, 37, 78, 0.12);
}
.field small { color: var(--muted); font-size: 12px; }

/* ==========================================================================
   Alertas & Notificações
   ========================================================================== */
.alert {
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 14px;
  border: 1px solid;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert.error {
  background: var(--err-bg);
  color: var(--err);
  border-color: var(--err-line);
}
.alert.success {
  background: var(--ok-bg);
  color: var(--ok);
  border-color: var(--ok-line);
}
.alert.info {
  background: var(--info-bg);
  color: var(--info);
  border-color: var(--info-line);
}
.alert.warn {
  background: var(--warn-bg);
  color: var(--warn);
  border-color: var(--warn-line);
}

/* ==========================================================================
   Cards & Superfícies
   ========================================================================== */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  transition: var(--transition);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  background: var(--brand-50);
  color: var(--brand);
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.off { background: #f1f5f9; color: var(--muted); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }

/* ==========================================================================
   Tabelas
   ========================================================================== */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th {
  text-align: left;
  color: var(--muted);
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #fafbfd;
}
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--ink-soft);
}
tr:hover td { background: #f8fafc; }
tr:last-child td { border-bottom: 0; }

/* ==========================================================================
   Autenticação / Login
   ========================================================================== */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
}
.auth-side {
  background:
    radial-gradient(900px 500px at 90% 0, rgba(232, 182, 50, 0.16), transparent),
    linear-gradient(155deg, #06152d, var(--brand) 55%, #16418a) !important;
  color: #ffffff;
  padding: 64px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.auth-side h2 {
  font-family: 'Cormorant Garamond', Garamond, serif;
  font-size: 40px;
  line-height: 1.15;
  max-width: 440px;
  color: #ffffff;
}
.auth-side p {
  opacity: 0.88;
  max-width: 440px;
  line-height: 1.65;
  color: #cbd5e1;
}
.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: #ffffff;
}
.auth-box {
  width: 100%;
  max-width: 420px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
}
.logo i {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  display: grid;
  place-items: center;
  color: var(--brand-950);
  font-style: normal;
  font-weight: 800;
}
@media (max-width: 880px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}

/* ==========================================================================
   Painel Administrativo: Shell & Sidebar
   ========================================================================== */
.shell {
  display: grid;
  grid-template-columns: 268px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--brand-950) !important;
  color: #cbd5e1;
  padding: 20px 14px 28px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar .logo {
  color: #ffffff;
  padding: 0 8px 20px;
}
.sidebar a {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: #c4d1e6;
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
}
.sidebar a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}
.sidebar a.active {
  background: rgba(232, 182, 50, 0.14) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  border-left: 3px solid var(--accent) !important;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.sidebar .sec {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #798fae;
  padding: 18px 12px 6px;
}
.sidebar .soon {
  opacity: 0.45;
  pointer-events: none;
}
.sidebar .soon em {
  margin-left: auto;
  font-size: 10px;
  font-style: normal;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.main {
  padding: 0 34px 28px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #f8fafc;
}
.admin-body { flex: 1 0 auto; display: flex; flex-direction: column; }
.admin-status-bar { margin-top: auto; padding-top: 28px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}
.topbar h1 { font-size: 24px; color: var(--ink); }
.who { display: flex; gap: 14px; align-items: center; font-size: 13px; color: var(--muted); }
.avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: var(--brand);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
  box-shadow: var(--shadow-xs);
}

/* KPIs */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}
.kpi {
  border-top: 3px solid var(--accent-border);
}
.kpi .n {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--brand);
  font-variant-numeric: tabular-nums lining-nums;
  line-height: 1.1;
  margin-bottom: 4px;
}
.kpi .l { color: var(--muted); font-size: 13px; font-weight: 600; }

.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 18px;
}
@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .shell { grid-template-columns: 1fr; }
}

.pager { display: flex; gap: 8px; justify-content: center; margin-top: 20px; }

/* ==========================================================================
   Fase 2: Componentes Adicionais
   ========================================================================== */
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.toolbar form { display: flex; gap: 8px; flex: 1; min-width: 240px; }
.toolbar input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font: inherit;
  background: #ffffff;
}
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-bottom: 22px;
}
.grid3 {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr;
  gap: 22px;
  margin-bottom: 22px;
}
@media (max-width: 980px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
}
.chart-box { position: relative; height: 210px; }
.chart-box.tall { height: 270px; }
.kv {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 16px;
  font-size: 14px;
}
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.section-title h3 { font-size: 16px; }

/* Admin Mobile: Menu Drawer */
.menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  margin-right: 12px;
  color: var(--ink);
}
.menu-overlay { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .menu-btn { display: inline-flex; }
  .sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    bottom: 0;
    width: 276px;
    max-width: 86vw;
    height: 100vh;
    z-index: 80;
    transform: translateX(-102%);
    transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: none;
  }
  body.menu-open .sidebar {
    transform: none;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
  }
  body.menu-open .menu-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 75;
  }
  .main { padding: 0 18px 24px; }
  .topbar { flex-wrap: wrap; gap: 12px; }
  .topbar .who { flex-wrap: wrap; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* ==========================================================================
   ABLACC Admin: Membros & Cartões
   ========================================================================== */
.fs { font-size: 16px; margin: 0 0 14px; color: var(--brand); }
.chk {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  margin: 8px 0;
}
.chk input { margin-top: 3px; }

.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}
.member-card {
  display: flex;
  gap: 14px;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  padding: 14px 16px;
  color: inherit;
  transition: var(--transition);
}
a.member-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--line-strong);
}
.mc-photo, .pt-photo, .mini-round {
  flex: none;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: linear-gradient(135deg, var(--brand), var(--brand-500));
  color: #ffffff;
  display: grid;
  place-items: center;
  font-weight: 700;
  box-shadow: var(--shadow-xs);
}
.mc-photo { width: 62px; height: 62px; font-size: 24px; }
.pt-photo { width: 110px; height: 110px; font-size: 42px; }
.mini-round { width: 46px; height: 46px; font-size: 20px; }
.mc-photo img, .pt-photo img, .mini-round img { width: 100%; height: 100%; object-fit: cover; }
.mc-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mc-body small { color: var(--muted); }

.profile-top { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.thumb-round {
  width: 88px;
  height: 88px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 3px solid var(--brand-50);
  box-shadow: var(--shadow-sm);
}

.rte {
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  background: #ffffff;
  line-height: 1.7;
  outline: 0;
  transition: var(--transition);
}
.rte:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(11, 37, 78, 0.12);
}
.rte blockquote {
  border-left: 4px solid var(--accent);
  margin: 12px 0;
  padding: 6px 16px;
  color: var(--ink-soft);
  background: var(--bg);
}
.ai-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin: 8px 0 14px;
}
.qr svg { width: 100%; height: auto; }
