/* ============================================================
   Trinova Compliance — Tema CRM "Aurora"
   Sistema de design unico: tokens, superficies, profundidade
   delicada (hairlines + sombra suave), tipografia consistente.
   ============================================================ */

:root {
  /* Marca */
  --navy: #0A2A7A;
  --royal: #1557D9;
  --teal: #1E9C9A;
  --green: #22C16B;
  --mint: #7EEBC6;
  --ink-soft: #DCE6FF;
  --grad: linear-gradient(135deg, #0A2A7A 0%, #1557D9 42%, #1E9C9A 74%, #22C16B 100%);

  /* Superficies */
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --surface-3: #f1f5fb;
  --line: #e9eef6;
  --line-strong: #dde5f0;

  /* Texto */
  --ink: #16233f;
  --ink-2: #4a5a74;
  --muted: #8491a8;

  /* Sidebar */
  --side-1: #0a1c47;
  --side-2: #081634;
  --side-ink: #9fabc9;
  --side-ink-strong: #ffffff;

  /* Acento semantico */
  --accent: #1557D9;
  --accent-ink: #103fa0;
  --c-blue: #2f6be0;
  --c-green: #2bb878;
  --c-teal: #2aa6a3;
  --c-amber: #e7a53f;
  --c-orange: #ef9a52;
  --c-violet: #8b7be0;
  --c-red: #ef6b6b;
  --c-gray: #aab4c5;

  /* Forma */
  --r-lg: 18px;
  --r: 14px;
  --r-sm: 11px;
  --r-pill: 999px;

  /* Elevacao (sombra unica, suave, consistente) */
  --sh-xs: 0 1px 2px rgba(16, 35, 63, .05);
  --sh-sm: 0 1px 2px rgba(16, 35, 63, .04), 0 2px 6px rgba(16, 35, 63, .05);
  --sh: 0 1px 3px rgba(16, 35, 63, .04), 0 10px 24px rgba(16, 35, 63, .06);
  --sh-lg: 0 2px 6px rgba(16, 35, 63, .05), 0 24px 54px rgba(10, 42, 122, .10);
  --ring: 0 0 0 4px rgba(21, 87, 217, .13);

  /* Compat (nomes antigos usados em views) */
  --card: var(--surface);
  --sidebar: var(--side-1);
  --text: var(--ink);
  --border: var(--line);
  --blue: var(--c-blue);
  --violet: var(--c-violet);
  --amber: var(--c-amber);
  --orange: var(--c-orange);
  --gray: var(--c-gray);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(1100px 560px at 100% -8%, rgba(21, 87, 217, .05), transparent 58%),
    radial-gradient(820px 460px at -8% 110%, rgba(34, 193, 107, .05), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; font-weight: 600; transition: color .15s ease; }
a:hover { color: var(--accent-ink); }
h1, h2, h3 { color: var(--ink); }
::selection { background: rgba(21, 87, 217, .16); }

/* Scrollbar discreta */
* { scrollbar-width: thin; scrollbar-color: #cdd7e6 transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #d3dce8; border: 3px solid transparent; background-clip: content-box; border-radius: 999px; }

/* ---------- Botoes globais (Bootstrap override suave) ---------- */
.btn {
  border-radius: var(--r-sm);
  font-weight: 650;
  padding: 9px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease, color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: var(--r-sm); }
.btn-primary { background: var(--accent); border-color: var(--accent); box-shadow: 0 6px 16px rgba(21, 87, 217, .22); }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); box-shadow: 0 10px 22px rgba(21, 87, 217, .28); }
.btn-outline-primary { color: var(--accent); border-color: var(--line-strong); background: var(--surface); }
.btn-outline-primary:hover { color: var(--accent-ink); border-color: #b9ccef; background: #f3f7ff; }
.btn-secondary { background: var(--surface-3); border-color: var(--line-strong); color: var(--ink-2); }
.btn svg { width: 17px; height: 17px; }

/* ---------- Form controls globais ---------- */
.form-control, .form-select, textarea, input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="date"] {
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control:focus, .form-select:focus, textarea:focus, input:focus {
  border-color: var(--royal);
  box-shadow: var(--ring);
  outline: 0;
}
.form-label, label { font-weight: 650; color: var(--ink-2); font-size: 13px; }
.form-check-input:checked { background-color: var(--royal); border-color: var(--royal); }
.form-check-input:focus { box-shadow: var(--ring); border-color: var(--royal); }

/* =====================================================
   APP SHELL
   ===================================================== */
.app-shell { display: grid; grid-template-columns: 234px 1fr; min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 13px;
  color: var(--ink-2);
  background: rgba(255, 255, 255, .62);
  backdrop-filter: blur(14px) saturate(1.1);
  border-right: 1px solid var(--line);
}
.brand { position: relative; display: flex; align-items: center; gap: 11px; margin-bottom: 22px; padding: 2px 4px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--royal), var(--green));
  box-shadow: 0 6px 14px rgba(34, 193, 107, .26), inset 0 1px 0 rgba(255, 255, 255, .4);
}
.brand-text { display: grid; line-height: 1.05; font-size: 15.5px; font-weight: 750; color: var(--navy); }
.brand-text small { margin-top: 3px; font-size: 9.5px; font-weight: 700; letter-spacing: 1.2px; color: var(--teal); text-transform: uppercase; }
.brand.dark { color: var(--ink); }

.sidebar nav { position: relative; display: grid; gap: 2px; }
.sidebar nav::before {
  content: "Menu";
  padding: 0 11px 7px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
  opacity: .7;
}
.sidebar a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ink-2);
  padding: 9px 11px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  transition: background .16s ease, color .16s ease;
}
.sidebar a svg { opacity: .7; }
.sidebar a:hover { background: rgba(21, 87, 217, .06); color: var(--royal); }
.sidebar a:hover svg { opacity: 1; }
.sidebar a.active { background: rgba(21, 87, 217, .09); color: var(--accent-ink); }
.sidebar a.active svg { color: var(--royal); opacity: 1; }
.sidebar a.active::before {
  content: "";
  position: absolute;
  left: -13px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: 0 3px 3px 0;
  background: var(--grad);
}

.sidebar-foot {
  position: relative;
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
}
.sidebar-foot svg { width: 16px; height: 16px; color: var(--green); flex: none; }

.sidebar svg, .icon-btn svg { width: 17px; height: 17px; }

.main { padding: 24px 26px; min-width: 0; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.topbar h1 { margin: 0; font-size: 21px; font-weight: 780; letter-spacing: -.4px; }
.eyebrow { margin: 0 0 3px; color: var(--accent); font-size: 10.5px; font-weight: 750; text-transform: uppercase; letter-spacing: .6px; }

.userbox {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 8px 10px 8px 14px;
  box-shadow: var(--sh-sm);
}
.userbox > div { display: grid; line-height: 1.25; }
.userbox strong { font-size: 13.5px; font-weight: 700; }
.userbox span { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.icon-btn {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.icon-btn:hover { background: #fdecec; color: var(--c-red); border-color: #f6d4d4; }

/* =====================================================
   CARDS & PAINEIS
   ===================================================== */
.panel, .auth-card, .public-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh);
}
.panel { padding: 18px; margin-bottom: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h2, .panel h2 { margin: 0; font-size: 14.5px; font-weight: 750; letter-spacing: -.2px; }
.panel h3 { margin-top: 20px; font-size: 14px; font-weight: 700; }
.panel-head span, .muted { color: var(--muted); font-size: 12.5px; font-weight: 500; }

/* Titulo de secao com tick de marca (profundidade sem peso) */
.panel-head h2 { position: relative; padding-left: 14px; }
.panel-head h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 15px;
  border-radius: 999px;
  background: var(--grad);
}

/* =====================================================
   METRICAS
   ===================================================== */
.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(126px, 1fr)); gap: 12px; margin-bottom: 16px; }
.metric-grid.compact { grid-template-columns: repeat(5, minmax(146px, 1fr)); }
.metric-card {
  position: relative;
  padding: 15px 15px 14px;
  min-height: 96px;
  display: grid;
  align-content: space-between;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}
.metric-card::before {
  content: "";
  position: absolute;
  left: 0; top: 13px; bottom: 13px;
  width: 3px;
  border-radius: 999px;
  background: currentColor;
  opacity: .9;
}
.metric-card span { color: var(--muted); font-size: 12px; font-weight: 600; }
.metric-card strong { font-size: 23px; line-height: 1; font-weight: 800; letter-spacing: -.8px; color: var(--ink); }
.metric-icon { color: var(--c-blue); display: inline-flex; width: 32px; height: 32px; border-radius: 10px; align-items: center; justify-content: center; background: color-mix(in srgb, currentColor 12%, white); }
.metric-icon svg { width: 17px; height: 17px; }

.metric-link { color: var(--c-blue); text-decoration: none; transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
.metric-link:hover { transform: translateY(-3px); border-color: #cfdcf2; box-shadow: var(--sh); }
.metric-link:focus-visible { outline: 0; box-shadow: var(--ring); }

.metric-card.nova, .nova .metric-icon { color: var(--c-blue); }
.metric-card.analise, .analise .metric-icon { color: var(--c-amber); }
.metric-card.investigacao, .investigacao .metric-icon { color: var(--c-orange); }
.metric-card.concluida, .concluida .metric-icon { color: var(--c-green); }
.metric-card.arquivada, .arquivada .metric-icon { color: var(--c-gray); }
.metric-card.resposta, .resposta .metric-icon { color: var(--c-teal); }

/* =====================================================
   DASHBOARD — paineis de grafico delicados
   ===================================================== */
.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 16px; }
.dashboard-grid .wide { grid-column: span 1; }
.dashboard-grid .panel { margin-bottom: 0; transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease; }
.dashboard-grid .panel:hover { transform: translateY(-2px); box-shadow: var(--sh-lg); border-color: var(--line-strong); }

.chart-box { position: relative; height: 240px; padding-top: 4px; }
.panel.wide .chart-box { height: 268px; }
.chart-box canvas { max-height: none !important; width: 100% !important; height: 100% !important; }

/* =====================================================
   TABELAS & STATUS
   ===================================================== */
.table { --bs-table-bg: transparent; font-size: 13.5px; margin: 0; }
.table > :not(caption) > * > * { padding: 13px 12px; }
.table thead th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--line);
}
.table tbody tr { border-bottom: 1px solid var(--line); transition: background .12s ease; }
.table tbody tr:hover { background: var(--surface-2); }
.table td { border: 0; color: var(--ink-2); vertical-align: middle; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 700;
  background: #eef4ff;
  color: var(--c-blue);
  white-space: nowrap;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.status.triagem { background: #f3f0ff; color: var(--c-violet); }
.status.em-analise { background: #fdf6e8; color: #c9881f; }
.status.em-investigacao { background: #fdf0e6; color: #d1762f; }
.status.concluida { background: #e9f9f0; color: #1a9b5c; }
.status.arquivada { background: #eef2f7; color: #64748b; }

.filters { display: grid; grid-template-columns: 2fr repeat(7, minmax(112px, 1fr)) auto; gap: 10px; align-items: center; }

/* Prazos */
.deadline-alert { border-radius: var(--r); }
.deadline-pill { display: inline-flex; align-items: center; gap: 6px; border-radius: var(--r-pill); padding: 6px 11px; font-size: 11.5px; font-weight: 750; white-space: nowrap; }
.deadline-pill svg { width: 14px; height: 14px; }
.deadline-pill.ok { color: #1a9b5c; background: #e9f9f0; }
.deadline-pill.risk { color: #b7791f; background: #fdf6e8; animation: pulse-warning 1.6s infinite; }
.deadline-pill.late, .metric-card.atrasada { color: #d64545; background: #fdecec; animation: pulse-danger 1.4s infinite; }
.deadline-pill.closed { color: #64748b; background: #eef2f7; }
.metric-card.atrasada { color: var(--c-red); }
@keyframes pulse-danger { 0%, 100% { box-shadow: 0 0 0 0 rgba(239, 107, 107, .4); } 50% { box-shadow: 0 0 0 7px rgba(239, 107, 107, 0); } }
@keyframes pulse-warning { 0%, 100% { box-shadow: 0 0 0 0 rgba(231, 165, 63, .4); } 50% { box-shadow: 0 0 0 7px rgba(231, 165, 63, 0); } }

/* =====================================================
   DETALHE DA DENUNCIA / CHAT / AUDITORIA
   ===================================================== */
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; }
.case-title { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.case-title h2 { font-size: 22px; font-weight: 780; letter-spacing: -.4px; }
.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 20px 0; }
.info-grid dt { color: var(--muted); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.info-grid dd { margin: 4px 0 0; font-weight: 650; color: var(--ink); }
.description { color: var(--ink-2); line-height: 1.7; }
.attachment-list { display: flex; gap: 10px; flex-wrap: wrap; }
.attachment-list a { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 12px; display: inline-flex; align-items: center; gap: 8px; background: var(--surface-2); color: var(--ink-2); font-weight: 600; transition: border-color .15s ease, background .15s ease; }
.attachment-list a:hover { border-color: #c7d6ef; background: #f3f7ff; color: var(--accent-ink); }
.stack { display: grid; gap: 14px; }
label.block, .stack label { display: grid; gap: 6px; color: var(--ink-2); font-size: 13px; font-weight: 650; }

.chat { display: grid; gap: 12px; margin-bottom: 14px; }
.message { border: 1px solid var(--line); border-radius: var(--r); padding: 13px 14px; background: var(--surface-2); }
.message strong { font-size: 13px; }
.message span { color: var(--muted); font-size: 11.5px; margin-left: 8px; }
.message p { margin: 8px 0 0; color: var(--ink-2); line-height: 1.6; }
.message-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }

.audit-note { border-left: 3px solid var(--c-amber); background: #fdf7e9; padding: 13px 14px; border-radius: var(--r-sm); color: #7a5a12; }
.audit-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.audit-summary div, .audit-timeline article { border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--r-sm); padding: 13px; }
.audit-summary p, .audit-timeline p { margin: 6px 0 0; color: var(--ink-2); white-space: pre-wrap; line-height: 1.55; }
.audit-timeline { display: grid; gap: 10px; margin-top: 10px; position: relative; }
.audit-timeline span { display: block; color: var(--muted); font-size: 11.5px; margin-top: 3px; }

/* =====================================================
   RELATORIOS / CONFIGURACOES
   ===================================================== */
.report-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.report-list li { display: flex; justify-content: space-between; padding: 13px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); }
.section-intro { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; }
.section-intro h2 { margin: 0 0 4px; }
.section-intro p { margin: 0; color: var(--muted); }
.intro-icon, .settings-hero .intro-icon { width: 48px; height: 48px; border-radius: var(--r); display: grid; place-items: center; background: #eef4ff; color: var(--accent); }
.intro-icon svg { width: 22px; height: 22px; }
.intro-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.settings-hero { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; }
.settings-hero h2 { margin: 0 0 6px; font-size: 22px; font-weight: 780; letter-spacing: -.4px; }
.settings-hero p { margin: 0; color: var(--muted); }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: 18px; }
.setting-card { margin-bottom: 0; }
.copy-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 14px; margin-bottom: 12px; background: var(--surface-2); }
.copy-row strong { display: block; margin-bottom: 6px; }
.copy-row code { display: block; color: var(--accent-ink); background: #eef4ff; border-radius: var(--r-sm); padding: 8px 10px; overflow-wrap: anywhere; font-size: 13px; }
.settings-list { display: grid; gap: 12px; margin: 0; }
.settings-list div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.settings-list div:last-child { border-bottom: 0; padding-bottom: 0; }
.settings-list dt { color: var(--muted); font-size: 11.5px; font-weight: 750; text-transform: uppercase; letter-spacing: .4px; }
.settings-list dd { margin: 0; font-weight: 700; text-align: right; }
.settings-tips { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.settings-tips li { display: grid; grid-template-columns: auto 1fr; gap: 10px; color: var(--ink-2); }
.settings-tips svg { width: 18px; height: 18px; color: var(--accent); margin-top: 2px; }

.empty-state { text-align: center; padding: 64px 20px; color: var(--muted); }
.empty-state svg { width: 40px; height: 40px; color: var(--c-gray); }

/* Alertas (flash) */
.alert { border-radius: var(--r-sm); border: 1px solid transparent; font-size: 13.5px; font-weight: 550; }
.alert-success { background: #e9f9f0; color: #166c45; border-color: #c7edd6; }
.alert-danger { background: #fdecec; color: #a33636; border-color: #f4d2d2; }
.alert-warning { background: #fdf6e8; color: #8a6413; border-color: #f0e2c0; }
.alert-info { background: #eef4ff; color: var(--accent-ink); border-color: #d4e2fb; }

/* =====================================================
   PAGINAS PUBLICAS (portal de denuncia)
   ===================================================== */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(440px, 100%); padding: 32px; }
.auth-card h1 { margin: 20px 0 8px; font-size: 26px; }
.auth-card p { color: var(--muted); }

.public-page { background:
  radial-gradient(900px 480px at 100% -10%, rgba(21, 87, 217, .06), transparent 60%),
  var(--bg); }
.public-wrap { width: min(1080px, calc(100% - 32px)); margin: 0 auto; padding: 32px 0; }
.compact-public { width: min(680px, calc(100% - 32px)); min-height: 100vh; display: grid; place-items: center; }
.public-hero {
  position: relative;
  min-height: 230px;
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 22px;
  align-items: center;
  color: #fff;
  background: var(--grad);
  padding: 36px;
  border-radius: var(--r-lg);
  margin-bottom: 18px;
  overflow: hidden;
  box-shadow: var(--sh-lg);
}
.public-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(40% 70% at 85% 10%, rgba(126, 235, 198, .25), transparent 70%),
    linear-gradient(90deg, rgba(255,255,255,.07) 1px, transparent 1px) 0 0 / 46px 46px;
  opacity: .5;
  pointer-events: none;
}
.public-hero.has-banner { background: linear-gradient(90deg, rgba(4, 14, 38, .82) 0%, rgba(4, 14, 38, .6) 55%, rgba(4, 14, 38, .3) 100%), var(--banner) center / cover no-repeat; }
.public-hero.has-banner::after { display: none; }
.public-hero.has-banner h1 { color: #fff; text-shadow: 0 2px 12px rgba(0, 0, 0, .35); }
.public-hero h1 { position: relative; font-size: clamp(28px, 5.4vw, 48px); margin: 0 0 10px; font-weight: 800; letter-spacing: -.8px; }
.public-hero p { position: relative; max-width: 680px; margin-bottom: 0; color: var(--ink-soft); font-size: 16px; }
.public-logo { position: relative; width: 88px; height: 88px; border-radius: var(--r); background: rgba(255, 255, 255, .14); display: grid; place-items: center; font-weight: 800; font-size: 24px; border: 1px solid rgba(255, 255, 255, .24); }
.public-logo.has-img { background: #fff; padding: 10px; overflow: hidden; }
.public-logo img { width: 100%; height: 100%; object-fit: contain; }
.settings-logo { width: 56px; height: 56px; object-fit: contain; border-radius: var(--r); background: #fff; border: 1px solid var(--line); padding: 6px; }
.empresa-nome { display: inline-flex; align-items: center; gap: 8px; }
.empresa-logo-mini { width: 28px; height: 28px; object-fit: contain; border-radius: 6px; background: #fff; border: 1px solid var(--line); padding: 2px; flex: none; }
.logo-field { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; }
.logo-preview { width: 96px; height: 96px; object-fit: contain; border-radius: 12px; background: #fff; border: 1px solid var(--line); padding: 8px; }
.logo-field .checkline { display: flex; align-items: center; gap: 8px; }
.logo-card-body { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center; }
.logo-card .logo-preview { width: 120px; height: 120px; }
.logo-card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.logo-card-actions form { margin: 0; }
.logo-card-actions .btn { display: inline-flex; align-items: center; gap: 8px; }
.logo-card-actions .btn svg { width: 18px; height: 18px; }
.logo-pick { position: relative; cursor: pointer; margin: 0; }
.logo-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.logo-pick.enviando { opacity: .7; pointer-events: none; }
.logo-pick.enviando span::after { content: '...'; }
.logo-hint { flex-basis: 100%; margin: 0; font-size: 13px; }
.banner-row { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.banner-preview { width: 240px; height: 80px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: var(--grad); }
.banner-preview.vazio { display: grid; place-items: center; padding: 8px 12px; color: #fff; font-size: 12px; font-weight: 650; text-align: center; line-height: 1.3; }
@media (max-width: 640px) { .logo-card-body { grid-template-columns: 1fr; justify-items: start; } }
.logo-preview.vazio { display: grid; place-items: center; font-weight: 800; font-size: 26px; color: var(--muted); }
.public-card { padding: 28px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.checkline { display: flex; align-items: center; gap: 10px; }
.protocol-link { display: inline-block; margin-top: 16px; }
.success { text-align: center; display: grid; gap: 14px; justify-items: center; }
.success svg { width: 54px; height: 54px; color: var(--c-green); }
.success code { display: block; font-size: 20px; padding: 12px 16px; background: var(--surface-3); border-radius: var(--r-sm); color: var(--ink); letter-spacing: .5px; }
.protocol-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin: 16px 0; }
.protocol-result { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin: 18px 0; }
.public-chat { margin-top: 14px; }

/* Portal publico — barra de topo + selos + split (cara de landing) */
.public-top { position: sticky; top: 0; z-index: 30; background: rgba(246, 248, 252, .82); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.public-top-in { width: min(1080px, calc(100% - 32px)); margin: 0 auto; height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.public-top .logo { display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 17px; color: var(--navy); }
.public-top .logo .mk { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 900; background: linear-gradient(135deg, var(--royal), var(--green)); box-shadow: 0 6px 14px rgba(34, 193, 107, .26); }
.public-top .logo small { display: block; font-size: 9.5px; font-weight: 700; letter-spacing: 1.2px; color: var(--teal); text-transform: uppercase; margin-top: 1px; }
.public-top-actions { display: flex; align-items: center; gap: 16px; font-size: 13.5px; font-weight: 600; }
.public-top-actions > a:not(.btn) { color: var(--ink-2); }
.public-top-actions > a:not(.btn):hover { color: var(--royal); }

.hero-pills { position: relative; display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.hero-pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .22); color: #fff; font-size: 12px; font-weight: 650; backdrop-filter: blur(8px); }
.hero-pill svg { width: 14px; height: 14px; color: var(--mint); }

.public-split { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .9fr); gap: 18px; align-items: start; }
.aside-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; box-shadow: var(--sh-sm); margin-bottom: 16px; }
.aside-card h3 { margin: 0 0 14px; font-size: 15px; font-weight: 800; letter-spacing: -.2px; }
.aside-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.aside-list li { display: grid; grid-template-columns: auto 1fr; gap: 12px; }
.aside-list .ck { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: #e9f9f0; color: #199a5b; flex: none; }
.aside-list .ck svg { width: 17px; height: 17px; }
.aside-list b { font-size: 13.5px; }
.aside-list p { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; display: grid; gap: 13px; }
.steps li { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; counter-increment: s; }
.steps li::before { content: counter(s); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; background: var(--grad); }
.steps b { font-size: 13.5px; }
.steps p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.5; }

.public-foot { width: min(1080px, calc(100% - 32px)); margin: 28px auto 32px; display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; }
.public-foot strong { color: var(--navy); }

@media (max-width: 860px) {
  .public-split { grid-template-columns: 1fr; }
  .public-top-actions > a:not(.btn) { display: none; }
}

canvas { max-height: 320px; }

/* =====================================================
   RESPONSIVO
   ===================================================== */
@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 82px 1fr; }
  .sidebar { padding: 20px 10px; }
  .sidebar nav::before { content: "•••"; text-align: center; letter-spacing: 2px; }
  .brand { justify-content: center; }
  .brand-text, .sidebar a span, .sidebar-foot span { display: none; }
  .sidebar a { justify-content: center; }
  .sidebar a.active::before { left: -10px; }
  .sidebar-foot { justify-content: center; }
  .metric-grid, .metric-grid.compact { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid, .detail-layout { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr 1fr; }
  .settings-grid, .settings-hero { grid-template-columns: 1fr; }
  .settings-hero .intro-actions { justify-content: flex-start; }
}

@media (max-width: 680px) {
  .main { padding: 18px 16px; }
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; gap: 8px; padding: 12px; }
  .sidebar::before, .sidebar nav::before, .sidebar-foot { display: none; }
  .sidebar nav { display: flex; }
  .brand { margin-bottom: 0; }
  .sidebar a.active::before { display: none; }
  .topbar, .case-title, .message-form { display: grid; }
  .metric-grid, .metric-grid.compact, .filters, .info-grid, .form-row, .protocol-form, .section-intro, .audit-summary, .copy-row { grid-template-columns: 1fr; }
  .intro-actions { justify-content: flex-start; }
  .public-hero { grid-template-columns: 1fr; padding: 24px; }
  .public-card { padding: 20px; }
  .chart-box, .panel.wide .chart-box { height: 220px; }
}

@media print {
  .sidebar, .topbar form, .intro-actions, form, .btn { display: none !important; }
  .app-shell { display: block; }
  .main { padding: 0; }
  .panel { box-shadow: none; break-inside: avoid; border-color: #d9e0ea; }
  body { background: #fff; }
}

/* =====================================================
   LOGIN (tela dupla)
   ===================================================== */
.trinova-login {
  min-height: 100vh;
  background: var(--bg);
  font-family: Inter, system-ui, sans-serif;
  color: var(--ink);
}
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 7fr) minmax(466px, 3fr); }

.login-brand-panel {
  position: relative;
  overflow: hidden;
  display: grid;
  align-items: center;
  min-height: 100vh;
  padding: clamp(32px, 5vw, 72px);
  color: #fff;
  background:
    radial-gradient(circle at 16% 16%, rgba(255, 255, 255, .14), transparent 24%),
    radial-gradient(circle at 82% 84%, rgba(34, 193, 107, .3), transparent 32%),
    var(--grad);
}
.aurora {
  position: absolute;
  inset: -40% -10% auto -10%;
  height: 80%;
  background:
    radial-gradient(60% 60% at 20% 30%, rgba(126, 235, 198, .24), transparent 70%),
    radial-gradient(50% 50% at 75% 20%, rgba(21, 87, 217, .26), transparent 70%);
  filter: blur(46px);
  animation: aurora-drift 16s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes aurora-drift {
  0% { transform: translate3d(-3%, -2%, 0) scale(1); opacity: .8; }
  100% { transform: translate3d(5%, 3%, 0) scale(1.08); opacity: 1; }
}
.tech-grid {
  position: absolute;
  inset: 0;
  opacity: .14;
  background-image:
    linear-gradient(rgba(255, 255, 255, .22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .22) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(90deg, #000 0%, transparent 82%);
}
.orb { position: absolute; width: 340px; aspect-ratio: 1; border-radius: 50%; filter: blur(48px); opacity: .4; }
.orb-blue { top: 6%; right: 10%; background: #5b9bff; animation: orb-float 10s ease-in-out infinite; }
.orb-green { bottom: -8%; left: 16%; background: var(--green); opacity: .5; animation: orb-float 12s ease-in-out infinite reverse; }
.orb-teal { top: 44%; left: 44%; width: 240px; background: var(--mint); opacity: .26; animation: orb-float 14s ease-in-out infinite; }
@keyframes orb-float { 0%, 100% { transform: translateY(0) translateX(0); } 50% { transform: translateY(-22px) translateX(10px); } }
.brand-watermark { position: absolute; right: -6%; top: 8%; width: min(46vw, 680px); opacity: .12; mix-blend-mode: screen; pointer-events: none; }
.particle-field span { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: rgba(255, 255, 255, .7); box-shadow: 0 0 16px rgba(255, 255, 255, .8); animation: float-particle 6s ease-in-out infinite; }
.particle-field span:nth-child(1) { top: 16%; left: 18%; }
.particle-field span:nth-child(2) { top: 28%; left: 72%; animation-delay: .7s; }
.particle-field span:nth-child(3) { top: 72%; left: 12%; animation-delay: 1.1s; }
.particle-field span:nth-child(4) { top: 62%; left: 84%; animation-delay: 1.5s; }
.particle-field span:nth-child(5) { top: 46%; left: 34%; animation-delay: 2s; }
.particle-field span:nth-child(6) { top: 82%; left: 58%; animation-delay: 2.4s; }
.particle-field span:nth-child(7) { top: 12%; left: 52%; animation-delay: 2.8s; }
.particle-field span:nth-child(8) { top: 54%; left: 66%; animation-delay: 3.2s; }
@keyframes float-particle { 0%, 100% { transform: translateY(0); opacity: .4; } 50% { transform: translateY(-14px); opacity: 1; } }

.brand-content { position: relative; z-index: 2; max-width: 840px; }
.trinova-logo { display: inline-flex; align-items: center; gap: 12px; }
.trinova-logo.image-logo { padding: 8px 12px; border-radius: 16px; background: rgba(255, 255, 255, .94); box-shadow: 0 18px 42px rgba(10, 42, 122, .18); }
.trinova-logo.image-logo img { display: block; width: min(230px, 32vw); height: auto; }
.trinova-logo.compact.image-logo { padding: 8px 10px; border: 1px solid var(--line); background: #fff; box-shadow: var(--sh-sm); }
.trinova-logo.compact.image-logo img { width: 184px; }

.hero-copy { margin-top: clamp(40px, 7vw, 84px); }
.login-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .18);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
}
.hero-copy h1 { max-width: 720px; margin: 0; font-size: clamp(40px, 5.2vw, 64px); line-height: 1.02; font-weight: 800; letter-spacing: -1.5px; }
.hero-copy > p { margin: 22px 0 0; max-width: 540px; color: var(--ink-soft); font-size: 18px; line-height: 1.55; }

.trust-grid { margin-top: 42px; display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 14px; }
.trust-grid article {
  min-height: 118px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 18px;
  background: rgba(255, 255, 255, .09);
  backdrop-filter: blur(18px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16);
  transition: transform .25s ease, border-color .25s ease, background .25s ease;
}
.trust-grid article:hover { transform: translateY(-4px); border-color: rgba(126, 235, 198, .5); background: rgba(255, 255, 255, .13); }
.trust-ic { display: inline-grid; place-items: center; width: 40px; height: 40px; margin-bottom: 12px; border-radius: 12px; background: rgba(126, 235, 198, .15); border: 1px solid rgba(126, 235, 198, .3); }
.trust-grid svg { width: 20px; height: 20px; color: var(--mint); }
.trust-grid strong { display: block; margin-bottom: 4px; font-size: 14.5px; color: #fff; }
.trust-grid .trust-desc { color: var(--ink-soft); font-size: 12.5px; line-height: 1.45; }

.login-form-panel {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 44px;
  background:
    radial-gradient(circle at 82% 10%, rgba(21, 87, 217, .08), transparent 26%),
    linear-gradient(135deg, #fbfcfe, #eef4ff);
}
.login-card {
  width: min(452px, 100%);
  padding: 44px;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 22px;
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--sh-lg);
  backdrop-filter: blur(16px);
  animation: card-rise .6s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes card-rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.login-heading { margin: 30px 0 22px; }
.login-heading h2 { margin: 0 0 8px; font-size: 27px; font-weight: 800; letter-spacing: -.6px; color: var(--navy); }
.login-heading p { margin: 0; color: var(--muted); line-height: 1.55; }

.login-form { display: grid; gap: 15px; }
.login-form label { display: grid; gap: 7px; color: var(--navy); font-size: 12.5px; font-weight: 750; }
.input-shell {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: #fff;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.input-shell:focus-within { border-color: var(--royal); box-shadow: var(--ring); transform: translateY(-1px); }
.input-shell > svg { width: 18px; height: 18px; color: var(--royal); }
.input-shell input { width: 100%; border: 0; outline: 0; color: var(--navy); font: inherit; background: transparent; }
.input-shell input::placeholder { color: #9aa7bd; }
.toggle-pass { border: 0; background: transparent; padding: 4px; display: grid; place-items: center; color: #9aa7bd; cursor: pointer; transition: color .15s ease; }
.toggle-pass:hover { color: var(--royal); }

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  border: 1px solid #dadce0;
  border-radius: var(--r);
  background: #fff;
  color: #3c4043;
  font-weight: 650;
  font-size: 15px;
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}
.google-btn:hover { color: #3c4043; border-color: #c7cbd1; box-shadow: 0 8px 20px rgba(10, 42, 122, .12); transform: translateY(-1px); }
.google-btn:active { transform: translateY(0); }
.google-ic { display: grid; place-items: center; }

.login-divider { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; margin: 18px 0 6px; }
.login-divider::before, .login-divider::after { content: ""; height: 1px; background: var(--line); }
.login-divider span { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }

.login-options { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 2px; font-size: 13px; }
.remember-line { display: flex !important; align-items: center; gap: 8px; margin: 0; color: var(--ink-2) !important; font-weight: 650 !important; }
.login-options a { color: var(--royal); font-weight: 750; }

.login-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  margin-top: 8px;
  border: 0;
  border-radius: var(--r);
  color: #fff;
  background: linear-gradient(90deg, var(--royal), var(--green));
  background-size: 170% 100%;
  font-weight: 750;
  font-size: 15px;
  box-shadow: 0 14px 30px rgba(21, 87, 217, .24);
  transition: background-position .4s ease, transform .18s ease, box-shadow .18s ease;
}
.login-submit svg { width: 18px; height: 18px; transition: transform .18s ease; }
.login-submit:hover { background-position: 100% 0; transform: translateY(-1px); box-shadow: 0 18px 38px rgba(21, 87, 217, .3); }
.login-submit:hover svg { transform: translateX(3px); }

.secure-note { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin-top: 26px; }
.secure-note > span { height: 1px; background: var(--line); }
.secure-note p { display: inline-flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.secure-note svg { width: 15px; height: 15px; color: var(--green); }

.login-footer { position: absolute; left: 44px; right: 44px; bottom: 22px; display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 11.5px; }
.login-footer strong { color: var(--navy); }

@media (max-width: 1100px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand-panel { min-height: auto; padding: 36px; }
  .trust-grid { grid-template-columns: repeat(2, 1fr); }
  .login-form-panel { min-height: auto; padding: 36px 22px 86px; }
}
@media (max-width: 680px) {
  .login-brand-panel { padding: 26px 18px; }
  .hero-copy { margin-top: 32px; }
  .hero-copy h1 { font-size: 36px; }
  .hero-copy > p { font-size: 16px; }
  .trust-grid { grid-template-columns: 1fr; }
  .login-card { padding: 30px 24px; }
  .trinova-logo.image-logo img { width: min(230px, 68vw); }
  .trinova-logo.compact.image-logo img { width: min(176px, 60vw); }
  .login-options, .login-footer { display: grid; justify-content: stretch; }
  .login-footer { left: 22px; right: 22px; text-align: center; }
}
