/* ==========================================================================
   assets/css/senhas_painel.css — ZmedPlus: Gerenciador de Senhas, Painéis TV & Mídias
   Escopado em .sx3 (reutiliza .orx e tokens nativos ZmedPlus)
   ========================================================================== */
.sx3 { display: flex; flex-direction: column; gap: 12px; }
.sx3 *, .sx3 *::before, .sx3 *::after { box-sizing: border-box; }

.sx3-tabs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  background: var(--color-surface, #fff); border: 1px solid #e2e8f0; border-radius: 14px;
  padding: 8px 12px; box-shadow: 0 2px 8px -4px rgba(15, 42, 68, .08);
}
.sx3-tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px;
  border: 1px solid #cbd5e1; background: #fff; color: #475569; font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer;
}
.sx3-tab .num {
  width: 20px; height: 20px; border-radius: 50%; background: #e2e8f0; color: #334155;
  display: inline-flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 800;
}
.sx3-tab.active { background: #155785; border-color: #155785; color: #fff; }
.sx3-tab.active .num { background: #129f82; color: #fff; }

.sx3-grid-tv { display: grid; grid-template-columns: 330px 1fr; gap: 14px; align-items: start; }
@media (max-width: 1080px) { .sx3-grid-tv { grid-template-columns: 1fr; } }

.sx3-card {
  background: var(--color-surface, #fff); border: 1px solid #e2e8f0; border-radius: 14px;
  overflow: hidden; box-shadow: 0 2px 10px -4px rgba(15, 42, 68, .07);
}
.sx3-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 14px; background: #f8fafc; border-bottom: 1px solid #e2e8f0;
}
.sx3-card-head b { font-size: .84rem; color: #155785; text-transform: uppercase; letter-spacing: .04em; display: inline-flex; align-items: center; gap: 7px; }
.sx3-card-body { padding: 14px; display: flex; flex-direction: column; gap: 12px; }

.sx3-tv-item {
  border: 1.5px solid #e2e8f0; border-radius: 12px; padding: 11px 12px; background: #fff;
  cursor: pointer; transition: all .15s; display: flex; flex-direction: column; gap: 8px;
}
.sx3-tv-item:hover { border-color: #93c5fd; background: #f8fbff; }
.sx3-tv-item.ativo { border-color: #155785; background: #eff6ff; box-shadow: 0 4px 12px -6px rgba(21, 87, 133, .35); }
.sx3-tv-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sx3-tv-item-top b { font-size: .92rem; color: #0f2942; }
.sx3-tv-item small { color: #64748b; font-size: .77rem; }
.sx3-tv-acts { display: flex; gap: 6px; flex-wrap: wrap; }

.sx3-fgrid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px; }
.sx3-f { display: flex; flex-direction: column; gap: 4px; grid-column: span 4; min-width: 0; }
.sx3-f.c2 { grid-column: span 2; }
.sx3-f.c3 { grid-column: span 3; }
.sx3-f.c4 { grid-column: span 4; }
.sx3-f.c6 { grid-column: span 6; }
.sx3-f.c8 { grid-column: span 8; }
.sx3-f.c12 { grid-column: span 12; }
@media (max-width: 820px) { .sx3-f, .sx3-f.c2, .sx3-f.c3, .sx3-f.c4, .sx3-f.c6, .sx3-f.c8 { grid-column: span 12; } }

.sx3-f label { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: #475569; }
.sx3-f input:not([type=checkbox]):not([type=color]):not([type=range]),
.sx3-f select,
.sx3-f textarea {
  width: 100%; padding: 7px 10px; border: 1px solid #cbd5e1; border-radius: 8px;
  font: inherit; font-size: .84rem; color: #1e293b; background: #fff;
}
.sx3-f textarea { resize: vertical; min-height: 62px; }
.sx3-f input[type=color] { width: 42px; height: 32px; border: 1px solid #cbd5e1; border-radius: 7px; padding: 2px; cursor: pointer; background: #fff; }

/* Seletor visual dos 4 temas */
.sx3-temas { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 720px) { .sx3-temas { grid-template-columns: repeat(2, 1fr); } }
.sx3-tema {
  border: 2px solid #e2e8f0; border-radius: 11px; padding: 8px; cursor: pointer; text-align: left;
  background: #fff; font: inherit; transition: all .15s;
}
.sx3-tema:hover { transform: translateY(-1px); }
.sx3-tema.on { border-color: #129f82; box-shadow: 0 0 0 3px rgba(18, 159, 130, .18); }
.sx3-tema-prev { height: 34px; border-radius: 7px; margin-bottom: 6px; position: relative; overflow: hidden; }
.sx3-tema-prev i { position: absolute; right: 6px; bottom: 5px; width: 16px; height: 8px; border-radius: 4px; display: block; }
.sx3-tema b { display: block; font-size: .78rem; color: #0f2942; }
.sx3-tema small { font-size: .69rem; color: #64748b; }

.sx3-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sx3-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid #cbd5e1; background: #f8fafc; font-size: .77rem; font-weight: 700; color: #334155; cursor: pointer;
}
.sx3-chip input { margin: 0; }
.sx3-chip.on { background: #e6f7f5; border-color: #14b8a6; color: #0f687a; }

.sx3-midia-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 11px; border: 1px solid #e2e8f0; border-radius: 10px; background: #fff;
}
.sx3-midia-ic {
  width: 34px; height: 34px; border-radius: 9px; background: #eff6ff; color: #155785;
  display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0;
}
.sx3-midia-ic.yt { background: #fef2f2; color: #dc2626; }
.sx3-midia-ic.img { background: #ecfdf5; color: #059669; }
.sx3-midia-ic.av { background: #fffbeb; color: #d97706; }

.sx3-pri-badge {
  display: inline-block; padding: 2px 7px; border-radius: 999px; font-size: .68rem; font-weight: 800; text-transform: uppercase;
}
.sx3-pri-badge.normal { background: #f1f5f9; color: #475569; }
.sx3-pri-badge.pref   { background: #ffedd5; color: #c2410c; }
.sx3-pri-badge.super  { background: #fee2e2; color: #b91c1c; }
.sx3-pri-badge.tea    { background: #dbeafe; color: #1d4ed8; }

.sx3-sec-tit {
  font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  color: #155785; border-bottom: 1px solid #e2e8f0; padding-bottom: 5px; margin-top: 4px;
}
/* Cores das senhas preferenciais por tipo (laranja = deficiente/60+/gestante/colo, vermelho = 80+, azul = autismo) */
.sx3-item-pref  { border-left-color: #ea580c !important; background: #fff7ed !important; border-color: #fed7aa !important; }
.sx3-item-pref .sx2-cod { color: #c2410c !important; }
.sx3-item-super { border-left-color: #dc2626 !important; background: #fef2f2 !important; border-color: #fecaca !important; }
.sx3-item-super .sx2-cod { color: #b91c1c !important; }
.sx3-item-tea   { border-left-color: #2563eb !important; background: #eff6ff !important; border-color: #bfdbfe !important; }
.sx3-item-tea .sx2-cod { color: #1d4ed8 !important; }

/* Botão Chamar Próximo Preferencial (laranja destaque) */
.sx3-btn-pref {
  background: linear-gradient(135deg, #f59e0b, #ea580c) !important;
  border-color: #ea580c !important;
  color: #fff !important;
  font-weight: 800 !important;
}
.sx3-btn-pref:hover { filter: brightness(1.06); }
.sx3-btn-cnt {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px;
  background: rgba(255, 255, 255, .24); font-size: .72rem; font-weight: 900; margin-left: 3px;
}
.sx3-btn-cnt:empty { display: none; }

/* Badge ao vivo de senhas aguardando nos botões de atalho (Agenda / Atendimento) */
.sx3-badge-ag {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: #f59e0b; color: #fff; font-size: .72rem; font-weight: 900;
  line-height: 1; box-shadow: 0 2px 6px rgba(245, 158, 11, .45);
}
.sx3-badge-ag:empty { display: none; }

/* Modal Resumo do Chamador de Senhas (aberto pela Agenda e Atendimento) */
.sx3-rmodal {
  position: fixed; inset: 0; z-index: 2600;
  background: rgba(15, 23, 42, .52); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.sx3-rbox {
  width: min(1220px, 96vw); max-height: 90vh;
  background: #f4f7fb; border-radius: 16px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .36);
  display: flex; flex-direction: column; overflow: hidden;
  animation: sx3Pop .16s ease-out;
}
@keyframes sx3Pop { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: scale(1); } }
.sx3-rhead {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 18px; color: #fff;
  background: linear-gradient(90deg, #10325a 0%, #146379 58%, #169e87 100%);
}
.sx3-rhead-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sx3-rhead-tit { font-size: 1.02rem; font-weight: 800; display: inline-flex; align-items: center; gap: 8px; }
.sx3-rkpis { display: inline-flex; align-items: center; gap: 8px; }
.sx3-rkpi {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .24);
  font-size: .76rem; font-weight: 700;
}
.sx3-rkpi b { font-size: .86rem; font-weight: 900; }
.sx3-rhead-acts { display: flex; align-items: center; gap: 8px; }
.sx3-rhbtn {
  border: 1px solid rgba(255, 255, 255, .3); background: rgba(255, 255, 255, .14); color: #fff;
  padding: 6px 12px; border-radius: 9px; font: inherit; font-size: .79rem; font-weight: 700;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: background .15s;
}
.sx3-rhbtn:hover { background: rgba(255, 255, 255, .26); }
.sx3-rclose {
  width: 32px; height: 32px; border-radius: 9px; border: 0; background: rgba(255, 255, 255, .18);
  color: #fff; font-size: 1.35rem; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.sx3-rclose:hover { background: rgba(239, 68, 68, .85); }
.sx3-rbody {
  padding: 14px; display: flex; flex-direction: column; gap: 12px;
  flex: 1; min-height: 0; overflow: hidden;
}
.sx3-rsplit {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  flex: 1; min-height: 0;
}
.sx3-rsplit .orx-panel {
  display: flex; flex-direction: column; min-height: 0; max-height: 58vh;
}
.sx3-rsplit .sx2-lista {
  overflow-y: auto; flex: 1; min-height: 220px; padding: 10px;
}
@media (max-width: 960px) {
  .sx3-rsplit { grid-template-columns: 1fr; overflow-y: auto; }
  .sx3-rsplit .orx-panel { max-height: 36vh; }
}

/* ==================== ABA 4: GERENCIAR TERMINAIS ==================== */
.sx3-term-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--color-surface, #fff); border: 1px solid #e2e8f0; border-radius: 14px;
  padding: 10px 14px; box-shadow: 0 2px 8px -4px rgba(15, 42, 68, .07);
}
.sx3-term-filtros { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sx3-term-busca {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px;
  border: 1px solid #cbd5e1; border-radius: 9px; background: #f8fafc; min-width: 220px;
}
.sx3-term-busca i { color: #64748b; font-size: .82rem; }
.sx3-term-busca input { border: 0; background: transparent; outline: none; font: inherit; font-size: .83rem; width: 100%; color: #0f2942; }
.sx3-term-fbtn {
  border: 1px solid #cbd5e1; background: #fff; color: #475569; padding: 5px 11px;
  border-radius: 999px; font: inherit; font-size: .76rem; font-weight: 700; cursor: pointer;
}
.sx3-term-fbtn.on { background: #155785; border-color: #155785; color: #fff; }

.sx3-term-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 960px) { .sx3-term-grid { grid-template-columns: 1fr; } }

.sx3-term-card {
  background: var(--color-surface, #fff); border: 1.5px solid #e2e8f0; border-radius: 14px;
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 2px 10px -4px rgba(15, 42, 68, .07); transition: border-color .15s, box-shadow .15s;
}
.sx3-term-card:hover { border-color: #93c5fd; box-shadow: 0 6px 18px -8px rgba(21, 87, 133, .2); }
.sx3-term-card.inativo { opacity: .66; background: #f8fafc; border-style: dashed; }

.sx3-term-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sx3-term-id { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sx3-term-ic {
  width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem; flex-shrink: 0; background: #eff6ff; color: #155785;
}
.sx3-term-ic.CONSULTORIO { background: #e6f7f5; color: #0f766e; }
.sx3-term-ic.SALA { background: #f3e8ff; color: #7e22ce; }
.sx3-term-ic.ATENDIMENTO { background: #fef3c7; color: #b45309; }
.sx3-term-tit { min-width: 0; }
.sx3-term-tit b { display: flex; align-items: center; gap: 6px; font-size: .96rem; color: #0f2942; flex-wrap: wrap; }
.sx3-term-num {
  display: inline-flex; align-items: center; justify-content: center; padding: 1px 7px; border-radius: 6px;
  background: #155785; color: #fff; font-size: .72rem; font-weight: 800;
}
.sx3-term-tit small { display: block; font-size: .76rem; color: #64748b; margin-top: 2px; }

.sx3-term-st {
  padding: 3px 9px; border-radius: 999px; font-size: .7rem; font-weight: 800; text-transform: uppercase; flex-shrink: 0;
  background: #dcfce7; color: #166534;
}
.sx3-term-st.off { background: #fee2e2; color: #991b1b; }

.sx3-term-meta { display: flex; flex-direction: column; gap: 6px; font-size: .79rem; color: #334155; }
.sx3-term-row { display: flex; align-items: flex-start; gap: 7px; flex-wrap: wrap; }
.sx3-term-row > i { color: #129f82; margin-top: 3px; width: 15px; text-align: center; flex-shrink: 0; }
.sx3-term-lbl { font-weight: 700; color: #64748b; margin-right: 2px; }
.sx3-term-pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
  background: #f1f5f9; border: 1px solid #e2e8f0; color: #1e293b; font-size: .73rem; font-weight: 700;
}
.sx3-term-pill.tv { background: #e6f7f5; border-color: #99f6e4; color: #0f766e; }
.sx3-term-pill.all { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }

.sx3-term-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap;
  padding-top: 9px; border-top: 1px solid #f1f5f9; margin-top: auto;
}
.sx3-term-foot > div { display: flex; gap: 6px; flex-wrap: wrap; }
