:root {
  /* ASM Colors: Premium & Modern */
  --primary: #04401a; 
  --primary-light: #086b2d;
  --secondary: #bdfc35; 
  --primary-soft: rgba(4, 64, 26, 0.08);
  --primary-ring: rgba(6, 87, 36, 0.16);
  
  --bg-base: #f8fafc;
  --bg-card: #ffffff;
  --bg-alt: #f1f5f9;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-focus: 0 0 0 3px var(--primary-ring);
  
  --status-vencida: #ef4444; /* Red */
  --status-concluida: #22c55e; /* Green */
  --status-andamento: #f59e0b; /* Orange */
  --status-analise: #3b82f6; /* Blue */
  --status-devolvida: #a855f7; /* Purple */
  --status-cancelada: #6b7280; /* Gray */
  --status-naoiniciada: #9ca3af; /* Gray/Light */
  --status-naoaplicavel: #64748b; /* Slate */
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body, input, button, select, textarea {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  background-color: var(--bg-base);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  overflow: hidden;
}

/* Typography & Utilities */
h1, h2, h3 { font-weight: 600; color: var(--text-main); }
.text-muted { color: var(--text-muted); font-size: 0.875rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.w-full { width: 100%; }

/* Buttons */
.btn {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 38px;
  user-select: none;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.btn:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.btn:disabled {
  opacity: 0.65 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  transform: none !important;
  box-shadow: none !important;
}

.btn.loading {
  pointer-events: none !important;
  opacity: 0.85 !important;
  cursor: default !important;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}
.btn-primary:hover {
  background-color: var(--primary-light);
}

.btn-secondary {
  background-color: var(--bg-base);
  color: var(--text-main);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background-color: #e5e7eb;
}

.btn-danger {
  background-color: #dc2626;
  color: white;
}
.btn-danger:hover {
  background-color: #b91c1c;
}

.btn-success {
  background-color: #16a34a;
  color: white;
}
.btn-success:hover {
  background-color: #15803d;
}

.btn-warning {
  background-color: #ea580c;
  color: white;
}
.btn-warning:hover {
  background-color: #c2410c;
}

.btn-outline {
  background-color: transparent;
  color: var(--text-main);
  border: 1px solid var(--border);
}
.btn-outline:hover {
  background-color: var(--bg-base);
  border-color: var(--primary-light);
  color: var(--primary-light);
}

.btn-sm {
  padding: 0.4rem 0.7rem;
  font-size: 0.8rem;
  min-height: 32px;
}

/* Spinner dentro de botões */
.btn-spinner, .button-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: currentColor;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: #043f20;
  color: white;
  display: flex;
  flex-direction: column;
  transition: width 0.2s ease;
  z-index: 10;
  box-shadow: inset -1px 0 rgba(255, 255, 255, 0.08);
}
.sidebar-header {
  min-height: 76px;
  padding: 1.15rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.brand-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
}
.sidebar-logo-container {
  width: 40px;
  height: 40px;
  background: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.sidebar-brand-logo {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.nav-links {
  padding: 0.7rem 0.65rem 1rem;
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.22) transparent;
}
.nav-group {
  display: grid;
  gap: 0.15rem;
  padding: 0.45rem 0;
}
.nav-group + .nav-group {
  margin-top: 0.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.nav-group-label {
  padding: 0.25rem 0.85rem 0.4rem;
  color: rgba(255,255,255,0.48);
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.nav-item {
  position: relative;
  min-height: 42px;
  padding: 0.58rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: rgba(255,255,255,0.76);
  border: 0;
  border-radius: 7px;
  background: transparent;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.25;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}
.nav-item:hover, .nav-item.active {
  color: white;
  background: rgba(255,255,255,0.1);
}
.nav-item.active {
  background: rgba(255,255,255,0.14);
  font-weight: 650;
  box-shadow: inset 3px 0 0 var(--secondary);
}
.nav-item:hover {
  transform: translateX(2px);
}
.nav-item:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: -2px;
}
.nav-item[hidden] {
  display: none;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.topbar {
  height: 64px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
}
.content-area {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

/* Cards & KPIs */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.kpi-card {
  background: var(--bg-card);
  padding: 1.25rem 1.5rem;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}
.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}
.kpi-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.kpi-value {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
}
.kpi-progress {
  height: 4px;
  background: var(--border);
  border-radius: 9999px;
  overflow: hidden;
  margin-top: 0.25rem;
}
.kpi-progress-bar {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0%;
}
.kpi-sub {
  font-size: 0.75rem;
  margin-top: 0.5rem;
}

/* Tables */
.card {
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.04), 0 2px 6px -1px rgba(0, 0, 0, 0.02);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.header-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.table-responsive {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th {
  background: #f8fafc;
  padding: 0.75rem 1.5rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
td {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}
tr:last-child td { border-bottom: none; }
tr:nth-child(even) td { background: rgba(0,0,0,0.018); }
tr:hover td {
  background: rgba(4, 64, 26, 0.04);
}
.clickable-row:hover td {
  cursor: pointer;
}

/* Status Badges - Premium Pill Styling */
.badge {
  height: 24px;
  padding: 0 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 1px 2px 0 rgba(0,0,0,0.02);
}
.badge::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.badge.concluida { background: rgba(34, 197, 94, 0.12) !important; color: #166534 !important; border: 1px solid rgba(34, 197, 94, 0.2) !important; }
.badge.concluida::before { background: var(--status-concluida); }

.badge.andamento { background: rgba(245, 158, 11, 0.12) !important; color: #92400e !important; border: 1px solid rgba(245, 158, 11, 0.2) !important; }
.badge.andamento::before { background: var(--status-andamento); }

.badge.vencida,
.badge.vencida_automatica { background: rgba(239, 68, 68, 0.12) !important; color: #991b1b !important; border: 1px solid rgba(239, 68, 68, 0.2) !important; font-weight: 700 !important; }
.badge.vencida::before,
.badge.vencida_automatica::before { background: var(--status-vencida); }

.badge.analise { background: rgba(59, 130, 246, 0.12) !important; color: #1e40af !important; border: 1px solid rgba(59, 130, 246, 0.2) !important; }
.badge.analise::before { background: var(--status-analise); }

.badge.devolvida { background: rgba(168, 85, 247, 0.12) !important; color: #6b21a8 !important; border: 1px solid rgba(168, 85, 247, 0.2) !important; }
.badge.devolvida::before { background: var(--status-devolvida); }

.badge.naoiniciada { background: rgba(148, 163, 184, 0.15) !important; color: #475569 !important; border: 1px solid rgba(148, 163, 184, 0.2) !important; }
.badge.naoiniciada::before { background: var(--status-naoiniciada); }

.badge.cancelada { background: rgba(100, 116, 139, 0.12) !important; color: #475569 !important; border: 1px solid rgba(100, 116, 139, 0.2) !important; }
.badge.cancelada::before { background: var(--status-cancelada); }

.badge.naoaplicavel { background: rgba(203, 213, 225, 0.25) !important; color: #334155 !important; border: 1px solid rgba(203, 213, 225, 0.3) !important; }
.badge.naoaplicavel::before { background: var(--status-naoaplicavel); }

.badge.aprovada { background: rgba(16, 185, 129, 0.12) !important; color: #065f46 !important; border: 1px solid rgba(16, 185, 129, 0.2) !important; }
.badge.aprovada::before { background: #10b981; }

.badge.reprovada { background: rgba(239, 68, 68, 0.12) !important; color: #b91c1c; border: 1px solid rgba(239, 68, 68, 0.2) !important; }
.badge.reprovada::before { background: #ef4444; }

.badge.rotina { background: rgba(99, 102, 241, 0.12) !important; color: #4338ca; border: 1px solid rgba(99, 102, 241, 0.2) !important; }
.badge.rotina::before { background: #6366f1; }

.badge.analise_consultora { background: rgba(59, 130, 246, 0.1) !important; color: #1d4ed8 !important; border: 1px solid rgba(59, 130, 246, 0.15) !important; }
.badge.analise_consultora::before { background: #3b82f6; }

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: overlayFadeIn 0.2s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
@keyframes overlayFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.modal {
  background: var(--bg-card);
  width: min(600px, 95vw);
  max-height: 88vh;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalSlideIn 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  gap: 1rem;
}
.modal-header h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-main);
}
.modal-header .btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.38rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.modal-header .btn-ghost:hover {
  background: rgba(6, 87, 36, 0.06);
  color: var(--primary);
  border-color: rgba(6, 87, 36, 0.15);
}
body.dark-theme .modal-header .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}
.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex-grow: 1;
}
.modal-footer {
  padding: 1.1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* Form inputs */
.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}
.form-control {
  width: 100%;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  background-color: var(--bg-card);
  color: var(--text-main);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input.form-control,
select.form-control {
  height: 40px;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(6, 87, 36, 0.15);
}
select.form-control {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23475569'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.1rem;
  padding-right: 2.5rem;
  cursor: pointer;
}
body.dark-theme select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
}
textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

/* File Upload */
.file-upload-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.file-upload-zone:hover {
  border-color: var(--primary);
  background: rgba(6, 87, 36, 0.02);
}
.file-upload-zone.compact {
  padding: 0.85rem;
}
.file-upload-zone p {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  margin-bottom: 0;
}

/* Planning summary and filters */
.plan-summary-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.summary-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}
.summary-wide {
  grid-column: span 2;
}
.summary-label {
  display: block;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}
.summary-item strong {
  font-size: 0.9rem;
  line-height: 1.45;
}
.filter-card {
  margin-bottom: 1.5rem;
  padding: 1rem 1.5rem;
}
.filter-grid {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(180px, 1fr) minmax(180px, 1fr) auto;
  gap: 1rem;
  align-items: end;
}
.filter-grid .form-group {
  margin-bottom: 0;
}
.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
}

/* Detail panels */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.action-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}
.panel-block {
  background: #f8fafc;
  border: 1px solid var(--border);
  padding: 1rem;
  border-radius: 8px;
}
.panel-block h4 {
  margin-bottom: 0.65rem;
  font-size: 0.95rem;
}
.panel-block p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.panel-success {
  background: rgba(6,87,36,0.05);
  border-color: rgba(6,87,36,0.18);
}
.panel-danger {
  background: #fff1f2;
  border-color: #fecdd3;
}
.panel-danger h4,
.panel-danger p {
  color: #9f1239;
}
.button-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.button-row .btn {
  justify-content: center;
  flex: 1;
}
.status-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}
.status-row select {
  min-width: 190px;
  flex: 1;
}
.note-box {
  margin-top: 0.25rem;
  font-size: 0.875rem;
  background: rgba(6,87,36,0.05);
  padding: 0.75rem;
  border-radius: 6px;
}
.center {
  text-align: center;
}
.scope-preview {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
}
.scope-preview strong {
  color: var(--text-main);
  font-size: 0.95rem;
}
.custom-catalog-picker {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
}
.custom-catalog-picker[hidden] {
  display: none;
}
.custom-catalog-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  flex-wrap: wrap;
}
.custom-catalog-header strong {
  display: block;
  color: var(--text-main);
}
.custom-catalog-header span {
  display: block;
  margin-top: 0.2rem;
  color: var(--text-muted);
  font-size: 0.82rem;
}
.custom-catalog-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.custom-catalog-list {
  display: grid;
  gap: 0.55rem;
  max-height: min(46vh, 430px);
  overflow: auto;
  padding-right: 0.25rem;
}
.custom-catalog-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-base);
  cursor: pointer;
}
.custom-catalog-item input {
  margin-top: 0.2rem;
}
.custom-catalog-item strong,
.custom-catalog-item small,
.custom-catalog-item em {
  display: block;
  overflow-wrap: anywhere;
}
.custom-catalog-item small {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-top: 0.15rem;
}
.custom-catalog-item em {
  color: var(--text-main);
  font-size: 0.84rem;
  font-style: normal;
  margin-top: 0.25rem;
}
.custom-catalog-empty {
  padding: 1rem;
  color: var(--text-muted);
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 8px;
}
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  color: var(--text-main);
  font-size: 0.875rem;
}
.checkbox-row input {
  margin-top: 0.2rem;
}

/* Views */
.view {
  display: none;
}
.view.active {
  display: block;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Login screen */
#login-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-base);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: white;
  width: 100%;
  max-width: 400px;
  padding: 2.5rem;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.05);
  border: 1px solid var(--border);
  text-align: center;
}

/* Production app shell */
[hidden] {
  display: none !important;
}

/* Topbar datetime */
.topbar-datetime {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  border-right: 1px solid var(--border);
  padding-right: 0.75rem;
  margin-right: 0;
}

/* Sidebar user card */
.sidebar-active-company {
  position: relative;
  margin: 0.7rem 1.25rem 0.15rem;
  padding: 1rem 0 0;
  border-top: 1px solid rgba(255,255,255,0.12);
  color: #f8fafc;
  font-size: 0.84rem;
  font-weight: 750;
  line-height: 1.3;
  text-transform: none;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.sidebar-active-company::before {
  content: "Trabalhando em";
  display: block;
  margin-bottom: 0.32rem;
  color: rgba(217, 255, 87, 0.72);
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0;
}
.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--secondary);
  color: var(--primary);
  font-weight: 800;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}

/* Refresh icon spin animation */
@keyframes spin-icon {
  to { transform: rotate(360deg); }
}
.refresh-loading #refresh-icon {
  animation: spin-icon 0.8s linear infinite;
}

/* Plan progress bar */
.plan-progress-bar-wrap {
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(4,64,26,0.02);
}
.plan-progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  font-weight: 600;
}
#plan-progress-pct { color: var(--primary); font-weight: 700; }
.plan-progress-track {
  height: 8px;
  background: var(--border);
  border-radius: 9999px;
  overflow: hidden;
}
.plan-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-light), var(--secondary));
  border-radius: 9999px;
  width: 0%;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-screen {
  position: fixed;
  inset: 0;
  background: #03300f;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
  overflow: hidden;
}

.auth-screen.diagnostic-open {
  align-items: flex-start;
  overflow-y: auto;
  padding: 2rem 1rem 11rem;
}

#auth-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.auth-screen .auth-card {
  position: relative;
  z-index: 1;
}

.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
}

.loading-screen {
  flex-direction: column;
  gap: 1rem;
  color: var(--text-muted);
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.auth-card {
  width: min(460px, 100%);
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 16px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.55), 0 0 0 1px rgba(189,252,53,0.12);
  padding: 2rem;
  animation: loginSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.auth-card.diagnostic-mode {
  width: min(980px, 100%);
}

.auth-card.consultant-mode {
  width: min(720px, 100%);
}
@keyframes loginSlideIn {
  from { opacity: 0; transform: translateY(40px) scale(0.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.auth-brand h1 {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.auth-brand p,
.help-text,
.card-subtitle,
.table-subtext {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.auth-tab {
  border: 0;
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.7rem 0.5rem;
  cursor: pointer;
}

.auth-tab.active {
  background: var(--primary);
  color: white;
}

.auth-panel {
  display: none;
}

.auth-panel.active {
  display: block;
}

.diagnostic-panel.active {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.consultant-panel.active {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.consultant-header {
  border: 1px solid rgba(6, 87, 36, 0.16);
  border-radius: 12px;
  padding: 1.1rem;
  background: linear-gradient(135deg, rgba(6, 87, 36, 0.08), rgba(189, 252, 53, 0.12));
}

.consultant-header h2 {
  font-size: 1.35rem;
  margin: 0.2rem 0 0.35rem;
}

.consultant-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.consultant-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.consultant-consent {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem;
  background: #f8fafc;
}

.consultant-diagnostic-summary {
  border: 1px solid rgba(6, 87, 36, 0.18);
  border-radius: 12px;
  background: #f8fafc;
  padding: 1rem;
}

.consultant-diagnostic-summary h3 {
  margin: 0.15rem 0 0.5rem;
  font-size: 1.1rem;
}

.consultant-diagnostic-summary p {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.consultant-diagnostic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 0.85rem;
}

.consultant-diagnostic-grid div {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  padding: 0.7rem;
}

.consultant-diagnostic-grid span {
  color: var(--text-muted);
  display: block;
  font-size: 0.75rem;
  margin-bottom: 0.25rem;
}

.consultant-diagnostic-grid strong {
  font-size: 0.9rem;
}

.sr-only-field {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.request-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.diagnostic-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  gap: 1.25rem;
  align-items: end;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem;
  background: linear-gradient(135deg, rgba(6, 87, 36, 0.08), rgba(189, 252, 53, 0.16));
}

.diagnostic-header h2 {
  font-size: 1.35rem;
  margin: 0.2rem 0 0.35rem;
}

.diagnostic-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.diagnostic-kicker {
  color: var(--primary);
  display: inline-flex;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.diagnostic-iso-field {
  margin-bottom: 0;
}

.diagnostic-questions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.diagnostic-question {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.95rem;
  background: #ffffff;
}

.diagnostic-question-number {
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  background: rgba(6, 87, 36, 0.08);
  font-weight: 800;
  font-size: 0.78rem;
}

.diagnostic-question strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.diagnostic-question small {
  display: block;
  min-height: 2.55rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.diagnostic-question .form-control {
  grid-column: 1 / -1;
}

.diagnostic-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.diagnostic-result {
  border: 1px solid rgba(6, 87, 36, 0.18);
  border-radius: 14px;
  padding: 1.1rem;
  background: #f8fafc;
}

.diagnostic-result-grid {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: center;
}

.diagnostic-radar-card {
  min-height: 320px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: radial-gradient(circle at center, rgba(189, 252, 53, 0.14), rgba(255, 255, 255, 0.98) 62%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
}

.diagnostic-radar {
  width: 100%;
  max-width: 360px;
  height: auto;
}

.diagnostic-radar-grid {
  fill: none;
  stroke: rgba(100, 116, 139, 0.28);
  stroke-width: 1;
}

.diagnostic-radar-axis {
  stroke: rgba(6, 87, 36, 0.18);
  stroke-width: 1;
}

.diagnostic-radar-fill {
  fill: rgba(6, 87, 36, 0.22);
  stroke: none;
}

.diagnostic-radar-line {
  fill: none;
  stroke: var(--primary);
  stroke-width: 3;
  stroke-linejoin: round;
}

.diagnostic-radar-dot {
  fill: var(--secondary);
  stroke: var(--primary);
  stroke-width: 2;
}

.diagnostic-radar-label {
  fill: var(--text-main);
  font-size: 10px;
  font-weight: 700;
}

.diagnostic-summary h3 {
  font-size: 1.45rem;
  margin: 0.35rem 0 0.55rem;
}

.diagnostic-summary p {
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 1rem;
}

.diagnostic-score-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid rgba(6, 87, 36, 0.14);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  background: rgba(6, 87, 36, 0.05);
  margin-bottom: 0.7rem;
}

.diagnostic-score-row.warning {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.2);
}

.diagnostic-score-row span {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.diagnostic-score-row strong {
  text-align: right;
}

.diagnostic-next-steps {
  margin-top: 1rem;
}

.diagnostic-next-steps strong {
  display: block;
  margin-bottom: 0.5rem;
}

.diagnostic-next-steps ul {
  padding-left: 1.1rem;
  color: var(--text-muted);
  line-height: 1.55;
  font-size: 0.9rem;
}

.diagnostic-axis-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.diagnostic-axis-list > div {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  background: #fff;
}

.diagnostic-axis-list span {
  color: var(--text-muted);
  display: block;
  font-size: 0.76rem;
  margin-bottom: 0.25rem;
}

.diagnostic-axis-list strong {
  display: block;
  margin-bottom: 0.45rem;
}

.diagnostic-axis-bar {
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: #e2e8f0;
}

.diagnostic-axis-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 999px;
}

.btn-link,
.btn-ghost {
  background: transparent;
  color: var(--primary);
  border: 0;
}

.btn-link:hover,
.btn-ghost:hover {
  background: rgba(6, 87, 36, 0.08);
}

.sidebar-title {
  font-weight: 700;
  font-size: 1.05rem;
}

.sidebar-subtitle,
#user-role-display {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 0.2rem;
}

.nav-item {
  width: 100%;
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 20px;
  color: rgba(255,255,255,0.72);
}

.nav-icon svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
  color: white;
}

.sidebar-user {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.06);
}

.sidebar-user .btn {
  margin-top: 0.65rem;
  color: white;
  min-height: 32px;
  padding: 0.35rem 0;
  font-size: 0.78rem;
  box-shadow: none;
}

.topbar h2 {
  font-size: 1.1rem;
  margin-bottom: 0.15rem;
}

.topbar p {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.active-company-switcher {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 42px;
  padding: 0.32rem 0.4rem 0.32rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg-card) 88%, var(--primary-soft));
  box-shadow: var(--shadow-sm);
}

.active-company-heading {
  display: grid;
  gap: 0.1rem;
  min-width: 150px;
  max-width: 260px;
}

.active-company-heading span {
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.active-company-heading strong {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: var(--text-main);
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.12;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-company-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.active-company-search .form-control:not(.active-company-native-select) {
  width: min(260px, 24vw);
  min-height: 34px;
  padding: 0.35rem 0.75rem;
  border-radius: 10px;
  background: var(--bg-card);
  font-size: 0.8rem;
  font-weight: 650;
}

.active-company-search .btn {
  min-height: 34px;
  padding-inline: 0.75rem;
  border-radius: 10px;
}

.active-company-native-select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.active-company-search-results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 50;
  width: min(420px, 86vw);
  max-height: 340px;
  overflow-y: auto;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
}

.active-company-result {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.7rem 0.75rem;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-main);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.active-company-result:hover,
.active-company-result.is-active {
  background: var(--primary-soft);
}

.active-company-result strong {
  display: block;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.2;
}

.active-company-result small {
  display: block;
  margin-top: 0.18rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.25;
}

.active-company-result em {
  flex: 0 0 auto;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.active-company-search-empty {
  padding: 0.8rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
}

.row-active-company {
  background: rgba(16, 185, 129, 0.08);
}

.toolbar {
  display: flex;
  gap: 1rem;
  align-items: end;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.toolbar .form-group {
  margin-bottom: 0;
  min-width: 260px;
}

.notice-grid,
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.notice-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform 0.2s, box-shadow 0.2s;
}
.notice-panel:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.07);
}

.notice-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.notice-icon-danger  { background: rgba(239,68,68,0.1);  color: var(--status-vencida); }
.notice-icon-warning { background: rgba(245,158,11,0.1); color: var(--status-andamento); }
.notice-icon-primary { background: rgba(4,64,26,0.1);   color: var(--primary-light); }
.notice-icon-muted   { background: rgba(100,116,139,0.1); color: var(--text-muted); }

.notice-panel strong {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  margin: 0.2rem 0;
}

.notice-panel p {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin: 0;
}

.notice-label {
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.notice-panel.danger { border-color: var(--status-vencida); }
.notice-panel.warning { border-color: var(--status-andamento); }
.notice-panel.primary { border-color: var(--primary-light); }
.notice-panel.muted { border-color: var(--status-naoiniciada); }

.card-body {
  padding: 1.5rem;
}

.form-card .form-group {
  margin-bottom: 1rem;
}

.activity-list {
  padding: 0.5rem 1rem;
}

.activity-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 80px;
  gap: 1rem;
  align-items: start;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
}

.activity-row:last-child {
  border-bottom: 0;
}

.activity-row p {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-top: 0.2rem;
  line-height: 1.45;
}

.activity-row time {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-align: right;
}

.activity-type {
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.empty-cell {
  color: var(--text-muted);
  text-align: center;
  padding: 2rem;
}

.message {
  background: #f8fafc;
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem;
  margin-top: 1rem;
  font-size: 0.85rem;
}

.message.success,
.toast.success {
  background: #dcfce7;
  color: #166534;
  border-color: #bbf7d0;
}

.message.warning,
.toast.warning {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}

.message.danger,
.toast.danger {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 10000;
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.12);
  max-width: 360px;
}

/* Modals definitions are consolidated in the premium modals block above */

.detail-grid {
  align-items: start;
}

.detail-wide {
  grid-column: span 2;
}

.detail-label {
  color: var(--text-muted);
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
}

.inline-form {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
  background: #f8fafc;
}

.inline-form h4,
.updates-section h4 {
  margin-bottom: 0.85rem;
  font-size: 0.95rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.badge.neutral {
  background: #eef2f7;
  color: #475569;
}

.badge.neutral::before {
  background: #64748b;
}

code {
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.15rem 0.35rem;
}

.lgpd-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #0f172a;
  color: white;
  padding: 1.25rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  z-index: 10001;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.15);
}
.lgpd-banner p {
  color: #cbd5e1;
  font-size: 0.85rem;
  margin-top: 0.25rem;
  line-height: 1.5;
}
.lgpd-banner strong {
  font-size: 0.95rem;
  color: #f8fafc;
}
.lgpd-banner .btn {
  white-space: nowrap;
}

/* Security Tab */
.security-hero {
  background: #064e2b;
  color: white;
  border-radius: 8px;
  padding: 2rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}
.security-hero-content {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  max-width: 960px;
}
.security-hero-icon {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  display: grid;
  place-items: center;
  color: #d9ff57;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
}
.security-hero-icon svg {
  width: 34px;
  height: 34px;
}
.security-hero h3 {
  color: white;
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
}
.security-hero p {
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.55;
  max-width: 860px;
  margin: 0;
}
.security-trust-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}
.security-trust-strip span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.82rem;
  font-weight: 600;
}
.security-trust-strip span::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d9ff57;
}
.security-section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin: 0 0 1rem;
}
.security-section-heading h3 {
  font-size: 1.1rem;
  color: var(--text-main);
  margin: 0 0 0.25rem;
}
.security-section-heading p {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin: 0;
}
.security-protection-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-card);
  margin-bottom: 2rem;
}
.security-protection-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.35rem;
  min-width: 0;
  border-bottom: 1px solid var(--border);
}
.security-protection-item:nth-child(odd) {
  border-right: 1px solid var(--border);
}
.security-protection-item:nth-last-child(-n+2) {
  border-bottom: 0;
}
.security-line-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  color: var(--primary);
  background: rgba(6, 87, 36, 0.08);
  border-radius: 7px;
}
.security-line-icon svg {
  width: 22px;
  height: 22px;
}
.security-protection-item h4 {
  font-size: 0.95rem;
  margin: 0 0 0.35rem;
  color: var(--text-main);
}
.security-protection-item p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}
.security-responsibility {
  margin-bottom: 2rem;
}
.security-responsibility-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.security-responsibility-column {
  border: 1px solid var(--border);
  border-top: 4px solid var(--primary);
  border-radius: 8px;
  background: var(--bg-card);
  padding: 1.35rem;
}
.security-responsibility-column.client {
  border-top-color: #b7d432;
}
.security-responsibility-title {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.security-responsibility-title h4 {
  font-size: 0.98rem;
  margin: 0 0 0.2rem;
}
.security-responsibility-title p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}
.security-responsibility-mark {
  width: 48px;
  height: 42px;
  flex: 0 0 48px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(6, 87, 36, 0.1);
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 800;
}
.security-responsibility-column.client .security-responsibility-mark {
  background: rgba(183, 212, 50, 0.18);
  color: #49620b;
}
.security-check-list {
  list-style: none;
  display: grid;
  gap: 0.7rem;
  padding: 0;
  margin: 0;
}
.security-check-list li {
  position: relative;
  padding-left: 1.5rem;
  color: var(--text-main);
  font-size: 0.85rem;
  line-height: 1.45;
}
.security-check-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--primary);
  font-weight: 800;
}
.security-guidance {
  margin-bottom: 2rem;
}
.security-guidance-rows {
  border-top: 1px solid var(--border);
}
.security-guidance-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.35fr) minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.security-guidance-row strong {
  color: var(--text-main);
  font-size: 0.87rem;
}
.security-guidance-row span {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
}
.security-lgpd-footer {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: 1.5rem;
  align-items: center;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  background: var(--bg-card);
}
.security-lgpd-footer h3 {
  font-size: 1rem;
  margin: 0 0 0.4rem;
}
.security-lgpd-footer p,
.security-incident-note span {
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.5;
  margin: 0;
}
.security-incident-note {
  padding-left: 1.25rem;
  border-left: 1px solid var(--border);
}
.security-incident-note strong {
  display: block;
  color: #b42318;
  font-size: 0.86rem;
  margin-bottom: 0.25rem;
}
.mt-4 { margin-top: 1.5rem; }

/* Dark Theme Overrides */
body.dark-theme {
  --bg-base: #0f172a;
  --bg-card: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border: #334155;
  --primary: #0a8037;
}
body.dark-theme .btn-secondary {
  background-color: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border);
}
body.dark-theme .btn-secondary:hover { background-color: #334155; }
body.dark-theme .inline-form, body.dark-theme .message {
  background-color: #0f172a;
  border-color: #334155;
  color: #f8fafc;
}
body.dark-theme .table th { background-color: #0f172a; color: #cbd5e1; border-color: #334155; }
body.dark-theme .table td { border-bottom-color: #334155; }
body.dark-theme code { background-color: #0f172a; border-color: #334155; }
body.dark-theme .form-control { background-color: #0f172a; color: #f8fafc; border-color: #334155; }
body.dark-theme .modal { background-color: #1e293b; border-color: #334155; }
body.dark-theme .modal-header, body.dark-theme .modal-footer { border-color: #334155; }
body.dark-theme .card-header, body.dark-theme .activity-row { border-color: #334155; }
body.dark-theme .badge { color: #f8fafc; border: 1px solid rgba(255,255,255,0.1); }
body.dark-theme .badge.concluida { background: rgba(22, 101, 52, 0.4); }
body.dark-theme .badge.andamento { background: rgba(146, 64, 14, 0.4); }
body.dark-theme .badge.vencida { background: rgba(153, 27, 27, 0.4); }
body.dark-theme .badge.analise { background: rgba(30, 64, 175, 0.4); }
body.dark-theme .badge.devolvida { background: rgba(107, 33, 168, 0.4); }
body.dark-theme .badge.naoiniciada { background: rgba(55, 65, 81, 0.4); }
body.dark-theme .badge.cancelada { background: rgba(75, 85, 99, 0.4); }
body.dark-theme .badge.naoaplicavel { background: rgba(51, 65, 85, 0.4); }
body.dark-theme .security-card { background: #0f172a; border-color: #334155; }
body.dark-theme .security-hero {
  background: #063e25;
}
body.dark-theme .security-protection-list,
body.dark-theme .security-responsibility-column,
body.dark-theme .security-lgpd-footer {
  background: #0f172a;
  border-color: #334155;
}
body.dark-theme .security-protection-item,
body.dark-theme .security-responsibility-title,
body.dark-theme .security-guidance-rows,
body.dark-theme .security-guidance-row,
body.dark-theme .security-incident-note {
  border-color: #334155;
}
body.dark-theme .security-line-icon,
body.dark-theme .security-responsibility-mark {
  background: rgba(217, 255, 87, 0.1);
  color: #d9ff57;
}
body.dark-theme .security-responsibility-column.client .security-responsibility-mark {
  background: rgba(217, 255, 87, 0.12);
  color: #d9ff57;
}
body.dark-theme .diagnostic-header,
body.dark-theme .diagnostic-result,
body.dark-theme .diagnostic-radar-card,
body.dark-theme .diagnostic-question,
body.dark-theme .diagnostic-axis-list > div,
body.dark-theme .consultant-header,
body.dark-theme .consultant-consent,
body.dark-theme .consultant-diagnostic-summary,
body.dark-theme .consultant-diagnostic-grid div {
  background: #0f172a;
  border-color: #334155;
}
body.dark-theme .diagnostic-radar-label { fill: #f8fafc; }
body.dark-theme .diagnostic-axis-bar { background: #334155; }

@media (max-width: 900px) {
  .lgpd-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.25rem;
    gap: 1rem;
  }
  body {
    overflow: auto;
    height: auto;
    min-height: 100vh;
  }
  .sidebar {
    width: 220px;
  }
  .content-area {
    padding: 1rem;
  }
  .filter-grid {
    grid-template-columns: 1fr;
  }
  .summary-wide {
    grid-column: span 1;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .form-row,
  .activity-row {
    grid-template-columns: 1fr;
  }
  .activity-row time {
    text-align: left;
  }
  .detail-grid > div {
    grid-column: span 1 !important;
  }
  .card-header {
    align-items: flex-start;
    flex-direction: column;
  }
  .header-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .auth-screen.diagnostic-open {
    padding: 1rem 1rem 13rem;
  }
  .diagnostic-header,
  .diagnostic-questions,
  .diagnostic-result-grid,
  .diagnostic-axis-list,
  .consultant-grid,
  .consultant-diagnostic-grid {
    grid-template-columns: 1fr;
  }
  .auth-card.diagnostic-mode .auth-tabs,
  .auth-card.consultant-mode .auth-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .diagnostic-question small {
    min-height: 0;
  }
  .diagnostic-score-row {
    flex-direction: column;
    gap: 0.25rem;
  }
  .diagnostic-score-row strong {
    text-align: left;
  }
  .diagnostic-radar-card {
    min-height: 260px;
  }
}

@media (max-width: 768px) {
  body {
    display: block !important;
    height: auto !important;
    min-height: 100vh !important;
    overflow: auto !important;
    overflow-x: hidden !important;
  }

  .sidebar {
    position: sticky !important;
    top: 0 !important;
    width: 100% !important;
    max-height: none !important;
    z-index: 30 !important;
    box-shadow: 0 8px 24px rgba(4, 64, 26, 0.18) !important;
  }

  .sidebar-header {
    padding: 0.75rem 1rem;
  }

  .sidebar-logo-container {
    width: 34px;
    height: 34px;
  }

  .sidebar-title {
    font-size: 0.95rem;
  }

  .sidebar-subtitle {
    font-size: 0.68rem;
  }

  .nav-links {
    display: flex !important;
    gap: 0.35rem !important;
    padding: 0.55rem 0.75rem !important;
    overflow-x: auto !important;
    flex: none !important;
    scrollbar-width: thin !important;
  }

  .nav-group {
    display: contents;
  }

  .nav-group-label {
    display: none;
  }

  .nav-group + .nav-group {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .nav-item,
  .nav-item:hover,
  .nav-item.active {
    width: auto;
    flex: 0 0 auto;
    border-left: 0;
    border-radius: 8px;
    padding: 0.62rem 0.75rem;
    gap: 0.45rem;
    font-size: 0.78rem;
    white-space: nowrap;
    transform: none;
  }

  .nav-item.active {
    box-shadow: inset 0 -3px 0 var(--secondary);
  }

  .nav-icon {
    width: 16px;
  }

  .sidebar-user {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.65rem;
    align-items: center;
    padding: 0.75rem 1rem;
  }

  .sidebar-active-company {
    margin: 0;
    padding: 0.5rem 1rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    font-size: 0.7rem;
  }

  .sidebar-active-company::before {
    display: inline;
    margin: 0 0.4rem 0 0;
    font-size: 0.56rem;
  }

  .sidebar-user .btn {
    margin-top: 0;
    padding: 0.45rem 0.65rem;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08);
  }

  .main-content {
    min-height: 100vh;
    overflow: visible;
  }

  .topbar {
    height: auto !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.75rem !important;
    padding: 1rem !important;
    flex-wrap: wrap !important;
  }

  .topbar h2 {
    font-size: 1rem;
  }

  .topbar-actions {
    width: 100% !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    gap: 0.5rem !important;
  }

  .active-company-switcher {
    width: 100% !important;
    align-items: stretch !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    border-radius: 14px !important;
    padding: 0.75rem !important;
  }

  .active-company-heading {
    max-width: 100% !important;
  }

  .active-company-search {
    width: 100% !important;
  }

  .active-company-search .form-control:not(.active-company-native-select) {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
  }

  .active-company-search-results {
    left: 0 !important;
    right: auto !important;
    width: 100% !important;
  }

  .topbar-datetime {
    width: 100% !important;
    border-right: none !important;
    padding-right: 0 !important;
    margin-bottom: 0.25rem !important;
  }

  .content-area {
    padding: 1rem !important;
  }

  .toolbar {
    gap: 0.75rem;
  }

  .toolbar .form-group,
  .toolbar .btn {
    min-width: 0;
    width: 100%;
  }

  /* Redefinindo as grades solicitadas para coluna única */
  .consultant-grid,
  .diagnostic-questions,
  .diagnostic-result-grid,
  .detail-grid,
  .filter-grid,
  .kpi-grid,
  .notice-grid,
  .admin-grid,
  .security-grid {
    grid-template-columns: 1fr !important;
    gap: 0.85rem;
  }

  .security-protection-list,
  .security-responsibility-grid,
  .security-lgpd-footer {
    grid-template-columns: 1fr;
  }

  .security-hero {
    padding: 1.25rem;
  }

  .security-hero-content {
    align-items: flex-start;
  }

  .security-hero-icon {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }

  .security-hero-icon svg {
    width: 27px;
    height: 27px;
  }

  .security-hero h3 {
    font-size: 1.12rem;
  }

  .security-trust-strip {
    gap: 0.6rem 1rem;
  }

  .security-guidance-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .security-protection-item,
  .security-protection-item:nth-child(odd),
  .security-protection-item:nth-last-child(-n+2) {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .security-protection-item:last-child {
    border-bottom: 0;
  }

  .security-incident-note {
    padding-left: 0;
    padding-top: 1rem;
    border-left: 0;
    border-top: 1px solid var(--border);
  }

  .notice-panel,
  .kpi-card,
  .security-card {
    padding: 1rem;
  }

  .card {
    border-radius: 10px;
    margin-bottom: 0.9rem;
  }

  .card-header,
  .card-body {
    padding: 1rem;
  }

  .form-card .btn,
  .header-actions .btn {
    width: 100%;
    justify-content: center;
  }

  /* Modais com tamanho e rolagem interna adequados */
  .modal {
    width: 95vw !important;
    max-height: 90vh !important;
    display: flex !important;
    flex-direction: column !important;
    border-radius: 12px;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 1rem;
  }

  .modal-body {
    overflow-y: auto !important;
    flex: 1 !important;
  }

  .modal-footer {
    flex-direction: column-reverse;
    gap: 0.75rem;
  }

  .modal-footer .btn {
    width: 100%;
    justify-content: center;
  }

  /* Comportamento das tabelas */
  /* Tabelas administrativas (pequenas): mantêm transformação em cards para testes de fumaça passarem */
  .table-responsive {
    overflow: visible;
  }

  .table-responsive table,
  .table-responsive thead,
  .table-responsive tbody,
  .table-responsive tr,
  .table-responsive td {
    display: block;
    width: 100%;
  }

  .table-responsive thead {
    display: none;
  }

  .table-responsive tr {
    margin: 0 0 0.85rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-card);
  }

  .table-responsive tr:nth-child(even) td,
  .table-responsive tr:hover td {
    background: transparent;
  }

  .table-responsive td {
    display: grid;
    grid-template-columns: minmax(94px, 36%) minmax(0, 1fr);
    gap: 0.75rem;
    align-items: start;
    padding: 0.78rem 0.9rem;
    border-bottom: 1px solid var(--border);
    word-break: break-word;
  }

  .table-responsive td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
  }

  .table-responsive td:last-child {
    border-bottom: 0;
  }

  .table-responsive td.empty-cell {
    display: block;
    padding: 1.4rem 1rem;
    text-align: center;
  }

  .table-responsive td.empty-cell::before {
    content: none;
  }

  .request-actions,
  .table-responsive td[data-label="Ação"] {
    gap: 0.5rem;
  }

  .request-actions .btn,
  .table-responsive td[data-label="Ação"] > .btn {
    width: 100%;
    justify-content: center;
  }

  /* Tabelas grandes também viram cards no celular para evitar rolagem lateral. */
  body.is-admin .table-responsive:has(.checklist-table),
  .table-responsive:has(#atas-tbody),
  .table-responsive:has(#inspecoes-tbody),
  .table-responsive:has(#acompanhamentos-tbody) {
    overflow-x: hidden !important;
  }

  body.is-admin .checklist-table,
  .table-responsive:has(#atas-tbody) table,
  .table-responsive:has(#inspecoes-tbody) table,
  .table-responsive:has(#acompanhamentos-tbody) table {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  /* Tela de autenticação e diagnóstico público rolável */
  .auth-screen {
    align-items: flex-start !important;
    overflow-y: auto !important;
    padding: 1.5rem 1rem !important;
  }
  .auth-card {
    padding: 1.5rem 1.25rem !important;
    border-radius: 12px !important;
  }
}

/* ==========================================
   NOVOS STATUS BADGES
   ========================================== */
.badge.aprovada { background: rgba(6, 87, 36, 0.15); color: #065724; }
.badge.aprovada::before { background: #065724; }
.badge.reprovada { background: rgba(239, 68, 68, 0.15); color: #dc2626; }
.badge.reprovada::before { background: #dc2626; }
.badge.analise_consultora { background: rgba(99, 102, 241, 0.15); color: #4f46e5; }
.badge.analise_consultora::before { background: #4f46e5; }
.badge.rotina { background: rgba(6, 182, 212, 0.15); color: #0891b2; }
.badge.rotina::before { background: #0891b2; }
.badge.vencida { background: rgba(220, 38, 38, 0.2); color: #b91c1c; font-weight: 700; }
.badge.vencida::before { background: #b91c1c; }

/* Linha vencida na tabela */
.row-vencida td { background: rgba(220, 38, 38, 0.04); }
.text-danger { color: #dc2626; font-weight: 600; }

/* ==========================================
   BADGE DE NOTIFICAÇÃO
   ========================================== */
.notif-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: #dc2626;
  color: #fff;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

/* ==========================================
   MODAL LARGE
   ========================================== */
.modal-large {
  width: min(900px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
}

/* ==========================================
   IMPORT AREA
   ========================================== */
.import-area {
  padding: 1rem;
  border: 1px dashed var(--border);
  border-radius: 6px;
  margin-bottom: 1rem;
  background: var(--bg-base);
}

/* ==========================================
   DETAIL GRID EXPANDED
   ========================================== */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.detail-wide {
  grid-column: 1 / -1;
}
.detail-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.25rem;
}

/* ==========================================
   ACTIVITY TYPE COLORS
   ========================================== */
.activity-type.status-change { background: rgba(59, 130, 246, 0.15); color: #2563eb; }
.activity-type.deadline-change { background: rgba(245, 158, 11, 0.15); color: #d97706; }
.activity-type.approval { background: rgba(34, 197, 94, 0.15); color: #16a34a; }
.activity-type.rejection { background: rgba(239, 68, 68, 0.15); color: #dc2626; }
.activity-type.admin { background: rgba(6, 87, 36, 0.15); color: #065724; }
.activity-type.evidence { background: rgba(99, 102, 241, 0.15); color: #4f46e5; }

/* ==========================================
   FORM ROW
   ========================================== */
.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
}
.form-row .form-group {
  flex: 1;
  min-width: 180px;
}

/* ==========================================
   INLINE FORM
   ========================================== */
.inline-form {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem;
  margin: 1rem 0;
}
.inline-form h4 {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ==========================================
   KPI GRID EXPANDED
   ========================================== */
@media (min-width: 1200px) {
  .kpi-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* ============================================================
   CHECKLIST — FILTROS E TABELA (Phase 1+2)
   ============================================================ */

.filter-grid-checklist {
  display: grid;
  grid-template-columns: 2fr repeat(4, 1fr) auto auto auto;
  gap: 0.75rem;
  align-items: end;
}

.filter-grid-checklist .fg-search { grid-column: 1 / 2; }
.filter-actions { display: flex; align-items: flex-end; }

@media (max-width: 1200px) {
  .filter-grid-checklist {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: auto auto auto;
  }
  .filter-grid-checklist .fg-search { grid-column: 1 / -1; }
}

@media (max-width: 768px) {
  .filter-grid-checklist {
    grid-template-columns: 1fr 1fr;
  }
  .filter-grid-checklist .fg-search { grid-column: 1 / -1; }
}

/* Tabela checklist — larguras de coluna */
.checklist-table { table-layout: fixed; width: 100%; }
.checklist-table .col-item        { width: 4rem; }
.checklist-table .col-norma       { width: 5rem; }
.checklist-table .col-requisito   { width: 7rem; }
.checklist-table .col-demanda     { width: 14rem; }
.checklist-table .col-acao-desc   { width: 14rem; }
.checklist-table .col-processo    { width: 9rem; }
.checklist-table .col-responsavel { width: 8rem; }
.checklist-table .col-prazo       { width: 6rem; }
.checklist-table .col-status      { width: 8rem; }
.checklist-table .col-encerramento{ width: 7rem; }
.checklist-table .col-btn         { width: 5.5rem; }

.checklist-table td,
.checklist-table th {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
}

/* Linha vencida já existia — garantir destaque */
.row-vencida { background: rgba(239,68,68,0.06) !important; }
.row-vencida td { border-left: 3px solid var(--color-danger, #ef4444); }
.row-vencida:first-child td { border-left-color: var(--color-danger, #ef4444); }

/* Badge status completos */
.badge.naoiniciada        { background: rgba(148,163,184,0.18); color: #64748b; }
.badge.naoiniciada::before{ background: #94a3b8; }
.badge.andamento          { background: rgba(245,158,11,0.15);  color: #d97706; }
.badge.andamento::before  { background: #f59e0b; }
.badge.analise            { background: rgba(59,130,246,0.15);  color: #2563eb; }
.badge.analise::before    { background: #3b82f6; }
.badge.devolvida          { background: rgba(168,85,247,0.15);  color: #7c3aed; }
.badge.devolvida::before  { background: #a855f7; }
.badge.concluida          { background: rgba(34,197,94,0.15);   color: #15803d; }
.badge.concluida::before  { background: #22c55e; }
.badge.aprovada           { background: rgba(16,185,129,0.15);  color: #065f46; }
.badge.aprovada::before   { background: #10b981; }
.badge.reprovada          { background: rgba(239,68,68,0.15);   color: #b91c1c; }
.badge.reprovada::before  { background: #ef4444; }
.badge.rotina             { background: rgba(99,102,241,0.15);  color: #4338ca; }
.badge.rotina::before     { background: #6366f1; }
.badge.naoaplicavel       { background: rgba(203,213,225,0.3);  color: #475569; }
.badge.naoaplicavel::before{ background: #cbd5e1; }
.badge.cancelada          { background: rgba(100,116,139,0.15); color: #475569; }
.badge.cancelada::before  { background: #64748b; }
.badge.vencida            { background: rgba(239,68,68,0.18);   color: #dc2626; font-weight: 700; }
.badge.vencida::before    { background: #dc2626; }
.badge.analise_consultora { background: rgba(59,130,246,0.12);  color: #1d4ed8; }
.badge.analise_consultora::before { background: #3b82f6; }

.badge::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 5px;
  flex-shrink: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Botão de detalhe na tabela */
.btn-detalhe {
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  border-radius: 6px;
  white-space: nowrap;
}

/* Rodapé da tabela */
.table-footer {
  padding: 0.6rem 1rem;
  font-size: 0.8rem;
  color: var(--text-muted, #64748b);
  border-top: 1px solid var(--border, #e2e8f0);
}

/* ============================================================
   IMPORT WIZARD — ESTILOS COMPLETOS
   ============================================================ */

/* Modal maior para o wizard */
.modal-xlarge {
  width: min(1100px, 96vw);
  max-height: 92vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.modal-xlarge .modal-header {
  flex-shrink: 0;
}

/* Barra de etapas */
.wizard-steps {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.45rem;
  flex-wrap: wrap;
}
.wizard-step {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: transparent;
  transition: background 0.2s, color 0.2s;
}
.wizard-step.active {
  background: var(--primary);
  color: #fff;
}
.wizard-step.done {
  background: rgba(6,87,36,0.12);
  color: var(--primary);
}
.wizard-step-sep {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Painéis do wizard */
.wizard-panel { display: block; }
.wizard-panel[hidden] { display: none; }
.wizard-panel-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--text-main);
}

/* Rodapé do wizard */
.wizard-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  gap: 1rem;
}

/* Dropzone de upload */
.import-dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  text-align: center;
  cursor: pointer;
  background: var(--bg-base);
  transition: border-color 0.2s, background 0.2s;
}
.import-dropzone:hover,
.import-dropzone:focus,
.import-dropzone.dragover {
  border-color: var(--primary);
  background: rgba(6,87,36,0.04);
  outline: none;
}
.import-dropzone-inner p {
  margin: 0.4rem 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}
.import-dropzone-icon { font-size: 2.5rem; display: block; margin-bottom: 0.75rem; }
.import-file-hidden {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}
.import-file-info {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.file-chip {
  background: rgba(6,87,36,0.1);
  color: var(--primary);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
}

/* Grade de mapeamento de colunas */
.column-mapping-grid {
  display: grid;
  gap: 0.75rem;
}
.mapping-row {
  display: grid;
  grid-template-columns: 200px 1fr 160px;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
.mapping-row:last-child { border-bottom: 0; }
.mapping-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}
.mapping-auto-badge {
  font-size: 0.72rem;
  color: #16a34a;
  background: rgba(34,197,94,0.1);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.req { color: #dc2626; margin-left: 2px; }

/* Chips de amostra da 1ª linha */
.mapping-sample {
  margin-top: 1.25rem;
  padding: 1rem;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.mapping-sample strong { display: block; margin-bottom: 0.6rem; font-size: 0.82rem; color: var(--text-muted); }
.sample-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.sample-chip {
  font-size: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sample-chip em { color: var(--text-muted); font-style: normal; }

/* Sumário de validação */
.validation-summary { margin-bottom: 0.5rem; }
.validation-pills { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.v-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}
.v-pill.success  { background: rgba(34,197,94,0.12);  color: #15803d; }
.v-pill.warning  { background: rgba(245,158,11,0.12); color: #d97706; }
.v-pill.danger   { background: rgba(239,68,68,0.12);  color: #dc2626; }
.v-pill.neutral  { background: rgba(100,116,139,0.12);color: #475569; }

/* Linhas da prévia coloridas por estado */
.preview-table { font-size: 0.8rem; }
.preview-row-error td { background: rgba(239,68,68,0.06) !important; }
.preview-row-warn  td { background: rgba(245,158,11,0.06) !important; }
.preview-row-skip  td { background: rgba(100,116,139,0.08) !important; opacity: 0.6; }

/* Resultado final */
.import-result-hero {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 1rem;
}
.import-result-hero.success { background: rgba(34,197,94,0.08); border: 1px solid rgba(34,197,94,0.2); }
.import-result-hero.partial { background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.2); }
.import-result-hero h3 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.import-result-hero p  { margin: 0; color: var(--text-muted); font-size: 0.9rem; }
.result-icon { font-size: 2.2rem; flex-shrink: 0; }

@media (max-width: 768px) {
  .mapping-row { grid-template-columns: 1fr 1fr; }
  .mapping-auto-badge { display: none; }
  .wizard-footer { flex-direction: column; }
  .wizard-footer .btn { width: 100%; justify-content: center; }
  .modal-xlarge { max-height: 95vh; }
}

/* ============================================================
   DASHBOARD DE RELATÓRIOS
   ============================================================ */

/* Grade de filtros do relatório */
.filter-grid-report {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr 1fr auto auto auto;
  gap: 0.75rem;
  align-items: end;
  padding: 1rem;
}
@media (max-width: 1400px) {
  .filter-grid-report { grid-template-columns: 1fr 1fr 1fr 1fr; }
}
@media (max-width: 900px) {
  .filter-grid-report { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .filter-grid-report { grid-template-columns: 1fr; }
}

/* Grade de gráficos */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.charts-grid-single {
  grid-template-columns: minmax(0, 1fr);
}
.chart-card-wide {
  grid-column: 1 / -1;
}
@media (max-width: 900px) {
  .charts-grid { grid-template-columns: 1fr; }
  .chart-card-wide { grid-column: 1; }
}

.chart-card .card-body {
  min-height: 280px;
}
.chart-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
}
.chart-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}
.bar-wrap, .line-wrap {
  flex-direction: column;
  align-items: stretch;
  overflow-x: auto;
}

/* Legenda de gráfico */
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.78rem;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--bg-base);
  border: 1px solid var(--border);
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Barras horizontais */
.bar-chart {
  width: 100%;
}
.bar-row {
  display: grid;
  grid-template-columns: 140px 1fr 48px;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
}
.bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-main);
  text-align: right;
  padding-right: 0.5rem;
}
.bar-track {
  background: var(--bg-base);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
  min-width: 2px;
}
.bar-value {
  color: var(--text-muted);
  font-weight: 600;
  text-align: right;
}

.dashboard-progress-card {
  margin-bottom: 1rem;
}
.dashboard-progress-percent {
  color: var(--primary);
  font-size: 1.8rem;
  line-height: 1;
}
.dashboard-progress-track {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  overflow: hidden;
}
.dashboard-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #22c55e);
  transition: width .35s ease;
}
.dashboard-status-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: .5rem;
  margin-top: .85rem;
}
.dashboard-status-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .55rem .65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-base);
  color: var(--text-muted);
  font-size: .82rem;
}
.dashboard-status-pill strong {
  color: var(--text-main);
  font-size: 1rem;
}
.dashboard-status-pill.concluida { border-left: 4px solid #22c55e; }
.dashboard-status-pill.andamento { border-left: 4px solid #f59e0b; }
.dashboard-status-pill.vencida { border-left: 4px solid #dc2626; }
.dashboard-status-pill.warning { border-left: 4px solid #f97316; }
.dashboard-status-pill.neutral { border-left: 4px solid #64748b; }

.item-action-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .4rem;
  flex-wrap: wrap;
}

/* KPI grid do relatório */
.rel-kpi-grid {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

/* Gráfico de linha mensal */
.line-chart-svg {
  width: 100%;
  height: 200px;
  overflow: visible;
}

/* Vazio de gráfico */
.chart-empty {
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 2rem;
  text-align: center;
  width: 100%;
}

/* Compatibilidade: ocultar canvas antigo (substituído por SVG) */
#status-chart-canvas { display: none !important; }
#chart-legend { display: none !important; }

/* ============================================================
   SISTEMA DE ALERTAS — NOTIFICAÇÕES UI
   ============================================================ */

/* Abas de filtro */
.notif-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  padding: 0 1rem;
}
.notif-tab {
  padding: .65rem 1rem;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: .4rem;
  transition: color .15s, border-color .15s;
}
.notif-tab:hover { color: var(--text-main); }
.notif-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.notif-tab-badge {
  background: rgba(100,116,139,.15);
  color: var(--text-muted);
  border-radius: 999px;
  font-size: .7rem;
  padding: .1rem .45rem;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
}
.notif-tab.active .notif-tab-badge {
  background: rgba(6,87,36,.12);
  color: var(--primary);
}

/* Filtros */
.notif-filters {
  display: flex;
  gap: .75rem;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  align-items: center;
}

/* Lista de notificações */
.notif-list {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

/* Card individual de notificação */
.notif-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: .75rem 1rem;
  align-items: start;
  transition: box-shadow .2s;
}
.notif-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,.07);
}
.notif-card.unread {
  border-left: 4px solid var(--primary);
  background: linear-gradient(to right, rgba(6,87,36,.03) 0%, transparent 100%);
}

/* Ícone de urgência */
.notif-urgency-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.notif-urgency-critical .notif-urgency-icon  { background: rgba(220,38,38,.12); }
.notif-urgency-high     .notif-urgency-icon  { background: rgba(245,158,11,.12); }
.notif-urgency-medium   .notif-urgency-icon  { background: rgba(99,102,241,.1); }
.notif-urgency-low      .notif-urgency-icon  { background: rgba(34,197,94,.1); }

/* Conteúdo */
.notif-content-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 .2rem;
}
.notif-content-body {
  font-size: .82rem;
  color: var(--text-muted);
  margin: 0 0 .4rem;
  line-height: 1.45;
}
.notif-meta {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  align-items: center;
  font-size: .75rem;
  color: var(--text-muted);
}

/* Ações do card */
.notif-actions {
  display: flex;
  gap: .4rem;
  align-items: flex-start;
  flex-shrink: 0;
}

/* Contador urgente no badge do sino */
.notif-badge-critical {
  background: #dc2626 !important;
}

/* Grid de filas de envio */
.alert-queue-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.alert-queue-card {
  display: flex;
  gap: .85rem;
  align-items: flex-start;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
}
.alert-queue-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}
.alert-queue-card strong { display: block; margin-bottom: .3rem; }
.alert-queue-card p {
  font-size: .82rem;
  color: var(--text-muted);
  margin: 0 0 .4rem;
  line-height: 1.45;
}

@media (max-width: 768px) {
  .alert-queue-grid { grid-template-columns: 1fr; }
  .notif-card { grid-template-columns: auto 1fr; }
  .notif-actions { grid-column: 1 / -1; justify-content: flex-end; }
}


/* Badge: dias em atraso */
.badge-days-late {
  display: inline-block;
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fca5a5;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 6px;
  margin-left: 4px;
  white-space: nowrap;
  vertical-align: middle;
}

/* Responsividade: filtro de prazo no mobile */
@media (max-width: 768px) {
  .filter-grid {
    grid-template-columns: 1fr 1fr;
  }
  
  #due-from, #due-to {
    font-size: 0.8rem;
  }
}

/* ============================================================
   VISÃO CLIENTE — MEU PAINEL (Legenda, KPIs, Banners, Botões)
   ============================================================ */

.client-dashboard-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.client-welcome-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.client-welcome-box h3 {
  margin: 0;
  font-size: 1.3rem;
  color: var(--text-main);
}

.client-welcome-box p {
  margin: 0.25rem 0 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.client-welcome-meta {
  text-align: right;
}

@media (max-width: 768px) {
  .client-welcome-box {
    flex-direction: column;
    align-items: flex-start;
  }
  .client-welcome-meta {
    text-align: left;
  }
}

.client-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
}

@media (max-width: 1200px) {
  .client-kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .client-kpi-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .client-kpi-grid {
    grid-template-columns: 1fr;
  }
}

.client-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  transition: all 0.25s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 125px;
}

.client-kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(6, 87, 36, 0.08);
  border-color: rgba(6, 87, 36, 0.2);
}

.client-kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.client-kpi-card.kpi-mine::before { background: var(--primary, #065724); }
.client-kpi-card.kpi-overdue::before { background: var(--color-danger, #dc2626); }
.client-kpi-card.kpi-soon::before { background: #f59e0b; }
.client-kpi-card.kpi-analise::before { background: #3b82f6; }
.client-kpi-card.kpi-done::before { background: #22c55e; }

.client-kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.client-kpi-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.client-kpi-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.client-kpi-card.kpi-mine .client-kpi-icon-wrap { background: rgba(6, 87, 36, 0.08); color: var(--primary); }
.client-kpi-card.kpi-overdue .client-kpi-icon-wrap { background: rgba(220, 38, 38, 0.08); color: #dc2626; }
.client-kpi-card.kpi-soon .client-kpi-icon-wrap { background: rgba(245, 158, 11, 0.08); color: #f59e0b; }
.client-kpi-card.kpi-analise .client-kpi-icon-wrap { background: rgba(59, 130, 246, 0.08); color: #3b82f6; }
.client-kpi-card.kpi-done .client-kpi-icon-wrap { background: rgba(34, 197, 94, 0.08); color: #22c55e; }

.client-kpi-val {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.client-shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

@media (max-width: 1024px) {
  .client-shortcuts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .client-shortcuts-grid {
    grid-template-columns: 1fr;
  }
}

.btn-shortcut {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  text-align: left;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.01);
  width: 100%;
}

.btn-shortcut:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(6, 87, 36, 0.06);
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(6, 87, 36, 0.02) 100%);
}

.btn-shortcut-icon {
  font-size: 1.6rem;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-shortcut:hover .btn-shortcut-icon {
  background: rgba(6, 87, 36, 0.08);
  color: var(--primary);
}

.btn-shortcut-text strong {
  display: block;
  font-size: 0.92rem;
  color: var(--text-main);
}

.btn-shortcut-text span {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: block;
  margin-top: 0.15rem;
}

.status-legend-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

.status-legend-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 1rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-legend-table {
  width: 100%;
  border-collapse: collapse;
}

.status-legend-table tr {
  border-bottom: 1px solid var(--border);
}

.status-legend-table tr:last-child {
  border-bottom: none;
}

.status-legend-table td {
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: var(--text-main);
}

.status-legend-table td.legend-badge-col {
  width: 200px;
}

.status-legend-table td.legend-desc-col {
  color: var(--text-muted);
  line-height: 1.4;
}

@media (max-width: 600px) {
  .status-legend-table tr {
    display: block;
    padding: 0.6rem 0;
  }
  .status-legend-table td {
    display: block;
    padding: 0.25rem 0;
  }
}

.btn-prominent-action {
  background: linear-gradient(135deg, #065724 0%, #087330 100%) !important;
  color: #ffffff !important;
  padding: 0.8rem 2.2rem !important;
  font-size: 1.02rem !important;
  font-weight: 700 !important;
  border: none !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 15px rgba(6, 87, 36, 0.28) !important;
  transition: all 0.2s ease-in-out !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.6rem !important;
  cursor: pointer !important;
}

.btn-prominent-action:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 20px rgba(6, 87, 36, 0.4) !important;
  background: linear-gradient(135deg, #087330 0%, #0a8f3c 100%) !important;
}

.btn-prominent-action:active {
  transform: translateY(0) !important;
}

.client-instruction-banner {
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  border-left: 5px solid;
}

.client-instruction-banner.banner-danger {
  background: rgba(239, 68, 68, 0.05);
  border-color: #dc2626;
  color: #7f1d1d;
}

.client-instruction-banner.banner-warning {
  background: rgba(245, 158, 11, 0.05);
  border-color: #f59e0b;
  color: #78350f;
}

.client-instruction-banner.banner-info {
  background: rgba(59, 130, 246, 0.05);
  border-color: #3b82f6;
  color: #1e3a8a;
}

.client-instruction-banner.banner-success {
  background: rgba(34, 197, 94, 0.05);
  border-color: #22c55e;
  color: #064e3b;
}

.client-instruction-banner.banner-muted {
  background: rgba(148, 163, 184, 0.05);
  border-color: #64748b;
  color: #334155;
}

.client-instruction-banner p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
}

.client-instruction-banner p.explanation-text {
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.badge.a_vencer {
  background: rgba(245, 158, 11, 0.15) !important;
  color: #b45309 !important;
  border: 1px solid rgba(245, 158, 11, 0.3) !important;
}

.badge.a_vencer::before {
  background: #f59e0b;
}

/* ============================================================
   VALORES E AJUSTES DE RESPONSIVIDADE ADICIONAIS (CLIENTE/CELULAR)
   ============================================================ */

/* Filtros colapsados para coluna única em celulares de 390px e 430px */
@media (max-width: 480px) {
  .filter-grid-checklist {
    grid-template-columns: 1fr !important;
  }
  .filter-actions {
    width: 100% !important;
  }
  .filter-actions .btn {
    width: 100% !important;
    justify-content: center !important;
  }
}

/* Modificações específicas para checklist na Visão Cliente sob Mobile */
@media (max-width: 768px) {
  /* Tabela de checklist colapsa para cards se for cliente */
  body.is-client .table-responsive:has(.checklist-table) table {
    min-width: 0 !important;
  }

  /* Redefine quebra de texto natural para que a informação de demandas e ações não fique cortada */
  body.is-client .checklist-table td {
    white-space: normal !important;
    text-overflow: clip !important;
    overflow: visible !important;
  }

  /* Transforma a TD de Detalhe em botão 100% expandido no rodapé do card */
  body.is-client .checklist-table td[data-label="Detalhe"] {
    display: block !important;
    text-align: center !important;
    border-bottom: 0 !important;
    padding: 1rem !important;
    grid-template-columns: 1fr !important;
  }

  body.is-client .checklist-table td[data-label="Detalhe"]::before {
    display: none !important;
  }

  body.is-client .checklist-table td[data-label="Detalhe"] .btn-detalhe {
    width: 100% !important;
    justify-content: center !important;
    padding: 0.75rem !important;
    font-size: 0.9rem !important;
  }
}

/* ============================================================
   POLIMENTO VISUAL SEGURO — Design System ASM
   ============================================================ */

.page-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.section-header,
.data-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

.section-header h2,
.section-header h3,
.data-panel-header h3 {
  margin: 0;
  line-height: 1.25;
}

.action-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.data-panel,
.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.toolbar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
  align-items: end;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 24px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text-main);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.config-split-intro,
.template-page-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  padding: var(--space-6);
}

.config-split-intro h3,
.template-page-intro h3 {
  margin: 0.55rem 0 0.3rem;
}

.config-split-intro p,
.template-page-intro p {
  margin: 0;
  max-width: 720px;
  color: var(--text-muted);
}

.config-split-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.empty-state {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--bg-card) 78%, var(--bg-alt));
}

body,
input,
button,
select,
textarea {
  letter-spacing: 0;
}

.btn {
  border-radius: var(--radius-md);
  min-height: 40px;
  padding: 0.55rem 0.9rem;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary {
  background: linear-gradient(180deg, var(--primary-light), var(--primary));
}

.btn-primary:hover {
  background: linear-gradient(180deg, #0a7832, var(--primary));
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
}

.btn-secondary:hover,
.btn-outline:hover,
.btn-link:hover,
.btn-ghost:hover {
  border-color: var(--primary-ring);
  background: var(--primary-soft);
}

.btn-danger {
  background: #b91c1c;
}

.btn-sm {
  min-height: 34px;
  padding: 0.38rem 0.65rem;
}

.card,
.kpi-card,
.notice-panel,
.client-kpi-card,
.client-welcome-box,
.status-legend-card,
.btn-shortcut,
.filter-card,
.inline-form,
.panel-block,
.scope-preview,
.diagnostic-result,
.diagnostic-question,
.diagnostic-radar-card,
.consultant-header,
.consultant-consent,
.consultant-diagnostic-summary,
.alert-queue-card {
  border-radius: var(--radius-md);
}

.card,
.kpi-card,
.notice-panel,
.client-kpi-card,
.client-welcome-box,
.status-legend-card {
  box-shadow: var(--shadow-sm);
}

.card:hover,
.kpi-card:hover,
.notice-panel:hover,
.client-kpi-card:hover,
.btn-shortcut:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  min-height: 58px;
  padding: 0.9rem 1.25rem;
}

.card-header h3 {
  font-size: 1rem;
  line-height: 1.25;
}

.card-body {
  padding: 1.25rem;
}

.content-area {
  background:
    linear-gradient(180deg, rgba(4, 64, 26, 0.025), transparent 220px),
    var(--bg-base);
}

.topbar {
  height: 68px;
  padding: 0 1.5rem;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.topbar h2 {
  font-size: 1.15rem;
}

.topbar-actions {
  gap: var(--space-2);
}

.sidebar {
  box-shadow: inset -1px 0 rgba(255, 255, 255, 0.08);
}

.sidebar-header {
  min-height: 76px;
}

.nav-links {
  overflow-y: auto;
}

.nav-item {
  min-height: 44px;
  border-left: 0;
}

.nav-item:hover,
.nav-item.active {
  border-left-color: transparent;
}

.form-control {
  border-radius: var(--radius-md);
  min-height: 40px;
}

.form-control:focus {
  box-shadow: var(--shadow-focus);
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-alt);
  letter-spacing: 0;
}

td,
th {
  vertical-align: middle;
}

.table-responsive {
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.badge {
  min-height: 24px;
  border-radius: var(--radius-pill);
  letter-spacing: 0;
}

.kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-4);
}

.kpi-card {
  padding: 1rem;
  min-height: 128px;
}

.kpi-title,
.notice-label,
.summary-label,
.detail-label,
.client-kpi-title {
  letter-spacing: 0;
}

.kpi-value {
  font-size: clamp(1.75rem, 2.2rem, 2.2rem);
}

.kpi-icon,
.client-kpi-icon-wrap,
.btn-shortcut-icon,
.notice-icon,
.alert-queue-icon {
  border-radius: var(--radius-md);
}

.notice-panel {
  align-items: flex-start;
  border-color: var(--border);
}

.notice-panel.danger,
.notice-panel.warning,
.notice-panel.primary,
.notice-panel.muted {
  border-color: var(--border);
  border-left-width: 4px;
}

.notice-panel.danger { border-left-color: var(--status-vencida); }
.notice-panel.warning { border-left-color: var(--status-andamento); }
.notice-panel.primary { border-left-color: var(--primary-light); }
.notice-panel.muted { border-left-color: var(--status-naoiniciada); }

.filter-card {
  padding: 1rem;
}

.filter-grid,
.filter-grid-report {
  align-items: end;
}

.chart-card .card-body {
  min-height: 300px;
}

.chart-body,
.chart-wrap {
  min-height: 220px;
}

.chart-legend {
  gap: var(--space-2);
  justify-content: flex-start;
}

.legend-item {
  background: var(--bg-card);
}

.chart-empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-alt);
}

.auth-screen {
  background:
    radial-gradient(circle at center, rgba(189, 252, 53, 0.08), transparent 34rem),
    #03300f;
}

.auth-card {
  border-radius: 14px;
  padding: 2rem;
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.42);
}

.auth-brand {
  align-items: flex-start;
}

.auth-brand .brand-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.35rem;
}

.auth-tabs {
  border-radius: var(--radius-md);
}

.auth-tab {
  min-height: 48px;
  transition: background 0.2s ease, color 0.2s ease;
}

.auth-tab:not(.active):hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.lgpd-banner {
  left: 50%;
  right: auto;
  bottom: 1rem;
  width: min(1120px, calc(100% - 2rem));
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.26);
}

.alert-queue-grid {
  gap: var(--space-4);
}

.alert-queue-card {
  align-items: flex-start;
}

#wa-qr-box {
  background: var(--bg-alt) !important;
}

#wa-qr-img {
  box-shadow: var(--shadow-sm);
}

.modal {
  border-radius: var(--radius-md);
}

body.dark-theme {
  --bg-base: #0b1220;
  --bg-card: #111827;
  --bg-alt: #0f172a;
  --text-main: #f8fafc;
  --text-muted: #cbd5e1;
  --border: #263244;
  --border-strong: #334155;
  --primary: #12a150;
  --primary-light: #22c55e;
  --primary-soft: rgba(34, 197, 94, 0.1);
  --primary-ring: rgba(34, 197, 94, 0.2);
}

body.dark-theme .content-area,
body.dark-theme th,
body.dark-theme .panel-block,
body.dark-theme .inline-form,
body.dark-theme .scope-preview,
body.dark-theme .message,
body.dark-theme .chart-empty,
body.dark-theme .empty-state,
body.dark-theme .consultant-consent,
body.dark-theme .consultant-diagnostic-summary,
body.dark-theme .diagnostic-result,
body.dark-theme .diagnostic-question,
body.dark-theme .diagnostic-axis-list > div,
body.dark-theme .diagnostic-radar-card {
  background: var(--bg-alt);
}

body.dark-theme td {
  border-color: var(--border);
}

body.dark-theme tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.025);
}

body.dark-theme tr:hover td {
  background: rgba(34, 197, 94, 0.06);
}

body.dark-theme .badge.neutral {
  background: #1f2937;
  color: #e5e7eb;
  border-color: #334155;
}

@media (max-width: 900px) {
  .topbar {
    height: auto;
    min-height: 64px;
  }

  .action-bar,
  .topbar-actions {
    justify-content: flex-start;
  }

  .lgpd-banner {
    bottom: 0.75rem;
    align-items: stretch;
  }

  .lgpd-banner .btn {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .content-area {
    padding: 0.85rem;
  }

  .card-header,
  .section-header,
  .data-panel-header {
    gap: var(--space-3);
  }

  .card-body {
    padding: 1rem;
  }

  .btn,
  .form-control {
    width: 100%;
  }

  .topbar-actions .btn,
  .topbar-actions .active-company-switcher .form-control,
  .modal-footer .btn,
  .button-row .btn {
    width: auto;
  }

  .table-responsive {
    border: 1px solid var(--border);
  }
}

@media (max-width: 520px) {
  .auth-card {
    padding: 1.25rem;
  }

  .auth-brand {
    gap: var(--space-3);
  }

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

  .lgpd-banner {
    width: calc(100% - 1rem);
    bottom: 0.5rem;
    padding: 0.7rem;
    gap: 0.55rem;
  }

  .lgpd-banner strong {
    font-size: 0.8rem;
  }

  .lgpd-banner p {
    font-size: 0.7rem;
    line-height: 1.35;
    margin-top: 0.15rem;
  }

  .lgpd-banner .btn {
    min-height: 38px;
    padding: 0.45rem 0.7rem;
    font-size: 0.76rem;
  }
}

/* ==========================================
   AUTENTICAÇÃO - EXPERIÊNCIA CORPORATIVA
   ========================================== */
.auth-screen {
  --auth-green-deep: #033d19;
  --auth-green: #075c2b;
  --auth-lime: #bdfc35;
  align-items: center;
  overflow-y: auto;
  padding: 2rem 2rem 7.5rem;
  background:
    linear-gradient(135deg, rgba(3, 48, 15, 0.97), rgba(5, 72, 31, 0.93)),
    #03300f;
}

.auth-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 86%);
}

#auth-canvas {
  opacity: 0.35;
}

.auth-screen .auth-card {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(440px, 1.05fr);
  width: min(1080px, 100%);
  min-height: 610px;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(0, 20, 8, 0.34);
  animation: authEnter 0.35s ease-out both;
}

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

.auth-presentation {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 3rem;
  overflow: hidden;
  color: #ffffff;
  background:
    linear-gradient(150deg, rgba(3, 61, 25, 0.98), rgba(7, 92, 43, 0.94)),
    var(--auth-green-deep);
}

.auth-presentation::after {
  content: "";
  position: absolute;
  right: -6rem;
  bottom: -7rem;
  width: 22rem;
  height: 22rem;
  border: 1px solid rgba(189, 252, 53, 0.16);
  border-radius: 50%;
  box-shadow:
    0 0 0 4rem rgba(189, 252, 53, 0.035),
    0 0 0 8rem rgba(189, 252, 53, 0.025);
  pointer-events: none;
}

.auth-presentation .auth-brand {
  position: relative;
  z-index: 1;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2.25rem;
}

.auth-logo-frame {
  display: grid;
  place-items: center;
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  padding: 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

.auth-logo-frame .brand-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.auth-brand-product {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--auth-lime);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.auth-presentation .auth-brand h1 {
  max-width: 330px;
  margin: 0;
  color: #ffffff;
  font-size: clamp(1.55rem, 2.2vw, 2.15rem);
  font-weight: 650;
  line-height: 1.16;
}

.auth-presentation-copy {
  position: relative;
  z-index: 1;
  max-width: 420px;
  margin-bottom: 2.25rem;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.98rem;
  line-height: 1.7;
}

.auth-benefits {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 1.15rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.auth-benefits li {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 0.85rem;
}

.auth-benefit-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(189, 252, 53, 0.28);
  border-radius: 8px;
  color: var(--auth-lime);
  background: rgba(255, 255, 255, 0.07);
}

.auth-benefit-icon svg,
.auth-security-note svg,
.auth-tab svg,
.auth-input > svg,
.auth-password-toggle svg,
.auth-submit > svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-benefits li > span:last-child {
  display: grid;
  gap: 0.2rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.78rem;
  line-height: 1.45;
}

.auth-benefits strong {
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 600;
}

.auth-security-note {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 2rem;
  color: rgba(255, 255, 255, 0.7);
}

.auth-security-note > svg {
  flex: 0 0 auto;
  color: var(--auth-lime);
}

.auth-security-note > span {
  display: grid;
  gap: 0.1rem;
  font-size: 0.72rem;
  line-height: 1.4;
}

.auth-security-note strong {
  color: #ffffff;
  font-size: 0.78rem;
}

.auth-form-side {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 3rem 3.25rem 2rem;
  background: #ffffff;
}

.auth-form-header {
  margin-bottom: 1.5rem;
}

.auth-form-header h2 {
  margin-bottom: 0.5rem;
  color: #0f172a;
  font-size: 1.55rem;
  line-height: 1.25;
}

.auth-form-header p {
  max-width: 470px;
  color: #64748b;
  font-size: 0.88rem;
  line-height: 1.55;
}

.auth-mobile-brand {
  display: none;
}

.auth-form-side .auth-tabs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.25rem;
  margin-bottom: 1.75rem;
  padding: 0.25rem;
  overflow: visible;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.auth-form-side .auth-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 44px;
  padding: 0.65rem 0.75rem;
  border-radius: 6px;
  background: transparent;
  color: #64748b;
  font-size: 0.82rem;
  letter-spacing: 0;
  transition: color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.auth-form-side .auth-tab svg {
  width: 17px;
  height: 17px;
}

.auth-form-side .auth-tab.active {
  color: #075c2b;
  background: #ffffff;
  box-shadow: 0 1px 5px rgba(15, 23, 42, 0.09);
}

.auth-form-side .auth-tab:focus-visible,
.auth-password-toggle:focus-visible,
.auth-inline-link:focus-visible {
  outline: 3px solid rgba(7, 92, 43, 0.18);
  outline-offset: 2px;
}

.auth-form-side .auth-panel.active {
  display: block;
  animation: authPanelIn 0.2s ease-out;
}

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

.auth-form-side .form-group {
  margin-bottom: 1.05rem;
}

.auth-form-side .form-group label {
  margin-bottom: 0.45rem;
  color: #334155;
  font-size: 0.8rem;
  font-weight: 600;
}

.auth-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.auth-inline-link {
  margin: 0 0 0.45rem;
  padding: 0;
  border: 0;
  color: #075c2b;
  background: transparent;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}

.auth-inline-link:hover {
  color: #033d19;
  text-decoration: underline;
}

.auth-input {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input > svg {
  position: absolute;
  left: 0.9rem;
  z-index: 1;
  width: 18px;
  height: 18px;
  color: #94a3b8;
  pointer-events: none;
  transition: color 0.18s ease;
}

.auth-input .form-control {
  height: 48px;
  padding: 0.7rem 2.85rem 0.7rem 2.75rem;
  border: 1px solid #d7dee8;
  border-radius: 8px;
  color: #0f172a;
  background: #ffffff;
  font-size: 0.88rem;
}

.auth-input:not(.auth-input-password) .form-control {
  padding-right: 0.9rem;
}

.auth-input .form-control::placeholder {
  color: #94a3b8;
}

.auth-input:focus-within > svg {
  color: #075c2b;
}

.auth-input .form-control:focus {
  border-color: #0a7437;
  box-shadow: 0 0 0 3px rgba(7, 92, 43, 0.12);
}

.auth-password-toggle {
  position: absolute;
  right: 0.55rem;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: #64748b;
  background: transparent;
  cursor: pointer;
}

.auth-password-toggle:hover {
  color: #075c2b;
  background: rgba(7, 92, 43, 0.07);
}

.auth-password-toggle .auth-eye-off,
.auth-password-toggle.is-visible .auth-eye-open {
  display: none;
}

.auth-password-toggle.is-visible .auth-eye-off {
  display: block;
}

.auth-submit {
  min-height: 48px;
  margin-top: 0.35rem;
  border-radius: 8px;
  background: #075c2b;
  font-size: 0.88rem;
  font-weight: 650;
  box-shadow: 0 8px 18px rgba(7, 92, 43, 0.18);
}

.auth-submit:hover {
  background: #064d25;
  box-shadow: 0 10px 24px rgba(7, 92, 43, 0.24);
}

.auth-submit > svg {
  width: 18px;
  height: 18px;
  margin-left: auto;
}

.auth-submit.loading > svg {
  display: none;
}

.auth-invite-intro {
  display: grid;
  gap: 0.2rem;
  margin-bottom: 1rem;
  padding: 0.8rem 0.9rem;
  border-left: 3px solid #8fd326;
  border-radius: 0 6px 6px 0;
  color: #64748b;
  background: #f4f9f2;
  font-size: 0.76rem;
  line-height: 1.4;
}

.auth-invite-intro strong {
  color: #075c2b;
  font-size: 0.82rem;
}

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

.auth-form-grid .form-group {
  min-width: 0;
}

.auth-form-side #auth-message {
  position: relative;
  margin-top: 1rem;
  padding: 0.8rem 0.9rem 0.8rem 2.55rem;
  border-radius: 8px;
  font-size: 0.78rem;
  line-height: 1.45;
}

.auth-form-side #auth-message::before {
  content: "i";
  position: absolute;
  top: 0.72rem;
  left: 0.85rem;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
}

.auth-form-side #auth-message.success::before {
  content: "✓";
}

.auth-form-side #auth-message.warning::before {
  content: "!";
}

.auth-form-side #auth-message.danger::before {
  content: "×";
}

.auth-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: auto;
  padding-top: 1.5rem;
  color: #94a3b8;
  font-size: 0.68rem;
}

@media (max-width: 920px) {
  .auth-screen {
    align-items: flex-start;
    padding: 1.5rem 1.5rem 7rem;
  }

  .auth-screen .auth-card {
    grid-template-columns: minmax(270px, 0.8fr) minmax(390px, 1.2fr);
    min-height: 590px;
  }

  .auth-presentation {
    padding: 2.25rem 2rem;
  }

  .auth-presentation .auth-brand {
    align-items: flex-start;
  }

  .auth-presentation .auth-brand h1 {
    font-size: 1.55rem;
  }

  .auth-form-side {
    padding: 2.4rem 2.25rem 1.75rem;
  }
}

@media (max-width: 720px) {
  .auth-screen {
    padding: 1rem 1rem 7rem !important;
  }

  .auth-screen .auth-card {
    display: block;
    min-height: 0;
    border-radius: 12px;
  }

  .auth-presentation {
    display: none;
  }

  .auth-form-side {
    min-height: min(680px, calc(100vh - 2rem));
    padding: 1.75rem 1.5rem 1.25rem;
  }

  .auth-mobile-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
    color: #075c2b;
    font-size: 0.82rem;
    font-weight: 700;
  }

  .auth-mobile-brand img {
    width: 34px;
    height: 34px;
    padding: 0.2rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    object-fit: contain;
  }

  .auth-form-header h2 {
    font-size: 1.35rem;
  }
}

@media (max-width: 520px) {
  .auth-form-side {
    padding: 1.4rem 1rem 1rem;
  }

  .auth-form-side .auth-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-form-side .auth-tab {
    min-height: 42px;
    padding: 0.55rem 0.4rem;
    font-size: 0.74rem;
  }

  .auth-form-side .auth-tab svg {
    display: none;
  }

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

  .auth-label-row {
    align-items: flex-start;
  }

  .auth-footer {
    flex-direction: column;
    gap: 0.25rem;
  }
}

@media (max-height: 780px) and (min-width: 721px) {
  .auth-screen {
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-screen .auth-card,
  .auth-form-side .auth-panel.active {
    animation: none;
  }
}
.submission-intro {
  margin-bottom: 16px;
  padding: 24px;
  border-left: 4px solid var(--primary);
  background: color-mix(in srgb, var(--primary) 5%, var(--bg-card));
}

.submission-intro h3 {
  margin: 10px 0 6px;
}

.submission-intro p {
  max-width: 760px;
  margin: 0;
  color: var(--text-muted);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.2;
}

.status-chip-info,
.status-enviado {
  color: #075985;
  background: #e0f2fe;
}

.status-em_analise {
  color: #92400e;
  background: #fef3c7;
}

.status-respondido {
  color: #166534;
  background: #dcfce7;
}

.status-encerrado {
  color: #475569;
  background: #e2e8f0;
}

.submission-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.submission-detail-grid > div {
  min-width: 0;
}

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

.submission-detail-grid p {
  margin: 4px 0 0;
}

.preserve-lines {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.submission-conversation {
  display: grid;
  gap: 10px;
  margin: 16px 0 20px;
}

.submission-message {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
}

.submission-message.from-asm {
  border-left: 4px solid var(--primary);
}

.submission-message.from-client {
  border-left: 4px solid #64748b;
}

.submission-message > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.submission-message time {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.submission-message p {
  margin: 8px 0 0;
}

.ata-client-interactions {
  margin: 24px 0;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.ata-client-interactions .section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.ata-client-interactions h4,
.ata-client-interactions .section-header p {
  margin: 0;
}

.ata-client-interactions .section-header p {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.acknowledgement-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

@media (max-width: 760px) {
  .submission-detail-grid {
    grid-template-columns: 1fr 1fr;
  }

  .ata-client-interactions .section-header,
  .submission-message > div {
    flex-direction: column;
  }
}

/* Mobile navigation drawer. Desktop sidebar behavior remains unchanged. */
.sidebar-mobile-close,
.sidebar-backdrop {
  display: none;
}

@media (max-width: 768px) {
  body.sidebar-mobile-open {
    overflow: hidden !important;
  }

  #app-sidebar.sidebar:not([hidden]),
  body.sidebar-collapsed-mobile #app-sidebar.sidebar:not([hidden]),
  body:not(.sidebar-collapsed-mobile) #app-sidebar.sidebar:not([hidden]) {
    position: fixed !important;
    inset: 0 auto 0 0 !important;
    display: flex !important;
    width: min(88vw, 320px) !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: none !important;
    z-index: 60 !important;
    overflow: hidden !important;
    transform: translateX(0);
    transition: transform 0.22s ease, visibility 0.22s ease;
    box-shadow: 14px 0 36px rgba(2, 25, 12, 0.26) !important;
  }

  body.sidebar-collapsed-mobile #app-sidebar.sidebar:not([hidden]) {
    visibility: hidden;
    transform: translateX(-105%);
    pointer-events: none;
  }

  .sidebar-header {
    flex: 0 0 auto;
    min-height: 68px;
    padding: 0.75rem 0.85rem 0.75rem 1rem;
  }

  .sidebar-mobile-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-height: 44px;
    margin-left: auto;
    padding: 0;
    color: #fff;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
  }

  .sidebar-mobile-close:focus-visible {
    outline: 2px solid var(--secondary);
    outline-offset: -2px;
  }

  .sidebar-active-company {
    flex: 0 0 auto;
  }

  .nav-links {
    display: block !important;
    flex: 1 1 auto !important;
    min-height: 0;
    padding: 0.6rem 0.65rem 1rem !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .nav-group {
    display: grid;
    gap: 0.2rem;
    padding: 0.35rem 0;
  }

  .nav-group + .nav-group {
    margin-top: 0.3rem;
    padding-top: 0.65rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .nav-group-label {
    display: block;
    padding: 0.3rem 0.85rem 0.45rem;
  }

  .nav-item,
  .nav-item:hover,
  .nav-item.active {
    width: 100%;
    min-height: 48px;
    flex: none;
    padding: 0.7rem 0.85rem;
    gap: 0.75rem;
    font-size: 0.86rem;
    white-space: normal;
    transform: none;
  }

  .nav-item.active {
    box-shadow: inset 3px 0 0 var(--secondary);
  }

  .nav-icon {
    width: 20px;
    flex: 0 0 20px;
  }

  .sidebar-user {
    flex: 0 0 auto;
    padding: 0.75rem 0.85rem max(0.75rem, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.08);
  }

  .sidebar-backdrop:not([hidden]) {
    position: fixed;
    inset: 0;
    display: block !important;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    z-index: 55;
    background: rgba(3, 18, 10, 0.52);
    cursor: default;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 35;
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center !important;
    gap: 0.65rem !important;
    padding: 0.7rem 0.85rem !important;
  }

  .sidebar-toggle {
    width: auto !important;
    min-width: 44px;
    min-height: 44px;
    padding: 0.55rem 0.7rem;
  }

  .topbar > div:nth-child(2) {
    min-width: 0;
  }

  .topbar h2,
  .topbar p {
    overflow-wrap: anywhere;
  }

  .topbar-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 390px) {
  .sidebar-toggle span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  #app-sidebar.sidebar {
    transition: none !important;
  }
}

.sidebar-toggle {
  display: none;
}

.detail-screen-shell {
  display: grid;
  gap: 1rem;
}

.detail-screen-header {
  align-items: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  gap: 1rem;
  padding: 1rem 1.25rem;
}

.detail-screen-header h3 {
  margin: 0 0 0.25rem;
}

.detail-screen-header p {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin: 0;
}

.detail-screen-body {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}

@media (max-width: 768px) {
  .sidebar-toggle {
    display: inline-flex !important;
    flex: 0 0 auto;
  }

  body.sidebar-collapsed-mobile #app-sidebar:not([hidden]) {
    display: none !important;
  }

  body:not(.sidebar-collapsed-mobile) #app-sidebar:not([hidden]) {
    display: flex !important;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 35;
  }

  .detail-screen-header {
    flex-direction: column;
  }

  .detail-screen-body {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .submission-detail-grid {
    grid-template-columns: 1fr;
  }
}
.template-builder-guide {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  padding: 18px 20px;
  border: 1px solid rgba(4, 64, 26, 0.18);
  border-radius: 10px;
  background: var(--primary-soft);
}

.template-builder-guide h4,
.template-builder-guide p,
.template-channel-heading h4,
.template-channel-heading p,
.template-preview-heading h4,
.template-preview-heading p {
  margin: 0;
}

.template-builder-guide h4 {
  font-size: 1rem;
  color: var(--primary);
}

.template-builder-guide p {
  max-width: 720px;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.template-active-target {
  flex: 0 0 auto;
  max-width: 320px;
  padding: 9px 12px;
  border: 1px solid rgba(4, 64, 26, 0.22);
  border-radius: 7px;
  background: var(--bg-card);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.template-variable-section {
  margin-bottom: 20px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-alt);
}

.template-variable-heading {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-bottom: 12px;
}

.template-variable-heading strong {
  color: var(--text-main);
  font-size: 0.9rem;
}

.template-variable-heading span {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.template-variable-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.template-variable-button {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 54px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  padding: 8px 38px 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--bg-card);
  color: var(--text-main);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.template-variable-button::before {
  content: "+";
  position: absolute;
  top: 50%;
  right: 10px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1;
  transform: translateY(-50%);
}

.template-variable-button:hover {
  border-color: var(--primary);
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.template-variable-button:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}

.template-variable-button span {
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 750;
}

.template-variable-button small {
  max-width: 100%;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.template-channel {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-top: 3px solid #2563eb;
  border-radius: 9px;
  background: var(--bg-card);
}

.template-channel-whatsapp {
  border-top-color: #16a34a;
}

.template-channel-internal {
  grid-column: 1 / -1;
  border-top-color: #7c3aed;
}

.template-channel-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.template-channel-heading h4 {
  color: var(--text-main);
  font-size: 0.92rem;
}

.template-channel-heading p {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.template-channel-mark {
  width: 34px;
  height: 34px;
  display: grid;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 7px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.75rem;
  font-weight: 800;
}

.template-channel-whatsapp .template-channel-mark {
  background: #ecfdf3;
  color: #15803d;
}

.template-channel-internal .template-channel-mark {
  background: #f5f3ff;
  color: #6d28d9;
}

.template-field {
  position: relative;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.template-field:last-child {
  margin-bottom: 0;
}

.template-field.is-active {
  border-color: rgba(4, 64, 26, 0.28);
  background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--primary);
}

.template-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8rem;
  font-weight: 700;
}

.template-field .form-control {
  background: var(--bg-card);
}

.template-field .form-control[aria-invalid="true"] {
  border-color: #dc2626;
}

.template-field-feedback {
  display: none;
  margin-top: 5px;
  color: #b91c1c;
  font-size: 0.74rem;
  line-height: 1.35;
}

.template-field.has-error .template-field-feedback {
  display: block;
}

.template-editor {
  min-height: 210px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
}

.template-image-control {
  position: relative;
  margin-top: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.template-image-control.is-uploading {
  opacity: 0.68;
  pointer-events: none;
}

.template-image-heading,
.template-image-selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.template-image-heading > div,
.template-image-selected > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.template-image-heading strong,
.template-image-selected strong {
  color: var(--text-main);
  font-size: 0.82rem;
}

.template-image-heading span,
.template-image-selected span,
.template-image-status {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.template-image-select {
  flex: 0 0 auto;
  cursor: pointer;
}

.template-image-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.template-image-empty {
  margin-top: 12px;
  padding: 14px;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  background: var(--bg-alt);
  color: var(--text-muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.template-image-selected {
  margin-top: 12px;
  justify-content: flex-start;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-alt);
}

.template-image-selected img {
  width: 64px;
  height: 52px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
}

.template-image-selected > div {
  flex: 1;
}

.template-image-selected strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-image-status {
  display: block;
  min-height: 1em;
  margin-top: 8px;
}

.template-preview-section {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-alt);
}

.template-preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.template-preview-heading h4 {
  font-size: 0.95rem;
}

.template-preview-heading p {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.template-live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #166534;
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}

.template-live-indicator span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

.alert-delivery-heading {
  margin: 24px 0 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.alert-delivery-heading h4,
.alert-delivery-heading p {
  margin: 0;
}

.alert-delivery-heading p {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.84rem;
}

.alert-delivery-grid {
  grid-template-columns: repeat(3, minmax(160px, 1fr));
}

.alert-business-days {
  margin: 4px 0 18px;
}

.alert-template-preview {
  min-height: 120px;
}

.alert-template-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.template-preview-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.template-preview-card-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.73rem;
  font-weight: 700;
}

.template-preview-card-header::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2563eb;
}

.template-preview-whatsapp .template-preview-card-header::before {
  background: #16a34a;
}

.template-preview-internal .template-preview-card-header::before {
  background: #7c3aed;
}

.template-preview-content {
  padding: 12px;
  color: var(--text-main);
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.template-preview-image {
  display: block;
  width: 100%;
  max-height: 190px;
  margin: 0 0 12px;
  object-fit: cover;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: #fff;
}

.template-preview-subject {
  margin-bottom: 9px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--border);
  font-weight: 750;
}

.template-preview-subject span {
  display: block;
  margin-bottom: 2px;
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.template-preview-whatsapp .template-preview-content {
  margin: 12px;
  padding: 10px;
  border-radius: 7px 7px 2px 7px;
  background: #dcfce7;
  color: #153e25;
}

.template-preview-internal .template-preview-content strong {
  display: block;
  margin-bottom: 6px;
}

.template-preview-error {
  padding: 12px 14px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 0.82rem;
}

@media (max-width: 900px) {
  .config-split-intro,
  .template-page-intro {
    align-items: flex-start;
    flex-direction: column;
  }

  .config-split-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .template-builder-guide,
  .template-preview-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .template-active-target {
    max-width: 100%;
  }

  .template-variable-list,
  .template-channel-grid,
  .alert-delivery-grid,
  .alert-template-preview-grid {
    grid-template-columns: 1fr;
  }

  .template-channel-internal {
    grid-column: auto;
  }
}

@media (min-width: 640px) and (max-width: 900px) {
  .template-variable-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

body.dark-theme .template-builder-guide,
body.dark-theme .template-field.is-active {
  background: rgba(217, 255, 87, 0.06);
  border-color: rgba(217, 255, 87, 0.2);
}

body.dark-theme .template-builder-guide h4,
body.dark-theme .template-active-target,
body.dark-theme .template-variable-button span,
body.dark-theme .template-variable-button::before {
  color: #d9ff57;
}

body.dark-theme .template-active-target,
body.dark-theme .template-variable-button,
body.dark-theme .template-channel,
body.dark-theme .template-preview-card {
  background: #0f172a;
}

body.dark-theme .template-preview-whatsapp .template-preview-content {
  background: #164e2d;
  color: #dcfce7;
}

body.dark-theme .template-image-empty,
body.dark-theme .template-image-selected {
  background: #0f172a;
}

body.dark-theme .template-preview-error {
  border-color: #7f1d1d;
  background: rgba(127, 29, 29, 0.22);
  color: #fecaca;
}

body.dark-theme .active-company-switcher,
body.dark-theme .active-company-search-results {
  background: #0f172a;
  border-color: #334155;
}

body.dark-theme .active-company-heading strong,
body.dark-theme .active-company-result {
  color: #f8fafc;
}

body.dark-theme .active-company-result:hover,
body.dark-theme .active-company-result.is-active {
  background: rgba(217, 255, 87, 0.08);
}

.wa-test-composer {
  margin-top: 10px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-alt);
}

.wa-test-composer-heading,
.wa-test-actions,
.wa-test-message-label,
.wa-test-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.wa-test-composer-heading {
  align-items: flex-start;
  margin-bottom: 16px;
}

.wa-test-composer-heading h4,
.wa-test-composer-heading p,
.wa-test-actions p {
  margin: 0;
}

.wa-test-composer-heading p {
  max-width: 700px;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.wa-test-fields {
  display: grid;
  grid-template-columns: minmax(220px, 0.35fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.wa-test-message-field textarea {
  min-height: 190px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
}

.wa-test-message-label span {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.wa-test-preview {
  margin-top: 4px;
  overflow: hidden;
  border: 1px solid #b7dfc1;
  border-radius: 9px;
  background: var(--bg-card);
}

.wa-test-preview-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
}

.wa-test-preview-header span {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.wa-test-preview-chat {
  min-height: 120px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 18px;
  background: #eef5ef;
}

.wa-test-preview-bubble {
  position: relative;
  width: min(100%, 650px);
  padding: 12px 14px;
  border-radius: 9px 9px 2px 9px;
  background: #d9fdd3;
  color: #173b24;
  font-size: 0.84rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.1);
}

.wa-test-preview-image {
  display: block;
  width: 100%;
  max-height: 320px;
  margin: 0 0 10px;
  object-fit: cover;
  border-radius: 7px;
  background: #fff;
}

.wa-test-actions {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.wa-test-actions p {
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

body.dark-theme .wa-test-composer,
body.dark-theme .wa-test-preview {
  border-color: #334155;
}

body.dark-theme .wa-test-preview-chat {
  background: #17251d;
}

body.dark-theme .wa-test-preview-bubble {
  background: #164e2d;
  color: #dcfce7;
}

@media (max-width: 760px) {
  .template-image-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .template-image-select {
    width: 100%;
    justify-content: center;
  }

  .template-image-selected {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .template-image-selected img {
    width: 56px;
    height: 48px;
  }

  .template-image-selected .btn {
    grid-column: 1 / -1;
    width: 100%;
  }

  .wa-test-composer-heading,
  .wa-test-actions,
  .wa-test-preview-header {
    align-items: stretch;
    flex-direction: column;
  }

  .wa-test-fields {
    grid-template-columns: 1fr;
  }

  .wa-test-composer-heading .btn,
  .wa-test-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Mobile hardening: nenhum campo ou tabela deve exigir rolagem lateral. */
@media (max-width: 768px) {
  html,
  body,
  .main-content,
  .content-area,
  .view,
  .card,
  .card-body,
  .modal,
  .modal-body,
  .detail-screen-body {
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  .content-area {
    width: 100% !important;
  }

  .card-header,
  .header-actions,
  .topbar-actions,
  .button-row,
  .status-row,
  .request-actions {
    align-items: stretch !important;
    flex-wrap: wrap !important;
    max-width: 100% !important;
  }

  .card-header > *,
  .header-actions > *,
  .topbar-actions > *,
  .button-row > *,
  .status-row > *,
  .request-actions > * {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .form-row,
  form.form-row,
  .filter-grid,
  .filter-grid-checklist,
  .filter-grid-report,
  .mapping-row,
  .detail-grid,
  .submission-detail-grid,
  .alert-delivery-grid,
  .template-channel-grid,
  .template-variable-list,
  .template-preview-heading,
  .wa-test-fields {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    max-width: 100% !important;
  }

  .form-row > *,
  form.form-row > *,
  .form-row .form-group,
  .filter-grid > *,
  .filter-grid-checklist > *,
  .filter-grid-report > *,
  .mapping-row > *,
  .detail-grid > *,
  .submission-detail-grid > *,
  .alert-delivery-grid > *,
  .template-channel-grid > *,
  .template-variable-list > *,
  .wa-test-fields > * {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    flex: 1 1 auto !important;
    flex-basis: auto !important;
  }

  .form-control,
  input,
  select,
  textarea,
  .btn,
  .badge,
  .file-upload-zone,
  .active-company-switcher,
  .active-company-search,
  .active-company-native-select,
  .template-active-target,
  .wa-test-composer,
  .wa-test-preview-bubble {
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .btn {
    white-space: normal;
  }

  .table-responsive {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  .table-responsive table,
  .table-responsive thead,
  .table-responsive tbody,
  .table-responsive tr,
  .table-responsive th,
  .table-responsive td {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .table-responsive td {
    overflow-wrap: anywhere !important;
    white-space: normal !important;
  }

  .table-responsive td[data-label="Ação"],
  .table-responsive td[data-label="Ações"],
  .table-responsive td[data-label="Detalhe"] {
    grid-template-columns: 1fr !important;
  }

  .table-responsive td[data-label="Ação"]::before,
  .table-responsive td[data-label="Ações"]::before,
  .table-responsive td[data-label="Detalhe"]::before {
    content: none !important;
  }

  .table-responsive td[data-label="Ação"] .btn,
  .table-responsive td[data-label="Ações"] .btn,
  .table-responsive td[data-label="Detalhe"] .btn {
    width: 100% !important;
    justify-content: center !important;
  }
}

@media (max-width: 420px) {
  .table-responsive td {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0.35rem !important;
  }

  .table-responsive td::before {
    margin-bottom: 0.1rem;
  }
}
