/* FilaClin — versão estática (sem React/Vite/Node) */
:root {
  --radius: 0.75rem;
  --background: oklch(0.99 0.005 280);
  --foreground: oklch(0.18 0.04 270);
  --card: #ffffff;
  --card-foreground: oklch(0.18 0.04 270);
  --primary: oklch(0.58 0.22 295);
  --primary-foreground: oklch(0.99 0.005 280);
  --primary-glow: oklch(0.72 0.18 300);
  --muted: oklch(0.96 0.01 280);
  --muted-foreground: oklch(0.5 0.03 270);
  --accent: oklch(0.94 0.04 295);
  --accent-foreground: oklch(0.32 0.12 290);
  --warning: oklch(0.78 0.15 75);
  --warning-foreground: oklch(0.2 0.05 60);
  --border: oklch(0.92 0.015 285);
  --input: oklch(0.92 0.015 285);
  --ring: oklch(0.58 0.22 295);
  --gradient-primary: linear-gradient(135deg, oklch(0.58 0.22 295), oklch(0.72 0.18 300));
  --gradient-hero: linear-gradient(135deg, oklch(0.58 0.22 295) 0%, oklch(0.5 0.24 280) 50%, oklch(0.42 0.18 260) 100%);
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --shadow-glow: 0 0 40px -10px oklch(0.58 0.22 295 / 0.5);
  --shadow-elegant: 0 10px 40px -10px oklch(0.4 0.15 280 / 0.25);
}

* { box-sizing: border-box; margin: 0; padding: 0; border-color: var(--border); }
html, body { height: 100%; }
body {
  background-color: var(--background);
  color: var(--foreground);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
h1,h2,h3,h4 { letter-spacing: -0.02em; font-weight: 700; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }

/* Utilities */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
.container-narrow { max-width: 720px; margin: 0 auto; padding: 0 1rem; }
.min-h-screen { min-height: 100vh; }
.flex { display: flex; }
.grid { display: grid; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: .5rem; } .gap-3 { gap: .75rem; } .gap-4 { gap: 1rem; } .gap-6 { gap: 1.5rem; }
.text-center { text-align: center; }
.hidden { display: none; }
.relative { position: relative; }
.absolute { position: absolute; }
.sticky { position: sticky; top: 0; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid color-mix(in oklch, var(--border) 50%, transparent);
  background-color: color-mix(in oklch, var(--background) 70%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.site-header .bar {
  height: 4rem; display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.125rem; }
.brand-mark {
  width: 2.25rem; height: 2.25rem; border-radius: .9rem;
  background-image: var(--gradient-primary);
  display: grid; place-items: center; box-shadow: var(--shadow-glow);
  color: var(--primary-foreground);
}
.brand-mark svg { width: 1.25rem; height: 1.25rem; }
.nav { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  border-radius: .6rem; padding: .55rem .95rem; font-weight: 500; font-size: .875rem;
  transition: background .15s, color .15s, box-shadow .15s, transform .05s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-ghost { background: transparent; color: var(--foreground); }
.btn-ghost:hover { background: var(--accent); color: var(--accent-foreground); }
.btn-outline { border: 1px solid var(--border); background: transparent; }
.btn-outline:hover { background: var(--accent); color: var(--accent-foreground); }
.btn-primary { background-image: var(--gradient-primary); color: var(--primary-foreground); }
.btn-primary:hover { box-shadow: var(--shadow-glow); }
.btn-secondary { background: var(--muted); color: var(--foreground); }
.btn-lg { padding: .75rem 1.25rem; font-size: 1rem; }
.btn-sm { padding: .4rem .75rem; font-size: .8125rem; }

.shadow-glow { box-shadow: var(--shadow-glow); }
.shadow-elegant { box-shadow: var(--shadow-elegant); }

/* Hero */
.hero { position: relative; overflow: hidden; }
.hero-bg { position: absolute; inset: 0; background-image: var(--gradient-hero); opacity: .3; pointer-events: none; }
.hero-glow {
  position: absolute; top: 5rem; left: 50%; transform: translateX(-50%);
  width: 600px; height: 600px; border-radius: 9999px;
  background: color-mix(in oklch, var(--primary) 20%, transparent);
  filter: blur(80px); pointer-events: none;
}
.hero-inner { position: relative; padding: 6rem 0; }
@media (min-width: 768px) { .hero-inner { padding: 8rem 0; } }
.hero-content { max-width: 768px; margin: 0 auto; text-align: center; }
.hero-badge {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .25rem .75rem; border-radius: 9999px;
  background: var(--accent); color: var(--accent-foreground);
  font-size: .75rem; font-weight: 500; margin-bottom: 1.5rem;
}
.hero-badge svg { width: .75rem; height: .75rem; }
.hero h1 {
  font-size: clamp(2.25rem, 5vw, 3.75rem); line-height: 1.05;
  margin-bottom: 1.5rem;
}
.gradient-text {
  background-image: var(--gradient-primary);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p {
  font-size: 1.125rem; color: var(--muted-foreground);
  max-width: 640px; margin: 0 auto 2rem;
}
.hero-actions { display: flex; flex-direction: column; gap: .75rem; justify-content: center; }
@media (min-width: 640px) { .hero-actions { flex-direction: row; } }

/* Features grid */
.features { padding: 5rem 0; }
.features-grid { display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
@media (min-width: 768px) { .features-grid { grid-template-columns: repeat(3, 1fr); } }
.feature-card {
  border: 1px solid var(--border); background: var(--card);
  border-radius: 1rem; padding: 1.5rem;
  transition: box-shadow .2s;
}
.feature-card:hover { box-shadow: var(--shadow-elegant); }
.feature-icon {
  width: 2.5rem; height: 2.5rem; border-radius: .5rem;
  background: var(--accent); color: var(--accent-foreground);
  display: grid; place-items: center; margin-bottom: 1rem;
}
.feature-icon svg { width: 1.25rem; height: 1.25rem; }
.feature-card h3 { font-size: 1rem; margin-bottom: .25rem; }
.feature-card p { font-size: .875rem; color: var(--muted-foreground); }

/* Footer */
.site-footer {
  border-top: 1px solid color-mix(in oklch, var(--border) 50%, transparent);
  padding: 2rem 0; text-align: center;
  font-size: .875rem; color: var(--muted-foreground);
}

/* Form / card */
.page-main { padding: 2.5rem 0; }
.page-title { font-size: 1.875rem; margin-bottom: .25rem; }
.page-sub { color: var(--muted-foreground); margin-bottom: 2rem; }
.card {
  border: 1px solid var(--border); background: var(--card);
  border-radius: 1rem; padding: 1.5rem;
}
.form-grid { display: grid; gap: 1.25rem; }
.form-row { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .form-row-2 { grid-template-columns: 1fr 1fr; } }
.field { display: grid; gap: .5rem; }
.label { font-size: .875rem; font-weight: 500; }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--input); background: var(--card);
  border-radius: .5rem; padding: .55rem .75rem; font-size: .875rem;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 25%, transparent);
}
.textarea { resize: vertical; min-height: 5rem; }
.radio-grid { display: grid; gap: .75rem; grid-template-columns: 1fr 1fr; }
.radio-card {
  display: flex; align-items: center; gap: .5rem;
  border: 1px solid var(--border); border-radius: .5rem; padding: .75rem;
  cursor: pointer;
}
.radio-card:hover { background: var(--accent); color: var(--accent-foreground); }
.helper { font-size: .75rem; color: var(--muted-foreground); }

.clickable-nome { cursor: pointer; color: var(--foreground); font-weight: 500; }
.clickable-nome:hover { color: var(--ring); text-decoration: underline; }

.detalhes-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: .75rem; }
.det-item { display: flex; flex-direction: column; gap: .15rem; }
.det-item.full { grid-column: 1 / -1; }
.det-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-foreground); font-weight: 600; }
.det-val { font-size: .9rem; color: var(--foreground); }

/* Vagas Info - linha de status clara abaixo do select */
.vagas-info {
  margin-top: .5rem;
  padding: .625rem .875rem;
  border-radius: .5rem;
  font-size: .875rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .5rem;
  min-height: 2.5rem;
}
.vagas-info.lotada  { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }
.vagas-info.quase   { background: #fffbeb; color: #d97706; border: 1px solid #fcd34d; }
.vagas-info.ok      { background: #f0fdf4; color: #16a34a; border: 1px solid #86efac; }
.vagas-info.sem-limite { background: var(--muted); color: var(--muted-foreground); border: 1px solid var(--border); font-weight: 500; }
.vagas-info .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.vagas-info.lotada  .dot { background: #dc2626; }
.vagas-info.quase   .dot { background: #d97706; }
.vagas-info.ok      .dot { background: #16a34a; }
.vagas-info.sem-limite .dot { background: var(--muted-foreground); }

.notice {
  border: 1px dashed var(--border); border-radius: .75rem;
  padding: 1rem; background: var(--muted);
  font-size: .875rem; color: var(--muted-foreground);
}

/* Painel da Fila */
.painel {
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
  background: linear-gradient(165deg, #0f0f23 0%, #1a1a3e 50%, #0d0d1f 100%);
  font-family: var(--font-display);
  display: flex;
  flex-direction: column;
  color: var(--primary-foreground);
}
.painel-header {
  display: flex; align-items: center; justify-content: space-between; 
  padding: .75rem 1.5rem;
  flex-shrink: 0; gap: 1rem;
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.3) 0%, rgba(59, 130, 246, 0.3) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.painel-header .hdr-left {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-width: 80px;
}
.painel-header .hdr-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .25rem;
}
.painel-header .hdr-right { 
  display: flex; 
  align-items: center; 
  gap: .5rem; 
  flex-shrink: 0;
  min-width: 80px;
  justify-content: flex-end;
}
.painel-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-shadow: 0 2px 10px rgba(0,0,0,0.3);
  white-space: nowrap;
}
.painel-logo-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.painel-logo-wrap img {
  height: 2.5rem;
  border-radius: .5rem;
  object-fit: contain;
}
.painel-logo-nome {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.05em;
  text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

/* Info do relógio melhorada */
#relogio {
  font-size: .85rem;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.08);
  padding: .35rem .75rem;
  border-radius: .5rem;
  letter-spacing: .02em;
}

/* ── Botão de som ── */
#btn-som {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .3rem .6rem;
  border-radius: 9999px;
  border: 1.5px solid transparent;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  transition: all .2s ease;
  cursor: pointer;
  user-select: none;
}
#btn-som:hover { opacity: .85; }

/* Ligado */
#btn-som.som-ligado {
  background: rgba(34 197 94 / .18);
  border-color: #22c55e;
  color: #4ade80;
  box-shadow: 0 0 10px rgba(34 197 94 / .3);
}
/* Desligado */
#btn-som.som-desligado {
  background: rgba(255 255 255 / .08);
  border-color: rgba(255 255 255 / .2);
  color: rgba(255 255 255 / .35);
}
/* Ícone semmuted quando desligado */
#btn-som.som-desligado #icon-som { stroke: rgba(255 255 255 / .35); }

/* Ponto animado quando ligado */
#som-indicador {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  animation: som-pulse 1.8s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes som-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 4px #22c55e; }
  50% { opacity: .4; box-shadow: none; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
.painel-main {
  flex: 1; display: flex;
  overflow: hidden;
  width: 100%;
}
.painel-split {
  display: flex;
  flex: 1;
  overflow: hidden;
}
.fila-lista {
  display: none;
}
.fila-lista-header {
  padding: 1.25rem 1.25rem 1rem;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: rgba(255,255,255,0.5);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
  background: rgba(139, 92, 246, 0.1);
}
#fila-items {
  flex: 1;
  overflow-y: auto;
  padding: .75rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
#fila-items::-webkit-scrollbar { width: 6px; }
#fila-items::-webkit-scrollbar-track { background: transparent; }
#fila-items::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
.fila-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem .85rem;
  border-radius: .75rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  transition: all .2s ease;
}
.fila-item:hover {
  background: rgba(255,255,255,0.08);
  transform: translateX(2px);
}
.fila-item-senha {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  min-width: 45px;
  text-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}
.fila-item-info { flex: 1; min-width: 0; }
.fila-item-nome {
  font-size: .85rem;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fila-item-prof {
  font-size: .7rem;
  color: rgba(255,255,255,0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fila-item-badge {
  font-size: .6rem;
  font-weight: 700;
  color: rgba(139, 92, 246, 0.9);
  background: rgba(139, 92, 246, 0.15);
  padding: .15rem .4rem;
  border-radius: 9999px;
  white-space: nowrap;
}
.fila-item.nao-compareceu {
  border-left: 3px solid #f97316;
  background: rgba(249, 115, 22, 0.1);
}
.fila-item.nao-compareceu:hover {
  background: rgba(249, 115, 22, 0.15);
}
.fila-item.nao-compareceu .fila-item-senha { color: #fb923c; }
.fila-item.nao-compareceu .fila-item-nome { color: #fdba74; }
.nao-compareceu-badge {
  background: #f97316 !important;
  color: #fff !important;
  font-size: .85rem !important;
  padding: 0 .3rem !important;
  border-radius: 9999px !important;
  font-weight: 400 !important;
}
.fila-divider {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem .75rem .25rem;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #fb923c;
  opacity: .9;
}
.fila-divider::before,
.fila-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(249, 115, 22, 0.4);
}
.cards-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.painel-card {
  border-radius: 1.5rem;
  background: rgba(255,255,255,.1);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.2);
  padding: 2.5rem; text-align: center;
}
.painel-card-sm {
  border-radius: 1rem;
  background: rgba(255,255,255,.05);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.1);
  padding: 1.5rem;
}
.painel-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .15em; opacity: .75; margin-bottom: 1rem; }
.painel-senha-big { font-size: clamp(6rem, 18vw, 14rem); font-weight: 700; line-height: 1; letter-spacing: -0.05em; }
.painel-senha-md { font-size: clamp(3rem, 8vw, 5rem); font-weight: 700; }
.painel-consultorio {
  font-size: clamp(1.5rem, 4vw, 2.5rem); font-weight: 700; margin-top: .5rem;
  opacity: .9; letter-spacing: .05em;
}
.painel-fila { display: flex; flex-direction: column; gap: .5rem; max-height: 60vh; overflow-y: auto; }
.painel-fila-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem; border-radius: .5rem; background: rgba(255,255,255,.05);
}
.painel-fila-item .senha { font-weight: 700; font-size: 1.5rem; }
.painel-fila-item .pos, .painel-fila-item .stat { font-size: .75rem; opacity: .7; text-transform: uppercase; }
.painel-footer { 
  padding: .75rem 1.5rem; 
  text-align: center; 
  font-size: .8rem; 
  opacity: .5; 
  flex-shrink: 0;
  color: rgba(255,255,255,0.4);
  background: rgba(0,0,0,0.2);
}
.painel-gate {
  position: fixed; inset: 0;
  background: linear-gradient(165deg, #0f0f23 0%, #1a1a3e 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.gate-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 1.5rem;
  padding: 3rem;
  text-align: center;
  max-width: 400px; width: 90%;
  display: flex; flex-direction: column; gap: 1rem;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
  backdrop-filter: blur(10px);
}
.gate-icon { font-size: 3rem; margin-bottom: .5rem; }
.gate-title { color: #fff; font-size: 1.5rem; margin: 0; font-weight: 700; }
.gate-sub { color: rgba(255,255,255,.6); font-size: .9rem; margin: 0; }
.gate-input { width: 100%; text-align: center; font-size: 1.1rem; padding: 1rem; border-radius: .75rem; }
.gate-erro { color: #f87171; font-size: .85rem; font-weight: 600; }
.gate-btn { width: 100%; padding: 1rem; font-size: 1rem; border-radius: .75rem; }

.msg-publica {
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.2) 0%, rgba(59, 130, 246, 0.2) 100%);
  border-top: 1px solid rgba(255,255,255,0.1);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding: .75rem 1.5rem;
  text-align: center;
  font-size: .9rem;
  color: rgba(255,255,255,0.8);
  flex-shrink: 0;
}

/* Focus Mode - Cards vertical por profissional */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: clamp(0.75rem, 2vw, 1.5rem);
  padding: clamp(1rem, 2vw, 1.5rem);
  overflow-y: auto;
  flex: 1;
  align-content: start;
}
.cards-grid::-webkit-scrollbar { width: 8px; }
.cards-grid::-webkit-scrollbar-track { background: transparent; }
.cards-grid::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
.cards-grid:empty { display: none; }

/* Cada bloco = 1 profissional */
.tv-prof-block {
  border-radius: 1.25rem;
  overflow: hidden;
  animation: cardEntrar .4s cubic-bezier(.34,1.56,.64,1) forwards;
  /* Base:TV 32" (~1280px) */
  font-size: clamp(0.75rem, 1.2vw, 1rem);
}
@keyframes cardEntrar {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.tv-prof-saida {
  animation: cardSair .3s ease forwards;
}
@keyframes cardSair {
  to { opacity: 0; transform: translateY(10px) scale(0.95); }
}

/* Card em atendimento — gradient melhorado */
.tv-card-em {
  background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 50%, #4f46e5 100%);
  padding: clamp(1rem, 2.5vw, 1.5rem) clamp(1.25rem, 3.5vw, 2rem);
  color: #fff;
  border-radius: 1.25rem 1.25rem 0 0;
  position: relative;
  overflow: hidden;
}
.tv-card-em::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.15) 0%, transparent 50%);
  pointer-events: none;
}
.tv-card-em-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: clamp(0.5rem, 1.2vw, 0.75rem);
  flex-wrap: wrap;
  gap: 0.25rem;
  position: relative;
  z-index: 1;
}
.tv-card-em-label {
  font-size: clamp(0.7rem, 1.4vw, 0.85rem);
  text-transform: uppercase;
  letter-spacing: .12em;
  opacity: .9;
  font-weight: 700;
  color: rgba(255,255,255,0.95);
}
.tv-card-cons {
  font-size: clamp(0.65rem, 1.3vw, 0.8rem);
  font-weight: 700;
  background: rgba(255,255,255,0.25);
  padding: clamp(0.15rem, 0.4vw, 0.2rem) clamp(0.5rem, 1.4vw, 0.75rem);
  border-radius: 9999px;
  backdrop-filter: blur(4px);
}
.tv-card-senha {
  font-size: clamp(3rem, 10vw, 5.5rem);
  font-weight: 900;
  line-height: .9;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 4px 20px rgba(0,0,0,0.3);
  position: relative;
  z-index: 1;
}
.tv-card-paciente {
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  font-weight: 600;
  margin-top: clamp(0.3rem, 1vw, 0.5rem);
  opacity: .95;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  position: relative;
  z-index: 1;
}
.tv-card-prof {
  font-size: clamp(0.75rem, 1.6vw, 0.9rem);
  opacity: .7;
  margin-top: clamp(0.15rem, 0.5vw, 0.25rem);
  position: relative;
  z-index: 1;
}

/* Card próxima senha */
.tv-card-prox {
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.3) 0%, rgba(99, 102, 241, 0.15) 100%);
  padding: clamp(0.75rem, 1.8vw, 1.25rem) clamp(1rem, 3vw, 1.5rem);
  color: #fff;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2.5vw, 1.25rem);
  flex-wrap: wrap;
}
.tv-card-prox-label {
  font-size: clamp(0.65rem, 1.3vw, 0.75rem);
  text-transform: uppercase;
  letter-spacing: .1em;
  opacity: .6;
  font-weight: 600;
  white-space: nowrap;
}
.tv-card-prox-senha {
  font-size: clamp(1.5rem, 4.5vw, 2.5rem);
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  color: #a5b4fc;
  text-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
}
.tv-card-prox-nome {
  font-size: clamp(0.75rem, 1.6vw, 0.9rem);
  opacity: .7;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.tv-card-sem-prox {
  font-size: clamp(0.7rem, 1.4vw, 0.8rem);
  opacity: .4;
  font-style: italic;
}

/* Barra de fila */
.tv-card-fila {
  padding: clamp(0.4rem, 1vw, 0.6rem) clamp(1rem, 3vw, 1.5rem);
  font-size: clamp(0.7rem, 1.4vw, 0.8rem);
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  background: rgba(0,0,0,0.3);
  letter-spacing: .05em;
  border-radius: 0 0 1rem 1rem;
}

/* tv-prof-block melhorado */
.tv-prof-block {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 1.25rem;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  transition: transform .3s ease, box-shadow .3s ease;
}
.tv-prof-block:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(139, 92, 246, 0.2);
}

/* ══════════════════════════════════════════════════
   TV OPTIMIZATIONS — breakpoints específicos para
   Smart TVs: 50", 40" e 32" polegadas
   Viewports típicos:
     50"/40" 1080p  → ~1920px
     50"/40" 4K     → viewport 1920px (browser escala)
     32"   720p    → ~1280px
     32"   1080p   → ~1920px
     tablets        → ~768-1024px
   ══════════════════════════════════════════════════ */

/* ── TV 32" (1280px) ─────────────────────────────── */
@media (max-width: 1280px) {
  .cards-grid {
    /* 2 cards por linha em 1280px — senha bem visível */
    grid-template-columns: repeat(2, 1fr);
  }

  .tv-prof-block {
    font-size: clamp(0.85rem, 1.3vw, 1.1rem);
  }

  .tv-card-senha {
    font-size: clamp(3.5rem, 6vw, 6rem);
  }

  .tv-card-paciente {
    font-size: clamp(1.1rem, 1.8vw, 1.4rem);
    white-space: normal;
    overflow: visible;
  }

  .tv-card-prof {
    font-size: clamp(0.85rem, 1.4vw, 1rem);
  }

  .tv-card-prox-senha {
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  }

  .tv-card-prox-nome {
    font-size: clamp(0.85rem, 1.4vw, 1rem);
  }

  .tv-card-em-label,
  .tv-card-cons {
    font-size: clamp(0.7rem, 1.1vw, 0.85rem);
  }

  .tv-card-fila {
    font-size: clamp(0.75rem, 1.2vw, 0.9rem);
  }

  .tv-card-em {
    padding: clamp(1rem, 2vw, 1.5rem) clamp(1.25rem, 2.5vw, 1.75rem);
  }

  .tv-card-prox {
    padding: clamp(0.8rem, 1.5vw, 1.25rem) clamp(1rem, 2vw, 1.5rem);
  }

  /* Sidebar da fila: letras maiores */
  .fila-lista {
    display: none;
  }

  .painel-title {
    font-size: clamp(0.75rem, 1.1vw, 1rem);
  }
}

/* ── TV 40"/50" 1080p (1920px) — padrão grande ──── */
@media (min-width: 1281px) and (max-width: 1920px) {
  .cards-grid {
    /* 3 cards por linha em 1920px */
    grid-template-columns: repeat(3, 1fr);
  }

  .tv-prof-block {
    font-size: clamp(0.9rem, 0.9vw, 1.15rem);
  }

  .tv-card-senha {
    font-size: clamp(4rem, 4.5vw, 7rem);
  }

  .tv-card-paciente {
    font-size: clamp(1.1rem, 1.2vw, 1.5rem);
    white-space: normal;
    overflow: visible;
  }

  .tv-card-prof {
    font-size: clamp(0.85rem, 0.9vw, 1.1rem);
  }

  .tv-card-prox-senha {
    font-size: clamp(2rem, 2.5vw, 3.5rem);
  }

  .tv-card-prox-nome {
    font-size: clamp(0.85rem, 0.9vw, 1.1rem);
  }

  .tv-card-em-label,
  .tv-card-cons {
    font-size: clamp(0.7rem, 0.75vw, 0.9rem);
  }

  .tv-card-fila {
    font-size: clamp(0.75rem, 0.8vw, 0.95rem);
  }

  .tv-card-em {
    padding: clamp(1.25rem, 1.5vw, 2rem) clamp(1.5rem, 2vw, 2.5rem);
  }

  .tv-card-prox {
    padding: clamp(1rem, 1.2vw, 1.5rem) clamp(1.25rem, 1.5vw, 2rem);
    gap: clamp(0.75rem, 1vw, 1.5rem);
  }

  .fila-lista {
    display: none;
  }

  .painel-title {
    font-size: clamp(0.8rem, 0.9vw, 1.1rem);
  }
}

/* ── TV 50"+ 4K ou telas muito grandes (>1920px) ── */
@media (min-width: 1921px) {
  .cards-grid {
    /* 4+ cards — senha continua grande */
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }

  .tv-prof-block {
    font-size: clamp(1rem, 0.65vw, 1.25rem);
  }

  .tv-card-senha {
    font-size: clamp(5rem, 5vw, 9rem);
  }

  .tv-card-paciente {
    font-size: clamp(1.4rem, 1.2vw, 2rem);
  }

  .tv-card-prof {
    font-size: clamp(1rem, 0.85vw, 1.25rem);
  }

  .tv-card-prox-senha {
    font-size: clamp(2.5rem, 2vw, 4rem);
  }

  .tv-card-prox-nome {
    font-size: clamp(1rem, 0.85vw, 1.25rem);
  }

  .tv-card-em-label,
  .tv-card-cons {
    font-size: clamp(0.8rem, 0.7vw, 1rem);
  }

  .tv-card-fila {
    font-size: clamp(0.85rem, 0.7vw, 1rem);
  }

  .tv-card-em {
    padding: clamp(1.5rem, 1.5vw, 2.5rem) clamp(2rem, 2vw, 3rem);
  }

  .tv-card-prox {
    padding: clamp(1.25rem, 1.2vw, 2rem) clamp(1.5rem, 1.5vw, 2.5rem);
    gap: clamp(1rem, 1vw, 1.75rem);
  }

  .fila-lista {
    display: none;
  }

  .painel-title {
    font-size: clamp(0.9rem, 0.75vw, 1.1rem);
  }

  .painel-header {
    padding: clamp(0.75rem, 0.8vw, 1.25rem) clamp(1.25rem, 1.5vw, 2rem);
  }

  .painel-footer {
    padding: clamp(0.75rem, 0.8vw, 1rem) clamp(1.25rem, 1.5vw, 2rem);
    font-size: clamp(0.75rem, 0.7vw, 0.9rem);
  }
}

/* ── Tablets (768-1024px) — cards menores mas legíveis ── */
@media (max-width: 1024px) and (min-width: 769px) {
  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }

  .tv-card-senha {
    font-size: clamp(3rem, 7vw, 5rem);
  }

  .fila-lista {
    display: none;
  }
}

/* ── Mobile (<768px) — empilha cards ── */
@media (max-width: 768px) {
  .painel-split {
    flex-direction: column;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  .fila-lista {
    display: none;
  }

  .tv-card-senha {
    font-size: clamp(2.5rem, 10vw, 5rem);
  }
}
.painel-vazio {
  display: none !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 2rem;
  text-align: center;
  padding: 2rem;
}
.painel-vazio.mostrar { display: flex !important; }
.vazio-icon { font-size: 5rem; animation: pulseVazio 2s ease-in-out infinite; }
@keyframes pulseVazio {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.05); opacity: 0.8; }
}
.vazio-texto { 
  font-size: 1.4rem; 
  font-weight: 600; 
  color: rgba(255,255,255,.5); 
  letter-spacing: .05em;
  text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

/* Acompanhar */
.status-box {
  display: grid; gap: .5rem; padding: 1.25rem; border-radius: 1rem;
  border: 1px solid var(--border); background: var(--card); text-align: center;
}
.status-badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .25rem .75rem; border-radius: 9999px; font-size: .75rem; font-weight: 600;
  background: var(--warning); color: var(--warning-foreground);
  justify-self: center;
}
.senha-display {
  font-size: 4rem; font-weight: 700; letter-spacing: -0.04em;
  background-image: var(--gradient-primary);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ====================== ADMIN SHELL ====================== */
.admin-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }

.admin-sidebar {
  display: flex; flex-direction: column; border-right: 1px solid var(--border);
  background: var(--card); position: sticky; top: 0; height: 100vh;
  z-index: 20; /* Above overlay */
}

/* Overlay - hidden by default on desktop */
.admin-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 5; /* Below sidebar on desktop */
}

/* Desktop sidebar nav links */
.admin-sidebar nav {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
}

.admin-sidebar nav a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.admin-sidebar nav a:hover {
  background: var(--accent);
}

.admin-sidebar nav a.active {
  background: var(--accent);
  font-weight: 600;
}

.admin-sidebar nav a .pill {
  margin-left: auto;
}
.admin-sidebar .brand-row { display: flex; align-items: center; gap: .5rem; padding: 1rem; border-bottom: 1px solid var(--border); }
.admin-sidebar nav { display: flex; flex-direction: column; gap: .15rem; padding: .5rem; flex: 1; overflow-y: auto; }
.admin-sidebar nav a {
  display: flex; align-items: center; gap: .6rem; padding: .55rem .75rem; border-radius: .5rem;
  font-size: .875rem; color: var(--foreground); position: relative;
}
.admin-sidebar nav a:hover { background: var(--accent); color: var(--accent-foreground); }
.admin-sidebar nav a.active { background: var(--accent); color: var(--accent-foreground); font-weight: 600; }
.admin-sidebar nav a .pill {
  margin-left: auto; background: #dc2626; color: #fff; font-size: .65rem; font-weight: 700;
  border-radius: 9999px; padding: .05rem .4rem;
}
.admin-sidebar .foot { border-top: 1px solid var(--border); padding: .5rem; display: flex; flex-direction: column; gap: .15rem; }
.admin-sidebar .foot button {
  display: flex; align-items: center; gap: .6rem; padding: .55rem .75rem; border-radius: .5rem;
  font-size: .875rem; text-align: left; width: 100%;
}
.admin-sidebar .foot button:hover { background: var(--accent); color: var(--accent-foreground); }

/* ── Info do usuário logado ── */
.admin-user {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .75rem;
  background: var(--muted);
  border-radius: .5rem;
  margin-bottom: .15rem;
}
.admin-user-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  background-image: var(--gradient-primary);
  color: var(--primary-foreground);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: .85rem;
  flex-shrink: 0;
}
.admin-user-info { min-width: 0; }
.admin-user-email {
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-user-role {
  font-size: .65rem;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.admin-main { display: flex; flex-direction: column; min-width: 0; }
.admin-header {
  height: 3.5rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .5rem; padding: 0 1rem;
  position: sticky; top: 0; background: color-mix(in oklch, var(--background) 80%, transparent);
  backdrop-filter: blur(12px); z-index: 5;
}
.admin-content { flex: 1; padding: 1.5rem; max-width: 100%; overflow-x: hidden; }
.icon-btn {
  width: 2rem; height: 2rem; display: inline-grid; place-items: center; border-radius: .4rem;
}
.icon-btn:hover { background: var(--accent); }

/* Generic admin UI */
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }
.muted { color: var(--muted-foreground); }
.h1 { font-size: 1.5rem; font-weight: 700; }
.h2 { font-size: 1.125rem; font-weight: 600; }
.small { font-size: .75rem; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.stack-sm { display: flex; flex-direction: column; gap: .5rem; }
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
@media (min-width: 768px) { .kpi-grid { grid-template-columns: repeat(4, 1fr); } }
.kpi-grid-5 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
@media (min-width: 768px) { .kpi-grid-5 { grid-template-columns: repeat(5, 1fr); } }
.kpi-grid-4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
@media (min-width: 768px) { .kpi-grid-4 { grid-template-columns: repeat(4, 1fr); } }
.kpi {
  border: 1px solid var(--border); background: var(--card); border-radius: .9rem; padding: .9rem;
  display: flex; flex-direction: column; gap: .25rem;
}
.kpi .label { font-size: .7rem; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: .05em; }
.kpi .value { font-size: 1.5rem; font-weight: 700; }
.kpi.gradient { background-image: var(--gradient-primary); color: var(--primary-foreground); border: none; }
.kpi.gradient .value { font-size: 3rem; }

/* Tables */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: .75rem; background: var(--card); }
.tbl { width: 100%; border-collapse: collapse; font-size: .875rem; }
.tbl th, .tbl td { padding: .55rem .65rem; text-align: left; border-bottom: 1px solid var(--border); }
.tbl th { font-size: .7rem; color: var(--muted-foreground); text-transform: uppercase; background: var(--muted); font-weight: 600; }
.tbl tbody tr:hover { background: color-mix(in oklch, var(--accent) 50%, transparent); }
.tbl .actions { display: flex; gap: .15rem; justify-content: flex-end; }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { background: var(--accent); }

/* Status badges */
.status-finalizado { background: color-mix(in oklch, #16a34a 15%, transparent); color: #15803d; }
.status-cancelado { background: color-mix(in oklch, #dc2626 15%, transparent); color: #dc2626; }
.status-pendente-reagendamento { background: #f97316; color: #fff; font-weight: 700; }
.badge-pulse {
  background: #f97316 !important;
  color: #fff !important;
  font-weight: 700;
  animation: pulse-badge 1.5s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.4);
}
@keyframes pulse-badge {
  0% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.6); }
  70% { box-shadow: 0 0 0 8px rgba(249, 115, 22, 0); }
  100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0); }
}
.status-nao-compareceu { background: color-mix(in oklch, #f59e0b 15%, transparent); color: #b45309; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: .25rem; padding: .15rem .55rem; border-radius: 9999px; font-size: .7rem; font-weight: 600; border: 1px solid var(--border); }
.badge.success { background: color-mix(in oklch, #16a34a 15%, transparent); color: #15803d; border-color: color-mix(in oklch, #16a34a 30%, transparent); }
.badge.warn { background: color-mix(in oklch, #f59e0b 15%, transparent); color: #b45309; border-color: color-mix(in oklch, #f59e0b 30%, transparent); }
.badge.danger { background: color-mix(in oklch, #dc2626 15%, transparent); color: #b91c1c; border-color: color-mix(in oklch, #dc2626 30%, transparent); }
.badge.muted { background: var(--muted); color: var(--muted-foreground); }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal {
  background: var(--card); border-radius: 1rem; padding: 1.25rem;
  max-width: 600px; width: 100%; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-elegant);
}
.modal.lg { max-width: 720px; }
.modal h3 { font-size: 1.125rem; margin-bottom: .75rem; }
.modal-footer { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem; }

/* Buttons extras */
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-warning { background: #ea580c; color: #fff; }
.btn-warning:hover { background: #c2410c; }

/* Bulk selection bar */
.sel-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .75rem;
  background: var(--accent);
  border-radius: .6rem;
  border: 1px solid var(--border);
  flex-wrap: wrap;
}

/* Pedidos cards */
.pedido-card { border: 1px solid var(--border); background: var(--card); border-radius: .9rem; padding: 1rem; }
.pedido-card + .pedido-card { margin-top: .75rem; }
.pedido-info-grid { display: grid; gap: .5rem; grid-template-columns: repeat(3, 1fr); margin: .5rem 0; font-size: .85rem; }
@media (max-width: 600px) { .pedido-info-grid { grid-template-columns: 1fr; } }
.checkbox { width: 1rem; height: 1rem; accent-color: var(--primary); }
.switch { position: relative; display: inline-block; width: 2.4rem; height: 1.3rem; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; cursor: pointer; inset: 0; background: var(--muted); border-radius: 9999px; transition: .2s; }
.switch span::before { content: ""; position: absolute; height: 1rem; width: 1rem; left: .15rem; top: .15rem; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(1.1rem); }

/* Bar chart simples */
.barchart { display: flex; align-items: flex-end; gap: .35rem; height: 8rem; padding: .5rem 0; }
.barchart .bar { background-image: var(--gradient-primary); width: 100%; border-radius: .25rem .25rem 0 0; min-height: 4px; position: relative; }
.barchart .bar span { position: absolute; top: -1.1rem; left: 50%; transform: translateX(-50%); font-size: .65rem; }
.barchart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .25rem; min-width: 0; }
.barchart .col .lbl { font-size: .65rem; color: var(--muted-foreground); }

/* Profissionais lotados no dropdown */
select option:disabled {
  color: #dc2626;
  background-color: #fef2f2;
  font-style: italic;
}
select option[disabled]::before {
  content: "🚫 ";
}


/* ====================== MOBILE OPTIMIZATIONS ====================== */
@media (max-width: 768px) {
  /* Admin Shell Mobile */
  .admin-shell {
    grid-template-columns: 1fr;
    position: relative;
  }
  
  .admin-sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    z-index: 200;
    transition: left 0.3s ease;
    box-shadow: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .admin-sidebar.open {
    left: 0;
    box-shadow: 4px 0 20px rgba(0,0,0,0.3);
  }
  
  .admin-sidebar nav a {
    position: relative;
    z-index: 201;
    min-height: 48px;
    display: flex;
    align-items: center;
  }
  
  /* Overlay for mobile menu - only visible on mobile */
  .admin-overlay {
    display: none !important;
  }
  
  .admin-overlay.open {
    display: block !important;
  }
  
  .admin-header {
    padding: 0 0.75rem;
    position: sticky;
    top: 0;
    z-index: 150;
    background: var(--background);
  }
  
  .admin-content {
    padding: 1rem 0.75rem;
    min-height: calc(100vh - 3.5rem);
  }
  
  .admin-content > * {
    margin-bottom: 1rem;
  }
  
  /* KPIs Mobile */
  .kpi-grid, .kpi-grid-5, .kpi-grid-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  
  .kpi {
    padding: 0.75rem;
  }
  
  .kpi .value {
    font-size: 1.25rem;
  }
  
  .kpi.gradient .value {
    font-size: 2rem;
  }
  
  /* Tables Mobile */
  .tbl-wrap {
    margin: 0 -0.75rem;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  
  .tbl {
    font-size: 0.8125rem;
  }
  
  .tbl th, .tbl td {
    padding: 0.5rem;
  }
  
  .tbl .actions {
    flex-direction: column;
    gap: 0.25rem;
  }
  
  .tbl .actions .btn {
    width: 100%;
    justify-content: center;
    padding: 0.4rem;
    font-size: 0.75rem;
  }
  
  /* Buttons Mobile */
  .btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
  }
  
  .btn-lg {
    padding: 0.65rem 1rem;
    font-size: 0.875rem;
  }
  
  /* Row/Flex Mobile */
  .row, .spread {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .row > * {
    width: 100%;
  }
  
  /* Forms Mobile */
  .field {
    margin-bottom: 0.75rem;
  }
  
  input, textarea, select {
    font-size: 16px !important; /* Previne zoom em iOS */
    padding: 0.65rem 0.75rem;
  }
  
  /* Modal Mobile */
  .modal-backdrop {
    padding: 0.5rem;
    align-items: flex-end;
  }
  
  .modal {
    border-radius: 1rem 1rem 0 0;
    max-height: 90vh;
    width: 100%;
    margin: 0;
  }
  
  .modal-footer {
    flex-direction: column-reverse;
  }
  
  .modal-footer .btn {
    width: 100%;
    justify-content: center;
  }
  
  /* Cards/Pedidos Mobile */
  .pedido-card {
    padding: 0.75rem;
    border-radius: 0.75rem;
  }
  
  .pedido-card + .pedido-card {
    margin-top: 0.5rem;
  }
  
  .pedido-info-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }
  
  /* Header Mobile */
  .site-header .bar {
    height: 3.5rem;
    padding: 0 0.75rem;
  }
  
  .brand {
    font-size: 1rem;
  }
  
  /* Navigation Mobile */
  .nav {
    gap: 0.25rem;
  }
  
  .nav .btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
  }
  
  /* Page Titles Mobile */
  .page-title {
    font-size: 1.25rem;
  }
  
  .page-sub {
    font-size: 0.875rem;
  }
  
  /* Toast Mobile */
  .toast-host {
    left: 0.5rem !important;
    right: 0.5rem !important;
    max-width: none !important;
  }
  
  /* KPI Grid - 1 column on very small screens */
  @media (max-width: 480px) {
    .kpi-grid, .kpi-grid-5, .kpi-grid-4 {
      grid-template-columns: 1fr;
    }
    
    .tbl-wrap {
      font-size: 0.75rem;
    }
    
    .pedido-info-grid {
      grid-template-columns: 1fr;
    }
  }
}

/* Touch-friendly tap targets */
@media (pointer: coarse) {
  .btn, .icon-btn, nav a {
    min-height: 44px;
    min-width: 44px;
  }
  
  input, select, textarea {
    min-height: 44px;
  }
}

/* Improved scroll on mobile */
@media (max-width: 768px) {
  body {
    -webkit-overflow-scrolling: touch;
  }
  
  .tbl-wrap {
    -webkit-overflow-scrolling: touch;
  }
  
  .admin-sidebar nav {
    -webkit-overflow-scrolling: touch;
  }
}

/* Profissionais na agenda */
.profs-cell {
  font-size: 0.75rem !important;
  line-height: 1.4;
}

.prof-tag {
  display: inline-block;
  background: var(--muted);
  padding: 0.1rem 0.4rem;
  border-radius: 0.3rem;
  margin: 0.1rem;
  font-size: 0.7rem;
  white-space: nowrap;
}

.prof-tag.bloqueado {
  background: #fee2e2;
  color: #991b1b;
  text-decoration: line-through;
}

@media (max-width: 768px) {
  .profs-cell {
    max-width: 120px;
    overflow: hidden;
  }
  
  .prof-tag {
    display: block;
    margin: 0.1rem 0;
  }
}

/* Safe area insets for notched devices */
@supports (padding: env(safe-area-inset-bottom)) {
  .admin-footer {
    padding-bottom: env(safe-area-inset-bottom);
  }
  
  .modal-backdrop {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* Toggle switch inline labels - stays compact on mobile */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .form-row-2.toggle-row-group {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .form-row-2.toggle-row-group .toggle-row {
    width: auto;
    flex-direction: row;
    background: var(--muted);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
  }
}


/* ── Calendário visual de agendamento ── */
.cal-month-label {
  font-weight: 700;
  font-size: .95rem;
  color: var(--foreground);
  letter-spacing: .01em;
}
.cal-nav {
  width: 2rem;
  height: 2rem;
  border-radius: .5rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--foreground);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  line-height: 1;
  transition: background .15s;
}
.cal-nav:hover { background: var(--accent); }
.cal-nav:disabled { opacity: .35; cursor: default; }

.cal-card {
  border: 1px solid var(--border);
  border-radius: .75rem;
  overflow: hidden;
  background: var(--card);
}
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem .75rem .4rem;
}
.cal-grid {
  padding: 0 .5rem .6rem;
  background: var(--card);
}
.cal-legend {
  padding: .5rem .5rem 0;
}
.cal-dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  margin-bottom: .35rem;
}
.cal-dow span {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted-foreground);
  padding: .2rem 0;
}
.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: .2rem;
}
.cal-day {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: .5rem;
  font-size: .85rem;
  cursor: pointer;
  border: 2px solid transparent;
  background: transparent;
  color: var(--foreground);
  transition: background .12s, color .12s, transform .12s, box-shadow .12s;
  font-family: inherit;
}
.cal-day.empty { cursor: default; }
.cal-day.past {
  color: var(--muted-foreground);
  opacity: .35;
  cursor: default;
}
.cal-day.unavailable {
  color: var(--muted-foreground);
  opacity: .3;
  cursor: default;
  text-decoration: line-through;
}
.cal-day.selected {
  background: var(--primary) !important;
  color: var(--primary-foreground) !important;
  font-weight: 700;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(234,179,8,.25);
}
.cal-day.selected:hover { background: var(--primary); }

/* ── Dias disponíveis com cor de fundo por nível de vaga ── */
.cal-day[data-vagas]:not(.past):not(.unavailable) {
  color: #fff;
  font-weight: 600;
}
.cal-day[data-vagas="alta"] {
  background: #16a34a;
  box-shadow: 0 2px 6px rgba(22,163,74,.3);
}
.cal-day[data-vagas="alta"]:hover {
  background: #15803d;
  transform: scale(1.08);
}
.cal-day[data-vagas="media"] {
  background: #ca8a04;
  box-shadow: 0 2px 6px rgba(202,138,4,.3);
}
.cal-day[data-vagas="media"]:hover {
  background: #a16207;
  transform: scale(1.08);
}
.cal-day[data-vagas="baixa"] {
  background: #ea580c;
  box-shadow: 0 2px 6px rgba(234,88,12,.3);
}
.cal-day[data-vagas="baixa"]:hover {
  background: #c2410c;
  transform: scale(1.08);
}
.cal-day[data-vagas="critica"] {
  background: #dc2626;
  box-shadow: 0 2px 8px rgba(220,38,38,.4);
  animation: pulse-vaga 1.8s ease-in-out infinite;
}
.cal-day[data-vagas="critica"]:hover {
  background: #b91c1c;
  transform: scale(1.08);
}

@keyframes pulse-vaga {
  0%, 100% { box-shadow: 0 2px 8px rgba(220,38,38,.4); }
  50%       { box-shadow: 0 2px 16px rgba(220,38,38,.7); }
}

/* Bolinha indicadora em cima do número */
.cal-day[data-vagas]:not(.past):not(.unavailable)::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.7);
}
.cal-day[data-vagas="alta"]::after   { background: #bbf7d0; }
.cal-day[data-vagas="media"]::after  { background: #fef08a; }
.cal-day[data-vagas="baixa"]::after  { background: #fed7aa; }
.cal-day[data-vagas="critica"]::after { background: #fecaca; }

/* Legenda */
.cal-legend {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  padding: .5rem .5rem 0;
  border-top: 1px solid var(--border);
  margin-top: .5rem;
}
.cal-legend-item {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .7rem;
  font-weight: 600;
  color: var(--muted-foreground);
}
.cal-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}


/* ══════════════════════════════════════════════════
   Admin — Fila de Atendimento (cards por profissional)
   ══════════════════════════════════════════════════ */

.prof-cards-area {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
  align-content: start;
}

.prof-card {
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Header do card */
.prof-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .9rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--muted);
  gap: .5rem;
}
.prof-card-nome {
  font-weight: 700;
  font-size: .95rem;
}
.prof-card-cons {
  font-size: .7rem;
  color: var(--muted-foreground);
}
.prof-card-status {
  font-size: .7rem;
  font-weight: 700;
  padding: .2rem .55rem;
  border-radius: 9999px;
  white-space: nowrap;
}
.status-em {
  background: #fee2e2;
  color: #dc2626;
}
.status-livre {
  background: #f0fdf4;
  color: #16a34a;
}

/* Área: paciente em atendimento */
.prof-card-em {
  padding: 1rem;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
}
.prof-card-em-label {
  font-size: .6rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  opacity: .75;
  font-weight: 600;
  margin-bottom: .25rem;
}
.prof-card-em-senha {
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.04em;
}
.prof-card-em-nome {
  font-size: .95rem;
  font-weight: 600;
  opacity: .9;
  margin-top: .2rem;
}
.prof-card-em-actions {
  display: flex;
  gap: .4rem;
  margin-top: .75rem;
  flex-wrap: wrap;
}
.prof-card-em-actions .btn {
  flex: 1;
  min-width: 0;
  font-size: .8rem;
}

/* Área: vazio / chamar próximo */
.prof-card-vazio {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  align-items: stretch;
}
.prof-card-vazio-msg {
  font-size: .8rem;
  color: var(--muted-foreground);
  text-align: center;
}
.prof-btn-chamar {
  width: 100%;
  font-size: 1rem;
  padding: .75rem;
  background-image: var(--gradient-primary);
  box-shadow: var(--shadow-glow);
}
.prof-btn-chamar:hover { box-shadow: 0 0 60px -10px oklch(0.58 0.22 295 / 0.6); }
.prof-btn-chamar:disabled {
  opacity: .4;
  cursor: not-allowed;
  box-shadow: none;
}

/* Área: fila do profissional */
.prof-card-fila {
  border-top: 1px solid var(--border);
  flex: 1;
}
.prof-card-fila-header {
  padding: .5rem .75rem;
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted-foreground);
  font-weight: 700;
  background: var(--muted);
}
.prof-card-fila-list {
  padding: .5rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  max-height: 220px;
  overflow-y: auto;
}
.prof-card-fila-vazio {
  text-align: center;
  font-size: .75rem;
  color: var(--muted-foreground);
  padding: .5rem;
}

/* Fila items — adaptados do painel TV mas para admin */
.fila-item {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .55rem .65rem;
  border-radius: .6rem;
  background: var(--background);
  border: 1px solid var(--border);
}
.fila-item-senha {
  font-size: .95rem;
  font-weight: 800;
  color: var(--foreground);
  flex-shrink: 0;
  width: 3rem;
}
.fila-item-info { flex: 1; min-width: 0; }
.fila-item-nome {
  font-size: .8rem;
  font-weight: 600;
  color: var(--foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fila-item-prof {
  font-size: .65rem;
  color: var(--muted-foreground);
}
.fila-item-actions {
  display: flex;
  gap: .25rem;
  flex-shrink: 0;
}
.fila-item-actions .btn {
  padding: .25rem .5rem;
  font-size: .75rem;
}

/* Responsive */
@media (max-width: 768px) {
  .prof-cards-area {
    grid-template-columns: 1fr;
  }
  .prof-card {
    min-width: 0;
  }
}


/* ═══════════════════════════════════════════
   Step wizard — agendar.html
═══════════════════════════════════════════ */
.step-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2.5rem;
  gap: 0;
}
.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  cursor: default;
}
.step-circle {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  border: 2px solid var(--border);
  display: grid;
  place-items: center;
  font-size: .875rem;
  font-weight: 700;
  color: var(--muted-foreground);
  background: var(--background);
  transition: all .25s;
}
.step-label {
  font-size: .7rem;
  color: var(--muted-foreground);
  white-space: nowrap;
  font-weight: 500;
}
.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 .25rem;
  margin-bottom: 1.2rem;
  min-width: 1.5rem;
  max-width: 4rem;
}
.step-item.active .step-circle {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-foreground);
}
.step-item.active .step-label {
  color: var(--foreground);
  font-weight: 600;
}
.step-item.done .step-circle {
  background: #22c55e;
  border-color: #22c55e;
  color: #fff;
}
.step-item.done .step-label {
  color: #22c55e;
}
.step-item.done + .step-line {
  background: #22c55e;
}

/* Step panels */
.step-panel {
  display: none;
  animation: fadeIn .2s ease;
}
.step-panel.active {
  display: block;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.step-header {
  text-align: center;
  margin-bottom: 1rem;
}
#panel-2 .step-header {
  margin-bottom: .75rem;
}
.step-icon {
  font-size: 2.5rem;
  margin-bottom: .5rem;
}
.step-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 .25rem;
}
.step-sub {
  color: var(--muted-foreground);
  margin: 0;
  font-size: .9rem;
}
.step-actions {
  display: flex;
  gap: .75rem;
  margin-top: 1.5rem;
  justify-content: space-between;
  align-items: center;
}
.step-actions .btn-ghost {
  color: var(--muted-foreground);
}

/* Step 2 data badge */
.s2-data-display {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1rem;
  background: rgba(234,179,8,.08);
  border: 1px solid rgba(234,179,8,.2);
  border-radius: .5rem;
  margin-top: .75rem;
  font-weight: 600;
  color: var(--foreground);
}
.s2-data-badge { font-size: 1.1rem; }

/* Step 3 loading */
.s3-loading {
  text-align: center;
  padding: 2rem;
  color: var(--muted-foreground);
}
.spin-icon { animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Step 4 radio cards */
#s4-opcoes .radio-grid { grid-template-columns: 1fr 1fr; gap: .75rem; }
.radio-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  padding: 1.25rem .75rem;
  border: 2px solid var(--border);
  border-radius: .75rem;
  cursor: pointer;
  transition: all .2s;
  text-align: center;
  user-select: none;
}
.radio-card input[type="radio"] { display: none; }
.radio-card-blocked {
  cursor: not-allowed !important;
  opacity: 0.45;
  border-color: var(--border) !important;
}
.radio-card:has(input:checked) {
  border-color: var(--primary);
  background: rgba(234,179,8,.06);
}
.radio-card-icon { font-size: 1.75rem; }
.radio-card-label { font-weight: 600; font-size: .9rem; }

/* Step 5 review */
.review-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
}
.review-item {
  background: var(--muted);
  border-radius: .5rem;
  padding: .6rem .85rem;
}
.review-key {
  font-size: .7rem;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: .03em;
  font-weight: 600;
  margin-bottom: .2rem;
}
.review-val {
  font-weight: 600;
  font-size: .9rem;
}

/* Responsive */
@media (max-width: 640px) {
  .step-label { display: none; }
  .step-bar { gap: 0; }
  .step-line { min-width: 1rem; max-width: 2.5rem; }
  .review-grid { grid-template-columns: 1fr; }
}
