:root {
  color-scheme: dark;

  /* DARK command-center palette (remapped legacy tokens + new tokens) */
  --bg: #0B1220;            /* page background (deep navy-black) */
  --bg-elev: #0F1A2E;       /* elevated surfaces / inputs */
  --rail: #0A1322;          /* side rail, darker */
  --card: #131C2E;          /* cards/panels */
  --card-hover: #18233A;
  --line: #233148;          /* borders/dividers (visible on dark) */
  --ink: #E6EDF7;           /* primary text */
  --muted: #94A3B8;         /* secondary text (>=3:1 on dark) */
  --primary: #3B82F6;       /* security blue (buttons, active) */
  --primary-strong: #2563EB;
  --info: #38BDF8;          /* cyan accent / focus */
  --green: #22C55E;         /* verificado / baixo risco */
  --amber: #F59E0B;         /* medio */
  --red: #EF4444;           /* alto / fail / fraude */
  --shadow: 0 18px 50px rgba(2, 8, 20, 0.55);
  --glow-blue: 0 0 0 1px rgba(59, 130, 246, .25), 0 0 24px rgba(59, 130, 246, .18);

  /* Legacy tokens remapped to dark theme so the cascade re-themes everything */
  --surface: #131C2E;       /* was #fff -> --card */
  --wash: #0B1220;          /* was #f5f7fb -> --bg */
  --teal: #3B82F6;          /* was teal -> --primary (security blue) */
  --blue: #38BDF8;          /* was blue -> --info (cyan focus) */

  /* Fonts (offline / system only) */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;

  font-family: var(--font-sans);
}

* {
  box-sizing: border-box;
}

/* Respeita o atributo HTML hidden mesmo quando o elemento tem display definido. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font-sans);
  background-image:
    radial-gradient(900px 600px at 0% -5%, rgba(59, 130, 246, 0.12), transparent 60%),
    radial-gradient(700px 500px at 100% 0%, rgba(56, 189, 248, 0.07), transparent 55%);
  background-attachment: fixed;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 0 15px;
  color: #fff;
  background: var(--primary);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, opacity 120ms ease;
}

button:hover {
  background: var(--primary-strong);
  box-shadow: none;
  filter: none;
}

button:active {
  opacity: 0.9;
  transform: none;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 9px;
  padding: 0 15px;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}

button:disabled {
  cursor: not-allowed;
  color: #5b6b85;
  background: #1a2436;
  box-shadow: none;
  filter: none;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--bg-elev);
  outline: 0;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

input::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

select option {
  color: var(--ink);
  background: var(--bg-elev);
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
  background: var(--bg-elev);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

:focus-visible {
  outline: 2px solid var(--info);
  outline-offset: 2px;
}

a {
  color: var(--info);
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(800px 500px at 12% 12%, rgba(59, 130, 246, 0.18), transparent 55%),
    radial-gradient(700px 520px at 88% 80%, rgba(56, 189, 248, 0.10), transparent 55%),
    var(--bg);
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.72fr);
  width: min(1120px, 100%);
  min-height: 640px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--card);
  box-shadow: var(--shadow);
}

.auth-hero {
  display: grid;
  align-content: end;
  gap: 18px;
  padding: 44px;
  color: #fff;
  position: relative;
  background:
    linear-gradient(160deg, rgba(11, 18, 32, 0.92), rgba(15, 26, 46, 0.86)),
    radial-gradient(circle at 22% 18%, rgba(59, 130, 246, 0.35), transparent 42%),
    radial-gradient(circle at 85% 90%, rgba(56, 189, 248, 0.18), transparent 45%),
    var(--rail);
}

.auth-logo-container {
  display: flex;
  justify-content: center;
  margin-bottom: auto;
  padding-bottom: 24px;
}

.auth-logo {
  width: 180px;
  height: 180px;
  object-fit: contain;
}

.login-version {
  margin-top: 18px;
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  opacity: 0.6;
}

.auth-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(59, 130, 246, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.07) 1px, transparent 1px);
  background-size: 38px 38px;
  -webkit-mask-image: radial-gradient(circle at 30% 30%, #000, transparent 75%);
  mask-image: radial-gradient(circle at 30% 30%, #000, transparent 75%);
  opacity: 0.6;
}

.auth-hero > * {
  position: relative;
  z-index: 1;
}

.auth-hero h1 {
  max-width: 640px;
  margin-bottom: 0;
  font-size: clamp(2.1rem, 6vw, 4.5rem);
  line-height: 0.95;
  letter-spacing: 0;
  color: #f4f8ff;
}

.auth-hero p {
  max-width: 620px;
  margin-bottom: 0;
  color: rgba(230, 237, 247, 0.82);
  font-size: 1.04rem;
  line-height: 1.55;
}

.auth-kicker {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-hero .auth-kicker {
  color: var(--info);
}

.auth-signal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 10px;
  max-width: 520px;
}

.auth-signal-grid span {
  border: 1px solid rgba(59, 130, 246, 0.28);
  border-radius: 10px;
  padding: 12px;
  color: rgba(230, 237, 247, 0.92);
  background: rgba(59, 130, 246, 0.10);
  font-size: 0.88rem;
  font-weight: 800;
  transition: border-color 150ms ease, background 150ms ease;
}

.auth-signal-grid span:hover {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(59, 130, 246, 0.16);
}

.auth-panel {
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 42px;
  background: var(--card);
}

.auth-panel h2 {
  margin-bottom: 4px;
  font-size: 1.8rem;
  color: var(--ink);
}

.auth-status,
.login-message {
  min-height: 22px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.login-form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: transparent;
  font-weight: 600;
}

.secondary-button:hover {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.10);
  filter: none;
  box-shadow: none;
}

#logoutButton {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

#logoutButton:hover {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.10);
}

.auditor-page {
  min-height: 100vh;
  background: var(--bg);
}

.auditor-shell {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  min-height: 100vh;
}

.audit-rail {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 28px;
  padding: 18px 12px;
  color: var(--ink);
  background: var(--rail);
  border-right: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(59, 130, 246, 0.30);
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(59, 130, 246, 0.22), rgba(56, 189, 248, 0.08));
  color: var(--ink);
  font-size: 0.72rem;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.brand-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.rail-version {
  margin-top: auto;
  font-size: 0.58rem;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
  letter-spacing: 0.3px;
  opacity: 0.6;
}

.brand-mark strong {
  font-size: 0.66rem;
  color: var(--info);
}

.rail-nav {
  display: grid;
  gap: 10px;
}

.rail-button {
  display: grid;
  place-items: center;
  width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  font-weight: 800;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease, box-shadow 180ms ease;
}

.rail-button:hover {
  color: var(--ink);
  background: var(--card-hover);
  border-color: var(--primary);
  filter: none;
  box-shadow: none;
}

.rail-button.active {
  color: #fff;
  background: linear-gradient(180deg, var(--primary), var(--primary-strong));
  border-color: transparent;
  box-shadow: var(--glow-blue);
}

.rail-button svg {
  width: 20px;
  height: 20px;
}

.audit-main {
  min-width: 0;
  padding: 18px;
}

.audit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.audit-header h1 {
  margin-bottom: 0;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  color: var(--ink);
}

.user-menu-wrapper {
  position: relative;
  display: inline-block;
}

.user-avatar-trigger {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, var(--primary), var(--info));
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.user-avatar-trigger:hover {
  transform: scale(1.05);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 200px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(2, 8, 20, 0.5);
  z-index: 100;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: slideDown 150ms ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.user-dropdown-header {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-dropdown-header span {
  color: var(--ink);
  font-weight: 700;
  font-size: 0.9rem;
  word-break: break-all;
}

.user-dropdown-header .user-email-muted {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 400;
}

.logout-dropdown-btn {
  width: 100%;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--red);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 150ms ease, border-color 150ms ease;
}

.logout-dropdown-btn svg.btn-icon {
  width: 14px;
  height: 14px;
  stroke: currentColor;
}

.logout-dropdown-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.4);
}

.command-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.kpi-tile,
.case-queue,
.case-detail,
.decision-cell,
.metric-card,
.report-panel,
.ticket,
.signal-card,
.ai-summary,
.action-columns section {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 10px 30px rgba(2, 8, 20, 0.35);
}

.kpi-tile {
  padding: 14px;
  position: relative;
  overflow: hidden;
  transition: transform 150ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.kpi-tile::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--primary), var(--info));
  opacity: 0.65;
}

.kpi-tile:hover {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: var(--glow-blue), 0 10px 30px rgba(2, 8, 20, 0.4);
}

.kpi-tile span,
.decision-cell span,
.metric-card span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.kpi-tile strong {
  font-size: 1.8rem;
  color: var(--ink);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.audit-workspace {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.case-queue,
.case-detail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: calc(100dvh - 170px);
}

.case-queue {
  overflow: hidden;
}

.case-detail {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.case-detail::-webkit-scrollbar {
  width: 8px;
}

.case-detail::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

.case-detail::-webkit-scrollbar-thumb:hover {
  background: #2f425e;
}

.queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 14px;
}

.queue-header h2 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--ink);
}

.queue-header select {
  width: 130px;
  min-height: 36px;
}

.case-list {
  display: grid;
  gap: 8px;
  padding: 12px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.case-list::-webkit-scrollbar {
  width: 10px;
}
.case-list::-webkit-scrollbar-thumb {
  background: var(--line);
  border: 2px solid var(--card);
  border-radius: 999px;
}
.case-list::-webkit-scrollbar-thumb:hover {
  background: #2f425e;
}

.case-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 68px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px 10px 20px;
  color: var(--ink);
  background: var(--bg-elev);
  text-align: left;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: background 150ms ease, border-color 150ms ease, transform 120ms ease;
}

.case-row:hover {
  background: var(--card-hover);
  border-color: rgba(59, 130, 246, 0.35);
}

.case-row.active {
  border-color: rgba(59, 130, 246, 0.6);
  background: var(--card-hover);
  box-shadow: var(--glow-blue);
}

.case-row.active::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--primary), var(--info));
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.6);
  z-index: 2;
}

.case-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  border-radius: 12px 0 0 12px;
  transition: background 150ms ease;
}

.case-bar.green {
  background: var(--green);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.4);
}

.case-bar.yellow,
.case-bar.pending {
  background: var(--amber);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.case-bar.red {
  background: var(--red);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.case-row small {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-row em {
  color: var(--ink);
  font-style: normal;
  font-weight: 900;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.case-light {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.case-light.green {
  background: var(--green);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.7);
}

.case-light.yellow {
  background: var(--amber);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.7);
}

.case-light.pending {
  background: var(--amber);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.7);
}

.case-light.red {
  background: var(--red);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.7);
}

.queue-empty {
  margin: 10px;
  color: var(--muted);
}

.case-detail {
  padding: 14px;
}

.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 620px;
  text-align: center;
}

.empty-state h2 {
  color: var(--ink);
}

.empty-state p,
.muted {
  color: var(--muted);
}

.case-hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-radius: 14px;
  padding: 18px;
  color: #fff;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    radial-gradient(600px 220px at 0% 0%, rgba(59, 130, 246, 0.30), transparent 60%),
    linear-gradient(135deg, #0E1A30, #11203A);
}

.case-hero h2 {
  margin-bottom: 6px;
  font-size: clamp(1.4rem, 3vw, 2.1rem);
  color: #f4f8ff;
}

.case-hero .muted {
  margin-bottom: 0;
  color: rgba(230, 237, 247, 0.72);
}

.traffic-light {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: none;
  white-space: nowrap;
}

.traffic-light > span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: block;
  background: var(--muted);
}

.traffic-light strong { font-weight: 600; }

.traffic-light.green { border-color: rgba(34, 197, 94, 0.35); }
.traffic-light.green > span { background: var(--green); box-shadow: 0 0 8px rgba(34, 197, 94, 0.6); }

.traffic-light.yellow { border-color: rgba(245, 158, 11, 0.35); }
.traffic-light.yellow > span { background: var(--amber); box-shadow: 0 0 8px rgba(245, 158, 11, 0.6); }

.traffic-light.pending { border-color: rgba(245, 158, 11, 0.35); }
.traffic-light.pending > span { background: var(--amber); box-shadow: 0 0 8px rgba(245, 158, 11, 0.6); }

.traffic-light.white { border-color: rgba(255, 255, 255, 0.2); }
.traffic-light.white > span { background: #ffffff; box-shadow: 0 0 8px rgba(255, 255, 255, 0.6); }

.traffic-light.red { border-color: rgba(239, 68, 68, 0.35); }
.traffic-light.red > span { background: var(--red); box-shadow: 0 0 8px rgba(239, 68, 68, 0.6); }

.case-hero-badges {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

#aiConfidence.green,
strong.green {
  color: var(--green) !important;
  text-shadow: 0 0 10px rgba(34, 197, 94, 0.2);
}
#aiConfidence.yellow,
strong.yellow {
  color: var(--amber) !important;
  text-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}
#aiConfidence.red,
strong.red {
  color: var(--red) !important;
  text-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}
#aiConfidence.white,
strong.white {
  color: #ffffff !important;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.decision-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.decision-cell,
.metric-card {
  padding: 14px;
}

.decision-cell strong,
.metric-card strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.tab-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.tab-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: var(--bg-elev);
  cursor: pointer;
  position: relative;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}

.tab-button:hover {
  color: var(--ink);
  background: var(--card-hover);
  filter: none;
  box-shadow: none;
}

.tab-button.active {
  color: #fff;
  background: rgba(59, 130, 246, 0.16);
  border-color: rgba(59, 130, 246, 0.5);
}

.tab-button.active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -11px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--info));
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.6);
}

.tab-content {
  min-height: 300px;
}

/* ----- Trilha de validação (pipeline) ----- */
.pipeline {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px 18px;
  margin-bottom: 12px;
}

.pipeline-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.pipeline-head h3 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink);
}

.pipeline-hint {
  font-size: 0.72rem;
  color: var(--muted);
}

.pipeline-track {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
}

.pipeline-step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 6px;
  --step: var(--green);
}

.pipeline-step.status-warn { --step: var(--amber); }
.pipeline-step.status-fail { --step: var(--red); }
.pipeline-step.status-pending { --step: var(--info); }

/* conector entre os nós; herda a cor da etapa para mostrar propagação de risco */
.pipeline-step::before {
  content: "";
  position: absolute;
  top: 21px;
  left: calc(-50% + 22px);
  width: calc(100% - 44px);
  height: 2px;
  background: var(--line);
  z-index: 0;
}

.pipeline-step:first-child::before { display: none; }
.pipeline-step.status-warn::before { background: linear-gradient(90deg, var(--line), var(--amber)); }
.pipeline-step.status-fail::before { background: linear-gradient(90deg, var(--line), var(--red)); }
.pipeline-step.status-pending::before { background: linear-gradient(90deg, var(--line), var(--info)); }

.pipeline-node {
  position: relative;
  z-index: 1;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--step);
  background: var(--bg-elev);
  color: var(--step);
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.pipeline-node:hover { transform: translateY(-2px); }
.pipeline-node:focus-visible { outline: 2px solid var(--info); outline-offset: 3px; }

.pipeline-icon { width: 20px; height: 20px; display: block; }
.pipeline-icon svg { width: 100%; height: 100%; display: block; }

.pipeline-badge {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--step);
  color: var(--bg);
  display: grid;
  place-items: center;
  border: 2px solid var(--bg-elev);
}

.pipeline-badge svg { width: 11px; height: 11px; display: block; }

.pipeline-index {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
}

.pipeline-label {
  margin-top: 2px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
}

.pipeline-detail {
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--step);
  line-height: 1.25;
}

.pipeline-step.is-active .pipeline-node {
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--step) 30%, transparent);
  background: color-mix(in srgb, var(--step) 16%, var(--bg-elev));
}

/* destaque dos signal-cards ao clicar numa etapa */
.insight-grid.is-filtered .signal-card.dimmed { opacity: 0.3; }
.signal-card.highlight { box-shadow: 0 0 0 2px var(--info); }

@media (max-width: 720px) {
  .pipeline-track { grid-template-columns: 1fr; gap: 16px; }
  .pipeline-step {
    display: grid;
    grid-template-columns: 44px 1fr;
    align-items: center;
    column-gap: 12px;
    text-align: left;
    padding: 0;
  }
  .pipeline-node { grid-row: 1 / span 2; grid-column: 1; }
  .pipeline-index { display: none; }
  .pipeline-label { grid-column: 2; grid-row: 1; margin: 0; }
  .pipeline-detail { grid-column: 2; grid-row: 2; margin: 2px 0 0; }
  .pipeline-step::before {
    top: -16px;
    left: 21px;
    width: 2px;
    height: 16px;
  }
  .pipeline-step:first-child::before { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .pipeline-node { transition: none; }
  .pipeline-node:hover { transform: none; }
}

.ai-summary {
  padding: 16px;
  margin-bottom: 10px;
}

.ai-summary p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px;
}

.signal-card {
  border-left: 5px solid var(--muted);
  padding: 12px;
  transition: border-color 150ms ease, background 150ms ease, transform 120ms ease, opacity 150ms ease, box-shadow 150ms ease;
}

.signal-card:hover {
  transform: translateY(-1px);
}

.signal-card.pass {
  border-left-color: var(--green);
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.10), transparent 60%), var(--card);
}

.signal-card.warn,
.signal-card.info {
  border-left-color: var(--amber);
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.10), transparent 60%), var(--card);
}

.signal-card.info {
  border-left-color: var(--info);
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.10), transparent 60%), var(--card);
}

.signal-card.fail {
  border-left-color: var(--red);
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.12), transparent 60%), var(--card);
}

.signal-card strong,
.signal-card span {
  display: block;
}

.signal-card strong {
  color: var(--ink);
}

.signal-card span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

.evidence-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
}

.action-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(190px, 1fr));
  gap: 10px;
}

.action-columns section,
.report-panel {
  padding: 14px;
}

ul {
  margin: 0;
  padding-left: 18px;
}

li {
  margin-bottom: 8px;
  color: var(--muted);
  line-height: 1.4;
}

.report-panel button {
  margin-top: 8px;
}

.ticket-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
}

.ticket {
  padding: 14px;
}

.ticket span {
  color: var(--info);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ticket strong {
  display: block;
  margin: 8px 0 5px;
  color: var(--ink);
}

.ticket p {
  margin-bottom: 0;
  color: var(--muted);
}

.eyebrow {
  color: var(--info);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (min-width: 761px) {
  .auditor-shell {
    height: 100vh;
    overflow: hidden;
  }
  .audit-rail {
    height: 100vh;
    box-sizing: border-box;
  }
  .audit-main {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
  }
  .view {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
  }
  .view::-webkit-scrollbar {
    width: 8px;
  }
  .view::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: 4px;
  }
  .view::-webkit-scrollbar-thumb:hover {
    background: #2f425e;
  }
}

@media (max-width: 1120px) {
  .auth-shell,
  .audit-workspace {
    grid-template-columns: 1fr;
  }

  .case-queue,
  .case-detail {
    min-height: 0;
    max-height: none;
  }

  .command-band,
  .insight-grid,
  .evidence-grid,
  .action-columns,
  .ticket-list {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

@media (max-width: 760px) {
  .auth-page,
  .audit-main {
    padding: 10px;
  }

  .auth-shell,
  .auditor-shell {
    grid-template-columns: 1fr;
  }

  .audit-rail {
    align-items: center;
    flex-direction: row;
    justify-content: space-between;
    min-height: 70px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .rail-nav {
    grid-auto-flow: column;
  }

  .auth-hero,
  .auth-panel {
    padding: 24px;
  }

  .auth-signal-grid,
  .command-band,
  .decision-grid,
  .insight-grid,
  .evidence-grid,
  .action-columns,
  .ticket-list {
    grid-template-columns: 1fr;
  }

  .audit-header,
  .case-hero {
    align-items: flex-start;
    flex-direction: column;
  }
}

.forensics-panel { display: grid; gap: 16px; }
.forensic-block {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.tab-section-head {
  margin-bottom: 14px;
}
.tab-section-head h3 {
  margin: 0 0 4px;
  color: var(--ink);
}
.tab-section-head .muted {
  margin: 0;
  font-size: 0.9rem;
}

/* Pipeline de revisão humana */
.review-panel { display: grid; gap: 14px; }
.review-reason {
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(245, 158, 11, 0.06);
}
.review-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.review-reason p { margin: 0; color: var(--ink); }

.review-details {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-elev);
  padding: 4px 14px;
}
.review-details > summary {
  cursor: pointer;
  padding: 10px 0;
  color: var(--info);
  font-weight: 600;
  list-style: none;
}
.review-details > summary::-webkit-details-marker { display: none; }
.review-details > summary::before { content: "▸ "; color: var(--muted); }
.review-details[open] > summary::before { content: "▾ "; }
.review-details-body { padding: 4px 0 12px; }
.review-details-body h4 {
  margin: 14px 0 6px;
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.review-details-body ul { margin: 0; padding-left: 18px; }
.review-details-body li { margin-bottom: 4px; }

.review-actions-block {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: var(--card);
}
.review-note-label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.review-note-label textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--bg-elev);
  font: inherit;
  resize: vertical;
}
.review-note-label textarea:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}
.review-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.review-decision {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  border-radius: 12px;
  padding: 14px;
  background: rgba(34, 197, 94, 0.07);
}
.review-decision.review-reprovada { border-left-color: var(--red); background: rgba(239, 68, 68, 0.07); }
.review-decision.review-nova_captura { border-left-color: var(--amber); background: rgba(245, 158, 11, 0.07); }
.review-decision strong { color: var(--ink); font-size: 1.05rem; }
.review-decision span { color: var(--muted); font-size: 0.86rem; }
.review-decision .review-note { margin: 4px 0 0; color: var(--ink); font-style: italic; }
.review-decision small { color: var(--muted); font-size: 0.76rem; }

.forensic-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.forensic-controls select {
  flex: 1 1 220px;
  min-width: 0;
  max-width: 360px;
  min-height: 40px;
}
.forensic-controls button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 14px;
  font-size: 0.85rem;
  white-space: nowrap;
}
.forensic-result { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.forensic-heatmap { display: grid; gap: 8px; }
.forensic-canvas {
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #000;
  box-shadow: 0 8px 28px rgba(2, 8, 20, 0.55);
}
.forensic-score {
  margin: 0 0 8px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.forensic-score strong {
  color: var(--info);
}
.forensic-findings { display: grid; gap: 8px; }
.finding {
  display: grid;
  gap: 2px;
  padding: 10px;
  border-radius: 10px;
  border-left: 4px solid var(--muted);
  background: var(--card);
  color: var(--ink);
}
.finding.fail {
  border-left-color: var(--red);
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.12), transparent 60%), var(--card);
}
.finding.warn {
  border-left-color: var(--amber);
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.10), transparent 60%), var(--card);
}
.finding.pass {
  border-left-color: var(--green);
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.10), transparent 60%), var(--card);
}
.finding.info {
  border-left-color: var(--info);
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.10), transparent 60%), var(--card);
}
.info-callout {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--info);
  border-radius: 12px;
  background: rgba(56, 189, 248, 0.06);
  margin-bottom: 16px;
}
.info-callout svg { width: 20px; height: 20px; color: var(--info); flex: 0 0 auto; margin-top: 2px; }
.info-callout strong { display: block; margin-bottom: 4px; color: var(--ink); }
.info-callout p { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }
.forensic-legend { margin: 4px 0 10px; color: var(--muted); font-size: 0.82rem; }
.forensic-block input[type="file"] { color: var(--muted); font-size: 0.9rem; max-width: 100%; }
.forensic-block input[type="file"]::file-selector-button {
  margin-right: 12px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--bg-elev);
  font-weight: 600;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}
.forensic-block input[type="file"]::file-selector-button:hover {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.10);
}
@media (max-width: 720px) { .forensic-result { grid-template-columns: 1fr; } }
.linked-cases { margin-top: 16px; display: grid; gap: 8px; }
.linked-cases h3 { margin: 0 0 4px; color: var(--red); letter-spacing: 0.02em; }
.linked-row {
  display: grid;
  gap: 2px;
  padding: 10px;
  border-radius: 12px;
  color: var(--ink);
  background: rgba(239, 68, 68, 0.10);
  border: 1px solid rgba(239, 68, 68, 0.42);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.12), 0 0 22px rgba(239, 68, 68, 0.18);
}
.linked-cases.empty .muted { margin: 8px 0 0; }

/* ── View switcher ─────────────────────────────────────────── */
.view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.view-head h2 {
  margin-bottom: 0;
  font-size: clamp(1.4rem, 3vw, 2rem);
  color: var(--ink);
}

.view-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── Reports view ───────────────────────────────────────────── */
.report-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.report-summary .kpi-tile strong {
  font-size: 1.6rem;
}

.report-section {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 10px 30px rgba(2, 8, 20, 0.35);
  padding: 16px;
  margin-bottom: 14px;
}

.report-section h3 {
  margin-bottom: 12px;
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.report-table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100dvh - 360px);
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.report-table-wrap::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.report-table-wrap::-webkit-scrollbar-thumb {
  background: var(--line);
  border: 2px solid var(--card);
  border-radius: 999px;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
}

.report-table th,
.report-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.report-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  background: var(--card);
}

.report-table td {
  color: var(--ink);
  font-size: 0.88rem;
}

.report-table td.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.report-table tbody tr:last-child td {
  border-bottom: none;
}

.report-table tbody tr:hover td {
  background: var(--card-hover);
}

.risk-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  background: var(--muted);
  vertical-align: middle;
}

.risk-dot.green { background: var(--green); box-shadow: 0 0 6px rgba(34, 197, 94, 0.5); }
.risk-dot.yellow { background: var(--amber); box-shadow: 0 0 6px rgba(245, 158, 11, 0.5); }
.risk-dot.pending { background: var(--amber); box-shadow: 0 0 6px rgba(245, 158, 11, 0.5); }
.risk-dot.red { background: var(--red); box-shadow: 0 0 6px rgba(239, 68, 68, 0.5); }

.decision-tally {
  display: grid;
  gap: 6px;
}

.decision-tally-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  font-size: 0.88rem;
}

.decision-tally-row span { color: var(--muted); }
.decision-tally-row strong {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* ── Support view ───────────────────────────────────────────── */
.support-grid {
  display: grid;
  gap: 14px;
}

.support-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 10px 30px rgba(2, 8, 20, 0.35);
  padding: 18px;
}

.support-card h3 {
  margin-bottom: 14px;
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.support-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  color: var(--ink);
}

.support-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}

.support-status-dot.online {
  background: var(--green);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

.support-status-dot.offline {
  background: var(--red);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.support-mode-badge {
  margin-left: auto;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(59, 130, 246, 0.10);
  color: var(--info);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.global-ticket-list {
  display: grid;
  gap: 8px;
  max-height: calc(100dvh - 420px);
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.global-ticket-list::-webkit-scrollbar {
  width: 10px;
}
.global-ticket-list::-webkit-scrollbar-thumb {
  background: var(--line);
  border: 2px solid var(--card);
  border-radius: 999px;
}

.global-ticket {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
}

.global-ticket-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.global-ticket-queue {
  color: var(--info);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.global-ticket-case {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.76rem;
  font-family: var(--font-mono);
}

.global-ticket strong {
  color: var(--ink);
  font-size: 0.9rem;
}

.global-ticket p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.support-contact-list {
  display: grid;
  gap: 8px;
}

.support-contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  font-size: 0.88rem;
}

.support-contact-item span:first-child {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  min-width: 64px;
}

.support-contact-item span:last-child {
  color: var(--ink);
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
}

.support-version {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.78rem;
}

.empty-tickets {
  padding: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 1120px) {
  .report-summary {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}

@media (max-width: 760px) {
  .report-summary {
    grid-template-columns: 1fr 1fr;
  }

  .view-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* Chat com o Suporte Cygnus */
.support-chat-card { margin-top: 14px; }
.chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.chat-head strong { display: block; color: var(--ink); }
.chat-head small { color: var(--muted); font-size: 0.82rem; }
.chat-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
  flex: 0 0 auto;
}
.chat-status-dot.online { background: var(--green); box-shadow: 0 0 8px rgba(34, 197, 94, 0.6); }

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100dvh - 420px);
  min-height: 180px;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-elev);
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.chat-messages::-webkit-scrollbar { width: 10px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--line); border: 2px solid var(--bg-elev); border-radius: 999px; }

.chat-msg { display: flex; flex-direction: column; max-width: 80%; gap: 3px; }
.chat-msg.chat-user { align-self: flex-end; align-items: flex-end; }
.chat-msg.chat-support { align-self: flex-start; align-items: flex-start; }
.chat-bubble {
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-user .chat-bubble {
  color: #fff;
  background: var(--primary);
  border-bottom-right-radius: 4px;
}
.chat-support .chat-bubble {
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
.chat-meta { color: var(--muted); font-size: 0.7rem; }

.chat-input { display: flex; gap: 10px; margin-top: 12px; }
.chat-input input { flex: 1 1 auto; min-width: 0; }
.chat-input button { flex: 0 0 auto; }

/* Chat: header com ação, botão limpar e indicador "digitando" */
.chat-head-info { flex: 1 1 auto; min-width: 0; }
.chat-clear {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 12px;
  font-size: 0.8rem;
}
.chat-typing .chat-bubble {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: chatTyping 1.2s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: 0.18s; }
.typing-dot:nth-child(3) { animation-delay: 0.36s; }
@keyframes chatTyping {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

/* ----- Aba Anexos ----- */
.attachments {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.attachments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.attachments-header h3 {
  margin: 0;
}

.attachments-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-auto-refresh-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.toggle-auto-refresh-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.toggle-auto-refresh-btn.active {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.4);
  color: var(--green);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.15);
}

.toggle-auto-refresh-btn.active:hover {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.6);
}

.toggle-auto-refresh-btn svg {
  width: 14px;
  height: 14px;
}

.refresh-atts-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}

.refresh-atts-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.refresh-atts-btn svg {
  width: 14px;
  height: 14px;
  transition: transform 150ms ease;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.refresh-atts-btn svg.spinning {
  animation: spin 1s linear infinite;
}

.att-dropzone {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px;
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  background: var(--bg-elev);
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}

.att-dropzone:hover {
  border-color: var(--primary);
  background: var(--card-hover);
}

.att-dropzone strong { color: var(--ink); }
.att-dropzone span { color: var(--muted); font-size: 0.8rem; }

.att-queue,
.att-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.att-queue-row {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  padding: 6px 10px;
  border-left: 3px solid var(--muted);
  background: var(--card);
  border-radius: 6px;
}

.att-queue-row.att-ok { border-left-color: var(--green); color: var(--ink); }
.att-queue-row.att-err { border-left-color: var(--red); color: var(--ink); }

/* estado de erro standalone (ex.: <li class="att-err"> na listagem) */
.att-err { color: var(--red); }

.att-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.att-row a { color: var(--info); font-weight: 600; text-decoration: none; }
.att-row a:hover { text-decoration: underline; }
.att-row span { color: var(--muted); font-size: 0.76rem; font-family: var(--font-mono); }

/* ==========================================================================
   SCENARIOS VIEW (Novo simulador de cenários)
   ========================================================================== */
.scenarios-workspace {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 20px;
  align-items: start;
  margin-top: 14px;
}

.scenarios-left-col,
.scenarios-right-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.scenarios-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  padding: 20px;
  box-shadow: 0 10px 30px rgba(2, 8, 20, 0.35);
}

.scenarios-card h3 {
  margin: 0 0 12px;
  font-size: 1.15rem;
  color: var(--ink);
}

.scenario-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 180px;
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 20px;
  background: var(--bg-elev);
  cursor: pointer;
  transition: border-color 200ms ease, background 200ms ease, box-shadow 200ms ease;
  text-align: center;
}

.scenario-dropzone:hover,
.scenario-dropzone.dragover {
  border-color: var(--primary);
  background: var(--card-hover);
  box-shadow: var(--glow-blue);
}

.scenario-dropzone-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.1);
  color: var(--primary);
  margin-bottom: 4px;
}

.scenario-dropzone-icon svg {
  width: 24px;
  height: 24px;
}

.scenario-dropzone strong {
  font-weight: 600;
  color: var(--ink);
}

.scenario-dropzone span {
  font-size: 0.8rem;
  color: var(--muted);
}

.presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.preset-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-elev);
  text-align: left;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.preset-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  background: var(--card-hover);
  box-shadow: 0 5px 15px rgba(59, 130, 246, 0.15);
}

.preset-card .preset-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
}

.preset-card .preset-meta {
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.4;
}

.preset-card .preset-risk {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 99px;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

.preset-card .preset-risk.green {
  background: rgba(34, 197, 94, 0.12);
  color: var(--green);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.preset-card .preset-risk.yellow {
  background: rgba(245, 158, 11, 0.12);
  color: var(--amber);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.preset-card .preset-risk.red {
  background: rgba(239, 68, 68, 0.12);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.validation-tracker {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(14, 26, 48, 0.8), rgba(17, 32, 58, 0.8));
  box-shadow: var(--glow-blue);
  animation: pulse-border 2s infinite ease-in-out;
}

@keyframes pulse-border {
  0%, 100% { border-color: rgba(59, 130, 246, 0.2); }
  50% { border-color: rgba(59, 130, 246, 0.5); }
}

.tracker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.tracker-header h4 {
  margin: 0;
  font-size: 1rem;
  color: var(--info);
  letter-spacing: 0.02em;
}

.tracker-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
}

.tracker-steps-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tracker-step-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  transition: all 250ms ease;
}

.tracker-step-row.scanning {
  border-color: rgba(59, 130, 246, 0.3);
  background: rgba(59, 130, 246, 0.05);
}

.tracker-step-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--muted);
}

.tracker-step-icon svg {
  width: 18px;
  height: 18px;
}

.tracker-step-row.scanning .tracker-step-icon {
  color: var(--primary);
  animation: spin 1s linear infinite;
}

.tracker-step-row.success {
  background: rgba(34, 197, 94, 0.04);
}
.tracker-step-row.success .tracker-step-icon {
  color: var(--green);
}

.tracker-step-row.warning {
  background: rgba(245, 158, 11, 0.04);
}
.tracker-step-row.warning .tracker-step-icon {
  color: var(--amber);
}

.tracker-step-row.danger {
  background: rgba(239, 68, 68, 0.04);
}
.tracker-step-row.danger .tracker-step-icon {
  color: var(--red);
}

.tracker-step-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tracker-step-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
}

.tracker-step-detail {
  font-size: 0.76rem;
  color: var(--muted);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.tracker-step-status {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.tracker-step-row.pending { opacity: 0.5; }
.tracker-step-row.success .tracker-step-status { color: var(--green); }
.tracker-step-row.warning .tracker-step-status { color: var(--amber); }
.tracker-step-row.danger .tracker-step-status { color: var(--red); }
.tracker-step-row.scanning .tracker-step-status { color: var(--primary); }

.tracker-summary-card {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  text-align: center;
}

.tracker-summary-card.done {
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.05);
}

.tracker-summary-card button {
  width: 100%;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.scenarios-list-card {
  max-height: 480px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.scenarios-table-wrap {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  flex: 1;
}

.scenarios-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.scenarios-table th,
.scenarios-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.scenarios-table th {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.scenarios-table tr.clickable {
  cursor: pointer;
  transition: background 150ms ease;
}

.scenarios-table tr.clickable:hover {
  background: var(--bg-elev);
}

.scenarios-table tr.clickable:active {
  background: var(--card-hover);
}

.scenarios-table td strong {
  color: var(--ink);
}

.scenarios-table td small {
  display: block;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  margin-top: 2px;
}

.scenario-risk-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 99px;
  letter-spacing: 0.05em;
  text-align: center;
}

.scenario-risk-pill.green {
  background: rgba(34, 197, 94, 0.12);
  color: var(--green);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.scenario-risk-pill.yellow {
  background: rgba(245, 158, 11, 0.12);
  color: var(--amber);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.scenario-risk-pill.red {
  background: rgba(239, 68, 68, 0.12);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* ---- Score de autenticidade (aba Anexos) ---- */
.auth-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
  width: 100%;
}
.auth-badge {
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
}
.auth-aprovada { background: #e8f7ee; color: #127a43; }
.auth-revisao { background: #fff6e0; color: #9a6b00; }
.auth-rejeitada, .auth-erro { background: #fdeaea; color: #b3261e; }
.auth-indisponivel { background: #ececec; color: #666; }
.auth-partial { font-size: 0.75rem; color: #9a6b00; }
.auth-retry {
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  border-radius: 6px;
  padding: 2px 10px;
  font-size: 0.8rem;
  cursor: pointer;
}
.auth-retry:disabled { opacity: 0.5; cursor: default; }
.auth-details { width: 100%; font-size: 0.85rem; }
.auth-details summary { cursor: pointer; }
.auth-details ul { margin: 6px 0; padding-left: 18px; }
.auth-cap { color: #b3261e; font-weight: 600; }
.auth-laudo { font-style: italic; margin: 6px 0 0; }
/* Avaria relatada nao confirmada pela analise multimodal: callout deterministico */
.auth-damage-callout {
  margin: 8px 0 0;
  padding: 6px 10px;
  border-radius: 6px;
  border-left: 3px solid var(--red);
  background: rgba(239, 68, 68, 0.12);
  color: var(--red);
  font-weight: 700;
}
/* Realce best-effort das sentencas do laudo que indicam dano nao confirmado */
.laudo-flag {
  background: rgba(239, 68, 68, 0.16);
  color: var(--red);
  font-weight: 600;
  border-radius: 3px;
  padding: 0 2px;
}

.auth-case-pill {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ---- Registro no banco (aba Evidências) ---- */
.db-record { margin-top: 16px; }
.db-record h4 { margin: 12px 0 6px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; word-break: break-all; }
.db-grid { display: grid; gap: 8px; margin: 8px 0 0; }
.db-grid dt { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.7; }
.db-grid dd { margin: 2px 0 0; }
.db-files { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.db-files li { display: flex; flex-direction: column; gap: 2px; padding: 6px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.db-sha { opacity: 0.7; }

.auth-warning { color: #9a6b00; font-weight: 600; }

/* ==========================================================================
   WIZARD ONBOARDING FOR SCENARIOS VIEW
   ========================================================================== */

.wizard-steps-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 10px auto 25px;
  max-width: 600px;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--line);
  padding: 14px 28px;
  border-radius: 20px;
  backdrop-filter: blur(10px);
}

.wizard-step-indicator-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.wizard-step-indicator-item .step-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 0.82rem;
  font-weight: 700;
  background: var(--bg);
  transition: all 0.3s ease;
}

.wizard-step-indicator-item.active {
  color: var(--info);
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

.wizard-step-indicator-item.active .step-circle {
  border-color: var(--info);
  background: var(--info);
  color: var(--bg);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.5);
}

.wizard-step-indicator-item.completed {
  color: var(--green);
}

.wizard-step-indicator-item.completed .step-circle {
  border-color: var(--green);
  background: var(--green);
  color: var(--bg);
}

.wizard-step-line {
  flex: 1;
  height: 2px;
  background: var(--line);
  min-width: 40px;
  transition: all 0.3s ease;
}

.wizard-step-line.active {
  background: var(--info);
  box-shadow: 0 0 8px var(--info);
}

.wizard-card {
  max-width: 600px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  padding: 30px;
  box-shadow: 0 15px 35px rgba(2, 8, 20, 0.45);
}

.wizard-card-header {
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.wizard-card-header h3 {
  margin: 0 0 6px;
  font-size: 1.35rem;
  color: var(--ink);
  font-weight: 700;
}

.wizard-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 30px;
}

.wizard-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wizard-field.textarea-field {
  margin-bottom: 30px;
}

.wizard-field label {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.wizard-field input,
.wizard-field textarea {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--ink);
  font-size: 0.94rem;
  transition: all 0.25s ease;
}

.wizard-field input:focus,
.wizard-field textarea:focus {
  border-color: var(--info);
  background: rgba(15, 23, 42, 0.9);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.15);
  outline: none;
}

.wizard-field.error input,
.wizard-field.error textarea {
  border-color: var(--red);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}

.wizard-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.wiz-btn-next {
  background: linear-gradient(135deg, var(--primary), var(--info));
  color: #fff;
  border: none;
  padding: 12px 28px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
  transition: all 0.2s ease;
}

.wiz-btn-next:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.45), var(--glow-blue);
}

.wiz-btn-next:active {
  transform: translateY(0);
}

/* Animation fade-in */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.3s ease-out forwards;
}

/* Shake Animation on Error */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.shake {
  animation: shake 0.4s ease-in-out;
}

/* Summary Bar on Step 3 */
.wizard-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--line);
  padding: 14px 20px;
  border-radius: 14px;
  margin-bottom: 20px;
  backdrop-filter: blur(8px);
}

.wizard-summary-info {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.92rem;
  min-width: 0;
  flex: 1;
}

.wizard-summary-tag {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: var(--info);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  font-weight: 700;
  flex-shrink: 0;
}

.wizard-summary-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.wizard-summary-vehicle {
  color: var(--ink);
  font-weight: 600;
}

.wizard-summary-desc {
  color: var(--muted);
  font-size: 0.86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wizard-btn-edit {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  flex-shrink: 0;
  margin-left: 14px;
}

.wizard-btn-edit:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink);
  border-color: var(--muted);
}

/* ---- Autocomplete Dropdown ---- */
.autocomplete-wrap {
  position: relative;
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: rgba(15, 23, 42, 0.97);
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 10px 10px;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.12) transparent;
}

.autocomplete-dropdown:empty {
  display: none;
}

.autocomplete-item {
  padding: 10px 14px;
  font-size: 0.88rem;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
  background: rgba(56, 189, 248, 0.12);
  color: #fff;
}

.autocomplete-item .ac-highlight {
  color: var(--info);
  font-weight: 700;
}

.autocomplete-loading {
  padding: 12px 14px;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
  font-style: italic;
}

/* ----- Rules Engine ----- */
.rules-hint {
  margin: 0 0 24px;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.5;
}

.rules-layout {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  margin-top: 10px;
}

.rules-left-col {
  flex: 0 0 38%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
}

.rules-right-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: rgba(15, 23, 42, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 20px;
}

.rules-column-title {
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rules-column-title .badge {
  font-size: 0.68rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--muted);
}

/* Barra de Abas (Tabs) */
.rules-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.rules-tabs::-webkit-scrollbar {
  display: none;
}

.rules-tab-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.rules-tab-btn:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
}

.rules-tab-btn.active {
  color: var(--info);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.rules-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Cards com Design Premium */
.rule-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(30, 41, 59, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 16px 18px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.rule-card:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.3);
  background: rgba(30, 41, 59, 0.5);
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.06);
}

.rule-card.mandatory {
  border-left: 4px solid var(--primary);
  background: rgba(59, 130, 246, 0.04);
}

.rule-card.mandatory:hover {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.08);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.05);
}

.rule-card-main {
  flex: 1;
}

.rule-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.rule-card-head strong {
  color: #fff;
  font-size: 0.94rem;
  font-weight: 600;
}

.rule-card-desc {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--muted);
}

.rule-soon {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--amber);
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 999px;
  padding: 1px 8px;
  white-space: nowrap;
  font-weight: 700;
}

.rule-lock {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 999px;
  padding: 4px 12px;
  white-space: nowrap;
  font-weight: 700;
}

.rule-toggle {
  position: relative;
  width: 46px;
  height: 25px;
  min-height: 0;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
}

.rule-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
}

.rule-toggle:active {
  opacity: 1;
}

.rule-toggle.on {
  background: var(--green);
}

.rule-toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.rule-toggle.on .rule-toggle-knob {
  transform: translateX(21px);
}

.rule-toggle:focus-visible {
  outline: 2px solid var(--info);
  outline-offset: 2px;
}

/* Histórico de alterações de regras (auditoria) */
.rules-audit {
  margin-top: 28px;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
}

.rules-audit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rules-audit-item {
  display: grid;
  grid-template-columns: 96px 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  font-size: 0.84rem;
}

.rules-audit-action {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  padding: 3px 8px;
  border-radius: 999px;
}

.rules-audit-action.on {
  color: #34d399;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.25);
}

.rules-audit-action.off {
  color: #f87171;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.25);
}

.rules-audit-rule {
  font-weight: 600;
  color: var(--ink);
}

.rules-audit-who {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.audit-mode {
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.rules-audit-when {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rules-audit-empty {
  padding: 12px 14px;
  font-style: italic;
}

@media (max-width: 1024px) {
  .rules-layout {
    flex-direction: column;
    gap: 20px;
  }
  .rules-left-col {
    flex: 1 1 auto;
    width: 100%;
  }
  .rules-audit-item {
    grid-template-columns: 84px 1fr;
    row-gap: 6px;
  }
  .rules-audit-when {
    grid-column: 2;
  }
}

/* ---- Rail Footer & Logout Button ---- */
.rail-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.rail-footer .rail-version {
  margin-top: 0;
}

.logout-rail-btn {
  color: rgba(239, 68, 68, 0.75);
  border-color: rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.04);
}

.logout-rail-btn:hover {
  color: #fff;
  background: #ef4444;
  border-color: #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.35);
  filter: none;
}

/* ---- Notifications Widget (Top Header) ---- */
.header-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.notifications-wrapper {
  position: relative;
}

.notifications-trigger {
  position: relative;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  width: 38px;
  height: 38px;
  min-height: 38px;
  border-radius: 9px;
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.notifications-trigger:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  border-color: var(--muted);
}

.bell-icon {
  width: 18px;
  height: 18px;
}

.notifications-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--red);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg);
  line-height: 1;
}

/* Dropdown de Notificações */
.notifications-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  overflow: hidden;
  backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
}

.notifications-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.notifications-dropdown-header h4 {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
}

.clear-notifications-btn {
  background: transparent;
  border: none;
  color: var(--info);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.15s ease;
  min-height: 0;
}

.clear-notifications-btn:hover {
  background: rgba(56, 189, 248, 0.08);
}

.notifications-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 280px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.notification-item {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--ink);
  transition: background 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: default;
}

.notification-item:last-child {
  border-bottom: none;
}

.notification-item:hover {
  background: rgba(255, 255, 255, 0.02);
}

.notification-item .notif-time {
  font-size: 0.65rem;
  color: var(--muted);
  align-self: flex-end;
}

.notification-item.notif-success {
  border-left: 3px solid var(--green);
}

.notification-item.notif-info {
  border-left: 3px solid var(--info);
}

.notifications-empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-style: italic;
  font-size: 0.82rem;
}

/* Animação do Sino (Wiggle) */
@keyframes wiggle {
  0% { transform: rotate(0); }
  15% { transform: rotate(10deg); }
  30% { transform: rotate(-10deg); }
  45% { transform: rotate(5deg); }
  60% { transform: rotate(-5deg); }
  75% { transform: rotate(2deg); }
  85% { transform: rotate(-2deg); }
  100% { transform: rotate(0); }
}

.wiggle {
  animation: wiggle 0.6s ease;
}

/* ---- Assistente AI (view assistant) ---- */
#viewAssistant {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.assistant-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-msg {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 14px;
  line-height: 1.5;
  font-size: 0.88rem;
  backdrop-filter: blur(10px);
}

.chat-user {
  align-self: flex-end;
  background: rgba(59, 130, 246, 0.16);
  color: var(--ink);
  border: 1px solid rgba(59, 130, 246, 0.35);
  white-space: pre-wrap;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.08);
}

.chat-assistant {
  align-self: flex-start;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.chat-error {
  align-self: flex-start;
  background: rgba(239, 68, 68, 0.1);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.chat-thinking {
  opacity: 0.6;
  font-style: italic;
  color: var(--muted);
}

.chat-assistant p {
  margin: 0 0 8px;
}

.chat-assistant p:last-child {
  margin-bottom: 0;
}

.chat-table {
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 0.82rem;
  width: 100%;
}

.chat-table th,
.chat-table td {
  border: 1px solid var(--line);
  padding: 6px 10px;
  text-align: left;
}

.chat-table th {
  background: rgba(255, 255, 255, 0.03);
  font-weight: 700;
  color: #fff;
}

.chat-table td {
  color: var(--muted);
}

.chat-assistant a[data-case-id] {
  color: var(--info);
  text-decoration: underline;
  cursor: pointer;
  font-weight: 600;
}

.chat-assistant a[data-case-id]:hover {
  color: #fff;
}

.chat-note {
  font-size: 0.76rem;
  color: var(--amber);
  margin: 8px 0 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-queries {
  margin-top: 10px;
  font-size: 0.76rem;
}

.chat-queries summary {
  cursor: pointer;
  color: var(--muted);
  user-select: none;
  font-weight: 600;
}

.chat-queries summary:hover {
  color: var(--ink);
}

.chat-query pre {
  background: rgba(15, 23, 42, 0.6);
  color: #cbd5e1;
  border: 1px solid var(--line);
  padding: 10px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.74rem;
  font-family: var(--font-mono);
}

.assistant-form {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}

.assistant-form textarea {
  flex: 1;
  resize: none;
  padding: 10px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font-size: 0.88rem;
  font-family: inherit;
  transition: all 0.25s ease;
}

.assistant-form textarea:focus {
  border-color: var(--info);
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.15);
  outline: none;
}

.assistant-form button {
  padding: 0 22px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s ease;
}

.assistant-form button:hover {
  background: var(--primary-strong);
}

.assistant-form button:disabled {
  opacity: 0.5;
  cursor: default;
}

.chat-verify-ok {
  font-size: 0.76rem;
  color: var(--green);
  margin: 8px 0 0;
}

.chat-verify-warn {
  margin-top: 10px;
  padding: 10px 14px;
  background: rgba(245, 158, 11, 0.1);
  border-left: 3px solid var(--amber);
  border-radius: 8px;
  font-size: 0.82rem;
  color: var(--amber);
}

.chat-verify-warn ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

