/* ═══════════════════════════════════════════════════════════════════════════
   INCISE — Painel de Orçamentos (Fallback Manual)
   Design System: Luxury Clinical & Dark Executive Premium
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Google Fonts ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Design Tokens ────────────────────────────────────────────────────────── */
:root {
  /* =========================================================================
     MODO ESCURO (Padrão - Dark Executive)
     ========================================================================= */
  --bg-deep: #08090C;
  --bg-surface: rgba(14, 18, 27, 0.75);
  --bg-surface-solid: #0E121E;
  --bg-elevated: rgba(22, 28, 41, 0.85);
  --bg-card: rgba(18, 22, 33, 0.75);
  --bg-input: rgba(10, 13, 20, 0.9);
  --bg-hover: rgba(59, 130, 246, 0.08);

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.04);
  --border-default: rgba(255, 255, 255, 0.07);
  --border-focus: #3B82F6;
  --border-accent: rgba(59, 130, 246, 0.4);

  /* Text */
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --text-accent: #60A5FA;
  --text-success: #4ADE80;
  --text-warning: #FBBF24;
  --text-error: #F87171;
  --text-white: #FFFFFF;

  /* Brand */
  --brand-primary: #1B2A6B;
  --brand-light: #3B5BDB;
  --brand-glow: rgba(59, 130, 246, 0.15);

  /* Accents */
  --accent-blue: #3B82F6;
  --accent-green: #22C55E;
  --accent-red: #EF4444;
  --accent-amber: #F59E0B;

  /* Shadows & Glows */
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
  --shadow-premium: 0 12px 32px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 24px rgba(59, 130, 246, 0.07);

  /* Shared Properties */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 150ms var(--ease-out);
  --transition-normal: 300ms var(--ease-out);
  --transition-slow: 500ms var(--ease-out);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --tracking-tight: -0.02em;
  --tracking-tighter: -0.04em;
}

[data-theme="light"] {
  /* =========================================================================
     MODO CLARO (Luxury Clinical)
     ========================================================================= */
  --bg-deep: #F4F6F9;
  --bg-surface: rgba(255, 255, 255, 0.85);
  --bg-surface-solid: #FFFFFF;
  --bg-elevated: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-input: #FFFFFF;
  --bg-hover: rgba(59, 130, 246, 0.06);

  /* Borders */
  --border-subtle: rgba(15, 23, 42, 0.04);
  --border-default: rgba(15, 23, 42, 0.08);
  --border-focus: #2563EB;
  --border-accent: rgba(37, 99, 235, 0.3);

  /* Text */
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;
  --text-accent: #2563EB;
  --text-success: #16A34A;
  --text-warning: #D97706;
  --text-error: #DC2626;
  --text-white: #FFFFFF; /* Mantém branco para legibilidade em botões escuros */

  /* Brand */
  --brand-primary: #1E3A8A;
  --brand-light: #2563EB;
  --brand-glow: rgba(37, 99, 235, 0.08);

  /* Shadows & Glows */
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.06);
  --shadow-premium: 0 10px 30px rgba(15, 23, 42, 0.04);
  --shadow-glow: 0 0 24px rgba(37, 99, 235, 0.04);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-weight: 400;
  color: var(--text-primary);
  background: var(--bg-deep);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Ambient light effect */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 600px;
  background: radial-gradient(
    ellipse 80% 50% at 50% 0%,
    var(--brand-glow) 0%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 0;
  transition: background var(--transition-slow);
}

/* ── Focus Styles (Accessibility) ─────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-accent);
}

/* ═══════════════════════════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════════════════════════ */

.app-container {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  min-height: 100vh;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--border-subtle);
}

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

.app-header__logo {
  height: 36px;
  opacity: 0.9;
  filter: brightness(1.1);
}

.app-header__title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}

.app-header__subtitle {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.app-header__user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.app-header__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-primary), var(--accent-blue));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-white);
}

.btn-logout {
  background: none;
  border: 1px solid var(--border-default);
  color: var(--text-muted);
  padding: 6px 12px;
  font-size: 0.7rem;
  font-family: var(--font-sans);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-logout:hover {
  border-color: var(--accent-red);
  color: var(--text-error);
  background: rgba(239, 68, 68, 0.06);
}

/* ── Theme Toggle Button ─────────────────────────────────────────────────── */
.btn-theme-toggle {
  background: none;
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-theme-toggle:hover {
  border-color: var(--border-accent);
  color: var(--text-accent);
  background: var(--bg-hover);
  transform: rotate(15deg);
}

/* Declarative theme icon visibility */
[data-theme="light"] .theme-icon-moon {
  display: block;
}
[data-theme="light"] .theme-icon-sun {
  display: none;
}
[data-theme="dark"] .theme-icon-moon {
  display: none;
}
[data-theme="dark"] .theme-icon-sun {
  display: block;
}

.theme-icon-moon,
.theme-icon-sun {
  display: none;
  stroke-width: 2.2px;
  transition: transform var(--transition-normal);
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOGIN SCREEN
   ═══════════════════════════════════════════════════════════════════════════ */

.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  animation: fadeInUp 250ms var(--ease-out);
  will-change: transform, opacity;
  transform: translateZ(0);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-surface);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 44px 36px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  position: relative;
  overflow: hidden;
  transition: background var(--transition-normal), border var(--transition-normal);
}

/* Glassmorphism top glow no modo escuro */
[data-theme="dark"] .login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
}

.login-card__logo {
  display: block;
  height: 48px;
  margin: 0 auto 12px;
  opacity: 0.95;
}

.login-card__title {
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: var(--tracking-tighter);
  margin-bottom: 6px;
  color: var(--text-primary);
}

.login-card__desc {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

.login-card__badge {
  display: inline-block;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid var(--border-accent);
  color: var(--text-accent);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 28px;
  display: block;
  text-align: center;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════════════════════════════════════════ */

.form-group {
  margin-bottom: 22px;
}

.form-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 13px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-primary);
  transition: all var(--transition-normal);
  -webkit-appearance: none;
}

.form-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
  opacity: 0.8;
}

.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px var(--brand-glow);
  background: var(--bg-surface-solid);
}

.form-input:hover:not(:focus) {
  border-color: var(--border-accent);
}

.form-input--pin {
  text-align: center;
  letter-spacing: 12px;
  font-size: 1.45rem;
  font-weight: 700;
  padding-left: 28px; /* Ajusta centralização devido ao letter-spacing */
}

.form-input--error {
  border-color: var(--accent-red) !important;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1) !important;
}

.form-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
}

.form-error {
  font-size: 0.78rem;
  color: var(--text-error);
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  animation: fadeInUp 250ms var(--ease-out);
}

.form-error::before {
  content: '⚠';
  font-size: 0.85rem;
}

/* Select */
.form-select {
  width: 100%;
  padding: 13px 16px;
  padding-right: 40px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-normal);
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}

[data-theme="light"] .form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

.form-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px var(--brand-glow);
  background: var(--bg-surface-solid);
}

.form-select:hover:not(:focus) {
  border-color: var(--border-accent);
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-light));
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}
.btn--primary:hover {
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35), 0 0 40px var(--brand-glow);
  transform: translateY(-1px);
}
.btn--primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn--success {
  background: linear-gradient(135deg, #15803d, var(--accent-green));
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2);
}
.btn--success:hover {
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.3);
  transform: translateY(-1px);
}

.btn--ghost {
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
}
.btn--ghost:hover {
  border-color: var(--border-accent);
  color: var(--text-accent);
  background: var(--bg-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn--danger {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.15);
  color: var(--text-error);
}
.btn--danger:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  transform: translateY(-1px);
}

.btn--full {
  width: 100%;
}

.btn--sm {
  padding: 8px 16px;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
}

/* Button loading spinner */
.btn__spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

.btn-icon-svg {
  stroke-width: 2.2px;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CARDS & SECTIONS
   ═══════════════════════════════════════════════════════════════════════════ */

.section {
  margin-bottom: 24px;
  animation: fadeInUp 250ms var(--ease-out);
  will-change: transform, opacity;
  transform: translateZ(0);
}

.section__title {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section__title::before {
  content: '';
  width: 3px;
  height: 14px;
  background: var(--accent-blue);
  border-radius: 2px;
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  position: relative;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PROCEDURE LIST
   ═══════════════════════════════════════════════════════════════════════════ */

.proc-search-wrapper {
  position: relative;
  margin-bottom: 16px;
}

.proc-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 0.85rem;
}

.proc-search-input {
  width: 100%;
  padding: 12px 16px 12px 40px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-primary);
  transition: all var(--transition-fast);
}
.proc-search-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.proc-search-input::placeholder {
  color: var(--text-muted);
}

/* Autocomplete dropdown */
.proc-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  max-height: 240px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 200ms var(--ease-out);
}
.proc-dropdown[hidden] {
  display: none;
}

.proc-dropdown__item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  cursor: pointer;
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.85rem;
}
.proc-dropdown__item:last-child {
  border-bottom: none;
}
.proc-dropdown__item:hover,
.proc-dropdown__item--active {
  background: var(--bg-hover);
}
.proc-dropdown__item__name {
  color: var(--text-primary);
  font-weight: 500;
}
.proc-dropdown__item__price {
  color: var(--text-accent);
  font-weight: 600;
  font-size: 0.8rem;
  white-space: nowrap;
}

/* Procedure items in the list */
.proc-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 60px;
}

.proc-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  animation: fadeInUp 200ms var(--ease-out);
}
.proc-item:hover {
  border-color: var(--border-accent);
}

.proc-item__main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.proc-item__name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.proc-item__price {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-accent);
  white-space: nowrap;
  text-align: right;
  min-width: 80px;
}

.proc-item__controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Badges interativos (botões) */
.proc-item__badge-btn {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}
.proc-item__badge-btn:hover {
  border-color: var(--accent-orange);
  color: var(--text-warning);
  background: rgba(251, 191, 36, 0.05);
}
.proc-item__badge-btn--active {
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.2);
  color: var(--text-warning);
}
.proc-item__badge-btn--active:hover {
  background: rgba(251, 191, 36, 0.18);
}

/* Select de Alternativas minimalista */
.proc-item__select-alt {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  cursor: pointer;
  outline: none;
  transition: all var(--transition-fast);
}
.proc-item__select-alt:hover {
  border-color: var(--accent-blue);
  color: var(--text-accent);
}
.proc-item__select-alt option {
  background: var(--bg-surface-solid);
  color: var(--text-primary);
}

.proc-item__badge {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  white-space: nowrap;
}
.proc-item__badge--opcional {
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.2);
  color: var(--text-warning);
}
.proc-item__badge--alt {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: var(--text-accent);
}

.proc-item__remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 1rem;
  line-height: 1;
  transition: color var(--transition-fast);
  border-radius: 4px;
}
.proc-item__remove:hover {
  color: var(--text-error);
  background: rgba(239, 68, 68, 0.1);
}

/* Procedimento Personalizado (Não Tabelado) */
.proc-custom-actions {
  display: flex;
  margin-top: 8px;
  margin-bottom: 4px;
}
.btn-custom-trigger {
  background: none;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.btn-custom-trigger:hover {
  background: var(--brand-glow);
  color: var(--text-primary);
}

.custom-proc-form {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 8px;
  margin-bottom: 12px;
  animation: fadeInUp 250ms var(--ease-out);
}
.custom-proc-form__row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.custom-proc-form__price-group {
  width: 140px;
  flex-shrink: 0;
}

/* OU separator */
.proc-ou-separator {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-blue);
  letter-spacing: 2px;
  padding: 2px 0;
}

.proc-empty {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOGGLES / SWITCHES
   ═══════════════════════════════════════════════════════════════════════════ */

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.toggle-row:last-child {
  border-bottom: none;
}

.toggle-row__label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}

.toggle-row__desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-switch__slider {
  position: absolute;
  inset: 0;
  background: var(--border-default);
  border-radius: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.toggle-switch__slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--bg-surface-solid);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.toggle-switch input:checked + .toggle-switch__slider {
  background: var(--accent-blue);
}
.toggle-switch input:checked + .toggle-switch__slider::before {
  transform: translateX(20px);
  background: #fff;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOTALS BAR
   ═══════════════════════════════════════════════════════════════════════════ */

.totals-bar {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-top: 16px;
}

.totals-bar__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
}

.totals-bar__label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.totals-bar__value {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 600;
}

.totals-bar__divider {
  height: 1px;
  background: var(--border-default);
  margin: 8px 0;
}

.totals-bar__row--total {
  padding: 10px 0 4px;
}

.totals-bar__row--total .totals-bar__label {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 700;
}

.totals-bar__row--total .totals-bar__value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-accent);
  letter-spacing: var(--tracking-tight);
}

.totals-bar__row--discount .totals-bar__value {
  color: var(--text-success);
}

/* ═══════════════════════════════════════════════════════════════════════════
   DISCOUNT SECTION
   ═══════════════════════════════════════════════════════════════════════════ */

.discount-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.discount-row .form-input {
  flex: 1;
  min-width: 0;
}

.discount-type-toggle {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
}

.discount-type-toggle__btn {
  padding: 10px 14px;
  background: transparent;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.discount-type-toggle__btn--active {
  background: var(--accent-blue);
  color: var(--text-white);
}

/* ═══════════════════════════════════════════════════════════════════════════
   HISTORY TABLE
   ═══════════════════════════════════════════════════════════════════════════ */

.history-table {
  width: 100%;
  border-collapse: collapse;
}

.history-table thead th {
  text-align: left;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-default);
}

.history-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
}
.history-table tbody tr:hover {
  background: var(--bg-hover);
}

.history-table tbody td {
  padding: 12px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  vertical-align: middle;
}

.history-table .col-paciente {
  font-weight: 600;
  color: var(--text-primary);
}

.history-table .col-valor {
  font-weight: 700;
  color: var(--text-accent);
  white-space: nowrap;
}

/* Status badges */
.status-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.status-badge--pendente {
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.2);
  color: var(--text-warning);
}
.status-badge--agendado {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: var(--text-success);
}
.status-badge--recusado {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--text-error);
}
.status-badge--encerrado {
  background: rgba(100, 116, 139, 0.1);
  border: 1px solid rgba(100, 116, 139, 0.2);
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TABS
   ═══════════════════════════════════════════════════════════════════════════ */

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 4px;
  border: 1px solid var(--border-subtle);
}

.tab {
  flex: 1;
  padding: 10px 16px;
  background: transparent;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  text-align: center;
}
.tab:hover {
  color: var(--text-secondary);
}
.tab--active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.tab-content {
  display: none;
  animation: fadeInUp 300ms var(--ease-out);
}
.tab-content--active {
  display: block;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════════════════ */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  font-size: 0.8rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 400px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInRight 400ms var(--ease-out);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.toast--success {
  border-left: 3px solid var(--accent-green);
}
.toast--error {
  border-left: 3px solid var(--accent-red);
}
.toast--info {
  border-left: 3px solid var(--accent-blue);
}

.toast--leaving {
  animation: slideOutRight 300ms var(--ease-out) forwards;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SKELETON LOADING
   ═══════════════════════════════════════════════════════════════════════════ */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-elevated) 25%,
    rgba(255, 255, 255, 0.04) 50%,
    var(--bg-elevated) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton--text {
  height: 14px;
  margin-bottom: 8px;
}
.skeleton--text:last-child {
  width: 60%;
}

.skeleton--row {
  height: 48px;
  margin-bottom: 8px;
  border-radius: var(--radius-md);
}

/* ═══════════════════════════════════════════════════════════════════════════
   STATUS INDICATOR (bot health)
   ═══════════════════════════════════════════════════════════════════════════ */

.bot-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.7rem;
  color: var(--text-muted);
  padding: 8px 14px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.bot-status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.bot-status__dot--online {
  background: var(--accent-green);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
  animation: pulse 2s infinite;
}
.bot-status__dot--offline {
  background: var(--accent-red);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

/* ═══════════════════════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════════════════════ */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(40px);
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .app-container {
    padding: 16px 14px 40px;
  }

  .app-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .app-header__user {
    width: 100%;
    justify-content: space-between;
  }

  .card {
    padding: 18px;
    border-radius: var(--radius-md);
  }

  /* Evita que o iOS dê zoom automático nos campos (exige pelo menos 16px/1rem de font-size) */
  .form-input,
  .form-select,
  .proc-search-input {
    font-size: 16px !important;
    padding: 14px 16px; /* Touch target confortável para o toque */
  }

  .proc-item {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 14px;
  }

  .proc-item__main {
    justify-content: space-between;
  }

  .proc-item__controls {
    justify-content: space-between;
    border-top: 1px solid var(--border-subtle);
    padding-top: 8px;
    width: 100%;
  }

  .proc-item__price {
    min-width: auto;
  }

  .custom-proc-form__row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .custom-proc-form__price-group {
    width: 100%;
  }

  .discount-row {
    flex-direction: row;
    gap: 8px;
  }
  
  .discount-row .form-input {
    flex: 1;
  }

  .history-table {
    font-size: 0.78rem;
  }

  .tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
  }
  .tab {
    padding: 12px 10px;
    font-size: 0.85rem;
  }

  .totals-bar__row--total .totals-bar__value {
    font-size: 1.1rem;
  }

  /* Botões de Ações empilhados verticalmente no celular para facilitar o clique com uma mão */
  .app-container .flex-end {
    flex-direction: column-reverse;
    width: 100%;
    gap: 8px;
  }
  
  .app-container .flex-end .btn {
    width: 100%;
    padding: 14px 20px; /* Touch target estendido para mobile */
    font-size: 0.92rem;
  }

  .proc-dropdown__item {
    padding: 14px 16px; /* Altura confortável para toques em dispositivos móveis */
  }

  .proc-item__remove {
    padding: 8px 12px; /* Amplia área de toque no celular */
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  .login-card {
    padding: 28px 20px;
    border-radius: var(--radius-lg);
  }

  /* Mobile UX de Luxo: Oculta colunas menos relevantes e foca nas críticas */
  .history-table thead th:nth-child(1), /* Data */
  .history-table tbody td:nth-child(1),
  .history-table thead th:nth-child(3), /* Tutor */
  .history-table tbody td:nth-child(3),
  .history-table thead th:nth-child(6), /* Criado por */
  .history-table tbody td:nth-child(6) {
    display: none;
  }

  .history-table thead th,
  .history-table tbody td {
    padding: 10px 6px;
    font-size: 0.78rem;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PIN SETUP MODAL
   ═══════════════════════════════════════════════════════════════════════════ */

.pin-setup-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeInUp 300ms var(--ease-out);
}

.pin-setup-modal {
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-default);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 400ms var(--ease-out);
}

.pin-setup-modal__icon {
  font-size: 2.5rem;
  text-align: center;
  margin-bottom: 16px;
  animation: pulse 2s infinite;
}

.pin-setup-modal__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  letter-spacing: var(--tracking-tight);
  margin: 0 0 8px;
}

.pin-setup-modal__desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.6;
  margin: 0 0 24px;
}

.pin-setup-modal__desc strong {
  color: var(--text-accent);
}

.pin-setup-modal__hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  margin: 16px 0 0;
  line-height: 1.5;
  font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════════════════
   WHATSAPP CONNECTION PANEL
   ═══════════════════════════════════════════════════════════════════════════ */

/* Tab badge de status (ponto colorido na aba WhatsApp) */
.wa-tab-badge {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: 6px;
  vertical-align: middle;
  flex-shrink: 0;
  transition: background var(--transition-normal), box-shadow var(--transition-normal);
}
.wa-tab-badge--open {
  background: var(--accent-green);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
  animation: pulse 2s infinite;
}
.wa-tab-badge--close {
  background: var(--accent-red);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}
.wa-tab-badge--unknown {
  background: var(--text-muted);
}

/* Aba exclusiva de admin */
.tab--admin {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Status Row */
.wa-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.wa-status-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wa-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  transition: all var(--transition-normal);
}
.wa-status-badge__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.wa-status-badge--open {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.25);
  color: var(--text-success);
}
.wa-status-badge--open .wa-status-badge__dot {
  background: var(--accent-green);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
  animation: pulse 2s infinite;
}
.wa-status-badge--close {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.25);
  color: var(--text-error);
}
.wa-status-badge--close .wa-status-badge__dot {
  background: var(--accent-red);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}
.wa-status-badge--unknown {
  background: var(--bg-elevated);
  border-color: var(--border-default);
  color: var(--text-muted);
}
.wa-status-badge--unknown .wa-status-badge__dot {
  background: var(--text-muted);
}

.wa-status-instance {
  font-size: 0.72rem;
  color: var(--text-muted);
  padding-left: 4px;
}

.wa-status-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* Botão small */
.btn--sm {
  padding: 7px 14px;
  font-size: 0.78rem;
}

/* Botão danger (ghost vermelho) */
.btn--danger {
  color: var(--text-error);
  border-color: rgba(239, 68, 68, 0.3);
}
.btn--danger:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.5);
}

/* QR Code Area */
.wa-qr-area {
  animation: fadeInUp 300ms var(--ease-out);
}

.wa-qr-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 24px;
  padding: 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.wa-qr-header__icon {
  color: var(--text-accent);
  flex-shrink: 0;
  margin-top: 2px;
}

.wa-qr-header__title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.wa-qr-header__desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.wa-qr-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  margin: 0 auto 16px;
  max-width: 280px;
  position: relative;
}

.wa-qr-img {
  width: 260px;
  height: 260px;
  border-radius: var(--radius-md);
  border: 3px solid var(--border-default);
  background: #fff;
  display: block;
  object-fit: contain;
  box-shadow: var(--shadow-md);
  transition: opacity var(--transition-normal);
}
.wa-qr-img[src=""] {
  display: none;
}

.wa-qr-loading {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.wa-qr-loading--visible {
  display: flex;
}
.wa-qr-loading .btn__spinner {
  width: 28px;
  height: 28px;
  border-width: 3px;
}

.wa-qr-timer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  min-height: 20px;
}
.wa-qr-timer--warning {
  color: var(--text-warning);
  font-weight: 600;
}

.wa-qr-actions {
  display: flex;
  justify-content: center;
}

/* Connect Area (estado desconectado) */
.wa-connect-area {
  text-align: center;
  padding: 32px 0 8px;
  animation: fadeInUp 300ms var(--ease-out);
}

.wa-connect-hint {
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Success Area */
.wa-success-area {
  text-align: center;
  padding: 32px 0;
  animation: fadeInUp 400ms var(--ease-out);
}

.wa-success-icon {
  color: var(--text-success);
  margin-bottom: 16px;
  animation: fadeInUp 300ms var(--ease-out);
}

.wa-success-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
  margin-bottom: 8px;
}

.wa-success-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* Responsivo mobile */
@media (max-width: 768px) {
  .wa-status-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .wa-qr-wrapper {
    max-width: 100%;
  }
  .wa-qr-img {
    width: 220px;
    height: 220px;
  }
  .wa-qr-header {
    flex-direction: column;
    gap: 10px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════════════════════ */

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.text-center {
  text-align: center;
}

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

.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-12 { gap: 12px; }
.flex { display: flex; }
.flex-end { justify-content: flex-end; }
.items-center { align-items: center; }

/* ═══════════════════════════════════════════════════════════════════════════
   GESTÃO TAB — Badge + Acesso
   ═══════════════════════════════════════════════════════════════════════════ */

.tab--gestor {
  position: relative;
}

.gestao-tab-badge {
  display: inline-block;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.08));
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #FBBF24;
  font-size: 0.5rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  vertical-align: middle;
  margin-left: 4px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   GESTÃO DASHBOARD — Layout
   ═══════════════════════════════════════════════════════════════════════════ */

.gestao-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.gestao-header__subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.gestao-header__subtitle::before {
  content: '🔒';
  font-size: 0.65rem;
}

.gestao-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.gestao-section-title::before {
  content: '';
  width: 2px;
  height: 12px;
  background: var(--accent-amber);
  border-radius: 2px;
}

.gestao-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

@media (max-width: 640px) {
  .gestao-two-col {
    grid-template-columns: 1fr;
  }
}

/* ── Loading & Error States ───────────────────────────────────────────────── */

.gestao-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  animation: fadeInUp 200ms var(--ease-out);
}

.gestao-loading__spinner {
  width: 20px;
  height: 20px;
  border-width: 2px;
  border-color: rgba(59, 130, 246, 0.25);
  border-top-color: var(--accent-blue);
}

.gestao-error {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px 24px;
  color: var(--text-error);
  font-size: 0.85rem;
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   KPI GRID — 3 Períodos Simultâneos
   ═══════════════════════════════════════════════════════════════════════════ */

.periodo-labels {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
  margin-left: 160px; /* alinha com kpi-cells */
}

@media (max-width: 600px) {
  .periodo-labels {
    margin-left: 0;
    grid-template-columns: 1fr;
  }
}

.periodo-label {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-align: center;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}

.periodo-label--semana {
  color: #60A5FA;
  background: rgba(96, 165, 250, 0.08);
  border-color: rgba(96, 165, 250, 0.2);
}

.periodo-label--mes {
  color: #A78BFA;
  background: rgba(167, 139, 250, 0.08);
  border-color: rgba(167, 139, 250, 0.2);
}

.periodo-label--trimestre {
  color: #34D399;
  background: rgba(52, 211, 153, 0.08);
  border-color: rgba(52, 211, 153, 0.2);
}

.kpi-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
  border-radius: var(--radius-sm);
}

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

.kpi-row:hover {
  background: var(--bg-hover);
}

.kpi-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  width: 150px;
  flex-shrink: 0;
}

.kpi-cells {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  flex: 1;
}

.kpi-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  min-width: 0;
}

.kpi-cell--semana {
  background: rgba(96, 165, 250, 0.06);
  border: 1px solid rgba(96, 165, 250, 0.12);
}

.kpi-cell--mes {
  background: rgba(167, 139, 250, 0.06);
  border: 1px solid rgba(167, 139, 250, 0.12);
}

.kpi-cell--trimestre {
  background: rgba(52, 211, 153, 0.06);
  border: 1px solid rgba(52, 211, 153, 0.12);
}

.kpi-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
  text-align: center;
}

.kpi-value--accent { color: var(--text-accent); }
.kpi-value--green  { color: var(--text-success); }
.kpi-value--warn   { color: var(--text-warning); }

@media (max-width: 600px) {
  .kpi-label { width: 100%; margin-bottom: 4px; }
  .kpi-row { flex-direction: column; align-items: stretch; }
  .kpi-cells { grid-template-columns: 1fr 1fr 1fr; }
  .periodo-labels { margin-left: 0; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   TREND CHART — SVG Nativo
   ═══════════════════════════════════════════════════════════════════════════ */

.trend-chart-wrapper {
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius-md);
}

.trend-svg {
  width: 100%;
  height: auto;
  max-height: 200px;
  display: block;
}

.trend-legend {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 12px;
  justify-content: center;
}

.trend-legend__item {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.trend-legend__item::before {
  content: '';
  width: 12px;
  height: 4px;
  border-radius: 2px;
}

.trend-legend__item--total::before {
  background: rgba(96, 165, 250, 0.6);
}

.trend-legend__item--agendados::before {
  background: rgba(52, 211, 153, 0.8);
}

/* ═══════════════════════════════════════════════════════════════════════════
   GESTÃO TABLES — Equipe & Clínicas
   ═══════════════════════════════════════════════════════════════════════════ */

.gestao-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.82rem;
}

.gestao-table thead tr {
  background: transparent;
}

.gestao-table th {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.gestao-table td {
  padding: 12px 12px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

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

.gestao-table tbody tr:hover td {
  background: var(--bg-hover);
}

.gestao-table__empty {
  text-align: center;
  color: var(--text-muted);
  padding: 24px !important;
  font-style: italic;
  font-size: 0.8rem;
}

/* Medalhas de ranking */
.rank-medal {
  font-size: 0.8rem;
  font-weight: 800;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.rank-medal--1 {
  background: rgba(251, 191, 36, 0.15);
  color: #FBBF24;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.rank-medal--2 {
  background: rgba(148, 163, 184, 0.15);
  color: #94A3B8;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.rank-medal--3 {
  background: rgba(180, 120, 60, 0.15);
  color: #B45309;
  border: 1px solid rgba(180, 120, 60, 0.3);
}

/* Progress bar inline para taxa de conversão */
.conv-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.conv-bar__track {
  flex: 1;
  height: 4px;
  background: var(--border-subtle);
  border-radius: 2px;
  overflow: hidden;
  min-width: 40px;
}

.conv-bar__fill {
  height: 100%;
  border-radius: 2px;
  transition: width 600ms var(--ease-out);
  will-change: width;
  transform: translateZ(0);
}

.conv-bar__fill--high   { background: var(--accent-green); }
.conv-bar__fill--mid    { background: var(--accent-amber); }
.conv-bar__fill--low    { background: var(--accent-red); }

.conv-bar__pct {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
  min-width: 36px;
  text-align: right;
}

/* Status badges nas linhas da tabela */
.status-mini {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
}

.status-mini__pill {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.status-mini__pill--pendente  { background: rgba(251, 191, 36, 0.12); color: #FBBF24; }
.status-mini__pill--recusado  { background: rgba(239, 68, 68, 0.12);  color: #F87171; }
.status-mini__pill--encerrado { background: rgba(100, 116, 139, 0.12); color: #94A3B8; }

/* ═══════════════════════════════════════════════════════════════════════════
   FOLLOW-UP BARS
   ═══════════════════════════════════════════════════════════════════════════ */

.followup-bars {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.followup-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.followup-item__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.followup-item__label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.followup-item__stats {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.followup-item__stats strong {
  color: var(--text-success);
}

.followup-bar__track {
  width: 100%;
  height: 6px;
  background: var(--border-subtle);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.followup-bar__fill {
  height: 100%;
  border-radius: 3px;
  transition: width 800ms var(--ease-out);
  will-change: width;
  transform: translateZ(0);
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-green));
}

.followup-item__eficacia {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: right;
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RECUSAS LIST
   ═══════════════════════════════════════════════════════════════════════════ */

.recusas-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recusa-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.recusa-item__motivo {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
  line-height: 1.3;
}

.recusa-item__count {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-error);
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.recusa-item__bar {
  width: 100%;
  height: 3px;
  background: var(--border-subtle);
  border-radius: 2px;
  overflow: hidden;
}

.recusa-item__bar-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.6), rgba(239, 68, 68, 0.3));
  border-radius: 2px;
  transition: width 700ms var(--ease-out);
  will-change: width;
  transform: translateZ(0);
}

/* ═══════════════════════════════════════════════════════════════════════════
   GESTÃO TIMESTAMP
   ═══════════════════════════════════════════════════════════════════════════ */

.gestao-timestamp {
  text-align: center;
  font-size: 0.65rem;
  color: var(--text-muted);
  padding: 16px 0 8px;
  opacity: 0.7;
}
