/* ── DASHBOARD ─────────────────────────────────────────────── */
#dashboard-metrics {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.dash-card {
  text-align: center; padding: 22px 18px; color: #fff;
  border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
  transition: transform .2s, box-shadow .2s;
}
.dash-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.dash-card-value { font-size: 2.1rem; font-weight: 800; letter-spacing: -0.02em; }
.dash-card-label { font-size: 0.87rem; opacity: 0.90; margin-top: 2px; }
.dash-card-primary   { background: linear-gradient(135deg, var(--primary), var(--primary-light)); }
.dash-card-success   { background: linear-gradient(135deg, #1e7e48, #27ae60); }
.dash-card-info      { background: linear-gradient(135deg, #1556a4, #1a6fa8); }
.dash-card-warning   { background: linear-gradient(135deg, #c27c00, #e0900a); }
.dash-card-accent    { background: linear-gradient(135deg, var(--accent-dark), var(--accent)); color: #1a0800; }
.dash-card-secondary { background: linear-gradient(135deg, var(--primary-dark), var(--primary-light)); }
.dash-card-muted     { background: var(--primary-muted); color: var(--text-main); }

#adm-tab-dashboard .dashboard-powerbi-quick {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

#adm-tab-dashboard .dashboard-powerbi-quick h4 {
  margin-bottom: 4px;
}

#adm-tab-dashboard #dashboard-metrics {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)) !important;
  gap: 10px !important;
  margin-bottom: 12px !important;
}

#adm-tab-dashboard #dashboard-metrics .card {
  padding: 12px !important;
}

#adm-tab-dashboard #dashboard-metrics .card > div:first-child {
  font-size: 1.45rem !important;
}

#adm-tab-dashboard #dashboard-metrics .card > div:last-child {
  font-size: 0.8rem !important;
}

#adm-tab-dashboard .dashboard-charts-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

#adm-tab-dashboard .dashboard-chart-card {
  grid-column: span 4;
  padding: 14px 14px 12px;
  border-radius: 14px;
  border: 1px solid rgba(56,70,34,0.16);
  background: #ffffff;
  box-shadow: 0 10px 18px rgba(40,49,23,0.08);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

#adm-tab-dashboard .dashboard-chart-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 24px rgba(40,49,23,0.14);
  border-color: rgba(56,70,34,0.24);
}

#adm-tab-dashboard .dashboard-chart-card:last-child {
  grid-column: span 12;
}

#adm-tab-dashboard .dashboard-chart-card h4 {
  margin-bottom: 10px;
  font-size: 0.96rem;
  color: var(--primary-dark);
  font-weight: 800;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}

#adm-tab-dashboard .dashboard-chart-card h4::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  box-shadow: 0 0 0 3px rgba(56,70,34,0.12);
}

#adm-tab-dashboard .dashboard-chart-canvas {
  width: 100% !important;
  height: 220px !important;
  display: block;
}

#adm-tab-dashboard .dashboard-chart-card:last-child .dashboard-chart-canvas {
  height: 250px !important;
}

.powerbi-modal-box {
  max-width: 980px;
  width: 96%;
}

.powerbi-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.powerbi-modal-body {
  max-height: 72vh;
  overflow: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.powerbi-step-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.powerbi-step-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f7f9f4;
  padding: 10px 12px;
  font-size: 0.82rem;
  color: #4d5243;
}

.powerbi-actions {
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.powerbi-preview-block {
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.powerbi-filters {
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.powerbi-filters select {
  margin: 0;
  min-width: 160px;
}

.powerbi-summary {
  margin-bottom: 8px;
  min-height: 18px;
}

.powerbi-table-wrap {
  overflow-x: auto;
  max-height: 300px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

#powerbi-dynamic-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

#powerbi-dynamic-table thead tr {
  background: #f7f9f4;
  position: sticky;
  top: 0;
}

#powerbi-dynamic-table th {
  padding: 9px 12px;
  text-align: right;
  border-bottom: 1px solid #e0e7d4;
}

#powerbi-dynamic-table th:first-child {
  text-align: left;
}

#powerbi-dynamic-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #e0e7d4;
  text-align: right;
}

#powerbi-dynamic-table td:first-child {
  text-align: left;
}

@media (max-width: 1200px) {
  #adm-tab-dashboard .dashboard-charts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #adm-tab-dashboard .dashboard-chart-card {
    grid-column: span 1;
  }
  #adm-tab-dashboard .dashboard-chart-card:last-child {
    grid-column: span 2;
  }
}

@media (max-width: 768px) {
  #adm-tab-dashboard .dashboard-charts-grid {
    grid-template-columns: 1fr;
  }

  #adm-tab-dashboard .dashboard-chart-card,
  #adm-tab-dashboard .dashboard-chart-card:last-child {
    grid-column: span 1;
  }

  #adm-tab-dashboard .dashboard-chart-canvas {
    height: 180px !important;
  }

  #adm-tab-dashboard .dashboard-chart-card:last-child .dashboard-chart-canvas {
    height: 200px !important;
  }

  .powerbi-modal-head {
    flex-direction: column;
    align-items: stretch;
  }

  .powerbi-modal-head .btn {
    width: 100%;
  }

  .powerbi-filters {
    align-items: stretch;
  }

  .powerbi-filters > div,
  .powerbi-filters > button {
    width: 100%;
  }

  .powerbi-filters select {
    min-width: 0;
    width: 100%;
  }
}

.module-card-solid {
  text-align: center; padding: 22px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff; cursor: pointer; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm); transition: transform .2s, box-shadow .2s;
}
.module-card-solid:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

/* ── FILA DE ATENDIMENTO ──────────────────────────────────── */
.queue-item {
  background: var(--surface); padding: 14px 16px;
  border-radius: var(--radius-sm); margin-bottom: 10px;
  box-shadow: var(--shadow-xs);
  display: flex; justify-content: space-between; align-items: flex-start;
  border: 1px solid var(--border); border-left: 5px solid var(--primary);
  transition: box-shadow .2s;
}
.queue-item:hover { box-shadow: var(--shadow-sm); }
.queue-item.priority { border-left-color: #415029; background: #f4f6f0; }
.queue-item.called   { border-left-color: var(--accent); background: var(--accent-muted); }

/* ── CALENDÁRIO ──────────────────────────────────────────── */
.calendar-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 5px; margin-top: 10px; }
.calendar-day  { padding: 9px; background: var(--surface-2); text-align: center; cursor: pointer; border-radius: var(--radius-xs); border: 1px solid transparent; transition: all .15s; }
.calendar-day:hover { background: var(--primary-muted); }
.calendar-day.selected { border-color: var(--primary); color: var(--primary); font-weight: 700; }
.calendar-day.has-slots { background: var(--primary); color: white; font-weight: 700; }

/* ── TV ─────────────────────────────────────────────────── */
#view-tv.tv-view {
  padding: 12px;
  height: var(--app-viewport-height);
  max-height: var(--app-viewport-height);
  overflow: hidden;
  background:
    radial-gradient(circle at 2% 0%, rgba(56,70,34,0.14) 0%, transparent 44%),
    radial-gradient(circle at 100% 100%, rgba(230,184,0,0.12) 0%, transparent 42%),
    #f2f3ef;
}

#view-tv .tv-shell {
  width: 100%;
  height: 100%;
  border-radius: 22px;
  border: 1px solid rgba(56,70,34,0.20);
  background: linear-gradient(160deg, #ffffff 0%, #f6f8f2 100%);
  box-shadow: 0 18px 42px rgba(40,49,23,0.18);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#view-tv .tv-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 16px;
  border-bottom: 1px solid rgba(56,70,34,0.16);
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
  flex-shrink: 0;
}

#view-tv .tv-clock-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.30);
  background: rgba(255,255,255,0.16);
  color: #ffffff;
}

#view-tv .tv-clock-chip span {
  font-size: 0.78rem;
  font-weight: 600;
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

#view-tv .tv-clock-chip strong {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

#view-tv .tv-topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

#view-tv .tv-btn-admin {
  background: rgba(230,240,255,0.94);
  color: #154275;
  border-color: rgba(191,219,254,0.82);
}

#view-tv .tv-btn-intranet {
  background: rgba(248,250,252,0.94);
  color: #4d5243;
  border-color: rgba(203,213,225,0.88);
}

#view-tv .tv-layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 0;
  min-height: 0;
}

#view-tv .tv-main-stage {
  padding: clamp(14px, 2.5vw, 30px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  min-height: 0;
  overflow: hidden;
}

#view-tv .tv-main-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 0%, rgba(56,70,34,0.06), transparent 52%),
    radial-gradient(circle at 50% 100%, rgba(230,184,0,0.08), transparent 52%);
  pointer-events: none;
}

#view-tv .tv-main-kicker {
  position: relative;
  z-index: 1;
  margin: 0 0 10px;
  font-size: clamp(0.9rem, 1.2vw, 1.08rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary-dark);
}

#view-tv .ticket-big {
  position: relative;
  z-index: 1;
  font-size: clamp(4.8rem, 14vw, 10rem);
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #1a1a1a;
  text-align: center;
  text-shadow: 0 10px 24px rgba(40,49,23,0.18);
  max-width: 94%;
  margin-left: auto;
  margin-right: auto;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}
/* Nome de paciente (chamada clinica) e mais longo que uma senha: fonte menor para caber */
#view-tv .ticket-big.is-name {
  font-size: clamp(2.4rem, 6.5vw, 5.2rem);
  letter-spacing: 0;
}

#view-tv .tv-patient-name {
  position: relative;
  z-index: 1;
  margin-top: 10px;
  font-size: clamp(1.4rem, 3vw, 2.45rem);
  font-weight: 700;
  color: #25291e;
  max-width: min(92%, 980px);
  word-break: break-word;
}

#view-tv .tv-desk-name {
  position: relative;
  z-index: 1;
  margin-top: 12px;
  font-size: clamp(1.6rem, 4.2vw, 3.25rem);
  font-weight: 800;
  color: #b42318;
  letter-spacing: 0.01em;
}

#view-tv .tv-side-panel {
  border-left: 1px solid rgba(56,70,34,0.16);
  background: linear-gradient(180deg, #eef1e9 0%, #e8ece3 100%);
  padding: 16px 14px 14px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#view-tv .tv-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

#view-tv .tv-side-head h3 {
  margin: 0;
  font-size: 1.02rem;
  color: var(--primary-dark);
}

#view-tv .tv-audio-btn {
  min-width: 108px;
}

#view-tv .tv-history-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 3px;
}

#view-tv .tv-history-item {
  background: #ffffff;
  border: 1px solid rgba(56,70,34,0.16);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  padding: 10px 11px;
  box-shadow: var(--shadow-xs);
  color: #1f2319;
}

#view-tv .tv-history-item .code {
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--primary-dark);
}

#view-tv .tv-history-item .meta {
  margin-top: 3px;
  font-size: 0.82rem;
  color: #4e5344;
  line-height: 1.42;
}

#view-tv .tv-history-item.tv-history-empty {
  border-style: dashed;
  border-left-color: rgba(56,70,34,0.35);
  background: rgba(255,255,255,0.72);
  text-align: center;
  color: #5e6455;
}

#view-tv .blink {
  animation: tvTicketPulse 0.95s ease-in-out 3;
}

@keyframes tvTicketPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.03); opacity: 0.58; }
}

@media (max-width: 1200px) {
  #view-tv .tv-layout {
    grid-template-columns: minmax(0, 1fr) 320px;
  }
}

@media (max-width: 980px) {
  #view-tv.tv-view { padding: 10px; }
  #view-tv .tv-shell { min-height: calc(100vh - 20px); border-radius: 18px; }
  #view-tv .tv-layout { grid-template-columns: 1fr; }
  #view-tv .tv-side-panel {
    border-left: 0;
    border-top: 1px solid rgba(56,70,34,0.14);
    min-height: 260px;
  }
  #view-tv .tv-main-stage {
    justify-content: flex-start;
    padding-top: 26px;
    padding-bottom: 26px;
  }
}

/* ── SENHAS EMITIDAS ─────────────────────────────────────── */
#view-issued.issued-view {
  padding: 14px;
  height: var(--app-viewport-height);
  min-height: var(--app-viewport-height);
  max-height: var(--app-viewport-height);
  overflow: hidden;
  background:
    radial-gradient(circle at 2% 0%, rgba(56,70,34,0.14) 0%, transparent 44%),
    radial-gradient(circle at 100% 100%, rgba(230,184,0,0.12) 0%, transparent 42%),
    #f2f3ef;
}

#view-issued .issued-shell {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  border-radius: 22px;
  border: 1px solid rgba(56,70,34,0.2);
  background: linear-gradient(165deg, #ffffff 0%, #f6f8f2 100%);
  box-shadow: 0 18px 42px rgba(40,49,23,0.18);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#view-issued .issued-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(56,70,34,0.16);
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
}

#view-issued .issued-clock-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.16);
  color: #fff;
}

#view-issued .issued-clock-chip span {
  font-size: 0.78rem;
  font-weight: 600;
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

#view-issued .issued-clock-chip strong {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

#view-issued .issued-topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

#view-issued .issued-btn-admin {
  background: rgba(230,240,255,0.94);
  color: #154275;
  border-color: rgba(191,219,254,0.82);
}

#view-issued .issued-btn-intranet {
  background: rgba(248,250,252,0.94);
  color: #4d5243;
  border-color: rgba(203,213,225,0.88);
}

#view-issued .issued-hero {
  text-align: center;
  padding: 24px 18px 10px;
}

#view-issued .issued-hero h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3.3vw, 2.6rem);
  color: var(--primary-dark);
}

#view-issued .issued-hero p {
  margin: 7px 0 0;
  color: #5b6250; /* legibilidade: era var(--text-light) #9da394 (contraste 2.6:1) */
  font-size: 0.95rem;
}

#view-issued .issued-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  align-content: start;
  padding: 14px 18px 12px;
  overflow-y: auto;
}

#view-issued .issued-grid::-webkit-scrollbar { width: 9px; }
#view-issued .issued-grid::-webkit-scrollbar-track { background: rgba(148,163,184,0.12); border-radius: 999px; }
#view-issued .issued-grid::-webkit-scrollbar-thumb { background: rgba(56,70,34,0.36); border-radius: 999px; }

#view-issued .issued-ticket-card {
  border: 1px solid var(--border);
  background: #ffffff;
  border-radius: 14px;
  box-shadow: var(--shadow-xs);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#view-issued .issued-ticket-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#view-issued .issued-ticket-order {
  font-size: 0.72rem;
  font-weight: 700;
  color: #4e5344;
}

#view-issued .issued-ticket-status {
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 9px;
}

#view-issued .issued-ticket-card.is-waiting .issued-ticket-status {
  color: #1f7a4f;
  background: #eafaf1;
  border: 1px solid #b7e7c9;
}

#view-issued .issued-ticket-card.is-served .issued-ticket-status {
  color: #854d0e;
  background: #fefce8;
  border: 1px solid #fde68a;
}

#view-issued .issued-ticket-code {
  font-size: clamp(2rem, 5vw, 2.7rem);
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: var(--primary-dark);
}

#view-issued .issued-ticket-patient {
  font-size: 1.08rem;
  font-weight: 700;
  color: #25291e;
  overflow-wrap: anywhere;
}

#view-issued .issued-ticket-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#view-issued .issued-ticket-dept {
  font-size: 0.78rem;
  font-weight: 700;
  color: #41546b;
  background: #edf2f7;
  border: 1px solid #d7e0ea;
  border-radius: 999px;
  padding: 3px 10px;
}

#view-issued .issued-ticket-priority {
  font-size: 0.76rem;
  font-weight: 700;
  color: #9a5b00;
  background: #fff7e6;
  border: 1px solid #f5d08a;
  border-radius: 999px;
  padding: 3px 9px;
}

#view-issued .issued-ticket-time {
  font-size: 0.78rem;
  color: #6b7280;
  line-height: 1.4;
}

#view-issued .issued-ticket-note {
  margin-top: 2px;
  font-size: 0.8rem;
  color: #92400e;
  background: #fff8ee;
  border: 1px solid #f5d9ad;
  border-radius: 10px;
  padding: 7px 9px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

#view-issued .issued-empty-state {
  grid-column: 1 / -1;
  border: 1px dashed rgba(56,70,34,0.3);
  border-radius: 14px;
  background: rgba(255,255,255,0.72);
  padding: 30px 16px;
  text-align: center;
}

#view-issued .issued-empty-state.is-error {
  border-color: rgba(185,28,28,0.4);
  background: rgba(254,242,242,0.85);
}

#view-issued .issued-empty-icon {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  margin: 0 auto 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #1f7a4f;
  background: #eafaf1;
  border: 1px solid #b7e7c9;
}

#view-issued .issued-empty-title {
  font-size: 1.08rem;
  color: var(--primary-dark);
  font-weight: 800;
}

#view-issued .issued-empty-sub {
  margin-top: 4px;
  color: #5b6250;
  font-size: 0.9rem;
}

#view-issued .issued-foot {
  padding: 6px 18px 14px;
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 980px) {
  #view-issued.issued-view {
    padding: 10px;
    height: var(--app-viewport-height);
    min-height: var(--app-viewport-height);
    max-height: var(--app-viewport-height);
  }
  #view-issued .issued-shell { border-radius: 18px; }
}

@media (max-width: 760px) {
  #view-issued .issued-topbar {
    flex-direction: column;
    align-items: flex-start;
  }
  #view-issued .issued-topbar-actions {
    width: 100%;
    justify-content: stretch;
  }
  #view-issued .issued-topbar-actions .btn {
    flex: 1;
  }
  #view-issued .issued-grid {
    grid-template-columns: 1fr;
    padding: 12px;
  }
  #view-issued .issued-foot {
    padding: 4px 12px 12px;
  }
}

/* ── TOTEM ───────────────────────────────────────────────── */
#view-totem.view-section {
  padding: 20px;
  background:
    radial-gradient(ellipse 75% 60% at 0% 0%, rgba(56,70,34,0.10) 0%, transparent 65%),
    radial-gradient(ellipse 80% 70% at 100% 100%, rgba(230,184,0,0.10) 0%, transparent 70%),
    #eff1eb;
}

#view-totem .totem-shell {
  max-width: 1360px;
  min-height: calc(100vh - 96px);
  margin: 0 auto;
  padding: 18px 20px 24px;
  border-radius: 24px;
  border: 1px solid rgba(56,70,34,0.20);
  background: linear-gradient(155deg, rgba(255,255,255,0.96), rgba(243,245,238,0.94));
  box-shadow: 0 18px 48px rgba(40,49,23,0.18);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

#view-totem .totem-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#view-totem .totem-clock-badge {
  min-width: 148px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(56,70,34,0.24);
  background: rgba(56,70,34,0.08);
  color: var(--primary-dark);
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 0.95rem;
}

#view-totem .totem-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

#view-totem .btn-totem-back {
  background: rgba(56,70,34,0.08);
  border-color: rgba(56,70,34,0.22);
  color: var(--primary-dark);
}

#view-totem .btn-totem-back:hover {
  background: rgba(56,70,34,0.16);
}

#view-totem .totem-stage-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

#view-totem .totem-stage {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
}

#view-totem .totem-title {
  font-size: clamp(2rem, 3.7vw, 3.2rem);
  line-height: 1.1;
  color: var(--primary-dark);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

#view-totem .totem-subtitle {
  font-size: clamp(1rem, 1.6vw, 1.35rem);
  color: #4e5344;
  margin-bottom: 0;
}

#totem-grid {
  margin: 28px auto 0;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

#totem-grid .totem-grid-message {
  grid-column: 1 / -1;
  padding: 22px 14px;
  border: 1.5px dashed rgba(56,70,34,0.28);
  border-radius: 14px;
  color: #505843;
  font-weight: 600;
  background: rgba(255,255,255,0.55);
}

#view-totem .totem-dept-btn {
  width: 100%;
  min-height: 98px;
  padding: 14px 16px;
  font-size: 1.08rem;
  font-weight: 700;
  border-radius: 16px;
  box-shadow: 0 12px 24px rgba(40,49,23,0.18);
  border-color: #2e391a;
  white-space: normal;
  line-height: 1.25;
}

#view-totem .totem-dept-btn:hover {
  transform: translateY(-2px);
}

#view-totem .totem-form-card {
  max-width: 520px;
  margin: 28px auto 0;
  padding: 22px 20px;
  border-radius: 20px;
  border: 1px solid rgba(56,70,34,0.20);
  background: rgba(255,255,255,0.92);
  box-shadow: 0 14px 30px rgba(40,49,23,0.14);
  text-align: left;
}

#view-totem .totem-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

#view-totem .totem-field label {
  font-size: 0.86rem;
  font-weight: 700;
  color: #393f2f;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#view-totem #totem-cpf,
#view-totem #totem-name {
  margin: 0;
  padding: 13px 14px;
  text-align: center;
  font-size: 1.05rem;
}

#view-totem #totem-cpf-status {
  display: block;
  min-height: 18px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
}

#view-totem .totem-form-actions {
  margin-top: 8px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

#view-totem .totem-issued-title {
  font-size: clamp(2rem, 4vw, 3.6rem);
  color: #394820; /* legibilidade: era var(--accent-dark) gold #b8900a (contraste 3:1) */
  margin-bottom: 10px;
}
body.theme-dark #view-totem .totem-issued-title{ color:#c8d9aa; }

#view-totem #totem-ticket-display {
  font-size: clamp(3.4rem, 12vw, 7.4rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--primary);
  margin: 8px 0 12px;
  text-shadow: 0 8px 20px rgba(56,70,34,0.20);
}

#view-totem .totem-footer-actions {
  display: flex;
  justify-content: center;
}

#view-totem .btn-totem-exit {
  opacity: 0.82;
}

#view-totem .btn-totem-exit:hover {
  opacity: 1;
}

@media (max-width: 920px) {
  #view-totem .totem-shell {
    min-height: calc(100vh - 88px);
    padding: 16px;
  }

  #view-totem .totem-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  #view-totem .totem-clock-badge {
    text-align: center;
    width: 100%;
  }

  #view-totem .totem-toolbar-actions {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 640px) {
  #view-totem.view-section {
    padding: 10px;
  }

  #view-totem .totem-shell {
    min-height: calc(100vh - 76px);
    border-radius: 18px;
    padding: 12px;
    gap: 14px;
  }

  #view-totem .totem-toolbar-actions {
    flex-direction: column;
  }

  #view-totem .totem-toolbar-actions .btn {
    width: 100%;
  }

  #totem-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 18px;
  }

  #view-totem .totem-dept-btn {
    min-height: 82px;
    font-size: 1rem;
  }

  #view-totem .totem-form-card {
    margin-top: 16px;
    padding: 16px 14px;
  }

  #view-totem #totem-cpf,
  #view-totem #totem-name {
    font-size: 1rem;
  }

  #view-totem .totem-subtitle {
    font-size: 0.98rem;
  }
}

/* ── LOGIN AUXILIAR ───────────────────────────────────────── */
.login-header { display: flex; align-items: normal; gap: 14px; margin-bottom: 1px; }
.login-header h2  { margin: 0; font-size: 1.3rem; color: var(--primary); }
.login-header .small { margin: 2px 0 0; color: #666; }
.site-footer {
  position: fixed; bottom: 0; left: 0; right: 0;
  text-align: center; padding: 9px 16px;
  font-size: 11px; color: var(--text-muted);
  background: rgba(239,241,235,0.94); backdrop-filter: blur(8px);
  border-top: 1px solid var(--border); z-index: 900; letter-spacing: 0.2px;
}
.logo-prefeitura  { width: 80px; height: auto; object-fit: contain; }
.prefeitura-wrap  { display: flex; justify-content: center; margin-top: 4vh; margin-bottom: 6px; pointer-events: none; }
.prefeitura-logo  { width: 136px; max-width: 42vw; height: auto; object-fit: contain; display: block; }
.login-logo-allregtech { display: block; margin: 0 auto 12px; width: 150px; max-width: 74%; object-fit: contain; opacity: 0.82; }
.logo-allregtech  { display: block; margin: 0 auto 12px; width: 150px; max-width: 74%; object-fit: contain; opacity: 0.82; }
.logo-allregtech[alt]:not([src]) { display: inline-block; font-weight: 700; color: var(--primary); text-align: center; }

/* ── STATUS ────────────────────────────────────────────────── */
.status-waiting          { border-left: 5px solid var(--primary); background: var(--surface-2); }
.status-served           { border-left: 5px solid var(--accent); background: var(--accent-muted); }
.status-called-elsewhere { border-left: 5px solid #f1c40f; background: #fffde7; }
.status-default          { border-left: 5px solid #95a5a6; background: #f5f5f5; }
.selected                { background-color: var(--primary) !important; color: white !important; }
.visible-queue-item      { padding: 8px 12px !important; font-size: 0.9rem !important; margin-bottom: 5px !important; }
.status-active           { color: var(--success); font-weight: 700; }
.status-inactive         { color: var(--danger); font-weight: 700; }

/* Não depender apenas de cor para status */
.status-active::before,
.rec-status-active::before,
.rec-status-completed::before,
.rec-status-closed::before,
.fat-badge.done::before,
.ts-alert-success::before {
  content: "✔ ";
  font-weight: 800;
}

.status-inactive::before,
.rec-status-cancelled::before,
.rec-status-no_show::before,
.fat-badge.cancelled::before,
.ts-alert-error::before {
  content: "✖ ";
  font-weight: 800;
}

.status-waiting::before,
.rec-status-waiting::before,
.fat-badge.pending::before,
.fat-badge.inprogress::before,
.ts-alert-warn::before {
  content: "• ";
  font-weight: 800;
}

/* ── BOTÕES ESPECIAIS ─────────────────────────────────────── */
.btn-exclamation { background: none; border: none; color: #ff6b6b; font-size: 1.2rem; cursor: pointer; padding: 0; margin-left: 8px; transition: color .2s; }
.btn-exclamation:hover { color: var(--danger); }
.btn-close { background: none; border: none; font-size: 1.5rem; color: #888; cursor: pointer; padding: 0; margin: 0; line-height: 1; }
.btn-close:hover { color: var(--primary); }
.calendar-nav-btn { background: var(--primary); color: white; border: none; padding: 7px 11px; border-radius: var(--radius-xs); cursor: pointer; font-size: 1.1rem; font-weight: bold; transition: background .2s; }
.calendar-nav-btn:hover { background: var(--primary-dark); }
.filter-toggle { display: flex; align-items: center; font-weight: 500; background: var(--primary-muted); padding: 5px 10px; border-radius: 5px; border: 1px solid var(--primary); cursor: pointer; transition: background .2s; margin-right: 20px; }
.filter-toggle.selected { background: var(--primary); color: white; }
.filter-toggle input[type="checkbox"] { margin-right: 5px; }

/* ── PORTAL HISTÓRICO ──────────────────────────────────────── */
#portal-history-list { padding: 0; margin: 0; list-style: none; }
#portal-history-list li { background: var(--surface-2); padding: 12px 15px; margin-bottom: 8px; border-radius: var(--radius-sm); border-left: 4px solid var(--primary); box-shadow: var(--shadow-xs); }
.appt-info  { display: flex; flex-direction: column; gap: 4px; }
.appt-time  { font-weight: 600; color: var(--primary); }
.appt-status { font-size: 0.85rem; color: var(--text-muted); }

/* ── WHATSAPP BALLOON ─────────────────────────────────────── */
.whatsapp-balloon {
  position: fixed; bottom: 30px; right: 30px; z-index: 1000;
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(135deg, #25D366, #128C7E);
  color: white; padding: 12px 20px; border-radius: 50px;
  text-decoration: none; box-shadow: 0 4px 20px rgba(37,211,102,0.4);
  transition: all .3s; animation: pulse-whatsapp 2.5s infinite;
}
.whatsapp-balloon:hover { transform: scale(1.06); box-shadow: 0 6px 28px rgba(37,211,102,0.6); }
.whatsapp-icon { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; }
.whatsapp-icon svg { width: 100%; height: 100%; }
.whatsapp-text { font-weight: 600; font-size: 14px; }
@keyframes pulse-whatsapp {
  0%   { box-shadow: 0 0 0 0 rgba(37,211,102,0.7); }
  70%  { box-shadow: 0 0 0 14px rgba(37,211,102,0); }
  100% { box-shadow: 0 0 0 0 rgba(37,211,102,0); }
}

/* ── CLASSES AUSENTES ─────────────────────────────────────── */
.past            { opacity: 0.38; cursor: not-allowed; pointer-events: none; }
.text-muted      { color: var(--text-muted); font-size: 0.9rem; }
.text-danger     { color: var(--danger); font-size: 0.9rem; }
.list-item       { background: var(--surface-2); padding: 10px 14px; margin-bottom: 8px; border-radius: var(--radius-sm); border-left: 4px solid var(--primary); list-style: none; font-size: 0.9rem; }
.scale-105       { transform: scale(1.05); }

/* ── ABAS DO ADMIN ────────────────────────────────────────── */
#view-admin .flex button.btn-primary { background: var(--primary); box-shadow: 0 2px 8px rgba(56,70,34,0.28); color: white; }

/* ════════════════════════════════════════════════════════════
   RESPONSIVO
════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  #view-login.view-section.active { flex-direction: column; }
  .login-left-panel { min-height: 260px; padding: 40px 28px 32px; }
  .login-right-panel { flex: 1; min-height: auto; padding: 36px 24px; box-shadow: none; border-top: 3px solid var(--primary-muted); }
  .prefeitura-logo { width: 110px; max-width: 52vw; }
  .login-logo-prefeitura-main { width: 146px; }
  .login-logo-allregtech, .logo-allregtech { width: 132px; max-width: 70%; }
  .login-brand-title { font-size: 1.78rem; }
  .login-form-links { grid-template-columns: 1fr; gap: 8px; }
  .login-link-chip { min-height: 36px; font-size: 0.79rem; }
  .panel-container { padding: 20px 16px; }
  .whatsapp-balloon { bottom: 20px; right: 20px; padding: 10px 16px; }
  .whatsapp-icon   { width: 24px; height: 24px; }
  .whatsapp-text   { font-size: 13px; }
  #view-operator > .panel-container > header > .flex > .btn,
  #view-admin > .panel-container > header > .flex > .btn,
  #view-driver > .panel-container > header > .flex > .btn,
  #adm-tab-dashboard .flex.space-between > .flex > .btn.btn-sm,
  #view-driver .card .flex.mt-2 > .btn { flex-basis: 110px; max-width: 118px; font-size: 0.72rem; }
  #view-admin .admin-tabs > .btn,
  #view-admin > .panel-container > header > .flex > .btn,
  #adm-tab-dashboard .flex.space-between > .flex > .btn.btn-sm { flex-basis: 112px; width: 112px; min-width: 112px; max-width: 112px; }
  #view-admin .admin-tabs > .btn.admin-tab-wide { flex-basis: 160px; width: 160px; min-width: 160px; max-width: 160px; }
}
@media (max-width: 640px) {
  .login-left-panel { display: none; }
  .login-right-panel { flex: 1; min-height: 100vh; }
}
@media (max-width: 768px) { .md\:grid-cols-2 { grid-template-columns: 1fr; } }

/* ── TAILWIND COMPAT ─────────────────────────────────────── */
.min-h-screen { min-height: 100vh; }
.p-8 { padding: 2rem; } .p-6 { padding: 1.5rem; } .p-4 { padding: 1rem; }
.p-3 { padding: 0.75rem; } .p-2 { padding: 0.5rem; } .p-1 { padding: 0.25rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.mb-1 { margin-bottom: 0.25rem; } .mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 0.75rem; } .mb-4 { margin-bottom: 1rem; }
.mt-4 { margin-top: 1rem; }
.max-w-6xl { max-width: 72rem; } .max-w-md { max-width: 28rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.overflow-hidden { overflow: hidden; }
.items-center { align-items: center; } .justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; } .gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; } .gap-6 { gap: 1.5rem; }
.flex-wrap { flex-wrap: wrap; }
.grid { display: grid; }
.grid-cols-7 { grid-template-columns: repeat(7,1fr); }
.grid-cols-3 { grid-template-columns: repeat(3,1fr); }
.grid-cols-2 { grid-template-columns: repeat(2,1fr); }
.bg-white  { background-color: white; } .bg-gray-50 { background-color: var(--surface-2); }
.bg-blue-600 { background-color: var(--primary); } .bg-green-100 { background-color: var(--primary-muted); }
.bg-blue-100 { background-color: var(--surface-2); } .bg-blue-50 { background-color: #f0f4ef; }
.bg-black { background-color: black; }
.bg-gradient-to-br { background: linear-gradient(to bottom right, var(--surface-2), var(--primary-muted)); }
.bg-gradient-to-r  { background: linear-gradient(to right, var(--primary), var(--primary-dark)); }
.text-white { color: white; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-blue-100 { color: var(--primary-muted); } .text-gray-600 { color: var(--text-muted); }
.text-gray-700 { color: var(--text-main); } .text-gray-800 { color: #1a2e1a; }
.text-gray-500 { color: #5a7058; } .text-green-800 { color: var(--primary-dark); }
.text-blue-800 { color: var(--primary); } .text-blue-600 { color: var(--primary); }
.font-bold { font-weight: 700; } .font-semibold { font-weight: 600; } .font-medium { font-weight: 500; }
.rounded-2xl { border-radius: 1rem; } .rounded-xl { border-radius: 0.75rem; }
.rounded-lg { border-radius: 0.5rem; } .rounded-full { border-radius: 9999px; }
.shadow-2xl { box-shadow: var(--shadow-lg); } .shadow-lg { box-shadow: var(--shadow); } .shadow { box-shadow: var(--shadow-sm); }
.w-8 { width: 2rem; } .h-8 { height: 2rem; } .w-5 { width: 1.25rem; } .h-5 { height: 1.25rem; }
.w-4 { width: 1rem; } .h-4 { height: 1rem; } .w-3 { width: 0.75rem; } .h-3 { height: 0.75rem; }
.w-12 { width: 3rem; } .h-12 { height: 3rem; } .w-6 { width: 1.5rem; } .h-6 { height: 1.5rem; }
.w-full { width: 100%; } .aspect-square { aspect-ratio: 1; }
.relative { position: relative; } .fixed { position: fixed; } .block { display: block; }
.inset-0 { top:0; right:0; bottom:0; left:0; } .z-50 { z-index: 50; }
.opacity-50 { opacity: 0.5; }
.space-y-3 > * + * { margin-top: 0.75rem; } .space-y-2 > * + * { margin-top: 0.5rem; }
.hover\:bg-white:hover { background-color: white; }
.hover\:bg-gray-100:hover { background-color: var(--surface-2); }
.hover\:bg-blue-50:hover { background-color: var(--primary-muted); }
.hover\:bg-blue-200:hover { background-color: #b8c3a4; }
.hover\:bg-blue-700:hover { background-color: var(--primary-dark); }
.hover\:bg-green-200:hover { background-color: #b8c3a4; }
.hover\:scale-105:hover { transform: scale(1.05); }
.hover\:scale-125:hover { transform: scale(1.25); }
.hover\:shadow-xl:hover { box-shadow: var(--shadow); }
.transition-all { transition: all 0.2s; } .transition-colors { transition: background-color 0.2s; }
.transition-transform { transition: transform 0.2s; }
.bg-opacity-50 { background-color: rgba(0,0,0,0.5); }
.focus\:border-blue-600:focus { border-color: var(--primary); }
.focus\:outline-none:focus { outline: none; }
.border-2 { border-width: 2px; } .border-gray-300 { border-color: var(--border); }
.bg-green-100 { background-color: var(--primary-muted); } .text-green-800 { color: var(--primary-dark); }

/* ── ABAS DE NAVEGAÇÃO ────────────────────────────────────── */
.rec-tab {
  padding: 10px 20px; background-color: transparent;
  border: 2px solid transparent; color: var(--text-muted);
  font-weight: 600; font-size: 0.9rem; cursor: pointer;
  transition: all 0.2s ease; border-radius: 10px 10px 0 0; margin-bottom: -2px;
}
.rec-tab:hover { color: var(--primary); background-color: var(--primary-glass); }
.rec-tab.active {
  background-color: white; color: var(--primary);
  font-weight: 700; border: 2px solid var(--border); border-bottom: 2px solid white;
}
