:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --sidebar: #0f172a;
  --sidebar-hover: #1e293b;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --blue: #3b82f6;
  --violet: #8b5cf6;
  --amber: #f59e0b;
  --orange: #fb923c;
  --green: #22c55e;
  --gray: #94a3b8;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, system-ui, sans-serif; background: var(--bg); color: var(--text); }
a { color: #2563eb; text-decoration: none; font-weight: 600; }
.app-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--sidebar); padding: 24px 16px; color: white; }
.brand { font-size: 20px; font-weight: 800; letter-spacing: 0; margin-bottom: 28px; }
.brand span { color: #93c5fd; }
.brand.dark { color: var(--text); }
.sidebar nav { display: grid; gap: 6px; }
.sidebar a { display: flex; align-items: center; gap: 12px; color: #cbd5e1; padding: 11px 12px; border-radius: 8px; font-size: 14px; font-weight: 600; }
.sidebar a:hover, .sidebar a.active { background: var(--sidebar-hover); color: #fff; }
.sidebar svg, .icon-btn svg, .btn svg { width: 18px; height: 18px; }
.main { padding: 26px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.topbar h1 { margin: 0; font-size: 28px; font-weight: 750; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.userbox { display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.userbox div { display: grid; line-height: 1.2; }
.userbox span { color: var(--muted); font-size: 12px; }
.icon-btn { border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; }
.panel, .metric-card, .auth-card, .public-card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 12px 32px rgba(15, 23, 42, .06); }
.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric-grid.compact { grid-template-columns: repeat(5, minmax(150px, 1fr)); }
.metric-card { padding: 18px; min-height: 126px; display: grid; align-content: space-between; }
.metric-card span { color: var(--muted); font-size: 13px; font-weight: 650; }
.metric-card strong { font-size: 30px; line-height: 1; }
.metric-icon { color: var(--blue); }
.metric-link { color: inherit; text-decoration: none; transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
.metric-link:hover { color: inherit; transform: translateY(-2px); border-color: #bfdbfe; box-shadow: 0 16px 36px rgba(37, 99, 235, .12); }
.metric-link:focus-visible { outline: 3px solid rgba(59, 130, 246, .35); outline-offset: 3px; }
.nova .metric-icon, .metric-card.nova { color: var(--blue); }
.analise .metric-icon, .metric-card.analise { color: var(--amber); }
.investigacao .metric-icon, .metric-card.investigacao { color: var(--orange); }
.concluida .metric-icon, .metric-card.concluida { color: var(--green); }
.arquivada .metric-icon, .metric-card.arquivada { color: var(--gray); }
.resposta .metric-icon, .metric-card.resposta { color: #14b8a6; }
.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; margin-bottom: 18px; }
.dashboard-grid .wide { grid-column: span 1; }
.panel { padding: 20px; margin-bottom: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel h2, .panel-head h2 { margin: 0; font-size: 18px; font-weight: 750; }
.panel h3 { margin-top: 22px; font-size: 15px; font-weight: 750; }
.panel-head span, .muted { color: var(--muted); font-size: 13px; }
.table { --bs-table-bg: transparent; font-size: 14px; }
.table th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.status { display: inline-flex; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 750; background: #eff6ff; color: var(--blue); white-space: nowrap; }
.status.triagem { background: #f5f3ff; color: var(--violet); }
.status.em-analise { background: #fffbeb; color: var(--amber); }
.status.em-investigacao { background: #fff7ed; color: var(--orange); }
.status.concluida { background: #f0fdf4; color: var(--green); }
.status.arquivada { background: #f1f5f9; color: #64748b; }
.filters { display: grid; grid-template-columns: 2fr repeat(7, minmax(112px, 1fr)) auto; gap: 10px; align-items: center; }
.btn { border-radius: 8px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-primary { background: var(--blue); border-color: var(--blue); }
.deadline-alert { border-radius: 8px; }
.deadline-pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 6px 10px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.deadline-pill svg { width: 15px; height: 15px; }
.deadline-pill.ok { color: #166534; background: #dcfce7; }
.deadline-pill.risk { color: #92400e; background: #fef3c7; animation: pulse-warning 1.2s infinite; }
.deadline-pill.late, .metric-card.atrasada { color: #b91c1c; background: #fee2e2; animation: pulse-danger 1s infinite; }
.deadline-pill.closed { color: #475569; background: #e2e8f0; }
@keyframes pulse-danger {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .45); }
  50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}
@keyframes pulse-warning {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, .45); }
  50% { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
}
.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: 24px; }
.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 20px 0; }
.info-grid dt { color: var(--muted); font-size: 12px; font-weight: 700; }
.info-grid dd { margin: 0; font-weight: 650; }
.description { color: #334155; line-height: 1.65; }
.attachment-list { display: flex; gap: 10px; flex-wrap: wrap; }
.attachment-list a { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; display: inline-flex; align-items: center; gap: 8px; }
.stack { display: grid; gap: 14px; }
label { display: grid; gap: 6px; color: #334155; font-size: 13px; font-weight: 700; }
.chat { display: grid; gap: 12px; margin-bottom: 14px; }
.message { border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: #fbfdff; }
.message span { color: var(--muted); font-size: 12px; margin-left: 8px; }
.message p { margin: 8px 0 0; color: #334155; }
.message-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.audit-note { border-left: 4px solid var(--amber); background: #fffbeb; padding: 12px; border-radius: 8px; color: #78350f; }
.audit-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.audit-summary div, .audit-timeline article { border: 1px solid var(--border); background: #fbfdff; border-radius: 8px; padding: 12px; }
.audit-summary p, .audit-timeline p { margin: 6px 0 0; color: #334155; white-space: pre-wrap; }
.audit-timeline { display: grid; gap: 10px; margin-top: 10px; }
.audit-timeline span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.report-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.report-list li { display: flex; justify-content: space-between; padding: 12px; background: #f8fafc; border-radius: 8px; }
.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 { width: 48px; height: 48px; border-radius: 8px; display: grid; place-items: center; background: #eff6ff; color: var(--blue); }
.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: 24px; }
.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(--border); border-radius: 8px; padding: 14px; margin-bottom: 12px; background: #fbfdff; }
.copy-row strong { display: block; margin-bottom: 6px; }
.copy-row code { display: block; color: #1d4ed8; background: #eff6ff; border-radius: 8px; padding: 8px 10px; overflow-wrap: anywhere; }
.settings-list { display: grid; gap: 12px; margin: 0; }
.settings-list div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.settings-list div:last-child { border-bottom: 0; padding-bottom: 0; }
.settings-list dt { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.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: #334155; }
.settings-tips svg { width: 18px; height: 18px; color: var(--blue); margin-top: 2px; }
.empty-state { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty-state svg { width: 42px; height: 42px; color: var(--blue); }
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(180deg, #f8fafc 0%, #eef6ff 100%); }
.auth-card { width: min(440px, 100%); padding: 30px; }
.auth-card h1 { margin: 20px 0 8px; font-size: 28px; }
.auth-card p { color: var(--muted); }
.public-page { background: #eef2f7; }
.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 { min-height: 230px; display: grid; grid-template-columns: 88px 1fr; gap: 22px; align-items: center; color: #fff; background: linear-gradient(135deg, #0f172a, #1e40af 72%, #14b8a6); padding: 34px; border-radius: 8px; margin-bottom: 18px; }
.public-hero h1 { font-size: clamp(30px, 6vw, 54px); margin: 0 0 10px; font-weight: 800; }
.public-hero p { max-width: 680px; margin-bottom: 0; color: #dbeafe; }
.public-logo { width: 88px; height: 88px; border-radius: 8px; background: rgba(255,255,255,.12); display: grid; place-items: center; font-weight: 800; font-size: 24px; border: 1px solid rgba(255,255,255,.22); }
.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: 56px; height: 56px; color: var(--green); }
.success code { display: block; font-size: 20px; padding: 12px 16px; background: #f1f5f9; border-radius: 8px; color: var(--text); }
.protocol-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin: 16px 0; }
.protocol-result { background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin: 18px 0; }
.public-chat { margin-top: 14px; }
canvas { max-height: 320px; }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 88px 1fr; }
  .sidebar { padding: 20px 12px; }
  .brand { font-size: 16px; }
  .brand span, .sidebar span { display: none; }
  .sidebar a { 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) {
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; display: flex; overflow-x: auto; gap: 8px; }
  .sidebar nav { display: flex; }
  .main { padding: 18px; }
  .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; }
}

@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; }
}

.trinova-login {
  min-height: 100vh;
  background: #f4f8fb;
  font-family: Inter, system-ui, sans-serif;
  color: #05204a;
}
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(460px, 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 18% 18%, rgba(255,255,255,.2), transparent 24%),
    radial-gradient(circle at 76% 76%, rgba(35,193,107,.34), transparent 28%),
    radial-gradient(circle at 58% 42%, rgba(13,91,215,.38), transparent 22%),
    linear-gradient(135deg, #05204a 0%, #0d5bd7 60%, #23c16b 100%);
}
.tech-grid {
  position: absolute;
  inset: 0;
  opacity: .18;
  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: 52px 52px;
  mask-image: linear-gradient(90deg, #000 0%, transparent 82%);
}
.orb {
  position: absolute;
  width: 360px;
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(44px);
  opacity: .45;
}
.orb-blue { top: 7%; right: 10%; background: #60a5fa; }
.orb-green { bottom: -8%; left: 18%; background: #23c16b; opacity: .58; }
.brand-watermark {
  position: absolute;
  right: -6%;
  top: 8%;
  width: min(48vw, 720px);
  opacity: .16;
  mix-blend-mode: screen;
  filter: blur(.2px);
  pointer-events: none;
}
.particle-field span {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255,255,255,.75);
  box-shadow: 0 0 18px rgba(255,255,255,.8);
  animation: float-particle 5s 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; }
@keyframes float-particle {
  0%, 100% { transform: translateY(0); opacity: .45; }
  50% { transform: translateY(-16px); opacity: 1; }
}
.brand-content {
  position: relative;
  z-index: 2;
  max-width: 820px;
}
.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(5,32,74,.16);
}
.trinova-logo.image-logo img {
  display: block;
  width: min(245px, 34vw);
  height: auto;
}
.trinova-logo.compact.image-logo {
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  background: #fff;
  box-shadow: 0 16px 32px rgba(5,32,74,.08);
}
.trinova-logo.compact.image-logo img {
  width: 190px;
}
.trinova-logo > span {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 900;
  letter-spacing: 0;
  color: #05204a;
  background: #fff;
  box-shadow: 0 20px 48px rgba(5,32,74,.18);
}
.trinova-logo strong { display: block; line-height: 1; font-weight: 850; letter-spacing: 0; }
.trinova-logo small { display: block; margin-top: 4px; color: rgba(255,255,255,.76); font-weight: 700; }
.trinova-logo.compact > span {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, #05204a, #0d5bd7);
  box-shadow: 0 16px 32px rgba(13,91,215,.22);
}
.trinova-logo.compact small { color: #64748b; }
.hero-copy { margin-top: clamp(48px, 8vw, 96px); }
.login-eyebrow {
  margin: 0 0 14px;
  color: rgba(255,255,255,.78);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
.hero-copy h1 {
  max-width: 680px;
  margin: 0;
  font-size: clamp(52px, 6.4vw, 86px);
  line-height: .95;
  font-weight: 800;
  letter-spacing: 0;
}
.hero-copy > p {
  margin: 22px 0 0;
  max-width: 520px;
  color: rgba(255,255,255,.82);
  font-size: 20px;
  line-height: 1.5;
}
.trust-grid {
  margin-top: 44px;
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
}
.trust-grid article {
  min-height: 118px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 20px;
  background: rgba(255,255,255,.08);
  backdrop-filter: blur(20px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}
.trust-grid svg { width: 22px; height: 22px; color: #a7f3d0; margin-bottom: 12px; }
.trust-grid strong { display: block; margin-bottom: 4px; font-size: 15px; }
.trust-grid span { color: rgba(255,255,255,.75); font-size: 13px; 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% 12%, rgba(13,91,215,.13), transparent 24%),
    linear-gradient(135deg, #f8fafc, #edf4ff);
}
.login-card {
  width: min(480px, 100%);
  padding: 48px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 24px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 30px 80px rgba(5,32,74,.12);
  backdrop-filter: blur(18px);
}
.login-heading { margin: 34px 0 24px; }
.login-heading h2 { margin: 0 0 8px; font-size: 30px; font-weight: 850; color: #05204a; }
.login-heading p { margin: 0; color: #64748b; line-height: 1.55; }
.login-form { display: grid; gap: 16px; }
.login-form label { color: #05204a; font-size: 13px; font-weight: 800; }
.input-shell {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid #d8e3ef;
  border-radius: 14px;
  background: #fff;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.input-shell:focus-within {
  border-color: #0d5bd7;
  box-shadow: 0 0 0 4px rgba(13,91,215,.12);
  transform: translateY(-1px);
}
.input-shell svg { width: 19px; height: 19px; color: #0d5bd7; }
.input-shell input {
  width: 100%;
  border: 0;
  outline: 0;
  color: #05204a;
  font: inherit;
  background: transparent;
}
.input-shell input::placeholder { color: #94a3b8; }
.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
  font-size: 13px;
}
.remember-line {
  display: flex !important;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: #475569 !important;
  font-weight: 700 !important;
}
.login-options a { color: #0d5bd7; font-weight: 800; }
.login-submit {
  min-height: 54px;
  margin-top: 8px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(90deg, #0d5bd7, #23c16b);
  font-weight: 850;
  box-shadow: 0 18px 34px rgba(13,91,215,.26), 0 0 28px rgba(35,193,107,.18);
  transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
}
.login-submit:hover {
  background: linear-gradient(90deg, #0848ad, #1fa85e);
  transform: translateY(-1px);
  box-shadow: 0 22px 42px rgba(13,91,215,.32), 0 0 34px rgba(35,193,107,.22);
}
.secure-note {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
}
.secure-note > span { height: 1px; background: #dbe7f1; }
.secure-note p {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.secure-note svg { width: 16px; height: 16px; color: #23c16b; }
.login-footer {
  position: absolute;
  left: 40px;
  right: 40px;
  bottom: 24px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: #64748b;
  font-size: 12px;
}
.login-footer strong { color: #05204a; }

@media (max-width: 1100px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand-panel {
    min-height: auto;
    padding: 34px;
  }
  .trust-grid { grid-template-columns: repeat(2, 1fr); }
  .login-form-panel { min-height: auto; padding: 34px 22px 86px; }
}

@media (max-width: 680px) {
  .login-brand-panel { padding: 26px 18px; }
  .hero-copy { margin-top: 36px; }
  .hero-copy h1 { font-size: 42px; }
  .hero-copy > p { font-size: 17px; }
  .trust-grid { grid-template-columns: 1fr; }
  .login-card { padding: 30px 24px; }
  .trinova-logo.image-logo img { width: min(240px, 70vw); }
  .trinova-logo.compact.image-logo img { width: min(180px, 62vw); }
  .login-options, .login-footer { display: grid; justify-content: stretch; }
  .login-footer { left: 22px; right: 22px; text-align: center; }
}
