:root { --bg:#0f172a; --panel:#ffffff; --line:#e5e7eb; --text:#111827; --muted:#64748b; --accent:#2563eb; }
* { box-sizing:border-box; }
body { margin:0; font-family: system-ui, -apple-system, Segoe UI, sans-serif; background:#f1f5f9; color:var(--text); }
.app-shell { min-height:100vh; display:flex; }
.sidebar { width:260px; background:var(--bg); color:#fff; padding:24px 16px; position:fixed; inset:0 auto 0 0; }
.brand { font-size:24px; font-weight:800; line-height:1.1; margin-bottom:32px; }
.brand span { color:#93c5fd; font-size:18px; }
.menu-link { display:block; width:100%; border:0; background:transparent; color:#cbd5e1; text-align:left; padding:14px 16px; border-radius:12px; margin-bottom:8px; cursor:pointer; font-size:15px; }
.menu-link:hover, .menu-link.active { background:#1e293b; color:#fff; }
.content { margin-left:260px; padding:28px; width:calc(100% - 260px); }
.panel { background:var(--panel); border:1px solid var(--line); border-radius:18px; padding:24px; box-shadow:0 10px 30px rgba(15,23,42,.06); }
h1 { margin-top:0; }
.cards { display:grid; grid-template-columns:repeat(4,minmax(160px,1fr)); gap:16px; margin:20px 0; }
.card { border:1px solid var(--line); border-radius:16px; padding:18px; background:#f8fafc; }
.card strong { display:block; font-size:28px; }
.card span { color:var(--muted); }
.table-wrap { overflow:auto; }
table { border-collapse:collapse; width:100%; min-width:850px; }
th,td { border-bottom:1px solid var(--line); padding:12px; text-align:left; vertical-align:top; }
th { background:#f8fafc; }
button.primary,.small { border:0; border-radius:10px; cursor:pointer; background:var(--accent); color:#fff; padding:12px 16px; font-weight:700; }
button.secondary { border:1px solid var(--line); border-radius:10px; cursor:pointer; background:#fff; color:#334155; padding:12px 16px; font-weight:700; }
button.secondary:hover { background:#f8fafc; }
.small { padding:8px 12px; }
.detail-grid { display:grid; grid-template-columns:repeat(2,minmax(220px,1fr)); gap:14px; margin-bottom:16px; }
.detail-grid div { background:#f8fafc; border:1px solid var(--line); border-radius:12px; padding:12px; }
.detail-grid b { display:block; color:var(--muted); font-size:13px; }
.motivo { background:#fff7ed; border:1px solid #fed7aa; border-radius:12px; padding:14px; margin:16px 0; }
textarea { width:100%; border:1px solid var(--line); border-radius:12px; padding:12px; margin:8px 0 14px; font:inherit; }
.loading { padding:18px; color:var(--muted); }
.error { color:#b91c1c; }
.result { margin-top:20px; border-top:1px solid var(--line); padding-top:18px; }
pre { white-space:pre-wrap; background:#0b1220; color:#e5e7eb; border-radius:12px; padding:16px; }
@media (max-width: 900px) {
  .app-shell { display:block; }
  .sidebar { position:relative; width:100%; min-height:auto; }
  .content { margin-left:0; width:100%; padding:16px; }
  .cards,.detail-grid { grid-template-columns:1fr; }
}

.muted { color:var(--muted); }
.error-box { background:#fef2f2; border:1px solid #fecaca; border-radius:14px; padding:18px; }
.result-header { display:flex; justify-content:space-between; gap:16px; align-items:flex-start; margin-bottom:16px; }
.result-header h2 { margin-bottom:4px; }
.status-pill { border-radius:999px; padding:8px 12px; font-size:13px; font-weight:800; white-space:nowrap; }
.status-pill.ok { background:#dcfce7; color:#166534; }
.status-pill.warn { background:#fef3c7; color:#92400e; }
.meta-grid { display:grid; grid-template-columns:repeat(4,minmax(160px,1fr)); gap:12px; margin:16px 0; }
.meta-grid div { background:#f8fafc; border:1px solid var(--line); border-radius:12px; padding:12px; min-width:0; }
.meta-grid b { display:block; color:var(--muted); font-size:12px; margin-bottom:4px; }
.meta-grid span { overflow-wrap:anywhere; }
.ai-score-box { display:grid; grid-template-columns:220px 1fr; gap:16px; align-items:center; border:1px solid #bfdbfe; background:#eff6ff; border-radius:16px; padding:18px; margin:18px 0; }
.score-value { display:block; font-size:42px; font-weight:900; color:#1d4ed8; line-height:1; }
.score-label { color:#1e40af; font-weight:700; }
.three-columns { display:grid; grid-template-columns:repeat(3,minmax(220px,1fr)); gap:16px; margin:20px 0; }
.three-columns section { border:1px solid var(--line); border-radius:14px; padding:16px; background:#f8fafc; }
.check-list li::marker { content:"✓ "; color:#15803d; font-weight:bold; }
.warn-list li::marker { content:"! "; color:#b45309; font-weight:bold; }
.rag-empty { border:1px dashed #f59e0b; background:#fffbeb; color:#92400e; border-radius:12px; padding:14px; }
.rag-list { display:grid; gap:14px; margin-top:12px; }
.rag-card { border:1px solid var(--line); border-radius:14px; background:#fff; padding:16px; }
.rag-card-header { display:flex; justify-content:space-between; gap:16px; align-items:flex-start; }
.rag-card-header strong { display:block; }
.rag-card-header span { display:block; color:var(--muted); font-size:13px; margin-top:4px; }
.rag-score { background:#eef2ff; color:#3730a3; border-radius:999px; padding:6px 10px; font-size:12px; font-weight:800; white-space:nowrap; }
.rag-meta { display:flex; flex-wrap:wrap; gap:8px; margin:12px 0; }
.rag-meta span, .tags span { border:1px solid var(--line); background:#f8fafc; color:#475569; border-radius:999px; padding:5px 9px; font-size:12px; }
.rag-trecho { background:#f8fafc; border-left:4px solid #cbd5e1; padding:12px; border-radius:8px; color:#334155; }
.tags { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
.human-review-box { margin-top:18px; border:1px solid #fed7aa; background:#fff7ed; color:#9a3412; border-radius:14px; padding:14px; }
@media (max-width: 1100px) {
  .meta-grid { grid-template-columns:repeat(2,minmax(160px,1fr)); }
  .three-columns { grid-template-columns:1fr; }
}
@media (max-width: 700px) {
  .result-header, .rag-card-header { display:block; }
  .status-pill, .rag-score { display:inline-block; margin-top:8px; }
  .meta-grid, .ai-score-box { grid-template-columns:1fr; }
}

.panel-header { display:flex; justify-content:space-between; gap:16px; align-items:flex-start; }
.filter-bar { display:flex; flex-wrap:wrap; gap:12px; align-items:end; margin:18px 0; padding:14px; border:1px solid var(--line); border-radius:14px; background:#f8fafc; }
.filter-bar label { display:grid; gap:6px; min-width:180px; color:var(--muted); font-size:13px; font-weight:700; }
.filter-bar input[type="date"], .filter-bar input[type="search"], .filter-bar select { border:1px solid var(--line); border-radius:10px; padding:10px 12px; font:inherit; color:var(--text); background:#fff; width:100%; }
.filter-field-convenio { min-width:260px; }
.filter-field-search { flex:1 1 340px; min-width:280px; }
.filter-actions { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.periodo-info { border:1px solid #bfdbfe; background:#eff6ff; color:#1e40af; border-radius:12px; padding:12px 14px; margin:12px 0; }
.filter-summary { display:flex; flex-wrap:wrap; gap:8px; align-items:center; border:1px solid #dbeafe; background:#eff6ff; color:#1e3a8a; border-radius:12px; padding:12px 14px; margin:12px 0 18px; }
.empty-table { text-align:center; color:var(--muted); padding:28px 12px; }
.dashboard-cards { grid-template-columns:repeat(4,minmax(170px,1fr)); }
.status-badge { display:inline-flex; align-items:center; border-radius:999px; padding:6px 10px; font-size:12px; font-weight:800; white-space:nowrap; }
.status-pendente { background:#fef3c7; color:#92400e; }
.status-parcial { background:#dbeafe; color:#1d4ed8; }
.status-total { background:#dcfce7; color:#166534; }
@media (max-width: 900px) {
  .panel-header { display:block; }
  .filter-bar { display:grid; }
  .filter-field-convenio,
  .filter-field-search { min-width:0; }
  .filter-actions { display:grid; grid-template-columns:1fr; }
  .dashboard-cards { grid-template-columns:1fr; }
}
