/* ==========================================================================
   ONLY ESTÉTICA AVANÇADA — Design System (Luxo Claro & Luxo Escuro)
   ========================================================================== */

:root {
  /* Champagne Gold Palette (matched to Only logo #DEC687) */
  --gold-300: #EBD8A7;
  --gold-400: #DEC687;
  --gold-500: #C2A052;
  --gold-600: #9E7E36;
  --gold-700: #7D6124;
  --gold-tint: rgba(194, 160, 82, 0.12);
  --gold-tint-strong: rgba(194, 160, 82, 0.22);
  --gold-gradient: linear-gradient(135deg, #DEC687 0%, #B89344 100%);

  /* Light Luxury Theme (Default) */
  --bg-canvas: #FAF8F4;
  --bg-sidebar: #F3EEE5;
  --bg-surface: #FFFFFF;
  --bg-surface-2: #F7F3EC;
  --bg-hover: #EFE9DD;
  --border-subtle: #EAE2D4;
  --border-strong: #DACDB7;

  --text-primary: #1F1C18;
  --text-secondary: #5E554B;
  --text-muted: #8C8275;
  --text-inverse: #FFFFFF;

  --shadow-xs: 0 1px 2px rgba(31, 28, 24, 0.04);
  --shadow-sm: 0 2px 8px rgba(31, 28, 24, 0.05);
  --shadow-md: 0 8px 24px rgba(31, 28, 24, 0.07);
  --shadow-lg: 0 20px 50px rgba(31, 28, 24, 0.14);

  /* Semantic Status Colors */
  --status-scheduled-bg: #F3EFE6;
  --status-scheduled-fg: #7D6124;
  --status-confirmed-bg: #E8F5EE;
  --status-confirmed-fg: #1E6B45;
  --status-waiting-bg: #F3ECFA;
  --status-waiting-fg: #6B3FA0;
  --status-inprogress-bg: #FEF4E2;
  --status-inprogress-fg: #A16207;
  --status-done-bg: #EBF2F7;
  --status-done-fg: #24577A;
  --status-cancelled-bg: #FBEAEA;
  --status-cancelled-fg: #A33030;

  --whatsapp-bg: #E7F7EE;
  --whatsapp-fg: #128C4A;
  --whatsapp-solid: #1E9E56;

  /* Typography & Radii */
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --sidebar-width: 262px;
  --topbar-height: 72px;
  --hour-height: 92px;
}

[data-theme="dark"] {
  --bg-canvas: #11100E;
  --bg-sidebar: #161411;
  --bg-surface: #1C1915;
  --bg-surface-2: #24201B;
  --bg-hover: #2C2721;
  --border-subtle: #2D2821;
  --border-strong: #40382E;

  --text-primary: #F6F2EA;
  --text-secondary: #C5BCB0;
  --text-muted: #8E8477;
  --text-inverse: #171410;

  --gold-500: #DEC687;
  --gold-600: #EBD8A7;
  --gold-tint: rgba(222, 198, 135, 0.13);
  --gold-tint-strong: rgba(222, 198, 135, 0.24);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.65);

  --status-scheduled-bg: rgba(222, 198, 135, 0.16);
  --status-scheduled-fg: #EBD8A7;
  --status-confirmed-bg: rgba(46, 178, 111, 0.16);
  --status-confirmed-fg: #6EE7A8;
  --status-waiting-bg: rgba(167, 139, 250, 0.18);
  --status-waiting-fg: #D8B4FE;
  --status-inprogress-bg: rgba(245, 158, 11, 0.16);
  --status-inprogress-fg: #FCD34D;
  --status-done-bg: rgba(56, 189, 248, 0.15);
  --status-done-fg: #7DD3FC;
  --status-cancelled-bg: rgba(239, 68, 68, 0.16);
  --status-cancelled-fg: #FCA5A5;

  --whatsapp-bg: rgba(30, 158, 86, 0.18);
  --whatsapp-fg: #5EE398;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .font-display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gold-500);
}

/* ==========================================================================
   App Shell Layout
   ========================================================================== */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg-canvas);
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 40;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  padding: 20px 20px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-logo-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
}

.brand-logo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-text-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.05;
  color: var(--text-primary);
  letter-spacing: 0.03em;
}

.brand-text-sub {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold-600);
  margin-top: 2px;
}

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

.nav-section-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  padding: 12px 12px 6px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 13px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 13.5px;
  transition: all 0.16s ease;
  width: 100%;
  text-align: left;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--border-subtle);
}

.nav-item.active svg {
  color: var(--gold-600);
  opacity: 1;
}

.nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--gold-tint);
  color: var(--gold-600);
}

.sidebar-portal-card {
  margin: 12px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xs);
}

.sidebar-portal-title {
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-primary);
}

.sidebar-portal-title svg {
  width: 16px;
  height: 16px;
  color: var(--gold-600);
  flex-shrink: 0;
}

.sidebar-portal-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  margin: 4px 0 10px;
  line-height: 1.4;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22A06B;
  box-shadow: 0 0 0 3px rgba(34, 160, 107, 0.16);
}

.sync-dot.local {
  background: var(--gold-500);
  box-shadow: 0 0 0 3px var(--gold-tint);
}

/* Main Area */
.main-area {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: var(--topbar-height);
  padding: 12px 28px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-canvas);
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.mobile-menu-btn {
  display: none;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.page-title {
  font-size: 28px;
  line-height: 1.1;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 1px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-content {
  padding: 24px 28px 40px;
  flex: 1;
  max-width: 1560px;
  width: 100%;
  margin: 0 auto;
}

/* ==========================================================================
   Buttons, Inputs, Badges & Cards
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 13px;
  transition: all 0.16s ease;
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--gold-gradient);
  color: #1F190E;
  box-shadow: 0 2px 10px rgba(184, 147, 68, 0.28);
}

.btn-primary:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(184, 147, 68, 0.36);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background: var(--bg-surface-2);
  border-color: var(--border-strong);
}

.btn-ghost {
  color: var(--text-secondary);
  padding: 8px 11px;
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-whatsapp {
  background: var(--whatsapp-bg);
  color: var(--whatsapp-fg);
  border: 1px solid rgba(30, 158, 86, 0.25);
}

.btn-whatsapp:hover {
  background: var(--whatsapp-solid);
  color: #FFFFFF;
}

.btn-danger {
  background: var(--status-cancelled-bg);
  color: var(--status-cancelled-fg);
}

.btn-danger:hover {
  filter: brightness(0.96);
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-block {
  width: 100%;
}

/* Segmented Control */
.segmented {
  display: inline-flex;
  background: var(--bg-surface-2);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.segmented button {
  padding: 6px 13px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.segmented button.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

/* Cards */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.card-pad {
  padding: 20px;
}

/* Form Elements */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

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

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

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-size: 13.5px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px var(--gold-tint);
}

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

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box svg {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-box input {
  padding-left: 36px;
}

/* Status & Category Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-agendado { background: var(--status-scheduled-bg); color: var(--status-scheduled-fg); }
.badge-confirmado { background: var(--status-confirmed-bg); color: var(--status-confirmed-fg); }
.badge-em_espera { background: var(--status-waiting-bg); color: var(--status-waiting-fg); }
.badge-em_atendimento { background: var(--status-inprogress-bg); color: var(--status-inprogress-fg); }
.badge-concluido { background: var(--status-done-bg); color: var(--status-done-fg); }
.badge-faltou, .badge-cancelado { background: var(--status-cancelled-bg); color: var(--status-cancelled-fg); }
.badge-gold { background: var(--gold-tint); color: var(--gold-600); }
.badge-vip {
  background: linear-gradient(135deg, rgba(222,198,135,0.28), rgba(184,147,68,0.16));
  color: var(--gold-600);
  border: 1px solid rgba(194,160,82,0.35);
}

/* KPI Row */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

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

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
}

.kpi-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gold-gradient);
  opacity: 0.65;
}

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--gold-tint);
  color: var(--gold-600);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.kpi-value {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.15;
  margin-top: 10px;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ==========================================================================
   Agenda Visual (Day & Week Calendar)
   ========================================================================== */
.agenda-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.agenda-date-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.agenda-date-label {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  min-width: 230px;
  text-align: center;
  text-transform: capitalize;
}

.agenda-layout {
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 20px;
  align-items: start;
}

.calendar-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.calendar-scroll {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 230px);
}

.cal-header-row {
  display: grid;
  position: sticky;
  top: 0;
  z-index: 15;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.cal-time-corner {
  width: 66px;
  padding: 14px 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-align: center;
  border-right: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cal-col-header {
  padding: 12px 12px;
  border-right: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 175px;
}

.cal-col-header:last-child {
  border-right: none;
}

.cal-col-header.today-col {
  background: var(--gold-tint);
}

.col-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12.5px;
  color: #FFFFFF;
  flex-shrink: 0;
}

.col-title {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-primary);
  line-height: 1.2;
}

.col-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

.cal-body-grid {
  display: grid;
  position: relative;
}

.cal-time-axis {
  width: 66px;
  border-right: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
}

.cal-time-label {
  height: var(--hour-height);
  padding: 6px 8px 0;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--border-subtle);
}

.cal-column {
  position: relative;
  border-right: 1px solid var(--border-subtle);
  min-width: 175px;
}

.cal-column:last-child {
  border-right: none;
}

.cal-slot {
  height: calc(var(--hour-height) / 2);
  border-bottom: 1px dashed var(--border-subtle);
  cursor: pointer;
  transition: background 0.12s ease;
  position: relative;
}

.cal-slot.hour-start {
  border-bottom-style: dashed;
}

.cal-slot.hour-end {
  border-bottom-style: solid;
}

.cal-slot:hover {
  background: var(--gold-tint);
}

.cal-slot:hover::after {
  content: '+ Agendar ' attr(data-time);
  position: absolute;
  top: 5px;
  left: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gold-600);
}

.cal-now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gold-500);
  z-index: 12;
  pointer-events: none;
}

.cal-now-line::before {
  content: '';
  position: absolute;
  left: -4px;
  top: -3.5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold-500);
}

/* Appointment Block */
.appt-block {
  position: absolute;
  left: 5px;
  right: 5px;
  border-radius: 10px;
  padding: 6px 9px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--gold-500);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  z-index: 10;
  overflow: hidden;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.appt-block:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  z-index: 14;
}

.appt-block.status-cancelado, .appt-block.status-faltou {
  opacity: 0.55;
  text-decoration: line-through;
}

.appt-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  flex-shrink: 0;
  line-height: 1.2;
}

.appt-quick-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(30, 107, 69, 0.35);
  background: var(--status-confirmed-bg);
  color: var(--status-confirmed-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: all 0.14s ease;
}

.appt-quick-check svg {
  width: 12px;
  height: 12px;
}

.appt-quick-check:hover {
  background: #1E6B45;
  color: #FFFFFF;
  transform: scale(1.08);
}

.appt-block.status-concluido {
  background: linear-gradient(180deg, var(--bg-surface) 0%, var(--status-done-bg) 100%);
}

.appt-time {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.appt-patient {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.28;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.appt-proc {
  font-size: 11.5px;
  line-height: 1.25;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.appt-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: auto;
  padding-top: 2px;
  font-size: 10.5px;
  line-height: 1.2;
  color: var(--text-muted);
  flex-shrink: 0;
}

.appt-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Agenda Right Panel */
.agenda-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.side-section-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mini-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mini-stat {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
}

.mini-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.mini-stat-val {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
}

.pending-item {
  padding: 11px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  margin-bottom: 9px;
}

.pending-item:last-child { margin-bottom: 0; }

.pending-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.pending-name {
  font-weight: 600;
  font-size: 13px;
}

.pending-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.pending-actions {
  display: flex;
  gap: 6px;
  margin-top: 9px;
}

/* ==========================================================================
   Tables, Grids, Packages & Progress Bars
   ========================================================================== */
.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.filter-pill {
  padding: 7px 14px;
  border-radius: var(--radius-full);
  font-size: 12.5px;
  font-weight: 500;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  transition: all 0.15s;
}

.filter-pill:hover {
  border-color: var(--gold-500);
  color: var(--text-primary);
}

.filter-pill.active {
  background: var(--gold-tint);
  border-color: var(--gold-500);
  color: var(--gold-600);
  font-weight: 600;
}

.cards-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 16px;
}

.cards-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr));
  gap: 18px;
}

.proc-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.proc-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.proc-price {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--gold-600);
  line-height: 1;
}

.proc-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.proc-precare {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-surface-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  border-left: 3px solid var(--gold-400);
}

/* Data Table */
.table-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-xs);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  padding: 13px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13.5px;
  vertical-align: middle;
}

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

.data-table tbody tr {
  transition: background 0.12s;
}

.data-table tbody tr:hover {
  background: var(--bg-surface-2);
}

.patient-cell {
  display: flex;
  align-items: center;
  gap: 11px;
}

.avatar-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--gold-tint-strong);
  color: var(--gold-600);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(194, 160, 82, 0.35);
}

/* Progress Bar (Packages & Finance Bars) */
.progress-track {
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--bg-hover);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--gold-gradient);
  transition: width 0.3s ease;
}

.package-box {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 10px;
}

/* Finance Charts */
.finance-charts-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px;
  margin-bottom: 20px;
}

.bar-row {
  margin-bottom: 13px;
}

.bar-row:last-child { margin-bottom: 0; }

.bar-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 5px;
}

/* ==========================================================================
   Modal & Slide-over Drawer
   ========================================================================== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 13, 10, 0.52);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.16s ease;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.18s ease;
}

.modal.modal-wide {
  max-width: 820px;
}

.modal > form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-header h2 {
  font-size: 25px;
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 13, 10, 0.45);
  backdrop-filter: blur(3px);
  z-index: 95;
  display: flex;
  justify-content: flex-end;
  animation: fadeIn 0.16s ease;
}

.drawer {
  width: 100%;
  max-width: 500px;
  height: 100%;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.22s ease;
}

.drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.drawer-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.drawer-section {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 15px;
}

.drawer-section-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.status-pills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.status-choice {
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  transition: all 0.14s;
}

.status-choice:hover {
  border-color: var(--gold-500);
}

.status-choice.active {
  border-color: var(--gold-500);
  background: var(--gold-tint);
  color: var(--gold-600);
}

.whatsapp-preview {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 12.5px;
  white-space: pre-wrap;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 10px 0;
}

.alert-box {
  padding: 11px 14px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.alert-box svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-warning {
  background: var(--status-inprogress-bg);
  color: var(--status-inprogress-fg);
  border: 1px solid rgba(217, 119, 6, 0.25);
}

.alert-danger {
  background: var(--status-cancelled-bg);
  color: var(--status-cancelled-fg);
  border: 1px solid rgba(185, 28, 28, 0.25);
}

/* ==========================================================================
   Patient Public Online Booking Portal (?portal=agendar)
   ========================================================================== */
.portal-shell {
  min-height: 100vh;
  background: var(--bg-canvas);
  display: flex;
  flex-direction: column;
}

.portal-topbar {
  padding: 16px 28px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.portal-hero {
  text-align: center;
  padding: 36px 20px 24px;
  max-width: 720px;
  margin: 0 auto;
}

.portal-hero-logo {
  height: 82px;
  object-fit: contain;
  margin-bottom: 12px;
}

.portal-hero h1 {
  font-size: 38px;
  line-height: 1.1;
}

.portal-hero p {
  color: var(--text-secondary);
  margin: 8px 0 0;
  font-size: 14.5px;
}

.portal-container {
  max-width: 860px;
  width: 100%;
  margin: 0 auto 60px;
  padding: 0 20px;
}

.stepper {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}

.step-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  font-size: 12.5px;
  font-weight: 600;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.step-pill.active {
  border-color: var(--gold-500);
  background: var(--gold-tint);
  color: var(--gold-600);
}

.step-pill.done {
  background: var(--status-confirmed-bg);
  color: var(--status-confirmed-fg);
  border-color: transparent;
}

.step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-surface-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.step-pill.active .step-num {
  background: var(--gold-500);
  color: #1F190E;
}

.portal-proc-option {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 10px;
  width: 100%;
  text-align: left;
}

.portal-proc-option:hover, .portal-proc-option.selected {
  border-color: var(--gold-500);
  background: var(--gold-tint);
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.slot-btn {
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  font-weight: 600;
  font-size: 13px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  transition: all 0.14s;
}

.slot-btn:hover {
  border-color: var(--gold-500);
  color: var(--gold-600);
}

.slot-btn.selected {
  background: var(--gold-gradient);
  color: #1F190E;
  border-color: transparent;
}

/* ==========================================================================
   Prontuário Digital & Modo Cabine (Tablet / Touch-First)
   ========================================================================== */
.cabine-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}

.cabine-card {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--gold-500);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

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

.cabine-card.has-record {
  border-left-color: #22A06B;
}

.records-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.record-card {
  padding: 18px 20px;
}

.record-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.area-chip-static {
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.record-lot-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2);
  border-left: 3px solid var(--gold-400);
  font-size: 12.5px;
  color: var(--text-secondary);
}

.record-notes {
  margin-top: 12px;
  font-size: 13.5px;
  color: var(--text-primary);
  white-space: pre-wrap;
  line-height: 1.55;
}

.record-media-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.record-thumb, .record-sig-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.record-thumb img {
  width: 110px;
  height: 82px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.record-sig-thumb img {
  height: 60px;
  max-width: 180px;
  background: #FFFFFF;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

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

.touch-chip {
  padding: 8px 13px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.14s ease;
}

.touch-chip:hover {
  border-color: var(--gold-500);
}

.touch-chip.active {
  background: var(--gold-gradient);
  color: #1F190E;
  border-color: transparent;
  font-weight: 700;
}

.phrase-chip {
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-strong);
  background: var(--bg-surface);
  font-size: 11.5px;
  color: var(--text-secondary);
  transition: all 0.14s;
}

.phrase-chip:hover {
  border-color: var(--gold-500);
  color: var(--gold-600);
  background: var(--gold-tint);
}

.an-check-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  font-size: 12.5px;
  cursor: pointer;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.photo-drop-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 136px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  padding: 12px;
}

.photo-drop-label:hover {
  border-color: var(--gold-500);
  background: var(--gold-tint);
}

.photo-drop-label svg {
  width: 24px;
  height: 24px;
  color: var(--gold-600);
}

.photo-drop-label span {
  font-size: 11.5px;
  color: var(--text-muted);
}

.photo-preview-wrap {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.photo-preview-wrap img {
  width: 100%;
  height: 136px;
  object-fit: cover;
  display: block;
}

.photo-preview-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 6px 10px;
  background: rgba(15, 13, 10, 0.68);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
}

.consent-text {
  font-size: 12.5px;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 10px;
  line-height: 1.5;
}

.sig-pad-wrap {
  background: #FFFFFF;
  border: 1.5px dashed var(--gold-500);
  border-radius: var(--radius-md);
  padding: 6px;
  text-align: center;
}

.sig-canvas {
  width: 100%;
  height: 145px;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.sig-hint {
  font-size: 11px;
  color: #8C8275;
  padding-top: 4px;
  border-top: 1px solid #EFEAE0;
}

/* Login Screen (cPanel Hosting) */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at top, var(--gold-tint) 0%, var(--bg-canvas) 62%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 34px 30px 26px;
  box-shadow: var(--shadow-lg);
}

/* ==========================================================================
   Painel de Fluxo da Recepção (Em Espera • Atendendo • Canceladas)
   ========================================================================== */
.flow-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.flow-pill-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-xs);
}

.flow-pill-card:hover {
  transform: translateY(-1px);
  border-color: var(--gold-500);
  box-shadow: var(--shadow-sm);
}

.flow-pill-card.active {
  border-color: var(--gold-500);
  box-shadow: 0 0 0 2px var(--gold-tint);
}

.flow-pill-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.flow-pill-count {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.05;
  margin-top: 2px;
  color: var(--text-primary);
}

.flow-pill-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
}

.reception-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(230px, 1fr));
  gap: 16px;
  align-items: start;
}

.reception-col {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px;
  min-height: 360px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.reception-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.reception-col-title {
  font-weight: 700;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.reception-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--gold-500);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.14s, box-shadow 0.14s;
}

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

.reception-card.col-waiting { border-left-color: #8B5CF6; }
.reception-card.col-active { border-left-color: #D97706; }
.reception-card.col-done { border-left-color: #22A06B; }
.reception-card.col-cancelled { border-left-color: #DC2626; opacity: 0.88; }

.reception-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Vendas, Formas de Pagamento & Contratos
   ========================================================================== */
.sale-item-row {
  display: grid;
  grid-template-columns: 2fr 78px 110px 96px 36px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.sale-item-head {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.sale-summary {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.sale-summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 4px;
}

.sale-summary-total {
  font-size: 17px;
  font-weight: 700;
  color: var(--gold-600);
  margin-top: 4px;
}

.contract-sheet {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #FFFFFF;
}

@media (max-width: 680px) {
  .sale-item-row {
    grid-template-columns: 1fr 1fr;
  }
  .sale-item-head {
    display: none;
  }
}

@media (max-width: 1180px) {
  .reception-board {
    grid-template-columns: repeat(2, 1fr);
  }
  .flow-summary-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .reception-board {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Toasts & Empty States & Animations
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--text-primary);
  color: var(--text-inverse);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 9px;
  border-left: 4px solid var(--gold-400);
  animation: slideUp 0.2s ease;
}

.toast svg {
  width: 17px;
  height: 17px;
  color: var(--gold-400);
  flex-shrink: 0;
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state h3 {
  font-size: 22px;
  color: var(--text-primary);
  margin: 10px 0 6px;
}

@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); }
}
@keyframes slideInRight {
  from { transform: translateX(100%); } to { transform: translateX(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Responsive (Tablet, Celular & PWA Standalone)
   ========================================================================== */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 13, 10, 0.48);
  backdrop-filter: blur(2px);
  z-index: 35;
  animation: fadeIn 0.16s ease;
}

.mobile-bottom-nav {
  display: none;
}

.show-sm {
  display: none;
}

.table-wrap {
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 1180px) {
  .agenda-layout {
    grid-template-columns: 1fr;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .kpi-grid.kpi-grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .finance-charts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .main-area {
    margin-left: 0;
  }
  .mobile-menu-btn {
    display: inline-flex;
  }
  .topbar {
    padding: 10px 16px;
    min-height: 62px;
  }
  .page-title {
    font-size: 22px;
  }
  .page-subtitle {
    display: none;
  }
  .page-content {
    padding: 16px 14px 92px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .calendar-scroll {
    max-height: calc(100dvh - 290px);
    -webkit-overflow-scrolling: touch;
  }
  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 32;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 18px rgba(31, 28, 24, 0.08);
  }
  .mbn-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 4px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 10.5px;
    font-weight: 600;
  }
  .mbn-item svg {
    width: 19px;
    height: 19px;
  }
  .mbn-item.active {
    color: var(--gold-600);
    background: var(--gold-tint);
  }
  .toast-container {
    bottom: 78px;
    left: 14px;
    right: 14px;
  }
}

@media (max-width: 680px) {
  .hide-sm {
    display: none;
  }
  .show-sm {
    display: inline;
  }
  .kpi-grid, .kpi-grid.kpi-grid-3 {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .kpi-card {
    padding: 14px;
  }
  .kpi-value {
    font-size: 24px;
  }
  .flow-summary-strip {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .flow-pill-card {
    padding: 10px 12px;
  }
  .flow-pill-count {
    font-size: 22px;
  }
  .agenda-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .agenda-date-nav {
    flex-wrap: wrap;
    justify-content: space-between;
  }
  .agenda-date-label {
    font-size: 19px;
    min-width: 0;
    flex: 1 1 180px;
    text-align: left;
  }
  .segmented {
    max-width: 100%;
    overflow-x: auto;
  }
  .segmented button {
    padding: 6px 10px;
    font-size: 12px;
    white-space: nowrap;
  }
  .overlay {
    padding: 8px;
    align-items: flex-end;
  }
  .modal, .modal.modal-wide {
    max-height: 93dvh;
    border-radius: 20px 20px 14px 14px;
  }
  .modal-header, .modal-body, .modal-footer,
  .drawer-header, .drawer-body {
    padding-left: 16px;
    padding-right: 16px;
  }
  .drawer {
    max-width: 100%;
  }
  /* Evita zoom automatico no Safari iOS ao focar campos */
  .form-input, .form-select, .form-textarea {
    font-size: 16px;
    min-height: 44px;
  }
  .photo-grid {
    grid-template-columns: 1fr;
  }
  .status-pills-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .portal-topbar {
    padding: 12px 14px;
  }
  .portal-hero {
    padding: 24px 16px 18px;
  }
  .portal-hero-logo {
    height: 64px;
  }
  .portal-hero h1 {
    font-size: 29px;
  }
  .portal-proc-option {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .portal-proc-option > div:last-child {
    text-align: left !important;
    display: flex;
    align-items: baseline;
    gap: 12px;
    width: 100%;
    justify-content: space-between;
  }
  .data-table th, .data-table td {
    padding: 10px 12px;
    font-size: 12.5px;
  }
}

@media (max-width: 420px) {
  .hide-xs {
    display: none;
  }
  .kpi-grid, .kpi-grid.kpi-grid-3 {
    grid-template-columns: 1fr;
  }
}

/* =====================================================================
   NOVOS MÓDULOS — Fluxo de Caixa, Automações WhatsApp, Baixa clínica
   ===================================================================== */
.nav-badge.nav-badge-alert {
  background: var(--whatsapp-solid);
  color: #fff;
}

textarea.whatsapp-preview.wa-edit {
  width: 100%;
  resize: vertical;
  font-family: inherit;
  min-height: 170px;
  outline: none;
}
textarea.whatsapp-preview.wa-edit:focus { border-color: var(--gold-400); }
.wa-tabs button { font-size: 11.5px; padding-left: 4px; padding-right: 4px; }

.proc-precare-missing { border-left-color: var(--status-inprogress-fg); background: var(--status-inprogress-bg); }
.proc-aftercare { border-left-color: #6C8474; }

.pin-input { letter-spacing: 0.4em; font-size: 18px; font-variant-numeric: tabular-nums; }
.signoff-section { border: 1.5px dashed var(--gold-400); }
.signoff-section.signed { border-style: solid; border-color: rgba(30,107,69,0.3); }

/* Caixa */
.cash-toolbar { gap: 12px; }
.cash-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cash-session-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 16px; margin-bottom: 16px;
  border-radius: var(--radius-md);
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  font-size: 13px;
}
.cash-session-bar.open { border-color: rgba(30,107,69,0.28); background: var(--status-confirmed-bg); }
.cash-session-bar.closed { background: var(--bg-surface-2); }
.cash-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
  background: var(--status-inprogress-fg); box-shadow: 0 0 0 4px rgba(161,98,7,0.15);
}
.cash-dot.open { background: #22A06B; box-shadow: 0 0 0 4px rgba(34,160,107,0.18); }
.cash-dot.closed { background: var(--text-muted); box-shadow: none; }
.kpi-card-highlight { border-color: var(--gold-400); }
.cash-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.cash-side { display: flex; flex-direction: column; gap: 16px; }
.cash-table tfoot td { border-top: 2px solid var(--border-strong); background: var(--bg-surface-2); padding-top: 12px; padding-bottom: 12px; }
.cash-opening-row td { background: var(--bg-surface-2); color: var(--text-secondary); }
.cash-group-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; }
.cash-group-row + .cash-group-row { border-top: 1px solid var(--border-subtle); }
.cash-total-box {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: var(--radius-md);
  background: var(--gold-tint); border: 1px solid var(--gold-tint-strong); font-size: 13px;
}
.cash-total-box > strong { font-size: 22px; color: var(--gold-700); font-variant-numeric: tabular-nums; }
[data-theme="dark"] .cash-total-box > strong { color: var(--gold-400); }
.cash-item-row, .cash-item-head { display: grid; grid-template-columns: minmax(0, 1fr) 70px 120px 40px; gap: 8px; align-items: center; }
.cash-item-row + .cash-item-row { margin-top: 8px; }
.cash-item-head { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }

/* Automações */
.auto-status-card {
  display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 18px; margin-bottom: 16px; border-radius: var(--radius-lg);
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
}
.auto-status-card.on { background: var(--whatsapp-bg); border-color: rgba(18,140,74,0.25); }
.auto-tabs { flex-wrap: wrap; }
.auto-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.auto-item { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 12px 14px; }
.auto-item + .auto-item { margin-top: 10px; }
.auto-item-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.auto-rules { display: flex; flex-direction: column; }
.auto-rule { display: flex; gap: 14px; align-items: flex-start; padding: 16px 0; }
.auto-rule + .auto-rule { border-top: 1px solid var(--border-subtle); }
.auto-rule strong { font-size: 14px; }
.auto-rule-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.auto-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; }
.auto-inline .form-select { width: auto; padding: 6px 10px; }
.auto-switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; margin-top: 2px; cursor: pointer; }
.auto-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.auto-switch span {
  position: absolute; inset: 0; border-radius: 999px; background: var(--border-strong); transition: background 0.15s ease;
}
.auto-switch span::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-xs); transition: transform 0.15s ease;
}
.auto-switch input:checked + span { background: var(--whatsapp-solid); }
.auto-switch input:checked + span::after { transform: translateX(18px); }
.auto-switch input:focus-visible + span { outline: 2px solid var(--gold-500); outline-offset: 2px; }
.code-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px;
  background: var(--bg-surface-2); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
  padding: 8px 10px; color: var(--text-primary);
}

@media (max-width: 1100px) {
  .cash-layout, .auto-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .cash-item-row, .cash-item-head { grid-template-columns: minmax(0, 1fr) 54px 92px 34px; gap: 6px; }
  .cash-actions .btn { flex: 1; }
}
