:root {
  --blue: #436eb3;
  --blue-dark: #2f5390;
  --blue-soft: #eaf0f9;
  --green: #01b034;
  --green-dark: #00622e;
  --green-soft: #e6f6ea;
  --ink: #1c2433;
  --muted: #5b6578;
  --line: #e3e7ee;
  --bg: #f5f7fa;
  --card: #ffffff;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn: #8a5a00;
  --warn-soft: #fff6e0;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(28, 36, 51, .06), 0 4px 16px rgba(28, 36, 51, .05);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
a { color: var(--blue); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
p { margin: 0 0 1em; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.wrap { max-width: 880px; margin: 0 auto; padding: 0 20px; }
.wrap-wide { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* Topo */
.topbar { background: #fff; border-bottom: 1px solid var(--line); }
.topbar .inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 68px; }
.topbar img { height: 34px; width: auto; display: block; }
.topbar nav { display: flex; align-items: center; gap: 18px; font-size: .95rem; }
.topbar nav a { text-decoration: none; font-weight: 600; }
.topbar .who { color: var(--muted); font-size: .9rem; }
.accent { height: 3px; background: linear-gradient(90deg, var(--green), var(--green-dark)); }

/* Hero */
.hero { padding: 40px 0 28px; }
.hero h1 { font-size: clamp(1.7rem, 3.5vw, 2.3rem); color: var(--ink); }
.hero .lead { font-size: 1.08rem; color: var(--muted); max-width: 680px; }
.pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 22px; }
.pillar { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.pillar strong { display: flex; align-items: center; gap: 8px; color: var(--blue-dark); margin-bottom: 4px; }
.pillar strong::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: none; }
.pillar span { font-size: .9rem; color: var(--muted); }

/* Cartões e formulário */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; margin-bottom: 24px; }
.card h2 { font-size: 1.25rem; }
.step { display: flex; gap: 12px; align-items: baseline; margin: 26px 0 8px; }
.step:first-of-type { margin-top: 0; }
.step .n { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--blue); color: #fff; font-weight: 700; font-size: .85rem; display: inline-flex; align-items: center; justify-content: center; }
.step label, .step .label { font-weight: 700; font-size: 1.02rem; }
.hint { font-size: .88rem; color: var(--muted); margin: 0 0 10px 38px; }
.field { margin-left: 38px; }
input[type=text], input[type=email], input[type=month], select, textarea {
  width: 100%; font: inherit; color: inherit; background: #fff; border: 1px solid #cdd3de; border-radius: 8px; padding: 11px 13px;
}
textarea { min-height: 200px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, .dropzone:focus-visible { outline: 3px solid rgba(67, 110, 179, .3); border-color: var(--blue); outline-offset: 0; }
.counter { text-align: right; font-size: .8rem; color: var(--muted); margin-top: 4px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; cursor: pointer; }
.check input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--blue); flex: none; }
.checks-inline { display: flex; flex-wrap: wrap; gap: 6px 22px; }

.btn { font: inherit; font-weight: 700; border: 0; border-radius: 8px; padding: 12px 22px; cursor: pointer; background: var(--blue); color: #fff; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.btn:hover { background: var(--blue-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--blue); border: 1px solid var(--blue); }
.btn.secondary:hover { background: var(--blue-soft); }
.btn.ghost { background: transparent; color: var(--blue); padding: 8px 10px; }
.btn.ghost:hover { background: var(--blue-soft); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 7px 14px; font-size: .88rem; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 24px; }

.dropzone { border: 2px dashed #c3cbd8; border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted); cursor: pointer; background: #fbfcfe; transition: border-color .15s, background .15s; }
.dropzone.over { border-color: var(--blue); background: var(--blue-soft); }
.dropzone strong { color: var(--blue); }
.file-list { list-style: none; padding: 0; margin: 10px 0 0; }
.file-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; margin-top: 6px; font-size: .9rem; background: #fff; }
.file-list .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list button { border: 0; background: none; color: var(--danger); cursor: pointer; font: inherit; font-size: .85rem; }
.file-list a { text-decoration: none; font-weight: 600; }

.notice { border-radius: 8px; padding: 12px 14px; font-size: .9rem; margin: 12px 0; }
.notice.info { background: var(--blue-soft); color: #23406f; }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.error { background: var(--danger-soft); color: var(--danger); }
.notice.ok { background: var(--green-soft); color: var(--green-dark); }

/* Protocolo */
.protocol-box { text-align: center; padding: 26px; border: 2px solid var(--green); border-radius: var(--radius); background: var(--green-soft); margin: 18px 0; }
.protocol-box .code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: clamp(1.2rem, 4vw, 1.9rem); font-weight: 700; letter-spacing: .06em; color: var(--ink); user-select: all; word-break: break-all; }
.protocol-input { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace !important; font-size: 1.2rem !important; letter-spacing: .08em; text-transform: uppercase; text-align: center; }

/* Status */
.badge { display: inline-block; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.badge.recebida { background: var(--blue-soft); color: var(--blue-dark); }
.badge.em_analise { background: #eef2ff; color: #3b4ba8; }
.badge.aguardando_denunciante { background: var(--warn-soft); color: var(--warn); }
.badge.encerrada { background: var(--green-soft); color: var(--green-dark); }
.badge.restrito { background: var(--danger-soft); color: var(--danger); }

.stepper { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 18px 0 6px; }
.stepper div { text-align: center; font-size: .8rem; color: var(--muted); padding-top: 10px; border-top: 4px solid var(--line); }
.stepper div.done { border-color: var(--green); color: var(--green-dark); font-weight: 600; }
.stepper div.current { border-color: var(--blue); color: var(--blue-dark); font-weight: 700; }

/* Conversa */
.thread { display: flex; flex-direction: column; gap: 12px; margin: 14px 0; }
.msg { max-width: 82%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.msg .meta { font-size: .76rem; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.msg .body { white-space: pre-wrap; word-wrap: break-word; }
.msg.left { align-self: flex-start; background: var(--blue-soft); border-color: #d4e0f2; }
.msg.right { align-self: flex-end; background: #fff; }
.msg.system { align-self: center; max-width: 100%; background: transparent; border: 0; font-size: .85rem; color: var(--muted); text-align: center; padding: 4px; }
.msg.note { align-self: stretch; max-width: 100%; background: var(--warn-soft); border: 1px dashed #e6c46f; }
.msg .file-list li { background: rgba(255, 255, 255, .7); }
.pre { white-space: pre-wrap; word-wrap: break-word; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin: 0; font: inherit; }

/* Portal */
.tabs { display: flex; gap: 4px; }
.tabs a { padding: 8px 14px; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 600; }
.tabs a.active { background: var(--blue-soft); color: var(--blue-dark); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 22px 0; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.kpi.active { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue-soft); }
.kpi .v { font-size: 1.8rem; font-weight: 800; }
.kpi .l { font-size: .85rem; color: var(--muted); }
table.list { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.list th, table.list td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: .92rem; vertical-align: middle; }
table.list th { background: #fafbfd; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
table.list tbody tr { cursor: pointer; }
table.list tbody tr:hover { background: #fafbfd; }
table.list tr:last-child td { border-bottom: 0; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-right: 6px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .92rem; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 10px; }
.seg button { font: inherit; font-size: .88rem; border: 0; background: #fff; padding: 8px 14px; cursor: pointer; color: var(--muted); font-weight: 600; }
.seg button.active { background: var(--blue); color: #fff; }
details.audit summary { cursor: pointer; font-weight: 700; }
.audit-list { list-style: none; padding: 0; margin: 12px 0 0; font-size: .84rem; max-height: 340px; overflow: auto; }
.audit-list li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.audit-list time { color: var(--muted); display: block; font-size: .76rem; }
.login-card { max-width: 420px; margin: 70px auto; }
.code-input { font-size: 1.6rem !important; letter-spacing: .5em; text-align: center; font-family: ui-monospace, Menlo, monospace !important; }
.report-table td:last-child, .report-table th:last-child { text-align: right; }
.bar { height: 8px; background: var(--blue); border-radius: 4px; min-width: 2px; }

footer { border-top: 1px solid var(--line); background: #fff; padding: 18px 0; font-size: .82rem; color: var(--muted); margin-top: 32px; }
footer .inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

@media (max-width: 860px) {
  .grid2 { grid-template-columns: 1fr; }
  .hint, .field { margin-left: 0; }
  .card { padding: 20px; }
  .msg { max-width: 95%; }
  table.list .hide-sm { display: none; }
  .topbar nav .who { display: none; }
}
@media print {
  .topbar, footer, .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; }
}
