:root {
  /* Paleta DôPin Saúde — Azul Petróleo Profundo + Turquesa Vivo */
  --petrol-900: #041b2a;
  --petrol-800: #06283d;
  --petrol-700: #0b3b59;
  --turquoise-600: #0d9488;
  --turquoise-500: #14b8a6;
  --turquoise-100: #ccfbf1;
  --turquoise-50: #f0fdfa;
  --cyan-400: #22d3ee;

  --white: #ffffff;
  --bg-page: #f8fafc;
  --text-main: #0f172a;
  --text-muted: #52647a;
  --border: #d5e2ea;

  --success: #0d9488;
  --success-bg: #ccfbf1;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --warning: #b45309;
  --warning-bg: #fef3c7;
  --info: #0369a1;
  --info-bg: #e0f2fe;

  --radius: 10px;
  --shadow: 0 4px 14px rgba(6, 40, 61, 0.07);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
  background-color: var(--bg-page);
  color: var(--text-main);
}

/* ==================== TELA DE LOGIN ==================== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-page);
}

.login-topbar {
  width: 100%;
  background: var(--white);
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 20;
}

.login-topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.login-logo-badge {
  background: var(--petrol-800);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(6, 40, 61, 0.18);
}

.login-subtitle {
  color: #94a3b8;
  font-size: 0.72rem;
}

.status-pill-light {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.status-pill-light.online {
  background: var(--turquoise-50);
  border: 1px solid rgba(20, 184, 166, 0.35);
  color: var(--turquoise-600);
}

.status-pill-light.online .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--turquoise-500);
}

.status-pill-light.offline {
  background: var(--warning-bg);
  border: 1px solid rgba(180, 83, 9, 0.3);
  color: var(--warning);
}

.status-pill-light.offline .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
}

.login-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 20px;
}

.login-card {
  width: 100%;
  max-width: 1020px;
  background: var(--white);
  border-radius: 18px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
  border: 1px solid #e2e8f0;
  overflow: hidden;
  display: grid;
  grid-template-columns: 5fr 7fr;
}

.login-hero {
  background: linear-gradient(155deg, var(--petrol-900), var(--petrol-800) 60%, var(--petrol-700));
  color: var(--white);
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.glow-top {
  position: absolute;
  top: -70px;
  right: -70px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: rgba(34, 211, 238, 0.16);
  filter: blur(36px);
  pointer-events: none;
}

.glow-bottom {
  position: absolute;
  bottom: -90px;
  left: -90px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: rgba(20, 184, 166, 0.22);
  filter: blur(40px);
  pointer-events: none;
}

.login-hero-content,
.login-hero-features {
  position: relative;
  z-index: 2;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--cyan-400);
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 24px;
}

.hero-tag svg {
  width: 14px;
  height: 14px;
}

.login-hero h2 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 16px;
}

.login-hero p {
  color: rgba(226, 232, 240, 0.88);
  font-size: 0.9rem;
  line-height: 1.6;
}

.login-hero-features {
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 0.78rem;
  color: #e2e8f0;
}

.hero-feat {
  display: flex;
  align-items: center;
  gap: 10px;
}

.feat-check {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-weight: 700;
  flex-shrink: 0;
}

.feat-check.turquoise {
  background: rgba(20, 184, 166, 0.28);
  color: var(--turquoise-500);
}

.feat-check.cyan {
  background: rgba(34, 211, 238, 0.22);
  color: var(--cyan-400);
}

.login-form-side {
  padding: 44px 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-form-box {
  width: 100%;
  max-width: 400px;
}

.login-form-box h3 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--petrol-800);
  margin-bottom: 4px;
}

.login-desc {
  font-size: 0.88rem;
  color: #64748b;
  margin-bottom: 22px;
}

.perfil-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 4px;
  background: #f1f5f9;
  border-radius: 11px;
  margin-bottom: 22px;
}

.perfil-btn {
  border: none;
  background: transparent;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s;
}

.perfil-btn:hover {
  color: var(--petrol-800);
}

.perfil-btn.active {
  background: var(--white);
  color: var(--petrol-800);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}

.login-field {
  margin-bottom: 16px;
}

.login-field label {
  display: block;
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #334155;
  margin-bottom: 6px;
}

.login-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.login-field input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  font-size: 0.9rem;
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 40px;
}

.btn-eye {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.btn-eye:hover {
  color: var(--petrol-800);
}

.btn-eye svg {
  width: 17px;
  height: 17px;
}

.remember-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: #475569;
  cursor: pointer;
  margin: 4px 0 18px;
}

.remember-row input {
  accent-color: var(--turquoise-500);
  width: 15px;
  height: 15px;
}

.btn-login-submit {
  width: 100%;
  justify-content: center;
  padding: 12px 16px;
  border-radius: 10px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.92rem;
}

.login-footer {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid #f1f5f9;
  text-align: center;
  font-size: 0.76rem;
  color: #94a3b8;
}

@media (max-width: 840px) {
  .login-card {
    grid-template-columns: 1fr;
  }

  .login-form-side {
    padding: 32px 24px;
  }
}

/* ==================== PAINEL PRINCIPAL (APP) ==================== */
#appShell {
  padding-bottom: 40px;
}

.topbar {
  background: linear-gradient(135deg, var(--petrol-900), var(--petrol-800) 60%, var(--petrol-700));
  color: var(--white);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  box-shadow: 0 3px 12px rgba(6, 40, 61, 0.22);
  border-bottom: 2px solid rgba(20, 184, 166, 0.35);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-badge {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.3);
  width: 44px;
  height: 44px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.logo-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 1.1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.clinic-badge {
  margin-left: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(20, 184, 166, 0.2);
  border: 1px solid rgba(34, 211, 238, 0.35);
  color: var(--cyan-400);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.brand .subtitle {
  display: block;
  font-size: 0.78rem;
  color: #94a3b8;
  margin-top: 2px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.user-pill {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  color: #e2e8f0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.user-pill svg {
  width: 15px;
  height: 15px;
  color: var(--cyan-400);
}

.date-picker-box {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 12px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.date-picker-box label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.date-picker-box input {
  background: var(--white);
  color: var(--petrol-800);
  border: none;
  padding: 4px 8px;
  border-radius: 5px;
  font-weight: 600;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
}

.status-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-badge.online {
  background: rgba(20, 184, 166, 0.18);
  color: #5eead4;
  border: 1px solid rgba(45, 212, 191, 0.4);
}

.status-badge.online .dot {
  background: var(--turquoise-500);
}

.status-badge.offline {
  background: rgba(220, 38, 38, 0.25);
  color: #fecaca;
  border: 1px solid rgba(254, 202, 202, 0.4);
}

.status-badge.offline .dot {
  background: #f87171;
}

/* Navigation Tabs */
.tabs-nav {
  background: var(--white);
  border-bottom: 2px solid var(--border);
  padding: 0 24px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 14px 16px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: var(--petrol-800);
  background: var(--turquoise-50);
}

.tab-btn.active {
  color: var(--petrol-800);
  border-bottom-color: var(--turquoise-500);
}

.tab-btn.active i,
.tab-btn.active svg {
  color: var(--turquoise-600);
}

.nav-badge-count {
  background: var(--danger);
  color: var(--white);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
}

/* Main Layout */
.container {
  max-width: 1400px;
  margin: 22px auto;
  padding: 0 20px;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.clinic-profile-card {
  border-top: 4px solid var(--turquoise-500);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
}

.card-header h2,
.card-header h3 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--petrol-800);
  font-size: 1.1rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.card-header h3 svg,
.card-header h2 svg {
  width: 18px;
  height: 18px;
  color: var(--turquoise-600);
}

.card-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.card-header-bar h2 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--petrol-800);
}

.header-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hint {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Forms */
.grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 14px;
}

.form-span-2 {
  grid-column: span 2;
}

.form-span-full {
  grid-column: 1 / -1;
}

@media (max-width: 700px) {
  .form-span-2 {
    grid-column: span 1;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--petrol-800);
}

input,
select,
textarea {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 0.92rem;
  background: var(--white);
  color: var(--text-main);
  transition: border-color 0.2s, box-shadow 0.2s;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--turquoise-500);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.16);
}

.preview-strip {
  grid-column: 1 / -1;
  background: var(--turquoise-50);
  border: 1px solid #99f6e4;
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--petrol-800);
}

.preview-strip .highlight {
  color: var(--petrol-800);
  background: var(--white);
  border: 1px solid rgba(20, 184, 166, 0.35);
  padding: 2px 10px;
  border-radius: 6px;
}

.preview-strip .highlight strong {
  color: var(--turquoise-600);
}

.retro-alert-box {
  grid-column: 1 / -1;
  background: var(--warning-bg);
  border: 1px solid rgba(180, 83, 9, 0.35);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--warning);
}

.retro-alert-box label {
  color: var(--warning);
  font-weight: 700;
  display: block;
  margin-bottom: 6px;
}

.retro-alert-box input {
  width: 100%;
  border-color: rgba(180, 83, 9, 0.4);
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  padding: 9px 16px;
  border-radius: 7px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: 0.2s;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--turquoise-500);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(20, 184, 166, 0.25);
}

.btn-primary:hover {
  background: var(--turquoise-600);
}

.btn-outline {
  background: var(--white);
  color: var(--petrol-800);
  border: 1px solid var(--petrol-800);
}

.btn-outline:hover {
  background: var(--turquoise-50);
  border-color: var(--turquoise-600);
  color: var(--turquoise-600);
}

.btn-outline-light {
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
  border: 1px solid rgba(34, 211, 238, 0.35);
}

.btn-outline-light:hover {
  background: rgba(20, 184, 166, 0.25);
  border-color: var(--cyan-400);
}

.btn-edit-sm {
  background: var(--turquoise-50);
  color: var(--turquoise-600);
  border: 1px solid rgba(20, 184, 166, 0.35);
  padding: 4px 9px;
  font-size: 0.8rem;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
  transition: 0.15s;
}

.btn-edit-sm:hover {
  background: var(--turquoise-100);
}

.btn-danger-sm {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 4px 9px;
  font-size: 0.8rem;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

.btn-success-sm {
  background: var(--success-bg);
  color: var(--success);
  padding: 4px 9px;
  font-size: 0.8rem;
  border-radius: 5px;
  border: 1px solid rgba(13, 148, 136, 0.3);
  cursor: pointer;
  font-weight: 600;
}

.item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th {
  background: var(--petrol-800);
  color: var(--white);
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  white-space: nowrap;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:hover td {
  background: var(--turquoise-50);
}

tfoot tr.row-total td {
  background: #f1f5f9;
  font-weight: 700;
  color: var(--petrol-800);
  border-top: 2px solid var(--petrol-800);
}

tfoot tr.row-media td {
  background: var(--turquoise-50);
  font-weight: 600;
  color: var(--petrol-700);
  font-size: 0.84rem;
}

.summary-pill {
  background: var(--turquoise-50);
  color: var(--petrol-800);
  border: 1px solid rgba(20, 184, 166, 0.35);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.88rem;
}

.summary-pill strong {
  color: var(--turquoise-600);
}

.summary-pill.danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(185, 28, 28, 0.25);
}

.summary-pill.danger strong {
  color: var(--danger);
}

/* KPIs & Grids */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.kpi-grid-5 {
  grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
}

.kpi-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 5px solid var(--petrol-800);
  border-radius: var(--radius);
  padding: 15px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-card span {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.kpi-card strong {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.32rem;
  color: var(--petrol-800);
}

.kpi-card small {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.kpi-card.highlight-green {
  border-left-color: var(--turquoise-500);
}

.kpi-card.highlight-green strong {
  color: var(--turquoise-600);
}

.kpi-card.highlight-red {
  border-left-color: var(--danger);
}

.kpi-card.highlight-red strong {
  color: var(--danger);
}

.kpi-card.highlight-blue {
  border-left-color: var(--info);
}

.kpi-card.highlight-blue strong {
  color: var(--info);
}

.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr));
  gap: 20px;
}

/* ==================== GRÁFICO DE BARRAS ANUAL ==================== */
.chart-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--petrol-800);
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  display: inline-block;
}

.legend-dot.rev {
  background: var(--turquoise-500);
}

.legend-dot.exp {
  background: #ef4444;
}

.bar-chart-wrap {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 10px;
  align-items: end;
  height: 210px;
  padding: 18px 8px 6px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  gap: 6px;
  min-width: 44px;
}

.bar-pair {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 150px;
  width: 100%;
  justify-content: center;
}

.bar-item {
  width: 14px;
  border-radius: 4px 4px 0 0;
  min-height: 3px;
  transition: height 0.35s ease;
  cursor: pointer;
}

.bar-item.rev {
  background: var(--turquoise-500);
}

.bar-item.rev:hover {
  background: var(--turquoise-600);
}

.bar-item.exp {
  background: #ef4444;
}

.bar-item.exp:hover {
  background: #dc2626;
}

.bar-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* ==================== DEMONSTRATIVO MENSAL ==================== */
.demo-mensal-card {
  border-top: 4px solid var(--petrol-800);
}

.demo-sheet {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 22px;
}

.demo-header-doc {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid var(--petrol-800);
  padding-bottom: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}

.demo-header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.demo-clinic-logo {
  max-height: 58px;
  max-width: 140px;
  object-fit: contain;
  border-radius: 6px;
}

.demo-header-doc h4 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.2rem;
  color: var(--petrol-800);
}

.demo-header-doc p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.demo-meta-box {
  text-align: right;
  font-size: 0.82rem;
  color: var(--petrol-800);
}

.demo-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.demo-box {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.demo-box span {
  display: block;
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.demo-box strong {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.15rem;
  color: var(--petrol-800);
}

.demo-section-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.96rem;
  color: var(--petrol-800);
  margin: 18px 0 8px;
}

.demo-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-top: 42px;
  padding-top: 12px;
}

.sig-line {
  border-top: 1px solid #64748b;
  text-align: center;
  padding-top: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==================== PRONTUÁRIO, ODONTOGRAMA & EVOLUÇÃO ==================== */
.prontuario-subnav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.subtab-btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-page);
  color: var(--petrol-800);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: 0.2s;
}

.subtab-btn:hover {
  background: var(--turquoise-50);
  border-color: var(--turquoise-500);
}

.subtab-btn.active {
  background: var(--petrol-800);
  color: var(--white);
  border-color: var(--petrol-800);
}

.anamnese-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 12px;
}

.anamnese-item {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 13px;
}

.anamnese-item small {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--petrol-700);
  margin-bottom: 4px;
}

.anamnese-item p {
  font-size: 0.88rem;
  color: var(--text-main);
  white-space: pre-wrap;
}

.anamnese-item.alert-alergia {
  border-left: 4px solid var(--danger);
  background: #fff5f5;
}

/* Odontograma FDI Visual + Planejamento */
.arch-wrapper {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 16px;
}

.arch-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--petrol-700);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

.arch-row {
  display: grid;
  grid-template-columns: repeat(16, minmax(38px, 1fr));
  gap: 5px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.tooth-chip {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 4px;
  text-align: center;
  cursor: pointer;
  transition: 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.tooth-chip:hover {
  border-color: var(--turquoise-500);
  transform: translateY(-1px);
}

.tooth-chip .tooth-num {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--petrol-800);
}

.tooth-chip .tooth-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
}

.tooth-chip.st-pendente {
  background: var(--warning-bg);
  border-color: #f59e0b;
}

.tooth-chip.st-pendente .tooth-dot {
  background: #d97706;
}

.tooth-chip.st-andamento {
  background: var(--info-bg);
  border-color: #0284c7;
}

.tooth-chip.st-andamento .tooth-dot {
  background: #0284c7;
}

.tooth-chip.st-realizado {
  background: var(--turquoise-100);
  border-color: var(--turquoise-600);
}

.tooth-chip.st-realizado .tooth-dot {
  background: var(--turquoise-600);
}

.odonto-quadrantes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.quadrante-box {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 12px;
}

.quadrante-box h4 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.88rem;
  color: var(--petrol-800);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.tooth-plan-row {
  display: grid;
  grid-template-columns: 42px 1fr 88px 115px auto;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}

.tooth-plan-row .tooth-badge {
  background: var(--petrol-800);
  color: var(--white);
  font-weight: 700;
  font-size: 0.78rem;
  text-align: center;
  padding: 6px 4px;
  border-radius: 6px;
}

.tooth-plan-row input,
.tooth-plan-row select {
  padding: 6px 8px;
  font-size: 0.82rem;
}

@media (max-width: 640px) {
  .tooth-plan-row {
    grid-template-columns: 40px 1fr;
  }
}

/* Status Badges */
.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-tag.pendente {
  background: var(--warning-bg);
  color: var(--warning);
}

.status-tag.andamento {
  background: var(--info-bg);
  color: var(--info);
}

.status-tag.realizado {
  background: var(--success-bg);
  color: var(--success);
}

/* Cartões de Evolução Clínica */
.evolucao-card {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-left: 4px solid var(--turquoise-500);
  border-radius: 9px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.evolucao-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.evolucao-data {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  color: var(--petrol-800);
  font-size: 0.92rem;
}

.evolucao-texto {
  font-size: 0.9rem;
  color: var(--text-main);
  line-height: 1.55;
  white-space: pre-wrap;
}

/* Seletor pesquisável de Paciente no Mapa Diário */
.paciente-picker-wrap {
  position: relative;
}

.paciente-picker-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--white);
  border: 1px solid var(--turquoise-500);
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(6, 40, 61, 0.14);
  max-height: 220px;
  overflow-y: auto;
  margin-top: 4px;
}

.paciente-picker-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.86rem;
}

.paciente-picker-item:hover {
  background: var(--turquoise-50);
}

.paciente-picker-item strong {
  color: var(--petrol-800);
  display: block;
}

.paciente-picker-item small {
  color: var(--text-muted);
  font-size: 0.76rem;
}

/* Lists in Config */
.inline-form {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.inline-form input {
  flex: 1;
  min-width: 110px;
}

.editable-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.editable-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 12px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 7px;
  gap: 10px;
  flex-wrap: wrap;
}

.editable-list input.inline-edit {
  width: 85px;
  padding: 4px 6px;
  text-align: right;
}

.logo-preview-box {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  background: var(--bg-page);
  border: 1px dashed var(--border);
  border-radius: 9px;
  margin-bottom: 14px;
}

.logo-preview-box img {
  max-height: 64px;
  max-width: 180px;
  object-fit: contain;
  border-radius: 6px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 27, 42, 0.7);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  z-index: 999;
  padding: 16px;
  overflow-y: auto;
}

.modal-box {
  background: var(--white);
  padding: 24px;
  border-radius: 12px;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 4px solid var(--turquoise-500);
  box-shadow: 0 12px 32px rgba(6, 40, 61, 0.28);
}

.modal-box.modal-lg {
  max-width: 620px;
}

.modal-box h3 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--petrol-800);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

.error-text {
  color: var(--danger);
  font-size: 0.84rem;
  margin-bottom: 8px;
}

.hidden {
  display: none !important;
}

.text-success {
  color: var(--turquoise-600);
  font-weight: 600;
}

.text-danger {
  color: var(--danger);
  font-weight: 600;
}

/* ==================== IMPRESSÃO / PDF ==================== */
@media print {
  body {
    background: #ffffff;
  }

  .no-print {
    display: none !important;
  }

  #appShell {
    padding: 0;
  }

  .container {
    margin: 0;
    padding: 0;
    max-width: 100%;
  }

  .demo-mensal-card {
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
  }

  .demo-sheet {
    border: none;
    padding: 0;
  }

  th {
    background: #06283d !important;
    color: #ffffff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* =====================================================================
   RESPONSIVIDADE — TABLET E CELULAR
   ===================================================================== */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

img,
svg {
  max-width: 100%;
}

#appShell {
  overflow-x: clip;
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
}

input,
select,
textarea {
  max-width: 100%;
}

td {
  overflow-wrap: anywhere;
}

/* Telas sem mouse: sem efeito de "pular" no hover */
@media (hover: none) {
  .tooth-chip:hover {
    transform: none;
  }
  tr:hover td {
    background: inherit;
  }
}

/* -------------------- TABLET (≤ 1024px) -------------------- */
@media (max-width: 1024px) {
  .topbar {
    padding: 12px 16px;
  }

  .tabs-nav {
    padding: 0 12px;
  }

  .tab-btn {
    padding: 12px 12px;
    font-size: 0.86rem;
  }

  .odonto-quadrantes {
    grid-template-columns: 1fr;
  }
}

/* -------------------- CELULAR / TABLET PEQUENO (≤ 768px) -------------------- */
@media (max-width: 768px) {
  /* Evita o zoom automático do iOS ao focar campos (exige ≥ 16px) */
  input,
  select,
  textarea,
  .login-field input {
    font-size: 16px;
  }

  /* ---------- Login ---------- */
  .login-topbar-inner {
    padding: 0 14px;
    height: 58px;
  }

  .login-subtitle {
    display: none;
  }

  .status-pill-light {
    padding: 5px 10px;
    font-size: 0.7rem;
  }

  .login-main {
    padding: 14px 12px calc(14px + env(safe-area-inset-bottom));
    align-items: flex-start;
  }

  .login-card {
    border-radius: 14px;
  }

  .login-hero {
    padding: 24px 22px;
  }

  .login-hero h2 {
    font-size: 1.35rem;
    margin-bottom: 8px;
  }

  .hero-tag {
    margin-bottom: 14px;
  }

  .login-hero-features {
    display: none;
  }

  .login-form-side {
    padding: 24px 20px;
  }

  .perfil-btn {
    padding: 10px 6px;
    font-size: 0.8rem;
  }

  /* ---------- Topbar do sistema ---------- */
  .topbar {
    padding: 12px 14px;
    padding-top: calc(12px + env(safe-area-inset-top));
    gap: 10px;
  }

  .brand {
    min-width: 0;
    width: 100%;
  }

  .brand > div:last-child {
    min-width: 0;
  }

  .brand .subtitle {
    display: none;
  }

  .brand-title {
    font-size: 1.2rem;
    row-gap: 4px;
  }

  .clinic-badge {
    margin-left: 0;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-basis: 100%;
    width: fit-content;
  }

  .logo-badge {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
  }

  .header-controls {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto auto;
    grid-template-areas:
      'user sync sair'
      'date date status';
    gap: 8px;
  }

  .user-pill {
    grid-area: user;
    min-width: 0;
  }

  #usuarioLogadoInfo {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #statusConexao {
    grid-area: status;
    justify-content: center;
  }

  .date-picker-box {
    grid-area: date;
    min-width: 0;
    padding: 5px 10px;
  }

  .date-picker-box input {
    flex: 1;
    min-width: 0;
    padding: 6px 8px;
  }

  #btnSincronizar {
    grid-area: sync;
  }

  #btnSair {
    grid-area: sair;
  }

  #btnSincronizar,
  #btnSair {
    justify-content: center;
    min-height: 40px;
  }

  /* ---------- Abas principais: barra fixa com rolagem lateral ---------- */
  .tabs-nav {
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 0 8px;
    gap: 2px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    box-shadow: 0 2px 8px rgba(6, 40, 61, 0.08);
  }

  .tabs-nav::-webkit-scrollbar {
    display: none;
  }

  .tab-btn {
    scroll-snap-align: start;
    padding: 12px 10px;
    font-size: 0.82rem;
    gap: 5px;
  }

  .tab-btn svg {
    width: 16px;
    height: 16px;
  }

  /* ---------- Layout geral ---------- */
  .container {
    margin: 14px auto;
    padding: 0 10px;
  }

  .card {
    padding: 14px;
    margin-bottom: 14px;
  }

  .card .card {
    padding: 12px 10px;
  }

  .card-header {
    flex-direction: column;
    align-items: stretch;
  }

  .card-header h2,
  .card-header h3 {
    font-size: 1rem;
  }

  .card-header-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .header-inline {
    width: 100%;
  }

  .header-inline > input,
  .header-inline > select {
    flex: 1 1 160px;
  }

  .header-inline > .btn {
    flex: 1 1 140px;
    justify-content: center;
  }

  /* Campos de busca com largura fixa inline no HTML */
  .card-header > input,
  #buscaPaciente,
  #buscaMedicamento {
    max-width: 100% !important;
    width: 100%;
  }

  .grid-form {
    gap: 12px;
  }

  .form-group[style*='max-width'] {
    max-width: 100% !important;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .form-actions .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .preview-strip {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    padding: 10px 12px;
    font-size: 0.84rem;
  }

  .preview-strip > div span {
    display: block;
    font-size: 0.74rem;
    color: var(--text-muted);
  }

  .preview-strip .highlight {
    grid-column: 1 / -1;
    padding: 6px 10px;
  }

  /* Botões pequenos com área de toque confortável */
  .btn-edit-sm,
  .btn-danger-sm,
  .btn-success-sm {
    min-height: 36px;
    padding: 6px 12px;
    font-size: 0.82rem;
  }

  .btn {
    min-height: 40px;
  }

  /* Listas editáveis (pacientes, dentistas, especialidades) */
  .editable-list li {
    flex-direction: column;
    align-items: stretch;
  }

  .editable-list li .item-actions,
  .editable-list li > .btn-danger-sm {
    width: 100%;
  }

  .editable-list li .item-actions > button {
    flex: 1 1 auto;
  }

  .inline-form input,
  .inline-form select {
    flex: 1 1 100%;
  }

  .inline-form .btn {
    flex: 1 1 100%;
    justify-content: center;
  }

  .logo-preview-box {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .logo-preview-box img {
    margin: 0 auto;
  }

  .logo-preview-box form {
    margin-left: 0 !important;
  }

  /* KPIs em 2 colunas */
  .kpi-grid,
  .kpi-grid-5 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
  }

  .kpi-card {
    padding: 11px 12px;
    border-left-width: 4px;
  }

  .kpi-card span {
    font-size: 0.74rem;
  }

  .kpi-card strong {
    font-size: 1.05rem;
    overflow-wrap: anywhere;
  }

  .kpi-card small {
    font-size: 0.68rem;
  }

  .two-col {
    gap: 14px;
  }

  .simple-table {
    font-size: 0.82rem;
  }

  .simple-table th,
  .simple-table td {
    padding: 8px;
  }

  /* Gráfico anual: rolagem lateral */
  .bar-chart-wrap {
    gap: 6px;
    -webkit-overflow-scrolling: touch;
  }

  .bar-col {
    min-width: 34px;
  }

  .bar-item {
    width: 11px;
  }

  .chart-legend {
    flex-wrap: wrap;
  }

  /* Demonstrativo mensal */
  .demo-sheet {
    padding: 12px;
  }

  .demo-header-brand {
    flex-wrap: wrap;
  }

  .demo-meta-box {
    text-align: left;
  }

  .demo-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .demo-signatures {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  /* ---------- Prontuário ---------- */
  .prontuario-subnav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .subtab-btn {
    justify-content: center;
    text-align: center;
    padding: 10px 8px;
    font-size: 0.8rem;
    line-height: 1.25;
    min-height: 48px;
  }

  .subtab-btn svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
  }

  .arch-wrapper {
    padding: 10px;
  }

  .arch-title {
    flex-direction: column;
    gap: 2px;
  }

  /* Arcada em 2 linhas de 8 dentes (direita / esquerda) */
  .arch-row {
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 4px;
    overflow: visible;
  }

  .tooth-chip {
    padding: 7px 2px;
    min-height: 40px;
  }

  .quadrante-box {
    padding: 8px;
  }

  .tooth-plan-row select {
    padding-right: 4px;
  }

  .tooth-plan-row .item-actions button {
    min-height: 34px;
  }

  /* Linha de planejamento do dente: 2 linhas no celular */
  .tooth-plan-row {
    grid-template-columns: 40px minmax(0, 0.75fr) minmax(0, 1.25fr);
    grid-template-areas:
      'badge desc desc'
      'valor valor status'
      'acoes acoes acoes';
    gap: 6px;
    padding: 6px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
  }

  .tooth-plan-row .tooth-badge {
    grid-area: badge;
    align-self: stretch;
    display: grid;
    place-items: center;
  }

  .tooth-plan-row input[type='text'] {
    grid-area: desc;
  }

  .tooth-plan-row input[type='number'] {
    grid-area: valor;
  }

  .tooth-plan-row select {
    grid-area: status;
  }

  .tooth-plan-row input,
  .tooth-plan-row select {
    width: 100%;
    font-size: 16px;
    padding: 8px;
  }

  .tooth-plan-row .item-actions {
    grid-area: acoes;
    justify-content: flex-end;
  }

  .tooth-plan-row .item-actions .btn-edit-sm {
    flex: 1;
  }

  .anamnese-grid {
    grid-template-columns: 1fr;
  }

  .evolucao-card {
    padding: 12px;
  }

  .evolucao-card-head .item-actions {
    width: 100%;
  }

  .evolucao-card-head .item-actions button {
    flex: 1;
  }

  .paciente-picker-dropdown {
    max-height: 50vh;
  }

  .paciente-picker-item {
    padding: 11px 12px;
  }

  /* ---------- Modais: estilo "folha" que sobe da base ---------- */
  .modal-backdrop {
    place-items: end center;
    padding: 0;
  }

  .modal-box {
    max-width: 100% !important;
    border-radius: 16px 16px 0 0;
    max-height: 92vh;
    max-height: 92dvh;
    overflow-y: auto;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .modal-box input,
  .modal-box select {
    width: 100%;
  }
}

/* ---------- Tabelas viram "cartões" no celular ----------
   Os rótulos (data-label) são preenchidos automaticamente pelo responsive.js
   a partir do <thead> de cada tabela. */
@media screen and (max-width: 768px) {
  .table-responsive {
    overflow: visible;
  }

  table.tabela-cards,
  table.tabela-cards tbody,
  table.tabela-cards tfoot,
  table.tabela-cards tr,
  table.tabela-cards td {
    display: block;
    width: 100%;
  }

  table.tabela-cards thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  table.tabela-cards tr {
    background: var(--white);
    border: 1px solid var(--border);
    border-left: 4px solid var(--turquoise-500);
    border-radius: 9px;
    padding: 4px 12px;
    margin-bottom: 10px;
    box-shadow: 0 1px 4px rgba(6, 40, 61, 0.05);
  }

  table.tabela-cards td {
    position: relative;
    min-height: 38px;
    padding: 9px 0 9px calc(40% + 10px);
    text-align: right;
    border-bottom: 1px dashed var(--border);
    background: transparent !important;
  }

  table.tabela-cards td:last-child {
    border-bottom: none;
  }

  table.tabela-cards td::before {
    content: attr(data-label);
    position: absolute;
    left: 0;
    top: 9px;
    width: 40%;
    text-align: left;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    color: var(--petrol-700);
    line-height: 1.3;
  }

  /* Célula sem rótulo (mensagem "Nenhum registro...") */
  table.tabela-cards td.td-vazio,
  table.tabela-cards td[data-label=''] {
    padding-left: 0;
    text-align: center;
    color: var(--text-muted);
  }

  table.tabela-cards td.td-vazio::before,
  table.tabela-cards td[data-label='']::before {
    display: none;
  }

  table.tabela-cards tr:has(td.td-vazio) {
    border-left-color: var(--border);
  }

  /* Coluna de ações e botões dentro dos cartões */
  table.tabela-cards td.item-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  table.tabela-cards td input,
  table.tabela-cards td select {
    width: 100% !important;
    max-width: 100%;
  }

  table.tabela-cards td .status-tag {
    white-space: normal;
    text-align: right;
  }

  table.tabela-cards tfoot tr.row-total {
    border-left-color: var(--petrol-800);
    background: #f1f5f9;
  }

  table.tabela-cards tfoot tr.row-total td {
    border-top: none;
    font-weight: 700;
  }
}

/* -------------------- CELULAR PEQUENO (≤ 400px) -------------------- */
@media (max-width: 400px) {
  .brand-title {
    font-size: 1.08rem;
  }

  .date-picker-box label {
    font-size: 0;
    gap: 0;
  }

  .date-picker-box label svg {
    width: 16px;
    height: 16px;
  }

  #btnSair {
    padding: 9px 10px;
  }

  .tooth-chip .tooth-num {
    font-size: 0.72rem;
  }

  .login-hero {
    padding: 20px 18px;
  }

  .login-hero p {
    font-size: 0.84rem;
  }

  .kpi-card strong {
    font-size: 0.98rem;
  }

  .demo-summary-grid {
    grid-template-columns: 1fr;
  }

  table.tabela-cards td {
    padding-left: calc(42% + 8px);
  }

  table.tabela-cards td::before {
    width: 42%;
  }
}

/* Celular deitado (paisagem): modal não pode ocupar a tela toda */
@media (max-height: 500px) and (orientation: landscape) {
  .modal-box {
    max-height: 96vh;
  }

  .tabs-nav {
    position: static;
  }
}

/* Correção: valores negativos nos KPIs devem aparecer em vermelho (ex.: prejuízo) */
.kpi-card strong.text-danger {
  color: var(--danger);
}

/* =====================================================================
   VISUALIZAÇÃO / IMPRESSÃO DE DOCUMENTOS CLÍNICOS (SEM POP-UP)
   Receitas, atestados e declarações abrem dentro do sistema.
   ===================================================================== */
.doc-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: #e2e8f0;
  display: flex;
  flex-direction: column;
}

.doc-preview-overlay.hidden {
  display: none !important;
}

body.doc-preview-aberto {
  overflow: hidden;
}

.doc-preview-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--petrol-800);
  box-shadow: 0 2px 10px rgba(6, 40, 61, 0.25);
}

.doc-preview-toolbar .doc-preview-voltar {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.55);
}

.doc-preview-nome {
  flex: 1;
  min-width: 0;
  color: #e2e8f0;
  font-size: 0.86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.doc-preview-dica {
  display: none;
  margin: 0;
  padding: 8px 14px;
  font-size: 0.8rem;
  color: var(--petrol-800);
  background: var(--turquoise-50);
  border-bottom: 1px solid #99f6e4;
}

.doc-preview-scroll {
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

/* Folha do documento (mesma aparência do antigo pop-up, escopada) */
.doc-print-root { color: #0f172a; font-family: 'Segoe UI', Arial, sans-serif; }
.doc-print-root .page-sheet { background: #fff; max-width: 780px; margin: 0 auto 24px; padding: 32px; border: 1px solid #cbd5e1; border-radius: 8px; }
.doc-print-root .doc-head { border-bottom: 2px solid #06283d; padding-bottom: 14px; margin-bottom: 18px; }
.doc-print-root .doc-brand { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.doc-print-root .doc-brand img { max-width: 100%; }
.doc-print-root .doc-brand h2 { margin: 0; color: #06283d; font-size: 1.25rem; }
.doc-print-root .doc-brand p { margin: 4px 0 0; color: #475569; font-size: 0.82rem; }
.doc-print-root .doc-title-bar { text-align: center; margin: 18px 0; }
.doc-print-root .doc-title-bar h3 { margin: 0; color: #06283d; letter-spacing: 0.5px; }
.doc-print-root .via-badge { display: inline-block; margin-top: 6px; padding: 4px 12px; background: #f0fdfa; border: 1px solid #14b8a6; color: #0d9488; font-size: 0.78rem; font-weight: 700; border-radius: 999px; }
.doc-print-root .pac-box { background: #f8fafc; border: 1px solid #e2e8f0; padding: 10px 14px; border-radius: 6px; margin-bottom: 18px; font-size: 0.92rem; }
.doc-print-root .med-item { padding: 12px 0; border-bottom: 1px dashed #cbd5e1; }
.doc-print-root .med-title { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; font-size: 0.98rem; }
.doc-print-root .med-posologia { margin-top: 5px; font-size: 0.92rem; }
.doc-print-root .med-sub { margin-top: 3px; font-size: 0.82rem; color: #475569; }
.doc-print-root .atestado-body { font-size: 1rem; line-height: 1.75; margin: 28px 0 48px; text-align: justify; }
.doc-print-root .doc-footer { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 52px; font-size: 0.88rem; }
.doc-print-root .sig-box { text-align: center; min-width: 240px; }
.doc-print-root .sig-line { border-top: 1px solid #334155; margin-bottom: 6px; padding: 0; color: inherit; }
.doc-print-root .landscape-two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 1120px; margin: 0 auto; align-items: stretch; }
.doc-print-root .landscape-two-cols .page-sheet { max-width: 100%; margin: 0; padding: 20px; font-size: 0.86rem; display: flex; flex-direction: column; justify-content: space-between; }
.doc-print-root .landscape-two-cols .doc-brand h2 { font-size: 1.05rem; }
.doc-print-root .landscape-two-cols .doc-title-bar h3 { font-size: 0.98rem; }
.doc-print-root .landscape-two-cols .doc-footer { margin-top: 28px; }

@media screen and (max-width: 760px) {
  .doc-preview-toolbar { padding-left: 10px; padding-right: 10px; gap: 8px; }
  .doc-preview-nome { display: none; }
  .doc-preview-toolbar .btn { flex: 1; justify-content: center; min-height: 44px; }
  .doc-preview-dica { display: block; }
  .doc-preview-scroll { padding: 10px; }
  .doc-print-root .page-sheet { padding: 18px 14px; margin-bottom: 14px; }
  .doc-print-root .landscape-two-cols { grid-template-columns: 1fr; }
  .doc-print-root .doc-brand h2 { font-size: 1.05rem; }
  .doc-print-root .doc-title-bar h3 { font-size: 0.98rem; }
  .doc-print-root .atestado-body { font-size: 0.95rem; margin: 18px 0 30px; text-align: left; }
  .doc-print-root .doc-footer { flex-direction: column; align-items: stretch; gap: 26px; margin-top: 32px; }
  .doc-print-root .sig-box { min-width: 0; }
}

@media screen and (max-width: 380px) {
  .doc-preview-toolbar .btn span { font-size: 0.82rem; }
}

/* Na impressão: somente o documento aberto, sem o sistema por trás */
@media print {
  body.doc-preview-aberto { overflow: visible; background: #fff; }
  body.doc-preview-aberto > *:not(#docPreviewOverlay) { display: none !important; }
  body.doc-preview-aberto #docPreviewOverlay { position: static; display: block; background: #fff; }
  body.doc-preview-aberto .doc-preview-toolbar,
  body.doc-preview-aberto .doc-preview-dica { display: none !important; }
  body.doc-preview-aberto .doc-preview-scroll { overflow: visible; padding: 0; }
  .doc-print-root .page-sheet { border: 1px solid #cbd5e1; margin: 0 auto; padding: 14px; break-inside: avoid; page-break-inside: avoid; }
  .doc-print-root .landscape-two-cols { max-width: 100%; gap: 12px; grid-template-columns: 1fr 1fr; }
  .doc-print-root * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ==================== CADASTRO PENDENTE / PACIENTE PROVISÓRIO ==================== */
.status-tag.cadastro-pendente {
  background: var(--danger-bg);
  color: var(--danger);
  letter-spacing: 0.3px;
}

.novo-paciente-box {
  border: 1px dashed var(--warning);
  background: var(--warning-bg);
  border-radius: 9px;
  padding: 12px 14px;
}

.novo-paciente-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.novo-paciente-head .hint { flex: 1; min-width: 200px; }
.novo-paciente-box .grid-form { margin: 0; }

.paciente-picker-item.picker-novo {
  background: var(--warning-bg);
  border-top: 1px solid #fcd34d;
}

.paciente-picker-item.picker-novo strong { color: var(--warning); }

.aviso-cadastro-pendente {
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.86rem;
}

.doc-preview-imprimir:disabled { opacity: 0.75; cursor: progress; }

.doc-preview-link {
  display: inline;
  margin-left: 4px;
  padding: 0;
  border: none;
  background: none;
  color: var(--turquoise-600);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

/* =====================================================================
   MAPA DIÁRIO — ordenação por coluna, coluna Ação sempre visível, edição
   ===================================================================== */
.th-sort {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  font: inherit;
  font-weight: 600;
  border-radius: 4px;
}

.th-sort::after {
  content: '↕';
  font-size: 0.75em;
  opacity: 0.45;
}

.th-sort:hover::after { opacity: 0.9; }
.th-sort:focus-visible { outline: 2px solid var(--cyan-400); outline-offset: 2px; }
th.sort-asc .th-sort::after { content: '▲'; opacity: 1; color: var(--cyan-400); }
th.sort-desc .th-sort::after { content: '▼'; opacity: 1; color: var(--cyan-400); }

/* Tabela compacta: cabeçalhos podem quebrar linha → cabe em 100% de zoom */
.tabela-mapa { font-size: 0.84rem; }
.tabela-mapa th {
  white-space: normal;
  line-height: 1.25;
  padding: 9px 8px;
  vertical-align: bottom;
}
.tabela-mapa td { padding: 8px; overflow-wrap: break-word; }
/* valores em R$ nunca quebram no meio */
.tabela-mapa td:nth-child(4), .tabela-mapa td:nth-child(5), .tabela-mapa td:nth-child(7),
.tabela-mapa td:nth-child(8), .tabela-mapa td:nth-child(10) { white-space: nowrap; }
.tabela-mapa td:first-child { min-width: 120px; }

.acoes-mapa {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: stretch;
}

.acoes-mapa button { white-space: nowrap; text-align: center; }
.acoes-mapa button:disabled { opacity: 0.55; cursor: not-allowed; }

/* Coluna Ação fixa à direita: mesmo se a tela for estreita, ela nunca fica escondida */
@media screen and (min-width: 769px) {
  .tabela-mapa th:last-child,
  .tabela-mapa td.col-acoes {
    position: sticky;
    right: 0;
    z-index: 1;
  }
  .tabela-mapa td.col-acoes {
    background: var(--white);
    box-shadow: -6px 0 8px -6px rgba(6, 40, 61, 0.25);
  }
  .tabela-mapa tr:hover td.col-acoes { background: var(--turquoise-50); }
  .tabela-mapa th:last-child { background: var(--petrol-800); }
}

.tabela-mapa tr.linha-editando td { background: var(--warning-bg) !important; }

.mapa-ordenar-mobile {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--petrol-800);
}

@media screen and (max-width: 768px) {
  .mapa-ordenar-mobile { display: flex; width: 100%; }
  .mapa-ordenar-mobile select { flex: 1; }
  .acoes-mapa { flex-direction: row; }
  .acoes-mapa button { flex: 1; min-height: 40px; }
}

.mapa-edicao-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--warning-bg);
  border: 1px solid #fcd34d;
  color: var(--warning);
  border-radius: 9px;
  padding: 10px 14px;
  margin-bottom: 14px;
}

.mapa-edicao-banner > div { display: flex; flex-direction: column; gap: 2px; }
.mapa-edicao-banner .hint { color: var(--warning); }
#cardFormMapa.modo-edicao { border-color: #fcd34d; box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.25); }

.col-mudancas div { line-height: 1.45; }

/* =====================================================================
   AGENDA
   ===================================================================== */
.btn-agenda {
  background: #1f3d58;
  color: var(--white);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  box-shadow: 0 3px 10px rgba(6, 40, 61, 0.22);
}
.btn-agenda:hover { background: var(--petrol-800); }
.btn-agenda-mais { font-size: 1.25em; line-height: 1; font-weight: 500; }
#agSalvar { text-transform: none; letter-spacing: 0; font-size: 0.95rem; padding: 10px 20px; }
.btn-texto { background: none; color: var(--text-muted); font-weight: 500; }
.btn-texto:hover { color: var(--petrol-800); background: #f1f5f9; }

.agenda-topo {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.agenda-titulo {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 2rem;
  letter-spacing: 0.5px;
  color: var(--petrol-900);
}

.agenda-dia-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--petrol-800);
}

.agenda-dia-nav strong { min-width: 0; font-size: 0.95rem; }

.ag-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--petrol-800);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}
.ag-nav-btn:hover { background: var(--turquoise-50); border-color: var(--turquoise-500); }

.agenda-layout {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.agenda-lateral { display: flex; flex-direction: column; gap: 14px; }

.agenda-box {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}

.agenda-box-titulo {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--petrol-900);
  line-height: 1.3;
  margin-bottom: 10px;
}

/* Mini calendário */
.mini-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-weight: 700;
  color: var(--petrol-800);
  font-size: 0.9rem;
}
.mini-cal-head .ag-nav-btn { width: 26px; height: 26px; font-size: 1rem; }

.mini-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
}

.mini-cal-sem { font-size: 0.75rem; font-weight: 700; color: var(--petrol-900); padding: 2px 0 4px; }

.mini-cal-dia {
  position: relative;
  border: none;
  background: none;
  border-radius: 5px;
  font-size: 0.8rem;
  color: var(--text-main);
  padding: 5px 0;
  cursor: pointer;
}
.mini-cal-dia:hover { background: var(--turquoise-50); }
.mini-cal-dia.fora { color: #a8b5c3; }
.mini-cal-dia.hoje { box-shadow: inset 0 0 0 1.5px var(--turquoise-500); font-weight: 700; }
.mini-cal-dia.sel { background: var(--petrol-800); color: var(--white); font-weight: 700; }
.mini-cal-dia.tem::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 1px;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: var(--turquoise-500);
}
.mini-cal-dia.sel.tem::after { background: var(--cyan-400); }

/* Filtro de profissionais e legenda */
.ag-filtro-lista { display: flex; flex-direction: column; gap: 8px; }
.ag-filtro-item { display: flex; align-items: center; gap: 9px; font-size: 0.9rem; cursor: pointer; color: var(--text-main); }
.ag-filtro-item input { width: 17px; height: 17px; accent-color: var(--petrol-800); }

.ag-legenda { display: flex; flex-direction: column; gap: 6px; }
.ag-legenda-item { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--text-muted); }
.ag-legenda-item i { width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0; }

/* Grade */
.agenda-principal {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.agenda-grade-wrap {
  overflow: auto;
  max-height: calc(100vh - 230px);
  min-height: 320px;
  -webkit-overflow-scrolling: touch;
}

.ag-vazio { padding: 24px; }

.ag-grade {
  display: grid;
  grid-template-columns: 76px repeat(var(--ag-cols), minmax(190px, 1fr));
}

.ag-cel {
  border-right: 1px solid #e3eaf0;
  border-bottom: 1px solid #e3eaf0;
  background: var(--white);
}

.ag-prof-head,
.ag-canto {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 82px;
}

.ag-canto { left: 0; z-index: 3; }

.ag-prof-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}

.ag-prof-nome {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--petrol-900);
  text-transform: uppercase;
  line-height: 1.25;
}

.ag-avatar {
  position: relative;
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #dbe7ef, #b7cad8);
  color: var(--petrol-800);
  font-weight: 800;
  font-size: 0.95rem;
  border: 2px solid var(--white);
  box-shadow: 0 1px 4px rgba(6, 40, 61, 0.2);
}

.ag-online {
  position: absolute;
  right: -1px;
  bottom: 1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #2f9e7a;
  border: 2px solid var(--white);
}

.ag-hora {
  position: sticky;
  left: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--petrol-900);
  font-size: 0.95rem;
}

.ag-slot {
  position: relative;
  min-height: 78px;
  padding: 8px;
}

.ag-card {
  position: relative;
  height: 100%;
  min-height: 62px;
  background: var(--cor, #1f4e6b);
  color: var(--white);
  border-radius: 7px;
  padding: 11px 14px;
  box-shadow: 0 2px 6px rgba(6, 40, 61, 0.18);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  transition: transform 0.12s, box-shadow 0.12s;
}
.ag-card:hover { transform: translateY(-1px); box-shadow: 0 5px 12px rgba(6, 40, 61, 0.25); }
.ag-card:focus-visible { outline: 3px solid var(--cyan-400); outline-offset: 2px; }

.ag-card-linha { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 4px; font-size: 0.98rem; padding-right: 18px; }

.ag-card-nome {
  all: unset;
  cursor: pointer;
  font-weight: 600;
  color: var(--white);
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.35);
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}
.ag-card-nome:hover { text-decoration-color: var(--white); }
.ag-card-nome:focus-visible { outline: 2px solid var(--white); outline-offset: 2px; }

.ag-card-info { font-size: 0.74rem; opacity: 0.88; }

.ag-check {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #34b38a;
  color: var(--white);
  font-size: 0.72rem;
  font-weight: 800;
  border: 1.5px solid rgba(255, 255, 255, 0.8);
}

.ag-card.status-faltou { opacity: 0.6; }
.ag-card.status-faltou .ag-card-nome { text-decoration: line-through; }
.ag-card.status-atendido { filter: saturate(0.8); }

.ag-add {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 7px;
  border: none;
  background: #dceaf7;
  color: var(--petrol-800);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
  transition: 0.15s;
}
.ag-add:hover, .ag-add:focus-visible { opacity: 1; background: var(--turquoise-100); color: var(--turquoise-600); }

/* Mouse: o "+" aparece ao passar sobre o horário; telas de toque: sempre visível */
@media (hover: hover) {
  .ag-livre .ag-add { opacity: 0; }
  .ag-livre:hover .ag-add, .ag-add:focus-visible { opacity: 1; }
}

/* Modal da agenda (igual à imagem: branco, rótulos em maiúsculas, botão escuro) */
.modal-box.modal-agenda {
  max-width: 500px;
  border-top: none;
  padding: 26px 28px;
  border-radius: 14px;
}

.modal-agenda-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal-agenda-head h3 { font-size: 1.45rem; font-weight: 800; color: var(--petrol-900); }

.modal-fechar {
  border: none;
  background: none;
  font-size: 1.9rem;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
  padding: 0 4px;
}
.modal-fechar:hover { color: var(--petrol-900); }

.form-agenda { display: flex; flex-direction: column; gap: 14px; }
.form-agenda .form-group { display: flex; flex-direction: column; gap: 6px; }
.form-agenda label { font-weight: 700; font-size: 0.86rem; color: #1e293b; letter-spacing: 0.2px; }
.form-agenda input,
.form-agenda select,
.form-agenda textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 11px 13px;
  font-size: 0.95rem;
  background: var(--white);
}
.form-agenda textarea { resize: vertical; min-height: 96px; }
.form-agenda input:focus,
.form-agenda select:focus,
.form-agenda textarea:focus { outline: none; border-color: var(--turquoise-500); box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15); }

.ag-linha-dupla { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ag-acoes { align-items: center; }
.ag-acoes-espaco { flex: 1; }

/* Responsivo */
@media (max-width: 980px) {
  .agenda-layout { grid-template-columns: 1fr; }
  .agenda-lateral { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: start; }
  /* rolagem interna: o cabeçalho com os profissionais e a coluna de horários ficam fixos */
  .agenda-grade-wrap { max-height: 72vh; }
  /* filtro e legenda compactos, em linha */
  .ag-filtro-lista, .ag-legenda { flex-direction: row; flex-wrap: wrap; gap: 6px 14px; }
}

@media (max-width: 600px) {
  .agenda-titulo { font-size: 1.5rem; }
  .agenda-topo { gap: 10px; }
  .agenda-topo .btn-agenda { flex: 1; justify-content: center; }
  .agenda-dia-nav { margin-left: 0; width: 100%; justify-content: space-between; }
  .agenda-dia-nav strong { flex: 1; text-align: center; font-size: 0.85rem; }
  /* ordem no celular: calendário → profissionais → GRADE → legenda */
  .agenda-layout { display: flex; flex-direction: column; }
  .agenda-lateral { display: contents; }
  .agenda-lateral > .agenda-box { order: 1; }
  .agenda-principal { order: 2; }
  .agenda-lateral > .agenda-box-legenda { order: 3; }
  .ag-grade { grid-template-columns: 58px repeat(var(--ag-cols), minmax(165px, 1fr)); }
  .ag-prof-head { padding: 10px; gap: 8px; min-height: 70px; }
  .ag-avatar { width: 38px; height: 38px; font-size: 0.82rem; }
  .ag-prof-nome { font-size: 0.82rem; }
  .ag-hora { font-size: 0.85rem; }
  .modal-box.modal-agenda { padding: 20px 18px; }
  .ag-linha-dupla { grid-template-columns: 1fr; }
  .ag-acoes { flex-wrap: wrap; }
  .ag-acoes .btn { flex: 1; justify-content: center; }
}

/* =====================================================================
   FILTROS DA LISTA DE PACIENTES
   ===================================================================== */
.filtros-pacientes {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.filtro-linha {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.filtro-busca { flex: 1 1 240px; min-width: 0; }
.filtro-linha select { flex: 0 1 280px; min-width: 0; }
.filtro-rotulo { font-size: 0.85rem; font-weight: 600; color: var(--petrol-800); }

.filtro-chips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.filtro-chip {
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--petrol-800);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.filtro-chip:hover { border-color: var(--turquoise-500); }
.filtro-chip.ativo { background: var(--petrol-800); border-color: var(--petrol-800); color: var(--white); }

.filtro-meses-custom { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--text-muted); }
.filtro-meses-custom input { width: 74px; padding: 6px 8px; }

.filtro-check { display: inline-flex; align-items: center; gap: 7px; font-size: 0.86rem; color: var(--text-main); cursor: pointer; }
.filtro-check input { width: 16px; height: 16px; accent-color: var(--turquoise-600); }
.filtro-check.desativado { opacity: 0.5; cursor: not-allowed; }

.paciente-indicadores { color: var(--petrol-700); }

@media (max-width: 600px) {
  .filtros-pacientes { padding: 10px; }
  .filtro-linha select, .filtro-busca { flex-basis: 100%; }
  .filtro-check { width: 100%; }
}

/* WhatsApp no prontuário (Recepção e Administração) */
.btn-whatsapp { background: #25d366; color: #fff; border: 1px solid #1ebe5b; }
.btn-whatsapp:hover { background: #1ebe5b; }
.btn-whatsapp.sem-telefone { background: #e2e8f0; color: #64748b; border-color: #cbd5e1; }

/* =====================================================================
   LOGO DôPin Saúde — "dôpin" com o acento em turquesa e "saúde" abaixo
   ===================================================================== */
.dopin-logo {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  font-size: 30px;
  line-height: 1;
  color: var(--petrol-800);
  text-decoration: none;
}

.dopin-logo,
.dopin-logo * {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

.dopin-logo__nome {
  font-weight: 800;
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.dopin-logo__o {
  position: relative;
  display: inline-block;
}

/* Ajuste fino da altura do acento: mude 0.1em (menor = sobe, maior = desce) */
.dopin-logo__acento {
  position: absolute;
  top: var(--dopin-acento-topo, 0.1em);
  left: 50%;
  transform: translateX(-50%);
  width: 0.36em;
  height: 0.2em;
  max-width: none;
  stroke: var(--turquoise-500);
}

.dopin-logo__sub {
  font-size: max(0.21em, 10px);
  font-weight: 500;
  line-height: 1;
  color: #0f766e;
  letter-spacing: 0.32em;
  margin-right: -0.32em;
}

/* Fundo escuro (cabeçalho do sistema) */
.dopin-logo--escuro { color: var(--white); }
.dopin-logo--escuro .dopin-logo__acento { stroke: #5FD6C9; }
.dopin-logo--escuro .dopin-logo__sub { color: #5FD6C9; }

.dopin-logo--grande { font-size: 64px; }

/* Ícone do "ô" no quadradinho do cabeçalho */
#headerLogoBadge svg { max-width: none; }
#headerLogoBadge { background: #0F2747; border-color: rgba(95, 214, 201, 0.35); }

@media (max-width: 768px) {
  .dopin-logo--topo { font-size: 26px; }
}

@media (max-width: 400px) {
  .dopin-logo--topo { font-size: 24px; }
}


/* =====================================================================
   DIÁRIO DE CAIXA — MODO DIA | PERÍODO, GAVETA ACUMULADA E FECHAMENTO
   ===================================================================== */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.caixa-modo {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: #eef2f6;
  border-radius: 10px;
  margin-bottom: 16px;
}
.caixa-modo-btn {
  border: none;
  background: transparent;
  padding: 8px 16px;
  border-radius: 7px;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-muted);
  cursor: pointer;
}
.caixa-modo-btn:hover { color: var(--petrol-800); }
.caixa-modo-btn.active { background: var(--white); color: var(--petrol-800); box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1); }

.gaveta-resumo {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.gaveta-item {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.gaveta-item span { font-size: 0.76rem; color: var(--text-muted); font-weight: 600; }
.gaveta-item strong { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 1.05rem; color: var(--petrol-800); }
.gaveta-item.entrada strong { color: var(--turquoise-600); }
.gaveta-item.saida strong { color: var(--danger); }
.gaveta-item.total { background: var(--petrol-800); border-color: var(--petrol-800); }
.gaveta-item.total span { color: #cbd5e1; }
.gaveta-item.total strong { color: var(--white); }
.gaveta-item.total.negativo { background: var(--danger); border-color: var(--danger); }
.gaveta-desde { grid-column: 1 / -1; }
.gaveta-movimentos { margin-bottom: 12px; }
.gaveta-form { margin-bottom: 4px; }
.gaveta-form select { flex: 1 1 220px; }
.gaveta-tipo-hint { display: block; margin-top: 2px; }

.periodo-form {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px 16px;
}
.periodo-form .form-group { min-width: 160px; }
.periodo-atalhos { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.periodo-acoes { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }

.fechamento-cabecalho { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin: 4px 0 14px; }
.fechamento-cabecalho h3 { font-family: 'Plus Jakarta Sans', sans-serif; color: var(--petrol-800); font-size: 1.15rem; }
.fech-saidas-detalhe { margin-top: 14px; }

/* Impressão do fechamento: só o relatório, com as saídas detalhadas */
@media print {
  body.imprimindo-fechamento .tab-content:not(#tab-caixa),
  body.imprimindo-fechamento #caixaVisaoDia,
  body.imprimindo-fechamento .alerta-salarios { display: none !important; }
  body.imprimindo-fechamento #tab-caixa,
  body.imprimindo-fechamento #caixaVisaoPeriodo { display: block !important; }
  body.imprimindo-fechamento .card { box-shadow: none; break-inside: avoid; }
  body.imprimindo-fechamento .kpi-card { box-shadow: none; }
  body.imprimindo-fechamento .fech-saidas-detalhe[hidden] { display: block !important; }
}

/* =====================================================================
   PAGAMENTO DENTISTA — CARDS POR PROFISSIONAL
   ===================================================================== */
.dentista-cards { display: flex; flex-direction: column; gap: 10px; }

.dent-card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--petrol-800);
  border-radius: var(--radius);
  background: var(--white);
  overflow: hidden;
}
.dent-card.aberto { border-left-color: var(--turquoise-500); box-shadow: var(--shadow); }

.dent-card-head {
  all: unset;
  box-sizing: border-box;
  width: 100%;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto auto 18px;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
}
.dent-card-head:hover { background: var(--turquoise-50); }
.dent-card-head:focus-visible { outline: 3px solid var(--turquoise-500); outline-offset: -3px; }
.dent-card-head:disabled { cursor: default; grid-template-columns: 42px minmax(0, 1fr) auto auto; }
.dent-card-head:disabled:hover { background: transparent; }

.dent-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--petrol-800);
  color: var(--white);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
}
.dent-ident { display: flex; flex-direction: column; min-width: 0; }
.dent-ident strong { color: var(--petrol-800); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dent-resumo { display: flex; flex-direction: column; align-items: flex-end; }
.dent-resumo small { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; }
.dent-resumo strong { font-family: 'Plus Jakarta Sans', sans-serif; color: var(--petrol-800); font-size: 1.05rem; }

.dent-status { padding: 4px 10px; border-radius: 999px; font-size: 0.74rem; font-weight: 700; white-space: nowrap; }
.dent-status.pendente { background: var(--warning-bg); color: var(--warning); }
.dent-status.quitado { background: var(--success-bg); color: var(--success); }
.dent-status.neutro { background: #f1f5f9; color: var(--text-muted); }
.dent-seta { color: var(--text-muted); transition: transform 0.2s; }
.dent-card.aberto .dent-seta { transform: rotate(180deg); }

.dent-card-corpo { padding: 4px 16px 16px; border-top: 1px solid var(--border); }
.dent-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr));
  gap: 8px;
  margin: 12px 0;
}
.dent-info {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dent-info span { font-size: 0.74rem; color: var(--text-muted); font-weight: 600; }
.dent-info strong { color: var(--petrol-800); font-size: 0.98rem; }

.dent-pagar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: 10px 14px;
  align-items: end;
  background: var(--turquoise-50);
  border: 1px solid #99f6e4;
  border-radius: 9px;
  padding: 12px 14px;
}
.dent-pagar-acoes { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.dent-pagar > small { grid-column: 1 / -1; }

/* =====================================================================
   FUNCIONÁRIOS CLT + ALERTA DE SALÁRIOS
   ===================================================================== */
.alerta-salarios {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--warning-bg);
  border: 1px solid #fcd34d;
  border-left: 5px solid var(--warning);
  color: #78350f;
  border-radius: 9px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 0.88rem;
  line-height: 1.45;
}
.alerta-salarios.grave { background: var(--danger-bg); border-color: #fca5a5; border-left-color: var(--danger); color: #7f1d1d; }
.alerta-salarios-texto { flex: 1; min-width: 220px; }

.func-pagar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 4px; }
.func-pagar input[type='month'] { padding: 5px 8px; max-width: 150px; }
.func-pagar select { padding: 5px 8px; }

@media (max-width: 768px) {
  .caixa-modo { display: flex; width: 100%; }
  .caixa-modo-btn { flex: 1; min-height: 40px; }
  .periodo-form .form-group { flex: 1 1 140px; min-width: 0; }
  .periodo-acoes { margin-left: 0; width: 100%; }
  .periodo-acoes .btn { flex: 1; justify-content: center; }

  .dent-card-head { grid-template-columns: 38px minmax(0, 1fr) 18px; grid-template-areas: 'av id seta' 'av res status'; row-gap: 6px; padding: 12px; }
  .dent-card-head:disabled { grid-template-columns: 38px minmax(0, 1fr); grid-template-areas: 'av id' 'av res'; }
  .dent-avatar { grid-area: av; width: 38px; height: 38px; }
  .dent-ident { grid-area: id; }
  .dent-resumo { grid-area: res; align-items: flex-start; }
  .dent-status { grid-area: status; justify-self: end; }
  .dent-seta { grid-area: seta; }
  .dent-card-head:disabled .dent-status { display: none; }
  .dent-card-corpo { padding: 4px 12px 12px; }
  .dent-info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dent-pagar-acoes .btn, .dent-pagar-acoes .btn-danger-sm { flex: 1; justify-content: center; min-height: 40px; }

  table.tabela-cards td .func-pagar { justify-content: flex-end; }
}

/* Logo da clínica no cabeçalho: aparece inteira (sem corte), no formato original */
#headerLogoBadge.com-logo-clinica {
  width: auto;
  min-width: 44px;
  max-width: 180px;
  height: 48px;
  padding: 4px 8px;
  background: var(--white);
  border-color: transparent;
}
#headerLogoBadge.com-logo-clinica img {
  display: block;
  width: auto;
  height: 40px;
  max-width: 164px;
  object-fit: contain;
}
@media (max-width: 768px) {
  #headerLogoBadge.com-logo-clinica { height: 42px; max-width: 140px; padding: 3px 6px; }
  #headerLogoBadge.com-logo-clinica img { height: 36px; max-width: 128px; }
}

/* Login: link "Esqueci minha senha" */
.link-esqueci {
  display: block;
  margin: 12px auto 0;
  background: none;
  border: none;
  color: var(--turquoise-600);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 6px;
}
.link-esqueci:hover { color: var(--petrol-800); }

/* =====================================================================
   ASSINATURA (ASAAS): BANNER, TELA DE BLOQUEIO, CHECKOUT E CARD
   ===================================================================== */
.banner-assinatura {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: #eef6ff;
  border: 1px solid #bfdbfe;
  border-left: 5px solid var(--info);
  color: #0c3a5e;
  border-radius: 9px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 0.88rem;
  line-height: 1.45;
}
.banner-assinatura.grave { background: var(--warning-bg); border-color: #fcd34d; border-left-color: var(--warning); color: #78350f; }
.banner-assinatura-texto { flex: 1; min-width: 220px; }
.banner-fechar { border: none; background: none; font-size: 1.4rem; line-height: 1; color: inherit; opacity: 0.6; cursor: pointer; padding: 0 4px; }
.banner-fechar:hover { opacity: 1; }

.bloqueio-assinatura {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: #0F2747;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
}
body.assinatura-bloqueada { overflow: hidden; }
.bloqueio-caixa {
  background: var(--white);
  border-radius: 16px;
  max-width: 460px;
  width: 100%;
  padding: 32px 28px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}
.bloqueio-caixa .dopin-logo { font-size: 44px; margin-bottom: 6px; }
.bloqueio-caixa h2 { font-family: 'Plus Jakarta Sans', sans-serif; color: var(--petrol-800); font-size: 1.35rem; }
.bloqueio-caixa p { color: var(--text-muted); line-height: 1.55; font-size: 0.95rem; }
.bloqueio-acoes { display: flex; flex-direction: column; gap: 8px; width: 100%; margin-top: 6px; }
.bloqueio-acoes .btn { justify-content: center; min-height: 44px; }

.modal-box.modal-checkout { max-width: 520px; border-top: none; padding: 24px 26px; border-radius: 14px; }
.ck-plano { display: flex; flex-direction: column; gap: 2px; background: var(--turquoise-50); border: 1px solid #99f6e4; border-radius: 10px; padding: 10px 14px; }
.ck-plano strong { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 1.3rem; color: var(--petrol-800); }
#formCheckout { display: flex; flex-direction: column; gap: 14px; }
.ck-fieldset { border: none; display: flex; flex-direction: column; gap: 10px; }
.ck-fieldset legend { font-weight: 700; font-size: 0.86rem; color: var(--petrol-800); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.3px; }
.ck-fieldset input { width: 100%; }
.ck-linha { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ck-dias { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.ck-dias label { position: relative; cursor: pointer; }
.ck-dias input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ck-dias span {
  display: block;
  text-align: center;
  padding: 10px 4px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-weight: 700;
  color: var(--petrol-800);
  background: var(--white);
}
.ck-dias input:checked + span { background: var(--petrol-800); border-color: var(--petrol-800); color: var(--white); }
.ck-dias input:focus-visible + span { outline: 3px solid var(--turquoise-500); outline-offset: 2px; }
.ck-seguranca { display: flex; gap: 8px; align-items: flex-start; font-size: 0.8rem; color: var(--text-muted); line-height: 1.45; }
.ck-seguranca svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--turquoise-600); margin-top: 1px; }

.assinatura-resumo { display: flex; flex-direction: column; gap: 12px; }
.assin-topo { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.assin-preco { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; color: var(--petrol-800); font-size: 1.15rem; }
.assin-grade { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 8px; }
.assin-item { background: var(--bg-page); border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; display: flex; flex-direction: column; gap: 2px; }
.assin-item span { font-size: 0.74rem; color: var(--text-muted); font-weight: 600; }
.assin-item strong { color: var(--petrol-800); font-size: 0.95rem; }
.assin-acoes { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 600px) {
  .ck-linha { grid-template-columns: 1fr; }
  .modal-box.modal-checkout { padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
  .bloqueio-caixa { padding: 26px 18px; }
}
