:root {
  /* ===== Azul-marinho do passaporte brasileiro ===== */
  --primary: #1b3a5f;
  --primary-light: #2a5183;
  --primary-dark: #12293f;
  --primary-hover: #234a76;
  --primary-50: #eef3f9;
  --primary-100: #dce7f2;
  --primary-200: #b9cde3;
  --primary-300: #8faece;

  /* Dourado discreto (detalhe institucional) */
  --accent: #c2a878;
  --accent-light: #d6c39c;
  --accent-dark: #a88c58;

  /* ===== Cores semânticas suaves (dessaturadas) ===== */
  --success: #4c9a80;
  --success-soft: #e9f4f0;
  --success-text: #2f6b57;
  --warning: #d29b4e;
  --warning-soft: #f8f0e2;
  --warning-text: #8a5f22;
  --danger: #cf6b6b;
  --danger-soft: #f7ebeb;
  --danger-text: #9c4444;
  --info: #4f7fb3;
  --info-soft: #eaf1f8;
  --info-text: #2f5b86;

  /* ===== Escala de cinza (base clara e levemente azulada) ===== */
  --gray-50: #f6f8fb;
  --gray-100: #eef1f6;
  --gray-150: #e6eaf1;
  --gray-200: #dde3ec;
  --gray-300: #c6cfdc;
  --gray-400: #97a3b6;
  --gray-500: #6b7788;
  --gray-600: #4f5a6b;
  --gray-700: #3a4353;
  --gray-800: #262d3a;
  --gray-900: #161c26;

  --surface: #ffffff;
  --app-bg: #f2f5f9;

  --sidebar-width: 264px;
  --topbar-height: 74px;

  /* ===== Bordas mais arredondadas ===== */
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  /* ===== Sombras suaves com tom azulado ===== */
  --shadow-xs: 0 1px 2px rgba(27, 58, 95, 0.05);
  --shadow-sm: 0 2px 8px rgba(27, 58, 95, 0.06);
  --shadow-md: 0 8px 24px rgba(27, 58, 95, 0.08);
  --shadow-lg: 0 18px 44px rgba(27, 58, 95, 0.12);
  --ring: 0 0 0 4px rgba(42, 81, 131, 0.14);

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html { font-size: 16px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--app-bg);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.app-container {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  padding: 14px;
  transition: transform 0.3s ease;
}

.sidebar::before {
  /* brilho sutil no topo */
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 180px;
  background: radial-gradient(120% 90% at 20% 0%, rgba(255,255,255,0.10), transparent 70%);
  pointer-events: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

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

.sidebar-toggle {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 1.2rem;
  cursor: pointer;
  display: none;
  padding: 4px;
  transition: var(--transition);
}

.sidebar-toggle:hover { color: #fff; }

.sidebar-nav {
  flex: 1;
  padding: 18px 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  color: rgba(255,255,255,0.72);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  font-weight: 500;
  font-size: 0.92rem;
  position: relative;
}

.nav-item i {
  width: 22px;
  text-align: center;
  font-size: 1.05rem;
  opacity: 0.9;
}

.nav-item:hover {
  background: rgba(255,255,255,0.09);
  color: #fff;
  transform: translateX(2px);
}

.nav-item.active {
  background: rgba(255,255,255,0.16);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 22px;
  background: var(--accent);
  border-radius: var(--radius-full);
}

.sidebar-footer {
  position: relative;
  padding: 14px 12px;
  margin-top: 4px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.user-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.6);
}

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 34px;
  background: rgba(255,255,255,0.82);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--gray-200);
  min-height: var(--topbar-height);
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.4px;
}

.page-subtitle {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-top: 2px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ===== CONTENT AREA ===== */
.content-area {
  flex: 1;
  padding: 28px 34px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  white-space: nowrap;
  line-height: 1;
}

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

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

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

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
}

.btn-secondary:hover { background: var(--gray-150); border-color: var(--gray-300); }

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover { filter: brightness(1.05); }

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger-text);
  border: 1px solid transparent;
}

.btn-danger:hover { background: #f1dede; }

.btn-sm {
  padding: 7px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-xs);
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--gray-300);
  color: var(--gray-700);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-50);
}

/* ===== CARDS ===== */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--gray-150);
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-800);
  letter-spacing: -0.2px;
}

.card-body { padding: 22px; }

/* ===== STATS CARDS (Dashboard) ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  gap: 18px;
  transition: var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-color: var(--gray-300);
}

.stat-icon {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.stat-icon.blue { background: var(--primary-50); color: var(--primary); }
.stat-icon.green { background: var(--success-soft); color: var(--success); }
.stat-icon.amber { background: var(--warning-soft); color: var(--warning); }
.stat-icon.red { background: var(--danger-soft); color: var(--danger); }
.stat-icon.purple { background: #f0eef8; color: #6b5ca8; }
.stat-icon.teal { background: #e8f4f2; color: #3f9285; }

.stat-info h4 {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.stat-info p {
  font-size: 0.85rem;
  color: var(--gray-500);
  font-weight: 500;
}

/* ===== TABLES ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 13px 18px;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--gray-500);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}

.data-table td {
  padding: 14px 18px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}

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

.data-table tr { transition: background 0.15s ease; }

.data-table tbody tr:hover td {
  background: var(--primary-50);
}

.data-table .actions {
  display: flex;
  gap: 6px;
}

.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--gray-400);
}

.empty-state i {
  font-size: 2.8rem;
  margin-bottom: 16px;
  color: var(--gray-300);
}

.empty-state h3 {
  color: var(--gray-600);
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.empty-state p {
  font-size: 0.9rem;
}

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: capitalize;
  border: 1px solid transparent;
}

.badge-success { background: var(--success-soft); color: var(--success-text); }
.badge-warning { background: var(--warning-soft); color: var(--warning-text); }
.badge-danger { background: var(--danger-soft); color: var(--danger-text); }
.badge-info { background: var(--info-soft); color: var(--info-text); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }

/* ===== MODAL ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(18, 41, 63, 0.42);
  backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 26px 4px;
}

.modal-title {
  font-size: 1.22rem;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.3px;
}

.modal-close {
  background: var(--gray-100);
  border: none;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  font-size: 1rem;
  color: var(--gray-500);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover { color: var(--gray-800); background: var(--gray-200); }

.modal-body { padding: 22px 26px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 26px 24px;
  border-top: 1px solid var(--gray-100);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== FORM ===== */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 7px;
}

.form-group .hint {
  font-size: 0.75rem;
  color: var(--accent-dark);
  font-weight: 600;
  margin-left: 3px;
}

.form-control {
  width: 100%;
  padding: 11px 15px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--gray-800);
  background: var(--gray-50);
  transition: var(--transition);
  outline: none;
}

.form-control:hover { border-color: var(--gray-300); }

.form-control:focus {
  border-color: var(--primary-light);
  background: var(--surface);
  box-shadow: var(--ring);
}

.form-control::placeholder { color: var(--gray-400); }

select.form-control {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b7788' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

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

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Campo com botões de ação (ex.: Senha GOV com mostrar/copiar) */
.input-action {
  position: relative;
}

.input-action .form-control {
  padding-right: 76px;
}

.input-action-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--gray-500);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.input-action-btn:hover {
  color: var(--primary);
  background: var(--gray-100);
}

#toggleSenhaGov { right: 40px; }
#copySenhaGov { right: 6px; }

.field-error {
  display: block;
  font-size: 0.75rem;
  color: var(--danger, #dc2626);
  margin-top: 5px;
  min-height: 1em;
}

/* Célula de telefone com atalho para o WhatsApp */
.tel-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.wa-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #25d366;
  color: #fff;
  font-size: 0.95rem;
  text-decoration: none;
  transition: var(--transition);
}

.wa-link:hover {
  background: #1da851;
  transform: scale(1.08);
}

/* Badge clicável (ex.: quantidade de processos do cliente) */
.badge-link {
  border: none;
  cursor: pointer;
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: var(--transition);
}

.badge-link:hover {
  filter: brightness(0.94);
  transform: translateY(-1px);
}

/* ===== PARECERES / LINHA DO TEMPO ===== */
.parecer-input {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.parecer-input textarea.form-control {
  min-height: 60px;
  flex: 1;
}

.parecer-input .btn {
  white-space: nowrap;
  flex-shrink: 0;
}

.timeline {
  margin-top: 16px;
  position: relative;
  padding-left: 8px;
}

.timeline-empty {
  color: var(--gray-400);
  font-size: 0.85rem;
  font-style: italic;
  padding: 4px 0;
}

.timeline-item {
  position: relative;
  padding-left: 26px;
  padding-bottom: 18px;
  border-left: 2px solid var(--gray-200);
}

.timeline-item:last-child {
  border-left-color: transparent;
  padding-bottom: 4px;
}

.timeline-marker {
  position: absolute;
  left: -7px;
  top: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 2px var(--gray-200);
}

.timeline-content {
  position: relative;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 10px 34px 10px 14px;
}

.timeline-time {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary-light);
  margin-bottom: 4px;
}

.timeline-text {
  font-size: 0.875rem;
  color: var(--gray-700);
  white-space: pre-wrap;
  word-break: break-word;
}

.timeline-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  border: none;
  background: transparent;
  color: var(--gray-400);
  cursor: pointer;
  padding: 2px 5px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.timeline-remove:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

/* ===== EDITOR DE TEXTO RICO ===== */
.rte {
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}

.rte-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  padding: 7px 8px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}

.rte-btn {
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--gray-600);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  transition: var(--transition);
}

.rte-btn:hover {
  background: var(--gray-200);
  color: var(--primary);
}

.rte-select {
  height: 30px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.8rem;
  color: var(--gray-700);
  padding: 0 6px;
  cursor: pointer;
}

.rte-editor {
  min-height: 120px;
  max-height: 280px;
  overflow-y: auto;
  border: none;
  border-radius: 0;
  background: var(--surface);
}

.rte-editor:focus {
  outline: none;
  box-shadow: none;
  border: none;
}

.rte-editor a {
  color: var(--primary-light);
  text-decoration: underline;
}

/* ===== CUSTOS (somente admin) ===== */
.custo-input {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.custo-input #fCustoValor { max-width: 150px; }
.custo-input #fCustoLegenda { flex: 1; min-width: 140px; }
.custo-input .btn { white-space: nowrap; flex-shrink: 0; }

.custo-empty {
  color: var(--gray-400);
  font-size: 0.85rem;
  font-style: italic;
  margin-top: 10px;
}

.custo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  margin-top: 8px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
}

.custo-legenda {
  flex: 1;
  font-size: 0.875rem;
  color: var(--gray-700);
  word-break: break-word;
}

.custo-legenda em { color: var(--gray-400); }

.custo-valor {
  font-weight: 700;
  color: var(--gray-800);
  font-variant-numeric: tabular-nums;
}

.custo-remove {
  border: none;
  background: transparent;
  color: var(--gray-400);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.custo-remove:hover { color: var(--danger); background: var(--danger-soft); }

.custo-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  margin-top: 12px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
}

.custo-total strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }

.btn-pago {
  margin-top: 12px;
  background: var(--gray-200);
  color: var(--gray-700);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.btn-pago:hover { background: #25d366; color: #fff; }

.btn-pago-ok {
  margin-top: 12px;
  background: #25d366;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.btn-pago-ok:hover { background: #1da851; color: #fff; }

/* Banner de filtro ativo por cliente */
.filter-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  margin-bottom: 16px;
  font-size: 0.875rem;
  color: var(--gray-700);
}

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  min-width: 300px;
  max-width: 450px;
  background: var(--surface);
  color: var(--gray-800);
  border: 1px solid var(--gray-200);
  border-left: 4px solid var(--gray-300);
}

.toast i { font-size: 1.05rem; }

.toast.success { border-left-color: var(--success); }
.toast.success i { color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.error i { color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.warning i { color: var(--warning); }
.toast.info { border-left-color: var(--info); }
.toast.info i { color: var(--info); }

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

/* ===== SEARCH & FILTER BAR ===== */
.search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.search-input-wrapper {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.search-input-wrapper i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
}

.search-input-wrapper input {
  width: 100%;
  padding: 12px 16px 12px 42px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--gray-800);
  outline: none;
  transition: var(--transition);
  box-shadow: var(--shadow-xs);
}

.search-input-wrapper input::placeholder { color: var(--gray-400); }

.search-input-wrapper input:focus {
  border-color: var(--primary-light);
  box-shadow: var(--ring);
}

.filter-select {
  padding: 12px 38px 12px 16px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: inherit;
  background: var(--surface);
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b7788' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  color: var(--gray-700);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
}

.filter-select:focus {
  border-color: var(--primary-light);
  box-shadow: var(--ring);
}

/* ===== TASK LIST ===== */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px 18px;
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.task-item:hover {
  border-color: var(--primary-200);
  box-shadow: var(--shadow-sm);
  transform: translateX(2px);
}

.task-item.completed {
  opacity: 0.72;
  background: var(--gray-50);
}

.task-item.completed .task-text {
  text-decoration: line-through;
  color: var(--gray-400);
}

.task-check {
  width: 22px;
  height: 22px;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}

.task-check:hover { border-color: var(--primary); background: var(--primary-50); }

.task-check.checked {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.task-content {
  flex: 1;
  min-width: 0;
}

.task-text {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--gray-800);
}

.task-meta {
  display: flex;
  gap: 12px;
  margin-top: 5px;
  font-size: 0.76rem;
  color: var(--gray-500);
  flex-wrap: wrap;
  align-items: center;
}

.task-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ===== PROCESSO STATUS ===== */
.status-ativo { background: var(--success-soft); color: var(--success-text); }
.status-suspenso { background: var(--warning-soft); color: var(--warning-text); }
.status-arquivado { background: var(--gray-100); color: var(--gray-600); }
.status-recurso { background: var(--info-soft); color: var(--info-text); }
.status-urgente { background: var(--danger-soft); color: var(--danger-text); }

/* ===== DETAIL VIEW ===== */
.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.detail-info h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gray-900);
}

.detail-info p {
  color: var(--gray-500);
  font-size: 0.9rem;
  margin-top: 4px;
}

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

.detail-item {
  padding: 18px;
  background: var(--gray-50);
  border: 1px solid var(--gray-150);
  border-radius: var(--radius-md);
}

.detail-item label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--gray-500);
  margin-bottom: 6px;
}

.detail-item span {
  font-size: 0.95rem;
  color: var(--gray-800);
  font-weight: 500;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-toggle { display: block; }

  .main-content {
    margin-left: 0;
  }

  .topbar {
    padding: 16px 20px;
  }

  .topbar-left .page-subtitle { display: none; }

  .content-area {
    padding: 18px 20px;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
  }

  .stat-card {
    padding: 16px;
    gap: 14px;
  }

  .stat-icon {
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
  }

  .stat-info h4 { font-size: 1.35rem; }

  .modal { max-width: 100%; margin: 10px; }

  .search-bar {
    flex-direction: column;
  }

  .search-input-wrapper { width: 100%; }

  .filter-select { width: 100%; }
}

/* ===== AUTH SCREEN ===== */
.auth-screen {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: linear-gradient(150deg, var(--primary-dark) 0%, var(--primary) 55%, var(--primary-light) 100%);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 50% at 15% 10%, rgba(255,255,255,0.10), transparent 60%),
    radial-gradient(50% 50% at 90% 90%, rgba(194,168,120,0.12), transparent 60%);
  pointer-events: none;
}

.auth-screen.active {
  display: flex;
}

.auth-container {
  width: 100%;
  max-width: 430px;
  position: relative;
  animation: slideUp 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 42px 38px 34px;
  box-shadow: 0 30px 70px rgba(18, 41, 63, 0.35);
  border: 1px solid rgba(255,255,255,0.6);
}

.auth-logo {
  text-align: center;
  margin-bottom: 30px;
}

.auth-logo .logo-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 1.6rem;
  color: var(--accent);
  box-shadow: var(--shadow-md);
}

.auth-logo .auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 20px;
  margin: 0 auto 18px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  box-shadow: var(--shadow-sm);
}

.auth-logo .auth-brand img {
  display: block;
  width: min(210px, 100%);
  height: auto;
}

.auth-logo h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.5px;
}

.auth-logo p {
  font-size: 0.86rem;
  color: var(--gray-500);
  margin-top: 4px;
}

.auth-form .form-group {
  margin-bottom: 18px;
}

.auth-form .form-group label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 7px;
  display: block;
}

.auth-form .form-control {
  padding: 13px 15px;
  font-size: 0.9rem;
  background: var(--gray-50);
}

.auth-form .form-control-wrapper {
  position: relative;
}

.auth-form .form-control-wrapper i {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 0.95rem;
  transition: var(--transition);
}

.auth-form .form-control-wrapper:focus-within i { color: var(--primary-light); }

.auth-form .form-control-wrapper .form-control {
  padding-left: 44px;
}

.auth-form .btn {
  width: 100%;
  padding: 14px;
  font-size: 0.95rem;
  justify-content: center;
  margin-top: 10px;
}

.auth-footer {
  text-align: center;
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--gray-150);
  font-size: 0.85rem;
  color: var(--gray-500);
}

.auth-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
}

.auth-footer a:hover {
  text-decoration: underline;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--gray-400);
  font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}

.auth-error {
  background: var(--danger-soft);
  border: 1px solid #e8cfcf;
  border-radius: var(--radius-sm);
  padding: 11px 15px;
  font-size: 0.85rem;
  color: var(--danger-text);
  display: none;
  margin-bottom: 16px;
  text-align: center;
}

.auth-error.show {
  display: block;
}

/* ===== LOGOUT BUTTON (sidebar) ===== */
.btn-logout {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  font-size: 0.9rem;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-xs);
  transition: var(--transition);
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-logout:hover {
  color: #fff;
  background: rgba(207, 107, 107, 0.30);
  border-color: rgba(207, 107, 107, 0.40);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: var(--radius-full); border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); background-clip: padding-box; }
