:root {
  --bg: #f0f4f8;
  --bg-card: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --sidebar: #0f172a;
  --sidebar-hover: #1e293b;
  --border: #e2e8f0;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --success: #059669;
  --success-bg: #ecfdf5;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --info: #0284c7;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(15,23,42,.08), 0 4px 12px rgba(15,23,42,.04);
  --shadow-lg: 0 8px 30px rgba(15,23,42,.12);
}

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

body {
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Utilidades */
.oculto { display: none !important; }
.tela:not(.oculto) { display: block; min-height: 100vh; }
.erro { color: var(--danger); font-size: .875rem; margin-top: .75rem; }
.opcional { font-size: .75rem; color: var(--text-muted); font-weight: 400; }

/* Botões */
button { font: inherit; cursor: pointer; border: none; border-radius: var(--radius-sm); transition: all .15s ease; }
.btn-primario {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--primary); color: #fff;
  padding: .625rem 1.125rem; font-weight: 500;
}
.btn-primario:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-secundario { background: #f1f5f9; color: var(--text); padding: .625rem 1rem; font-weight: 500; }
.btn-secundario:hover { background: #e2e8f0; }
.btn-ghost { background: transparent; color: var(--text-muted); padding: .5rem .75rem; }
.btn-ghost:hover { background: #f1f5f9; color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; padding: .625rem 1rem; font-weight: 500; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { font-size: .8125rem; padding: .375rem .625rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { background: #f1f5f9; color: var(--text-muted); padding: .5rem; display: flex; align-items: center; border-radius: var(--radius-sm); }
.btn-icon:hover { background: #e2e8f0; color: var(--text); }

/* Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* LOGIN */
.tela-login { background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #2563eb 100%); min-height: 100vh; }
.login-layout {
  display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh;
  max-width: 1100px; margin: 0 auto; align-items: center; gap: 3rem; padding: 2rem;
}
.login-brand { color: #fff; padding: 2rem; }
.brand-icon { font-size: 3rem; margin-bottom: 1rem; }
.login-brand h1 { font-size: 2.5rem; font-weight: 700; margin-bottom: .5rem; }
.login-brand > p { opacity: .85; font-size: 1.1rem; margin-bottom: 2rem; }
.login-features { list-style: none; }
.login-features li {
  padding: .5rem 0 .5rem 1.5rem; position: relative; opacity: .9;
}
.login-features li::before { content: "✓"; position: absolute; left: 0; color: #93c5fd; font-weight: 700; }
.login-card { padding: 2.5rem; }
.login-card h2 { font-size: 1.5rem; margin-bottom: .25rem; }
.subtitulo { color: var(--text-muted); margin-bottom: 1.5rem; font-size: .9375rem; }

.field { display: block; margin-bottom: 1rem; }
.field > span, .field:not(:has(span)) { display: block; font-size: .8125rem; font-weight: 500; color: var(--text); margin-bottom: .375rem; }
.field input, .field select, .field textarea {
  width: 100%; padding: .6875rem .875rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; font: inherit; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light);
}
.campo-senha { display: flex; gap: .5rem; }
.campo-senha input { flex: 1; }
.checkbox-label { display: flex; align-items: center; gap: .5rem; font-size: .875rem; color: var(--text-muted); margin-bottom: 1.25rem; cursor: pointer; }
.checkbox-label input { width: auto; accent-color: var(--primary); }

/* SHELL ADMIN */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px; background: var(--sidebar); color: #94a3b8;
  display: flex; flex-direction: column; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: .75rem;
  padding: 1.5rem 1.25rem; font-weight: 700; font-size: 1.125rem; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-icon-sm { font-size: 1.25rem; }
.sidebar-nav { flex: 1; padding: 1rem .75rem; display: flex; flex-direction: column; gap: .25rem; }
.nav-item {
  display: flex; align-items: center; gap: .75rem;
  width: 100%; padding: .75rem 1rem; border-radius: var(--radius-sm);
  background: transparent; color: #94a3b8; font-weight: 500; font-size: .9375rem; text-align: left;
}
.nav-item:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.nav-item.ativa { background: var(--primary); color: #fff; }
.sidebar-footer {
  padding: 1rem; border-top: 1px solid rgba(255,255,255,.08);
  display: flex; flex-wrap: wrap; align-items: center; gap: .625rem;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-info strong { display: block; color: #fff; font-size: .875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main-area { flex: 1; padding: 1.75rem 2rem; overflow-y: auto; max-height: 100vh; }
.aba { display: none; }
.aba.ativa { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* HEADER ADV */
.app-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 2rem; background: var(--bg-card); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand-mini { font-weight: 700; color: var(--primary); font-size: 1.125rem; }
.header-user { display: flex; align-items: center; gap: .75rem; }
.header-user strong { display: block; font-size: .9375rem; }
.page-content { padding: 1.75rem 2rem; max-width: 1200px; margin: 0 auto; }

.page-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 1.5rem; gap: 1rem; flex-wrap: wrap;
}
.page-title-row { margin-bottom: 1.5rem; }
h2 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }
.page-subtitle { color: var(--text-muted); font-size: .9375rem; margin-top: .25rem; }

/* Avatar */
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: .875rem; flex-shrink: 0;
}
.sidebar .avatar { width: 36px; height: 36px; font-size: .75rem; }

/* Badges */
.badge {
  display: inline-block; padding: .125rem .5rem; border-radius: 999px;
  font-size: .6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
}
.badge-admin { background: #ede9fe; color: #6d28d9; }
.badge-adv { background: var(--primary-light); color: var(--primary); }

.status {
  display: inline-flex; align-items: center; padding: .2rem .625rem;
  border-radius: 999px; font-size: .6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
}
.status-pendente { background: var(--warning-bg); color: var(--warning); }
.status-em_andamento { background: var(--primary-light); color: var(--primary); }
.status-concluida { background: var(--success-bg); color: var(--success); }
.status-cancelada { background: var(--danger-bg); color: var(--danger); }

.urgencia { font-size: .75rem; font-weight: 600; padding: .15rem .5rem; border-radius: 4px; }
.urgencia-vencido { background: var(--danger-bg); color: var(--danger); }
.urgencia-hoje { background: var(--warning-bg); color: var(--warning); }
.urgencia-breve { background: #fef3c7; color: #b45309; }

.prazo-destaque {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  min-width: 0;
  flex: 1;
}

.prazo-data {
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.3;
}

.prazo-complemento {
  font-size: 0.75rem;
  font-weight: 600;
  opacity: 0.95;
}

.prazo-verde {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.prazo-amarelo {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

.prazo-vermelho {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.prazo-neutro {
  background: #f8fafc;
  color: var(--text-muted);
  border-color: var(--border);
}

.demanda-card-adv .demanda-card-footer-adv {
  align-items: stretch;
  gap: 0.75rem;
}

.demanda-card-footer-adv .demanda-card-acoes {
  align-self: center;
}

/* Stats */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.125rem; box-shadow: var(--shadow); transition: transform .15s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-card .stat-valor { font-size: 1.75rem; font-weight: 700; line-height: 1.2; }
.stat-card .stat-label { font-size: .8125rem; color: var(--text-muted); margin-top: .25rem; }
.stat-card.stat-primary .stat-valor { color: var(--primary); }
.stat-card.stat-warning .stat-valor { color: var(--warning); }
.stat-card.stat-success .stat-valor { color: var(--success); }
.stat-card.stat-danger .stat-valor { color: var(--danger); }
.stats-compact { grid-template-columns: repeat(4, 1fr); }
.stats-dashboard { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

/* Filtros */
.filtros-bar {
  display: flex; flex-wrap: wrap; gap: .75rem; align-items: center;
  margin-bottom: 1.25rem; padding: 1rem; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.busca-wrap { position: relative; flex: 1; min-width: 200px; }
.busca-wrap input {
  width: 100%; padding: .625rem .875rem .625rem 2.5rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm); font: inherit;
}
.busca-wrap input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.busca-icon { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.busca-usuarios { margin-bottom: 1.25rem; max-width: 400px; }
.select-compact {
  padding: .625rem .875rem; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: #fff; font: inherit; font-size: .875rem;
}
.chips-filtro { display: flex; flex-wrap: wrap; gap: .375rem; }
.chip {
  padding: .375rem .75rem; border-radius: 999px; font-size: .8125rem; font-weight: 500;
  background: #f1f5f9; color: var(--text-muted); border: 1px solid transparent; cursor: pointer;
}
.chip:hover { background: #e2e8f0; }
.chip.ativo { background: var(--primary-light); color: var(--primary); border-color: #93c5fd; }

/* Demandas grid */
.demandas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.demanda-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; cursor: pointer; transition: all .2s; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: .75rem;
}
.demanda-card:hover { border-color: #93c5fd; box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.demanda-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.demanda-card h3 { font-size: .9375rem; font-weight: 600; line-height: 1.4; flex: 1; }
.demanda-card .resumo { font-size: .8125rem; color: var(--text-muted); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.demanda-card-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: .75rem; border-top: 1px solid var(--border); font-size: .8125rem; color: var(--text-muted);
}
.demanda-card-acoes { display: flex; gap: .375rem; }
.btn-card {
  padding: .3rem .5rem; font-size: .75rem; border-radius: 6px;
  background: #f1f5f9; color: var(--text); font-weight: 500;
}
.btn-card:hover { background: var(--primary-light); color: var(--primary); }
.btn-card-success:hover { background: var(--success-bg); color: var(--success); }

/* Usuários */
.usuarios-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.usuario-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; cursor: pointer; transition: all .2s; box-shadow: var(--shadow);
  display: flex; gap: 1rem; align-items: flex-start;
}
.usuario-card:hover { border-color: #93c5fd; transform: translateY(-2px); }
.usuario-card-info { flex: 1; min-width: 0; }
.usuario-card-info h3 { font-size: .9375rem; margin-bottom: .25rem; }
.usuario-card-info .login-tag { font-size: .8125rem; color: var(--text-muted); }
.usuario-card .remetentes { font-size: .75rem; color: var(--text-muted); margin-top: .5rem; word-break: break-all; }
.checkbox-grid { display: grid; gap: .5rem; margin-top: .5rem; max-height: 200px; overflow-y: auto; padding: .5rem; border: 1px solid var(--border); border-radius: var(--radius); }
.checkbox-item { font-size: .875rem; }
.texto-muted { font-size: .875rem; color: var(--text-muted); margin: .5rem 0 0; }
.nav-item-temp { position: relative; }
.nav-badge-temp { margin-left: auto; font-size: .625rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: .15rem .4rem; border-radius: 4px; background: rgba(245,158,11,.2); color: #b45309; }
.status-contencioso { background: #fef3c7; color: #92400e; }
.status-sem-roteamento { background: #ede9fe; color: #5b21b6; }
.motivo-sem-roteamento { font-size: 0.8125rem; color: #6d28d9; margin: 0.35rem 0; }
.stat-sem-roteamento { border-left: 3px solid #7c3aed; }
.stat-sem-roteamento .stat-valor { color: #5b21b6; }
.adv-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}
.adv-tab {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius) var(--radius) 0 0;
}
.adv-tab.ativa {
  color: var(--primary);
  background: var(--surface);
  box-shadow: inset 0 -2px 0 var(--primary);
}
.sem-roteamento-rotear .select-rotear-cli,
.sem-roteamento-rotear .select-rotear-adv { flex: 1; min-width: 140px; }
.contencioso-atribuir {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.contencioso-atribuir .select-atribuir { flex: 1; min-width: 160px; }
.demanda-meta { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.875rem; color: var(--text-muted); margin: 0.5rem 0; }
.checkbox-inline { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; color: var(--text-muted); white-space: nowrap; }
.importar-caixas-lista { margin: 0.5rem 0 0; padding-left: 1.25rem; font-size: 0.875rem; line-height: 1.6; }
.importar-secao-titulo { font-size: 0.9375rem; margin: 0 0 0.75rem; }
.importar-inbox-resultado { margin-top: 0.75rem; font-size: 0.875rem; padding: 0.75rem 1rem; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.importar-dica { margin: .75rem 0 1.25rem; line-height: 1.5; }
.importar-status { margin-top: 1.25rem; padding: 1rem; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.importar-status.processando { border-color: var(--primary); color: var(--primary); }
.importar-resultado { margin-top: 1rem; padding: 1rem 1.25rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.importar-resultado.sucesso { border-color: #22c55e; background: rgba(34,197,94,.06); }
.importar-resultado.erro { border-color: #ef4444; background: rgba(239,68,68,.06); }
.importar-resultado.aviso { border-color: #f59e0b; background: rgba(245,158,11,.06); }
.importar-resultado h4 { margin: 0 0 .5rem; font-size: 1rem; }
.importar-resultado p { margin: .35rem 0; font-size: .875rem; line-height: 1.5; }
.importar-detalhes { font-size: .75rem; overflow: auto; max-height: 200px; margin-top: .5rem; padding: .5rem; background: var(--surface-2); border-radius: 4px; }

/* Testes */
.testes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}
.teste-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  cursor: pointer;
  transition: all .2s;
  box-shadow: var(--shadow);
}
.teste-card:hover {
  border-color: #93c5fd;
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.teste-card-header {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
}
.teste-icon {
  font-size: 1.75rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: .125rem;
}
.teste-card h3 {
  font-size: .9375rem;
  font-weight: 600;
  margin-bottom: .25rem;
}
.teste-desc {
  font-size: .8125rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.teste-status {
  margin-left: auto;
  flex-shrink: 0;
}
.teste-indicator {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: all .3s;
}
.teste-indicator-idle { background: #cbd5e1; }
.teste-indicator-executando {
  background: var(--primary);
  animation: pulse 1s ease-in-out infinite;
}
.teste-indicator-ok { background: var(--success); box-shadow: 0 0 6px rgba(5,150,105,.4); }
.teste-indicator-atencao { background: var(--warning); box-shadow: 0 0 6px rgba(217,119,6,.4); }
.teste-indicator-falha { background: var(--danger); box-shadow: 0 0 6px rgba(220,38,38,.4); }
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(1.3); }
}
.teste-resultado {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.teste-msg {
  font-size: .875rem;
  font-weight: 500;
  padding: .625rem .875rem;
  border-radius: var(--radius-sm);
}
.teste-msg-ok { background: var(--success-bg); color: #047857; }
.teste-msg-falha { background: var(--danger-bg); color: #b91c1c; }
.teste-msg-atencao { background: var(--warning-bg); color: #b45309; }
.teste-detalhes {
  margin-top: .75rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
  font-size: .8125rem;
  color: var(--text-muted);
}
.teste-subitens {
  margin-top: .75rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.teste-sub {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .8125rem;
  padding: .5rem .75rem;
  border-radius: var(--radius-sm);
}
.teste-sub-ok { background: var(--success-bg); color: #047857; }
.teste-sub-falha { background: var(--danger-bg); color: #b91c1c; }
.teste-sub-icon { font-weight: 700; }
.testes-placeholder {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: .875rem;
}

/* Empty state */
.empty-state {
  grid-column: 1 / -1; text-align: center; padding: 3rem 2rem;
  background: var(--bg-card); border: 2px dashed var(--border); border-radius: var(--radius);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: .75rem; opacity: .5; }
.empty-state h3 { font-size: 1rem; margin-bottom: .375rem; }
.empty-state p { color: var(--text-muted); font-size: .875rem; }

/* Dashboard */
.dashboard-alertas {
  display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1.25rem;
}
.dashboard-alerta {
  display: flex; align-items: center; gap: .5rem;
  padding: .75rem 1rem; border-radius: var(--radius-sm);
  background: var(--warning-bg); color: #92400e; font-size: .875rem; font-weight: 500;
  border: 1px solid #fcd34d;
}
.dashboard-resumo {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 2rem;
}
.dashboard-kpi {
  display: flex; flex-direction: column; align-items: flex-start; gap: .375rem;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem 1.5rem; box-shadow: var(--shadow); text-align: left;
  transition: transform .15s, box-shadow .15s; cursor: pointer;
}
.dashboard-kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.dashboard-kpi-titulo { font-size: .8125rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }
.dashboard-kpi-total { font-size: 2.25rem; font-weight: 700; line-height: 1.1; }
.dashboard-kpi-tags { display: flex; flex-wrap: wrap; gap: .375rem; margin-top: .25rem; }
.dashboard-kpi-tag {
  font-size: .75rem; font-weight: 600; padding: .2rem .5rem; border-radius: 999px;
}
.tag-warning { background: var(--warning-bg); color: var(--warning); }
.tag-primary { background: var(--primary-light); color: var(--primary); }
.tag-success { background: var(--success-bg); color: var(--success); }
.tag-danger { background: var(--danger-bg); color: var(--danger); }
.tag-muted { background: #f1f5f9; color: var(--text-muted); }
.dashboard-kpi-admin { border-top: 3px solid var(--primary); }
.dashboard-kpi-admin .dashboard-kpi-total { color: var(--primary); }
.dashboard-kpi-contencioso { border-top: 3px solid #d97706; }
.dashboard-kpi-contencioso .dashboard-kpi-total { color: #92400e; }
.dashboard-kpi-sem-roteamento { border-top: 3px solid #7c3aed; }
.dashboard-kpi-sem-roteamento .dashboard-kpi-total { color: #5b21b6; }
.dashboard-secao-titulo {
  font-size: .8125rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 1rem;
}
.dashboard-extras { margin-top: 0; }
.dashboard-grid-extras {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.dashboard-card-detalhe {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: var(--shadow);
}
.dashboard-card-cabecalho {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 1.25rem; padding-bottom: .75rem; border-bottom: 1px solid var(--border);
}
.dashboard-card-cabecalho h3 { font-size: 1rem; font-weight: 600; }
.dashboard-card-total { font-size: 1.5rem; font-weight: 700; color: var(--text-muted); }
.dashboard-card-total strong { color: var(--text); }
.dashboard-equipe {
  display: flex; gap: 1.5rem; margin-top: 1.5rem; padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.dashboard-equipe-item { font-size: .875rem; color: var(--text-muted); }
.dashboard-equipe-item strong { font-size: 1.125rem; color: var(--text); margin-right: .375rem; }
.progress-bar-wrap { margin-bottom: .875rem; }
.progress-bar-wrap:last-of-type { margin-bottom: 0; }
.progress-label { display: flex; justify-content: space-between; font-size: .8125rem; margin-bottom: .375rem; color: var(--text-muted); }
.progress-label span:last-child { font-weight: 600; color: var(--text); }
.progress-bar { height: 6px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; transition: width .5s ease; }
@media (max-width: 900px) {
  .dashboard-resumo, .dashboard-grid-extras { grid-template-columns: 1fr; }
}

/* Modais */
dialog.modal {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  max-width: 600px;
  width: calc(100% - 2rem);
  max-height: calc(100vh - 2rem);
  box-shadow: var(--shadow-lg);
  margin: 0;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  overflow: hidden;
}
dialog.modal-sm { max-width: 400px; }

#modal-confirm .modal-confirm {
  display: flex;
  flex-direction: column;
}

#modal-confirm .modal-confirm-cabecalho {
  padding: 1.25rem 1.5rem 0;
  text-align: center;
}

#modal-confirm .modal-confirm-cabecalho h3 {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text);
}

#modal-confirm .modal-confirm-corpo {
  padding: 0.875rem 1.5rem 1.25rem;
  text-align: center;
}

#modal-confirm #confirm-mensagem {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-muted);
}

#modal-confirm .modal-confirm-rodape {
  justify-content: flex-end;
  gap: 0.625rem;
  padding: 0.875rem 1.5rem 1.25rem;
}
#modal-demanda { max-width: 680px; }
dialog::backdrop { background: rgba(15,23,42,.5); backdrop-filter: blur(4px); }
.modal-conteudo, .modal-form { display: flex; flex-direction: column; max-height: 90vh; }
.modal-cabecalho {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1rem; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border);
}
.modal-cabecalho h3 { font-size: 1.125rem; margin-top: .375rem; }

#modal-usuario .modal-cabecalho,
#modal-nova-demanda .modal-cabecalho {
  position: relative;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 3.5rem;
}

#modal-usuario .modal-cabecalho h3,
#modal-nova-demanda .modal-cabecalho h3 {
  margin: 0;
  padding: 0 2.5rem;
  width: 100%;
}

#modal-usuario .modal-cabecalho .btn-fechar-modal,
#modal-nova-demanda .modal-cabecalho .btn-fechar-modal {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
}
.modal-corpo { padding: 1.25rem 1.5rem; overflow-y: auto; flex: 1; }
.modal-rodape {
  display: flex; justify-content: flex-end; gap: .5rem;
  padding: 1rem 1.5rem; border-top: 1px solid var(--border); background: #f8fafc;
  border-radius: 0 0 var(--radius) var(--radius);
}
.modal-rodape-usuario { justify-content: space-between; align-items: center; }
.modal-rodape-acoes { display: flex; gap: .5rem; }
.modal-secao { margin-bottom: 1.25rem; }
.modal-secao h4 { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: .5rem; }
.texto-resumo { font-size: .9375rem; line-height: 1.6; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.info-item { background: #f8fafc; padding: .75rem; border-radius: var(--radius-sm); }
.info-item .info-label { font-size: .6875rem; text-transform: uppercase; color: var(--text-muted); letter-spacing: .04em; }
.info-item .info-valor { font-size: .875rem; font-weight: 500; margin-top: .125rem; word-break: break-word; }
.info-item.info-full { grid-column: 1 / -1; }
.anexo-badge {
  font-size: .8125rem;
  color: var(--text-muted);
  margin: -.25rem 0 .5rem;
}
.anexos-upload-lista {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  font-size: .875rem;
  color: var(--text-muted);
}
.anexos-upload-lista li {
  padding: .35rem .5rem;
  background: var(--surface-2);
  border-radius: 6px;
  border: 1px solid var(--border);
}
.anexos-lista { display: flex; flex-direction: column; gap: .5rem; }
.anexo-item {
  display: flex; align-items: center; gap: .75rem; padding: .625rem .875rem;
  background: #f8fafc; border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; font-size: .875rem; transition: background .15s;
}
.anexo-item:hover { background: var(--primary-light); border-color: #93c5fd; }
.anexo-item svg { color: var(--primary); flex-shrink: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.field-full { grid-column: 1 / -1; }
.acoes-modal { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.btn-fechar-modal {
  background: transparent; color: var(--text-muted); font-size: 1.5rem;
  line-height: 1; padding: .25rem .5rem; border-radius: 6px;
}
.btn-fechar-modal:hover { background: #f1f5f9; color: var(--text); }

/* Toast */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999; display: flex; flex-direction: column; gap: .5rem; }
.toast {
  padding: .875rem 1.25rem; border-radius: var(--radius-sm); color: #fff;
  font-size: .875rem; font-weight: 500; box-shadow: var(--shadow-lg);
  animation: slideIn .3s ease; max-width: 360px;
}
.toast-sucesso { background: var(--success); }
.toast-erro { background: var(--danger); }
.toast-info { background: var(--primary); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: none; opacity: 1; } }

/* Loading */
.loading-overlay {
  position: fixed; inset: 0; background: rgba(255,255,255,.7);
  display: flex; align-items: center; justify-content: center; z-index: 9998;
  backdrop-filter: blur(2px);
}
.spinner {
  width: 40px; height: 40px; border: 3px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsivo */
@media (max-width: 900px) {
  .login-layout { grid-template-columns: 1fr; padding: 1.5rem; }
  .login-brand { display: none; }
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; flex-wrap: wrap; }
  .sidebar-nav { flex-direction: row; flex: 1; padding: .5rem; overflow-x: auto; }
  .sidebar-footer { border-top: none; border-left: 1px solid rgba(255,255,255,.08); }
  .main-area { max-height: none; padding: 1rem; }
  .stats-compact { grid-template-columns: repeat(2, 1fr); }
  .demandas-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
