:root {
  --blue: #0f4fb5; --blue-dark: #0b2f6e; --yellow: #f5c400; --yellow-soft: #fff6cc;
  --ink: #16213a; --muted: #5d6680; --line: #e3e7ef; --bg: #f4f6fa; --card: #fff;
  --green: #14945a; --red: #d13a2f; --orange: #e08a00; --purple: #7c4dff;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.45; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; line-height: 1.2; }
h2 { font-size: 16px; margin-bottom: 12px; }
a { color: var(--blue); }
input, select, textarea, button { font: inherit; font-size: 16px; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.demo { background: var(--yellow); color: #3a2e00; text-align: center; font-size: 13px; font-weight: 600; padding: 6px 12px; }

.top { position: sticky; top: 0; z-index: 1000; display: flex; align-items: center; gap: 18px; padding: 10px 20px; background: var(--blue-dark); color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand img { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--yellow); object-fit: cover; }
.brand span { display: flex; flex-direction: column; line-height: 1.15; }
.brand small { color: var(--yellow); font-size: 12px; }
.menu { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.menu a { color: #d9e4ff; text-decoration: none; padding: 8px 12px; border-radius: 8px; white-space: nowrap; font-weight: 500; }
.menu a.on, .menu a:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.who { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.who span { display: flex; flex-direction: column; text-align: right; line-height: 1.2; }
.who small { color: #b9c8ec; font-size: 12px; }
.who a { color: var(--yellow); font-weight: 600; text-decoration: none; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 22px 20px 40px; display: flex; flex-direction: column; gap: 16px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 0 0 24px; }
.title-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.title-side { text-align: right; }
.back { text-decoration: none; font-size: 14px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px; cursor: pointer; }
.btn:hover { border-color: #c5ccdb; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.big { padding: 13px 18px; font-size: 16px; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.whats { background: #1faa59; border-color: #1faa59; color: #fff; margin-top: 12px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.grid2, .grid3, .grid4 { display: grid; gap: 16px; }
.grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); min-width: 130px; }
.filters label.grow { flex: 1; min-width: 200px; }
.filters select, .filters input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 14px; }
.filter-actions { display: flex; gap: 8px; }

.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: inherit; }
.kpi span { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi b { font-size: 28px; line-height: 1.1; }
.kpi small { font-size: 12px; color: var(--muted); }
.kpi.good { border-color: #b9e3cb; background: #f1fbf5; }
.kpi.good b { color: var(--green); }
.kpi.bad { border-color: #f3c2bd; background: #fff5f4; }
.kpi.bad b { color: var(--red); }
a.kpi:hover { border-color: var(--blue); }

.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) 32px; gap: 8px; align-items: center; font-size: 13px; }
.bar-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track { height: 10px; background: #edf0f6; border-radius: 6px; overflow: hidden; }
.track i { display: block; height: 100%; background: var(--blue); border-radius: 6px; }
.bar-row b { text-align: right; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--muted); font-size: 12px; font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 9px 8px; border-bottom: 1px solid #eef1f6; vertical-align: top; }
.table .n { text-align: right; white-space: nowrap; }
.table tr.off td { opacity: .5; }

.list { display: flex; flex-direction: column; }
.item { display: flex; justify-content: space-between; gap: 12px; padding: 12px 6px; border-bottom: 1px solid #eef1f6; color: inherit; text-decoration: none; }
.item:hover { background: #f8faff; }
.item.is-late { box-shadow: inset 3px 0 0 var(--red); }
.item-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.item-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; flex-shrink: 0; }
.days { font-size: 12px; color: var(--muted); }

.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: #eef1f6; color: var(--muted); white-space: nowrap; }
.s-recebida { background: #eef1f6; color: #4c5670; }
.s-formalizada { background: #e3eeff; color: #1550b8; }
.s-cobrada { background: #fff1d6; color: #8a5300; }
.s-atendida { background: #efe8ff; color: #5a2fd0; }
.s-resolvida { background: #e2f6eb; color: #0f7445; }
.s-arquivada { background: #f0f0f0; color: #777; }
.pill.late { background: #ffe3e0; color: #b42318; }
.p-alta { background: #fff1d6; color: #8a5300; }
.p-urgente { background: #ffe3e0; color: #b42318; }

.alert { background: #fff1f0; border: 1px solid #f3c2bd; color: #a3261b; border-radius: 10px; padding: 10px 14px; }
.ok { background: #effaf3; border: 1px solid #b9e3cb; color: #0f6b40; border-radius: 10px; padding: 10px 14px; }

.form { display: flex; flex-direction: column; gap: 14px; }
.form.narrow { max-width: 720px; width: 100%; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
.form input:not([type=checkbox]):not([type=radio]), .form select, .form textarea { width: 100%; padding: 11px 12px; border: 1px solid #d5dbe7; border-radius: 10px; background: #fff; color: var(--ink); font-weight: 400; }
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid #bcd3ff; border-color: var(--blue); }
.form label.check { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 500; color: var(--ink); }
.form label.check input { margin-top: 3px; width: 18px; height: 18px; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 14px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
legend { font-weight: 700; font-size: 14px; padding: 0 6px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
[hidden] { display: none !important; }

.login-page { background: var(--blue-dark); }
.login-page .foot { color: #b9c8ec; }
.login { display: grid; grid-template-columns: 1.2fr 1fr; gap: 0; background: #fff; border-radius: 20px; overflow: hidden; min-height: 560px; }
.login-art { background: var(--yellow); display: flex; align-items: center; }
.login-art img { width: 100%; height: auto; display: block; }
.login-box { padding: 34px; display: flex; flex-direction: column; gap: 12px; justify-content: center; }
.login-face { width: 64px; height: 64px; border-radius: 50%; border: 3px solid var(--yellow); }
.hint { font-size: 14px; font-weight: 600; }
.roles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.roles button { text-align: left; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: #f8faff; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.roles button:hover { border-color: var(--blue); background: #eef4ff; }
.roles b { font-size: 14px; color: var(--blue-dark); }
.roles small { font-size: 12px; color: var(--muted); }
.or { text-align: center; color: var(--muted); font-size: 13px; }

.detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.detail > div { display: flex; flex-direction: column; gap: 16px; }
.desc { font-size: 16px; margin-bottom: 14px; }
.facts { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); font-weight: 600; }
.facts dd { margin: 0; }
.photo { width: 100%; border-radius: 10px; display: block; }
.photo.small { max-width: 220px; margin-top: 6px; }
.mini-map { height: 240px; border-radius: 10px; }
.big-map { height: 620px; border-radius: 14px; border: 1px solid var(--line); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot.s-recebida { background: #7a8398; } .dot.s-formalizada { background: #1f6fe0; } .dot.s-cobrada { background: #e08a00; }
.dot.s-atendida { background: #7c4dff; } .dot.s-resolvida { background: #14945a; } .late-dot { background: #fff; border: 3px solid var(--red); }
.map-pin { display: block; width: 22px; height: 22px; border-radius: 50%; background: var(--c); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
.map-pin.is-late { border-color: var(--red); }

.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.timeline li { position: relative; background: none; padding: 0; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: -26px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: #c5ccdb; border: 2px solid #fff; }
.timeline li.st::before { background: var(--blue); }
.timeline li.s-resolvida::before { background: var(--green); }
.timeline li.s-cobrada::before { background: var(--orange); }
.timeline li.s-atendida::before { background: var(--purple); }
.timeline li.st, .timeline li.note { background: none; color: inherit; }
.tl-head { display: flex; flex-direction: column; }

.tabs { display: flex; gap: 4px; background: #e9edf5; padding: 4px; border-radius: 10px; width: fit-content; }
.tabs a { padding: 7px 14px; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; }
.tabs a.on { background: #fff; color: var(--blue-dark); }
.pager { display: flex; gap: 8px; flex-wrap: wrap; }
.report { display: flex; flex-direction: column; gap: 16px; }
.report-head { display: flex; align-items: center; gap: 16px; background: var(--blue-dark); color: #fff; border-radius: 14px; padding: 18px 20px; border-bottom: 5px solid var(--yellow); }
.report-head img { width: 64px; height: 64px; border-radius: 50%; border: 3px solid var(--yellow); }
.report-head .muted { color: #b9c8ec; }
.checklist { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; }
.check-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid #eef1f6; font-size: 14px; }
.check-row:last-child { border-bottom: 0; }
.choices { display: flex; gap: 10px; }
.choices label { flex-direction: row; align-items: center; gap: 4px; font-weight: 500; color: var(--ink); }
.visit { padding: 10px 0; border-bottom: 1px solid #eef1f6; display: flex; flex-direction: column; gap: 2px; }

@media (max-width: 980px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid3, .grid4 { grid-template-columns: 1fr 1fr; }
  .detail, .grid2 { grid-template-columns: 1fr; }
  .top { flex-wrap: wrap; padding: 10px 14px; gap: 8px; }
  .menu { order: 3; flex-basis: 100%; }
  .who { margin-left: auto; }
}
@media (max-width: 640px) {
  .wrap { padding: 16px 14px 32px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .grid3, .grid4, .two, .roles { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; border-radius: 0; }
  .login-art img { height: 200px; }
  .login-box { padding: 22px 18px; }
  .filters label { min-width: calc(50% - 5px); flex: 1; }
  .item { flex-direction: column; }
  .item-side { align-items: flex-start; text-align: left; flex-direction: row; flex-wrap: wrap; }
  .who span { display: none; }
  .big-map { height: 70vh; }
  .check-row { flex-direction: column; align-items: flex-start; }
  .facts { grid-template-columns: 1fr; }
}
@media print {
  .demo, .top, .no-print, .foot { display: none !important; }
  body { background: #fff; font-size: 12px; }
  .wrap { padding: 0; max-width: none; }
  .card, .kpi { break-inside: avoid; }
  .report-kpis { grid-template-columns: repeat(3, 1fr); }
  .grid2 { grid-template-columns: 1fr 1fr; }
}
