:root {
  --bg: #0f172a;
  --sidebar-bg: #111827;
  --sidebar-fg: #e5e7eb;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --muted: #9ca3af;
  --content-bg: #f4f6fb;
  --card-bg: #ffffff;
  --border: #e5e7eb;
  --danger: #dc2626;
  --success: #16a34a;
}

* { box-sizing: border-box; }
/* Página sem scroll próprio: só a tabela rola. */
html, body { height: 100%; overflow: hidden; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--content-bg);
  color: #1f2937;
}

.layout { display: flex; height: 100vh; overflow: hidden; }

/* ---------------- Sidebar ---------------- */
.sidebar {
  width: 250px;
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 40;
}
.brand {
  padding: 20px 22px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .5px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.brand-mark { color: #fff; }
.brand-sub { color: var(--accent); }

.nav { padding: 14px 10px; flex: 1; overflow-y: auto; }
.nav-group-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--muted); padding: 12px 14px 8px;
}
/* Grupos colapsáveis do menu */
button.nav-group-title {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; background: none; border: 0; cursor: pointer;
  font-family: inherit; text-align: left;
}
button.nav-group-title:hover { color: var(--sidebar-fg); }
button.nav-group-title:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px; }
.nav-chevron { font-size: 10px; transition: transform .18s ease; opacity: .75; }
.nav-group.collapsed .nav-chevron { transform: rotate(-90deg); }
.nav-group.collapsed .nav-group-items { display: none; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; margin: 2px 0;
  border-radius: 8px;
  color: var(--sidebar-fg); text-decoration: none;
  font-size: 14px; transition: background .15s;
}
.nav-link .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted);
}
.nav-link:hover { background: rgba(255,255,255,.06); }
.nav-link.active { background: var(--accent); color: #fff; }
.nav-link.active .dot { background: #fff; }

.sidebar-footer {
  padding: 16px; border-top: 1px solid rgba(255,255,255,.06);
}
.user-email {
  font-size: 12px; color: var(--muted); margin-bottom: 10px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.btn-logout {
  width: 100%; padding: 9px; border: 0; border-radius: 8px;
  background: rgba(255,255,255,.08); color: #fff; cursor: pointer;
  font-size: 13px;
}
.btn-logout:hover { background: rgba(255,255,255,.16); }
.account-link { display: block; font-size: 12px; color: var(--muted); text-decoration: none; margin-bottom: 8px; }
.account-link:hover { color: #fff; }
.sidebar-legal { margin-top: 12px; font-size: 11px; display: flex; gap: 6px; align-items: center; }
.sidebar-legal a { color: var(--muted); text-decoration: none; }
.sidebar-legal a:hover { color: #fff; }
.sidebar-legal span { color: rgba(255,255,255,.3); }

/* ---------------- Main ---------------- */
/* min-width:0 é essencial: sem isso o item flex cresce além da viewport
   com colunas largas e o scroll horizontal da grid não aparece. */
.main { flex: 1; min-width: 0; margin-left: 250px; display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  background: var(--card-bg); border-bottom: 1px solid var(--border);
  padding: 14px 26px; position: sticky; top: 0; z-index: 30;
}
.menu-toggle {
  display: none; background: none; border: 0; font-size: 22px; cursor: pointer;
}
.page-title { margin: 0; font-size: 18px; font-weight: 600; }
/* Conta no canto superior direito.
   Precisa ser flex: além do botão de conta (que é display:flex, portanto
   ocupa a linha toda), este bloco também abriga o seletor de plataforma —
   sem flex os dois empilham e o botão cobre o e-mail do usuário. */
.topbar-account {
  position: relative; margin-left: auto;
  display: flex; align-items: center; gap: 12px; min-width: 0;
}
.account-btn {
  display: flex; align-items: center; gap: 9px; background: none; border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 12px 5px 5px; cursor: pointer; color: var(--ink);
  max-width: 260px;
}
.account-btn:hover { background: #f8fafc; }
.account-avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: none;
}
.account-email {
  font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.account-caret { font-size: 10px; color: var(--muted); flex: none; }
.account-menu {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 220px; background: #fff;
  border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 30px rgba(15,23,42,.16);
  padding: 6px; z-index: 60;
}
.account-menu[hidden] { display: none; }
.account-menu-email {
  font-size: 12px; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border);
  margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.account-menu a, .account-menu button {
  display: block; width: 100%; text-align: left; padding: 9px 10px; border: 0; background: none;
  border-radius: 7px; font-size: 14px; color: var(--ink); cursor: pointer; text-decoration: none;
}
.account-menu a:hover, .account-menu button:hover { background: #f1f5f9; }
.account-menu button { color: var(--danger); }
@media (max-width: 640px) { .account-email { display: none; } }
/* Conteúdo preenche a altura restante e vira coluna flex;
   quem rola é a grid, não a página. */
.content {
  padding: 22px 26px;
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto; /* páginas-documento rolam na vertical; telas de grid usam .grid-host de altura fixa e não estouram */
}

.grid-note {
  font-size: 13px; color: var(--muted); line-height: 1.5;
  background: #f8fafc; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; margin-bottom: 12px;
}
.config-banner {
  font-size: 13px; color: #92400e; line-height: 1.55;
  background: #fffbeb; border: 1px solid #fcd34d; border-radius: 8px;
  padding: 12px 16px; margin-bottom: 12px;
}
.config-banner a { color: #92400e; font-weight: 600; }
.config-banner code {
  background: #fef3c7; padding: 1px 5px; border-radius: 4px; font-size: 12px;
}
.grid-host {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  flex: 1;
  min-height: 0;
  max-width: 100%;
  overflow: hidden; /* a própria grid Syncfusion cuida do scroll interno */
}

.alert {
  padding: 12px 16px; border-radius: 8px; margin-bottom: 14px; font-size: 14px;
}
.alert-error, .alert-danger { background: #fee2e2; color: var(--danger); }
.alert-success { background: #dcfce7; color: var(--success); }
.alert-info { background: #dbeafe; color: #1e40af; }

/* ---------------- Regulation Number: link + balão CFR ---------------- */
.cfr-link {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.cfr-link:hover { color: var(--accent-2); }

.cfr-popover {
  position: fixed;
  z-index: 1000;
  width: 380px;
  max-height: 320px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cfr-pop-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 10px 12px;
  background: var(--accent); color: #fff; font-size: 14px;
}
.cfr-pop-close {
  background: none; border: 0; color: #fff; font-size: 20px; line-height: 1;
  cursor: pointer; padding: 0 2px;
}
.cfr-pop-body { padding: 12px 14px; overflow-y: auto; font-size: 13px; }
.cfr-pop-title { font-weight: 600; margin-bottom: 8px; }
.cfr-pop-text { white-space: pre-wrap; color: #374151; line-height: 1.45; }

/* ---------------- Grafo de predicados ---------------- */
.graph-modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .6);
  display: flex; align-items: center; justify-content: center; z-index: 1200; padding: 20px;
}
.graph-modal {
  width: 94vw; max-width: 1100px; height: 84vh;
  background: #fff; border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column; box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
}
.graph-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: var(--accent); color: #fff; font-size: 15px;
}
.graph-head .muted { color: rgba(255, 255, 255, .8); margin-left: 8px; font-size: 12px; }
.graph-body { flex: 1; display: flex; min-height: 0; }
.graph-canvas {
  flex: 1; min-width: 0;
  background: radial-gradient(circle at 50% 40%, #f8fafc, #eef2f7);
  display: flex; align-items: center; justify-content: center; color: var(--muted);
}
.graph-empty { padding: 30px; color: var(--muted); text-align: center; }
.graph-info {
  width: 300px; border-left: 1px solid var(--border); padding: 16px; overflow-y: auto;
}
.pi-badge {
  display: inline-block; background: #eef2ff; color: #3730a3;
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 10px; margin-bottom: 12px;
}
.pi-row { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.pi-k { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.pi-v { font-size: 14px; color: #1f2937; }
.pi-note { margin-top: 10px; font-size: 12px; color: var(--muted); font-style: italic; }
.pi-actions { margin-top: 14px; }
.pi-actions a {
  display: inline-block; background: var(--accent); color: #fff; text-decoration: none;
  padding: 8px 14px; border-radius: 8px; font-size: 13px;
}
.graph-legend {
  display: flex; gap: 16px; padding: 8px 18px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--muted); background: #f8fafc; flex-wrap: wrap;
}
.graph-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }

@media (max-width: 820px) {
  .graph-modal { width: 96vw; height: 88vh; }
  .graph-body { flex-direction: column; }
  .graph-info { width: auto; border-left: 0; border-top: 1px solid var(--border); max-height: 40%; }
}

/* ---------------- Ícone do Summary (FDA) ao lado do K Number ---------------- */
.sum-icon {
  color: var(--accent);
  vertical-align: -2px;
  margin-left: 4px;
  display: inline-flex;
}
.sum-icon:hover { color: var(--accent-2); }

/* ---------------- Botão + modal 510(k) ---------------- */
.btn-action {
  background: transparent;
  color: var(--accent);
  border: 0;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn-action:hover { background: transparent; color: var(--accent-2); text-decoration: underline; }
.btn-action.btn-icon {
  padding: 5px 9px; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--accent); border: 0;
}
.btn-action.btn-icon:hover { background: transparent; color: var(--accent-2); }
.btn-action.btn-icon svg { display: block; }

.k-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1100; padding: 24px;
}
.k-modal {
  width: 100%; max-width: 900px; max-height: 82vh;
  background: #fff; border-radius: 12px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .4);
}
.k-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: var(--accent); color: #fff; font-size: 15px;
}
.k-modal-actions { display: flex; align-items: center; gap: 12px; }
.k-modal-pdf {
  background: rgba(255, 255, 255, .18);
  color: #fff; text-decoration: none;
  padding: 6px 12px; border-radius: 6px; font-size: 13px;
}
.k-modal-pdf:hover { background: rgba(255, 255, 255, .32); }
.k-modal-close {
  background: none; border: 0; color: #fff; font-size: 24px; line-height: 1;
  cursor: pointer;
}
.k-modal-body { padding: 16px 18px; overflow-y: auto; }
.k-count { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.k-empty { padding: 20px; text-align: center; color: var(--muted); }
.k-table-wrap { overflow-x: auto; }
.k-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.k-table th, .k-table td {
  border-bottom: 1px solid var(--border);
  padding: 8px 10px; text-align: left; vertical-align: top;
}
.k-table th { background: #f8fafc; position: sticky; top: 0; }
.k-table tr:hover td { background: #f9fafb; }

/* ---------------- Auth (allauth) ---------------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f172a, #1e3a8a);
  padding: 20px;
}
.auth-card {
  width: 100%; max-width: 400px; background: #fff;
  border-radius: 14px; padding: 34px 30px;
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
}
.auth-card h1 { margin: 0 0 6px; font-size: 22px; }
.auth-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 22px; }
.auth-card label { display: block; font-size: 13px; margin: 12px 0 6px; font-weight: 600; }
.auth-card input[type=text],
.auth-card input[type=email],
.auth-card input[type=password] {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px;
}
.auth-card input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.auth-card button[type=submit] {
  width: 100%; margin-top: 20px; padding: 12px; border: 0; border-radius: 8px;
  background: var(--accent); color: #fff; font-size: 15px; cursor: pointer;
}
.auth-card button[type=submit]:hover { background: var(--accent-2); }
.auth-card .helptext, .auth-card .form-text { font-size: 12px; color: var(--muted); }
.auth-card ul { margin: 6px 0; padding-left: 18px; }
.auth-links { margin-top: 18px; font-size: 13px; text-align: center; }
.auth-links a { color: var(--accent); text-decoration: none; }
.errorlist { color: var(--danger); font-size: 13px; list-style: none; padding: 0; margin: 6px 0; }
/* Gerenciar e-mails (allauth) */
.auth-subhead { font-size: 15px; margin: 26px 0 2px; }
.email-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.email-item { display: flex !important; align-items: center; gap: 8px; font-weight: 400 !important;
  font-size: 14px; margin: 0 !important; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
.email-item input[type=radio] { margin: 0; flex: none; }
.email-addr { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.email-actions button[type=submit] { width: auto !important; margin-top: 0 !important;
  padding: 8px 12px !important; font-size: 13px !important; background: #f1f5f9 !important; color: var(--ink) !important; }
.email-actions button[type=submit]:hover { background: #e2e8f0 !important; }
.email-actions button.danger { color: var(--danger) !important; }
.auth-card .tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px;
  border-radius: 10px; background: #eff6ff; color: var(--accent-d, #1d4ed8); }
.auth-card .tag.ok { background: #ecfdf5; color: #047857; }
.auth-card .tag.off { background: #fef2f2; color: var(--danger); }

/* ---------------- Texto explicativo de página ---------------- */
.page-intro {
  background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 10px;
  padding: 14px 18px; margin-bottom: 16px; font-size: 14px; color: #1e3a8a; line-height: 1.5;
}
.page-intro strong { color: #1e40af; }
.page-intro .pi-title { display: block; font-size: 15px; font-weight: 700; margin-bottom: 4px; }

/* ---------------- Alertas ---------------- */
.nav-badge {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 7px;
}
.alerts-layout {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start;
}
.card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px 20px;
}
.card.wide { grid-column: 1 / -1; }
.card-title { margin: 0 0 14px; font-size: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-head .card-title { margin: 0; }
.muted { color: var(--muted); font-weight: 400; font-size: 13px; }

.alert-form { display: flex; flex-direction: column; gap: 12px; }
.alert-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; }
.alert-form label.checkbox { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.alert-form input[type=text], .alert-form select {
  padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-weight: 400;
}
.alert-form input:focus, .alert-form select:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.form-help { font-size: 12px; color: var(--muted); }
.btn-primary {
  background: var(--accent); color: #fff; border: 0; border-radius: 8px;
  padding: 11px; font-size: 14px; cursor: pointer;
}
.btn-primary:hover { background: var(--accent-2); }
.btn-danger {
  background: var(--danger); color: #fff; border: 0; border-radius: 8px;
  padding: 11px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn-danger:hover { background: #b91c1c; }

.alerts-list { display: flex; flex-direction: column; gap: 10px; }
.alert-item {
  display: flex; justify-content: space-between; gap: 12px;
  border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px;
}
.alert-item.inactive { opacity: .6; }
.alert-item-name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.alert-item-filters { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--muted); }
.alert-item-actions { display: flex; gap: 6px; align-items: flex-start; }
.tag { background: #e0e7ff; color: #3730a3; font-size: 11px; padding: 1px 8px; border-radius: 10px; font-weight: 600; }
.tag.off { background: #fee2e2; color: var(--danger); }
.btn-mini {
  background: #f1f5f9; border: 1px solid var(--border); border-radius: 7px;
  padding: 5px 10px; font-size: 12px; cursor: pointer; color: #334155;
}
.btn-mini:hover { background: #e2e8f0; }
.btn-mini.danger { color: var(--danger); }

.badge { background: var(--danger); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 10px; margin-left: 6px; }
.hits { display: flex; flex-direction: column; }
.hit {
  display: grid; grid-template-columns: 130px 1fr auto; gap: 14px; align-items: center;
  padding: 12px 6px; border-bottom: 1px solid var(--border);
}
.hit.unread { background: #f5f8ff; }
.hit-ref { font-weight: 600; font-size: 13px; }
.hit-ref a { color: var(--accent); text-decoration: none; }
.hit-title { font-size: 14px; }
.hit-detail { font-size: 12px; color: var(--muted); }
.hit-meta { text-align: right; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.hit-date { font-size: 11px; color: var(--muted); }

@media (max-width: 820px) {
  .alerts-layout { grid-template-columns: 1fr; }
  .hit { grid-template-columns: 1fr; gap: 4px; }
  .hit-meta { text-align: left; flex-direction: row; align-items: center; }
}

/* ---------------- Dashboard ---------------- */
.dash { display: flex; flex-direction: column; gap: 18px; }
.kpi-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.kpi {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; text-decoration: none; color: inherit; display: flex; flex-direction: column;
  gap: 2px; transition: box-shadow .15s, transform .1s;
}
.kpi:hover { box-shadow: 0 6px 18px rgba(0,0,0,.08); transform: translateY(-1px); }
.kpi-n { font-size: 30px; font-weight: 700; line-height: 1.1; color: #111827; }
.kpi-l { font-size: 12px; font-weight: 600; color: #374151; }
.kpi-sub { font-size: 11px; color: var(--muted); }
.kpi.accent { border-color: #bfdbfe; background: #eff6ff; } .kpi.accent .kpi-n { color: var(--accent); }
.kpi.bad { border-color: #fecaca; background: #fef2f2; } .kpi.bad .kpi-n { color: var(--danger); }
.kpi.warn { border-color: #fde68a; background: #fffbeb; } .kpi.warn .kpi-n { color: #b45309; }
.dash-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; margin-bottom: 18px; }
.dash-chart { width: 100%; height: 280px; min-width: 0; }
.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.dash-monitor { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.dm-name { font-size: 14px; font-weight: 600; }
.dm-badges { display: flex; gap: 8px; }
.pill { font-size: 11px; padding: 2px 10px; border-radius: 10px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: #f0fdf4; color: #16a34a; }
.pill.warn { background: #fffbeb; color: #b45309; }
.pill.bad { background: #fef2f2; color: var(--danger); }
a.pill { text-decoration: none; cursor: pointer; }
a.pill:hover { filter: brightness(0.94); text-decoration: none; }
@media (max-width: 1100px) { .kpi-row { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 820px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } .dash-cols, .dash-charts { grid-template-columns: 1fr; } }

/* ---------------- Monitoramento (Recalls/MDR) ---------------- */
.mon-page { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.monitor-card { min-width: 0; }
/* Abas do Monitoring (My Products / Market Watch) */
.mon-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.mon-tab { padding: 10px 18px; font-weight: 600; font-size: 14px; color: var(--muted);
  cursor: pointer; border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.mon-tab:hover { color: var(--ink); }
.mon-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.mon-tab .muted { font-weight: 400; }
.mon-tab .badge { margin-left: 6px; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }
.mon-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
/* dentro do .mon-page o espaçamento já vem do gap do flex; evita margem dupla */
.mon-page .mon-toolbar { margin-bottom: 0; }
.mon-toolbar .btn-primary { width: auto; padding: 10px 18px; }
.monitor-card.inactive { opacity: .65; }
.count-chip { font-size: 12px; font-weight: 700; padding: 1px 9px; border-radius: 10px; margin-left: 6px; }
.count-chip.bad { background: #fef2f2; color: var(--danger); }
.count-chip.warn { background: #fffbeb; color: #b45309; }
.none-found { font-size: 13px; color: #16a34a; padding: 6px 0; }
.pi-source { margin-top: 8px; font-size: 12px; color: var(--muted); font-style: italic; }
/* Company Compliance Profile */
.profile-search { display: flex; gap: 10px; }
.profile-search input[type=text] {
  flex: 1; padding: 12px 14px; border: 1px solid var(--border); border-radius: 9px; font-size: 15px;
}
.profile-search input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.profile-search .btn-primary { width: auto; padding: 12px 24px; }
.prof-kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.kpi-box { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: #fff; text-align: center; }
.kpi-box .kpi-n { display: block; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.kpi-box .kpi-l { font-size: 12px; color: var(--muted); }
.kpi-box.bad .kpi-n { color: var(--danger); }
.kpi-box.warn .kpi-n { color: #b45309; }
.prof-table-wrap { overflow-x: auto; }
.prof-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.prof-table th { text-align: left; padding: 8px 10px; border-bottom: 2px solid var(--border);
  color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; }
.prof-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; white-space: nowrap; }
.prof-table td.wrap { white-space: normal; min-width: 240px; }
/* Company header no perfil */
.company-head { border-left: 4px solid var(--accent); display: flex;
  align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.company-head-main { flex: 1; min-width: 0; }
.company-head .btn-primary { flex-shrink: 0; white-space: nowrap; }
.company-name { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.company-addr { font-size: 14px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.company-fei { display: inline-block; margin-left: 10px; font-size: 11px; font-weight: 700;
  color: var(--accent-d, #1d4ed8); background: #eff6ff; padding: 2px 9px; border-radius: 10px; }
.section-divider { font-size: 16px; margin: 26px 0 6px; padding-top: 10px;
  border-top: 1px solid var(--border); color: var(--ink); }
/* FEI -> Company Profile (modal na grid Listing) */
.fei-link { color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.fei-link:hover { color: var(--accent-d, #1d4ed8); }
.ifu-link { color: var(--accent); text-decoration: none; font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.ifu-link:hover { text-decoration: underline; }
.ifu-link.muted { color: var(--muted, #64748b); font-weight: 500; }
.k-modal-wide { max-width: 1000px; width: 96%; }
.prof-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.prof-modal-name { font-size: 17px; font-weight: 700; }
.prof-modal-fei { font-size: 12px; color: var(--muted); margin-top: 2px; }
.prof-sec-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  color: var(--muted); margin: 20px 0 8px; }
.prof-modal .prof-kpis { margin-bottom: 4px; }
@media (max-width: 820px) { .prof-kpis { grid-template-columns: repeat(2, 1fr); } }
/* Signal detection */
.prof-table td.num, .prof-table th.num { text-align: right; white-space: nowrap; }
.sig-table tbody tr.sig-row { background: #fef2f2; }
.sig-badge { display: inline-block; background: var(--danger); color: #fff; font-size: 11px;
  font-weight: 700; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.sig-table .ci { color: var(--muted); font-size: 11px; }
/* Billing */
.sub-status { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 10px;
  border-radius: 12px; margin-right: 6px; }
.sub-status.ok { background: #ecfdf5; color: #047857; }
.sub-status.trial { background: #eff6ff; color: var(--accent-d, #1d4ed8); }
.sub-status.off { background: #fef2f2; color: var(--danger); }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.plan-card { position: relative; border: 1px solid var(--border); border-radius: 14px;
  padding: 22px 20px; background: #fff; text-align: center; }
.plan-card.featured { border: 2px solid var(--accent); box-shadow: 0 16px 36px -20px rgba(37,99,235,.4); }
.plan-badge { position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 12px; border-radius: 12px; }
.plan-name { font-weight: 700; font-size: 16px; margin-bottom: 6px; }
.plan-price { font-size: 30px; font-weight: 820; letter-spacing: -.02em; }
.plan-price small { font-size: 14px; color: var(--muted); font-weight: 600; }
.plan-sub { font-size: 13px; color: var(--muted); margin: 6px 0 16px; }
.plan-card .btn-primary { width: 100%; }
/* 483 Insights */
.obs-list { display: flex; flex-direction: column; gap: 12px; }
.obs-row { display: flex; gap: 12px; align-items: flex-start; }
.obs-rank { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--soft2, #f1f5f9);
  color: var(--muted); font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.obs-row:nth-child(-n+3) .obs-rank { background: #fef2f2; color: var(--danger); }
.obs-body { flex: 1; min-width: 0; }
.obs-text { font-size: 14px; color: var(--ink); line-height: 1.4; }
.obs-meta { display: flex; gap: 10px; align-items: center; margin: 4px 0 5px; flex-wrap: wrap; }
.obs-cfr { font-size: 11px; font-weight: 700; color: var(--accent-d, #1d4ed8); background: #eff6ff; padding: 1px 8px; border-radius: 10px; }
.obs-count { font-size: 12px; color: var(--muted); }
.obs-track { height: 6px; background: #f1f5f9; border-radius: 4px; overflow: hidden; }
.obs-fill { height: 100%; background: linear-gradient(90deg, #60a5fa, #2563eb); border-radius: 4px; }
.obs-fill.danger { background: linear-gradient(90deg, #f87171, #dc2626); }
.ins-sub { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  color: var(--muted); margin: 0 0 10px; }
.ins-chart { width: 100%; height: 440px; min-width: 0; }
.ins-chart.short { height: 240px; }
.mon-grid { margin-top: 8px; margin-bottom: 6px; min-width: 0; max-width: 100%; }
/* garante que a barra de rolagem horizontal interna da grid Syncfusion apareça */
.mon-grid .e-grid { max-width: 100%; }
.mon-grid .e-grid .e-content { overflow-x: auto; }
.mon-modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: flex; align-items: flex-start; justify-content: center; z-index: 1100; padding: 40px 20px; overflow-y: auto; }
.mon-modal-backdrop[hidden] { display: none; }
.mon-modal { width: 100%; max-width: 460px; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.mon-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; background: var(--accent); color: #fff; font-size: 15px; }
.mon-modal-body { padding: 18px; }

/* legado (Monitoramento) */
.monitor { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; }
.monitor.inactive { opacity: .6; }
.monitor-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.monitor-name { font-weight: 600; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.monitor-filters { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--muted); }
.monitor-stats { display: flex; gap: 14px; margin: 14px 0 4px; flex-wrap: wrap; }
.stat { border-radius: 10px; padding: 10px 16px; min-width: 120px; text-align: center; border: 1px solid var(--border); }
.stat .stat-n { display: block; font-size: 26px; font-weight: 700; line-height: 1; }
.stat .stat-l { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.stat.ok { background: #f0fdf4; border-color: #bbf7d0; } .stat.ok .stat-n { color: #16a34a; }
.stat.warn { background: #fffbeb; border-color: #fde68a; } .stat.warn .stat-n { color: #b45309; }
.stat.bad { background: #fef2f2; border-color: #fecaca; } .stat.bad .stat-n { color: var(--danger); }
.monitor-sub { margin-top: 12px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.mini-table { margin-top: 6px; }
.mini-row { display: grid; grid-template-columns: 90px 1fr auto; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; align-items: center; }
.mini-date { color: var(--muted); font-size: 12px; }
.mini-tag { font-size: 11px; background: #eef2ff; color: #3730a3; padding: 1px 8px; border-radius: 10px; white-space: nowrap; align-self: start; }
.mini-meta { font-size: 11px; color: var(--muted); margin-top: 1px; }
.mini-desc { font-size: 12px; color: #4b5563; margin-top: 3px; line-height: 1.4; }
@media (max-width: 820px) { .mini-row { grid-template-columns: 1fr; gap: 2px; } }

/* ---------------- Documentos legais ---------------- */
.legal-page { max-width: 860px; margin: 0 auto; padding: 0 20px 60px; }
.legal-top {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 12px; padding: 20px 0; border-bottom: 1px solid var(--border); margin-bottom: 28px;
}
.legal-brand { font-size: 22px; font-weight: 700; text-decoration: none; letter-spacing: .5px; }
.legal-brand .brand-mark { color: #111827; }
.legal-nav { display: flex; gap: 18px; flex-wrap: wrap; }
.legal-nav a { color: var(--accent); text-decoration: none; font-size: 14px; }
.legal-nav a:hover { text-decoration: underline; }

.legal-doc { color: #1f2937; line-height: 1.6; }
.legal-doc h1 { font-size: 28px; margin: 0 0 6px; }
.legal-doc h2 { font-size: 18px; margin: 26px 0 8px; color: #111827; }
.legal-doc p, .legal-doc li { font-size: 15px; }
.legal-doc ul { padding-left: 22px; }
.legal-doc a { color: var(--accent); }
.legal-doc code {
  background: #f1f5f9; padding: 1px 5px; border-radius: 4px; font-size: 13px;
}
.legal-meta { color: var(--muted); font-size: 14px; margin-top: 0; }
.legal-callout {
  background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 10px;
  padding: 14px 16px; margin: 18px 0 8px; font-size: 15px; color: #1e3a8a;
}
.legal-note {
  margin-top: 30px; padding-top: 16px; border-top: 1px dashed var(--border);
  color: var(--muted); font-size: 13px; font-style: italic;
}
.legal-footer {
  margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--border);
  color: var(--muted); font-size: 13px;
}
.auth-legal { margin-top: 16px; font-size: 12px; text-align: center; color: var(--muted); }
.auth-legal a { color: var(--accent); text-decoration: none; }

/* ---------------- Responsivo ---------------- */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: block; }
}

/* ---------------------------------------------------------------------------
   Módulo ANVISA: selo na marca, seletor de plataforma e cards do painel.
   O layout é o mesmo do FDA; muda só o acento (verde) da barra lateral.
   --------------------------------------------------------------------------- */
.brand-badge {
  display: inline-block; margin-left: 8px; padding: 2px 8px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  border-radius: 20px; color: #10b981; background: rgba(16,185,129,.14);
  vertical-align: middle;
}
.platform-anvisa .brand-sub { color: #10b981; }
.platform-anvisa .nav-link.active { background: #047857; }
.platform-anvisa .nav-link.active .dot { background: #fff; }

.platform-switch {
  flex: none; padding: 7px 13px; border-radius: 8px;
  border: 1px solid var(--border); background: #fff;
  font-size: 13px; font-weight: 600; color: var(--accent);
  text-decoration: none; white-space: nowrap; line-height: 1;
}
.platform-switch:hover { border-color: var(--accent); }
/* Na barra do módulo ANVISA o acento é verde. */
.platform-anvisa .platform-switch { color: #047857; }
.platform-anvisa .platform-switch:hover { border-color: #047857; }

/* Cards do painel ANVISA: quatro por linha, com o título completo visível. */
.anvisa-cards { grid-template-columns: repeat(4, 1fr); }
.anvisa-cards .kpi-l { line-height: 1.3; }
@media (max-width: 1100px) { .anvisa-cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .anvisa-cards { grid-template-columns: 1fr; } }

/* Botão que exibe o próprio valor da célula (contagem clicável nos Nomes
   Técnicos): parece número, comporta-se como link. */
.btn-action.btn-value {
  background: none; border: 0; padding: 2px 4px; font-weight: 600;
  color: var(--accent); cursor: pointer; font-variant-numeric: tabular-nums;
  text-decoration: underline; text-underline-offset: 2px;
  text-decoration-color: rgba(37,99,235,.35);
}
.btn-action.btn-value:hover { text-decoration-color: currentColor; }
.platform-anvisa .btn-action.btn-value { color: #047857; }
.platform-anvisa .btn-action.btn-value { text-decoration-color: rgba(4,120,87,.35); }

/* Carimbo de atualização acima da grid: data do arquivo na origem e da carga. */
.data-stamp {
  font-size: 12px; color: var(--muted); margin: 0 0 10px; padding: 0 2px;
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
}
.data-stamp strong { color: #374151; font-weight: 600; }

/* Telas de conta da ANVISA: mesmo cartão, fundo e acento verdes. */
.platform-anvisa .auth-wrap { background: linear-gradient(135deg, #064e3b, #047857); }
.platform-anvisa .auth-card input:focus { outline-color: #047857; border-color: #047857; }
.platform-anvisa .auth-card button[type=submit] { background: #047857; }
.platform-anvisa .auth-card button[type=submit]:hover { background: #065f46; }
.platform-anvisa .auth-links a { color: #047857; }
.auth-brand {
  display: flex; align-items: center; gap: 8px; margin-bottom: 20px;
  font-size: 19px; font-weight: 800; letter-spacing: -.02em;
}
.auth-brand a { color: var(--ink, #0f172a); text-decoration: none; }
.auth-brand a span { color: #047857; }
.auth-badge {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; padding: 2px 8px;
  border-radius: 20px; background: #ecfdf5; color: #047857;
}
.auth-plans {
  margin: 18px 0 4px; padding: 14px 16px; background: #f8fafc;
  border: 1px solid var(--border); border-radius: 10px; font-size: 13px; color: #334155;
}
.auth-plans strong { color: #0f172a; }
.auth-plans .preco { font-size: 15px; font-weight: 700; color: #047857; }

/* ---------------------------------------------------------------------------
   Assistente: conversa em coluna, com a caixa de pergunta fixa embaixo.
   --------------------------------------------------------------------------- */
.chat { display: flex; flex-direction: column; flex: 1; min-height: 0; gap: 12px; }
.chat-log {
  flex: 1; min-height: 0; overflow-y: auto; padding: 4px 2px;
  display: flex; flex-direction: column; gap: 14px;
}
.msg { display: flex; flex-direction: column; max-width: 860px; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg .bolha {
  padding: 12px 16px; border-radius: 14px; font-size: 14.5px; line-height: 1.6;
  background: var(--card-bg); border: 1px solid var(--border);
}
.msg.user .bolha { background: var(--accent); color: #fff; border-color: transparent; }
.platform-anvisa .msg.user .bolha { background: #047857; }
.msg.erro .bolha { background: #fef2f2; border-color: #fecaca; color: var(--danger); }
.msg .bolha p { margin: 0 0 8px; } .msg .bolha p:last-child { margin-bottom: 0; }
.msg .bolha table { margin: 8px 0; font-size: 13px; }
.msg .bolha code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.fontes { font-size: 11px; color: var(--muted); margin-top: 5px; padding-left: 4px; }
.fontes span {
  display: inline-block; background: #f1f5f9; border-radius: 10px;
  padding: 1px 8px; margin-right: 5px; font-family: ui-monospace, Menlo, monospace;
}
.chat-form { display: flex; gap: 10px; align-items: flex-end; }
.chat-form textarea {
  flex: 1; resize: none; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 10px; font: inherit; font-size: 14.5px; max-height: 140px;
}
.chat-form textarea:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.platform-anvisa .chat-form textarea:focus { outline-color: #047857; border-color: #047857; }
.chat-form button { width: auto; padding: 12px 22px; }
.chat-aviso { font-size: 11.5px; text-align: center; }
.chat-vazio { margin: auto; text-align: center; max-width: 620px; }
.chat-vazio h2 { font-size: 19px; margin: 0 0 8px; }
.sugestoes { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.sugestao {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 20px;
  padding: 8px 14px; font-size: 13px; cursor: pointer; color: var(--ink); text-align: left;
}
.sugestao:hover { border-color: var(--accent); }
.platform-anvisa .sugestao:hover { border-color: #047857; }
.pontos i {
  display: inline-block; width: 6px; height: 6px; margin-right: 3px; border-radius: 50%;
  background: var(--muted); animation: pulsa 1.2s infinite;
}
.pontos i:nth-child(2) { animation-delay: .2s; } .pontos i:nth-child(3) { animation-delay: .4s; }
@keyframes pulsa { 0%,60%,100% { opacity: .25; } 30% { opacity: 1; } }
