:root {
  /* Identidade AtlasMed preservada:
     "Atlas" = azul-petróleo #0e5f82 | "Med" = ciano #00c8e0.
     Neutros, sombras e espaçamentos modernizados (tom slate, mais respiro). */
  --color-primary: #0e5f82;
  --color-primary-dark: #08324a;
  --color-primary-light: #e2f4fb;
  --color-accent: #00c8e0;
  --color-background: #f6f8fb;
  --color-surface: #ffffff;
  --color-text: #1f2a37;
  --color-muted: #64748b;
  --color-danger: #c0392b;
  --color-success: #0a7c55;
  --color-border: #e7ecf2;

  --bg: var(--color-background);
  --surface: var(--color-surface);
  --surface-soft: #f8fafc;
  --surface-muted: #eaf4f9;
  --text: var(--color-text);
  --heading: #14233a;
  --muted: var(--color-muted);
  --muted-soft: #94a3b8;
  --border: var(--color-border);
  --border-strong: #cbd5e1;
  --primary: var(--color-primary);
  --primary-hover: #0a4d6b;
  --primary-soft: var(--color-primary-light);
  --danger: var(--color-danger);
  --danger-hover: #922b21;
  --danger-bg: #fdf2f0;
  --danger-text: #a93226;
  --success-bg: #eafaf3;
  --success-text: var(--color-success);
  --warning-bg: #fef9ec;
  --warning-text: #7d5a00;
  --info-bg: #e0f6fb;
  --info-text: #0a6d8a;

  /* Escala de espaçamento (base 4px) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;

  --radius-sm: 8px;
  --radius: 10px;
  --radius-lg: 16px;
  /* Sombras neutras (slate) — profundidade discreta e profissional */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.05), 0 10px 24px rgba(15, 23, 42, 0.07);
  --shadow-md: 0 6px 12px rgba(15, 23, 42, 0.06), 0 18px 44px rgba(15, 23, 42, 0.10);
  --nav-bg: var(--color-primary-dark);
  --nav-bg-soft: #0c4262;
  --nav-text: #f0f8fc;
  --nav-muted: #9cc8da;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 4% 0, rgba(14, 95, 130, 0.07), transparent 32rem),
    linear-gradient(180deg, #ffffff 0, var(--bg) 240px);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--primary);
}

small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

/* Navbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 68px;
  background: linear-gradient(135deg, var(--nav-bg) 0%, #0c4262 60%, #0a3550 100%);
  border-bottom: 1px solid rgba(0, 200, 224, 0.15);
  box-shadow: 0 8px 32px rgba(8, 50, 74, 0.22);
  backdrop-filter: blur(18px);
}

.topbar-inner {
  display: grid;
  grid-template-columns: minmax(220px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  width: min(1220px, 100%);
  min-height: 68px;
  margin: 0 auto;
  padding: 0 28px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  min-width: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  max-width: 250px;
  color: var(--nav-text);
  font-size: 17px;
  font-weight: 850;
  line-height: 1;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

.brand:hover {
  opacity: 0.9;
}

.brand-logo {
  display: block;
  flex: 0 0 auto;
  width: auto;
  max-width: 240px;
  height: 54px;
  object-fit: contain;
}

.logo-fallback {
  color: var(--nav-text);
  font-size: 17px;
  font-weight: 850;
  line-height: 1;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--nav-text);
  cursor: pointer;
  transition: background 0.2s ease;
}

.nav-toggle:hover {
  background: rgba(255, 255, 255, 0.16);
}

.nav-toggle-icon {
  width: 24px;
  height: 24px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--nav-muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--nav-text);
}

.nav-link-active {
  background: rgba(0, 200, 224, 0.22);
  color: #ffffff;
}

.nav-link-primary {
  padding: 8px 16px;
  background: var(--color-accent);
  color: var(--color-primary-dark);
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(0, 200, 224, 0.28);
}

.nav-link-primary:hover,
.nav-link-primary.nav-link-active {
  background: #00b3cc;
  color: var(--color-primary-dark);
  box-shadow: 0 8px 24px rgba(0, 200, 224, 0.35);
}

.topbar-user {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  min-width: 0;
}

.user-summary {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--nav-text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.15;
  text-align: right;
  white-space: nowrap;
}

.user-summary small {
  color: var(--nav-muted);
  font-size: 11px;
  font-weight: 600;
}

.logout-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--nav-text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.18s ease;
}

.logout-icon {
  width: 16px;
  height: 16px;
}

.logout-button:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Layout */
.page {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: var(--space-7) var(--space-6) 56px;
}

/* ════════════════════════════════════════════════════════════════════════
   SIDEBAR LATERAL (desktop) — substitui a barra de topo quando logado
   ════════════════════════════════════════════════════════════════════════ */
:root {
  --sidebar-w: 250px;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--nav-bg) 0%, #0c4262 55%, #0a3550 100%);
  border-right: 1px solid rgba(0, 200, 224, 0.15);
  box-shadow: 4px 0 24px rgba(8, 50, 74, 0.16);
  z-index: 30;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  padding: 16px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand .brand {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.sidebar-brand .brand-logo {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  padding: 16px 12px;
  overflow-y: auto;
}

.sidebar-nav .nav-link {
  justify-content: flex-start;
  width: 100%;
  min-height: 42px;
  padding: 10px 14px;
  gap: 11px;
  font-size: 13.5px;
}

.sidebar-nav .nav-icon {
  width: 18px;
  height: 18px;
}

.sidebar-nav .nav-link-primary {
  margin: 6px 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user .user-summary {
  text-align: left;
}

/* Conteúdo deslocado para a direita da sidebar */
.app-has-sidebar .page {
  width: auto;
  max-width: 1180px;
  margin-left: var(--sidebar-w);
  margin-right: auto;
}

/* Barra superior aparece só no mobile; fundo escuro idem */
.mobile-topbar {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

/* Tela de login (sem sidebar) mantém topbar centralizada */
.topbar-auth .topbar-inner {
  justify-content: center;
}

/* ── Mobile: sidebar vira gaveta deslizante ── */
@media (max-width: 900px) {
  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 25;
    min-height: 56px;
    padding: 9px 16px;
    background: linear-gradient(135deg, var(--nav-bg) 0%, #0a3550 100%);
    border-bottom: 1px solid rgba(0, 200, 224, 0.15);
    box-shadow: 0 6px 20px rgba(8, 50, 74, 0.18);
  }

  .mobile-topbar .brand-logo {
    height: 34px;
    max-width: 150px;
  }

  .sidebar {
    width: 270px;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 29;
    background: rgba(8, 24, 40, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
  }

  .sidebar-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .app-has-sidebar .page {
    margin-left: 0;
    margin-right: auto;
    max-width: none;
  }
}

/* Foco visível e acessível (teclado) em elementos interativos */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
.btn:focus-visible,
.button:focus-visible,
.nav-link:focus-visible,
.operation-card:focus-visible,
.admin-link-card:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.page-header,
.content-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.page-header > div,
.content-header > div {
  min-width: 0;
}

.page-header h1,
.content-header h1,
h1 {
  margin: 0 0 6px;
  color: var(--heading);
  font-size: 25px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.018em;
}

h2 {
  margin: 0 0 10px;
  color: var(--heading);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.muted,
.page-header .muted,
.content-header .muted {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.page-actions,
.header-actions,
.form-actions,
.action-panel {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.section-spaced,
.table-section {
  margin-top: 22px;
}

/* ── Painel de ajuste de pagamento ───────────────────── */
.adjust-payment-panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px 24px;
  margin-top: 16px;
}

.adjust-panel-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
  color: #111827;
}

.adjust-panel-desc {
  margin: 0 0 16px;
  font-size: 13px;
}

/* <details> variant (usado na fila) */
.adjust-panel-details {
  list-style: none;
}
.adjust-panel-details[open] > .adjust-panel-summary {
  margin-bottom: 14px;
}
.adjust-panel-summary {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  user-select: none;
  list-style: none;
}
.adjust-panel-summary::marker,
.adjust-panel-summary::-webkit-details-marker { display: none; }
.adjust-panel-summary::before {
  content: '▶ ';
  font-size: 10px;
}
.adjust-panel-details[open] .adjust-panel-summary::before {
  content: '▼ ';
}
.adjust-panel-inner {
  padding-top: 8px;
}

.adjust-panel-amounts {
  display: flex;
  gap: 24px;
  margin-bottom: 14px;
}
.adjust-amount-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.adjust-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #6b7280;
}
.adjust-amount-info strong {
  font-size: 16px;
  font-weight: 800;
  color: #111827;
}

.adjust-panel-fields {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.adjust-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 180px;
}
.adjust-field label {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
}
.adjust-field input {
  height: 38px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 14px;
}
.adjust-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* Preview dinâmico */
.adjust-preview {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  margin-bottom: 4px;
}
.adjust-preview--refund {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #92400e;
}
.adjust-preview--pending {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #78350f;
}
.adjust-preview--ok {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.dashboard-title {
  text-align: left;
}

.hero-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 22px;
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background:
    radial-gradient(circle at 92% 20%, rgba(25, 184, 198, 0.14), transparent 18rem),
    var(--surface);
  box-shadow: var(--shadow-sm);
}

.hero-panel-compact {
  padding: 22px 24px;
}

.hero-panel h1 {
  margin: 4px 0 6px;
  font-size: 28px;
  line-height: 1.12;
}

.hero-panel p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 820;
}

/* ── Dashboard — KPIs e seções ────────────────────────────── */
.dashboard-section-title {
  margin: 28px 0 14px;
  color: var(--heading);
  font-size: 14px;
  font-weight: 750;
  letter-spacing: 0.01em;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 8px;
}

.kpi-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: border-color 0.18s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.18s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.kpi-card:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.kpi-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
}

.kpi-icon svg {
  width: 26px;
  height: 26px;
}

.kpi-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.kpi-label {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.2;
}

.kpi-value {
  color: var(--heading);
  font-size: 34px;
  font-weight: 820;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.kpi-trend {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

/* Variações de cor por tipo de KPI */
.kpi-card-primary .kpi-icon {
  background: linear-gradient(135deg, var(--primary), var(--color-primary-dark));
  color: #ffffff;
}

.kpi-card-success .kpi-icon {
  background: var(--success-bg);
  color: var(--success-text);
}

.kpi-card-success .kpi-value {
  color: var(--success-text);
}

.kpi-card-alert {
  border-color: rgba(180, 35, 24, 0.28);
}

.kpi-card-alert .kpi-icon {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.kpi-card-alert .kpi-trend {
  color: var(--danger-text);
  font-weight: 700;
}

/* Breakdown de receita */
.revenue-breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}

.revenue-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.revenue-method {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.revenue-amount {
  color: var(--heading);
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.quick-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.admin-hub-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.grid,
.dashboard-grid,
.detail-grid,
.status-strip,
.queue-summary,
.report-summary,
.operation-grid,
.admin-link-grid {
  display: grid;
  gap: 16px;
}

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

.dashboard-grid,
.operation-grid,
.admin-link-grid,
.status-strip,
.queue-summary {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.reception-actions {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.dashboard-panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

/* Cards */
.card,
.admin-card,
.panel-form,
.table-wrap,
.detail-item,
.dashboard-panel,
.reception-search,
.status-strip article,
.queue-summary article,
.operation-card,
.admin-link-card,
.operational-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.admin-card,
.panel-form,
.dashboard-panel {
  box-shadow: var(--shadow-sm);
}

.card,
.status-strip article,
.queue-summary article {
  min-height: 88px;
  padding: 18px;
}

.card-label,
.status-strip span,
.queue-summary span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  letter-spacing: 0;
  text-transform: none;
}

.card strong,
.status-strip strong,
.queue-summary strong {
  color: var(--heading);
  font-size: 22px;
  font-weight: 820;
}

.operation-card,
.admin-link-card,
.operational-card {
  display: grid;
  gap: 10px;
  min-height: 126px;
  padding: 20px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.operation-card:hover,
.admin-link-card:hover,
.operational-card:hover {
  border-color: rgba(14, 95, 130, 0.32);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.operation-card span,
.admin-link-card strong {
  color: var(--primary);
  font-size: 17px;
  font-weight: 820;
}

.operation-card strong,
.admin-link-card span {
  align-self: end;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.operation-primary {
  border-color: rgba(25, 184, 198, 0.32);
  background: linear-gradient(135deg, var(--primary), var(--color-primary-dark));
  box-shadow: 0 14px 34px rgba(14, 95, 130, 0.18);
}

.operation-primary span,
.operation-primary strong {
  color: #ffffff;
}

.primary-action-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
  padding: 20px;
  border: 1px solid rgba(14, 95, 130, 0.22);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.dashboard-panel {
  padding: 18px;
}

/* Buttons */
.btn,
.button,
.queue-filter-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  margin-top: 0;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 13.5px;
  font-weight: 750;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-primary,
.button,
.queue-filter-button-primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover,
.button:hover,
.queue-filter-button-primary:hover {
  border-color: var(--primary-hover);
  background: var(--primary-hover);
  color: #ffffff;
}

.btn-secondary,
.button-secondary,
.queue-filter-button-secondary {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--text);
}

.btn-secondary:hover,
.button-secondary:hover,
.queue-filter-button-secondary:hover {
  border-color: rgba(14, 95, 130, 0.32);
  background: var(--surface-muted);
  color: var(--color-primary-dark);
}

.btn-danger,
.button-danger {
  border-color: rgba(180, 35, 24, 0.24);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.btn-danger:hover,
.button-danger:hover {
  border-color: rgba(180, 35, 24, 0.34);
  background: #ffe4e1;
  color: var(--danger-hover);
}

.btn-print {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--text);
}

.btn-print:hover {
  background: var(--surface-muted);
}

.btn:disabled,
.btn[disabled],
.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button-link {
  text-decoration: none;
}

.primary-action-button {
  white-space: nowrap;
}

/* Forms */
.form {
  display: grid;
  gap: 16px;
}

.panel-form {
  padding: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field {
  display: grid;
  gap: 6px;
}

.field-wide {
  grid-column: 1 / -1;
}

label {
  color: var(--text);
  font-size: 13px;
  font-weight: 720;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
  min-height: 104px;
  resize: vertical;
}

/* Document editor toolbar (laudo) */
.doc-editor-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.doc-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: var(--surface-soft);
  border: 1px solid var(--border-strong);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
}

.doc-editor-wrap textarea {
  border-radius: 0 0 10px 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
  line-height: 1.7;
}

.doc-tb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.doc-tb-btn:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.doc-tb-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

.doc-tb-hint {
  font-size: 11px;
  color: var(--muted);
  margin-left: 4px;
}

.doc-tb-hint code {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 4px;
  font-size: 10.5px;
}

.doc-tb-size-wrap {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.doc-tb-size-input {
  width: 54px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
  text-align: center;
  padding: 0 4px;
  /* hide native spin arrows */
  -moz-appearance: textfield;
}
.doc-tb-size-input::-webkit-outer-spin-button,
.doc-tb-size-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.doc-tb-size-input::placeholder {
  color: var(--muted);
  font-size: 11px;
}
.doc-tb-size-input:hover { border-color: var(--primary); }
.doc-tb-size-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.doc-tb-size-apply {
  font-size: 14px;
  width: 26px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(14, 95, 130, 0.72);
  outline: 0;
  box-shadow: 0 0 0 4px rgba(25, 184, 198, 0.14);
}

.checkbox-field label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
}

.checkbox-field input {
  width: auto;
  min-height: auto;
}

.form-section {
  display: grid;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.form-section:first-child {
  padding-top: 0;
}

.form-section:last-child {
  border-bottom: 0;
}

.form-section h2,
.field h2 {
  margin: 0 0 4px;
  font-size: 16px;
  color: var(--heading);
}

.form-inline-note,
.help-text {
  color: var(--muted);
  font-size: 12.5px;
}

.entry-section {
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-muted);
}

.entry-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.entry-section-header h2 {
  margin-bottom: 3px;
}

.entry-item-list {
  display: grid;
  gap: 10px;
}

.entry-item-row {
  display: grid;
  grid-template-columns: 34px minmax(260px, 1fr) minmax(128px, 160px) auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  transition: all 0.12s ease;
}

.entry-item-row:hover {
  background: var(--surface-muted);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

.payment-row {
  grid-template-columns: 34px minmax(128px, 180px) minmax(240px, 1fr) auto;
}

.entry-item-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  align-self: center;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--color-primary-dark);
  font-size: 12px;
  font-weight: 820;
}

.entry-item-main,
.entry-item-price {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.entry-item-price input {
  font-weight: 750;
  text-align: right;
}

.entry-remove-button {
  min-height: 42px;
  border-color: rgba(100, 116, 139, 0.28);
  color: var(--muted);
}

.checkbox-line {
  align-items: center;
  display: flex;
  gap: 8px;
}

.patient-lookup-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(14, 95, 130, 0.22);
  border-radius: var(--radius-lg);
  background: var(--primary-soft);
}

.patient-lookup-card[hidden] {
  display: none;
}

.patient-lookup-card strong {
  color: var(--heading);
}

.patient-lookup-card p {
  margin: 4px 0 0;
}

.input-muted {
  color: var(--muted);
  background: var(--surface-soft);
}

.highlighted-field {
  padding: 12px;
  border: 1px solid rgba(14, 95, 130, 0.2);
  border-radius: var(--radius);
  background: var(--primary-soft);
}

.age-box {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--muted);
}

.field-error,
.cpf-error-message,
.cep-message {
  color: var(--danger);
  font-size: 12.5px;
  font-weight: 750;
}

input.input-error {
  border-color: rgba(180, 35, 24, 0.7);
  background: #fffafa;
  box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.09);
}

input.input-valid {
  border-color: rgba(4, 120, 87, 0.45);
}

/* ── Novo Atendimento — cartões de seção ───────────────── */
.entry-form {
  display: grid;
  gap: 20px;
  max-width: 1000px;
}

/* Accordeon-style cards */
.entry-card-details {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.entry-card-details:hover {
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.entry-card-details[open] {
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.10);
}

/* Fallback para .entry-card (se não for convertido para details) */
.entry-card {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  transition: box-shadow 0.2s ease;
}

.entry-card:hover {
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

/* Summary (heading do accordeon) */
.entry-card-details > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  padding: 20px 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
}

.entry-card-details > summary:hover {
  background: rgba(0, 0, 0, 0.02);
}

.entry-card-details > summary::-webkit-details-marker {
  display: none;
}

.entry-card-details > summary::before {
  content: '▶';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  min-width: 20px;
  font-size: 12px;
  color: var(--muted);
  transition: transform 0.2s ease;
  order: 10;
}

.entry-card-details[open] > summary::before {
  transform: rotate(90deg);
}

.entry-card-details > summary > div {
  flex: 1;
  min-width: 0;
}

/* Content area */
.entry-card-content {
  padding: 24px;
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 100%;
  }
}

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

.entry-card-header h2 {
  margin: 0 0 4px;
  color: var(--heading);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
}

.entry-card-header .muted {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.entry-card-subhead {
  margin: 22px 0 14px;
  padding-top: 18px;
  padding-bottom: 8px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.4;
}

.entry-card-subhead:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

/* Banner de retorno gratuito */
.return-banner,
.return-notice {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border: 1px solid #86efac;
  border-radius: var(--radius);
  background: #dcfce7;
  color: #166534;
  font-size: 13px;
}

.return-banner strong,
.return-notice strong {
  color: #14532d;
}

.return-banner p {
  margin: 4px 0 0;
}

.return-banner-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Combobox de procedimento (digitar e buscar) ───────── */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.proc-combo {
  position: relative;
}

.proc-combo-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 264px;
  margin: 0;
  padding: 4px;
  list-style: none;
  overflow-y: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.proc-combo-list[hidden] {
  display: none;
}

.proc-combo-option {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
}

.proc-combo-option:hover,
.proc-combo-option.is-active {
  background: var(--primary-soft);
  color: var(--color-primary-dark);
}

.proc-combo-price {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.proc-combo-option.is-active .proc-combo-price,
.proc-combo-option:hover .proc-combo-price {
  color: var(--color-primary-dark);
}

.proc-combo-empty {
  padding: 10px 11px;
  color: var(--muted);
  font-size: 13px;
}

/* ── Densidade e alinhamento da aba Novo Atendimento ───── */
.entry-card .form-grid,
.entry-card-content .form-grid {
  gap: 16px 20px;
}

.entry-form .field {
  gap: 6px;
  display: grid;
}

.entry-form label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.entry-form input,
.entry-form select,
.entry-form textarea {
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.entry-form input:focus,
.entry-form select:focus,
.entry-form textarea:focus {
  border-color: var(--primary);
  outline: 0;
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.entry-form input[readonly],
.entry-form input[disabled] {
  background: var(--surface-soft);
  color: var(--muted);
  cursor: not-allowed;
}

.entry-form textarea {
  min-height: 88px;
  resize: vertical;
}

/* Neutraliza o destaque azul do campo de nascimento */
.entry-form .highlighted-field {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

/* Subseções com divisória clara */
.entry-card-subhead {
  margin: 22px 0 14px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.entry-card > .entry-card-subhead:first-child,
.entry-card .form-grid > .entry-card-subhead:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

/* Grade densa para campos curtos (endereço) */
.entry-grid-dense {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

/* Resumo financeiro e valores: números alinhados à direita */
.entry-form #subtotal_preview,
.entry-form #discount,
.entry-form #amount,
.entry-form #pending_preview,
.entry-item-price input {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Valor total = destaque sutil (campo-chave) */
.entry-form #amount {
  font-weight: 700;
  color: var(--heading);
}

.age-box {
  min-height: 40px;
}

/* Filters */
.filter-bar,
.search-bar,
.queue-filter {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-xs);
}

.filter-bar.search-bar-wide,
.search-bar-wide {
  grid-template-columns: minmax(220px, 1fr) repeat(auto-fit, minmax(145px, auto));
}

.queue-filter {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
}

.queue-filter-field {
  display: grid;
  gap: 6px;
}

.queue-filter-field label {
  color: var(--muted);
  font-size: 12px;
}

.queue-filter-field input,
.queue-filter-field select {
  width: 240px;
}

.queue-filter-doctor select {
  width: 280px;
}

.queue-filter-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.reception-search {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(280px, 1.2fr);
  align-items: end;
  gap: 18px;
  margin: 22px 0;
  padding: 18px;
}

.reception-search .filter-bar {
  margin-bottom: 0;
}

/* ── Fila de Espera — Cards Grid ──────────────────────────── */
/* ═══ Fila — barra de estatísticas compacta ═══════════════════════════ */
.queue-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-top: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.queue-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 0;
  min-width: 120px;
  padding: 12px 16px;
  border-left: 1px solid var(--border);
}

.queue-stat:first-child {
  border-left: none;
}

.queue-stat-value {
  color: var(--heading);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.queue-stat-label {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
}

.queue-stat-accent {
  background: var(--primary-soft);
}

.queue-stat-accent .queue-stat-value {
  color: var(--primary);
}

/* ═══ Fila — tabela densa profissional ════════════════════════════════ */
.queue-table-wrap {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  overflow: visible;
}

.queue-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  font-size: 13px;
}

.queue-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-strong);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}

.queue-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.queue-row:last-child td {
  border-bottom: none;
}

.queue-row {
  transition: background 0.12s ease;
}

.queue-row:hover {
  background: var(--surface-soft);
}

.queue-row-finished,
.queue-row-cancelled {
  color: var(--muted);
}

.queue-row-finished .qt-name,
.queue-row-cancelled .qt-name {
  font-weight: 650;
  color: var(--muted);
}

/* Linha do PRÓXIMO — destaque sóbrio */
.queue-row-next {
  background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--primary);
}

.queue-row-next:hover {
  background: var(--primary-soft);
}

/* Coluna posição */
.qt-col-pos { width: 44px; }
.qt-pos { text-align: center; }

.qt-pos-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.queue-row-next .qt-pos-num {
  background: var(--primary);
  color: #ffffff;
}

.qt-pos-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted-soft);
}

.status-dot-called { background: var(--color-accent); }
.status-dot-in_progress { background: var(--info-text); }
.status-dot-waiting_result { background: var(--warning-text); }
.status-dot-result_ready { background: var(--success-text); }
.status-dot-finished { background: var(--success-text); }
.status-dot-cancelled { background: var(--danger); }

/* Coluna paciente */
.qt-patient { min-width: 180px; }

.qt-name {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--heading);
  font-size: 13.5px;
  font-weight: 750;
  line-height: 1.25;
}

.qt-next-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 4px;
  background: var(--primary);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.qt-sub {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Coluna procedimento */
.qt-proc { min-width: 180px; }

.qt-proc-name {
  display: block;
  color: var(--text);
  font-weight: 650;
  line-height: 1.3;
}

.qt-proc-value {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Coluna médico */
.qt-doctor-name {
  display: block;
  color: var(--text);
  font-weight: 650;
}

.qt-muted {
  color: var(--muted-soft);
  font-weight: 600;
}

/* Coluna entrada */
.qt-entry {
  color: var(--text);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Coluna prioridade */
.qt-priority-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
}

.qt-priority-priority,
.qt-priority-urgent,
.qt-priority-high {
  background: var(--warning-bg);
  color: var(--warning-text);
}

/* Coluna ações */
.qt-col-actions { width: 1%; }

.qt-actions-inner {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.qt-actions-inner form {
  margin: 0;
}

.qt-actions-inner .btn-sm {
  min-height: 30px;
  padding: 5px 11px;
  font-size: 12.5px;
}

.qt-actions-inner .row-actions-menu summary {
  width: auto;
  min-height: 30px;
  height: auto;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 16px;
}

.queue-empty {
  margin-top: 16px;
  padding: 48px 24px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
  color: var(--muted);
  text-align: center;
}

.queue-empty p {
  margin: 0;
  font-size: 14px;
}

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

.table-wrap-actions-menu {
  overflow: visible;
}

.table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
}

.table th {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 820;
  letter-spacing: 0.02em;
  text-align: left;
  text-transform: uppercase;
}

.table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: top;
}

.table tbody tr:hover {
  background: #f6fbfb;
}

/* Linha de atendimento finalizado — destaque premium e discreto */
.table tbody tr.row-finished td {
  background-color: #f0fdf8;
  color: #374151;
}
.table tbody tr.row-finished td:first-child {
  border-left: 3px solid #10b981;
  padding-left: 11px;
}
.table tbody tr.row-finished:hover td {
  background-color: #e2faf1;
}

.table tr:last-child td {
  border-bottom: 0;
}

.table-actions,
.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

.table-actions a,
.table-actions .text-button,
.actions a,
.text-button {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.table-actions a:hover,
.table-actions .text-button:hover,
.actions a:hover,
.text-button:hover {
  color: var(--primary-hover);
}

.btn-link,
.table-actions button.btn-link {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}
.btn-link-danger,
.table-actions button.btn-link-danger {
  color: var(--danger, #dc2626);
}
.btn-link-danger:hover,
.table-actions button.btn-link-danger:hover {
  color: #b91c1c;
}

.table-actions-menu-cell {
  position: relative;
  justify-content: center;
  min-width: 54px;
}

.queue-row-actions {
  flex-wrap: nowrap;
  min-width: 138px;
}

.row-actions-menu {
  position: relative;
  display: inline-flex;
}

.row-actions-menu summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #4b5563;
  cursor: pointer;
  font-size: 25px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  list-style: none;
}

.row-actions-menu summary::-webkit-details-marker {
  display: none;
}

.row-actions-menu summary:hover,
.row-actions-menu[open] summary {
  background: #e5e7eb;
  color: #374151;
}

.row-actions-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 10;
  display: grid;
  min-width: 230px;
  padding: 0;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
  overflow: hidden;
}

.row-actions-dropdown a,
.row-actions-button {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 12px 18px;
  border-bottom: 1px solid #f1f5f9;
  border-radius: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 720;
  text-decoration: none;
}

.row-actions-dropdown form {
  margin: 0;
}

.row-actions-dropdown form:last-child .row-actions-button,
.row-actions-dropdown a:last-child {
  border-bottom: 0;
}

.row-actions-button {
  width: 100%;
  border-top: 0;
  border-right: 0;
  border-left: 0;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

.row-actions-button-success {
  color: var(--success-text);
}

.row-actions-dropdown a:hover,
.row-actions-button:hover {
  background: #f3f4f6;
  color: #111827;
}

.danger-link,
.text-button-danger {
  color: var(--danger-text) !important;
}

.danger-link:hover,
.text-button-danger:hover {
  color: var(--danger-hover) !important;
}

.empty {
  color: var(--muted);
  text-align: center;
}

/* Badges and statuses */
.status-badge,
.time-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 820;
  white-space: nowrap;
}

.status-muted,
.status-cancelled {
  background: #f1f5f9;
  color: var(--muted);
}

.status-waiting,
.status-called,
.status-waiting_result,
.status-pending,
.status-partial,
.time-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.status-in_progress {
  background: var(--info-bg);
  color: var(--info-text);
}

.status-result_ready,
.status-finished,
.status-finalized,
.status-paid,
.time-normal {
  background: var(--success-bg);
  color: var(--success-text);
}

.time-critical {
  background: var(--danger-bg);
  color: var(--danger-text);
}

/* Details and documents */
.detail-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.detail-item {
  padding: 16px;
}

.detail-wide {
  grid-column: 1 / -1;
}

.detail-item span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.detail-item strong,
.detail-item p {
  color: var(--text);
}

.document-content {
  white-space: pre-wrap;
  color: var(--text);
}

.receive-balance-form,
.finish-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  align-items: end;
  gap: 10px;
}

/* Alerts and utilities */
.alert {
  margin-bottom: 16px;
  padding: 11px 13px;
  border: 1px solid rgba(180, 35, 24, 0.16);
  border-radius: var(--radius);
  background: var(--danger-bg);
  color: var(--danger-text);
  font-size: 14px;
}

.alert-success {
  border-color: rgba(4, 120, 87, 0.16);
  background: var(--success-bg);
  color: var(--success-text);
}

.print-only {
  display: none;
}

/* Modal de confirmação (ações perigosas) */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
}

.modal-overlay.is-open {
  display: flex;
}

.modal-card {
  width: min(440px, 100%);
  padding: 26px 28px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.modal-card h3 {
  margin: 0 0 8px;
  color: var(--heading);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.modal-card p {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Modal com formulário (saída em espécie) */
.modal-card-form {
  width: min(620px, 100%);
  max-height: calc(100vh - 48px);
  padding: 22px 24px 20px;
  overflow-y: auto;
}

.modal-form-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-form-head h3 {
  margin: 0 0 4px;
  color: var(--heading);
  font-size: 17px;
  font-weight: 700;
}

.modal-form-sub {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.modal-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.modal-close:hover {
  border-color: var(--border-strong);
  background: var(--surface-soft);
  color: var(--text);
}

.modal-card-form .modal-actions {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Campo com prefixo (R$) */
.input-prefix {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-prefix:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 95, 130, 0.1);
}

.input-prefix-symbol {
  flex-shrink: 0;
  padding: 0 10px 0 12px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 650;
}

.input-prefix input {
  flex: 1;
  min-width: 0;
  border: none !important;
  background: transparent;
  box-shadow: none !important;
  padding-left: 0;
}

.input-prefix input:focus {
  outline: none;
  box-shadow: none !important;
}

/* Login */
.auth-layout {
  display: grid;
  min-height: calc(100vh - 96px);
  place-items: center;
  padding: 28px 0;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 430px);
  align-items: stretch;
  width: min(980px, 100%);
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.auth-hero {
  display: grid;
  align-items: end;
  min-height: 520px;
  padding: 36px;
  background:
    radial-gradient(circle at 18% 18%, rgba(25, 184, 198, 0.24), transparent 16rem),
    linear-gradient(135deg, var(--color-primary-dark), var(--primary));
  color: #ffffff;
}

.auth-hero h1 {
  max-width: 520px;
  margin: 16px 0 12px;
  color: #ffffff;
  font-size: 38px;
  line-height: 1.05;
}

.auth-hero p {
  max-width: 460px;
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
}

.auth-hero-brand {
  display: inline-flex;
  align-items: center;
}

.auth-hero-brand img {
  width: auto;
  max-width: 240px;
  max-height: 120px;
  object-fit: contain;
  filter: drop-shadow(0 18px 26px rgba(2, 6, 23, 0.24));
}

.auth-panel {
  width: min(430px, 100%);
  padding: 34px;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  box-shadow: none;
}

.auth-brand {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.auth-logo {
  display: block;
  width: auto;
  max-width: 240px;
  max-height: 110px;
  object-fit: contain;
}

.auth-logo-fallback {
  color: var(--primary);
  font-size: 32px;
  font-weight: 850;
  line-height: 1;
}

.auth-brand small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.auth-panel h1,
.auth-panel .muted {
  text-align: center;
}

/* Print */
.print-actions,
.print-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-xs);
}

.print-document,
.receipt-document {
  max-width: 840px;
  margin: 0 auto;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.print-report-header {
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid #111827;
  color: #111827;
}

.print-signatures,
.signature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 64px;
}

.print-signatures div,
.signature-grid div {
  padding-top: 8px;
  border-top: 1px solid #111827;
  text-align: center;
}

.print-signature {
  margin-top: 48px;
  padding-top: 0;
  line-height: 1.5;
}

.print-signature p {
  margin: 2px 0;
}

.print-signature-right {
  text-align: right;
}

.print-table {
  width: 100%;
  margin: 20px 0;
  border-collapse: collapse;
}

.print-table th,
.print-table td {
  padding: 9px 10px;
  border: 1px solid #d1d5db;
  text-align: left;
}

.clinical-print-document {
  padding-top: 18px;
}

.clinical-print-header {
  display: grid;
  gap: 0;
  margin-bottom: 18px;
  padding-bottom: 8px;
  border-bottom: 1px solid #111827;
  color: #111827;
  font-size: 12px;
}

.clinical-print-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 3px 0;
}

.clinical-print-row-main {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
}

.clinical-print-row p {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px;
  margin: 0;
  min-width: 0;
}

.clinical-print-row strong {
  white-space: nowrap;
}

.clinical-print-row strong::after {
  content: ":";
}

.clinical-print-row span {
  overflow-wrap: anywhere;
}

.clinical-print-procedure {
  margin: -4px 0 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.attendance-sheet {
  max-width: 900px;
  min-height: 1120px;
  padding: 26px 34px;
  color: #111827;
  font-family: "Courier New", Courier, monospace;
  font-size: 14px;
  line-height: 1.45;
}

.sheet-header {
  padding-bottom: 10px;
  border-bottom: 2px solid #111827;
  margin-bottom: 4px;
}

.sheet-header-inner {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sheet-logo {
  max-height: 64px;
  max-width: 140px;
  object-fit: contain;
  flex-shrink: 0;
}

.sheet-header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sheet-header h1 {
  margin: 0;
  color: #111827;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
}

.sheet-header p {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sheet-top {
  padding: 8px 0 0;
  border-bottom: 1px solid #111827;
}

.sheet-info-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.sheet-info-table th,
.sheet-info-table td {
  padding: 5px 6px;
  border-bottom: 1px solid #d1d5db;
  color: #111827;
  text-align: left;
  vertical-align: top;
}

.sheet-info-table th {
  width: 110px;
  font-weight: 700;
  white-space: nowrap;
}

.sheet-info-table td {
  overflow-wrap: anywhere;
}

.sheet-procedures-line,
.sheet-notes-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  padding: 6px 6px;
  border-bottom: 1px solid #d1d5db;
}

.sheet-procedures-line strong,
.sheet-notes-line strong {
  white-space: nowrap;
}

.sheet-procedures-line span,
.sheet-notes-line span {
  overflow-wrap: anywhere;
}

.sheet-report-space h2 {
  margin: 0 0 8px;
  color: #111827;
  font-family: "Courier New", Courier, monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sheet-report-space {
  min-height: 760px;
  padding-top: 10px;
}

.sheet-report-space h2 {
  color: #4b5563;
}

/* Appointments — Apple Calendar style */
.appt-page {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── Header bar ─────────────────────────────────── */
.appt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 0 20px;
  flex-wrap: wrap;
}

.appt-month-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.appt-month-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--heading);
  min-width: 200px;
}

.appt-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 16px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.13s, color 0.13s;
  line-height: 1;
}

.appt-nav-btn:hover {
  background: var(--primary-soft);
  color: var(--primary);
  text-decoration: none;
}

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

/* Doctor select in header */
.appt-doctor-select {
  font-size: 13px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  min-width: 160px;
}

/* ── Full-width calendar grid ────────────────────── */
.appt-calendar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.appt-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--border);
}

.appt-cal-wday {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  padding: 10px 0 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.appt-cal-body {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

/* Each day cell */
.appt-day {
  min-height: 112px;
  padding: 10px 8px 8px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-decoration: none;
  color: var(--text);
  transition: background 0.13s;
  cursor: pointer;
}

.appt-day:nth-child(7n) {
  border-right: none;
}

/* Remove bottom border on last row cells */
.appt-cal-last-row .appt-day {
  border-bottom: none;
}

.appt-day:hover {
  background: #f8fafb;
  text-decoration: none;
}

.appt-day.other-month {
  background: #fafafa;
  pointer-events: none;
}

.appt-day.other-month .appt-day-num {
  color: #d1d5db;
}

/* Day number */
.appt-day-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  flex-shrink: 0;
  align-self: flex-start;
}

.appt-day.is-today .appt-day-num {
  background: var(--primary);
  color: #fff;
  font-weight: 720;
}

.appt-day.is-selected:not(.is-today) .appt-day-num {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 720;
}

.appt-day.is-selected {
  background: #f4fbfb;
}

/* Event pills inside cells */
.appt-event-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px 2px 5px;
  border-radius: 5px;
  background: var(--primary-soft);
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.5;
}

.appt-event-pill .appt-event-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
}

.appt-event-more {
  font-size: 11px;
  color: var(--muted);
  padding-left: 5px;
  font-weight: 600;
}

/* ── Day detail panel (below calendar) ───────────── */
.appt-detail-panel {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.appt-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.appt-detail-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--heading);
}

.appt-detail-count {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

/* Status chips */
.appt-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.appt-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  border: 1.5px solid var(--border);
  color: var(--muted);
  background: var(--surface);
  transition: all 0.12s;
  white-space: nowrap;
}

.appt-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}

.appt-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Day nav (prev/today/next under calendar) */
.appt-day-nav {
  display: flex;
  gap: 6px;
}

/* Empty state */
.appt-empty {
  padding: 36px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ATENDIMENTOS — RESUMO VISUAL + TABELA PROFISSIONAL
   ═══════════════════════════════════════════════════════════════════════════ */

.attendance-page {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Resumo Visual (KPIs) */
.attendance-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 24px 0;
}

.attendance-kpi-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: box-shadow 0.18s, transform 0.18s;
}

.attendance-kpi-card:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.attendance-kpi-card .attendance-kpi-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0;
}

.attendance-kpi-card .attendance-kpi-value {
  font-size: 32px;
  font-weight: 820;
  color: var(--heading);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

/* Filtros */
.attendance-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.attendance-filters .attendance-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 180px;
}

.attendance-filters .attendance-filter-field {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s;
}

.attendance-filters .attendance-filter-field:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 95, 130, 0.1);
}

.attendance-filters .attendance-filter-actions {
  display: flex;
  gap: 10px;
}

/* Tabela de Atendimentos */
.attendance-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.attendance-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 11px 14px;
  border-bottom: 1.5px solid var(--primary);
  background: var(--surface);
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}

.attendance-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}

.attendance-table tbody tr:hover {
  background: var(--surface-soft);
}

.attendance-table tbody tr:last-child td {
  border-bottom: 1px solid var(--border-strong);
}

/* Status Badges */
.attendance-status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.attendance-status-finished {
  color: #15803d;
  background: #dcfce7;
}

.attendance-status-in_progress {
  color: #d97706;
  background: #fef3c7;
}

.attendance-status-waiting_result {
  color: #d97706;
  background: #fef3c7;
}

.attendance-status-result_ready {
  color: #1d4ed8;
  background: #dbeafe;
}

.attendance-status-cancelled {
  color: #b91c1c;
  background: #fee2e2;
}

.attendance-status-scheduled {
  color: #6b7280;
  background: #f3f4f6;
}

.attendance-status-waiting {
  color: #6b7280;
  background: #f3f4f6;
}

.attendance-status-called {
  color: #6b7280;
  background: #f3f4f6;
}

/* Row actions form — remover inline styles */
.row-action-form {
  margin: 0;
}

.row-action-button {
  background: none;
  border: none;
  padding: 0;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
  color: var(--primary);
}

.row-action-delete {
  color: #dc2626;
}

.row-action-success {
  color: #059669;
}

/* Responsividade */
@media (max-width: 1200px) {
  .attendance-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .attendance-summary-grid {
    grid-template-columns: 1fr;
  }

  .attendance-filters {
    flex-direction: column;
  }

  .attendance-filters .attendance-filter-group {
    width: 100%;
  }

  .attendance-filters .attendance-filter-actions {
    width: 100%;
  }

  .attendance-filters .attendance-filter-actions button,
  .attendance-filters .attendance-filter-actions a {
    flex: 1;
  }
}

@media (max-width: 700px) {
  .appt-day {
    min-height: 64px;
    padding: 6px 4px 4px;
  }
  .appt-event-pill {
    display: none;
  }
  .appt-month-title {
    font-size: 17px;
    min-width: 0;
  }
  .appt-day-num {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }
}

/* Pagamento em Agendamentos */
.appt-payment-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}

.appt-payment-status-paid {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
}

.appt-payment-status-partial {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.appt-payment-status-pending {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.appt-payment-status-awaiting {
  background: rgba(107, 114, 128, 0.1);
  color: #6b7280;
}

.appt-payment-status-cancelled {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}

.appt-btn-receive {
  margin-left: 4px;
}

/* TV */
/* ── TV de chamada ─────────────────────────────────────────── */
.tv-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
  font-family: var(--font);
}

/* Cabeçalho: logo à esquerda, relógio à direita */
.tv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 48px;
  border-bottom: 2px solid var(--border);
  background: var(--surface);
}

.tv-logo {
  height: 56px;
  width: auto;
  object-fit: contain;
}

.tv-clinic-name {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
}

.tv-clock {
  font-size: clamp(28px, 3.5vw, 48px);
  font-weight: 700;
  color: var(--heading);
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
}

/* Área central */
.tv-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 48px;
  gap: 24px;
}

.tv-calling-label {
  font-size: clamp(16px, 2vw, 24px);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--primary);
}

.tv-patient-name {
  margin: 0;
  font-size: clamp(56px, 9vw, 120px);
  font-weight: 800;
  line-height: 1.05;
  color: var(--heading);
}

.tv-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  width: min(900px, 100%);
  margin-top: 16px;
}

.tv-cards.tv-cards-single {
  grid-template-columns: minmax(0, 480px);
  justify-content: center;
}

.tv-card {
  padding: 28px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tv-card-label {
  font-size: clamp(13px, 1.5vw, 18px);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

.tv-card-value {
  font-size: clamp(20px, 2.5vw, 32px);
  font-weight: 700;
  color: var(--heading);
}

/* Estado ocioso */
.tv-idle {
  opacity: 0.45;
}

.tv-idle-text {
  font-size: clamp(28px, 4vw, 56px);
  font-weight: 600;
  color: var(--heading);
  margin: 0;
}

/* ── Novo Atendimento — Responsividade ─────────────────── */
@media (max-width: 900px) {
  /* Em mobile, details começam colapsados (sem open) */
  .entry-card-details {
    margin-bottom: 0;
  }

  .entry-card-details[open] {
    margin-bottom: 0;
  }

  .entry-card-details > summary {
    padding: 18px 20px;
  }

  .entry-card-content {
    padding: 20px;
  }

  .entry-form .form-grid {
    grid-template-columns: 1fr;
  }

  .entry-form .col-span-2 {
    grid-column: auto;
  }

  .entry-item-row {
    grid-template-columns: 34px 1fr auto;
    gap: 10px;
  }

  .entry-item-row .entry-item-price {
    grid-column: 1 / -1;
  }

  .entry-item-row .entry-remove-button {
    grid-column: 1 / -1;
  }

  .payment-row {
    grid-template-columns: 34px 1fr auto;
  }

  .btn {
    font-size: 13px;
    padding: 8px 12px;
    min-height: 36px;
  }
}

@media (max-width: 768px) {
  .entry-form {
    gap: 16px;
  }

  .page {
    padding: 20px 16px 36px;
  }

  .entry-card-details > summary {
    padding: 16px 18px;
    gap: 10px;
  }

  .entry-card-content {
    padding: 18px;
  }

  .entry-form .form-grid {
    grid-template-columns: 1fr;
  }

  .entry-item-row {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 10px;
  }

  .entry-item-index {
    width: 24px;
    height: 24px;
    font-size: 11px;
  }

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

@media print {
  .topbar,
  .button,
  .btn,
  .nav,
  .print-actions,
  .no-print {
    display: none !important;
  }

  .print-only,
  .print-signatures {
    display: block !important;
  }

  body {
    background: #ffffff;
  }

  .page {
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .print-document,
  .receipt-document {
    max-width: none;
    padding: 0;
    border: 0;
    border-radius: 0;
  }

  .attendance-sheet {
    max-width: none;
    min-height: 0;
    padding: 0;
  }

  .sheet-report-space {
    min-height: 280px;
  }

  .card,
  .detail-item,
  .table-wrap {
    box-shadow: none;
  }

  .table {
    font-size: 11px;
  }

  .table th,
  .table td {
    padding: 6px;
  }
}

@media (max-width: 900px) {
  .topbar {
    position: sticky;
  }

  .topbar-inner {
    grid-template-columns: minmax(180px, auto) 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    min-height: auto;
  }

  .nav-toggle {
    display: flex;
    order: 2;
  }

  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    background: rgba(8, 50, 74, 0.98);
    border-bottom: 1px solid rgba(0, 200, 224, 0.15);
    backdrop-filter: blur(20px);
    padding: 12px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 0;
    z-index: 19;
  }

  .nav.is-open {
    max-height: 600px;
  }

  .nav-link {
    justify-content: flex-start;
    width: 100%;
    padding: 11px 14px;
    border-radius: 6px;
    font-size: 14px;
    margin: 2px 0;
  }

  .nav-link-primary {
    padding: 11px 14px;
    margin: 2px 0;
  }

  .topbar-user {
    order: 3;
    justify-content: space-between;
    width: 100%;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    grid-column: 1 / -1;
  }

  .user-summary {
    text-align: left;
    flex-direction: row;
    gap: 6px;
    font-size: 12px;
  }

  .logout-button {
    font-size: 12px;
    padding: 6px 10px;
    gap: 4px;
    min-height: 32px;
  }

  .logout-icon {
    width: 14px;
    height: 14px;
  }

  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-hero {
    min-height: auto;
    padding: 28px;
  }

  .auth-hero h1 {
    font-size: 30px;
  }

  .brand-logo {
    max-width: 170px;
    height: 36px;
  }
}

@media (max-width: 720px) {
  .page {
    padding: 22px 16px 36px;
  }

  .page-header,
  .content-header,
  .hero-panel,
  .primary-action-panel,
  .page-actions,
  .header-actions,
  .form-actions,
  .action-panel,
  .queue-filter,
  .patient-lookup-card {
    align-items: stretch;
    flex-direction: column;
  }

  .grid,
  .form-grid,
  .entry-grid-dense,
  .detail-grid,
  .dashboard-panels,
  .reception-search,
  .entry-item-row,
  .payment-row,
  .receipt-row,
  .filter-bar,
  .search-bar,
  .search-bar-wide {
    grid-template-columns: 1fr;
  }

  .entry-form .col-span-2 {
    grid-column: auto;
  }

  .entry-section-header {
    flex-direction: column;
  }

  .entry-item-index {
    align-self: start;
  }

  .queue-filter-field input,
  .queue-filter-field select,
  .queue-filter-doctor select {
    width: 100%;
  }

  .btn,
  .button,
  .queue-filter-button {
    width: 100%;
  }

  .auth-panel {
    padding: 26px;
  }

  .auth-hero {
    display: none;
  }

  .auth-logo {
    max-width: 190px;
    max-height: 86px;
  }
}

/* ═══ Fila — tabela vira linhas empilhadas no mobile ══════════════════ */
@media (max-width: 960px) {
  .queue-stat {
    flex-basis: 33.33%;
    min-width: 0;
  }

  .queue-table-wrap {
    border: none;
    background: transparent;
    box-shadow: none;
  }

  .queue-table {
    min-width: 0;
  }

  .queue-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .queue-table,
  .queue-table tbody,
  .queue-row,
  .queue-table td {
    display: block;
    width: 100%;
  }

  .queue-row {
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
  }

  .queue-row-next {
    border-color: rgba(14, 95, 130, 0.4);
    box-shadow: inset 4px 0 0 var(--primary);
  }

  .queue-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    text-align: right;
  }

  .queue-row td:last-child {
    border-bottom: none;
  }

  .queue-table td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    text-align: left;
  }

  .qt-pos { justify-content: flex-start; }
  .qt-patient { flex-direction: column; align-items: flex-end; }
  .qt-name { justify-content: flex-end; text-align: right; }
  .qt-proc { flex-direction: column; align-items: flex-end; }
  .qt-proc-name,
  .qt-proc-value { text-align: right; }

  .qt-actions-inner {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}
/* ═══ RELATÓRIO DE CAIXA — tabelas e filtros profissionais ════════════════ */

/* Filtros — refazer sem CSS inline */
.financial-filters {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 24px 16px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.ff-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.ff-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ff-field label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.ff-field select,
.ff-field input[type="date"] {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ff-field select:focus,
.ff-field input[type="date"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 95, 130, 0.1);
}

.ff-field-doctors {
  flex: 1 1 0;
}

.ff-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ff-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.ff-chip input[type="checkbox"] {
  display: none;
}

.ff-chip:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.ff-chip:has(input:checked) {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  font-weight: 750;
}

.ff-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.ff-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
}

/* Resumo visual — cards com design system */
.financial-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.fs-card {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.fs-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
  border-color: var(--border-strong);
}

.fs-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.fs-label-icon {
  display: inline-block;
  font-size: 14px;
  opacity: 0.7;
}

.fs-value {
  color: var(--heading);
  font-size: 18px;
  font-weight: 620;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

/* Destaque para colunas importantes (Recebido, Saldo) */
.fs-card.fs-primary,
.fs-card.fs-balance {
  background: linear-gradient(135deg, var(--surface) 0%, rgba(14, 95, 130, 0.03) 100%);
  border-color: rgba(14, 95, 130, 0.2);
}

.fs-card.fs-primary:hover,
.fs-card.fs-balance:hover {
  background: linear-gradient(135deg, var(--surface) 0%, rgba(14, 95, 130, 0.06) 100%);
}

/* Cores por tipo de card */
.fs-card.fs-balance {
  border-color: var(--success-text);
}

.fs-card.fs-balance .fs-label,
.fs-card.fs-balance .fs-label-icon {
  color: var(--success-text);
  opacity: 1;
}

.fs-card.fs-balance .fs-value {
  color: var(--success-text);
}

/* Tabelas profissionais — similar à fila */
.financial-table-wrap {
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  overflow-x: auto;
  overflow-y: visible;
}

.financial-table {
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.financial-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 10px;
  border-bottom: 1px solid var(--border-strong);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}

.financial-table tbody td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
  font-size: 12.5px;
}

.financial-table tbody tr {
  transition: background 0.15s ease;
}

/* Stripe rows — linhas alternadas */
.financial-table tbody tr:nth-child(odd) {
  background: transparent;
}

.financial-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.01);
}

.financial-table tbody tr:hover {
  background: rgba(14, 95, 130, 0.04);
}

.financial-table tbody tr:nth-child(even):hover {
  background: rgba(14, 95, 130, 0.04);
}

.financial-table tbody tr:last-child td {
  border-bottom: none;
}

/* Cores por status de pagamento */
.financial-table .row-pending {
  background-color: transparent;
}

.financial-table .row-pending:hover {
  background: rgba(217, 119, 6, 0.04);
}

.financial-table .row-partial {
  background-color: transparent;
}

.financial-table .row-partial:hover {
  background: rgba(59, 130, 246, 0.04);
}

.financial-table .row-cancelled {
  opacity: 0.65;
}

.financial-table .row-cancelled:hover {
  opacity: 0.85;
  background: rgba(220, 38, 38, 0.04);
}

/* Status badges refinadas */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.status-badge.status-pending {
  background: rgba(217, 119, 6, 0.1);
  color: #d97706;
}

.status-badge.status-partial {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.status-badge.status-paid,
.status-badge.status-finished {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
}

.status-badge.status-cancelled {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}

/* Total row no final das tabelas */
.financial-table tbody tr.row-total {
  font-weight: 600;
  border-top: 2px solid var(--border-strong);
  background: rgba(14, 95, 130, 0.02);
}

.financial-table tbody tr.row-total td {
  padding: 12px 14px;
  color: var(--heading);
}

/* Inline actions — aparecem no hover */
.financial-table tbody td .inline-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.financial-table tbody tr:hover td .inline-actions {
  opacity: 1;
}

.inline-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.inline-action-btn:hover {
  background: rgba(14, 95, 130, 0.1);
  color: var(--primary);
}

/* ────────────────────────────────────────────────────────────────────────────
   REPASSE/COMISSÕES — Design System Profissional
   ──────────────────────────────────────────────────────────────────────────── */

/* KPI Cards — Resumo Visual */
.repasse-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.repasse-kpi-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: box-shadow 0.18s, transform 0.18s;
}

.repasse-kpi-card:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.repasse-kpi-card .repasse-kpi-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0;
}

.repasse-kpi-card .repasse-kpi-value {
  font-size: 32px;
  font-weight: 820;
  color: var(--primary);
  margin: 0;
}

.repasse-kpi-card.highlight .repasse-kpi-value {
  color: var(--success);
}

/* Filtros */
.repasse-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  align-items: flex-end;
}

.repasse-filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 1 auto;
  min-width: 160px;
}

.repasse-filter-group label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.repasse-filter-field {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
}

.repasse-filter-field:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 95, 130, 0.1);
}

.repasse-filter-actions {
  display: flex;
  gap: 8px;
}

/* Cards de Médicos */
.repasse-doctor-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.repasse-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
}

.repasse-card-header h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--primary);
}

.repasse-card-header .muted {
  margin: 3px 0 0;
  font-size: 13px;
}

.repasse-card-summary {
  text-align: right;
}

.repasse-card-summary .label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-weight: 700;
}

.repasse-card-summary .val {
  font-size: 14px;
  font-weight: 700;
}

.repasse-card-summary .val-commission {
  font-size: 18px;
  font-weight: 820;
  color: var(--success);
  margin-top: 4px;
}

/* Tabelas de Repasse */
.repasse-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.repasse-table thead th {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-strong);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}

.repasse-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
  font-size: 13px;
}

.repasse-table tbody tr:nth-child(odd) {
  background: transparent;
}

.repasse-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.01);
}

.repasse-table tbody tr:hover {
  background: rgba(14, 95, 130, 0.04);
}

.repasse-table tbody tr:last-child td {
  border-bottom: none;
}

.repasse-table tfoot tr {
  font-weight: 600;
  border-top: 2px solid var(--border-strong);
  background: rgba(14, 95, 130, 0.02);
}

.repasse-table tfoot td {
  padding: 12px 14px;
  color: var(--heading);
}

.repasse-commission-value {
  font-weight: 600;
  color: var(--success);
}

/* Grand Total Section */
.repasse-grand-total {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 28px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 40px;
  box-shadow: var(--shadow-xs);
}

.repasse-grand-total .gt-item {
  text-align: right;
}

.repasse-grand-total .gt-label {
  font-size: 12px;
  color: var(--muted);
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-weight: 700;
  margin-bottom: 4px;
}

.repasse-grand-total .gt-val {
  font-size: 16px;
  font-weight: 700;
}

.repasse-grand-total .gt-val-main {
  font-size: 22px;
  font-weight: 820;
  color: var(--success);
}

/* Responsividade */
@media (max-width: 1200px) {
  .repasse-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .repasse-grand-total {
    flex-direction: column;
    align-items: flex-end;
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .repasse-kpi-grid {
    grid-template-columns: 1fr;
  }

  .repasse-filters {
    flex-direction: column;
  }

  .repasse-filter-group {
    min-width: 100%;
  }

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

  .repasse-card-summary {
    text-align: left;
    margin-top: 12px;
  }

  .repasse-table {
    font-size: 12px;
  }

  .repasse-table thead th,
  .repasse-table tbody td {
    padding: 8px 10px;
  }

  .repasse-grand-total {
    flex-direction: column;
    align-items: flex-end;
    gap: 16px;
  }
}

/* Mini-gráficos */
.mini-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 20px;
  margin-top: 4px;
}

.mini-bar {
  flex: 1;
  background: var(--primary);
  border-radius: 2px;
  opacity: 0.6;
  transition: opacity 0.15s ease;
  min-height: 2px;
}

.mini-bar:hover {
  opacity: 0.9;
}

.breakdown-percentage {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
}

.trend-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 650;
}

.trend-up {
  color: #22c55e;
}

.trend-down {
  color: #dc2626;
}

/* Mobile: tabelas viram cards empilhados */
@media (max-width: 960px) {
  .financial-filters {
    padding: 14px;
  }

  .ff-row {
    flex-direction: column;
    gap: 12px;
  }

  .ff-field {
    width: 100%;
  }

  .ff-field select,
  .ff-field input[type="date"] {
    width: 100%;
  }

  .ff-actions {
    flex-direction: column;
    width: 100%;
    margin-left: 0;
  }

  .ff-actions .btn {
    width: 100%;
  }

  .financial-summary {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .fs-card {
    padding: 12px 14px;
  }

  .fs-label {
    font-size: 10px;
    margin-bottom: 4px;
  }

  .fs-value {
    font-size: 16px;
  }

  .financial-table-wrap {
    border: none;
    background: transparent;
    box-shadow: none;
  }

  .financial-table {
    min-width: 0;
  }

  .financial-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

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

  .financial-table tr {
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
  }

  .financial-table tr:hover {
    background: var(--surface);
  }

  .financial-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    text-align: right;
  }

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

  .financial-table td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    text-align: left;
  }

  /* Status badges em mobile */
  .financial-table .status-badge {
    flex-shrink: 0;
  }
}

/* ────────────────────────────────────────────────────────────────────────────
   MOBILE — Tabelas de dados viram cards empilhados (Atendimentos, Repasse,
   Agendamentos). Mesmo padrão da Fila e do Relatório de Caixa.
   ──────────────────────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  /* Remove min-width e deixa o container respirar */
  .attendance-table,
  .repasse-table,
  .appt-page .table {
    min-width: 0;
  }

  /* Esconde o cabeçalho (acessível) */
  .attendance-table thead,
  .repasse-table thead,
  .appt-page .table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  /* Tabela, corpo, linhas e células viram blocos */
  .attendance-table,
  .attendance-table tbody,
  .attendance-table tr,
  .attendance-table td,
  .repasse-table,
  .repasse-table tbody,
  .repasse-table tr,
  .repasse-table td,
  .appt-page .table,
  .appt-page .table tbody,
  .appt-page .table tr,
  .appt-page .table td {
    display: block;
    width: 100%;
  }

  /* Cada linha vira um card */
  .attendance-table tbody tr,
  .repasse-table tbody tr,
  .appt-page .table tbody tr {
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
    overflow: visible; /* deixa o menu de ações (⋮) aparecer */
  }

  /* Cada célula: rótulo à esquerda, valor à direita */
  .attendance-table tbody td,
  .repasse-table tbody td,
  .appt-page .table tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    text-align: right;
  }

  .attendance-table tbody tr td:last-child,
  .repasse-table tbody tr td:last-child,
  .appt-page .table tbody tr td:last-child {
    border-bottom: none;
  }

  /* Rótulo via data-label */
  .attendance-table tbody td::before,
  .repasse-table tbody td::before,
  .appt-page .table tbody td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    text-align: left;
  }

  /* Células sem rótulo (ações) não mostram ::before vazio */
  .attendance-table tbody td:not([data-label])::before,
  .repasse-table tbody td:not([data-label])::before,
  .appt-page .table tbody td:not([data-label])::before {
    content: none;
  }

  /* Coluna de ações alinhada à direita */
  .attendance-table tbody td.table-actions,
  .appt-page .table tbody td.table-actions {
    justify-content: flex-end;
  }

  /* Linha de "nenhum resultado" centralizada */
  .attendance-table tbody td.empty {
    justify-content: center;
    text-align: center;
    color: var(--muted);
  }
  .attendance-table tbody td.empty::before {
    content: none;
  }

  /* Subtotais (tfoot) do Repasse viram bloco também */
  .repasse-table tfoot,
  .repasse-table tfoot tr,
  .repasse-table tfoot td {
    display: block;
    width: 100%;
  }
  .repasse-table tfoot td {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 9px 14px;
    text-align: right;
  }
  .repasse-table tfoot td[colspan]::before {
    content: none;
  }

  /* Célula de pagamento (status + botão Receber): rótulo à esquerda,
     conteúdo à direita, quebrando para a linha de baixo se faltar espaço */
  .appt-page .table tbody td[data-label="Pagamento"] {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px 10px;
  }
  .appt-page .table tbody td[data-label="Pagamento"]::before {
    margin-right: auto;
  }
  .appt-page .table tbody td .appt-btn-receive {
    flex-shrink: 0;
  }

  /* ── Lista de Pacientes vira cards no mobile ── */
  .patients-table {
    min-width: 0;
  }
  .patients-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .patients-table,
  .patients-table tbody,
  .patients-table tr,
  .patients-table td {
    display: block;
    width: 100%;
  }
  .patients-table tbody tr {
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
  }
  .patients-table tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    text-align: right;
  }
  .patients-table tbody tr td:last-child {
    border-bottom: none;
  }
  .patients-table tbody td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    text-align: left;
  }
  .patients-table tbody td:not([data-label])::before {
    content: none;
  }
  /* Ações (Ver / Editar / Inativar) alinhadas à direita, quebrando se preciso */
  .patients-table tbody td.table-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px 16px;
  }
  .patients-table tbody td.empty {
    justify-content: center;
    text-align: center;
    color: var(--muted);
  }
  .patients-table tbody td.empty::before {
    content: none;
  }
}
