/* ==========================================================
   BNMA ADVOGADOS - COMPONENTES VISUAIS & INTERAÇÕES
   ========================================================== */

/* 1. BOTÕES */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
  white-space: nowrap;
  min-height: 40px;
  border: 1px solid transparent;
  text-decoration: none;
}

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

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

.btn-primary {
  background-color: var(--accent-solid);
  color: var(--accent-text);
}

.btn-primary:hover {
  background-color: var(--accent-solid-hover);
  box-shadow: var(--shadow-sm);
}

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

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

.btn-ghost {
  background-color: transparent;
  color: var(--text-secondary);
}

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

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
  min-height: 32px;
}

.btn-sm svg {
  width: 14px;
  height: 14px;
}

.btn-icon {
  padding: 0.5rem;
  min-height: 38px;
  min-width: 38px;
  border-radius: var(--radius-sm);
}

/* 2. CARDS E SUPERFÍCIES */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-title svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
  color: var(--text-secondary);
}

.card-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* 3. KPI STATS CARDS */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.kpi-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.kpi-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  white-space: normal;
  word-break: break-word;
  line-height: 1.25;
}

.kpi-value {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.kpi-meta {
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* 4. FORMULÁRIOS & INPUTS */
.form-group {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

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

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  word-break: keep-all;
}

.form-label span.req {
  color: #DC2626;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  min-height: 42px;
  padding: 0.6rem 0.85rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  transition: all var(--transition-fast);
  outline: none;
}

.form-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-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='%2371717A' 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.75rem center;
  background-size: 16px 16px;
  padding-right: 2.25rem;
  cursor: pointer;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(24, 24, 27, 0.08);
}

[data-theme="dark"] .form-input:focus,
[data-theme="dark"] .form-select:focus,
[data-theme="dark"] .form-textarea:focus {
  box-shadow: 0 0 0 2px rgba(250, 250, 250, 0.12);
}

[data-theme="dark"] .form-select {
  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='%23A1A1AA' 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");
}

.form-input::placeholder, .form-textarea::placeholder {
  color: var(--text-muted);
}

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

.form-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.form-checkbox {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  accent-color: var(--accent-solid);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background-color: var(--badge-bg);
  color: var(--badge-text);
  border: 1px solid var(--badge-border);
  white-space: nowrap !important;
  flex-shrink: 0;
  word-break: keep-all !important;
  min-width: max-content;
}

.badge svg {
  width: 12px;
  height: 12px;
  stroke-width: 2.2;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  display: inline-block;
  flex-shrink: 0;
  background-color: currentColor;
}

.badge-success {
  background-color: var(--badge-success-bg);
  color: var(--badge-success-text);
  border-color: var(--badge-success-border);
}

.badge-success .badge-dot {
  background-color: var(--badge-success-dot);
}

.badge-warning {
  background-color: var(--badge-warning-bg);
  color: var(--badge-warning-text);
  border-color: var(--badge-warning-border);
}

.badge-warning .badge-dot {
  background-color: var(--badge-warning-dot);
}

.badge-info {
  background-color: var(--badge-info-bg);
  color: var(--badge-info-text);
  border-color: var(--badge-info-border);
}

.badge-info .badge-dot {
  background-color: var(--badge-info-dot);
}

.badge-danger {
  background-color: var(--badge-danger-bg);
  color: var(--badge-danger-text);
  border-color: var(--badge-danger-border);
}

.badge-danger .badge-dot {
  background-color: var(--badge-danger-dot);
}

/* 6. MODAL & DIALOG */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 9, 11, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  touch-action: none;
  overscroll-behavior: contain;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-content {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  touch-action: auto;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

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

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.modal-body {
  padding: 1.5rem;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  background-color: var(--bg-muted);
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

/* 7. TOAST NOTIFICATIONS */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 380px;
}

.toast {
  background-color: var(--accent-solid);
  color: var(--accent-text);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: toastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid var(--border-subtle);
}

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

/* 8. TABS DE NAVEGAÇÃO INTERNA */
.tabs-header {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-surface);
  padding: 0.35rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  margin-bottom: 1.5rem;
  overflow-x: auto;
  box-shadow: var(--shadow-xs);
}

.tab-btn {
  padding: 0.55rem 0.95rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  transition: all var(--transition-fast);
  white-space: nowrap !important;
  flex-shrink: 0;
  word-break: keep-all !important;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  user-select: none;
}

.tab-btn svg {
  width: 15px;
  height: 15px;
  stroke-width: 2;
  flex-shrink: 0;
}

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

.tab-btn.active {
  color: var(--accent-text);
  background: var(--accent-solid);
  border-color: var(--accent-solid);
  box-shadow: var(--shadow-xs);
}

/* 9. VIEW SWITCHER (KANBAN / LISTA) */
.view-switcher-container {
  display: inline-flex;
  align-items: center;
  background-color: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.2rem;
  gap: 0.2rem;
}

.view-switcher-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-xs);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  border: none;
  background: transparent;
  cursor: pointer;
  white-space: nowrap !important;
  flex-shrink: 0;
  word-break: keep-all !important;
  transition: all var(--transition-fast);
}

.view-switcher-btn:hover {
  color: var(--text-primary);
}

.view-switcher-btn.active {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
}

/* 10. KANBAN BOARD SYSTEM */
.kanban-wrapper {
  overflow-x: auto;
  padding-bottom: 1.5rem;
  -webkit-overflow-scrolling: touch;
}

.kanban-board {
  display: flex;
  gap: 1rem;
  min-width: 100%;
  align-items: flex-start;
}

.kanban-column {
  flex: 0 0 280px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 230px);
  box-shadow: var(--shadow-xs);
}

.kanban-column-header {
  padding: 0.85rem 1rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.kanban-column-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.kanban-column-count {
  font-size: 0.75rem;
  font-weight: 700;
  background-color: var(--bg-muted);
  color: var(--text-secondary);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
}

.kanban-column-meta {
  padding: 0.35rem 1rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  background-color: var(--bg-body);
  border-bottom: 1px solid var(--border-subtle);
}

/* Scrollbars Discretas e Minimalistas */
*::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 9999px;
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.65);
}
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}

.kanban-cards-list {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  overflow-y: auto;
  flex: 1;
  min-height: 120px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}

.kanban-cards-list.drag-over {
  background-color: var(--bg-muted);
  border: 2px dashed var(--accent-solid);
  border-radius: var(--radius-sm);
}

.kanban-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  box-shadow: var(--shadow-xs);
  cursor: grab;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  user-select: none;
}

.kanban-card:hover {
  border-color: var(--border-normal);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.kanban-card.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.kanban-card-title {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.25;
}

.kanban-card-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.kanban-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.35rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.kanban-card-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.kanban-card-actions .btn {
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

@media (max-width: 768px) {
  .kanban-card-actions .btn {
    width: 44px;
    height: 44px;
    min-height: 44px;
    min-width: 44px;
  }
  .kanban-card-actions .btn svg {
    width: 16px;
    height: 16px;
  }
}

/* 11. MATRIZ DE PERMISSÕES & GESTÃO RBAC */
.perm-main-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

@media (min-width: 768px) {
  .perm-main-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.perm-header-controls {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
}

@media (min-width: 768px) {
  .perm-header-controls {
    flex-direction: row;
    align-items: center;
    width: auto;
  }
}

.perm-header-controls .view-switcher-container {
  width: 100%;
  display: flex;
}

@media (min-width: 768px) {
  .perm-header-controls .view-switcher-container {
    width: auto;
  }
}

.perm-header-controls .view-switcher-btn {
  flex: 1;
  justify-content: center;
}

@media (min-width: 768px) {
  .perm-header-controls .view-switcher-btn {
    flex: initial;
  }
}

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

@media (min-width: 768px) {
  .perm-save-btn {
    width: auto;
  }
}

.perm-role-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.perm-role-nav::-webkit-scrollbar {
  display: none;
}

.perm-role-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap !important;
  flex: 1 0 auto;
  word-break: keep-all !important;
  transition: all var(--transition-fast);
  min-height: 44px;
}

.perm-role-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-normal);
}

.perm-role-btn.active {
  background: var(--accent-solid);
  color: var(--accent-text);
  border-color: var(--accent-solid);
  box-shadow: var(--shadow-xs);
}

.perm-role-btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
  flex-shrink: 0;
}

/* Banner de Contexto do Perfil */
.perm-context-banner {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent-solid);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-shadow: var(--shadow-xs);
}

@media (min-width: 768px) {
  .perm-context-banner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.15rem;
  }
}

.perm-context-title {
  font-size: 0.88rem;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}

.perm-context-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.perm-context-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  width: 100%;
}

@media (min-width: 768px) {
  .perm-context-actions {
    display: flex;
    width: auto;
  }
}

/* Cards dos Módulos */
.perm-module-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 640px) {
  .card {
    padding: 1rem 0.85rem;
  }
  .perm-module-card {
    padding: 0.85rem 0.85rem;
  }
}

.perm-module-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}

.perm-module-card.is-inactive {
  background: var(--bg-body);
  border-color: var(--border-subtle);
}

.perm-module-card.is-inactive .perm-module-icon {
  opacity: 0.55;
}

.perm-module-card.is-inactive .perm-module-title {
  color: var(--text-secondary);
}

.perm-module-header {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

@media (min-width: 768px) {
  .perm-module-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
  }
}

.perm-module-info {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  width: 100%;
  min-width: 0;
}

.perm-module-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  flex-shrink: 0;
  margin-top: 2px;
  transition: opacity var(--transition-fast);
}

.perm-module-icon svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.perm-module-text {
  flex: 1;
  min-width: 0;
  width: 100%;
}

.perm-module-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.2rem;
}

.perm-module-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.perm-module-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
  word-break: break-word;
}

.perm-module-quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  width: 100%;
}

@media (min-width: 768px) {
  .perm-module-quick-actions {
    display: flex;
    align-items: center;
    width: auto;
    gap: 0.4rem;
  }
}

.perm-quick-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 38px;
  text-align: center;
}

.perm-quick-btn:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.perm-quick-btn-muted:hover {
  background: var(--badge-danger-bg);
  border-color: var(--badge-danger-border);
  color: var(--badge-danger-text);
}

.perm-admin-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 600;
  background: var(--badge-success-bg);
  color: var(--badge-success-text);
  border: 1px solid var(--badge-success-border);
  min-height: 38px;
  width: 100%;
}

@media (min-width: 768px) {
  .perm-admin-badge {
    width: auto;
  }
}

.perm-module-body {
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.85rem;
  width: 100%;
}

/* Grupo de Ações - Grid Responsivo */
.perm-actions-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: 100%;
}

@media (min-width: 640px) {
  .perm-actions-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
    gap: 0.5rem;
  }
}

/* Botão de Alternância de Ação */
.perm-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  min-height: 44px;
  width: 100%;
  box-sizing: border-box;
}

/* Estado Liberado / Ativo */
.perm-toggle-btn.is-granted {
  background: #F0FDF4;
  border: 1px solid #86EFAC;
  color: #15803D;
}

[data-theme="dark"] .perm-toggle-btn.is-granted {
  background: rgba(22, 163, 74, 0.15);
  border-color: rgba(74, 222, 128, 0.35);
  color: #4ADE80;
}

.perm-toggle-btn.is-granted:hover:not(.disabled) {
  border-color: #22C55E;
  background: #DCFCE7;
  box-shadow: var(--shadow-xs);
}

[data-theme="dark"] .perm-toggle-btn.is-granted:hover:not(.disabled) {
  background: rgba(22, 163, 74, 0.25);
  border-color: #4ADE80;
}

.perm-toggle-btn.is-granted .perm-toggle-icon {
  background: #16A34A;
  color: #FFFFFF;
}

/* Estado Bloqueado / Inativo */
.perm-toggle-btn.is-denied {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.perm-toggle-btn.is-denied:hover:not(.disabled) {
  border-color: var(--border-strong);
  color: var(--text-secondary);
  background: var(--bg-surface-hover);
}

.perm-toggle-btn.is-denied .perm-toggle-icon {
  background: var(--bg-muted);
  color: var(--text-muted);
}

.perm-toggle-btn.disabled {
  cursor: default;
  pointer-events: none;
}

.perm-toggle-icon {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.perm-toggle-label {
  flex: 1;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.perm-toggle-pill {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.perm-toggle-pill.on {
  background: #DCFCE7;
  color: #166534;
}

[data-theme="dark"] .perm-toggle-pill.on {
  background: rgba(34, 197, 94, 0.25);
  color: #86EFAC;
}

.perm-toggle-pill.off {
  background: var(--bg-muted);
  color: var(--text-muted);
}

.badge-muted {
  background: var(--bg-muted);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.perm-chip-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-xs);
  font-size: 0.76rem;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  background: var(--bg-body);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  white-space: nowrap !important;
  flex-shrink: 0;
  word-break: keep-all !important;
}

.perm-chip-toggle:hover:not(.disabled) {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.perm-chip-toggle.active {
  background: rgba(59, 130, 246, 0.12);
  border-color: #3b82f6;
  color: #3b82f6;
}

.perm-chip-toggle.active.success {
  background: rgba(16, 185, 129, 0.12);
  border-color: #10b981;
  color: #10b981;
}

.perm-chip-toggle.active.warning {
  background: rgba(234, 179, 8, 0.12);
  border-color: #eab308;
  color: #eab308;
}

.perm-chip-toggle.active.danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: #ef4444;
  color: #ef4444;
}

.perm-chip-toggle.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.perm-chip-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Tabela Comparativa Geral (Matriz) */
.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  white-space: nowrap;
}

.matrix-table th,
.matrix-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  white-space: nowrap;
}

.matrix-table th {
  background-color: var(--bg-muted);
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  word-break: keep-all;
}

.matrix-table td:not(:first-child),
.matrix-table th:not(:first-child) {
  text-align: center;
}

.perm-checkbox-cell {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 12. GUIA RÁPIDO & BANNERS EDUCATIVOS */
.guide-banner {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--accent-solid);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-xs);
}

.guide-banner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

.guide-banner-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.guide-banner-title svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
  color: var(--text-primary);
}

/* 13. GRÁFICOS VISUAIS & CHARTS NATIVOS */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.chart-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chart-container {
  width: 100%;
  height: 270px;
  position: relative;
  margin-top: 1rem;
}

.chart-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.chart-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  flex-shrink: 0;
  word-break: keep-all;
}

.chart-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* Quick Stats Bar no Gráfico de Evolução */
.chart-quick-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border-subtle);
}

.quick-stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 0.25rem 0.5rem;
  font-size: 0.72rem;
}

.quick-stat-chip .chip-label {
  color: var(--text-muted);
}

.quick-stat-chip .chip-val {
  color: var(--text-primary);
  font-weight: 700;
}

/* FUNIL VISUAL DE CONVERSÃO EXECUTIVO */
.funnel-visual-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  margin-top: 1rem;
}

.funnel-summary-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.35rem;
  flex-wrap: wrap;
}

.funnel-stat-block {
  display: flex;
  flex-direction: column;
}

.funnel-stat-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.funnel-stat-value {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
}

.funnel-summary-arrow {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.funnel-stages-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.funnel-stage-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: border-color var(--transition-fast, 0.15s ease);
}

.funnel-stage-card:hover {
  border-color: var(--border-strong);
}

.funnel-stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.funnel-stage-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1;
}

.funnel-stage-num {
  font-size: 0.72rem;
  font-weight: 800;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
}

.funnel-stage-titles {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.funnel-stage-name {
  font-size: 0.82rem;
  color: var(--text-primary);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.funnel-stage-meta {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.funnel-stage-metrics {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.funnel-stage-count {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-primary);
}

.funnel-stage-pills {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.funnel-stage-bar-track {
  width: 100%;
  height: 8px;
  background: var(--bg-muted);
  border-radius: 4px;
  overflow: hidden;
}

.funnel-stage-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.funnel-connector-row {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 4px;
}

.funnel-connector-line {
  width: 1px;
  height: 4px;
  background: var(--border-subtle);
}

/* Indicador de rolagem mobile para tabelas */
.mobile-table-hint {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.4rem 0.5rem;
  background: var(--bg-muted);
  border-radius: var(--radius-xs);
  margin-bottom: 0.5rem;
  text-align: center;
}

/* ==========================================================
   V15 & CALENDAR STYLES
   ========================================================== */

/* Priority Badges P1 to P7 */
.badge-prio {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap !important;
  flex-shrink: 0;
  word-break: keep-all !important;
  min-width: max-content;
}

.badge-p1 {
  background-color: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.badge-p2 {
  background-color: rgba(249, 115, 22, 0.15);
  color: #f97316;
  border: 1px solid rgba(249, 115, 22, 0.4);
}

.badge-p3 {
  background-color: rgba(234, 179, 8, 0.15);
  color: #eab308;
  border: 1px solid rgba(234, 179, 8, 0.4);
}

.badge-p4 {
  background-color: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.badge-p5 {
  background-color: rgba(99, 102, 241, 0.15);
  color: #6366f1;
  border: 1px solid rgba(99, 102, 241, 0.4);
}

.badge-p6 {
  background-color: rgba(168, 85, 247, 0.15);
  color: #a855f7;
  border: 1px solid rgba(168, 85, 247, 0.4);
}

.badge-p7 {
  background-color: rgba(107, 114, 128, 0.15);
  color: #9ca3af;
  border: 1px solid rgba(107, 114, 128, 0.4);
}

/* Qualification Badges */
.badge-otimo { background-color: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.4); white-space: nowrap !important; flex-shrink: 0; word-break: keep-all !important; }
.badge-bom { background-color: rgba(59, 130, 246, 0.15); color: #3b82f6; border: 1px solid rgba(59, 130, 246, 0.4); white-space: nowrap !important; flex-shrink: 0; word-break: keep-all !important; }
.badge-medio { background-color: rgba(234, 179, 8, 0.15); color: #eab308; border: 1px solid rgba(234, 179, 8, 0.4); white-space: nowrap !important; flex-shrink: 0; word-break: keep-all !important; }
.badge-ruim { background-color: rgba(239, 68, 68, 0.15); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.4); white-space: nowrap !important; flex-shrink: 0; word-break: keep-all !important; }

/* Agenda Header & Toolbar Responsiva */
.agenda-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.agenda-header-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.agenda-adv-filter-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.agenda-adv-filter-wrap select {
  min-width: 170px;
}

@media (max-width: 768px) {
  .agenda-page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .agenda-header-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    width: 100%;
  }
  .agenda-adv-filter-wrap {
    grid-column: 1 / -1;
    width: 100%;
  }
  .agenda-adv-filter-wrap select {
    width: 100%;
    min-height: 48px;
  }
  .agenda-header-toolbar .view-mode-toggle {
    grid-column: 1 / -1;
    width: 100%;
  }
  .agenda-header-toolbar .view-mode-toggle .btn {
    flex: 1;
    min-height: 48px;
    justify-content: center;
  }
  .agenda-header-toolbar .btn-secondary {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 48px;
    justify-content: center;
  }
}

/* Interactive Calendar Component */
.calendar-desktop-view {
  display: block;
}

.calendar-mobile-view {
  display: none;
}

/* Mobile Calendar Components (Mini-Grid, Weekly Strip & Day Agenda) */
.cal-mobile-month-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.cal-mobile-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background-color: var(--bg-muted);
  border-bottom: 1px solid var(--border-subtle);
  text-align: center;
  padding: 0.5rem 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.cal-mobile-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  background-color: var(--border-subtle);
  padding: 2px;
  width: 100%;
  box-sizing: border-box;
}

.cal-mobile-day {
  min-height: 48px;
  background-color: var(--bg-surface);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  padding: 0.25rem 0.15rem;
  user-select: none;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.cal-mobile-day:hover {
  background-color: var(--bg-surface-hover);
}

.cal-mobile-day:active {
  transform: scale(0.95);
}

.cal-mobile-day.other-month {
  background-color: var(--bg-body);
  opacity: 0.35;
}

.cal-mobile-day-num {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  transition: all 0.15s ease;
}

.cal-mobile-day.today .cal-mobile-day-num {
  border: 2px solid var(--accent-solid);
  font-weight: 800;
}

.cal-mobile-day.selected {
  background-color: rgba(59, 130, 246, 0.12);
}

.cal-mobile-day.selected .cal-mobile-day-num {
  background-color: var(--accent-solid);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.cal-mobile-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 6px;
  margin-top: 2px;
}

.cal-mobile-dot {
  width: 5px;
  height: 5px;
  border-radius: 9999px;
  flex-shrink: 0;
}

.cal-mobile-count-pill {
  font-size: 0.58rem;
  font-weight: 800;
  padding: 0 4px;
  line-height: 12px;
  border-radius: 6px;
  background-color: var(--accent-solid);
  color: #ffffff;
}

/* Painel Dinâmico da Agenda do Dia Selecionado */
.cal-selected-day-panel {
  display: flex;
  flex-direction: column;
  padding: 1.15rem 1rem;
  background-color: var(--bg-surface);
}

.cal-selected-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.cal-selected-day-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cal-mobile-cards-stream {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.cal-mobile-event-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  padding: 0.95rem 1rem;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cal-mobile-event-card:active {
  transform: scale(0.99);
}

.cal-mobile-event-card.prio-p1 { border-left-color: #EF4444; }
.cal-mobile-event-card.prio-p2 { border-left-color: #F97316; }
.cal-mobile-event-card.prio-p3 { border-left-color: #F59E0B; }
.cal-mobile-event-card.prio-p4 { border-left-color: #3B82F6; }
.cal-mobile-event-card.prio-p5 { border-left-color: #8B5CF6; }
.cal-mobile-event-card.prio-p6 { border-left-color: #64748B; }
.cal-mobile-event-card.prio-p7 { border-left-color: #94A3B8; }

.cal-card-meta-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.cal-card-time {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
}

.cal-card-client-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.cal-card-details {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
}

.cal-card-details span {
  white-space: nowrap;
  word-break: keep-all;
}

.cal-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.4rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--border-subtle);
}

.cal-card-actions .btn {
  min-height: 48px;
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  flex: 1 1 auto;
}

/* Weekly Strip Mobile */
.cal-mobile-week-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  padding: 0.65rem 0.5rem;
  background-color: var(--bg-body);
  border-bottom: 1px solid var(--border-subtle);
}

.cal-week-strip-btn {
  min-height: 52px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0.25rem 0;
  user-select: none;
}

.cal-week-strip-btn:hover {
  background-color: var(--bg-surface-hover);
}

.cal-week-strip-btn:active {
  transform: scale(0.95);
}

.cal-week-strip-btn.selected {
  background-color: var(--accent-solid);
  border-color: var(--accent-solid);
  color: #ffffff;
}

.cal-week-strip-btn.selected .cal-strip-day-name,
.cal-week-strip-btn.selected .cal-strip-day-num {
  color: #ffffff;
}

.cal-strip-day-name {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.cal-strip-day-num {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.15;
}

.cal-strip-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 5px;
  margin-top: 2px;
}

.calendar-wrapper {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.calendar-top-bar {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
}

.calendar-nav-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.calendar-current-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 180px;
  text-align: center;
}

.calendar-grid-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background-color: var(--bg-muted);
  border-bottom: 1px solid var(--border-subtle);
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.calendar-grid-header-col {
  padding: 0.65rem 0.5rem;
}

.calendar-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background-color: var(--border-subtle);
  gap: 1px;
}

.calendar-day-cell {
  background-color: var(--bg-surface);
  min-height: 105px;
  max-height: 125px;
  padding: 0.4rem 0.5rem;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition-fast);
  cursor: pointer;
  overflow: hidden;
}

.calendar-day-cell:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

.calendar-day-cell.other-month {
  background-color: var(--bg-body);
  opacity: 0.45;
}

.calendar-day-cell.today {
  background-color: rgba(59, 130, 246, 0.05);
  box-shadow: inset 0 0 0 1px var(--accent-solid);
}

.calendar-day-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.calendar-day-num {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
}

.calendar-day-cell.today .calendar-day-num {
  background-color: var(--accent-solid);
  color: #ffffff;
}

.calendar-day-count {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
}

.calendar-events-container {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  overflow: hidden;
}

/* Notion-Style Single-line Event Pill */
.notion-event-pill {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  font-size: 0.72rem;
  line-height: 1.25;
  font-weight: 500;
  color: var(--text-primary);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: all 0.15s ease;
}

.notion-event-pill:hover {
  background-color: var(--bg-muted);
  border-color: var(--text-muted);
  transform: translateY(-1px);
}

.notion-dot {
  width: 7px;
  height: 7px;
  border-radius: 9999px;
  flex-shrink: 0;
}
.notion-dot.prio-p1 { background-color: #EF4444; }
.notion-dot.prio-p2 { background-color: #F97316; }
.notion-dot.prio-p3 { background-color: #F59E0B; }
.notion-dot.prio-p4 { background-color: #3B82F6; }
.notion-dot.prio-p5 { background-color: #8B5CF6; }
.notion-dot.prio-p6 { background-color: #64748B; }
.notion-dot.prio-p7 { background-color: #94A3B8; }

.notion-more-pill {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-solid);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  word-break: keep-all;
}
.notion-more-pill:hover {
  text-decoration: underline;
  background-color: rgba(59, 130, 246, 0.08);
}

/* Weekly View Styles */
.calendar-week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background-color: var(--border-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.calendar-week-col {
  background-color: var(--bg-surface);
  min-height: 480px;
  display: flex;
  flex-direction: column;
}

.calendar-week-col-header {
  padding: 0.65rem 0.4rem;
  text-align: center;
  border-bottom: 1px solid var(--border-subtle);
  background-color: var(--bg-body);
}

.calendar-week-col-header.today {
  background-color: rgba(59, 130, 246, 0.08);
}

.calendar-week-col-events {
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  overflow-y: auto;
  max-height: 600px;
}

.calendar-week-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.calendar-week-card:hover {
  border-color: #3B82F6;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.calendar-event-time-badge {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* Ficha Jurídica Digital Form */
.ficha-modal-container {
  max-width: 820px;
  width: 95vw;
}

.ficha-section-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.ficha-section-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.criteria-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
  gap: 1rem;
}

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

.criteria-score-buttons {
  display: flex;
  gap: 0.35rem;
}

.criteria-btn {
  width: 38px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-muted);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
  word-break: keep-all;
}

.criteria-btn:hover {
  background-color: var(--border-subtle);
  color: var(--text-primary);
}

.criteria-btn.active-0 {
  background-color: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-color: #ef4444;
}

.criteria-btn.active-1 {
  background-color: rgba(234, 179, 8, 0.2);
  color: #eab308;
  border-color: #eab308;
}

.criteria-btn.active-2 {
  background-color: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border-color: #10b981;
}

.ficha-kpi-summary-box {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  text-align: center;
  margin-bottom: 1.25rem;
}

.ficha-kpi-val {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-top: 0.25rem;
  white-space: nowrap;
}

.ficha-kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  white-space: nowrap;
  word-break: keep-all;
}

/* Central de Ação Styles */
.action-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.action-rank-circle {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  background-color: var(--bg-muted);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
}

.action-diag-pill {
  font-size: 0.75rem;
  font-weight: 600;
  color: #f97316;
  background-color: rgba(249, 115, 22, 0.1);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  white-space: nowrap !important;
  flex-shrink: 0;
  word-break: keep-all !important;
}

.action-suggest-pill {
  font-size: 0.75rem;
  font-weight: 600;
  color: #10b981;
  background-color: rgba(16, 185, 129, 0.1);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  white-space: nowrap !important;
  flex-shrink: 0;
  word-break: keep-all !important;
}

/* ==========================================================
   PAGE HEADERS & ACTIONS GRID
   ========================================================== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-header-actions,
.admin-header-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.central-acao-card {
  border: 1px solid var(--accent-solid);
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.08);
}

.central-acao-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1rem;
}

.central-header-title-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  width: 100%;
}

.central-header-title-wrap .card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
  margin: 0;
}

.central-header-title-wrap .card-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

/* ==========================================================
   RESPONSIVIDADE MOBILE ROBUSTA & TOUCH-FIRST (BREAKPOINTS)
   ========================================================== */

@media (max-width: 1024px) {
  .kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  /* Botões & Ações Touch-First (Mínimo 48px) */
  .btn {
    min-height: 48px;
    padding: 0.65rem 1rem;
    touch-action: manipulation;
  }
  
  .btn-sm {
    min-height: 44px;
    min-width: 44px;
    padding: 0.45rem 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
  }

  .view-switcher-btn {
    min-height: 44px;
    padding: 0.5rem 0.85rem;
    touch-action: manipulation;
  }

  .tabs-header {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    padding: 0.35rem;
    gap: 0.5rem;
    scrollbar-width: none;
  }

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

  .tab-btn {
    min-height: 48px;
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
    touch-action: manipulation;
  }

  /* Page Header Mobile */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.85rem;
    margin-bottom: 1.25rem;
    width: 100%;
  }

  .page-header > div:first-child {
    width: 100%;
  }

  .page-header .page-title {
    font-size: 1.25rem;
    line-height: 1.25;
  }

  .page-header .card-subtitle {
    font-size: 0.82rem;
    line-height: 1.35;
  }

  .page-header-actions,
  .admin-header-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    width: 100%;
  }

  .page-header-actions .btn:last-child:nth-child(odd),
  .admin-header-toolbar .btn:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .page-header-actions .btn,
  .admin-header-toolbar .btn {
    width: 100%;
    min-height: 48px;
    justify-content: center;
    font-size: 0.82rem;
  }

  /* Cards e Containers */
  .card {
    padding: 1rem;
    border-radius: var(--radius-sm);
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .card-title {
    font-size: 0.95rem;
  }

  /* KPIs Grid */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    align-items: stretch;
  }

  .kpi-card {
    padding: 0.85rem 0.75rem;
    min-height: 115px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  .kpi-label {
    font-size: 0.7rem;
    min-height: 2.5em;
    line-height: 1.25;
  }

  .kpi-value {
    font-size: 1.25rem;
    line-height: 1.15;
  }

  .kpi-meta {
    font-size: 0.72rem;
    margin-top: auto;
    line-height: 1.3;
  }

  /* Formulários Touch-First */
  .form-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .form-input, .form-select, .form-textarea {
    font-size: 16px; /* Evita zoom automático no iOS Safari */
    min-height: 48px;
    padding: 0.65rem 0.85rem;
  }

  /* Modais Mobile (Bottom Sheet Moderno com Safe Area) */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
    background: rgba(9, 9, 11, 0.7);
  }

  .modal-content {
    max-width: 100%;
    width: 100%;
    max-height: 88dvh;
    max-height: 88vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: none;
    border-left: none;
    border-right: none;
  }

  .modal-header {
    padding: 1.15rem 1.25rem 0.85rem;
  }

  .modal-body {
    padding: 1rem 1.25rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .modal-footer {
    padding: 0.85rem 1.25rem;
    padding-bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px));
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .modal-footer .btn {
    width: 100%;
    min-height: 48px;
  }

  /* Kanban Board Mobile */
  .kanban-wrapper {
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 1rem;
    margin: 0 -0.5rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .kanban-column {
    flex: 0 0 85vw;
    max-width: 320px;
    scroll-snap-align: start;
    max-height: 72vh;
  }

  .kanban-card {
    padding: 0.75rem;
  }

  .kanban-card-title {
    font-size: 0.82rem;
    word-break: break-word;
  }

  /* Matriz de Permissões Mobile */
  .perm-module-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem;
  }

  .perm-module-info {
    width: 100%;
    min-width: 0;
  }

  .perm-actions-group {
    width: 100%;
    justify-content: flex-start;
    gap: 0.45rem;
    flex-wrap: wrap;
  }

  .perm-toggle-btn {
    min-height: 48px;
    touch-action: manipulation;
  }

  .perm-chip-toggle {
    min-height: 44px;
    padding: 0.45rem 0.75rem;
    font-size: 0.78rem;
    touch-action: manipulation;
  }

  .perm-quick-btn {
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    touch-action: manipulation;
  }

  .perm-role-nav {
    width: 100%;
  }

  .perm-role-btn {
    flex: 1;
    min-height: 48px;
    justify-content: center;
    padding: 0.5rem;
    font-size: 0.78rem;
    touch-action: manipulation;
  }

  /* Calendário Jurídico & Agenda Mobile */
  .calendar-desktop-view {
    display: none !important;
  }

  .calendar-mobile-view {
    display: flex !important;
    flex-direction: column;
    width: 100%;
  }

  .calendar-wrapper {
    overflow: visible;
    width: 100%;
    border-radius: var(--radius-sm);
  }

  .calendar-top-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.85rem;
  }

  .calendar-nav-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 0.5rem;
  }

  .calendar-nav-controls .btn {
    min-height: 44px;
    min-width: 44px;
  }

  .calendar-current-title {
    min-width: 0;
    font-size: 0.95rem;
    font-weight: 800;
    text-align: center;
    flex: 1;
  }

  .view-mode-toggle {
    width: 100%;
  }

  .view-mode-toggle .btn {
    flex: 1;
    min-height: 44px;
    font-size: 0.82rem;
    font-weight: 700;
  }

  /* Visão em Lista no Mobile */
  .agenda-day-group {
    padding: 0.85rem !important;
  }

  .agenda-day-group .btn {
    min-height: 48px;
  }

  /* Ficha Jurídica v15 Mobile */
  .criteria-item-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 0.25rem;
  }

  .criteria-score-buttons {
    width: 100%;
    justify-content: flex-start;
  }

  .criteria-btn {
    flex: 1;
    min-height: 48px;
    height: 48px;
    font-size: 0.85rem;
    touch-action: manipulation;
  }

  .ficha-kpi-summary-box {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    padding: 0.85rem;
  }

  .ficha-kpi-val {
    font-size: 1.15rem;
  }

  /* Meetings & Agenda Cards */
  .meeting-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem;
  }

  .meeting-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.65rem !important;
    align-items: stretch !important;
  }
  .kpi-card {
    padding: 0.85rem 0.75rem !important;
    min-height: 115px !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
  }
  .kpi-label {
    font-size: 0.68rem !important;
    min-height: 2.5em !important;
    line-height: 1.25 !important;
  }
  .kpi-value {
    font-size: 1.18rem !important;
    word-break: break-word;
    line-height: 1.15 !important;
  }
  .kpi-meta {
    font-size: 0.68rem !important;
    margin-top: auto !important;
    line-height: 1.3 !important;
  }
  .chart-card {
    padding: 0.85rem !important;
  }
  .chart-container {
    height: 230px !important;
  }
  .funnel-summary-banner {
    padding: 0.5rem 0.65rem !important;
    gap: 0.35rem !important;
  }
  .funnel-stat-value {
    font-size: 0.95rem !important;
  }
  .funnel-stage-card {
    padding: 0.55rem 0.65rem !important;
  }
  .funnel-stage-name {
    font-size: 0.78rem !important;
  }
  .funnel-stage-count {
    font-size: 0.88rem !important;
  }
  .kanban-column {
    flex: 0 0 90vw;
  }
  .ficha-kpi-summary-box {
    grid-template-columns: 1fr;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .perm-actions-group {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================
   SISTEMA DE FILTROS AVANÇADOS & QUICK PILLS (P1/P2 & MULTICRITÉRIO)
   ========================================================== */
.filter-pills-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.25rem 0.25rem 0.65rem 0.25rem;
  margin-bottom: 0.75rem;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  padding: 0.35rem 0.25rem 0.5rem 0.25rem;
}

.filter-pills-container::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.filter-pill:last-child {
  margin-right: 1.25rem;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.9rem;
  min-height: 44px;
  border-radius: 9999px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-normal);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap !important;
  flex: 0 0 auto !important;
  flex-shrink: 0 !important;
  word-break: keep-all !important;
  min-width: max-content;
  user-select: none;
  scroll-snap-align: start;
  touch-action: pan-x;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-xs);
}

.filter-pill span {
  white-space: nowrap !important;
  word-break: keep-all !important;
  flex-shrink: 0 !important;
}

.filter-pill:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--text-muted);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.filter-pill.active {
  background-color: var(--accent-solid);
  color: var(--accent-text);
  border-color: var(--accent-solid);
  box-shadow: var(--shadow-xs);
}

.filter-pill-counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 700;
  background-color: var(--bg-muted);
  color: var(--text-secondary);
  line-height: 1;
  white-space: nowrap !important;
  flex-shrink: 0;
  word-break: keep-all !important;
}

.filter-pill.active .filter-pill-counter {
  background-color: rgba(255, 255, 255, 0.25);
  color: inherit;
}

/* SDR Header & Toolbar Responsiva */
.sdr-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.sdr-header-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* SDR & Global Filter Card & Responsive Grid */
.filter-controls-row,
.sdr-filters-main-row {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  align-items: center;
}

.filter-col-search,
.sdr-filter-search-wrap {
  flex: 2 1 220px;
  min-width: 0;
}

.filter-col-select,
.sdr-filter-select-wrap {
  flex: 1.2 1 140px;
  min-width: 0;
}

.filter-col-actions,
.sdr-filter-actions-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.sdr-filters-expanded-row {
  display: none;
  gap: 0.65rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border-subtle);
}

.sdr-filters-expanded-row.open {
  display: flex;
}

/* Summary Strip */
.filter-summary-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  background-color: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.filter-summary-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-summary-info-main,
.filter-summary-info-sub {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-summary-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-active-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 0.2rem 0.5rem;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap !important;
  flex-shrink: 0;
  word-break: keep-all !important;
}

.filter-active-tag button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
}

.filter-active-tag button:hover {
  color: var(--accent-danger);
}

.badge-prio.sem-prio {
  background-color: var(--bg-muted);
  color: var(--text-muted);
  border: 1px dashed var(--border-normal);
  font-size: 0.68rem;
}

/* Breakpoints Específicos para Filtros & SDR Mobile */
@media (max-width: 768px) {
  .sdr-page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
  }

  .sdr-header-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    width: 100%;
  }

  .sdr-header-toolbar .view-switcher-container {
    grid-column: 1 / -1;
    width: 100%;
    display: flex;
  }

  .sdr-header-toolbar .view-switcher-container .view-switcher-btn {
    flex: 1;
    justify-content: center;
    min-height: 48px;
    font-size: 0.85rem;
  }

  .sdr-header-toolbar .btn {
    width: 100%;
    min-height: 48px;
    justify-content: center;
    padding: 0.5rem 0.25rem;
    font-size: 0.85rem;
    text-align: center;
  }

  .filter-controls-row,
  .sdr-filters-main-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    width: 100%;
  }

  .filter-col-search,
  .sdr-filter-search-wrap {
    grid-column: 1 / -1;
    width: 100%;
  }

  .filter-col-select,
  .sdr-filter-select-wrap {
    width: 100%;
  }

  .filter-col-select select,
  .sdr-filter-select-wrap select {
    width: 100%;
    min-height: 48px;
  }

  .filter-col-select-wide {
    grid-column: 1 / -1 !important;
    width: 100%;
  }

  .filter-col-actions {
    grid-column: 1 / -1;
    display: flex;
    width: 100%;
    margin-left: 0;
    margin-top: 0.25rem;
  }

  .sdr-filter-actions-wrap {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    width: 100%;
    margin-left: 0;
    margin-top: 0.25rem;
  }

  .filter-col-actions .btn,
  .sdr-filter-actions-wrap .btn {
    width: 100%;
    min-height: 48px;
    justify-content: center;
  }

  .sdr-filters-expanded-row.open {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    width: 100%;
  }

  .filter-summary-strip {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0.75rem;
  }

  .filter-summary-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    width: 100%;
  }

  .filter-summary-info-main {
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .filter-summary-info-sub .filter-summary-separator {
    display: none;
  }

  .filter-summary-badges {
    width: 100%;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border-subtle);
  }
}

@media (max-width: 480px) {
  .sdr-filter-actions-wrap .btn {
    font-size: 0.8rem;
    padding: 0.5rem 0.35rem;
    min-height: 48px;
  }
  .filter-pill {
    min-height: 48px;
    padding: 0.5rem 0.85rem;
    font-size: 0.82rem;
  }
}

