/* ==========================================================================
   04-RELATÓRIO — Workspace Teocrático Studio (Inspirado no CollectUI)
   Masonry Dinâmico Real: Zero Espaço Vazio, Zero Flickering, Alinhamento Perfeito
   ========================================================================== */

:root {
  /* Tema Escuro: Deep Slate Studio (CollectUI Inspired) */
  --bg-page: #080c14;
  --bg-sidebar: #0d121e;
  --bg-content: #0a0f1a;
  --bg-card: #131a2a;
  --bg-card-hover: #172136;
  --bg-input: #0a0f1a;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-card: rgba(255, 255, 255, 0.09);
  --border-hover: rgba(56, 189, 248, 0.5);
  --border-focus: #38bdf8;

  --text-heading: #ffffff;
  --text-body: #d1d5db;
  --text-muted: #8292a8;
  --text-faint: #475569;

  --accent-primary: #2563eb;
  --accent-primary-hover: #1d4ed8;
  --accent-glow: rgba(37, 99, 235, 0.25);

  --sidebar-active-bg: rgba(37, 99, 235, 0.14);
  --sidebar-active-text: #60a5fa;

  --shadow-card: 0 2px 10px rgba(0, 0, 0, 0.28);
  --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.48);

  --radius-card: 12px;
  --radius-btn: 7px;
  --radius-badge: 6px;
  --radius-pill: 9999px;
}

body.theme-light {
  /* Tema Claro: Pure Editorial Paper & Slate Studio */
  --bg-page: #f8fafc;
  --bg-sidebar: #f1f5f9;
  --bg-content: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #ffffff;
  --bg-input: #ffffff;

  --border-subtle: #e2e8f0;
  --border-card: #e2e8f0;
  --border-hover: #3b82f6;
  --border-focus: #2563eb;

  --text-heading: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-faint: #94a3b8;

  --accent-primary: #2563eb;
  --accent-primary-hover: #1d4ed8;
  --accent-glow: rgba(37, 99, 235, 0.15);

  --sidebar-active-bg: rgba(37, 99, 235, 0.1);
  --sidebar-active-text: #2563eb;

  --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.05), 0 3px 10px rgba(15, 23, 42, 0.03);
  --shadow-hover: 0 6px 18px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-page);
  color: var(--text-body);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", "Helvetica Neue", Arial, sans-serif;
  font-size: 14.5px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Shell do Workspace (Sidebar + Canvas Principal)
   ========================================================================== */
.workspace-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ==========================================================================
   Barra Lateral Fixa (Sidebar)
   ========================================================================== */
.sidebar {
  width: 290px;
  min-width: 290px;
  max-width: 290px;
  height: 100vh;
  position: sticky;
  top: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 100;
  user-select: none;
}

.sidebar-header {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-heading);
}

.brand-logo svg {
  color: var(--accent-primary);
  flex-shrink: 0;
}

.brand-meta {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-sub {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-primary);
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-scroll::-webkit-scrollbar {
  width: 5px;
}
.sidebar-scroll::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 4px;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  padding: 0 10px 4px;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-btn);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
  text-align: left;
  font-family: inherit;
  width: 100%;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-heading);
}

body.theme-light .nav-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 600;
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: inherit;
}

.nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.nav-item.active .nav-badge {
  background: rgba(37, 99, 235, 0.2);
  color: var(--sidebar-active-text);
}

body.theme-light .nav-badge {
  background: rgba(0, 0, 0, 0.05);
}

/* Rodapé da Sidebar */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 8px;
}

.sidebar-action-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  border-radius: var(--radius-btn);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-heading);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.sidebar-action-btn:hover {
  border-color: var(--border-hover);
}

/* ==========================================================================
   Área Principal de Conteúdo (Canvas Editorial)
   ========================================================================== */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 24px 32px 80px;
  display: flex;
  flex-direction: column;
}

@media (min-width: 1600px) {
  .main-content {
    padding: 28px 44px 90px;
  }
}

/* Top Header */
.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.search-wrap-main {
  position: relative;
  flex: 1;
  min-width: 300px;
  display: flex;
  align-items: center;
}

.search-ico {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-wrap-main input {
  width: 100%;
  height: 42px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-btn);
  padding: 0 76px 0 42px;
  color: var(--text-heading);
  font-size: 14px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s ease;
}

.search-wrap-main input:focus {
  border-color: var(--border-focus);
}

.kbd-badge {
  position: absolute;
  right: 36px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  pointer-events: none;
}

body.theme-light .kbd-badge {
  background: rgba(0, 0, 0, 0.04);
}

.clear-search-btn {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  display: none;
  padding: 2px;
}

.clear-search-btn.active {
  display: block;
}

.header-right-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.view-switch-group {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-btn);
  padding: 2px;
}

.view-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 30px;
  background: transparent;
  border: none;
  border-radius: 5px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.12s ease;
}

.view-toggle-btn:hover {
  color: var(--text-heading);
}

.view-toggle-btn.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-heading);
}

body.theme-light .view-toggle-btn.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Barra de Título da Seção Ativa */
.section-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  gap: 12px;
  flex-wrap: wrap;
}

.active-category-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.active-category-info h2 {
  font-size: 21px;
  font-weight: 700;
  color: var(--text-heading);
  letter-spacing: -0.01em;
}

.counter-pill {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  color: var(--text-muted);
}

.favs-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-accent-fav {
  background: #f59e0b;
  color: #000000;
  font-weight: 700;
  border-color: #d97706;
}

.btn-accent-fav:hover {
  background: #d97706;
  color: #ffffff;
}

.btn-ghost-sm {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.btn-ghost-sm:hover {
  color: #ffffff;
  border-color: var(--border-hover);
}

/* ==========================================================================
   MASONRY REAL POR COLUNAS FLEX (CollectUI Architecture)
   Eliminação TOTAL de Espaços Vazios:
   Cada card abraça seu texto (height: auto) e o próximo card fica logo abaixo!
   Zero Flickering: Transições puramente de cor/sombra, sem transform!
   ========================================================================== */
.cards-layout-grid {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  width: 100%;
  box-sizing: border-box;
}

.masonry-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* MODO LISTA EDITORIAL (1 coluna contínua de largura total) */
body.view-list .cards-layout-grid {
  display: block;
  max-width: 960px;
  margin: 0 auto;
}

body.view-list .masonry-col {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ==========================================================================
   Card de Conselho Teocrático (Estilo CollectUI Card Inspiration)
   ========================================================================== */
.conselho-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin: 0;
  box-sizing: border-box;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
  /* CRÍTICO: Zero transform no hover para garantir estabilidade absoluta e sem piscar! */
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
  position: relative;
  overflow: hidden;
}

.conselho-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-hover);
  background: var(--bg-card-hover);
}

/* Linha Superior Colorida com Indicador Fixo e Alinhamento Perfeito */
.conselho-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--card-accent, rgba(255, 255, 255, 0.15));
  border-top-left-radius: var(--radius-card);
  border-top-right-radius: var(--radius-card);
}

.conselho-card.cat-encorajamento { --card-accent: #f43f5e; }
.conselho-card.cat-territorio   { --card-accent: #f59e0b; }
.conselho-card.cat-varoes       { --card-accent: #6366f1; }
.conselho-card.cat-reunioes     { --card-accent: #0ea5e9; }
.conselho-card.cat-pastoreio    { --card-accent: #10b981; }
.conselho-card.cat-contas       { --card-accent: #f97316; }
.conselho-card.cat-pioneiros    { --card-accent: #eab308; }
.conselho-card.cat-censo        { --card-accent: #64748b; }
.conselho-card.cat-estudos      { --card-accent: #8b5cf6; }

/* Cabeçalho do Card */
.card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.card-meta-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Tag de Categoria Elegante - Sem cortes nem linhas desalinhadas */
.card-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  box-sizing: border-box;
}

.card-tag svg {
  flex-shrink: 0;
}

.card-tag.encorajamento { background: rgba(244, 63, 94, 0.12); border: 1px solid rgba(244, 63, 94, 0.3); color: #fb7185; }
.card-tag.territorio   { background: rgba(245, 158, 11, 0.12); border: 1px solid rgba(245, 158, 11, 0.3); color: #f59e0b; }
.card-tag.varoes       { background: rgba(99, 102, 241, 0.12); border: 1px solid rgba(99, 102, 241, 0.3); color: #818cf8; }
.card-tag.reunioes     { background: rgba(14, 165, 233, 0.12); border: 1px solid rgba(14, 165, 233, 0.3); color: #38bdf8; }
.card-tag.pastoreio    { background: rgba(16, 185, 129, 0.12); border: 1px solid rgba(16, 185, 129, 0.3); color: #34d399; }
.card-tag.contas       { background: rgba(249, 115, 22, 0.12); border: 1px solid rgba(249, 115, 22, 0.3); color: #fb923c; }
.card-tag.pioneiros    { background: rgba(234, 179, 8, 0.12); border: 1px solid rgba(234, 179, 8, 0.3); color: #facc15; }
.card-tag.censo        { background: rgba(100, 116, 139, 0.15); border: 1px solid rgba(100, 116, 139, 0.3); color: #94a3b8; }
.card-tag.estudos      { background: rgba(139, 92, 246, 0.12); border: 1px solid rgba(139, 92, 246, 0.3); color: #a78bfa; }
.card-tag.geral        { background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border-subtle); color: var(--text-muted); }

.badge-edited-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: var(--radius-badge);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  line-height: 1.2;
}

.card-tag-sec {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

body.theme-light .card-tag-sec {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.1);
  color: #64748b;
}

/* Botão Estrela de Favorito */
.btn-star-fav {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.12s ease;
  line-height: 1;
}

.btn-star-fav:hover {
  color: #f59e0b;
}

.btn-star-fav.active {
  color: #f59e0b;
}

.btn-star-fav.active svg {
  fill: #f59e0b;
  stroke: #f59e0b;
}

/* Título do Card — Tipografia Elegante e Precisa */
.card-title-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-heading);
  line-height: 1.42;
  margin: 4px 0 8px;
  letter-spacing: -0.01em;
}

/* Texto Justificado com Esquadro Teocrático Perfeito */
.card-paragraph {
  font-size: 13.5px;
  color: #cbd5e1;
  line-height: 1.72;
  white-space: pre-line;
  word-break: normal;
  overflow-wrap: break-word;
  text-align: justify;
  text-justify: inter-word;
  hyphens: none;
  -webkit-hyphens: none;
}

body.theme-light .card-paragraph {
  color: #334155;
}

.card-paragraph strong {
  color: #ffffff;
  font-weight: 600;
}

body.theme-light .card-paragraph strong {
  color: #0f172a;
}

.card-paragraph em {
  color: #38bdf8;
  font-style: italic;
}

body.theme-light .card-paragraph em {
  color: #0284c7;
}

/* Citações Bíblicas em Destaque */
.scripture-ref {
  font-weight: 600;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(56, 189, 248, 0.22);
  display: inline;
  white-space: nowrap;
}

body.theme-light .scripture-ref {
  color: #0369a1;
  background: rgba(3, 105, 161, 0.08);
  border-color: rgba(3, 105, 161, 0.2);
}

.org-ref {
  font-weight: 600;
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.08);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(167, 139, 250, 0.22);
  display: inline;
}

body.theme-light .org-ref {
  color: #6d28d9;
  background: rgba(109, 40, 217, 0.08);
  border-color: rgba(109, 40, 217, 0.2);
}

.card-paragraph .bullet-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 8px;
  text-align: justify;
}

.card-paragraph .bullet-dot {
  color: var(--accent-primary);
  font-weight: bold;
  font-size: 14px;
}

.card-paragraph .bullet-text {
  flex: 1;
}

.highlight-match {
  background: rgba(245, 158, 11, 0.35);
  color: #ffffff;
  padding: 1px 3px;
  border-radius: 3px;
  font-weight: 600;
}

body.theme-light .highlight-match {
  background: rgba(245, 158, 11, 0.25);
  color: #b45309;
}

/* Rodapé do Card (Centralizado, Simétrico e Harmonioso) */
.card-bottom-row {
  display: flex;
  justify-content: center;
  align-items: center;
  border-top: 1px solid var(--border-subtle);
  padding-top: 12px;
  margin-top: 14px;
  width: 100%;
}

.card-btn-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.btn-sm-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 29px;
  padding: 0 10px;
  border-radius: var(--radius-btn);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
  font-family: inherit;
  flex: 1;
  max-width: 95px;
  box-sizing: border-box;
}

/* 1. Botão EDITAR (Azul Céu / Pro Studio) */
.btn-sm-action.btn-edit-action {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
}

.btn-sm-action.btn-edit-action:hover {
  background: rgba(56, 189, 248, 0.22);
  border-color: rgba(56, 189, 248, 0.65);
  color: #ffffff;
}

body.theme-light .btn-sm-action.btn-edit-action {
  background: rgba(2, 132, 199, 0.08);
  border: 1px solid rgba(2, 132, 199, 0.3);
  color: #0284c7;
}

body.theme-light .btn-sm-action.btn-edit-action:hover {
  background: rgba(2, 132, 199, 0.18);
  border-color: rgba(2, 132, 199, 0.55);
  color: #0369a1;
}

/* 2. Botão EXCLUIR (Rose / Coral Suave) */
.btn-sm-action.btn-delete-action {
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #fb7185;
}

.btn-sm-action.btn-delete-action:hover {
  background: rgba(244, 63, 94, 0.22);
  border-color: rgba(244, 63, 94, 0.65);
  color: #ffffff;
}

body.theme-light .btn-sm-action.btn-delete-action {
  background: rgba(225, 29, 72, 0.08);
  border: 1px solid rgba(225, 29, 72, 0.3);
  color: #e11d48;
}

body.theme-light .btn-sm-action.btn-delete-action:hover {
  background: rgba(225, 29, 72, 0.18);
  border-color: rgba(225, 29, 72, 0.55);
  color: #be123c;
}

/* 3. Botão COPIAR (Esmeralda / Sucesso Teocrático) */
.btn-sm-action.btn-copy-action {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
}

.btn-sm-action.btn-copy-action:hover {
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(16, 185, 129, 0.65);
  color: #ffffff;
}

body.theme-light .btn-sm-action.btn-copy-action {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #059669;
}

body.theme-light .btn-sm-action.btn-copy-action:hover {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.55);
  color: #047857;
}

.btn-sm-action.btn-copy-action.copied {
  background: #10b981 !important;
  color: #ffffff !important;
  border-color: #10b981 !important;
}

/* ==========================================================================
   Botões Globais
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 15px;
  border-radius: var(--radius-btn);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.12s ease;
  font-family: inherit;
  text-decoration: none;
  user-select: none;
}

.btn-primary {
  background: var(--accent-primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-primary-hover);
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-outline {
  background: var(--bg-card);
  border-color: var(--border-card);
  color: var(--text-heading);
}

.btn-outline:hover {
  border-color: var(--border-hover);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.3);
  color: #fb7185;
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.22);
  border-color: #f43f5e;
  color: #ffffff;
}

/* ==========================================================================
   Modais
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 15, 0.82);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  overflow-y: auto;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-sidebar);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  width: 100%;
  max-width: min(1180px, 94vw);
  padding: 30px 40px 26px;
  box-shadow: 0 35px 75px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: auto;
  box-sizing: border-box;
}

body.theme-light .modal-card {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 25px 50px rgba(15, 23, 42, 0.18);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 16px;
}

.modal-head-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-heading);
}

.modal-head-title svg {
  color: #38bdf8;
}

.modal-head-title h3 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.modal-close-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 26px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.modal-close-icon:hover {
  color: var(--text-heading);
  background: rgba(255, 255, 255, 0.08);
}

.modal-body-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 18px;
  width: 100%;
}

@media (max-width: 840px) {
  .form-row-2 {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

.field-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.field-wrap label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.field-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.counter-label {
  font-size: 11.5px;
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.input-field, .select-field, .textarea-field {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-heading);
  font-size: 14.5px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

.input-field {
  height: 44px;
  font-weight: 500;
}

.select-field {
  height: 44px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238292a8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

.input-field:focus, .select-field:focus, .textarea-field:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.textarea-field {
  field-sizing: content;
  min-height: 85px;
  resize: none;
  overflow-y: hidden;
  line-height: 1.68;
  font-size: 14.5px;
  color: #cbd5e1;
}

body.theme-light .textarea-field {
  color: #1e293b;
}

/* Rodapé Perfeitamente Simétrico e Centralizado */
.modal-footer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  padding-top: 18px;
  margin-top: 6px;
  width: 100%;
}

.footer-aux-left {
  flex: 1;
  display: flex;
  justify-content: flex-start;
}

.footer-center-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.footer-aux-right {
  flex: 1;
}

.footer-center-actions .btn {
  min-width: 140px;
  height: 38px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  justify-content: center;
}

/* ==========================================================================
   Toast & Voltar ao Topo
   ========================================================================== */
.toast-popup {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #10b981;
  color: #ffffff;
  padding: 11px 20px;
  border-radius: var(--radius-btn);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 2000;
}

.toast-popup.show {
  transform: translateY(0);
  opacity: 1;
}

.btn-scroll-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  color: var(--text-heading);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 900;
}

.btn-scroll-top.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.btn-scroll-top:hover {
  background: var(--accent-primary);
  color: #ffffff;
}

.empty-box {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
  width: 100%;
}

.empty-box h3 {
  font-size: 19px;
  color: var(--text-heading);
  margin-bottom: 8px;
}
