* { box-sizing: border-box; font-family: Arial, sans-serif; }
body { margin: 0; background: #f6f8fb; color: #1f2937; }
.sidebar { position: fixed; top: 0; left: 0; width: 260px; height: 100vh; background: #0f172a; color: #e2e8f0; padding: 20px; }
.sidebar h1 { font-size: 20px; margin: 0 0 8px; }
.brand-block { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 8px; }
.brand-logo { width: 50%; max-width: 130px; height: auto; border-radius: 12px; object-fit: contain; display: block; }
.sidebar .user { color: #94a3b8; font-size: 13px; margin-bottom: 16px; }
.sidebar nav { display: flex; flex-direction: column; gap: 8px; }
.sidebar nav a, .sidebar .logout { color: #e2e8f0; text-decoration: none; padding: 8px 10px; border-radius: 8px; }
.sidebar nav a:hover, .sidebar .logout:hover { background: #1e293b; }
.sidebar .logout { display: inline-block; margin-top: 16px; border: 1px solid #334155; }
.content { margin-left: 280px; padding: 24px; }
.content h2 { margin-top: 0; }
.content-full { margin-left: 0; min-height: 100vh; display: grid; place-items: center; }
.login-card { background: white; border-radius: 12px; padding: 24px; width: 360px; box-shadow: 0 10px 30px rgba(0,0,0,.08); }
.login-brand { display: flex; align-items: center; gap: 10px; }
.login-brand-logo { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; display: block; }
.login-card form { display: flex; flex-direction: column; gap: 8px; }
.login-card input, button { padding: 10px; border-radius: 8px; border: 1px solid #cbd5e1; }
button { background: #2563eb; color: white; border: none; }
.grid { display: grid; gap: 16px; margin-top: 16px; }
.status-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.cards-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.card { background: white; border-radius: 12px; padding: 16px; box-shadow: 0 4px 16px rgba(0,0,0,.05); }
.error { color: #b91c1c; background: #fee2e2; padding: 8px; border-radius: 8px; }
.qr-placeholder { margin-top: 12px; border: 2px dashed #94a3b8; padding: 20px; border-radius: 8px; color: #64748b; text-align: center; }

.table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.table th, .table td { border-bottom: 1px solid #e5e7eb; padding: 10px; text-align: left; vertical-align: top; }
.table th { font-size: 12px; text-transform: uppercase; color: #475569; letter-spacing: .02em; }
.table-wrap { width: 100%; overflow: auto; border-radius: 10px; }
.table-wrap .table { min-width: 1200px; }
.table thead th { position: sticky; top: 0; background: #fff; z-index: 2; }
.toolbar-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar-row input, .toolbar-row select { padding: 8px; border: 1px solid #cbd5e1; border-radius: 8px; }
.message-card { border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px; margin-bottom: 10px; background: #fcfcfd; }
.messages-list { margin-top: 12px; max-height: 70vh; overflow: auto; }
.msg-badge { display: inline-block; font-size: 11px; border: 1px solid #cbd5e1; border-radius: 999px; padding: 2px 8px; margin-right: 4px; color: #334155; background: #f8fafc; }
.badge-shadow { border-color: #7c3aed; color: #5b21b6; background: #f3e8ff; }
.badge-ai { border-color: #0ea5e9; color: #075985; background: #e0f2fe; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.btn-danger { background: #b91c1c; }
.btn-secondary { background: #64748b; }
.qr-panel { border: 2px dashed #94a3b8; border-radius: 8px; padding: 16px; margin-top: 8px; }
.muted { color: #64748b; font-size: 13px; margin-top: 10px; }

.subscription-box { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 10px; }
.subscription-box.subscription-compact { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.subscription-group { border: 1px solid #e2e8f0; border-radius: 10px; padding: 8px; background: #f8fafc; }
.subscription-group h4 { margin: 4px 0 8px; font-size: 13px; color: #334155; }
.subscription-item { display: block; margin: 4px 0; font-size: 13px; }

.modal-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, 0.45);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 2000;
	padding: 16px;
}

.modal-card {
	width: min(860px, 100%);
	max-height: 92vh;
	overflow: auto;
	background: #fff;
	border-radius: 12px;
	padding: 16px;
	box-shadow: 0 20px 40px rgba(0,0,0,.25);
}

.send-destinations-list {
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	padding: 10px;
	max-height: 220px;
	overflow: auto;
	background: #f8fafc;
}

.send-destination-item {
	display: block;
	margin: 6px 0;
}

.global-shadow-banner { margin-bottom: 14px; background: #fef3c7; color: #92400e; border: 1px solid #f59e0b; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.badge-status { display:inline-block; padding: 3px 8px; border-radius: 999px; background:#eef2ff; color:#3730a3; font-size:12px; }
.badge-attendance { display:inline-block; padding: 3px 8px; border-radius: 999px; font-size:12px; background:#f1f5f9; }
.badge-attendance.no_response { background:#fee2e2; color:#991b1b; }
.badge-attendance.community { background:#fef9c3; color:#854d0e; }
.badge-attendance.official { background:#dbeafe; color:#1d4ed8; }
.badge-attendance.resolved { background:#dcfce7; color:#166534; }
.badge-attendance.unidentified { background:#ffedd5; color:#9a3412; }
.group-cell { max-width: 270px; }
.group-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.group-sub { color: #64748b; font-size: 12px; }
.case-title { max-width: 360px; }
.sla-box strong { display:block; }
.sla-box small { color:#64748b; }
.message-main { font-size: 15px; margin: 6px 0; }
.message-meta { color:#64748b; font-size: 12px; }
.message-card .case-chip { margin-top: 8px; display: inline-block; font-size: 12px; padding: 4px 10px; border-radius: 999px; border:1px solid #cbd5e1; }
.case-chip.linked_case { background:#f3e8ff; border-color:#c084fc; color:#6b21a8; }
.case-chip.no_case { background:#f8fafc; color:#475569; }
.case-chip.ai_waiting { background:#fff7ed; border-color:#fdba74; color:#9a3412; }
.case-chip.ai_processing { background:#e0f2fe; border-color:#7dd3fc; color:#075985; }
.case-header-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 16px; }
.case-header-grid .label { color:#64748b; font-size:12px; }
.case-header-grid .value { font-weight:600; }
.timeline-item { border-left: 3px solid #cbd5e1; padding-left: 12px; margin: 12px 0; }
.timeline-item.solicitante { border-left-color:#16a34a; }
.timeline-item.comunidade { border-left-color:#f59e0b; }
.timeline-item.equipe { border-left-color:#2563eb; }
.timeline-item.nao-identificado { border-left-color:#64748b; }
.timeline-item blockquote { margin:8px 0 0; background:#f8fafc; border-left:3px solid #cbd5e1; padding:8px; border-radius:6px; }
.report-cards { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.metric-number { font-size: 28px; font-weight: 700; margin-top: 8px; }
.metric-card { position: relative; overflow: hidden; border: 1px solid #e2e8f0; }
.metric-card::after { content:''; position:absolute; right:-24px; top:-24px; width:90px; height:90px; border-radius:50%; background: rgba(255,255,255,.55); }
.metric-card h3 { margin-bottom: 6px; }
.metric-total { background: linear-gradient(135deg, #eff6ff, #ffffff); }
.metric-open { background: linear-gradient(135deg, #eef2ff, #ffffff); }
.metric-no-response { background: linear-gradient(135deg, #fff7ed, #ffffff); }
.metric-sla { background: linear-gradient(135deg, #fef2f2, #ffffff); }
.metric-resolved { background: linear-gradient(135deg, #ecfdf5, #ffffff); }
.metric-first-response { background: linear-gradient(135deg, #f5f3ff, #ffffff); }

.report-charts-grid { align-items: stretch; }
.report-panel { border: 1px solid #e2e8f0; }
.report-panel h3 { margin-bottom: 12px; }

.donut-wrap { display: flex; flex-direction: column; gap: 14px; align-items: stretch; }
.donut-canvas { position: relative; width: 210px; height: 210px; margin: 0 auto; }
.donut-svg { width: 210px; height: 210px; display: block; }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut-center strong { font-size: 30px; line-height: 1; }
.donut-center small { color: #64748b; font-size: 12px; margin-top: 2px; }

.donut-legend { margin: 0; padding: 0; list-style: none; max-height: 280px; overflow: auto; }
.donut-legend li { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: center; padding: 6px 0; font-size: 14px; border-bottom: 1px dashed #e5e7eb; }
.donut-legend li:last-child { border-bottom: 0; }
.donut-legend .dot { width: 10px; height: 10px; border-radius: 999px; display: inline-block; }
.donut-legend .legend-label { white-space: normal; overflow-wrap: anywhere; line-height: 1.25; }
.donut-legend .legend-value { color: #334155; font-size: 13px; text-align: right; white-space: nowrap; }

.chart-bar-row { display:flex; align-items:center; gap:8px; margin:8px 0; }
.chart-bar-row .label { width: 220px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-bar { flex:1; background:#e2e8f0; border-radius:6px; overflow:hidden; height: 12px; }
.chart-bar-fill { height:100%; background:#2563eb; }
.chart-value { width:80px; text-align:right; font-size:12px; color:#334155; }

@media (max-width: 980px) {
  .donut-wrap { grid-template-columns: 1fr; }
  .donut-legend { max-height: none; }
}

@media (max-width: 1200px) {
	.content { margin-left: 0; padding: 16px; }
	.sidebar { position: static; width: 100%; height: auto; }
}
