/* ========================================================
   SISTEMA DE CONTAGEM COLABORATIVA DE SANTA CEIA
   Identidade Visual Fiel ao @santaceia.html + Expansões Mobile
   ======================================================== */

:root {
  --font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --text-main: #102a43;
  --text-muted: #60758a;
  --bg-app: #f6f8fb;
  --bg-card: #ffffff;
  --border-color: #d6dee6;
  --border-light: #e2e8ef;

  /* Cores Temáticas */
  --female-gradient: linear-gradient(135deg, #d85a83, #ad315d);
  --female-main: #ad315d;
  --female-light: #f5b4c7;
  --female-plus: #c93e6d;

  --male-gradient: linear-gradient(135deg, #428ed2, #1768b4);
  --male-main: #1768b4;
  --male-light: #acd7fa;
  --male-plus: #237cc8;

  --enfermos-gradient: linear-gradient(135deg, #0d9488, #0f766e);
  --enfermos-main: #0f766e;
  --enfermos-light: #99f6e4;
  --enfermos-plus: #0d9488;

  --success-bg: #dcfce7;
  --success-border: #22c55e;
  --success-text: #14532d;

  --warning-bg: #fef3c7;
  --warning-border: #f59e0b;
  --warning-text: #92400e;

  --whatsapp-color: #25D366;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: var(--font-family);
  color: var(--text-main);
  background: var(--bg-app);
  line-height: 1.45;
  min-height: 100vh;
}

/* Container do App Mobile */
.app {
  max-width: 520px;
  margin: auto;
  min-height: 100vh;
  padding: 16px 16px 40px;
}

/* Painel Administrativo mais largo em telas desktop */
.app-wide {
  max-width: 960px;
  margin: auto;
  min-height: 100vh;
  padding: 20px 18px 50px;
}

/* Barra de Topo / Navbar */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-muted);
}
.top-nav .user-info {
  display: flex;
  flex-direction: column;
}
.top-nav .user-info strong {
  color: var(--text-main);
  font-size: 14px;
}
.top-nav a {
  color: #c93e6d;
  text-decoration: none;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  background: #fff1f2;
}
.top-nav a:hover {
  background: #ffe4e6;
}

/* Cabeçalho */
.head {
  text-align: center;
  margin-bottom: 16px;
}
.head h1 {
  margin: 0;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.head p {
  margin: 4px 0;
  color: var(--text-muted);
  font-size: 14px;
}

/* Banners por Categoria */
.banner {
  border-radius: 18px;
  padding: 18px 22px;
  color: white;
  margin: 10px 0 20px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.06);
}
.banner h2 {
  font-size: 28px;
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.banner .sub-banner {
  font-size: 14px;
  opacity: 0.92;
}

.female .banner, .female .primary {
  background: var(--female-gradient);
}
.male .banner, .male .primary {
  background: var(--male-gradient);
}
.enfermos .banner, .enfermos .primary {
  background: var(--enfermos-gradient);
}

/* Indicador de Rodada */
.round {
  text-align: center;
  font-size: 22px;
  font-weight: 750;
  color: var(--text-main);
  margin-bottom: 6px;
}

/* Contador Principal */
.count {
  text-align: center;
  font-size: 104px;
  font-weight: 800;
  line-height: 1;
  margin: 16px 0 4px;
  color: #07111b;
  user-select: none;
  transition: transform 0.1s ease;
}
.count.pulse {
  transform: scale(1.05);
}

.caption {
  text-align: center;
  font-size: 18px;
  color: var(--text-muted);
}

/* Botões Circulares de Controle (+ e -) */
.controls {
  display: flex;
  justify-content: center;
  gap: 70px;
  margin: 22px 0;
}
.circle {
  width: 92px;
  height: 92px;
  border: 0;
  border-radius: 50%;
  font-size: 52px;
  font-weight: 400;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  transition: transform 0.08s ease, filter 0.15s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.circle:active {
  transform: scale(0.92);
}

.female .circle {
  background: var(--female-light);
  color: #9c2850;
}
.male .circle {
  background: var(--male-light);
  color: #1768b4;
}
.enfermos .circle {
  background: var(--enfermos-light);
  color: #0f766e;
}

.circle.plus {
  color: white;
}
.female .circle.plus {
  background: var(--female-plus);
}
.male .circle.plus {
  background: var(--male-plus);
}
.enfermos .circle.plus {
  background: var(--enfermos-plus);
}

/* Seção Especial de Enfermos (2 contadores lado a lado) */
.enfermos-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 14px 0 20px;
}
.enfermo-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 14px 10px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.enfermo-card.female-enf {
  border-top: 4px solid #d85a83;
}
.enfermo-card.male-enf {
  border-top: 4px solid #428ed2;
}
.enfermo-card h3 {
  margin: 0 0 6px;
  font-size: 15px;
  color: var(--text-main);
}
.enfermo-card .count-enf {
  font-size: 56px;
  font-weight: 800;
  line-height: 1.1;
  color: #07111b;
  margin: 8px 0;
}
.enfermo-controls {
  display: flex;
  justify-content: center;
  gap: 14px;
}
.circle-mini {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-size: 30px;
  font-weight: bold;
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  transition: transform 0.08s ease;
}
.circle-mini:active {
  transform: scale(0.9);
}
.female-enf .circle-mini {
  background: #fce7f3;
  color: #be185d;
}
.female-enf .circle-mini.plus {
  background: #db2777;
  color: white;
}
.male-enf .circle-mini {
  background: #e0f2fe;
  color: #0369a1;
}
.male-enf .circle-mini.plus {
  background: #0284c7;
  color: white;
}

/* Painel de Conferência ao Vivo (Tempo Real) */
.live-conference {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px;
  margin: 20px 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}
.live-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}
.live-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}
.live-badge {
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #059669;
  background: #ecfdf5;
  padding: 4px 8px;
  border-radius: 20px;
}
.live-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  display: inline-block;
  animation: pulse-dot 1.5s infinite;
}
@keyframes pulse-dot {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

/* Box de Indicador Visual de Consenso */
.consensus-box {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.25s ease;
}
.consensus-box.consensus-ok {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success-text);
}
.consensus-box.consensus-diff {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning-text);
  animation: shake 0.3s ease;
}
.consensus-box.consensus-wait {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* Lista de Participantes e Valores */
.participants-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.participant-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 12px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  font-size: 14px;
}
.participant-row.is-me {
  background: #f0f7ff;
  border-color: #bfdbfe;
  font-weight: 600;
}
.participant-name {
  display: flex;
  align-items: center;
  gap: 6px;
}
.role-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
}
.role-badge.lider {
  background: #e0e7ff;
  color: #3730a3;
}
.role-badge.ajudante {
  background: #e2e8f0;
  color: #475569;
}
.participant-val {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
}
.participant-val-enfermos {
  font-size: 13px;
  font-weight: 700;
  display: flex;
  gap: 8px;
}

/* Card de Estatísticas do Original */
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  background: white;
  margin: 18px 0;
}
.stat {
  text-align: center;
  padding: 12px 5px;
  border-right: 1px solid var(--border-color);
}
.stat:last-child {
  border: 0;
}
.stat b {
  display: block;
  font-size: 22px;
  color: var(--text-main);
}
.stat span {
  font-size: 11px;
  color: #52687c;
}

/* Botões */
.btn {
  width: 100%;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid #c6d0da;
  background: white;
  font-weight: 700;
  font-size: 16px;
  margin: 7px 0;
  cursor: pointer;
  color: var(--text-main);
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}
.btn:hover {
  background: #f1f5f9;
}
.btn:active {
  transform: scale(0.98);
}
.btn.primary {
  border: 0;
  background: linear-gradient(135deg, #1768b4, #0f4c81);
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(23, 104, 180, 0.25);
}
.btn.primary:hover {
  background: linear-gradient(135deg, #1d78cd, #145894);
  color: #ffffff !important;
}
.btn.btn-danger {
  background: #ef4444;
  color: white;
  border: 0;
}
.btn.btn-danger:hover {
  background: #dc2626;
}
.btn.btn-secondary {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #475569;
}
.btn.btn-whatsapp {
  background: var(--whatsapp-color);
  color: white;
  border: 0;
  font-weight: 700;
}
.btn.btn-whatsapp:hover {
  background: #20ba5a;
}
.btn-sm {
  padding: 8px 12px;
  font-size: 13px;
  width: auto;
  border-radius: 8px;
}

/* Notação de rodapé */
.note {
  text-align: center;
  color: #617588;
  font-size: 13px;
  margin-top: 18px;
}

/* Cards de Resumo */
.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 18px 0;
}
.card {
  text-align: center;
  padding: 18px;
  background: white;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.card b {
  font-size: 34px;
  display: block;
  color: var(--text-main);
}
.grand {
  text-align: center;
  background: #e8eef3;
  padding: 18px;
  border-radius: 14px;
  font-size: 18px;
  border: 1px solid #d2dbe3;
  margin: 12px 0;
}
.grand b {
  font-size: 38px;
  display: block;
  color: #0f2742;
}

/* Tabelas */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  background: white;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  margin: 16px 0;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
  font-size: 14px;
}
th {
  background: #edf2f7;
  color: #4a5d6e;
  font-weight: 600;
}
tr:last-child td {
  border-bottom: 0;
}
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Formulários */
.form-group {
  margin-bottom: 14px;
}
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #334155;
}
.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  background: white;
  outline: none;
  transition: border-color 0.2s ease;
}
.form-control:focus {
  border-color: #1768b4;
  box-shadow: 0 0 0 3px rgba(23, 104, 180, 0.15);
}

/* Abas Administrativas */
.nav-tabs {
  display: flex;
  gap: 8px;
  margin: 16px 0;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 2px;
  overflow-x: auto;
}
.tab-link {
  padding: 10px 16px;
  border-radius: 8px 8px 0 0;
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}
.tab-link.active {
  color: #1768b4;
  border-bottom: 3px solid #1768b4;
  background: white;
}

/* Painel de Ajudantes (Links e WhatsApp) */
.helper-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 10px;
}
.helper-actions {
  display: flex;
  gap: 6px;
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  margin: 12px 0;
}
.alert-success { background: #dcfce7; border: 1px solid #86efac; color: #166534; }
.alert-danger { background: #fee2e2; border: 1px solid #fca5a5; color: #991b1b; }
.alert-info { background: #e0f2fe; border: 1px solid #7dd3fc; color: #075985; }

/* Responsividade adicional */
@media(max-width: 380px) {
  .count { font-size: 82px; }
  .controls { gap: 40px; }
  .circle { width: 82px; height: 82px; font-size: 44px; }
}

/* Estilo para Impressão de Relatório Oficial */
@media print {
  body { background: white !important; color: black !important; }
  .top-nav, .btn, .no-print { display: none !important; }
  .app, .app-wide { max-width: 100% !important; padding: 0 !important; }
  .card, .table-responsive, table { border: 1px solid #999 !important; box-shadow: none !important; }
  th { background: #f0f0f0 !important; color: black !important; }
  .banner { border: 2px solid #333 !important; color: black !important; background: white !important; }
  .banner h2 { color: black !important; }
}