/* ========================================================================
 * HighTekk — design system (carvão azul, dark mode padrão, light toggle)
 * Baseado no protótipo em hightekk_frontend/.
 * ====================================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:#111827; --sidebar:#0D1929; --topbar:#161F2E; --card:#1C2840; --card2:#1F2F48;
  --border:rgba(255,255,255,0.07);
  --blue:#0B8FD4; --brand:#1A3A8F; --cyan:#5DDCF0;
  --text:#E2EAF4; --muted:#9CB3C9; --slate:#6B85A0; --steel:#4A6480;
  --success:#34A853; --danger:#dc2626; --warn:#d97706;

  /* Compat com style.css antigo — mapeia para a paleta escura.
     Se NÃO mapearmos, classes legacy (.card, .badge, .alert, table) ficam com
     fundo branco em dark mode. */
  --primary:#0B8FD4; --primary-dark:#0773AB;
  --surface:#1C2840;
  --text-muted:#9CB3C9;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg); color: var(--text);
  min-height: 100vh; display: flex; flex-direction: column;
  transition: background .3s, color .3s;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; flex: 1; min-height: 0; }

/* ── Sidebar ─────────────────────────────────────────────────────────── */
.ht-sidebar {
  width: 220px; background: var(--sidebar); overflow: hidden;
  display: flex; flex-direction: column;
  flex-shrink: 0; min-height: 100vh; position: sticky; top: 0;
}
.ht-logo { padding: 18px 20px; border-bottom: 0.5px solid var(--border); display: flex; align-items: center; gap: 11px; }
.ht-logo-mark { flex-shrink: 0; display: flex; }
.ht-logo-mark svg, .ht-logo-mark img { display: block; }
.ht-logo-text { color: var(--text); font-size: 16px; font-weight: 600; }
.ht-logo-text span { font-weight: 300; color: var(--muted); }
.ht-logo-sub { color: var(--slate); font-size: 11px; margin-top: 2px; }
.ht-nav-sec {
  padding: 14px 14px 5px; color: var(--steel);
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
}
.ht-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; font-size: 13px; color: var(--muted);
  cursor: pointer; text-decoration: none; transition: background .1s;
  border-left: 2px solid transparent;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ht-nav-item i { font-size: 17px; }
.ht-nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text); text-decoration: none; }
.ht-nav-item.active { background: rgba(11,143,212,0.12); color: var(--blue); border-left-color: var(--blue); }
.ht-sidebar-footer { margin-top: auto; border-top: 0.5px solid var(--border); padding: 8px 0; }

/* ── Menu mobile (hambúrguer + overlay) ─────────────────────────────────
 * Some no desktop; aparece só abaixo do breakpoint (ver media query no
 * fim do arquivo). O sidebar continua o mesmo elemento — vira um drawer
 * fixo que desliza da esquerda quando `.open`. */
.ht-menu-toggle {
  display: none; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0;
  border: 0.5px solid var(--border); background: rgba(255,255,255,0.07);
  color: var(--text); cursor: pointer; font-size: 18px;
}
.ht-sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 190; opacity: 0; visibility: hidden; transition: opacity .2s;
}
.ht-sidebar-overlay.show { opacity: 1; visibility: visible; }

/* ── Main / Topbar ───────────────────────────────────────────────────── */
.ht-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ht-topbar {
  background: var(--topbar); border-bottom: 0.5px solid var(--border);
  padding: 13px 28px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.ht-topbar-title { font-size: 15px; font-weight: 500; color: var(--text); }
.ht-topbar-sub { font-size: 11px; color: var(--slate); margin-top: 1px; }
.ht-topbar-right { display: flex; align-items: center; gap: 10px; }
.ht-theme-toggle {
  width: 34px; height: 34px; border-radius: 8px;
  border: 0.5px solid var(--border); background: rgba(255,255,255,0.07);
  color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; transition: all .15s;
}
.ht-theme-toggle:hover { border-color: var(--blue); color: var(--blue); }
.ht-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--blue); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 500;
}
.ht-avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.ht-roles-pill {
  font-size: 10px; padding: 3px 8px; border-radius: 12px;
  background: rgba(11,143,212,0.15); color: var(--blue); font-weight: 500;
}
.ht-content { padding: 24px 28px; flex: 1; overflow-y: auto; }

/* ── Breadcrumb (trilha de navegação) ─────────────────────────────────── */
.ht-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 7px;
  padding: 11px 28px; background: var(--topbar); border-bottom: 0.5px solid var(--border);
  font-size: 12px; }
.ht-crumbs a { color: var(--muted); text-decoration: none; }
.ht-crumbs a:hover { color: var(--blue); text-decoration: none; }
.ht-crumbs span { color: var(--slate); }
.ht-crumb-current { color: var(--text) !important; font-weight: 600; }
.ht-crumb-sep { font-size: 13px; color: var(--steel); }
body.light .ht-crumbs { background: #fff; border-bottom-color: #B7C7DE; }
body.light .ht-crumb-current { color: #0D1F4E !important; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.ht-btn {
  border: none; border-radius: 8px; padding: 8px 15px;
  font-size: 12px; font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: opacity .15s; font-family: inherit;
  text-decoration: none;
}
.ht-btn:hover { opacity: .85; text-decoration: none; }
.ht-btn-primary { background: var(--blue); color: #fff; }
.ht-btn-outline { background: rgba(255,255,255,0.08); color: var(--muted); border: 0.5px solid rgba(255,255,255,0.12); }
.ht-btn-outline:hover { color: var(--text); border-color: var(--blue); opacity: 1; }
.ht-btn-danger  { background: var(--danger); color: #fff; }
.ht-btn-ghost   { background: transparent; color: var(--muted); }
.ht-btn-ghost:hover { color: var(--text); }
.ht-btn i { font-size: 14px; }

/* ── Cards / panels ──────────────────────────────────────────────────── */
.ht-card {
  background: var(--card); border: 0.5px solid var(--border);
  border-radius: 12px; padding: 18px; margin-bottom: 16px;
}
.ht-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 8px; flex-wrap: wrap;
}
.ht-card-title { font-size: 13px; font-weight: 500; color: var(--text); margin: 0; }
.ht-card-sub   { font-size: 11px; color: var(--slate); margin-top: 2px; }

.ht-metrics {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px; margin-bottom: 22px;
}
.ht-metric { background: var(--card); border: 0.5px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.ht-metric.accent { background: var(--blue); border-color: var(--blue); }
.ht-metric-label { font-size: 11px; color: var(--slate); margin-bottom: 7px; display: flex; align-items: center; gap: 6px; }
.ht-metric.accent .ht-metric-label { color: rgba(255,255,255,0.65); }
.ht-metric-val { font-size: 24px; font-weight: 600; color: var(--text); }
.ht-metric.accent .ht-metric-val { color: #fff; }
.ht-metric-trend { font-size: 11px; color: var(--blue); margin-top: 4px; }
.ht-metric.accent .ht-metric-trend { color: rgba(255,255,255,0.7); }

/* ── Atalhos de ação (home) ─────────────────────────────────────────── */
.ht-quick-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.ht-quick-action {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 0.5px solid var(--border); border-radius: 12px;
  padding: 12px 16px; color: var(--text); text-decoration: none; flex: 1 1 200px;
  transition: border-color .15s, background .15s;
}
.ht-quick-action:hover { border-color: var(--blue); background: rgba(11,143,212,0.08); text-decoration: none; }
.ht-quick-action i { font-size: 20px; color: var(--blue); flex-shrink: 0; }
.ht-quick-action span { font-size: 13px; font-weight: 500; }
body.light .ht-quick-action { background: #ffffff; border-color: #B7C7DE; }
body.light .ht-quick-action:hover { border-color: #0B8FD4; background: #F0F7FC; }

/* ── Forms ──────────────────────────────────────────────────────────── */
.ht-form-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px;
}
.ht-form-grid .full { grid-column: 1 / -1; }
.ht-label, label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
.ht-input, input[type="text"], input[type="email"], input[type="date"], input[type="time"], input[type="password"], input[type="number"], textarea, select {
  width: 100%; padding: 9px 12px; border: 0.5px solid rgba(255,255,255,0.1);
  border-radius: 8px; font-size: 13px; color: var(--text); background: var(--card);
  outline: none; font-family: inherit; transition: border-color .15s;
}
.ht-input:focus, input:focus, textarea:focus, select:focus { border-color: var(--blue); }
textarea { resize: vertical; min-height: 80px; }
input[type="checkbox"], input[type="radio"] { width: auto; }

/* ── Tables ─────────────────────────────────────────────────────────── */
.ht-table { width: 100%; border-collapse: collapse; }
.ht-table th {
  font-size: 11px; color: var(--steel); font-weight: 500;
  text-align: left; padding: 10px 12px;
  border-bottom: 0.5px solid var(--border);
  letter-spacing: .04em; text-transform: uppercase;
}
.ht-table td { padding: 11px 12px; border-bottom: 0.5px solid var(--border); vertical-align: middle; font-size: 13px; }
.ht-table tr:last-child td { border-bottom: none; }
.ht-table tr:hover td { background: rgba(255,255,255,0.03); }
.ht-table .right { text-align: right; }

/* ── Badges / chips / status ────────────────────────────────────────── */
.ht-badge {
  font-size: 10px; padding: 3px 9px; border-radius: 20px;
  background: rgba(11,143,212,0.15); color: var(--blue); font-weight: 500;
  display: inline-block;
}
.ht-badge-neutral  { background: rgba(255,255,255,0.06); color: var(--slate); }
.ht-badge-success  { background: rgba(52,168,83,0.18); color: #86EFAC; }
.ht-badge-warn     { background: rgba(217,119,6,0.2); color: #fbbf24; }
.ht-badge-danger   { background: rgba(220,38,38,0.18); color: #fca5a5; }

.ht-chip {
  padding: 5px 13px; border-radius: 20px; font-size: 11px; font-weight: 500;
  cursor: pointer; border: 0.5px solid var(--border); background: transparent; color: var(--slate);
}
.ht-chip.active, .ht-chip:hover { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ── Alerts ─────────────────────────────────────────────────────────── */
.ht-alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; border-left: 3px solid var(--blue); background: rgba(11,143,212,0.08); color: var(--text); }
.ht-alert-success { border-left-color: var(--success); background: rgba(52,168,83,0.1); }
.ht-alert-error   { border-left-color: var(--danger);  background: rgba(220,38,38,0.1); }
.ht-alert-warn    { border-left-color: var(--warn);    background: rgba(217,119,6,0.1); }

/* ── Calendário (eventos) ───────────────────────────────────────────── */
.ht-cal { background: var(--card); border: 0.5px solid var(--border); border-radius: 12px; padding: 14px; }
.ht-cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ht-cal-month { font-size: 16px; font-weight: 600; color: var(--text); }
.ht-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.ht-cal-dow { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--steel); text-align: center; padding: 6px 0; }
.ht-cal-day {
  background: rgba(255,255,255,0.02); border: 0.5px solid var(--border);
  border-radius: 8px; padding: 6px; min-height: 90px; cursor: pointer; transition: background .12s;
  display: flex; flex-direction: column; gap: 3px;
}
.ht-cal-day:hover { background: rgba(11,143,212,0.06); border-color: rgba(11,143,212,0.3); }
.ht-cal-day.is-other { opacity: 0.35; }
.ht-cal-day.is-today { border-color: var(--blue); }
.ht-cal-num { font-size: 11px; color: var(--muted); font-weight: 500; }
.ht-cal-day.is-today .ht-cal-num { color: var(--blue); font-weight: 600; }
.ht-cal-evt { font-size: 10px; padding: 2px 5px; border-radius: 4px; background: rgba(11,143,212,0.18); color: #BFE3F5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ht-cal-evt.cat-culto    { background: rgba(11,143,212,0.18); color: #BFE3F5; }
.ht-cal-evt.cat-celula   { background: rgba(26,58,143,0.3);  color: #7BA7D4; }
.ht-cal-evt.cat-ebd      { background: rgba(93,220,240,0.15); color: #5DDCF0; }
.ht-cal-evt.cat-retiro   { background: rgba(217,119,6,0.18); color: #fbbf24; }
.ht-cal-evt.cat-reuniao  { background: rgba(167,139,250,0.15); color: #c4b5fd; }
.ht-cal-evt.cat-google   { background: rgba(52,168,83,0.18); color: #86EFAC; }
.ht-cal-evt.cat-aniversario        { background: rgba(236,72,153,0.28); color: #FBCFE8; }
.ht-cal-evt.cat-aniversario_celula { background: rgba(239,68,68,0.26);  color: #FCA5A5; }
.ht-cal-evt.cat-outro    { background: rgba(255,255,255,0.08); color: var(--muted); }

/* ── Toast ──────────────────────────────────────────────────────────── */
.ht-toast {
  position: fixed; right: 20px; bottom: 20px; padding: 11px 16px;
  background: var(--card2); color: var(--text); border-radius: 8px;
  border: 0.5px solid var(--border); font-size: 13px; z-index: 1000;
  opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s;
}
.ht-toast.show { opacity: 1; transform: translateY(0); }
.ht-toast.success { border-color: var(--success); }
.ht-toast.error   { border-color: var(--danger);  }

/* ── Modal ──────────────────────────────────────────────────────────── */
.ht-modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 900; display: flex; align-items: center; justify-content: center; padding: 16px; }
.ht-modal-bg.hidden { display: none; }
.ht-modal { background: var(--card); border-radius: 12px; max-width: 520px; width: 100%; border: 0.5px solid var(--border); overflow: hidden; }
.ht-modal-head { padding: 14px 18px; border-bottom: 0.5px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.ht-modal-title { font-size: 14px; font-weight: 600; color: var(--text); margin: 0; }
.ht-modal-body { padding: 18px; }
.ht-modal-foot { padding: 14px 18px; border-top: 0.5px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.ht-modal-close { background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; }

/* ── Utilities ──────────────────────────────────────────────────────── */
.muted { color: var(--slate); font-size: 12px; }
.right { text-align: right; }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.gap-2 { gap: 8px; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }

/* =====================================================================
 * LIGHT MODE
 * =================================================================== */
body.light {
  /* FUNDO do sistema = #DEE7F2 (mesma cor da tela de login), no lugar do branco.
     Cards/painéis ficam brancos (#ffffff) por cima, pra destacar do fundo. */
  background: #DEE7F2; color: #0D1F4E;
  --bg: #DEE7F2;
  --card: #ffffff; --card2: #D4DFEE;
  --border: #B7C7DE;
  --text: #0D1F4E; --muted: #5D6E8F; --slate: #5D6E8F; --steel: #98A8C4;
  --surface: #ffffff;
  --text-muted: #5D6E8F;
  --primary: #0B8FD4; --primary-dark: #0773AB;
}
body.light .ht-sidebar { background: #0D1F4E; }
body.light .ht-logo-text { color: #fff; }
body.light .ht-logo-text span { color: rgba(255,255,255,0.6); }
body.light .ht-logo-sub { color: rgba(255,255,255,0.45); }
body.light .ht-nav-sec { color: rgba(255,255,255,0.35); }
body.light .ht-nav-item { color: rgba(255,255,255,0.65); }
body.light .ht-nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
body.light .ht-nav-item.active { background: rgba(11,143,212,0.2); color: #0B8FD4; border-left-color: #0B8FD4; }
body.light .ht-sidebar-footer { border-top-color: rgba(255,255,255,0.1); }
body.light .ht-topbar { background: #0B8FD4; border-bottom: none; }
body.light .ht-topbar-title { color: #fff; }
body.light .ht-topbar-sub { color: rgba(255,255,255,0.7); }
body.light .ht-theme-toggle { background: rgba(255,255,255,0.18); border-color: rgba(255,255,255,0.3); color: #fff; }
body.light .ht-btn-outline { background: rgba(255,255,255,0.15); color: #fff; border-color: rgba(255,255,255,0.3); }
body.light .ht-card { box-shadow: 0 1px 2px rgba(13,31,78,0.04); }
body.light .ht-input, body.light input, body.light textarea, body.light select { background: #EDF2F9; border-color: #B7C7DE; color: #0D1F4E; }
body.light .ht-cal-day { background: #F7F9FC; }
body.light .ht-cal-day:hover { background: rgba(11,143,212,0.08); }
body.light .ht-modal-bg { background: rgba(13,31,78,0.5); }


/* =====================================================================
 * Overrides em classes LEGACY pra apagar fundos brancos/claros no dark mode.
 * Aplicado fora do shim .ht-content (que já é coberto) e tem peso > style.css.
 * =================================================================== */

/* Páginas que ainda têm app-header/sidebar antigos */
body:not(.light) .app-header { background: var(--topbar); border-bottom-color: var(--border); }
body:not(.light) .app-header h1 { color: var(--blue); }
body:not(.light) .sidebar:not(.ht-sidebar) { background: var(--sidebar); border-right-color: var(--border); }
body:not(.light) .sidebar:not(.ht-sidebar) a { color: var(--muted); }
body:not(.light) .sidebar:not(.ht-sidebar) a:hover { background: rgba(255,255,255,0.05); color: var(--text); }
body:not(.light) .sidebar:not(.ht-sidebar) a.active { background: rgba(11,143,212,0.12); color: var(--blue); border-left-color: var(--blue); }

/* Cards e tabelas (legacy) — quando aparecem dentro do shim já é coberto, mas
   garantia extra global. */
body:not(.light) .card { background: var(--card); border-color: var(--border); color: var(--text); }
body:not(.light) table { background: transparent; color: var(--text); }
body:not(.light) th { background: rgba(255,255,255,0.03); color: var(--steel); border-bottom-color: var(--border); }
body:not(.light) td { border-bottom-color: var(--border); color: var(--text); }
body:not(.light) tbody tr:hover { background: rgba(255,255,255,0.03); }

/* Inputs / form */
body:not(.light) input, body:not(.light) select, body:not(.light) textarea {
  background: var(--card); color: var(--text); border-color: rgba(255,255,255,0.12);
}
body:not(.light) input::placeholder, body:not(.light) textarea::placeholder { color: var(--steel); }
body:not(.light) label { color: var(--muted); }

/* Badges legacy — eram pastéis claros (#dcfce7, #fef3c7, #fee2e2). Substitui. */
body:not(.light) .badge { background: rgba(11,143,212,0.15); color: var(--blue); }
body:not(.light) .badge-success { background: rgba(52,168,83,0.18); color: #86EFAC; }
body:not(.light) .badge-warn    { background: rgba(217,119,6,0.22); color: #fbbf24; }
body:not(.light) .badge-danger  { background: rgba(220,38,38,0.18); color: #fca5a5; }

/* Alerts legacy — eram bgs pastéis. */
body:not(.light) .alert { border: none; color: var(--text); }
body:not(.light) .alert-success { background: rgba(52,168,83,0.12); border-left: 3px solid var(--success); }
body:not(.light) .alert-error   { background: rgba(220,38,38,0.12); border-left: 3px solid var(--danger); }
body:not(.light) .alert-warn    { background: rgba(217,119,6,0.12); border-left: 3px solid var(--warn); }

/* Botões legacy */
body:not(.light) .btn { background: var(--blue); color: #fff; }
body:not(.light) .btn:hover { background: var(--primary-dark); }
body:not(.light) .btn-secondary { background: rgba(255,255,255,0.08); color: var(--muted); border: 0.5px solid var(--border); }
body:not(.light) .btn-secondary:hover { background: rgba(255,255,255,0.14); color: var(--text); }
body:not(.light) .btn-danger { background: var(--danger); color: #fff; }
body:not(.light) .btn-google { background: var(--card2); color: var(--text); border-color: var(--border); }
body:not(.light) .btn-google:hover { background: rgba(255,255,255,0.05); }

/* Página de login (anonymous) — força fundo escuro */
body:not(.light) .login-page { background: var(--bg); color: var(--text); }
body:not(.light) .login-page .card { background: var(--card); border-color: var(--border); }
body:not(.light) .login-page .muted { color: var(--slate); }

/* Garante que .muted global fica legível em dark */
body:not(.light) .muted { color: var(--slate); }

/* Botão "Sair" no rodapé da sidebar (é um <button> com background:none) — herda
   cor do user-agent (preto). Força a cor do ht-nav-item. */
.ht-sidebar-footer button.ht-nav-item { color: var(--muted); }
.ht-sidebar-footer button.ht-nav-item:hover { color: var(--text); }
body.light .ht-sidebar-footer button.ht-nav-item { color: rgba(255,255,255,0.65); }
body.light .ht-sidebar-footer button.ht-nav-item:hover { color: #fff; }

/* Topbar: garante visibilidade do título/data mesmo se algum legacy tentar mudar */
.ht-topbar-title { color: var(--text) !important; }
.ht-topbar-sub   { color: var(--slate) !important; }
body.light .ht-topbar-title { color: #fff !important; }
body.light .ht-topbar-sub   { color: rgba(255,255,255,0.75) !important; }

/* Pílulas de papel na topbar — claras em light mode */
body.light .ht-roles-pill { background: rgba(255,255,255,0.22); color: #fff; }

/* Botão "Sair" na topbar — ao lado do avatar.
   Usa !important e appearance:none pra vencer o estilo default do <button>
   e qualquer override de .btn legacy. */
.ht-topbar .ht-topbar-logout,
button.ht-topbar-logout {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 7px 12px !important;
  border-radius: 8px !important;
  border: 0.5px solid rgba(255,255,255,0.15) !important;
  background: rgba(255,255,255,0.08) !important;
  color: #E2EAF4 !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  font-family: inherit !important;
  cursor: pointer !important;
  transition: all .15s !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  line-height: 1 !important;
}
.ht-topbar .ht-topbar-logout i,
button.ht-topbar-logout i { font-size: 14px !important; color: inherit !important; }
.ht-topbar .ht-topbar-logout span,
button.ht-topbar-logout span { color: inherit !important; }
.ht-topbar .ht-topbar-logout:hover,
button.ht-topbar-logout:hover {
  background: rgba(220,38,38,0.18) !important;
  border-color: rgba(220,38,38,0.55) !important;
  color: #fca5a5 !important;
}

/* Light mode — topbar tem fundo azul; botão precisa de contraste branco */
body.light .ht-topbar .ht-topbar-logout,
body.light button.ht-topbar-logout {
  background: rgba(255,255,255,0.22) !important;
  border-color: rgba(255,255,255,0.45) !important;
  color: #ffffff !important;
}
body.light .ht-topbar .ht-topbar-logout:hover,
body.light button.ht-topbar-logout:hover {
  background: rgba(255,255,255,0.35) !important;
  border-color: #ffffff !important;
  color: #ffffff !important;
}


/* =====================================================================
 * LIGHT MODE — correcoes gerais de contraste
 * Bloco final para vencer a especificidade do style.css legacy e do shim
 * inline em base.html. Reune todas as situacoes onde texto + fundo eram
 * "claro sobre claro" ou "escuro sobre escuro".
 * =================================================================== */

/* Cor base do conteudo principal */
body.light, body.light .ht-content { color: #0D1F4E; }
body.light .muted, body.light .ht-content .muted, body.light small.muted { color: #6B7BA0 !important; }

/* Cards */
body.light .ht-card,
body.light .ht-content .card,
body.light .card {
  background: #ffffff !important;
  border-color: #CBD5E1 !important;
  color: #0D1F4E !important;
  box-shadow: 0 1px 2px rgba(13,31,78,0.04);
}
body.light .ht-card h2, body.light .ht-card h3,
body.light .ht-content h2, body.light .ht-content h3,
body.light .ht-content .card h2, body.light .ht-content .card h3 { color: #0D1F4E !important; }

/* Tabelas (legacy e .ht-table) */
body.light .ht-content table,
body.light .ht-table,
body.light table {
  background: #ffffff !important;
  color: #0D1F4E !important;
}
body.light .ht-content table th,
body.light .ht-table th,
body.light table th {
  background: #F1F5F9 !important;
  color: #475569 !important;
  border-bottom-color: #CBD5E1 !important;
  font-weight: 600;
}
body.light .ht-content table td,
body.light .ht-table td,
body.light table td {
  background: transparent !important;
  color: #0D1F4E !important;
  border-bottom-color: #CBD5E1 !important;
}
/* Hover suave — nao escurece, so da um tom de gelo */
body.light .ht-content table tbody tr:hover td,
body.light .ht-table tbody tr:hover td,
body.light table tbody tr:hover td,
body.light tbody tr:hover { background: #F1F5F9 !important; color: #0D1F4E !important; }
body.light tbody tr:hover td * { color: inherit; }

/* Inputs / select / textarea */
body.light input, body.light select, body.light textarea,
body.light .ht-content input, body.light .ht-content select, body.light .ht-content textarea {
  background: #ffffff !important;
  color: #0D1F4E !important;
  border: 1px solid #CBD5E1 !important;
}
body.light input:focus, body.light select:focus, body.light textarea:focus {
  border-color: #0B8FD4 !important;
  box-shadow: 0 0 0 3px rgba(11,143,212,0.12);
}
body.light input::placeholder, body.light textarea::placeholder { color: #94A3B8 !important; }
body.light label, body.light .ht-content label { color: #475569 !important; font-weight: 500; }

/* Botoes */
body.light .ht-btn-primary, body.light .ht-content .btn:not(.btn-secondary):not(.btn-danger) {
  background: #0B8FD4 !important; color: #fff !important; border: none !important;
}
body.light .ht-btn-primary:hover, body.light .ht-content .btn:hover:not(.btn-secondary):not(.btn-danger) { background: #0773AB !important; }
body.light .ht-btn-outline, body.light .ht-content .btn-secondary {
  background: #ffffff !important; color: #475569 !important; border: 1px solid #CBD5E1 !important;
}
body.light .ht-btn-outline:hover, body.light .ht-content .btn-secondary:hover {
  background: #F8FAFC !important; color: #0D1F4E !important; border-color: #0B8FD4 !important;
}
body.light .ht-btn-danger, body.light .ht-content .btn-danger {
  background: #dc2626 !important; color: #fff !important;
}

/* Badges / chips */
body.light .ht-badge, body.light .ht-content .badge {
  background: #E6F4FB !important; color: #0773AB !important;
}
body.light .ht-badge-success, body.light .ht-content .badge-success { background: #DCFCE7 !important; color: #166534 !important; }
body.light .ht-badge-warn,    body.light .ht-content .badge-warn    { background: #FEF3C7 !important; color: #92400E !important; }
body.light .ht-badge-danger,  body.light .ht-content .badge-danger  { background: #FEE2E2 !important; color: #991B1B !important; }
body.light .ht-badge-neutral { background: #F1F5F9 !important; color: #475569 !important; }
body.light .ht-chip { background: #EDF2F9; color: #475569; border-color: #B7C7DE; }
body.light .ht-chip.active, body.light .ht-chip:hover { background: #0B8FD4; color: #fff; border-color: #0B8FD4; }

/* Alerts */
body.light .ht-alert, body.light .ht-content .alert { color: #0D1F4E !important; border: 1px solid transparent; }
body.light .ht-alert-success, body.light .ht-content .alert-success {
  background: #DCFCE7 !important; border-left: 3px solid #16A34A !important; color: #14532D !important;
}
body.light .ht-alert-error, body.light .ht-content .alert-error {
  background: #FEE2E2 !important; border-left: 3px solid #DC2626 !important; color: #7F1D1D !important;
}
body.light .ht-alert-warn, body.light .ht-content .alert-warn {
  background: #FEF3C7 !important; border-left: 3px solid #D97706 !important; color: #78350F !important;
}

/* Calendario de Eventos */
body.light .ht-cal { background: #ffffff !important; border-color: #B7C7DE !important; }
body.light .ht-cal-month, body.light .ht-cal-dow { color: #475569 !important; }
body.light .ht-cal-day { background: #E9EFF7 !important; border-color: #C2D0E4 !important; }
body.light .ht-cal-day:hover { background: #E0F2FE !important; border-color: #BAE6FD !important; }
body.light .ht-cal-day.is-today { border-color: #0B8FD4 !important; background: #F0F5FB !important; }
body.light .ht-cal-num { color: #475569 !important; }
body.light .ht-cal-day.is-today .ht-cal-num { color: #0B8FD4 !important; }
body.light .ht-cal-evt.cat-culto   { background: #DBEAFE !important; color: #1E40AF !important; }
body.light .ht-cal-evt.cat-celula  { background: #E0E7FF !important; color: #3730A3 !important; }
body.light .ht-cal-evt.cat-ebd     { background: #CFFAFE !important; color: #155E75 !important; }
body.light .ht-cal-evt.cat-retiro  { background: #FEF3C7 !important; color: #92400E !important; }
body.light .ht-cal-evt.cat-reuniao { background: #EDE9FE !important; color: #5B21B6 !important; }
body.light .ht-cal-evt.cat-google  { background: #DCFCE7 !important; color: #166534 !important; }
body.light .ht-cal-evt.cat-aniversario        { background: #FCE7F3 !important; color: #9D174D !important; }
body.light .ht-cal-evt.cat-aniversario_celula { background: #FEE2E2 !important; color: #991B1B !important; }
body.light .ht-cal-evt.cat-outro   { background: #F1F5F9 !important; color: #475569 !important; }

/* Metricas / dashboard */
body.light .ht-metric { background: #ffffff !important; border-color: #B7C7DE !important; }
body.light .ht-metric-label { color: #6B7BA0 !important; }
body.light .ht-metric-val   { color: #0D1F4E !important; }
body.light .ht-metric-trend { color: #0B8FD4 !important; }
body.light .ht-metric.accent { background: #0B8FD4 !important; }
body.light .ht-metric.accent .ht-metric-label,
body.light .ht-metric.accent .ht-metric-val,
body.light .ht-metric.accent .ht-metric-trend { color: #fff !important; }

/* Modal */
body.light .ht-modal { background: #ffffff !important; border-color: #B7C7DE !important; }
body.light .ht-modal-head { border-bottom-color: #CBD5E1 !important; }
body.light .ht-modal-title { color: #0D1F4E !important; }
body.light .ht-modal-foot { border-top-color: #CBD5E1 !important; }
body.light .ht-modal-close { color: #475569 !important; }

/* Avatar */
body.light .ht-avatar { background: #0B8FD4 !important; color: #fff !important; }

/* Detalhes / summary */
body.light details summary { color: #0B8FD4; }
body.light details ul li { color: #0D1F4E; }

/* Links */
body.light a { color: #0B8FD4; }
body.light a:hover { color: #0773AB; }
/* Botões de preenchimento sólido que são links (<a>): a regra acima os pintava
   de azul e o texto sumia no fundo azul. Mantém o texto branco (e no hover). */
body.light a.ht-btn-primary,
body.light a.cl-btn-accent,
body.light a.mem-btn-accent,
body.light a.cd-btn-accent,
body.light a.rep-new-btn,
body.light a.rc-btn-primary,
body.light a.er-btn-accent,
body.light a.ht-btn-danger,
body.light a.cd-btn-danger { color: #fff; }

/* Form-grid labels */
body.light .form-grid label, body.light .actions label { color: #475569 !important; }

/* Paginacao */
body.light .pag-btn { background: #EDF2F9 !important; color: #475569 !important; border: 1px solid #B7C7DE !important; }
body.light .pag-btn.active { background: #0B8FD4 !important; color: #fff !important; border-color: #0B8FD4 !important; }
body.light .pag-info { color: #6B7BA0 !important; }

/* ============================================================
   Bordas mais grossas — SOMENTE no sistema (tudo vive dentro de .layout).
   O login renderiza fora de .layout, então fica intocado.
   Hairlines de 0.5px viram 1.5px; separadores de 1 lado idem.
   ============================================================ */
.layout .ht-card,
.layout .ht-metric,
.layout .ht-cal,
.layout .ht-cal-day,
.layout .ht-input,
.layout input, .layout textarea, .layout select,
.layout .ht-btn-outline,
.layout .ht-chip,
.layout .ht-theme-toggle,
.layout .ht-modal,
.layout .pag-btn,
.layout .ht-badge,
.layout .ht-sidebar,
.layout .ht-topbar,
.layout .ht-logo,
.layout .ht-sidebar-footer,
.layout .ht-modal-head,
.layout .ht-modal-foot,
.layout .ht-table th,
.layout .ht-table td,
.layout .ht-content .card,
.layout .ht-content .btn-secondary,
.layout .ht-content table th,
.layout .ht-content table td {
  border-width: 1.5px !important;
}

/* ========================================================================
 * Drawer "Membros sem célula" — banner compacto + slide-in + indicações
 * ====================================================================== */

/* Banner de uma linha (usa o amarelo de alerta existente) */
.ua-banner { display:flex; align-items:center; gap:14px; padding:10px 14px; margin-bottom:16px;
  border-radius:10px; background:rgba(217,119,6,0.1); border-left:3px solid var(--warn); }
.ua-stack { display:flex; }
.ua-stack-ava { width:28px; height:28px; border-radius:50%; margin-left:-8px; flex-shrink:0;
  display:flex; align-items:center; justify-content:center; font-size:10px; font-weight:600;
  background:rgba(11,143,212,0.25); color:#4FB6E8; border:2px solid #241d10; }
.ua-stack-ava:first-child { margin-left:0; }
.ua-stack-more { background:rgba(255,255,255,0.12); color:var(--muted); }
.ua-banner-text { display:flex; align-items:center; gap:7px; color:var(--text); font-size:13px; }
.ua-banner-text i { color:var(--warn); }
.ua-banner-btn { margin-left:auto; display:inline-flex; align-items:center; gap:6px;
  background:var(--blue); color:#fff; border:none; border-radius:8px; padding:8px 14px;
  font-size:12px; font-weight:600; cursor:pointer; }
.ua-banner-btn:hover { background:#0a7ebb; }

/* Overlay + drawer */
.ua-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.45); opacity:0; visibility:hidden;
  transition:opacity .2s; z-index:60; }
.ua-overlay.show { opacity:1; visibility:visible; }
.ua-drawer { position:fixed; top:0; right:0; height:100vh; width:380px; max-width:100vw; z-index:61;
  background:#161F2E; border-left:1.5px solid rgba(8,100,180,0.45);
  display:flex; flex-direction:column; transform:translateX(100%); transition:transform .25s ease-out; }
.ua-drawer.open { transform:translateX(0); }
@media (max-width:480px){ .ua-drawer { width:100vw; } }

.ua-head { display:flex; align-items:center; gap:10px; padding:16px; border-bottom:1px solid rgba(8,100,180,0.35); }
.ua-head h3 { font-size:15px; color:var(--text); display:flex; align-items:center; gap:8px; }
.ua-count-badge { background:rgba(11,143,212,0.18); color:#4FB6E8; font-size:11px; font-weight:600;
  padding:2px 9px; border-radius:20px; }
.ua-x { margin-left:auto; background:none; border:none; color:var(--muted); cursor:pointer; font-size:18px;
  display:flex; padding:4px; border-radius:6px; }
.ua-x:hover { background:rgba(255,255,255,0.06); color:var(--text); }

.ua-searchbox { position:relative; padding:12px 16px 8px; }
.ua-searchbox i { position:absolute; left:26px; top:50%; transform:translateY(-25%); color:var(--slate); font-size:15px; }
.ua-searchbox input { width:100%; padding:8px 10px 8px 32px; font-size:13px; border-radius:8px;
  background:rgba(255,255,255,0.04); border:1px solid var(--border); color:var(--text); }
.ua-searchbox input:focus { outline:none; border-color:var(--blue); }

.ua-list { flex:1; overflow-y:auto; padding:6px 12px 12px; }
.ua-loading, .ua-done { text-align:center; color:var(--slate); padding:32px 16px; font-size:13px; }
.ua-done i { font-size:34px; color:var(--success); display:block; margin-bottom:10px; }

/* Item (linha collapsed) */
.ua-item { border-bottom:1px solid var(--border); transition:opacity .2s, transform .2s; }
.ua-item.ua-removing { opacity:0; transform:translateX(30px); }
.ua-summary { display:flex; align-items:center; gap:11px; padding:11px 4px; cursor:pointer; }
.ua-ava { width:34px; height:34px; border-radius:50%; flex-shrink:0; display:flex; align-items:center;
  justify-content:center; font-size:12px; font-weight:600; background:rgba(11,143,212,0.2); color:#4FB6E8; }
.ua-info { flex:1; min-width:0; }
.ua-name { font-size:13px; font-weight:600; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ua-sub { font-size:11px; color:var(--slate); margin-top:1px; }
.ua-chev { color:var(--slate); font-size:16px; transition:transform .18s; flex-shrink:0; }
.ua-item.open .ua-chev { transform:rotate(180deg); }

/* Painel expandido (accordion) — só a atribuição manual */
.ua-panel { display:none; padding:2px 4px 12px 45px; }
.ua-item.open .ua-panel { display:block; }
.ua-assign { display:inline-flex; align-items:center; gap:5px; font-size:11px; font-weight:600;
  padding:6px 12px; border-radius:7px; cursor:pointer; }
.ua-btn { background:var(--blue); color:#fff; border:none; }
.ua-btn:hover { background:#0a7ebb; }
.ua-btn:disabled { opacity:.45; cursor:not-allowed; }
.ua-manual { display:flex; gap:6px; margin-top:4px; }
.ua-select { flex:1; padding:6px 8px; font-size:11px; border-radius:7px; background:rgba(255,255,255,0.04);
  border:1px solid var(--border); color:var(--text); }

/* Paginação (15/pág) */
.ua-pager { display:flex; align-items:center; justify-content:center; gap:12px; padding:8px 16px;
  border-top:1px solid rgba(8,100,180,0.35); }
.ua-pg-btn { background:rgba(255,255,255,0.05); border:1px solid var(--border); color:var(--text);
  width:30px; height:30px; border-radius:7px; cursor:pointer; display:flex; align-items:center; justify-content:center; }
.ua-pg-btn:hover:not(:disabled) { border-color:var(--blue); color:var(--blue); }
.ua-pg-btn:disabled { opacity:.35; cursor:not-allowed; }
.ua-pg-label { font-size:11px; color:var(--muted); }

/* Rodapé — barra de progresso */
.ua-foot { padding:12px 16px; border-top:1px solid rgba(8,100,180,0.35); }
.ua-foot-label { font-size:11px; color:var(--muted); margin-bottom:6px; }
.ua-bar { height:6px; border-radius:4px; background:rgba(255,255,255,0.08); overflow:hidden; }
.ua-bar span { display:block; height:100%; background:var(--blue); border-radius:4px; transition:width .3s; }

/* Tema claro */
body.light .ua-drawer { background:#fff; border-left-color:rgba(8,100,180,0.25); }
body.light .ua-searchbox input, body.light .ua-select { background:#F1F5F9; }
body.light .ua-bar { background:#E2E8F0; }
body.light .ua-stack-ava { border-color:#FDF3E3; }
body.light .ua-name, body.light .ua-head h3 { color:#1E293B; }
body.light .ua-pg-btn { background:#F1F5F9; }

/* ========================================================================
 * RESPONSIVIDADE MOBILE — o sistema inteiro (sidebar fixa de 220px, sempre
 * visível) não tinha nenhum breakpoint real até aqui. Abaixo de 860px, a
 * sidebar vira um drawer que fica escondido por padrão e desliza por cima
 * do conteúdo quando o botão de menu (topbar) é tocado.
 * ====================================================================== */
@media (max-width: 860px) {
  .ht-menu-toggle { display: flex; }
  .ht-sidebar-overlay { display: block; }

  .ht-sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; z-index: 200;
    transform: translateX(-100%); transition: transform .2s ease-out;
    box-shadow: 4px 0 24px rgba(0,0,0,0.35);
  }
  .ht-sidebar.open { transform: translateX(0); }

  .ht-topbar { padding: 11px 14px; gap: 10px; }
  .ht-topbar-right { flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
  .ht-crumbs { padding: 9px 14px; }
  .ht-content { padding: 16px; }
  .ht-metrics { grid-template-columns: 1fr 1fr; gap: 10px; }
}

@media (max-width: 480px) {
  .ht-roles-pill { display: none; }
  .ht-metrics { grid-template-columns: 1fr; }
  .ht-topbar-title { font-size: 14px; }
}

