:root {
  --azul: #0f3b63;
  --azul-2: #145a8d;
  --verde: #1f7a4d;
  --amarelo: #d99a00;
  --laranja: #d96b00;
  --vermelho: #b42318;
  --cinza: #64748b;
  --borda: #d9e2ec;
  --texto: #17212b;
  --muted: #64748b;
  --bg: #eef3f7;
  --branco: #fff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--texto);
}

a { color: var(--azul-2); font-weight: 700; text-decoration: none; }
a:hover { text-decoration: underline; }

header {
  background: linear-gradient(135deg, #7c2d12, #b45309, #0f3b63);
  color: white;
  padding: 24px 18px;
  border-bottom: 5px solid #7c2d12;
}

header h1 { margin: 0; font-size: 25px; line-height: 1.2; }
header p { margin: 8px 0 0; opacity: .94; font-size: 14px; max-width: 980px; }

.container { max-width: 1220px; margin: 20px auto; padding: 0 14px 44px; }

.topbar {
  display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap;
  margin-bottom: 14px;
}

.card {
  background: white;
  border: 1px solid var(--borda);
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(15, 59, 99, .08);
  overflow: hidden;
  margin-bottom: 16px;
}

.card-header {
  padding: 14px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--borda);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.card-header h2 { margin: 0; font-size: 18px; color: var(--azul); }
.card-header span { font-size: 12px; color: var(--muted); text-align: right; }
.card-body { padding: 16px; }

.grid { display: grid; grid-template-columns: 1.25fr .95fr; gap: 16px; align-items: start; }
.grid-one { display: grid; grid-template-columns: 1fr; gap: 16px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.filters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }

label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 5px; color: #334155; }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--borda);
  border-radius: 10px;
  padding: 10px;
  font-size: 14px;
  background: white;
}

textarea { min-height: 82px; resize: vertical; }
.full { grid-column: 1 / -1; }

.hint { font-size: 12px; color: var(--muted); line-height: 1.45; margin-top: 6px; }
.inline-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

button, .btn {
  border: 0;
  border-radius: 12px;
  padding: 11px 14px;
  font-weight: 700;
  cursor: pointer;
  background: var(--azul);
  color: white;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
}

button.secondary, .btn.secondary { background: #e2e8f0; color: #1e293b; }
button.success, .btn.success { background: var(--verde); }
button.danger, .btn.danger { background: var(--vermelho); }
button.warning, .btn.warning { background: var(--laranja); }

.flash { border-radius: 14px; padding: 12px; margin-bottom: 12px; font-weight: 700; }
.flash.success { background:#ecfdf5; color:#14532d; border:1px solid #86efac; }
.flash.error { background:#fef2f2; color:#7f1d1d; border:1px solid #fecaca; }
.flash.info { background:#eff6ff; color:#1e3a8a; border:1px solid #bfdbfe; }

.hero-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.action-card {
  background: white;
  border: 1px solid var(--borda);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 8px 22px rgba(15, 59, 99, .08);
  cursor: pointer;
  transition: .15s;
}
.action-card:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(15, 59, 99, .12); }
.action-card strong { display: block; font-size: 17px; color: var(--azul); margin-bottom: 6px; }
.action-card span { display: block; font-size: 13px; color: var(--muted); line-height: 1.4; }

.vitrine {
  border-radius: 18px;
  border: 1px solid #fed7aa;
  background: linear-gradient(135deg, #fff7ed, #ffffff);
  box-shadow: 0 8px 22px rgba(180, 83, 9, .08);
  padding: 16px;
  margin-bottom: 16px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
}
.vitrine h2 { margin:0 0 4px; color:#9a3412; font-size:18px; }
.vitrine p { margin:0; color:#334155; font-size:13px; line-height:1.45; }
.vitrine.global { border-color:#bfdbfe; background:linear-gradient(135deg,#eff6ff,#ffffff); }
.vitrine.global h2 { color:#1e3a8a; }

.status-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.status-card {
  border: 1px solid var(--borda);
  border-radius: 12px;
  padding: 10px;
  background: white;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  cursor: pointer;
  font-size: 13px;
}
.status-card input { width:auto; margin-top: 2px; }
.status-card strong { display:block; margin-bottom: 2px; }
.status-card span { color: var(--muted); font-size: 12px; line-height: 1.3; }

.photo-preview { margin-top: 12px; }
.photo-card { border: 1px solid var(--borda); border-radius: 14px; overflow: hidden; background: #f8fafc; }
.photo-card img { width: 100%; height: 210px; object-fit: contain; display: block; background: #e2e8f0; }
.photo-card textarea { border-radius: 0; border: 0; border-top: 1px solid var(--borda); min-height: 62px; }

.mapa {
  height: 410px;
  border: 1px solid var(--borda);
  border-radius: 16px;
  overflow: hidden;
  background: #dbeafe;
  position: relative;
}
.leaflet-container { width:100%; height:100%; z-index:1; }

.fire-marker { background: transparent; border: 0; }
.fire-marker-wrap {
  width: 32px; height: 32px; border-radius: 999px; display:flex; align-items:center; justify-content:center;
  color:white; font-size:16px; font-weight:700; border:2px solid white; box-shadow:0 3px 10px rgba(0,0,0,.28);
}
.fire-ativo { background:#d32f2f; }
.fire-verificacao { background:#f57c00; }
.fire-atendimento { background:#1976d2; }
.fire-controlado { background:#2e7d32; }
.fire-apagado { background:#111827; }
.fire-arquivado { background:#6b7280; }

.map-legend { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.legend-item { display:inline-flex; align-items:center; gap:6px; background:#f8fafc; border:1px solid var(--borda); border-radius:999px; padding:6px 10px; font-size:12px; color:#334155; }
.legend-fire { width:18px; height:18px; display:inline-flex; align-items:center; justify-content:center; color:white; border-radius:999px; font-size:11px; font-weight:700; }
.legend-ativo { background:#d32f2f; } .legend-verificacao { background:#f57c00; } .legend-atendimento { background:#1976d2; } .legend-controlado { background:#2e7d32; } .legend-apagado { background:#111827; } .legend-arquivado { background:#6b7280; }

.protocol-box {
  border-radius: 16px;
  background: #ecfdf5;
  border: 1px solid #86efac;
  padding: 14px;
  margin-top: 12px;
  color: #14532d;
}
.protocol-box strong { display:block; font-size:20px; margin:6px 0; }

.badge { display:inline-flex; align-items:center; gap:4px; border-radius:999px; padding:4px 9px; font-size:12px; font-weight:700; color:white; white-space:nowrap; }
.st-ativo { background: var(--vermelho); }
.st-verificacao { background: var(--laranja); }
.st-atendimento { background: var(--azul-2); }
.st-controlado { background: var(--amarelo); color:#1f2937; }
.st-apagado { background: var(--verde); }
.st-arquivado { background: var(--cinza); }

.list { display:grid; gap:10px; margin-top:12px; }
.item { border:1px solid var(--borda); border-radius:14px; padding:12px; background:#fff; font-size:13px; line-height:1.45; }
.item-head { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:6px; }
.item strong { color: var(--azul); }

.dashboard-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin-bottom:16px; }
.dash-card { border:1px solid var(--borda); border-radius:18px; background:linear-gradient(135deg,#fff,#f8fafc); padding:15px; box-shadow:0 6px 16px rgba(15,59,99,.06); }
.dash-card small { display:block; color:var(--muted); font-weight:700; margin-bottom:5px; }
.dash-card b { display:block; color:var(--azul); font-size:26px; line-height:1; overflow:hidden; text-overflow:ellipsis; }
.dash-card span { display:block; color:#334155; font-size:12px; margin-top:6px; line-height:1.35; }
.dash-card.red b { color:var(--vermelho); } .dash-card.orange b { color:var(--laranja); } .dash-card.green b { color:var(--verde); } .dash-card.blue b { color:var(--azul-2); }

.analytics-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-bottom:16px; }
.panel { border:1px solid var(--borda); border-radius:18px; background:white; padding:14px; box-shadow:0 6px 16px rgba(15,59,99,.05); }
.panel h3 { margin:0 0 10px; color:var(--azul); font-size:16px; }
.bar-row { display:grid; grid-template-columns:120px 1fr 40px; gap:8px; align-items:center; margin:8px 0; font-size:13px; }
.bar-label { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:#334155; }
.bar-track { height:11px; background:#e2e8f0; border-radius:999px; overflow:hidden; }
.bar-fill { height:100%; background:linear-gradient(90deg,#f97316,#b42318); border-radius:999px; }
.status-dots { display:grid; gap:8px; }
.status-line { display:flex; align-items:center; justify-content:space-between; gap:8px; border:1px solid var(--borda); background:#f8fafc; border-radius:12px; padding:9px 10px; font-size:13px; }
.status-left { display:inline-flex; align-items:center; gap:8px; color:#334155; font-weight:700; }
.dot { width:11px; height:11px; border-radius:999px; display:inline-block; }
.dot.ativo { background:var(--vermelho); } .dot.verificacao{background:var(--laranja)} .dot.atendimento{background:var(--azul-2)} .dot.controlado{background:var(--verde)} .dot.apagado{background:#111827} .dot.arquivado{background:var(--cinza)}

.report-title { display:none; text-align:center; margin-bottom:16px; color:var(--azul); }
.report-title h1 { margin:0 0 4px; font-size:22px; }
.report-title p { margin:0; color:#475569; font-size:12px; }

.table { width:100%; border-collapse:collapse; font-size:13px; }
.table th, .table td { border-bottom:1px solid var(--borda); padding:9px; text-align:left; vertical-align:top; }
.table th { background:#f8fafc; color:#334155; }

footer a { color:#334155; font-weight:700; }
footer { text-align:center; padding:18px; color:#475569; font-size:13px; background:#e2e8f0; border-top:1px solid #cbd5e1; }

@media (max-width: 980px) { .grid { grid-template-columns:1fr; } }
@media (max-width: 680px) {
  .hero-actions, .form-grid, .status-options, .filters, .dashboard-grid, .analytics-grid { grid-template-columns:1fr; }
  header h1 { font-size:21px; }
  button, .btn { width:100%; }
  .card-header { align-items:flex-start; flex-direction:column; }
  .mapa { height:310px; }
  .vitrine { flex-direction:column; align-items:flex-start; }
}

@media print {
  @page { size:A4; margin:15mm 13mm 16mm 13mm; }
  body { background:white; }
  header, footer, .topbar, .hero-actions, .inline-actions, button, .btn, .filters, .mapa, .map-legend, .no-print { display:none !important; }
  .container { max-width:100%; margin:0; padding:0; }
  .card { box-shadow:none; break-inside:avoid; }
  .report-title { display:block !important; }
  .dashboard-grid { grid-template-columns:repeat(4,1fr); }
  .analytics-grid { grid-template-columns:1fr 1fr; }
}

.install-help {
  display:none;
  background:#eff6ff;
  border:1px solid #bfdbfe;
  color:#1e3a8a;
  border-radius:12px;
  padding:10px;
  margin-top:8px;
  font-size:13px;
}
#btnInstalarApp { display:inline-flex; }
.mapa-fallback {
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  min-height:260px;
  padding:20px;
  background:linear-gradient(135deg,#eff6ff,#fff7ed);
  color:#334155;
}

.mapa {
  min-height: 410px;
}

.mapa iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.leaflet-container {
  min-height: 410px;
}

@media (min-width: 681px) {
  .mapa {
    height: 460px;
    min-height: 460px;
  }
}
