﻿@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@500;600;700;800;900&display=swap");

/* TEST_SAVE */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-strong: #18212f;
  --surface-soft: #eef2f4;
  --border: #d9e0e7;
  --accent: #0f7b5f;
  --accent-hover: #0a634d;
  --blue: #2458a6;
  --red: #c0392b;
  --yellow: #a36a00;
  --text: #17202c;
  --muted: #667384;
  --sidebar-text: #edf4f1;
  --sidebar-muted: #aebbc6;
  --radius: 8px;
  --sidebar-w: 252px;
}

.auth-hidden {
  display: none !important;
}

/* Restaura o comportamento nativo do atributo hidden: classes como .nav-item e
   .fleet-tab definem display diretamente e venceriam o `hidden` do HTML, fazendo
   elemento.hidden = true (sidebar por permissao / modulos descontinuados, abas de
   Administracao) nao esconder nada. Esta e a unica excecao onde !important se
   justifica no projeto — restaura o padrao do HTML, nao sobrescreve estilo. */
[hidden] {
  display: none !important;
}

.auth-screen {
  min-height: 100vh;
  position: relative;
  display: grid;
  place-items: center;
  padding: 40px;
  overflow: hidden;
  background:
    linear-gradient(120deg, rgba(15,123,95,0.18), transparent 35%),
    linear-gradient(300deg, rgba(36,88,166,0.18), transparent 40%),
    #06111a;
  color: #edf4f1;
}

.auth-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.9), transparent 95%);
}

.auth-screen::after {
  content: "";
  position: absolute;
  width: 860px;
  height: 860px;
  border: 1px solid rgba(237,244,241,0.08);
  transform: rotate(18deg);
  right: -310px;
  top: -260px;
  background:
    linear-gradient(135deg, rgba(15,123,95,0.1), transparent 35%),
    linear-gradient(45deg, rgba(36,88,166,0.12), transparent 45%);
}

.auth-stage {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.auth-stage span {
  position: absolute;
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(237,244,241,0.65);
  box-shadow: 0 0 22px rgba(15,123,95,0.8);
  animation: authFloat 8s ease-in-out infinite;
}

.auth-stage span:nth-child(1) { left: 12%; top: 24%; }
.auth-stage span:nth-child(2) { left: 78%; top: 18%; animation-delay: -2s; }
.auth-stage span:nth-child(3) { left: 18%; top: 74%; animation-delay: -4s; }
.auth-stage span:nth-child(4) { left: 86%; top: 68%; animation-delay: -6s; }

.auth-shell {
  position: relative;
  z-index: 1;
  width: min(1040px, 100%);
  min-height: 620px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(237,244,241,0.16);
  border-radius: 8px;
  box-shadow: 0 30px 90px rgba(0,0,0,0.36);
  backdrop-filter: blur(18px);
  overflow: hidden;
}

.auth-hero-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 620px;
  padding: 56px;
  background:
    linear-gradient(145deg, rgba(7,23,33,0.65), rgba(7,23,33,0.92)),
    linear-gradient(45deg, rgba(15,123,95,0.28), rgba(36,88,166,0.2));
}

.auth-hero-panel::before {
  content: "";
  position: absolute;
  inset: 36px;
  border: 1px solid rgba(237,244,241,0.12);
  border-radius: 8px;
}

.auth-hero-panel::after {
  content: "";
  position: absolute;
  right: 54px;
  top: 54px;
  width: 190px;
  height: 190px;
  border-radius: 8px;
  border: 1px solid rgba(237,244,241,0.12);
  background:
    linear-gradient(135deg, rgba(15,123,95,0.45), transparent 52%),
    linear-gradient(315deg, rgba(36,88,166,0.5), transparent 52%);
  transform: rotate(12deg);
}

.auth-hero-kicker {
  width: fit-content;
  margin-bottom: 18px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(15,123,95,0.18);
  color: #b9f4df;
  border: 1px solid rgba(15,123,95,0.35);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.auth-hero-panel h1 {
  position: relative;
  max-width: 620px;
  margin: 0 0 18px;
  font-size: 44px;
  line-height: 1.05;
  letter-spacing: 0;
}

.auth-hero-panel p {
  position: relative;
  max-width: 560px;
  margin: 0;
  color: rgba(237,244,241,0.78);
  font-size: 16px;
  line-height: 1.7;
}

.auth-feature-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 34px;
}

.auth-feature-grid div {
  padding: 14px;
  border-radius: 8px;
  border: 1px solid rgba(237,244,241,0.12);
  background: rgba(255,255,255,0.08);
}

.auth-feature-grid strong {
  display: block;
  margin-bottom: 6px;
  color: #b9f4df;
  font-size: 15px;
}

.auth-feature-grid span {
  color: rgba(237,244,241,0.7);
  font-size: 12px;
}

.auth-form-panel {
  display: grid;
  place-items: center;
  padding: 44px;
  background: rgba(244,247,246,0.96);
}

.auth-card {
  width: min(390px, 100%);
  background: var(--surface);
  border: 1px solid rgba(217,224,231,0.9);
  border-radius: 8px;
  padding: 30px;
  box-shadow: 0 22px 50px rgba(17, 24, 39, 0.16);
}

.auth-logo {
  display: block;
  width: 210px;
  max-width: 100%;
  margin: 0 auto 24px;
  filter: grayscale(1);
}

.auth-card-heading span {
  display: inline-flex;
  margin-bottom: 8px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(15,123,95,0.1);
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.auth-card h1,
.auth-card-heading h1 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 26px;
  letter-spacing: 0;
}

.auth-card p,
.auth-card-heading p {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.45;
}

.auth-card label {
  display: block;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.auth-card input,
.admin-create-row input,
.admin-create-row select {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 12px 13px;
  font: inherit;
}

.auth-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15,123,95,0.12);
}

.auth-submit {
  width: 100%;
  margin-top: 12px;
  padding: 13px 16px;
  box-shadow: 0 12px 24px rgba(15,123,95,0.22);
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  margin-top: 12px;
  cursor: pointer;
}

.auth-status {
  min-height: 20px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

@keyframes authFloat {
  0%, 100% { transform: translate3d(0,0,0); opacity: 0.45; }
  50% { transform: translate3d(12px,-18px,0); opacity: 1; }
}

@media (max-width: 880px) {
  .auth-screen {
    padding: 18px;
  }

  .auth-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .auth-hero-panel {
    min-height: 280px;
    padding: 34px;
  }

  .auth-hero-panel h1 {
    font-size: 30px;
  }

  .auth-hero-panel::after {
    width: 110px;
    height: 110px;
    right: 28px;
    top: 28px;
  }

  .auth-feature-grid {
    grid-template-columns: 1fr;
  }

  .home-user-summary {
    align-items: stretch;
  }

  .home-hero {
    grid-template-columns: 1fr;
  }

  .home-user-details {
    grid-template-columns: 1fr;
  }

  .auth-form-panel {
    padding: 24px;
  }
}

.auth-screen {
  place-items: stretch;
  padding: clamp(18px, 3.4vw, 44px);
  background:
    radial-gradient(circle at 14% 26%, rgba(52,217,195,0.22), transparent 28%),
    radial-gradient(circle at 82% 76%, rgba(36,88,166,0.28), transparent 36%),
    linear-gradient(135deg, #061119 0%, #091923 48%, #07101a 100%);
  color: #f3f5f6;
  animation: authFadeIn 700ms ease both;
}

.auth-screen::before {
  background-image:
    linear-gradient(rgba(52,217,195,0.065) 1px, transparent 1px),
    linear-gradient(90deg, rgba(52,217,195,0.055) 1px, transparent 1px),
    radial-gradient(circle, rgba(52,217,195,0.22) 1px, transparent 2px);
  background-size: 76px 76px, 76px 76px, 118px 118px;
  mask-image: linear-gradient(90deg, rgba(0,0,0,1), rgba(0,0,0,0.55) 72%, transparent);
}

.auth-screen::after {
  width: 58vw;
  height: 58vw;
  right: auto;
  left: -18vw;
  top: 8vh;
  border-radius: 50%;
  border: 1px solid rgba(52,217,195,0.16);
  background:
    repeating-conic-gradient(from 28deg, transparent 0 11deg, rgba(52,217,195,0.12) 12deg 13deg),
    radial-gradient(circle, rgba(52,217,195,0.14), transparent 62%);
  transform: none;
  opacity: 0.75;
}

.auth-stage span {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: rgba(52,217,195,0.7);
  clip-path: polygon(25% 6%, 75% 6%, 100% 50%, 75% 94%, 25% 94%, 0 50%);
  box-shadow: 0 0 24px rgba(52,217,195,0.7);
}

.auth-shell {
  place-self: center;
  width: min(1180px, 100%);
  min-height: min(680px, calc(100vh - 70px));
  grid-template-columns: minmax(520px, 1.08fr) minmax(370px, 0.82fr);
  background: transparent;
  border: 1px solid rgba(243,245,246,0.16);
  border-radius: 8px;
  box-shadow: 0 34px 110px rgba(0,0,0,0.44);
  backdrop-filter: none;
  overflow: visible;
}

.auth-hero-panel {
  --mx: 58%;
  --my: 42%;
  min-height: min(680px, calc(100vh - 70px));
  justify-content: center;
  padding: clamp(36px, 5vw, 64px);
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at var(--mx) var(--my), rgba(52,217,195,0.2), transparent 24%),
    linear-gradient(145deg, rgba(51,55,61,0.98), rgba(24,31,38,0.98));
}

.auth-hero-panel::before {
  inset: 0;
  border-radius: 8px 0 0 8px;
  border: 0;
  background:
    linear-gradient(rgba(52,217,195,0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(52,217,195,0.05) 1px, transparent 1px),
    radial-gradient(circle at 18% 72%, rgba(52,217,195,0.18), transparent 19%),
    radial-gradient(circle at 82% 26%, rgba(243,245,246,0.08), transparent 18%);
  background-size: 58px 58px, 58px 58px, auto, auto;
  z-index: -2;
}

.auth-hero-panel::after {
  content: "";
  position: absolute;
  inset: auto auto -96px -124px;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  border: 1px solid rgba(52,217,195,0.22);
  background:
    radial-gradient(circle, rgba(52,217,195,0.2), transparent 58%),
    conic-gradient(from 80deg, transparent, rgba(52,217,195,0.24), transparent 40%);
  filter: blur(0.4px);
  z-index: -1;
  animation: authOrb 11s ease-in-out infinite;
}

.auth-hero-kicker {
  position: relative;
  z-index: 2;
  margin-bottom: 18px;
  background: rgba(52,217,195,0.12);
  color: #34d9c3;
  border-color: rgba(52,217,195,0.38);
  box-shadow: none;
}

.auth-hero-panel h1 {
  z-index: 2;
  max-width: 610px;
  color: #f3f5f6;
  font-size: clamp(34px, 4.2vw, 54px);
  font-weight: 900;
  line-height: 1.04;
}

.auth-hero-panel p {
  z-index: 2;
  max-width: 560px;
  color: rgba(243,245,246,0.76);
  font-weight: 500;
}

.auth-cursor-trail {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
}

.auth-cursor-trail span {
  position: absolute;
  width: var(--size);
  height: var(--size);
  transform: translate(-50%, -50%);
  clip-path: polygon(25% 6%, 75% 6%, 100% 50%, 75% 94%, 25% 94%, 0 50%);
  background: rgba(52,217,195,0.82);
  box-shadow: 0 0 20px rgba(52,217,195,0.78);
  animation: authTrail 850ms ease-out forwards;
}

.auth-molecule {
  position: relative;
  z-index: 3;
  height: 300px;
  max-width: 640px;
  margin-top: 28px;
  perspective: 900px;
}

.auth-molecule-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  opacity: 0.76;
}

.auth-molecule-lines path {
  fill: none;
  stroke: rgba(52,217,195,0.5);
  stroke-width: 2;
  stroke-dasharray: 7 10;
  filter: drop-shadow(0 0 12px rgba(52,217,195,0.42));
  animation: authDash 18s linear infinite;
}

.auth-hex-card {
  position: absolute;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 7px;
  width: 154px;
  height: 136px;
  padding: 26px 20px;
  color: #dffaf5;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.24), rgba(255,255,255,0.055)),
    radial-gradient(circle at 42% 70%, rgba(52,217,195,0.38), transparent 30%);
  border: 1px solid rgba(243,245,246,0.34);
  clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0 50%);
  box-shadow: 0 24px 56px rgba(0,0,0,0.36), inset 0 1px 0 rgba(255,255,255,0.36);
  backdrop-filter: blur(16px);
  transform: translate3d(var(--tx, 0), var(--ty, 0), 0) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transform-style: preserve-3d;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
  will-change: transform;
}

.auth-hex-card::before {
  content: "";
  position: absolute;
  inset: 11px;
  clip-path: inherit;
  border: 1px solid rgba(52,217,195,0.18);
}

.auth-hex-card:hover {
  border-color: rgba(52,217,195,0.78);
  box-shadow: 0 28px 70px rgba(0,0,0,0.42), 0 0 34px rgba(52,217,195,0.24), inset 0 1px 0 rgba(255,255,255,0.42);
}

.auth-hex-card svg {
  width: 42px;
  height: 42px;
  fill: none;
  stroke: #bff7ee;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 12px rgba(52,217,195,0.62));
  transform: translateZ(32px);
}

.auth-hex-card strong {
  color: #34d9c3;
  font-size: 17px;
  font-weight: 900;
  transform: translateZ(26px);
}

.auth-hex-card span {
  max-width: 112px;
  color: rgba(243,245,246,0.76);
  font-size: 11px;
  line-height: 1.35;
  text-align: center;
  transform: translateZ(20px);
}

.auth-hex-nf { left: 24px; top: 100px; animation: authMoleculeFloat 7.6s ease-in-out infinite; }
.auth-hex-ct { right: 18px; top: 22px; width: 170px; height: 150px; animation: authMoleculeFloat 8.4s ease-in-out -2s infinite; }
.auth-hex-rbac { right: 8px; bottom: 12px; width: 176px; height: 154px; animation: authMoleculeFloat 9s ease-in-out -4s infinite; }

.auth-form-panel {
  min-height: min(680px, calc(100vh - 70px));
  background: #f3f5f6;
  border-radius: 0 8px 8px 0;
  box-shadow: inset 1px 0 0 rgba(17,24,39,0.08);
}

.auth-card {
  width: min(360px, 100%);
  background: rgba(255,255,255,0.68);
  border: 1px solid rgba(217,224,231,0.9);
  border-radius: 8px;
  box-shadow: 0 22px 54px rgba(17,24,39,0.16);
  backdrop-filter: blur(10px);
}

.auth-logo {
  width: 218px;
  margin-bottom: 26px;
}

.auth-card-heading span {
  background: rgba(52,217,195,0.16);
  color: #087968;
}

.auth-card h1,
.auth-card-heading h1 {
  color: #17202c;
  font-weight: 900;
}

.auth-card p,
.auth-card-heading p {
  color: #5a5a5a;
}

.auth-card input {
  border-radius: 8px;
  border: 1px solid #ccd6df;
  background: #f8fbfd;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.auth-card input:focus {
  border-color: #34d9c3;
  border-width: 2px;
  padding: 11px 12px;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(52,217,195,0.16), 0 10px 24px rgba(52,217,195,0.22);
}

.auth-card .auth-submit.btn-primary {
  margin-top: 14px;
  border-radius: 9999px;
  background: #34d9c3;
  color: #ffffff;
  font-weight: 900;
  box-shadow: 0 14px 32px rgba(52,217,195,0.38);
}

.auth-card .auth-submit.btn-primary:hover:not(:disabled) {
  background: #21bfa9;
  box-shadow: 0 16px 38px rgba(52,217,195,0.48);
  transform: translateY(-1px);
}

.auth-card .link-button {
  color: #087968;
  text-decoration: none;
  transition: color 160ms ease, text-shadow 160ms ease;
}

.auth-card .link-button:hover {
  color: #34d9c3;
  text-decoration: underline;
  text-shadow: 0 0 16px rgba(52,217,195,0.42);
}

.auth-separator {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.auth-separator::before,
.auth-separator::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--border);
}

.google-login-btn {
  width: 100%;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s;
}

.google-login-btn:hover {
  border-color: rgba(15,123,95,.45);
  background: #fbfdfc;
  box-shadow: 0 10px 22px rgba(17,24,39,.08);
}

.google-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

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

@keyframes authOrb {
  0%, 100% { transform: translate3d(0,0,0) rotate(0deg); }
  50% { transform: translate3d(22px,-16px,0) rotate(12deg); }
}

@keyframes authMoleculeFloat {
  0%, 100% { margin-top: 0; }
  50% { margin-top: -12px; }
}

@keyframes authDash {
  to { stroke-dashoffset: -180; }
}

@keyframes authTrail {
  to {
    opacity: 0;
    transform: translate(calc(-50% + var(--drift-x)), calc(-50% + var(--drift-y))) scale(0.15) rotate(72deg);
  }
}

@media (max-width: 980px) {
  .auth-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .auth-hero-panel,
  .auth-form-panel {
    min-height: auto;
    border-radius: 8px 8px 0 0;
  }

  .auth-form-panel {
    border-radius: 0 0 8px 8px;
  }

  .auth-molecule {
    height: 250px;
  }
}

@media (max-width: 640px) {
  .auth-screen {
    padding: 14px;
  }

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

  .auth-molecule {
    height: auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .auth-molecule-lines {
    display: none;
  }

  .auth-hex-card,
  .auth-hex-ct,
  .auth-hex-rbac {
    position: relative;
    inset: auto;
    width: 100%;
    height: auto;
    min-height: 92px;
    clip-path: none;
    border-radius: 8px;
    animation: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-screen,
  .auth-stage span,
  .auth-hero-panel::after,
  .auth-hex-card,
  .auth-molecule-lines path {
    animation: none !important;
    transition: none !important;
  }
}

.user-menu-box {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  width: 100%;
  overflow: hidden;
}

.user-chip {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  color: var(--sidebar-text);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  overflow: hidden;
  transition: background .15s, border-color .15s;
}

.user-chip:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
}

.user-chip-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  overflow: hidden;
}

.user-chip-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: block;
  text-align: left;
}

.user-chip-email {
  font-size: 10px;
  color: var(--sidebar-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: block;
  text-align: left;
}

.user-chip-arrow {
  color: var(--sidebar-muted);
  flex-shrink: 0;
  opacity: 0.7;
}

.footer-action-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  overflow: hidden;
}

.user-avatar {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  overflow: hidden;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.content-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}

.compact-grid {
  grid-template-columns: repeat(3, minmax(160px, 1fr));
}

.permission-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 18px;
}

.permission-pill,
.permission-check {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.permission-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 8px;
}

.permission-check span {
  color: var(--text);
}

.permission-check small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  opacity: .75;
}

.admin-panel {
  display: none;
}

.admin-panel.active {
  display: block;
}

.admin-create-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 10px;
  align-items: end;
  margin: 14px 0 18px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafb;
}

.admin-users-table {
  min-width: 1280px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.admin-users-table th:nth-child(1),
.admin-users-table td:nth-child(1),
.admin-users-table th:nth-child(2),
.admin-users-table td:nth-child(2),
.admin-users-table th:nth-child(3),
.admin-users-table td:nth-child(3),
.admin-users-table th:nth-child(5),
.admin-users-table td:nth-child(5) {
  width: auto;
  white-space: normal;
}

.admin-inline-input,
.admin-inline-select {
  width: 100%;
  min-width: 150px;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 7px 9px;
}

.admin-inline-input:focus,
.admin-inline-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15,123,95,0.10);
}

.admin-users-table .admin-actions-cell {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  white-space: nowrap;
}

.admin-groups-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 16px;
}

.admin-group-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}

.admin-group-card h3 {
  font-size: 16px;
  margin-bottom: 2px;
}

.admin-group-card p {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 12px;
}

@media (max-width: 700px) {
  .admin-create-row {
    grid-template-columns: 1fr;
  }

  .admin-groups-list {
    grid-template-columns: 1fr;
  }
}

.forbidden-card {
  text-align: center;
  margin-top: 60px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  width: 100%;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Montserrat", "Lato", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
}

.portal-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface-strong);
  border-right: 1px solid #111824;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 200;
  overflow: hidden;
  transition: transform .25s ease;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(5px, 1vh, 10px);
  padding: clamp(10px, 2vh, 20px) 18px;
  padding-right: 42px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
  position: relative;
}

.brand-logo {
  width: 38px;
  height: 38px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 20px;
  color: #fff;
  flex-shrink: 0;
}

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

.brand-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--sidebar-text);
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
}

.brand-logo-img {
  display: block;
  width: 168px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.brand-logo-panel {
  width: 100%;
  border-radius: 8px;
  padding: clamp(5px, 1vh, 10px) 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-company {
  font-size: 12px;
  color: var(--sidebar-muted);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: clamp(8px, 1.5vh, 18px) 12px;
  display: flex;
  flex-direction: column;
  gap: clamp(1px, 0.4vh, 5px);
}

.nav-label-group {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
  padding: clamp(2px, 0.4vh, 4px) 10px clamp(3px, 0.6vh, 8px);
  display: block;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: clamp(30px, 4.5vh, 44px);
  padding: clamp(5px, 0.9vh, 10px) 12px;
  border-radius: 8px;
  border: none;
  background: none;
  color: var(--sidebar-muted);
  font-size: clamp(12px, 1.6vh, 14px);
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background .15s, color .15s;
}

.nav-item:hover {
  background: rgba(255,255,255,.08);
  color: var(--sidebar-text);
}

.nav-item.active {
  background: rgba(15,123,95,.22);
  color: #ffffff;
  font-weight: 750;
  box-shadow: inset 3px 0 0 #34d9c3;
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--sidebar-muted);
  flex-shrink: 0;
  transition: color .15s;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.nav-item:hover .nav-icon {
  color: var(--sidebar-text);
}

.nav-item.active .nav-icon {
  color: #34d9c3;
}

.nav-text { flex: 1; min-width: 0; }

.nav-soon {
  font-size: 10px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 999px;
  padding: 2px 7px;
  color: var(--sidebar-muted);
  white-space: nowrap;
}

.sidebar-footer {
  padding: clamp(8px, 1.5vh, 14px) 10px;
  border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
  overflow: hidden;
  width: 100%;
}

.manual-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--sidebar-muted);
  text-decoration: none;
  font-size: 13px;
  transition: background .15s, color .15s;
}

.footer-action {
  width: 100%;
  min-height: 36px;
  margin-bottom: 7px;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  background: rgba(255,255,255,.08);
  color: var(--sidebar-text);
  cursor: pointer;
  font-size: 13px;
  text-align: left;
}

.footer-action:hover {
  background: rgba(255,255,255,.12);
}

.footer-action.subtle {
  color: var(--sidebar-muted);
  background: transparent;
}

.manual-btn:hover {
  background: rgba(255,255,255,.08);
  color: var(--sidebar-text);
}

.portal-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  width: calc(100% - var(--sidebar-w));
  max-width: calc(100vw - var(--sidebar-w));
  padding: 28px clamp(16px, 2.8vw, 44px) 64px;
  min-width: 0;
  overflow-x: hidden;
  transition: margin-left .25s ease, width .25s ease, max-width .25s ease;
}

/* Desktop: sidebar recolhida — conteúdo usa a largura inteira da tela */
.portal-layout.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
  pointer-events: none;
}

.portal-layout.sidebar-collapsed .portal-content {
  margin-left: 0;
  width: 100%;
  max-width: 100vw;
}

.portal-layout.sidebar-collapsed .sidebar-expand-btn {
  display: inline-flex;
}

.sidebar-collapse-btn {
  position: absolute;
  top: 14px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 6px;
  background: rgba(255, 255, 255, .06);
  color: var(--sidebar-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 2;
}

.sidebar-collapse-btn:hover {
  color: var(--sidebar-text);
  background: rgba(255, 255, 255, .12);
}

.sidebar-collapse-btn svg {
  width: 14px;
  height: 14px;
}

.sidebar-expand-btn {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 210;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(16, 24, 40, .12);
  padding: 0;
}

.sidebar-expand-btn:hover {
  background: var(--surface-soft);
}

.sidebar-expand-btn svg {
  width: 18px;
  height: 18px;
}

/* Tabelas largas: scroll horizontal interno (classe usada no JS sem CSS definido) */
.responsive-table {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.page { display: none; }
.page.active {
  display: block;
  width: 100%;
  max-width: min(1536px, 100%);
  margin: 0 auto;
  min-width: 0;
}

.card,
.consulta-card,
.table-wrap,
.responsive-table {
  max-width: 100%;
}

.page-header {
  margin-bottom: 22px;
}

.page-title {
  font-size: clamp(24px, 2vw, 28px);
  font-weight: 800;
  line-height: 1.15;
}

.page-sub {
  color: var(--muted);
  font-size: 15px;
  margin-top: 6px;
  line-height: 1.55;
}

.nf-workspace {
  display: grid;
  gap: 18px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

/* Contém a página NF dentro da área útil (evita extrapolar pela sidebar) */
#page-nf,
#page-nf.page.active {
  max-width: 100%;
  min-width: 0;
  overflow-x: clip;
}

#page-nf .nf-step-panel,
#page-nf .card,
#page-nf .consulta-card,
#page-nf .manual-card,
#page-nf .nf-flow-card {
  max-width: 100%;
  min-width: 0;
}

.nf-kicker,
.nf-card-eyebrow {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(52,217,195,0.14);
  color: #087968;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.nf-kicker {
  color: #34d9c3;
  border: 1px solid rgba(52,217,195,0.34);
}

.nf-slim-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 0;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(16,24,40,.06);
}

.nf-slim-header .page-title { font-size: clamp(25px, 2vw, 28px); }

.nf-tabs {
  margin-bottom: 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}

.soon-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 65vh;
  text-align: center;
}

.soon-icon {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 22px;
}

.soon-page h2 {
  font-size: 22px;
  color: var(--text);
  margin-bottom: 10px;
}

.soon-page p {
  font-size: 15px;
  color: var(--muted);
  max-width: 420px;
  line-height: 1.6;
}

.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  z-index: 100;
}

.menu-toggle {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  padding: 7px 10px;
  border-radius: 8px;
}

.mobile-title {
  font-weight: 700;
  font-size: 15px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  margin-bottom: 22px;
  display: none;
  box-shadow: 0 1px 3px rgba(16,24,40,.06);
}

.card.active { display: block; }

.card h2 {
  font-size: 18px;
  margin-bottom: 20px;
  color: var(--text);
}

#page-nf .card {
  border-color: var(--border);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(16,24,40,.06);
  backdrop-filter: none;
}

#page-nf .card h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.nf-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.nf-section-heading > span {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: #17202c;
  color: #34d9c3;
  font-weight: 900;
  font-size: 13px;
}

.nf-section-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.tipo-selector {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.tipo-btn {
  flex: 1;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
  transition: all .2s;
}

#page-nf .tipo-selector {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

#page-nf .tipo-btn {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 14px 18px;
  background: var(--surface-soft);
  text-align: left;
}

#page-nf .tipo-btn span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

#page-nf .tipo-btn strong {
  color: var(--text);
  font-size: 18px;
}

.tipo-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: #e8f4ef;
  font-weight: 700;
}

#page-nf .tipo-btn.active {
  border-color: var(--accent);
  background: #e8f4ef;
  box-shadow: none;
}

#page-nf .tipo-btn.active strong {
  color: #087968;
}

.drop-zone {
  border: 2px dashed #b9c5d1;
  border-radius: var(--radius);
  padding: 38px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}

#page-nf .drop-zone {
  position: relative;
  min-height: 164px;
  display: grid;
  place-items: center;
  align-content: center;
  border-color: #b9c5d1;
  background: #fbfcfd;
  border-radius: 12px;
}

.drop-zone:hover {
  border-color: var(--accent);
  background: #f1faf6;
}

#page-nf .drop-zone:hover {
  border-color: var(--accent);
  background: #f1faf6;
}

.drop-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 12px;
}

#page-nf .drop-icon {
  min-width: 74px;
  height: 32px;
  background: var(--surface-soft);
  color: var(--accent);
  box-shadow: none;
}

.drop-zone p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.drop-zone p strong { color: var(--text); }
.hint { font-size: 13px !important; margin-top: 6px; }

.file-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
}

#page-nf .file-item {
  background: var(--surface-soft);
  box-shadow: none;
}

.file-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.file-item button {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  padding: 2px 5px;
}

.file-item button:hover { color: var(--red); }

/* ---- NF-e Chave de Acesso / DANFE ---- */
.nfe-chave-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 4px;
}

.nfe-chave-header { display: flex; flex-direction: column; gap: 4px; }

.nfe-chave-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.nfe-chave-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.nfe-chave-status {
  font-size: 13px;
  font-weight: 500;
  padding: 10px 14px;
  border-radius: 8px;
  border-left: 4px solid #94a3b8;
  background: #f8f9fb;
  color: var(--muted);
  transition: background .2s, border-color .2s, color .2s;
}

.nfe-chave-status--ready   { border-left-color: #94a3b8; background: #f8f9fb; color: var(--muted); }
.nfe-chave-status--reading { border-left-color: #f59e0b; background: #fffbeb; color: #92400e; }
.nfe-chave-status--success { border-left-color: var(--accent); background: #f1faf6; color: #065f46; font-weight: 600; }
.nfe-chave-status--error   { border-left-color: #ef4444; background: #fef2f2; color: #991b1b; }

.nfe-chave-auto-toggle {
  display: flex;
  align-items: center;
}

.nfe-chave-toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.nfe-chave-toggle-label input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.nfe-chave-btn-limpar { color: var(--muted) !important; }

.nfe-chave-field-wrap { display: flex; flex-direction: column; gap: 6px; }

.nfe-chave-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.nfe-chave-input {
  width: 100%;
  font-family: "Courier New", Courier, monospace;
  font-size: 15px;
  letter-spacing: .06em;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s;
}

.nfe-chave-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15,123,95,.12);
}

.nfe-chave-input--ok    { border-color: var(--accent) !important; }
.nfe-chave-input--error { border-color: #d9534f !important; }

.nfe-chave-error {
  font-size: 13px;
  color: #d9534f;
  font-weight: 500;
}

.nfe-chave-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nfe-chave-summary {
  background: #f1faf6;
  border: 1px solid #b9dece;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nfe-chave-ok-badge {
  font-size: 13px;
  font-weight: 700;
  color: #087968;
}

.nfe-chave-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.nfe-chave-data-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nfe-chave-data-item span {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.nfe-chave-data-item strong {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
}

.nfe-chave-hint {
  font-size: 13px;
  color: var(--muted);
  background: #f8f9fb;
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  border-radius: 0 6px 6px 0;
  line-height: 1.55;
}

.nfe-chave-hint strong { color: var(--text); }

.nfe-chave-drop-zone {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px dashed #b9dece;
  border-radius: 10px;
  padding: 24px 16px;
  background: #f8fcfa;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  text-align: center;
}
.nfe-chave-drop-zone.visible { display: flex; }
.nfe-chave-drop-zone.drag-over {
  border-color: var(--accent);
  background: #edf9f4;
}
.nfe-chave-drop-zone .drop-icon { font-size: 28px; line-height: 1; }
.nfe-chave-drop-zone .drop-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.nfe-chave-drop-zone .drop-sub {
  font-size: 12px;
  color: var(--muted);
}
/* ---------------------------------------- */

.btn-primary,
.btn-secondary,
.btn-danger {
  min-height: 44px;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: background .2s, opacity .2s, border-color .2s;
  margin-top: 20px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
}

.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }

#page-nf .btn-primary {
  background: var(--accent);
  box-shadow: none;
  min-height: 46px;
}

#page-nf .btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover { border-color: var(--accent); }

.btn-danger {
  background: var(--surface);
  color: var(--red);
  border: 1px solid var(--border);
}

.btn-danger:hover {
  border-color: var(--red);
  background: #fdeceb;
}

.hidden {
  display: none !important;
}

.nf-card {
  background: #f8fafb;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.nf-card.erro { border-color: var(--red); }

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

.nf-arquivo {
  font-weight: 650;
  font-size: 14px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.badge-aviso {
  background: #fff7e8;
  color: var(--yellow);
  border: 1px solid #f1d9a6;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  cursor: help;
  white-space: nowrap;
}

.erro-msg {
  color: var(--red);
  font-size: 14px;
  margin-top: 6px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  width: 100%;
}

#page-nf .manual-form,
#page-nf #revisaoContainer .form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-group label {
  font-size: 14px;
  color: var(--muted);
  font-weight: 650;
}

.field-group input,
.field-group select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 15px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  width: 100%;
}

#page-nf .field-group label {
  color: var(--muted);
  font-weight: 650;
  text-transform: none;
}

#page-nf .field-group input,
#page-nf .field-group select {
  min-height: 44px;
  background: var(--surface);
  border-color: var(--border);
}

#page-nf .field-group input:hover,
#page-nf .field-group select:hover {
  border-color: rgba(15,123,95,0.38);
}

.field-group input:focus,
.field-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15,123,95,.12);
}

.actions-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.actions-bar .btn-primary {
  flex: 1 1 260px;
  width: auto;
  margin-top: 0;
}
.actions-bar .btn-secondary {
  flex: 0 0 auto;
  margin-top: 0;
}

.success-box {
  text-align: center;
  padding: 20px 0;
}

.success-icon {
  width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #e8f4ef;
  color: var(--accent);
  font-weight: 800;
  margin-bottom: 16px;
}

.success-box h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

.success-box p {
  color: var(--muted);
  margin-bottom: 24px;
}

.consulta-card {
  display: block;
  margin-top: 22px;
}

.manual-card {
  display: block;
  margin-top: 22px;
}

#page-nf .manual-card,
#page-nf .consulta-card {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
}

#page-nf .manual-card::before,
#page-nf .consulta-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--accent);
}

.manual-card.nf-manual-hidden {
  display: none !important;
}

.consulta-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  min-width: 0;
}

#page-nf .consulta-header {
  position: relative;
  z-index: 1;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.consulta-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 9px;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}

.consulta-header h2 {
  margin-bottom: 4px;
}

#page-nf .consulta-header h2 {
  margin-bottom: 6px;
  font-size: 20px;
  font-weight: 800;
}

.consulta-header p,
.consulta-status {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.consulta-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr));
  gap: 14px;
  margin: 18px 0;
  max-width: 100%;
}

.summary-card {
  min-height: 82px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f8fafb;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
}

#page-nf .summary-card {
  min-height: 92px;
  background: #f8fafb;
  box-shadow: none;
}

#page-nf .summary-card:first-child {
  background: #f1faf6;
  border-color: #b2dcc8;
}

.summary-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.summary-card strong {
  color: var(--text);
  font-size: 22px;
  line-height: 1;
}

#page-nf .summary-card strong {
  font-size: 22px;
  font-weight: 800;
}

.donut-card {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.mini-donut {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #eef2f4;
  position: relative;
  flex: 0 0 auto;
}

.mini-donut::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: #f8fafb;
}

.consulta-filtros {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 16px;
  align-items: end;
  margin-bottom: 14px;
  max-width: 100%;
  min-width: 0;
}

.filter-date-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.btn-primary.compact,
.btn-secondary.compact,
.btn-danger.compact {
  width: auto;
  min-height: 42px;
  margin-top: 0;
  padding: 10px 17px;
  white-space: nowrap;
  font-size: 14px;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  margin-top: 14px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}

#page-nf .table-wrap {
  border-color: var(--border);
  box-shadow: none;
}

.consulta-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  background: var(--surface);
}

.consulta-table th,
.consulta-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 14px;
  vertical-align: top;
}

.consulta-table th {
  background: #f8fafb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.cadastros-shell {
  display: grid;
  gap: 16px;
}

.admin-loading {
  min-height: 92px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.admin-loading.error {
  color: var(--red);
  background: #fdeceb;
  border-color: #f1b7b1;
}

.cadastros-header,
.cadastros-toolbar,
.cadastro-drawer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.cadastros-header h2 {
  margin: 0 0 6px;
}

.cadastros-header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.cadastros-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cadastros-tab {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
}

.cadastros-tab.active {
  background: #e8f4ef;
  border-color: var(--accent);
  color: var(--accent);
}

.cadastros-toolbar input,
.cadastros-toolbar select {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface);
}

.cadastros-toolbar input {
  flex: 1 1 320px;
}

.cadastros-table td small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.cadastro-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.cadastro-status.ativo {
  background: #e8f4ef;
  color: var(--accent);
}

.cadastro-status.inativo {
  background: #eef2f4;
  color: var(--muted);
}

.cadastro-contab-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 24px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.cadastro-contab-toggle:hover {
  transform: scale(1.07);
}
.cadastro-contab-toggle.ativo {
  background: #e8f4ef;
  color: var(--accent);
}
.cadastro-contab-toggle.vazio {
  background: #f0f2f4;
  color: #b0b8c1;
  letter-spacing: 0.05em;
}
.cadastro-contab-toggle.vazio:hover {
  background: #e8f4ef;
  color: var(--accent);
}

.cadastro-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  justify-content: flex-end;
  background: rgba(12, 18, 26, 0.42);
}

.cadastro-modal-overlay.open {
  display: flex;
}

.cadastro-drawer {
  width: min(460px, 100%);
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -20px 0 50px rgba(16,24,40,.18);
  display: flex;
  flex-direction: column;
}

.cadastro-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
}

.cadastro-drawer-header h2 {
  margin: 0;
  font-size: 20px;
}

.cadastro-form {
  padding: 20px 22px;
  display: grid;
  gap: 14px;
  overflow-y: auto;
}

.cadastro-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.cadastro-form input,
.cadastro-form select,
.cadastro-form textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--surface);
  font: inherit;
}

.cadastro-form input[readonly] {
  background: var(--surface-soft);
  color: var(--muted);
  cursor: not-allowed;
  font-weight: 800;
}

.uso-consumo-alert {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #f1d9a6;
  border-radius: 8px;
  background: #fff7e8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.uso-consumo-alert strong {
  display: block;
  color: var(--yellow);
  margin-bottom: 3px;
}

.uso-consumo-alert span {
  color: var(--muted);
  font-size: 13px;
}

.uso-consumo-status {
  min-width: 140px;
  font-weight: 800;
}

.cadastro-form textarea {
  resize: vertical;
}

#page-nf .nf-card,
#page-nf .card,
#page-nf .nf-step-panel {
  overflow-x: auto;
  overflow-y: visible;
  max-width: 100%;
  min-width: 0;
}

#page-nf .consulta-table th {
  background: #f8fafb;
  color: var(--muted);
}

#page-nf .consulta-table td {
  background: var(--surface);
}

#page-nf .consulta-table tbody tr:hover td {
  background: #f7fbfa;
}

.sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0;
}

.sort-btn:hover {
  color: var(--accent);
}

.sort-indicator {
  color: #9aa6b2;
  font-size: 12px;
  line-height: 1;
}

.sort-indicator.active {
  color: var(--accent);
}

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

.consulta-table td:nth-child(4) {
  font-weight: 700;
  white-space: nowrap;
}

.consulta-table th:nth-child(1),
.consulta-table td:nth-child(1),
.consulta-table th:nth-child(2),
.consulta-table td:nth-child(2),
.consulta-table th:nth-child(4),
.consulta-table td:nth-child(4) {
  white-space: nowrap;
}

.consulta-table th:nth-child(1),
.consulta-table td:nth-child(1) {
  width: 96px;
}

.consulta-table th:nth-child(4),
.consulta-table td:nth-child(4) {
  width: 120px;
}

.empty-cell {
  color: var(--muted);
  text-align: center !important;
}

.manual-form {
  margin-top: 8px;
}

.full-field {
  grid-column: 1 / -1;
}

.manual-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

.table-action {
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--blue);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

#page-nf .table-action {
  background: var(--surface-soft);
  box-shadow: none;
}

.table-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
}

.table-action:hover {
  border-color: var(--blue);
  background: #eef4fb;
}

.danger-action,
.btn-danger {
  color: var(--red);
}

.danger-action:hover,
.btn-danger:hover {
  border-color: var(--red);
  background: #fdeceb;
}

.table-action:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: .55;
}

.fiscal-report {
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f8fafb;
  padding: 0;
  overflow: hidden;
}

.fiscal-report-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}

.fiscal-report-summary::-webkit-details-marker {
  display: none;
}

.fiscal-report-summary:hover {
  background: #f1f6f4;
}

.fiscal-report-body {
  border-top: 1px solid var(--border);
  padding: 14px 16px 16px;
}

.fiscal-summary-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex: 0 0 auto;
}

.fiscal-expand-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.fiscal-report[open] .fiscal-expand-label {
  font-size: 0;
}

.fiscal-report[open] .fiscal-expand-label::after {
  content: "Recolher laudo";
  font-size: 11px;
}

.fiscal-summary-alert {
  max-width: 680px;
  color: var(--yellow) !important;
  font-weight: 700;
}

.fiscal-summary-alert.ok {
  color: var(--accent) !important;
}

.fiscal-kicker {
  display: inline-flex;
  margin-bottom: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(15,123,95,.1);
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.fiscal-report h3,
.fiscal-report h4 {
  margin: 0;
  color: var(--text);
}

.fiscal-report h3 {
  font-size: 16px;
}

.fiscal-report h4 {
  font-size: 13px;
  margin-bottom: 10px;
}

.fiscal-report p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin-top: 4px;
}

.fiscal-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.fiscal-status.aprovada { background: #22c55e; }
.fiscal-status.aprovada-com-alertas { background: #f59e0b; }
.fiscal-status.pendencia-fiscal { background: #f97316; }
.fiscal-status.erro { background: #ef4444; }

.fiscal-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.fiscal-summary-item,
.fiscal-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
}

.fiscal-summary-item span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.fiscal-summary-item strong {
  color: var(--text);
  font-size: 16px;
}

.fiscal-summary-item strong.bad {
  color: var(--red);
}

.fiscal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.fiscal-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid #edf2f5;
  color: var(--muted);
  font-size: 12px;
}

.fiscal-row:last-child {
  border-bottom: 0;
}

.fiscal-row strong {
  color: var(--text);
  text-align: right;
}

.fiscal-row strong.ok {
  color: var(--accent);
}

.fiscal-row strong.bad {
  color: var(--red);
}

.fiscal-alerts,
.fiscal-requirements,
.fiscal-actions {
  margin-top: 12px;
}

.fiscal-alert,
.fiscal-requirement,
.fiscal-action-item,
.fiscal-empty {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--border);
  border-left: 4px solid #64748b;
  border-radius: var(--radius);
  background: var(--surface);
  padding: 10px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  margin-top: 7px;
}

.fiscal-alert.erro { border-left-color: #ef4444; }
.fiscal-alert.alerta { border-left-color: #f59e0b; }
.fiscal-alert.informacao { border-left-color: #3b82f6; }

.fiscal-alert strong,
.fiscal-requirement strong {
  min-width: 78px;
  font-size: 10px;
  font-weight: 850;
  color: var(--muted);
}

.fiscal-requirement.ok {
  border-left-color: #22c55e;
}

.fiscal-requirement.check {
  border-left-color: #f59e0b;
}

.fiscal-requirement div {
  flex: 1;
}

.fiscal-requirement span {
  display: block;
  color: var(--text);
  font-weight: 800;
  margin-bottom: 2px;
}

.fiscal-requirement p {
  margin: 0;
  color: var(--muted);
}

.fiscal-action-item {
  border-left-color: var(--accent);
}

.fiscal-empty {
  color: var(--muted);
  justify-content: center;
}

.loading {
  position: fixed;
  inset: 0;
  background: rgba(23,32,44,.65);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 999;
}

.loading.hidden { display: none; }

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255,255,255,.45);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

#loadingMsg {
  color: #ffffff;
  font-size: 15px;
}

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

@media (max-width: 768px) {
  .mobile-header { display: flex; }

  .sidebar-collapse-btn,
  .sidebar-expand-btn {
    display: none !important;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    pointer-events: auto;
  }

  .sidebar.open { transform: translateX(0); }

  /* No mobile o drawer nao usa a classe desktop */
  .portal-layout.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
  }

  .portal-layout.sidebar-collapsed .sidebar.open {
    transform: translateX(0);
    pointer-events: auto;
  }

  .portal-content {
    margin-left: 0;
    width: 100%;
    max-width: 100vw;
    padding: 72px 16px 60px;
  }

  .portal-layout.sidebar-collapsed .portal-content {
    margin-left: 0;
    width: 100%;
    max-width: 100vw;
  }

  .page.active {
    width: 100%;
    max-width: none;
  }

  .nf-slim-header { flex-direction: column; }

  #page-nf .manual-form,
  #page-nf #revisaoContainer .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Home V2 — tablet/mobile */
  .home-topbar {
    flex-wrap: wrap;
    gap: 10px;
    padding-bottom: 12px;
    margin-bottom: 20px;
  }

  .home-tabs { overflow-x: auto; flex-shrink: 0; }

  .home-topbar-end { gap: 6px; }

  .home-search-input { width: 160px; }
  .home-search-input:focus { width: 190px; }

  .home-hero-v2 {
    flex-direction: column;
    gap: 14px;
    margin-bottom: 18px;
  }

  .btn-nova-solicitacao { align-self: flex-start; }

  .kpi-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
  }

  .quick-access-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}

@media (max-width: 600px) {
  .card { padding: 20px; }
  .form-grid { grid-template-columns: 1fr; }
  #page-nf .manual-form,
  #page-nf #revisaoContainer .form-grid { grid-template-columns: 1fr; }
  .tipo-selector { flex-direction: column; }
  .actions-bar { flex-direction: column; }
  .actions-bar .btn-secondary,
  .actions-bar .btn-primary { width: 100%; margin-top: 0; }
  .consulta-header { flex-direction: column; }
  .consulta-actions { width: 100%; justify-content: stretch; }
  .consulta-actions .compact { flex: 1 1 100%; }
  .consulta-summary { grid-template-columns: 1fr; }
  .consulta-filtros { grid-template-columns: 1fr; }
  .filter-date-pair { grid-template-columns: 1fr; }
  .manual-actions { flex-direction: column; }
  .fiscal-report-summary,
  .fiscal-grid { grid-template-columns: 1fr; flex-direction: column; }
  .fiscal-summary-side { align-items: flex-start; }
  .fiscal-summary-grid { grid-template-columns: 1fr; }
  .btn-primary.compact,
  .btn-secondary.compact { width: 100%; }

  #page-nf .tipo-selector {
    grid-template-columns: 1fr;
  }

  #page-nf .drop-zone {
    min-height: 130px;
    padding: 24px 16px;
  }

  /* Home V2 — mobile estreito */
  .home-topbar { padding-bottom: 10px; margin-bottom: 14px; }

  .home-search-wrap { display: none; }

  .home-title-v2 { font-size: 20px !important; }

  .home-quote-v2 { font-size: 12px; }

  .kpi-row { grid-template-columns: 1fr; gap: 10px; }

  .kpi-card { padding: 16px 18px; gap: 14px; }

  .kpi-icon-wrap { width: 42px; height: 42px; }

  .kpi-value { font-size: 26px; }

  .quick-access-grid { grid-template-columns: 1fr; gap: 10px; margin-bottom: 60px; }

  .nfe-chave-actions { flex-direction: column; }
  .nfe-chave-actions .btn-secondary { width: 100%; }
}

/* --- Home Dashboard Styles --- */
.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  align-items: center;
  gap: 24px;
  background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 68%);
  border: 1px solid rgba(15,123,95,.16);
  border-radius: 16px;
  margin-bottom: 22px;
  padding: clamp(22px, 3vw, 32px);
  box-shadow: 0 8px 24px rgba(16,24,40,.06);
}

.home-user-summary,
.profile-summary,
.account-meta-grid {
  margin-top: 0;
}

.home-user-summary {
  display: grid;
  gap: 16px;
  padding: 16px;
  border: 1px solid rgba(15,123,95,.16);
  border-radius: 8px;
  background: rgba(255,255,255,.82);
  box-shadow: 0 1px 3px rgba(16,24,40,.05);
}

.home-user-main,
.profile-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.home-user-main img,
.profile-summary img,
.home-user-main > span,
.profile-summary > span {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 50%;
  object-fit: cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
}

.home-user-main strong,
.profile-summary h2 {
  display: block;
  color: var(--text);
  font-size: 15px;
}

.home-user-main small,
.profile-summary p {
  display: block;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.home-user-details,
.account-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.home-user-details span,
.account-meta-grid div {
  padding: 9px 11px;
  border-radius: 8px;
  background: #f8fafb;
  color: var(--muted);
  font-size: 12px;
}

.home-user-details span {
  display: grid;
  gap: 3px;
}

.home-user-details strong,
.account-meta-grid strong {
  color: var(--text);
}

.account-meta-grid span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.home-hero-kicker {
  display: inline-flex;
  margin-bottom: 10px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(15,123,95,.1);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.home-hero .page-title {
  font-size: clamp(28px, 3vw, 36px);
  line-height: 1.15;
  letter-spacing: 0;
}

.home-hero .page-sub {
  max-width: 680px;
  line-height: 1.55;
}

.home-quote {
  max-width: 760px;
  margin-top: 12px;
  color: #334155;
  font-size: 16px;
  line-height: 1.6;
}

.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 26px;
}

.insight-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}

.insight-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.insight-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.insight-note {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}

.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.module-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
  min-height: 190px;
}

.module-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  border-color: var(--accent);
}

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

.module-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(15,123,95,0.1);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
}

.module-icon.blue {
  background: rgba(36,88,166,.1);
  color: var(--blue);
}

.module-icon.yellow {
  background: rgba(163,106,0,.1);
  color: var(--yellow);
}

.module-icon.neutral {
  background: rgba(102,115,132,.12);
  color: var(--muted);
}

.module-status {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.module-status.available {
  background: rgba(15,123,95,0.1);
  color: var(--accent);
}

.module-status.soon {
  background: rgba(102,115,132,0.1);
  color: var(--muted);
}

.module-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

.module-card p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 16px;
  flex: 1;
}

.module-action {
  font-size: 13px;
  color: var(--blue);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.module-card:hover .module-action {
  color: var(--accent);
}

/* --- Advanced Dashboard Charts --- */

.dashboard-wrapper {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 26px;
}

@media (max-width: 900px) {
  .dashboard-wrapper {
    grid-template-columns: 1fr;
  }
}

.chart-widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  min-height: 292px;
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}

.widget-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  gap: 14px;
}

.widget-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.widget-subtitle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.widget-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.dashboard-wrapper .widget-select {
  display: none;
}

.widget-select, .widget-btn {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--muted);
  cursor: pointer;
}

.widget-btn:hover, .widget-select:hover {
  background: var(--border);
}

.fake-bar-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 180px;
  padding-top: 10px;
  gap: 7px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.fake-bar-chart::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  border-top: 1px dashed var(--border);
  z-index: 0;
  opacity: 0.5;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  height: 100%;
  position: relative;
  z-index: 1;
}

.bar {
  width: 70%;
  background: var(--sidebar-muted);
  border-radius: 4px 4px 0 0;
  transition: height 0.3s ease, background 0.3s;
}

.bar-col:nth-child(1) .bar { height: 38% !important; }
.bar-col:nth-child(2) .bar { height: 52% !important; }
.bar-col:nth-child(3) .bar { height: 61% !important; }
.bar-col:nth-child(4) .bar { height: 48% !important; }
.bar-col:nth-child(5) .bar { height: 76% !important; }
.bar-col:nth-child(6) .bar { height: 66% !important; }
.bar-col:nth-child(7) .bar { height: 82% !important; }
.bar-col:nth-child(8) .bar { height: 74% !important; }
.bar-col:nth-child(9) .bar { height: 90% !important; background: var(--accent); }
.bar-col:nth-child(10) .bar { height: 69% !important; }
.bar-col:nth-child(11) .bar { height: 57% !important; }
.bar-col:nth-child(12) .bar { height: 44% !important; }

.bar-col:hover .bar {
  background: var(--blue);
}

.bar-lbl {
  font-size: 0;
  color: var(--muted);
  margin-top: 8px;
}

.bar-lbl::after {
  font-size: 11px;
}

.bar-col:nth-child(1) .bar-lbl::after { content: "Jan"; }
.bar-col:nth-child(2) .bar-lbl::after { content: "Fev"; }
.bar-col:nth-child(3) .bar-lbl::after { content: "Mar"; }
.bar-col:nth-child(4) .bar-lbl::after { content: "Abr"; }
.bar-col:nth-child(5) .bar-lbl::after { content: "Mai"; }
.bar-col:nth-child(6) .bar-lbl::after { content: "Jun"; }
.bar-col:nth-child(7) .bar-lbl::after { content: "Jul"; }
.bar-col:nth-child(8) .bar-lbl::after { content: "Ago"; }
.bar-col:nth-child(9) .bar-lbl::after { content: "Set"; }
.bar-col:nth-child(10) .bar-lbl::after { content: "Out"; }
.bar-col:nth-child(11) .bar-lbl::after { content: "Nov"; }
.bar-col:nth-child(12) .bar-lbl::after { content: "Dez"; }

.fake-donut-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 24px;
}

.fake-donut {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) 0% 65%, #f39c12 65% 85%, #e74c3c 85% 100%);
  position: relative;
}

.fake-donut::after {
  content: attr(data-total);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90px;
  height: 90px;
  background: var(--surface);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.legend-item {
  display: flex;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  gap: 8px;
}

.legend-item .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* Insight card enhancements */
.insight-card.highlight-card {
  flex-direction: row;
  align-items: center;
  gap: 16px;
  padding: 24px;
}

.insight-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.insight-info {
  display: flex;
  flex-direction: column;
}

.insight-info .insight-label { margin-bottom: 4px; }
.insight-info .insight-value { margin-bottom: 2px; }

/* --- Home V2 --- */
.home-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  max-width: 100%;
  min-width: 0;
}

.home-tabs { display: flex; gap: 0; }

.home-tab {
  padding: 8px 18px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -15px;
  transition: color .15s, border-color .15s;
  font-family: inherit;
}

.home-tab:hover { color: var(--text); }

.home-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.home-topbar-end {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.home-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.home-search-icon {
  position: absolute;
  left: 10px;
  width: 15px;
  height: 15px;
  color: var(--muted);
  pointer-events: none;
}

.home-search-input {
  padding: 7px 12px 7px 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  font-size: 13px;
  color: var(--text);
  width: 200px;
  transition: border-color .15s, width .2s;
  font-family: inherit;
}

.home-search-input::placeholder { color: var(--muted); }

.home-search-input:focus {
  outline: none;
  border-color: var(--accent);
  width: 260px;
}

.topbar-icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
}

.topbar-icon-btn:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.topbar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--accent);
  transition: box-shadow .15s;
}

.topbar-avatar:hover { box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--accent-hover); }

.topbar-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-hero-v2 {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.home-title-v2 {
  font-size: clamp(22px, 2.2vw, 30px) !important;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 7px;
}

.home-quote-v2 {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
  line-height: 1.6;
  max-width: 520px;
}

.btn-nova-solicitacao {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background .15s;
  font-family: inherit;
}

.btn-nova-solicitacao:hover { background: var(--accent-hover); }

.kpi-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
  max-width: 100%;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 1px 3px rgba(16,24,40,.04);
}

.kpi-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon-wrap.kpi-green { background: rgba(15,123,95,.1); color: var(--accent); }
.kpi-icon-wrap.kpi-orange { background: rgba(243,156,18,.1); color: #f39c12; }
.kpi-icon-wrap.kpi-blue { background: rgba(36,88,166,.1); color: var(--blue); }

.kpi-body { flex: 1; min-width: 0; }

.kpi-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.kpi-value {
  font-size: clamp(26px, 2.4vw, 32px);
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  margin-bottom: 5px;
}

.kpi-note {
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.kpi-note-green { color: var(--accent); }
.kpi-note-orange { color: #f39c12; }
.kpi-note-blue { color: var(--blue); }

.widget-year-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  white-space: nowrap;
}

.legend-label { flex: 1; }

.legend-count {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  min-width: 32px;
  text-align: right;
}

.section-title-v2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  margin-top: 6px;
}

.quick-access-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 80px;
}

.quick-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}

.quick-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,.07);
  border-color: var(--accent);
}

.quick-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  margin-bottom: 14px;
  transition: background .15s;
}

.quick-card-icon svg { width: 20px; height: 20px; }

.quick-card:hover .quick-card-icon {
  background: rgba(15,123,95,.08);
  border-color: rgba(15,123,95,.25);
}

.quick-card-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.quick-card-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  flex: 1;
  margin-bottom: 18px;
}

.quick-card-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--accent);
  transition: gap .15s;
}

.quick-card:hover .quick-card-action { gap: 9px; }

.fab-btn {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px rgba(15,123,95,.45);
  z-index: 100;
  transition: background .15s, transform .15s, box-shadow .15s;
}

#page-home.active .fab-btn { display: inline-flex; }

.fab-btn:hover {
  background: var(--accent-hover);
  transform: scale(1.08);
  box-shadow: 0 6px 22px rgba(15,123,95,.5);
}

@media (max-width: 1100px) {
  .quick-access-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Home V2 — gráficos responsivos (overflow controlado em mobile) */
@media (max-width: 768px) {
  #page-home canvas,
  #page-home .chart-wrap {
    max-width: 100%;
    overflow-x: auto;
  }
  #page-home .widget-grid,
  #page-home .charts-row {
    grid-template-columns: 1fr !important;
    gap: 14px;
  }
}

@media (max-width: 700px) {
  .kpi-row { grid-template-columns: 1fr; }
  .quick-access-grid { grid-template-columns: 1fr; }
  .home-hero-v2 { flex-direction: column; align-items: flex-start; }
  .home-topbar { flex-wrap: wrap; gap: 10px; }
  .home-search-input { width: 140px; }
  .home-search-input:focus { width: 170px; }
  .home-tabs { order: 2; width: 100%; }
  .home-topbar-end { order: 1; margin-left: auto; }
}

/* --- Minha Conta (mc-*) --- */
.mc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 960px) {
  .mc-grid { grid-template-columns: 1fr; }
}

.mc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(16,24,40,.04);
}

.mc-profile-card {
  margin-bottom: 20px;
}

.mc-profile-main {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}

.mc-avatar-lg {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px rgba(15,123,95,.25);
}

.mc-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mc-avatar-initials {
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}

.mc-profile-info {
  flex: 1;
  min-width: 0;
}

.mc-profile-name {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 3px;
}

.mc-profile-email {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}

.mc-profile-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mc-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
}

.mc-badge-accent { background: rgba(15,123,95,.1); color: var(--accent); border: 1px solid rgba(15,123,95,.2); }
.mc-badge-success { background: rgba(39,174,96,.1); color: #27ae60; border: 1px solid rgba(39,174,96,.2); }
.mc-badge-warning { background: rgba(243,156,18,.1); color: #e67e22; border: 1px solid rgba(243,156,18,.2); }
.mc-badge-neutral { background: var(--surface-soft); color: var(--muted); border: 1px solid var(--border); }
.mc-badge-group { background: rgba(36,88,166,.08); color: var(--blue); border: 1px solid rgba(36,88,166,.18); }

.mc-info-divider {
  height: 1px;
  background: var(--border);
  margin-bottom: 20px;
}

.mc-info-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 700px) {
  .mc-info-grid { grid-template-columns: repeat(2, 1fr); }
}

.mc-info-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mc-info-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}

.mc-info-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}

.mc-val-active { color: #27ae60; }
.mc-val-pending { color: #e67e22; }

.mc-card-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.mc-section-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mc-icon-access { background: rgba(36,88,166,.08); color: var(--blue); }
.mc-icon-security { background: rgba(15,123,95,.1); color: var(--accent); }

.mc-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.mc-section-sub {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.mc-subsection {
  margin-bottom: 24px;
}

.mc-subsection:last-child { margin-bottom: 0; }

.mc-subsection-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mc-perm-count {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.mc-subsection-desc {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 14px;
  line-height: 1.5;
}

.mc-groups-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mc-group-tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 8px;
  background: rgba(36,88,166,.06);
  border: 1px solid rgba(36,88,166,.18);
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.mc-empty-text {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
}

.mc-perm-groups {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mc-perm-module {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mc-perm-module-name {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

.mc-perm-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.mc-perm-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--muted);
}

.mc-chip-write {
  background: rgba(36,88,166,.06);
  border-color: rgba(36,88,166,.2);
  color: var(--blue);
}

.mc-chip-danger {
  background: rgba(192,57,43,.06);
  border-color: rgba(192,57,43,.2);
  color: var(--red);
}

/* Security form */
.mc-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.mc-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mc-field-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .02em;
}

.mc-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.mc-input {
  width: 100%;
  padding: 10px 40px 10px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}

.mc-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15,123,95,.1);
}

.mc-toggle-pass {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  padding: 4px;
  border-radius: 4px;
  transition: color .15s;
}

.mc-toggle-pass:hover { color: var(--text); }

.mc-strength-bar {
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}

.mc-strength-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  transition: width .3s ease, background .3s ease;
}

.mc-strength-label {
  font-size: 11px;
  font-weight: 700;
  margin-top: 3px;
  min-height: 16px;
  display: block;
}

.mc-security-tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(15,123,95,.05);
  border: 1px solid rgba(15,123,95,.15);
  border-radius: 8px;
  color: var(--accent);
  font-size: 12px;
  line-height: 1.5;
}

.mc-security-tip svg { flex-shrink: 0; margin-top: 1px; }

.mc-save-btn {
  width: 100%;
  padding: 11px;
  font-size: 14px;
}

.mc-status-msg {
  font-size: 13px;
  font-weight: 600;
  min-height: 20px;
  text-align: center;
}

.mc-status-ok { color: #27ae60; }
.mc-status-error { color: var(--red); }

/* --- Fleet Module --- */
#page-frota.page.active { max-width: none; }

.fleet-shell {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
  min-width: 0;
}

.fleet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}

.fleet-eyebrow {
  display: inline-flex;
  margin-bottom: 9px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(15,123,95,.1);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.fleet-header-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.fleet-filter-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.fleet-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  max-width: 100%;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}

.fleet-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: #f8fafb;
  color: #34445a;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
  cursor: pointer;
  transition: background .16s, color .16s, border-color .16s, box-shadow .16s;
}

.fleet-tab:hover {
  border-color: #b9c5d1;
  color: var(--text);
}

.fleet-tab.active {
  background: #e8f4ef;
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15,123,95,.08);
}

#page-nf .nf-tabs {
  padding: 8px;
  border-radius: 12px;
}

#page-nf .nf-tabs .fleet-tab {
  min-height: 46px;
  padding: 12px 18px;
  font-size: 14px;
}

.fleet-tab.primary-tab {
  min-width: 150px;
  justify-content: center;
}

.fleet-tab-panel {
  display: none;
}

.fleet-tab-panel.active {
  display: block;
}

.fleet-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.fleet-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
  min-height: 112px;
}

.fleet-kpi-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.fleet-kpi-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(15,123,95,.1);
  color: var(--accent);
  font-size: 12px;
}

.fleet-kpi-value {
  margin-top: 12px;
  font-size: 26px;
  font-weight: 850;
  color: var(--text);
}

.fleet-kpi-note {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.fleet-overview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.fleet-overview-grid.compact {
  grid-template-columns: .9fr 1.1fr;
}

.fleet-section-grid {
  display: grid;
  grid-template-columns: minmax(320px, .8fr) minmax(0, 1.2fr);
  gap: 16px;
  min-width: 0;
}

.fleet-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
  min-width: 0;
}

.fleet-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.fleet-panel-header h2 {
  font-size: 16px;
  margin: 0;
  color: var(--text);
}

.fleet-panel-header p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin-top: 4px;
}

.fleet-form .btn-primary {
  width: auto;
}

.fleet-local-filters {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(130px, .55fr);
  gap: 10px;
  margin-bottom: 12px;
}

.fleet-local-filters input,
.fleet-local-filters select,
.fleet-panel-header select {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 8px 10px;
  color: var(--text);
  font-size: 13px;
}

.fleet-table-wrap {
  margin-top: 0;
}

.fleet-table {
  min-width: 930px;
}

.fleet-table .table-action {
  margin-right: 5px;
}

.fleet-vehicles-table {
  min-width: 720px;
}

.fleet-vehicles-table th:nth-child(1),
.fleet-vehicles-table td:nth-child(1) {
  width: 22%;
}

.fleet-vehicles-table th:nth-child(2),
.fleet-vehicles-table td:nth-child(2),
.fleet-vehicles-table th:nth-child(4),
.fleet-vehicles-table td:nth-child(4),
.fleet-vehicles-table th:nth-child(5),
.fleet-vehicles-table td:nth-child(5) {
  width: 105px;
  white-space: nowrap;
}

.fleet-vehicles-table th:nth-child(6),
.fleet-vehicles-table td:nth-child(6) {
  width: 220px;
  white-space: nowrap;
}

.fleet-actions-cell {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
}

.fleet-table .danger-action {
  color: var(--red);
}

.fleet-table .danger-action:hover {
  border-color: var(--red);
  background: #fdeceb;
}

.fleet-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.fleet-status.active,
.fleet-status.ativo,
.fleet-status.concluida {
  background: rgba(15,123,95,.1);
  color: var(--accent);
}

.fleet-status.warning,
.fleet-status.em-manutencao,
.fleet-status.agendada,
.fleet-status.em-andamento,
.fleet-status.afastado {
  background: #fff7e8;
  color: var(--yellow);
}

.fleet-status.danger,
.fleet-status.inativo,
.fleet-status.vendido,
.fleet-status.cancelada {
  background: #fdeceb;
  color: var(--red);
}

.fleet-chart-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.contratos-resp-filtros {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(150px, 210px) minmax(150px, 210px);
  gap: 8px;
  padding: 0 12px 12px;
}

.contratos-resp-filtros input,
.contratos-resp-filtros select {
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

@media (max-width: 760px) {
  .contratos-resp-filtros { grid-template-columns: 1fr; }
}

.fleet-chart-row {
  display: grid;
  grid-template-columns: minmax(120px, .7fr) minmax(140px, 1fr) minmax(80px, auto);
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.fleet-chart-label {
  color: var(--text);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fleet-chart-track {
  height: 10px;
  border-radius: 999px;
  background: #edf2f5;
  overflow: hidden;
}

.fleet-chart-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.fleet-chart-value {
  color: var(--muted);
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.fleet-month-chart {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  min-height: 190px;
  padding-top: 12px;
  border-bottom: 1px solid var(--border);
}

.fleet-month-bar {
  flex: 1;
  min-width: 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.fleet-month-bar span:first-child {
  width: 100%;
  min-height: 8px;
  border-radius: 5px 5px 0 0;
  background: var(--accent);
}

.fleet-column-chart {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  min-height: 230px;
  padding: 16px 12px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f8fafb;
  overflow-x: auto;
}

.fleet-column {
  min-width: 62px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.fleet-column-value {
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.fleet-column-bar {
  width: 72%;
  min-height: 12px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #18a078 0%, var(--accent) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2);
}

.fleet-column-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.fleet-alert-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fleet-alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: #f8fafb;
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
}

.fleet-alert.warning {
  border-left-color: var(--yellow);
}

.fleet-alert.danger {
  border-left-color: var(--red);
}

.fleet-insight-grid,
.fleet-mini-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 10px;
}

.fleet-insight,
.fleet-mini-kpi {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f8fafb;
  padding: 12px;
}

.fleet-insight span,
.fleet-mini-kpi span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 7px;
}

.fleet-insight strong,
.fleet-mini-kpi strong {
  display: block;
  color: var(--text);
  font-size: 16px;
  line-height: 1.3;
}

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

.fleet-detail-block {
  margin-top: 16px;
}

.fleet-detail-block h3 {
  font-size: 14px;
  margin-bottom: 9px;
}

.fleet-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 14px;
  text-align: center;
}

.fleet-fuel-field.hidden {
  display: none;
}

.fleet-sim-shell {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.fleet-sim-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.fleet-sim-hero h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.fleet-sim-hero p {
  color: var(--muted);
  font-size: 13px;
}

.fleet-sim-badge {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: #f8fafb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.fleet-sim-grid.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.fleet-sim-card,
.fleet-sim-detail {
  position: relative;
  overflow: hidden;
}

.fleet-sim-card::before,
.fleet-sim-detail::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
}

.fleet-sim-card.electric::before,
.fleet-sim-detail.electric::before {
  background: var(--accent);
}

.fleet-sim-card.combustion::before,
.fleet-sim-detail.combustion::before {
  background: var(--red);
}

.fleet-sim-card-title {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.fleet-sim-option-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fleet-sim-option {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  min-height: 58px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafb;
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}

.fleet-sim-option span {
  color: var(--muted);
  font-size: 12px;
}

.fleet-sim-option.active.electric {
  border-color: var(--accent);
  background: #eef8f4;
}

.fleet-sim-option.active.hybrid {
  border-color: #8b5cf6;
  background: #f4f0ff;
}

.fleet-sim-option.active.combustion {
  border-color: var(--red);
  background: #fff1f0;
}

.fleet-sim-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fleet-sim-term {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.fleet-sim-term button {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafb;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.fleet-sim-term button.active {
  border-color: var(--blue);
  color: var(--blue);
  background: #eef4fb;
}

.fleet-sim-slider {
  display: grid;
  grid-template-columns: 220px minmax(140px, 1fr) 100px;
  gap: 14px;
  align-items: center;
}

.fleet-sim-slider label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.fleet-sim-slider input[type="range"] {
  width: 100%;
}

.fleet-sim-slider strong {
  text-align: right;
  font-size: 12px;
}

.fleet-sim-verdict {
  border: 1px solid;
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fleet-sim-verdict.win {
  background: #eef8f4;
  border-color: rgba(15,123,95,.24);
}

.fleet-sim-verdict.lose {
  background: #fff1f0;
  border-color: rgba(192,57,43,.24);
}

.fleet-sim-verdict strong {
  color: var(--text);
  font-size: 14px;
}

.fleet-sim-verdict span {
  color: var(--muted);
  font-size: 13px;
}

.fleet-sim-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
}

.fleet-sim-detail h2 {
  font-size: 16px;
  margin: 0 0 12px;
}

.fleet-sim-detail div:not(.fleet-panel-header) {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.fleet-sim-detail span {
  color: var(--muted);
  font-size: 12px;
}

.fleet-sim-detail strong {
  font-size: 13px;
}

.fleet-sim-detail .total strong {
  color: var(--accent);
  font-size: 15px;
}

.fleet-sim-detail.combustion .total strong {
  color: var(--red);
}

.fleet-sim-chart-wrap {
  position: relative;
  width: 100%;
  height: 300px;
}

@media (max-width: 900px) {
  .fleet-sim-grid.two,
  .fleet-sim-kpis {
    grid-template-columns: 1fr;
  }

  .fleet-sim-slider {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .fleet-sim-slider strong {
    text-align: left;
  }

  .fleet-sim-hero {
    flex-direction: column;
  }
}

@media (max-width: 1180px) {
  .fleet-filter-card,
  .fleet-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fleet-section-grid,
  .fleet-overview-grid,
  .fleet-overview-grid.compact {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .fleet-header,
  .fleet-panel-header {
    flex-direction: column;
  }

  .fleet-header-actions,
  .fleet-header-actions .compact {
    width: 100%;
  }

  .fleet-filter-card,
  .fleet-kpi-grid,
  .fleet-local-filters,
  .fleet-insight-grid,
  .fleet-mini-kpis,
  .fleet-details-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── Módulo Contratos ──────────────────────────────────────── */

#page-contratos.page.active { max-width: none; }

.contratos-tab-panel {
  display: none;
}

.contratos-tab-panel.active {
  display: block;
}

.contratos-kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
  margin-bottom: 16px;
}

.contratos-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.contratos-dashboard-bottom {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.resp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.resp-table thead th {
  text-align: left;
  font-weight: 700;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 0 8px 8px;
  border-bottom: 1px solid var(--border);
}
.resp-table tbody tr:hover { background: var(--hover); }
.resp-table tbody td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.resp-table tbody td:last-child {
  font-weight: 700;
  color: var(--accent);
  text-align: right;
  width: 60px;
}
.resp-table tbody tr:last-child td { border-bottom: none; }
.resp-table tbody td:last-child { width: auto; min-width: 130px; }
.resp-table tfoot th {
  padding: 9px 8px 2px;
  border-top: 2px solid var(--border);
  color: var(--text);
  font-size: 12px;
}

#page-analises.page.active { max-width: none; }

.analises-shell .fleet-header {
  background: linear-gradient(90deg, #f1fbf7 0%, #fff 100%);
  border-color: #cfeee3;
}

.analises-filter-panel {
  margin-top: 4px;
}

.analises-filtros {
  grid-template-columns: minmax(160px, .7fr) minmax(240px, 1.3fr) minmax(140px, .7fr) minmax(150px, .7fr) minmax(130px, .6fr) auto;
  align-items: end;
}

.analises-pivot-table {
  min-width: 1200px;
}

.analises-detail-table {
  min-width: 1200px;
}

.analises-pivot-table th,
.analises-detail-table th {
  white-space: nowrap;
}

.analises-pivot-table td,
.analises-detail-table td {
  vertical-align: top;
}

/* ── KPI adaptativo para valores grandes ──────────────────────── */
.fleet-kpi-value-compact {
  font-size: 20px;
  font-weight: 850;
  color: var(--text);
  word-break: break-word;
}

.fleet-kpi-danger .fleet-kpi-icon {
  background: rgba(220,38,38,.12);
  color: #dc2626;
}
.fleet-kpi-danger .fleet-kpi-value { color: #dc2626; }

.fleet-kpi-warning .fleet-kpi-icon {
  background: rgba(234,88,12,.12);
  color: #ea580c;
}
.fleet-kpi-warning .fleet-kpi-value { color: #ea580c; }

.fleet-kpi-caution .fleet-kpi-icon {
  background: rgba(202,138,4,.12);
  color: #ca8a04;
}
.fleet-kpi-caution .fleet-kpi-value { color: #ca8a04; }

/* ── Badges de risco ──────────────────────────────────────────── */
.an-risco-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.an-risco-alto  { background: #fee2e2; color: #dc2626; }
.an-risco-medio { background: #fef3c7; color: #b45309; }
.an-risco-baixo { background: #dcfce7; color: #15803d; }

/* ── Alertas contratuais ──────────────────────────────────────── */
.an-alertas-section .fleet-panel-header { margin-bottom: 12px; }

.an-alertas-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.an-alerta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
}
.an-alerta-danger  { background: #fff5f5; border-color: #fca5a5; }
.an-alerta-warning { background: #fff7ed; border-color: #fdba74; }
.an-alerta-caution { background: #fefce8; border-color: #fde047; }
.an-alerta-info    { background: #f0f9ff; border-color: #bae6fd; }

.an-alerta-icon { font-size: 20px; flex-shrink: 0; }

.an-alerta-body { flex: 1; min-width: 0; }
.an-alerta-titulo { font-weight: 700; font-size: 13px; color: var(--text); }
.an-alerta-desc   { font-size: 12px; color: var(--muted); margin-top: 1px; }

.an-alerta-qtd {
  font-size: 22px;
  font-weight: 850;
  color: var(--text);
  flex-shrink: 0;
  min-width: 36px;
  text-align: right;
}

.an-alerta-btn {
  flex-shrink: 0;
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: var(--accent);
  transition: border-color .15s;
}
.an-alerta-btn:hover { border-color: var(--accent); background: #f0fdf4; }

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

.contratos-quick-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 14px;
}

.contratos-quick-filters button {
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafb;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.contratos-quick-filters button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.contratos-quick-filters button.active {
  background: #e8f4ef;
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15,123,95,.08);
}

/* Linhas da tabela com alertas */
.contratos-row-muted { opacity: 0.55; }
.contratos-row-critico td { background: #fff5f5 !important; }
.contratos-row-proximo td { background: #fff9f0 !important; }
.contratos-row-urgente td { background: #fff8f0 !important; }
.contratos-row-atencao td { background: #fffdf0 !important; }

/* Badges de alerta de vencimento */
.contratos-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
  margin-left: 4px;
  vertical-align: middle;
}

.contratos-badge.vencido  { background: #fdeceb; color: var(--red);    border: 1px solid #f5c6c3; }
.contratos-badge.critico  { background: #fdeceb; color: var(--red);    border: 1px solid #f5c6c3; }
.contratos-badge.proximo  { background: #fff3e8; color: #b86400;       border: 1px solid #f5d5b5; }
.contratos-badge.urgente  { background: #fff3e8; color: #e67e22;       border: 1px solid #f5d5b5; }
.contratos-badge.atencao  { background: #fffbe8; color: var(--yellow); border: 1px solid #f5e8b5; }
.contratos-badge.localizar { background: #fdeceb; color: var(--red);   border: 1px solid #f5c6c3; }

/* Tabela de contratos */
.contratos-table { min-width: 800px; }

/* Relatório de Contratos – layout fixo redesenhado */
#contratosRelatorioTable {
  table-layout: fixed;
  min-width: 800px;
}
#contratosRelatorioTable th,
#contratosRelatorioTable td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

/* Sticky header */
#contratosRelatorioTable thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--border);
}

/* 8-column widths */
#contratosRelatorioTable th:nth-child(1) { width: 36px;  }
#contratosRelatorioTable th:nth-child(2) { width: 175px; }
#contratosRelatorioTable th:nth-child(3) { width: 95px; }
#contratosRelatorioTable th:nth-child(4) { width: 92px; text-align: right; }
#contratosRelatorioTable th:nth-child(5) { width: 105px; text-align: right; }
#contratosRelatorioTable th:nth-child(6) { width: 118px; }
#contratosRelatorioTable th:nth-child(7) { width: 90px; }
#contratosRelatorioTable th:nth-child(8) { width: 300px; text-align: center; }
#contratosRelatorioTable td:nth-child(8) { overflow: hidden; }

/* Row spacing */
#contratosRelatorioTable td { padding: 10px 12px; font-size: 13px; }
#contratosRelatorioTable th { padding: 10px 12px; }

#contratosRelatorioTable .ctr-sort-btn {
  width: 100%;
  justify-content: flex-start;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
}

#contratosRelatorioTable .ctr-sort-btn.right {
  justify-content: flex-end;
}

#contratosRelatorioTable .ctr-sort-btn:hover {
  color: var(--text);
}

/* ── Contratos: accordion / expand row ──────────────────────── */

/* Expand toggle */
.ctr-expand-th { width: 36px !important; padding: 0 !important; }
.ctr-expand-cell { width: 36px; text-align: center !important; padding: 0 4px !important; }
.ctr-expand-icon {
  display: inline-block;
  font-size: 10px;
  color: var(--muted);
  pointer-events: none;
  transition: color .15s;
}

/* Main clickable row */
.ctr-main-row { cursor: pointer; user-select: none; }
.ctr-main-row:hover { background: var(--surface-soft) !important; }
.ctr-main-row:hover .ctr-expand-icon { color: var(--text); }
.ctr-main-row.ctr-expand-open { background: rgba(36,88,166,.05) !important; }

/* Fornecedor cell */
.ctr-col-fornecedor { max-width: 175px; }
.ctr-fornecedor-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 165px;
}
.ctr-fornecedor-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Responsável */
.ctr-col-responsavel { max-width: 95px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Valor columns */
.ctr-col-valor {
  text-align: right !important;
  white-space: nowrap;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -.01em;
}

/* Vencimento smart indicator */
.ctr-col-vencimento { white-space: nowrap; }
.ctr-venc-date {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.ctr-venc-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
  margin-top: 3px;
  white-space: nowrap;
  letter-spacing: .02em;
}
.ctr-venc-vencido { background: #fdeceb; color: var(--red);    border: 1px solid #f5c6c3; }
.ctr-venc-critico { background: #fdeceb; color: var(--red);    border: 1px solid #f5c6c3; }
.ctr-venc-proximo { background: #fff3e8; color: #b86400;       border: 1px solid #f5d5b5; }
.ctr-venc-urgente { background: #fff3e8; color: #e67e22;       border: 1px solid #f5d5b5; }
.ctr-venc-atencao { background: #fffbe8; color: var(--yellow); border: 1px solid #f5e8b5; }
.ctr-venc-normal  { background: rgba(15,123,95,.10); color: var(--accent); border: 1px solid rgba(15,123,95,.2); }
.ctr-venc-semdata { font-size: 12px; color: var(--muted); font-style: italic; }

/* Status */
.ctr-col-status { white-space: nowrap; }

/* Actions: todos os comandos na mesma linha */
.ctr-col-acoes {
  white-space: normal;
  padding-left: 6px !important;
  padding-right: 6px !important;
}

#contratosRelatorioTable .ctr-col-acoes .fleet-actions-cell {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  width: 100%;
  margin: 0;
}

#contratosRelatorioTable .ctr-col-acoes .table-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  margin: 0;
  padding: 0;
  border-radius: 9px;
  font-size: 16px;
  line-height: 1;
}

#contratosRelatorioTable .ctr-action-email {
  color: #0f766e;
  border-color: #99d8c5;
  background: #ecfdf5;
  font-size: 20px;
}

#contratosRelatorioTable .ctr-action-email:hover {
  color: #065f46;
  border-color: #0f766e;
  background: #d1fae5;
}

/* Detail / expanded row */
.ctr-detail-row > td {
  padding: 0 !important;
  border-top: none !important;
  background: var(--bg) !important;
}
.ctr-detail-container {
  padding: 16px 20px 20px 44px;
  background: var(--bg);
  border-bottom: 2px solid var(--border);
  border-left: 3px solid #2458a6;
  overflow: hidden;
  box-sizing: border-box;
}
.ctr-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  max-width: 100%;
  gap: 12px 20px;
}
.ctr-detail-field { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow: hidden; }
.ctr-detail-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  white-space: nowrap;
}
.ctr-detail-value {
  font-size: 13px;
  color: var(--text);
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  line-height: 1.4;
}
.ctr-detail-value a { color: #2458a6; text-decoration: none; }
.ctr-detail-value a:hover { text-decoration: underline; }
.autentique-filtros {
  grid-template-columns: minmax(220px, 1fr) 90px minmax(220px, 1fr) repeat(2, minmax(220px, 0.7fr));
  align-items: end;
}

.autentique-logic select {
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 0 12px;
  font: inherit;
  font-weight: 800;
  color: var(--accent);
}

.autentique-table {
  min-width: 1320px;
  table-layout: fixed;
}

.autentique-table th,
.autentique-table td {
  padding: 10px;
  vertical-align: middle;
}

.autentique-table th:nth-child(1),
.autentique-table td:nth-child(1) {
  width: 28%;
  white-space: normal;
}

.autentique-table th:nth-child(2),
.autentique-table td:nth-child(2) {
  width: 15%;
  white-space: normal;
}

.autentique-table th:nth-child(3),
.autentique-table td:nth-child(3) {
  width: 27%;
  white-space: normal;
  text-align: left;
}

.autentique-table th:nth-child(4),
.autentique-table td:nth-child(4),
.autentique-table th:nth-child(5),
.autentique-table td:nth-child(5) {
  width: 8%;
  white-space: nowrap;
}

.autentique-table th:nth-child(6),
.autentique-table td:nth-child(6) {
  width: 8%;
  white-space: nowrap;
  font-weight: 700;
}

.autentique-table th:nth-child(7),
.autentique-table td:nth-child(7) {
  width: 6%;
  white-space: nowrap;
}

.autentique-table .sort-btn {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  white-space: normal;
  line-height: 1.2;
}

.autentique-table th:nth-child(4) .sort-btn,
.autentique-table th:nth-child(5) .sort-btn,
.autentique-table th:nth-child(6) .sort-btn,
.autentique-table th:nth-child(7) .sort-btn {
  justify-content: center;
  text-align: center;
}

.autentique-table td:nth-child(4),
.autentique-table th:nth-child(4),
.autentique-table td:nth-child(5),
.autentique-table th:nth-child(5),
.autentique-table td:nth-child(6),
.autentique-table th:nth-child(6),
.autentique-table td:nth-child(7),
.autentique-table th:nth-child(7) {
  text-align: center;
}

.autentique-table .contratos-badge {
  margin-left: 0;
}

.autentique-signers {
  display: grid;
  gap: 4px;
  font-size: 12px;
  line-height: 1.3;
}

.autentique-signer-line {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 6px;
  align-items: start;
}

.autentique-signer-line strong {
  font-size: 11px;
}

.autentique-signer-line > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.autentique-signer-pill {
  display: inline;
}

.autentique-signer-line em {
  color: var(--muted);
  font-style: normal;
  margin-left: 4px;
}

.autentique-signer-line.ok strong { color: var(--accent); }
.autentique-signer-line.pendente strong { color: var(--yellow); }
.autentique-signer-line.revisao strong { color: #1565c0; }
.autentique-signer-line.erro strong { color: var(--red); }
.muted { color: var(--muted); }

@media (max-width: 1120px) {
  .autentique-filtros {
    grid-template-columns: 1fr 86px 1fr;
  }
}

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

/* Paginação */
.contratos-paginacao {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding: 16px 0 4px;
}

.contratos-paginacao .table-action.active-page {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Modal de detalhes */
.contratos-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(23,32,44,.65);
  z-index: 900;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.contratos-modal-overlay.open { display: flex; }

.contratos-modal {
  background: var(--surface);
  border-radius: 12px;
  width: 100%;
  max-width: 700px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.contratos-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.contratos-modal-header h2 { font-size: 18px; margin: 0; }

.contratos-modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--surface-soft);
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  flex-shrink: 0;
}

.contratos-modal-close:hover { background: var(--border); }

.contratos-modal-body { padding: 20px 24px 24px; }

.contratos-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.contratos-modal-field { display: flex; flex-direction: column; gap: 4px; }

.contratos-modal-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--muted);
}

.contratos-modal-value {
  font-size: 14px;
  color: var(--text);
  word-break: break-word;
  line-height: 1.45;
}

.contratos-modal-value a { color: var(--blue); }

/* Upload de contrato via IA */
.contratos-ia-upload {
  border: 2px dashed #b9c5d1;
  border-radius: var(--radius);
  padding: 38px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}

.contratos-ia-upload:hover,
.contratos-ia-upload.drag-over {
  border-color: var(--accent);
  background: #f1faf6;
}

/* Campos do formulário pós-IA */
.field-group.ia-preenchido input,
.field-group.ia-preenchido select {
  background: #f0faf5;
  border-color: #b2dcc8;
}

.field-group.ia-vazio input,
.field-group.ia-vazio select {
  background: #fff8f0;
  border-color: #f5d5a0;
}

.ia-vazio-label {
  color: var(--yellow);
  font-size: 10px;
  font-weight: 700;
  margin-left: 4px;
}

/* Toast de feedback */
.contratos-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--accent);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  z-index: 9999;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  animation: fadeInUp .2s ease;
}

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

@media (max-width: 1100px) {
  .contratos-dashboard-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
  .contratos-kpi-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)) !important; }
  .contratos-dashboard-bottom { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .contratos-filtros { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 700px) {
  .contratos-dashboard-grid { grid-template-columns: 1fr; }
  .contratos-dashboard-bottom { grid-template-columns: 1fr; }
  .analises-filtros { grid-template-columns: 1fr; }
  .contratos-filtros { grid-template-columns: 1fr; }
  .contratos-kpi-grid { grid-template-columns: 1fr !important; }
  .contratos-modal-grid { grid-template-columns: 1fr; }
}

/* ── Modal de Edição de Contrato ─────────────────────────────── */
.contratos-edicao-modal { max-width: 760px; display: flex; flex-direction: column; max-height: 90vh; }
.contratos-edicao-modal .contratos-modal-body { overflow-y: auto; flex: 1; padding: 20px 24px; }
.contratos-edicao-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

#contratosEdicaoBody {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

#contratosEdicaoBody .edicao-field { display: flex; flex-direction: column; gap: 4px; }
#contratosEdicaoBody .edicao-field:last-child { grid-column: 1 / -1; }

.edicao-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--muted);
}

.edicao-input {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 10px;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  width: 100%;
  box-sizing: border-box;
  transition: border-color .15s;
  font-family: inherit;
  resize: vertical;
}

.edicao-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(0,200,110,.12); }

@media (max-width: 700px) {
  #contratosEdicaoBody { grid-template-columns: 1fr; }
  .contratos-edicao-modal { max-width: 100%; }
}

/* ── Consulta de Orçamento ───────────────────────────────────── */
.orc-kpi-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)) !important; }

.orc-kpi-pct .kpi-info { display: flex; flex-direction: column; gap: 4px; }

.orc-progress-track {
  height: 8px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 6px;
}
.orc-progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .4s ease;
}

.orc-mini-row { display: flex; align-items: center; gap: 6px; }
.orc-mini-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.orc-mini-fill { height: 100%; border-radius: 99px; transition: width .3s; }

/* Saldo colors */
.orc-saldo-ok  { color: var(--accent) !important; }
.orc-saldo-low { color: var(--yellow) !important; }
.orc-saldo-neg { color: var(--red)    !important; }

/* Row risk highlight */
.orc-row-risco { background: rgba(192,57,43,.04); }
.orc-row-risco:hover { background: rgba(192,57,43,.08) !important; }

/* Badges */
.orc-badge-risco {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--red);
  background: rgba(192,57,43,.1);
  border-radius: 4px;
  padding: 2px 6px;
  margin-top: 4px;
}

.orc-badge-evento {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}
.orc-badge-concluido  { background: rgba(15,123,95,.12); color: var(--accent); }
.orc-badge-em-andamento, .orc-badge-em-curso { background: rgba(36,88,166,.12); color: #2458a6; }
.orc-badge-cancelado  { background: rgba(192,57,43,.12); color: var(--red); }
.orc-badge-pendente   { background: rgba(163,106,0,.12); color: var(--yellow); }

.orc-badge-item {
  display: inline-block;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--surface-soft);
  color: var(--muted);
  white-space: nowrap;
}

.orcamento-table th, .orcamento-table td { font-size: 13px; }

/* Sticky header */
.orcamento-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--border);
}

/* Expand toggle column */
.orc-expand-th { width: 36px; padding: 0 !important; }
.orc-expand-cell { width: 36px; text-align: center !important; padding: 0 4px !important; }
.orc-expand-icon {
  display: inline-block;
  font-size: 10px;
  color: var(--muted);
  pointer-events: none;
  transition: color .15s;
}

/* Group / summary row */
.orc-group-row {
  background: var(--surface-soft);
  cursor: pointer;
  user-select: none;
}

/* ─── Supply IA Chatbot ──────────────────────────────────────────────────── */

.supply-ia-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px 0 14px;
  height: 52px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 26px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(15,123,95,0.38);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.18s, box-shadow 0.18s, transform 0.15s;
}
.supply-ia-fab:hover { background: var(--accent-hover); box-shadow: 0 6px 24px rgba(15,123,95,0.46); }
.supply-ia-fab.active { background: var(--accent-hover); }
.supply-ia-fab svg { width: 22px; height: 22px; flex-shrink: 0; }
.supply-ia-fab-label { white-space: nowrap; }

.supply-ia-panel {
  position: fixed;
  bottom: 96px;
  right: 28px;
  z-index: 1199;
  width: 400px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 120px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(0.97);
  transition: opacity 0.2s, transform 0.2s;
}
.supply-ia-panel.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0) scale(1);
}

.supply-ia-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--surface-strong);
  color: var(--sidebar-text);
  flex-shrink: 0;
}
.supply-ia-header-info { display: flex; align-items: center; gap: 10px; }
.supply-ia-avatar {
  width: 38px; height: 38px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.supply-ia-avatar svg { width: 20px; height: 20px; color: #fff; }
.supply-ia-title { font-weight: 700; font-size: 15px; line-height: 1.2; }
.supply-ia-subtitle { font-size: 11px; color: var(--sidebar-muted); margin-top: 1px; }
.supply-ia-header-actions { display: flex; align-items: center; gap: 6px; }
.supply-ia-status-dot {
  width: 8px; height: 8px;
  background: #34d399;
  border-radius: 50%;
  display: inline-block;
}
.supply-ia-status-label { font-size: 12px; color: #34d399; font-weight: 600; }
.supply-ia-close {
  background: none; border: none; color: var(--sidebar-muted);
  font-size: 16px; cursor: pointer; padding: 4px 6px; border-radius: 4px;
  transition: color 0.15s;
}
.supply-ia-close:hover { color: var(--sidebar-text); }

.supply-ia-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
}

.supply-ia-msg { display: flex; flex-direction: column; }
.supply-ia-msg-user { align-items: flex-end; }
.supply-ia-msg-assistant { align-items: flex-start; }

.supply-ia-bubble {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.supply-ia-msg-user .supply-ia-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.supply-ia-msg-assistant .supply-ia-bubble {
  background: var(--surface-soft);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.supply-ia-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
}
.supply-ia-typing span {
  width: 7px; height: 7px;
  background: var(--muted);
  border-radius: 50%;
  animation: supplyIADot 1.2s infinite ease-in-out;
}
.supply-ia-typing span:nth-child(2) { animation-delay: 0.2s; }
.supply-ia-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes supplyIADot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.supply-ia-sugestoes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  max-width: 92%;
}
.supply-ia-sug {
  background: none;
  border: 1.5px solid var(--accent);
  color: var(--accent);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  line-height: 1.4;
}
.supply-ia-sug:hover:not(:disabled) { background: var(--accent); color: #fff; }
.supply-ia-sug:disabled { opacity: 0.45; cursor: default; }

.supply-ia-footer {
  padding: 12px 14px 10px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.supply-ia-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.supply-ia-input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--bg);
  resize: none;
  min-height: 38px;
  max-height: 120px;
  overflow-y: auto;
  transition: border-color 0.15s;
  outline: none;
}
.supply-ia-input:focus { border-color: var(--accent); }
.supply-ia-send {
  width: 38px; height: 38px;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.supply-ia-send:hover:not(:disabled) { background: var(--accent-hover); }
.supply-ia-send:disabled { opacity: 0.5; cursor: default; }
.supply-ia-send svg { width: 17px; height: 17px; }
.supply-ia-disclaimer {
  font-size: 11px;
  color: var(--muted);
  margin-top: 7px;
  text-align: center;
}

@media (max-width: 480px) {
  .supply-ia-panel { right: 12px; bottom: 80px; width: calc(100vw - 24px); }
  .supply-ia-fab { right: 12px; bottom: 16px; }
}
.orc-group-row:hover { background: var(--border) !important; }
.orc-group-row:hover .orc-expand-icon { color: var(--text); }
.orc-group-row.orc-expand-open { background: rgba(36,88,166,.06) !important; }
.orc-group-row.orc-row-risco { background: rgba(192,57,43,.05) !important; }
.orc-group-row.orc-row-risco:hover { background: rgba(192,57,43,.09) !important; }

/* Event name cell */
.orc-col-evento { max-width: 200px; }
.orc-evento-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}
.orc-evento-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* Column alignment helpers */
.orc-col-data    { text-align: center !important; white-space: nowrap; }
.orc-col-unidade { white-space: nowrap; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.orc-col-valor   { text-align: right !important; white-space: nowrap; font-weight: 600; }
.orc-col-pct     { min-width: 100px; }

/* Detail / expanded row */
.orc-detail-row > td { padding: 0 !important; border-top: none !important; }
.orc-detail-container {
  padding: 0 16px 16px 40px;
  background: var(--bg);
  border-bottom: 2px solid var(--border);
}
.orc-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.orc-detail-table th {
  padding: 8px 10px;
  background: var(--surface);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.orc-detail-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.orc-detail-table tr:last-child td { border-bottom: none; }
.orc-detail-table tr:hover td { background: var(--surface-soft); }

/* Truncate helpers inside detail table */
.orc-dt-truncate {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.orc-dt-wide { max-width: 200px; }

/* Situação indicators */
.orc-indicador {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}
.orc-indicador-ok     { background: rgba(15,123,95,.12);  color: var(--accent); }
.orc-indicador-alerta { background: rgba(163,106,0,.12);  color: var(--yellow); }
.orc-indicador-risco  { background: rgba(192,57,43,.12);  color: var(--red); }

@media (max-width: 900px) {
  .orc-kpi-grid { grid-template-columns: 1fr 1fr !important; }
}
@media (max-width: 600px) {
  .orc-kpi-grid { grid-template-columns: 1fr !important; }
}

/* ── Searchable Select (cs-wrap) ─────────────────────────────── */
.cs-wrap { position: relative; }
.cs-control {
  display: flex; align-items: center;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); transition: border-color .15s;
}
.cs-wrap.open .cs-control,
.cs-control:focus-within { border-color: var(--accent); }
.cs-input {
  flex: 1; border: none; background: transparent;
  padding: 8px 10px; font-size: 14px; color: var(--text);
  outline: none; cursor: pointer; min-width: 0;
  font-family: inherit;
}
.cs-input:focus { cursor: text; }
.cs-clear {
  display: none; border: none; background: none;
  color: var(--muted); cursor: pointer; padding: 0 6px;
  font-size: 13px; line-height: 1; flex-shrink: 0;
}
.cs-clear:hover { color: var(--red); }
.cs-wrap.has-value .cs-clear { display: block; }
.cs-arrow {
  padding: 0 8px; color: var(--muted); pointer-events: none;
  font-size: 10px; flex-shrink: 0; transition: transform .15s;
}
.cs-wrap.open .cs-arrow { transform: rotate(180deg); }
.cs-list {
  display: none; position: absolute; top: calc(100% + 3px);
  left: 0; right: 0; z-index: 300;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); max-height: 240px; overflow-y: auto;
  list-style: none; margin: 0; padding: 4px 0;
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
}
.cs-wrap.open .cs-list { display: block; }
.cs-list li {
  padding: 8px 14px; font-size: 14px; cursor: pointer;
  color: var(--text); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
}
.cs-list li:hover { background: rgba(15,123,95,.07); color: var(--accent); }
.cs-list li.cs-selected { font-weight: 700; color: var(--accent); }
.cs-list li.cs-placeholder { color: var(--muted); font-style: italic; }
.cs-list li.cs-hidden { display: none; }
.cs-no-results {
  padding: 10px 14px; font-size: 13px;
  color: var(--muted); font-style: italic; display: none;
}

.anfarmag-page {
  display: grid;
  gap: 18px;
}

.anfarmag-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  border-radius: 10px;
  background: linear-gradient(135deg, #006747, #0f7b5f);
  color: #fff;
  box-shadow: var(--shadow-md);
}

.anfarmag-eyebrow {
  display: inline-flex;
  margin-bottom: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  color: #d9fff3;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  padding: 4px 10px;
  text-transform: uppercase;
}

.anfarmag-hero h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
}

.anfarmag-hero p {
  max-width: 720px;
  margin: 10px 0 0;
  color: rgba(255,255,255,.86);
  line-height: 1.5;
}

.anfarmag-hero-card {
  min-width: 150px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 10px;
  background: rgba(255,255,255,.1);
  text-align: center;
}

.anfarmag-hero-card strong {
  display: block;
  font-size: 34px;
}

.anfarmag-hero-card span {
  color: rgba(255,255,255,.84);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.anfarmag-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.anfarmag-toolbar h2 {
  margin: 0;
  color: var(--text);
  font-size: 22px;
}

.anfarmag-toolbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.anfarmag-actions {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.anfarmag-search {
  display: grid;
  gap: 4px;
  min-width: 260px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.anfarmag-search input {
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafb;
  color: var(--text);
  padding: 0 12px;
  font-weight: 700;
}

.anfarmag-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.anfarmag-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.anfarmag-card:hover {
  transform: translateY(-2px);
  border-color: rgba(15,123,95,.35);
  box-shadow: var(--shadow-md);
}

.anfarmag-card.featured {
  border-top: 4px solid var(--accent);
}

.anfarmag-card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.anfarmag-date strong,
.anfarmag-date span {
  display: block;
}

.anfarmag-date strong {
  color: var(--muted);
  font-size: 12px;
}

.anfarmag-date span {
  margin-top: 3px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.anfarmag-badge {
  align-self: start;
  border-radius: 999px;
  background: #eaf1ff;
  color: #2458a6;
  font-size: 10px;
  font-weight: 900;
  padding: 4px 8px;
  text-transform: uppercase;
}

.anfarmag-badge.urgent {
  background: #fff3db;
  color: #9a5b00;
}

.anfarmag-card h2 {
  font-size: 16px;
  line-height: 1.35;
  margin: 0;
  color: var(--text);
}

.anfarmag-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  margin: 0;
}

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

.anfarmag-card a {
  display: inline-flex;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.anfarmag-card-actions button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafb;
  color: var(--muted);
  cursor: pointer;
}

.anfarmag-empty {
  grid-column: 1 / -1;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1180px) {
  .anfarmag-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .anfarmag-hero,
  .anfarmag-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .anfarmag-actions,
  .anfarmag-search {
    width: 100%;
  }

  .anfarmag-actions button {
    flex: 1;
  }

  .anfarmag-list {
    grid-template-columns: 1fr;
  }
}

/* ════════════════════════════════════════════════════════════
   AVALIAÇÃO DE FORNECEDORES
   ════════════════════════════════════════════════════════════ */

.avalforn-tab-panel { display: none; }
.avalforn-tab-panel.active { display: block; }

.avalforn-history-filter {
  grid-template-columns: minmax(240px, 1fr) auto;
}

/* Badges de categoria */
.avalforn-cat-infra  { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.avalforn-cat-tec    { background: #e3f2fd; color: #1565c0; border: 1px solid #bbdefb; }
.avalforn-cat-sup    { background: #f3e5f5; color: #6a1b9a; border: 1px solid #e1bee7; }
.avalforn-cat-log    { background: #fff8e1; color: #e65100; border: 1px solid #ffecb3; }

/* Badges de faixa de score */
.avalforn-badge-renovar   { background: rgba(15,123,95,.1); color: var(--accent);  border: 1px solid rgba(15,123,95,.25); }
.avalforn-badge-ressalvas { background: #fffbe8;             color: var(--yellow);  border: 1px solid #f5e8b5; }
.avalforn-badge-alerta    { background: #fff3e8;             color: #e67e22;        border: 1px solid #f5d5b5; }
.avalforn-badge-nao       { background: #fdeceb;             color: var(--red);     border: 1px solid #f5c6c3; }
.avalforn-badge-sem       { background: var(--surface-soft); color: var(--muted);   border: 1px solid var(--border); }

/* Tabela principal */
.avalforn-table { min-width: 860px; }

/* Config – linhas monitoradas */
.avalforn-config-row.is-monitored td:first-child { border-left: 3px solid var(--accent); }
.avalforn-config-row.is-monitored { background: rgba(15,123,95,.04); }
.avalforn-cfg-cat {
  width: 100%;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 10px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
}
.avalforn-cfg-cat:disabled { background: var(--surface-soft); color: var(--muted); cursor: not-allowed; }
.avalforn-cfg-cat:focus { outline: none; border-color: var(--accent); }

/* Formulário de avaliação – dimensões */
.avalforn-dims { display: flex; flex-direction: column; gap: 16px; }
.avalforn-dim-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 14px;
  background: var(--surface-soft);
  border-radius: var(--radius);
}
.avalforn-dim-label {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  min-width: 200px;
}
.avalforn-dim-peso {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 1px 7px;
  margin-left: 6px;
}
.avalforn-nota-opts { display: flex; gap: 8px; }
.avalforn-nota-opt { display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.avalforn-nota-opt input[type="radio"] { display: none; }
.avalforn-nota-opt span {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border);
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  transition: all 0.15s;
  cursor: pointer;
}
.avalforn-nota-opt input[type="radio"]:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(15,123,95,.3);
}
.avalforn-nota-opt:hover span { border-color: var(--accent); color: var(--accent); }

/* Score preview */
.avalforn-score-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-top: 16px;
  font-size: 14px;
  color: var(--muted);
}
.avalforn-score-num {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

/* Modal de configuração – cabeçalho com checkbox */
.avalforn-toggle-wrap {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.avalforn-toggle-wrap input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ======================================================
   GESTÃO DE NOTAS FISCAIS — Flow card e stepper
   ====================================================== */

/* Corrige conflito: cards dentro de painel ativo sempre visíveis */
.nf-step-panel.active .card {
  display: block;
}

/* Step panels — apenas o ativo fica visível */
.nf-step-panel {
  display: none;
}
.nf-step-panel.active {
  display: block;
}

/* ------ Flow card (container principal) ------ */
.nf-flow-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  border-radius: 14px;
  padding: 24px 28px 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,.07);
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

/* ------ Cabeçalho do flow ------ */
.nf-flow-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  min-width: 0;
}

.nf-flow-title-group {
  min-width: 0;
  flex: 1 1 220px;
}

.nf-flow-eyebrow {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  margin-bottom: 4px;
}

.nf-flow-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 4px;
}

.nf-flow-sub {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.nf-flow-badge {
  flex-shrink: 0;
  background: #0f2f2e;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: 0.2px;
}

/* ------ Stepper (linha de etapas) ------ */
.nf-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 18px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}

/* Conector entre etapas */
.step-connector {
  flex-shrink: 0;
  width: 28px;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  transition: background 0.3s;
  margin: 0 6px;
  margin-top: -12px; /* alinha com centro do círculo */
}
.step-connector.completed {
  background: var(--accent);
}

/* Cada etapa */
.nf-step {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 14px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  border-radius: 10px;
  text-align: left;
  min-width: 0;
  max-width: 100%;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

/* Círculo numerado */
.nf-step .step-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--border);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
  font-family: "Montserrat", sans-serif;
}

/* Texto da etapa */
.nf-step .step-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

.nf-step .step-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s;
}

.nf-step .step-desc {
  font-size: 11px;
  color: var(--muted);
  opacity: 0.65;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Estado: concluída */
.nf-step.completed {
  background: rgba(15, 123, 95, 0.05);
  border-color: rgba(15, 123, 95, 0.28);
}
.nf-step.completed .step-num {
  background: rgba(15, 123, 95, 0.15);
  color: transparent;
  font-size: 0;
}
.nf-step.completed .step-num::after {
  content: "✓";
  font-size: 15px;
  color: var(--accent);
  font-weight: 900;
}
.nf-step.completed .step-label {
  color: var(--accent);
}
.nf-step.completed .step-desc {
  color: var(--accent);
  opacity: 0.6;
}

/* Estado: ativa */
.nf-step.active {
  background: rgba(15, 123, 95, 0.08);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 123, 95, 0.14);
}
.nf-step.active .step-num {
  background: var(--accent);
  color: #fff;
}
.nf-step.active .step-label {
  color: var(--accent);
  font-weight: 800;
}
.nf-step.active .step-desc {
  color: var(--accent);
  opacity: 0.75;
}

/* Hover em etapas pendentes */
.nf-step:hover:not(.active):not(.completed) {
  border-color: rgba(15, 123, 95, 0.35);
  background: rgba(15, 123, 95, 0.03);
}
.nf-step:hover:not(.active):not(.completed) .step-num {
  background: rgba(15, 123, 95, 0.2);
  color: var(--accent);
}

/* ------ Hint (orientação da etapa atual) ------ */
.nf-step-hint {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--surface-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 11px 16px;
  margin-bottom: 16px;
}
.nf-step-hint strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.nf-step-hint span {
  font-size: 12px;
  color: var(--muted);
}

/* ------ Botões de navegação do flow ------ */
.nf-flow-nav {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ------ Cabeçalho da revisão/gravação com contador e setas ------ */
.nf-review-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.nf-review-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.nf-review-counter {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-align: center;
}

/* Badges de status na gravação */
.badge-ok {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #6ee7b7;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.badge-skip {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  background: var(--input-bg, #f4f4f5);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* Formulário manual oculto */
.nf-manual-hidden {
  display: none !important;
}

/* --- Entrada sub-tabs --- */
.entrada-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.entrada-tab {
  padding: 8px 18px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}
.entrada-tab:hover { color: var(--text); }
.entrada-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.entrada-tab-panel { display: none; }
.entrada-tab-panel.active { display: block; }

/* --- Validação summary bar --- */
.validacao-summary { margin-bottom: 14px; }
.validacao-summary-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.validacao-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 13px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}
.validacao-indicator strong { font-weight: 700; }
.validacao-indicator.apta { background: #e8f5e9; border-color: #a5d6a7; color: #2e7d32; }
.validacao-indicator.ressalva { background: #fff8e1; border-color: #ffe082; color: #7b5800; }
.validacao-indicator.revisao { background: #e3f2fd; border-color: #90caf9; color: #1565c0; }
.validacao-indicator.nao-apta { background: #fce4ec; border-color: #f48fb1; color: #c62828; }
.validacao-indicator.pendente { background: var(--surface-soft); color: var(--muted); }
.validacao-indicator.total { background: #f3e5f5; border-color: #ce93d8; color: #6a1b9a; }

.revisao-lista {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.revisao-nota-card {
  margin: 0;
}

/* --- Decisão fiscal buttons --- */
.decisao-fiscal {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 0 8px;
  border-top: 1px solid var(--border);
  margin-top: 14px;
}
.decisao-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.decisao-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.decisao-btn {
  padding: 7px 16px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface-soft);
  color: var(--text);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.decisao-btn:hover { filter: brightness(0.95); }
.decisao-btn.apta { border-color: #a5d6a7; }
.decisao-btn.apta.active { background: #2e7d32; border-color: #2e7d32; color: #fff; }
.decisao-btn.ressalva { border-color: #ffe082; }
.decisao-btn.ressalva.active { background: #f9a825; border-color: #f9a825; color: #fff; }
.decisao-btn.revisao { border-color: #90caf9; }
.decisao-btn.revisao.active { background: #1565c0; border-color: #1565c0; color: #fff; }
.decisao-btn.nao_apta { border-color: #f48fb1; }
.decisao-btn.nao_apta.active { background: #c62828; border-color: #c62828; color: #fff; }

/* --- Decisão badges (inline) --- */
.decisao-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-soft);
  color: var(--muted);
}
.decisao-badge.decisao-apta { background: #e8f5e9; color: #2e7d32; }
.decisao-badge.decisao-ressalva { background: #fff8e1; color: #7b5800; }
.decisao-badge.decisao-revisao { background: #e3f2fd; color: #1565c0; }
.decisao-badge.decisao-nao_apta { background: #fce4ec; color: #c62828; }

/* --- Dados da nota collapsible --- */
.dados-nota-collapsible {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.dados-nota-collapsible summary {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-soft);
  user-select: none;
}
.dados-nota-collapsible summary:hover { color: var(--text); }
.dados-nota-collapsible .form-grid { padding: 16px; }

/* --- Triagem filtros --- */
.triagem-filtros {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.triagem-filtro-btn {
  padding: 6px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.triagem-filtro-btn:hover { color: var(--text); border-color: var(--accent); }
.triagem-filtro-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* --- Triagem list items --- */
.triagem-list { display: flex; flex-direction: column; gap: 8px; }
.triagem-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  flex-wrap: wrap;
  transition: background 0.1s, border-color 0.1s;
}
.triagem-item.selected {
  background: #f0faf5;
  border-color: var(--accent);
}
.triagem-item.blocked {
  background: var(--surface-soft);
  opacity: 0.65;
  flex-wrap: wrap;
}
.triagem-check { display: flex; align-items: center; }
.triagem-check input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }
.triagem-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.triagem-nome {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.triagem-detalhe {
  font-size: 12px;
  color: var(--muted);
}
.triagem-item-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 120px;
}
.triagem-laudo-status {
  font-size: 11px;
  color: var(--muted);
}
.triagem-blocked-msg {
  width: 100%;
  font-size: 12px;
  color: #c62828;
  padding-left: 30px;
}
.triagem-count {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  font-size: 14px;
  color: var(--muted);
}
.triagem-count strong { color: var(--text); }

/* Forma de lançamento toggle inside triagem item */
.triagem-forma-wrap {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.triagem-forma-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.triagem-forma-toggle {
  display: flex;
  gap: 4px;
  background: var(--surface-soft);
  border-radius: 6px;
  padding: 3px;
}
.triagem-forma-btn {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
  transition: background .15s, color .15s;
}
.triagem-forma-btn.active {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}

/* Per-item classification table inside triagem */
.triagem-itens-wrap {
  width: 100%;
  margin-top: 8px;
  overflow-x: auto;
}
.triagem-itens-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.triagem-itens-table th {
  text-align: left;
  padding: 5px 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.triagem-itens-table td {
  padding: 5px 8px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}
.triagem-itens-table tr:last-child td { border-bottom: none; }
.triagem-item-desc {
  font-size: 12px;
  color: var(--text);
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.triagem-item-input {
  width: 100%;
  min-width: 120px;
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.triagem-item-input:focus { border-color: var(--accent); }
.triagem-item-select {
  width: 100%;
  min-width: 140px;
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #fff;
  color: var(--text);
  outline: none;
  cursor: pointer;
  transition: border-color .15s;
}
.triagem-item-select:focus { border-color: var(--accent); }

#page-nf .actions-bar .btn-primary,
#page-nf .actions-bar .btn-secondary,
#page-nf .actions-bar .btn-danger {
  min-height: 46px;
  padding: 11px 18px;
}

#page-nf .actions-bar .btn-secondary.compact {
  min-width: 132px;
}

/* Responsivo mobile */
@media (max-width: 1100px) {
  .nf-step .step-desc {
    display: none;
  }

  .nf-step {
    padding: 10px 12px;
    gap: 8px;
  }

  .step-connector {
    width: 14px;
    margin: 0 3px;
    margin-top: -8px;
  }

  #page-nf .consulta-header {
    flex-direction: column;
    align-items: stretch;
  }

  #page-nf .consulta-actions {
    justify-content: flex-start;
  }

  .nf-flow-card {
    padding: 18px 16px 16px;
  }
}

@media (max-width: 900px) {
  .nf-stepper {
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
    overflow-x: visible;
  }

  .step-connector {
    width: 3px;
    height: 14px;
    margin: 0 0 0 22px;
    margin-top: 0;
  }

  .nf-step {
    width: 100%;
    flex: none;
  }

  .nf-step .step-desc {
    display: block;
  }
}

@media (max-width: 768px) {
  .nf-flow-card {
    padding: 18px 16px 16px;
  }
  .nf-flow-header {
    flex-direction: column;
    gap: 10px;
  }
  .nf-stepper {
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
  }
  .step-connector {
    width: 3px;
    height: 18px;
    margin: 0 0 0 22px;
    margin-top: 0;
  }
  .nf-step {
    width: 100%;
  }
  .nf-review-header {
    flex-direction: column;
    gap: 12px;
  }
  .nf-review-nav {
    width: 100%;
    justify-content: center;
  }
  .decisao-fiscal {
    flex-direction: column;
    align-items: flex-start;
  }
  .triagem-item-status {
    min-width: auto;
    align-items: flex-start;
  }
}

/* ── Contratos DB extras ────────────────────────────────────── */

/* Icone de PDF disponivel na listagem */
.contratos-pdf-ok {
  color: var(--accent) !important;
  border-color: rgba(15,123,95,.3) !important;
}

/* Formulario manual de contrato */
#contratosManualForm .form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

#contratosManualForm .form-field {
  display: grid;
  gap: 5px;
}

#contratosManualForm .form-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

#contratosManualForm .form-input {
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 10px;
  font: inherit;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  width: 100%;
  box-sizing: border-box;
}

#contratosManualForm textarea.form-input {
  resize: vertical;
  min-height: 72px;
}

/* ── Legenda Característica (Contratos) ───────────────────────── */
.contratos-legenda {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  padding: 6px 0 14px;
}

.contratos-legenda-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 2px solid transparent;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: box-shadow 0.15s, transform 0.1s, background 0.15s;
  min-width: 200px;
  max-width: 260px;
  flex: 1 1 200px;
}

.contratos-legenda-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  transform: translateY(-1px);
}

.contratos-legenda-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  color: #fff;
}

.contratos-legenda-card.essencial { border-color: #c0392b; }
.contratos-legenda-card.essencial .contratos-legenda-icon { background: #c0392b; }
.contratos-legenda-card.essencial.active { background: #fdf0ef; border-color: #c0392b; box-shadow: 0 0 0 3px rgba(192,57,43,0.18); }

.contratos-legenda-card.necessario { border-color: #16a085; }
.contratos-legenda-card.necessario .contratos-legenda-icon { background: #16a085; }
.contratos-legenda-card.necessario.active { background: #eaf8f5; border-color: #16a085; box-shadow: 0 0 0 3px rgba(22,160,133,0.18); }

.contratos-legenda-card.desejavel { border-color: #e67e22; }
.contratos-legenda-card.desejavel .contratos-legenda-icon { background: #e67e22; }
.contratos-legenda-card.desejavel.active { background: #fef5ec; border-color: #e67e22; box-shadow: 0 0 0 3px rgba(230,126,34,0.18); }

.contratos-legenda-titulo {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.contratos-legenda-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

@media (max-width: 700px) {
  .contratos-legenda { justify-content: stretch; }
  .contratos-legenda-card { max-width: 100%; flex: 1 1 100%; }
}
