/* MRK Adm Global: tela limpa, neutra, legível em tablet. */
:root {
  --ink: #111827; --text: #1f2937; --muted: #6b7280; --line: #e5e7eb; --bg: #f5f6f8; --card: #fff;
  --accent: #2563eb; --ok: #16a34a; --warn: #d97706; --erro: #dc2626; --side: #111827; --side-text: #cbd5e1;
  --r: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 0 0 8px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.carregando { padding: 40px; text-align: center; color: var(--muted); }

/* Login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login .card { width: 100%; max-width: 380px; padding: 32px 28px; }
.login .marca { font-weight: 800; font-size: 22px; letter-spacing: -.02em; color: var(--ink); margin-bottom: 4px; }
.login .sub { color: var(--muted); margin-bottom: 22px; }
.login .links { margin-top: 14px; display: flex; justify-content: space-between; font-size: 13px; }

/* Layout */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-text); padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.side .marca { color: #fff; font-weight: 800; font-size: 17px; padding: 6px 10px 18px; letter-spacing: -.01em; }
.side nav a { display: flex; align-items: center; gap: 10px; color: var(--side-text); padding: 9px 10px; border-radius: 8px; font-weight: 500; }
.side nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.side nav a.ativo { background: rgba(255,255,255,.12); color: #fff; }
.side .eu { margin-top: auto; padding: 10px; font-size: 12px; color: #94a3b8; border-top: 1px solid rgba(255,255,255,.08); }
.side .eu b { color: #e2e8f0; display: block; font-size: 13px; }
.side .eu a { color: #94a3b8; }
.main { padding: 22px 26px 60px; min-width: 0; }
.topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.topo .acoes { display: flex; gap: 8px; flex-wrap: wrap; }
.menu-btn { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: -240px; width: 220px; z-index: 20; transition: left .2s; }
  .side.aberta { left: 0; box-shadow: 0 0 0 100vw rgba(0,0,0,.4); }
  .menu-btn { display: inline-flex; }
  .main { padding: 14px 14px 60px; }
}

/* Componentes */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid2 { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.grid3 { display: grid; gap: 14px; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.kpi .n { font-size: 26px; font-weight: 700; color: var(--ink); }
.kpi .l { color: var(--muted); font-size: 12px; }
.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--ink); color: #fff; border: 1px solid var(--ink); border-radius: 8px; padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; min-height: 36px; }
.btn:hover { background: #000; text-decoration: none; }
.btn.sec { background: #fff; color: var(--ink); border-color: #d1d5db; }
.btn.sec:hover { background: #f3f4f6; }
.btn.perigo { background: #fff; color: var(--erro); border-color: #fca5a5; }
.btn.perigo:hover { background: #fef2f2; }
.btn.mini { padding: 4px 9px; min-height: 28px; font-size: 12px; font-weight: 500; }
.btn:disabled { opacity: .5; cursor: default; }
label { display: block; font-weight: 600; font-size: 13px; margin: 10px 0 4px; }
label .opc { font-weight: 400; color: var(--muted); }
input, select, textarea { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; color: var(--text); min-height: 36px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #93c5fd; border-color: var(--accent); }
input[type=checkbox] { width: auto; min-height: 0; }
textarea { min-height: 90px; resize: vertical; }
.linha { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.linha > * { flex: 1; min-width: 140px; }
.linha > .fixo { flex: none; min-width: 0; }
.filtros { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.filtros > div { min-width: 150px; flex: 1; }
.filtros label { margin-top: 0; }
.erro { color: var(--erro); font-size: 13px; margin: 6px 0; min-height: 16px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: #e5e7eb; color: #374151; margin-right: 4px; }
.tag.cor { color: #fff; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; background: #eef2ff; color: #3730a3; }
.pill.ok { background: #dcfce7; color: #166534; }
.pill.erro { background: #fee2e2; color: #991b1b; }
.pill.warn { background: #fef3c7; color: #92400e; }
.pill.neutro { background: #f3f4f6; color: #4b5563; }

table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fafafa; }
tr:last-child td { border-bottom: 0; }
tr.clicavel { cursor: pointer; }
tr.clicavel:hover td { background: #f8fafc; }
.tabela-wrap { overflow-x: auto; }
.paginacao { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 10px; }
.vazio { padding: 30px; text-align: center; color: var(--muted); background: var(--card); border: 1px dashed var(--line); border-radius: var(--r); }

/* Jornada */
.jornada { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); margin-left: 8px; }
.jornada li { position: relative; padding: 0 0 14px 18px; }
.jornada li::before { content: ""; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: #9ca3af; border: 2px solid #fff; }
.jornada li.cadastro::before, .jornada li.recadastro::before { background: var(--accent); }
.jornada li.email_enviado::before, .jornada li.email_entregue::before { background: #7c3aed; }
.jornada li.email_aberto::before, .jornada li.email_clicado::before { background: var(--ok); }
.jornada li.email_devolvido::before, .jornada li.descadastro::before { background: var(--erro); }
.jornada li.whatsapp::before { background: #25d366; }
.jornada li.etapa::before, .jornada li.movido_area::before { background: var(--warn); }
.jornada .quando { font-size: 12px; color: var(--muted); }
.jornada .titulo { font-weight: 500; }
.jornada .corpo { white-space: pre-wrap; color: #374151; font-size: 13px; margin-top: 4px; }

/* Modal e avisos */
.modal-fundo { position: fixed; inset: 0; background: rgba(17,24,39,.45); display: flex; align-items: flex-start; justify-content: center; padding: 40px 12px; z-index: 50; overflow: auto; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 560px; padding: 20px; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.modal.larga { max-width: 860px; }
.modal h2 { margin-bottom: 14px; }
.modal .rodape { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px; font-size: 13px; box-shadow: 0 4px 16px rgba(0,0,0,.2); max-width: 360px; }
.toast.erro { background: var(--erro); }
.toast.ok { background: var(--ok); }
.barra { height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; }
.barra > div { height: 100%; background: var(--accent); }
.previa-email { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: #fafafa; max-height: 50vh; overflow: auto; }
.qr { width: 220px; height: 220px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.copiar { font-family: ui-monospace, monospace; font-size: 12px; background: #f3f4f6; padding: 6px 8px; border-radius: 6px; word-break: break-all; }
.check-linha { display: flex; gap: 8px; align-items: center; font-weight: 400; margin: 8px 0; }
.check-linha input { width: 18px; height: 18px; }
.abas { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.abas a { padding: 8px 12px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.abas a.ativo { color: var(--ink); border-color: var(--ink); }
.abas a:hover { text-decoration: none; color: var(--ink); }
.mini-grafico { display: flex; align-items: flex-end; gap: 2px; height: 60px; }
.mini-grafico div { flex: 1; max-width: 28px; background: var(--accent); border-radius: 2px 2px 0 0; min-height: 1px; }
@media (max-width: 860px) { .col-opc { display: none; } }
