@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  /* ================= TEMA CLARO (PADRÃO) ================= */
  --bg-main: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-surface-solid: #ffffff;
  --bg-card: #ffffff;
  --bg-card-solid: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-glass: rgba(255, 255, 255, 0.92);
  --bg-glass-subtle: rgba(0, 0, 0, 0.02);
  
  /* Brand & Accents */
  --primary: #0284c7;
  --primary-light: #0284c7;
  --primary-dark: #0369a1;
  --primary-glow: rgba(2, 132, 199, 0.2);
  --primary-gradient: linear-gradient(135deg, #0284c7 0%, #06b6d4 100%);
  --primary-gradient-hover: linear-gradient(135deg, #0369a1 0%, #0891b2 100%);
  
  --accent-cyan: #0891b2;
  --accent-blue: #2563eb;
  --accent-emerald: #059669;
  --accent-amber: #d97706;
  --accent-rose: #e11d48;
  --accent-purple: #7c3aed;
  --accent-indigo: #4f46e5;
  
  /* Text Colors */
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --text-inverse: #ffffff;
  
  /* Borders & Dividers */
  --border-color: rgba(0, 0, 0, 0.08);
  --border-glow: rgba(2, 132, 199, 0.3);
  --border-focus: rgba(2, 132, 199, 0.5);
  --border-subtle: rgba(0, 0, 0, 0.04);
  
  /* Status Colors */
  --status-agendado-bg: rgba(124, 58, 237, 0.08);
  --status-agendado-border: rgba(124, 58, 237, 0.25);
  --status-agendado-text: #7c3aed;
  
  --status-em_rota-bg: rgba(2, 132, 199, 0.08);
  --status-em_rota-border: rgba(2, 132, 199, 0.25);
  --status-em_rota-text: #0284c7;
  
  --status-no_local-bg: rgba(217, 119, 6, 0.08);
  --status-no_local-border: rgba(217, 119, 6, 0.25);
  --status-no_local-text: #d97706;
  
  --status-concluido-bg: rgba(5, 150, 105, 0.08);
  --status-concluido-border: rgba(5, 150, 105, 0.25);
  --status-concluido-text: #059669;
  
  --status-cancelado-bg: rgba(225, 29, 72, 0.08);
  --status-cancelado-border: rgba(225, 29, 72, 0.25);
  --status-cancelado-text: #e11d48;

  /* Shadows & Elevation */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.08), 0 2px 6px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 28px -4px rgba(0, 0, 0, 0.12), 0 4px 12px -2px rgba(0, 0, 0, 0.06);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  
  /* Geometry */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 9999px;
  
  --sidebar-width: 230px;
  --sidebar-collapsed-width: 68px;
  --header-height: 60px;
  
  --font-heading: 'Plus Jakarta Sans', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ================= TEMA ESCURO ================= */
[data-theme="dark"] {
  --bg-main: #090d16;
  --bg-surface: rgba(16, 24, 40, 0.75);
  --bg-surface-solid: #101828;
  --bg-card: rgba(22, 33, 54, 0.65);
  --bg-card-solid: #152238;
  --bg-card-hover: rgba(30, 47, 76, 0.85);
  --bg-glass: rgba(13, 20, 36, 0.85);
  --bg-glass-subtle: rgba(255, 255, 255, 0.03);
  
  --primary: #0284c7;
  --primary-light: #38bdf8;
  --primary-dark: #0369a1;
  --primary-glow: rgba(56, 189, 248, 0.35);
  --primary-gradient: linear-gradient(135deg, #0284c7 0%, #06b6d4 100%);
  --primary-gradient-hover: linear-gradient(135deg, #38bdf8 0%, #22d3ee 100%);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --text-inverse: #0b1120;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(56, 189, 248, 0.4);
  --border-focus: rgba(56, 189, 248, 0.6);
  --border-subtle: rgba(255, 255, 255, 0.04);
  
  --status-agendado-bg: rgba(139, 92, 246, 0.12);
  --status-agendado-border: rgba(139, 92, 246, 0.35);
  --status-agendado-text: #c084fc;
  
  --status-em_rota-bg: rgba(6, 182, 212, 0.12);
  --status-em_rota-border: rgba(6, 182, 212, 0.35);
  --status-em_rota-text: #38bdf8;
  
  --status-no_local-bg: rgba(245, 158, 11, 0.12);
  --status-no_local-border: rgba(245, 158, 11, 0.35);
  --status-no_local-text: #fbbf24;
  
  --status-concluido-bg: rgba(16, 185, 129, 0.12);
  --status-concluido-border: rgba(16, 185, 129, 0.35);
  --status-concluido-text: #34d399;
  
  --status-cancelado-bg: rgba(244, 63, 94, 0.12);
  --status-cancelado-border: rgba(244, 63, 94, 0.35);
  --status-cancelado-text: #fb7185;

  --shadow-sm: 0 2px 8px -2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px -4px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 40px -8px rgba(0, 0, 0, 0.65);
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.25);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.55;
  overflow-x: hidden;
  letter-spacing: -0.01em;
  transition: background-color 0.25s ease, color 0.25s ease;
}

[data-theme="dark"] body {
  background-image: 
    radial-gradient(circle at 10% 0%, rgba(2, 132, 199, 0.12) 0%, transparent 45%),
    radial-gradient(circle at 90% 100%, rgba(6, 182, 212, 0.08) 0%, transparent 50%);
  background-attachment: fixed;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.25);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.45);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-main);
}

/* Layout Core */
#app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* ================= SIDEBAR & RECOLHIMENTO ================= */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: width 0.28s cubic-bezier(0.16, 1, 0.3, 1), transform 0.28s ease, background-color 0.25s ease;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* Sidebar Recolhida (Collapsed) */
#app-layout.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-width);
}

#app-layout.sidebar-collapsed .brand-text,
#app-layout.sidebar-collapsed .nav-section-title,
#app-layout.sidebar-collapsed .nav-item span,
#app-layout.sidebar-collapsed .nav-badge,
#app-layout.sidebar-collapsed .user-info {
  display: none !important;
}

#app-layout.sidebar-collapsed .sidebar-header {
  padding: 1.2rem 0.85rem;
  justify-content: center;
}

#app-layout.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 0.75rem 0;
}

#app-layout.sidebar-collapsed .sidebar-footer {
  padding: 0.85rem 0.5rem;
  justify-content: center;
}

#app-layout.sidebar-collapsed .btn-logout .btn-logout-text {
  display: none;
}

.sidebar-header {
  padding: 1.2rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: var(--primary-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
  flex-shrink: 0;
}

.brand-icon svg {
  width: 20px;
  height: 20px;
  fill: #ffffff;
}

.brand-text h2 {
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  white-space: nowrap;
}

.brand-text span {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
  display: block;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sidebar-nav {
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 700;
  padding: 0.75rem 0.75rem 0.25rem 0.75rem;
  white-space: nowrap;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  user-select: none;
  white-space: nowrap;
}

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

.nav-item.active {
  background: rgba(2, 132, 199, 0.1);
  border-color: rgba(2, 132, 199, 0.25);
  color: var(--primary);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  font-size: 0.7rem;
  background: rgba(2, 132, 199, 0.12);
  color: var(--primary);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-family: var(--font-mono);
}

.sidebar-footer {
  padding: 0.85rem 1.1rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
}

.user-mini {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* User Menu Header & Dropdown */
.user-header-menu-container {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.btn-user-avatar-trigger {
  background: transparent;
  border: 2px solid transparent;
  padding: 2px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.btn-user-avatar-trigger:hover,
.btn-user-avatar-trigger:focus-visible,
.user-header-menu-container.is-open .btn-user-avatar-trigger {
  border-color: rgba(2, 132, 199, 0.45);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
  transform: scale(1.04);
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 250px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.22), 0 4px 12px -2px rgba(0, 0, 0, 0.12);
  padding: 0.85rem;
  z-index: 250;
  animation: userMenuPop 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

@keyframes userMenuPop {
  0% {
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.user-menu-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0.25rem 0.65rem 0.25rem;
}

.user-avatar-lg {
  width: 42px !important;
  height: 42px !important;
  font-size: 0.95rem !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
}

.user-menu-header .user-info {
  flex: 1;
  min-width: 0;
}

.user-menu-header .user-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-menu-header .user-role {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: capitalize;
  margin-top: 2px;
}

.user-menu-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 0.4rem 0 0.55rem 0;
}

.user-menu-actions {
  display: flex;
  flex-direction: column;
}

.user-menu-btn-logout {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: #ef4444;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.user-menu-btn-logout:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
  color: #dc2626;
  transform: translateX(2px);
}

.user-menu-btn-logout svg {
  flex-shrink: 0;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #0284c7, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: #fff;
  flex-shrink: 0;
}

.user-info {
  line-height: 1.2;
  white-space: nowrap;
}

.user-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
}

.user-role {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: capitalize;
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-logout:hover {
  background: rgba(225, 29, 72, 0.1);
  color: var(--accent-rose);
}

/* ================= MAIN WRAPPER ================= */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

#app-layout.sidebar-collapsed .main-wrapper {
  margin-left: var(--sidebar-collapsed-width);
}

.top-header {
  height: var(--header-height);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 90;
  transition: background-color 0.25s ease;
}

.header-left-group {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.btn-toggle-sidebar {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-toggle-sidebar:hover {
  color: var(--text-main);
  background: var(--bg-card-hover);
  border-color: rgba(2, 132, 199, 0.3);
}

.page-title h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.page-title span {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-muted);
  display: block;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

/* Theme Toggle Button */
.btn-theme-toggle {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 1.05rem;
}

.btn-theme-toggle:hover {
  color: var(--text-main);
  background: var(--bg-card-hover);
}

.content-container {
  padding: 1.5rem;
  flex: 1;
}

body:has(#module-financeiro[style*="display: block"]) .content-container,
body:has(#module-financeiro[style*="display:block"]) .content-container,
.content-container:has(#module-financeiro[style*="display: block"]),
.content-container:has(#module-financeiro[style*="display:block"]) {
  padding: 0 !important;
}

/* ================= BUTTONS ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  text-align: center;
  white-space: nowrap;
  user-select: none;
}

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

.btn-primary {
  background: var(--primary-gradient);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
}

.btn-primary:hover {
  background: var(--primary-gradient-hover);
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
  transform: translateY(-1px);
  color: #ffffff;
}

.btn-secondary {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

.btn-danger {
  background: rgba(225, 29, 72, 0.1);
  border: 1px solid rgba(225, 29, 72, 0.25);
  color: var(--accent-rose);
}

.btn-danger:hover {
  background: var(--accent-rose);
  color: #fff;
  transform: translateY(-1px);
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

/* ================= FORMS & INPUTS ================= */
.form-group {
  margin-bottom: 1.1rem;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-control {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  color: var(--text-main);
  outline: none;
  transition: var(--transition);
  font-size: 0.88rem;
}

.form-control::placeholder {
  color: var(--text-dim);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' 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 0.85rem center;
  padding-right: 2.2rem;
  cursor: pointer;
}

/* ================= SEARCHABLE SELECT / AUTOCOMPLETE ================= */
.searchable-select {
  position: relative;
  width: 100%;
}

.searchable-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.searchable-input-wrapper .search-icon {
  position: absolute;
  left: 0.85rem;
  color: var(--text-dim);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.searchable-input-wrapper .search-clear-btn {
  position: absolute;
  right: 2.2rem;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.2rem;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  transition: var(--transition);
}

.searchable-input-wrapper .search-clear-btn:hover {
  color: var(--accent-rose);
  background: rgba(225, 29, 72, 0.1);
}

.searchable-input-wrapper .search-arrow-icon {
  position: absolute;
  right: 0.85rem;
  color: var(--text-dim);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.searchable-select.is-open .search-arrow-icon {
  transform: rotate(180deg);
  color: var(--primary);
}

.searchable-select.is-open .search-icon {
  color: var(--primary);
}

.searchable-input {
  width: 100%;
  padding-left: 2.35rem !important;
  padding-right: 3.2rem !important;
  cursor: text;
  text-overflow: ellipsis;
  background: var(--bg-surface);
}

.searchable-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  z-index: 1050;
  max-height: 230px;
  overflow-y: auto;
  display: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: anim-fadeSlideUp 0.18s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.searchable-select.is-open .searchable-dropdown {
  display: block;
}

.searchable-option {
  padding: 0.65rem 0.85rem;
  font-size: 0.85rem;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  transition: background-color 0.15s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.searchable-option:last-child {
  border-bottom: none;
}

.searchable-option:hover,
.searchable-option.is-highlighted {
  background: rgba(2, 132, 199, 0.12);
  color: var(--primary-light);
}

.searchable-option.is-selected {
  background: var(--primary-glow);
  color: var(--primary);
  font-weight: 600;
}

.searchable-option .option-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.searchable-option .option-badge {
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  flex-shrink: 0;
}

.searchable-no-results {
  padding: 1rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.85rem;
}

.input-prefix-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-prefix-wrapper .input-prefix {
  position: absolute;
  left: 0.85rem;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--primary);
  pointer-events: none;
  font-family: var(--font-mono);
  user-select: none;
}

.input-prefix-wrapper input {
  padding-left: 2.5rem !important;
}

/* ================= MODALS ================= */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(16px) scale(0.98);
  transition: transform 0.25s ease;
}

.modal-backdrop.show .modal-card {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 800;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-close-modal:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.05);
}

.modal-body {
  padding: 1.5rem;
}

/* ================= PAGE FORM CONTAINER (TELA CHEIA) ================= */
.page-form-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin-bottom: 2rem;
  width: 100%;
}

.page-form-header {
  padding: 1.25rem 1.6rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card-hover);
}

.page-form-header h2 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.page-form-header p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.page-form-body {
  padding: 1.6rem;
}

.page-form-footer {
  padding: 1.1rem 1.6rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  background: var(--bg-card-hover);
}

/* ================= TOAST NOTIFICATIONS ================= */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 300px;
  max-width: 400px;
  background: var(--bg-surface);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.1rem;
  box-shadow: var(--shadow-lg);
  color: var(--text-main);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  animation: slideInRight 0.3s ease-out;
  border-top: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.toast.success {
  border-left-color: var(--accent-emerald);
}

.toast.error {
  border-left-color: var(--accent-rose);
}

.toast.warning {
  border-left-color: var(--accent-amber);
}

.toast-icon {
  font-size: 1.15rem;
}

.toast-content h4 {
  font-size: 0.86rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.toast-content p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

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

/* ================= TRANSITION ANIMATIONS ================= */

/* Fade In */
@keyframes anim-fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Fade + Slide Up (for module sections and forms) */
@keyframes anim-fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade + Slide Down (for closing forms going back to list) */
@keyframes anim-fadeSlideDown {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scale In (for cards and items) */
@keyframes anim-scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Slide In from Right (for form screens) */
@keyframes anim-slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Utility animation classes */
.anim-fade-in {
  animation: anim-fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.anim-fade-slide-up {
  animation: anim-fadeSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.anim-fade-slide-down {
  animation: anim-fadeSlideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.anim-scale-in {
  animation: anim-scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.anim-slide-in-right {
  animation: anim-slideInRight 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Module section transition — only on explicit switch via JS */
.app-module.anim-module-enter {
  animation: anim-fadeSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Scoped child animations — only during module switch, NOT on data reload */
.app-module.anim-module-enter .kpi-card {
  animation: anim-fadeSlideUp 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.app-module.anim-module-enter .kpi-card:nth-child(1) { animation-delay: 0.05s; }
.app-module.anim-module-enter .kpi-card:nth-child(2) { animation-delay: 0.1s; }
.app-module.anim-module-enter .kpi-card:nth-child(3) { animation-delay: 0.15s; }
.app-module.anim-module-enter .kpi-card:nth-child(4) { animation-delay: 0.2s; }

.app-module.anim-module-enter .filter-bar {
  animation: anim-fadeSlideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.12s;
}

.app-module.anim-module-enter .mural-columns,
.app-module.anim-module-enter .table-container {
  animation: anim-fadeSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.18s;
}

.app-module.anim-module-enter .entity-grid {
  animation: anim-fadeSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.1s;
}

/* Form screen entrance */
.page-form-container.anim-enter {
  animation: anim-slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Kanban/Table crossfade — on explicit toggle */
.mural-columns.anim-enter,
.table-container.anim-enter {
  animation: anim-fadeSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Soft smooth crossfade for date data change (no vertical jump/flicker) */
@keyframes anim-softFade {
  from { opacity: 0.7; }
  to { opacity: 1; }
}

.anim-date-switch {
  animation: anim-softFade 0.18s ease-out both;
}

/* Date preset buttons — smooth active pill transition */
.btn-date-preset {
  position: relative;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-date-preset:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.05);
}

.btn-date-preset.active {
  background: var(--primary-gradient) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
}

/* ================= RESPONSIVENESS ================= */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.4);
  }
  .main-wrapper {
    margin-left: 0 !important;
  }
}
