/* ==========================================================================
   SecurityLog Transportes — Design System
   Tokens, base, componentes e utilitários. Mobile-first.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Paleta oficial da marca */
  --navy: #152744;
  --navy-deep: #0d1c30;
  --navy-800: #112038;
  --green: #2a7a38;
  --green-hover: #1e5c2a;
  --green-soft: rgba(42, 122, 56, 0.1);
  --white: #ffffff;
  --gray-50: #f4f7f4;
  --gray-200: #e2e8e3;
  --gray-500: #64748b;
  --gray-900: #1e293b;

  /* Semântica */
  --bg: var(--white);
  --bg-alt: var(--gray-50);
  --text: var(--gray-900);
  --text-muted: var(--gray-500);
  --border: var(--gray-200);
  --focus: #2a7a38;

  /* Status */
  --ok: #2a7a38;
  --warn: #b45309;
  --danger: #b91c1c;
  --info: #152744;

  /* Tipografia */
  --font-display: "Sora", "Inter", system-ui, -apple-system, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Roboto Mono", ui-monospace, monospace;

  --fs-xs: 0.78rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: 1.75rem;
  --fs-3xl: 2.125rem;
  --fs-4xl: 2.75rem;

  /* Espaçamento e forma */
  --space-section: 4.5rem;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;
  --maxw: 1200px;

  /* Sombras sutis */
  --shadow-sm: 0 1px 2px rgba(21, 39, 68, 0.06);
  --shadow: 0 6px 20px rgba(21, 39, 68, 0.07);
  --shadow-lg: 0 18px 48px rgba(21, 39, 68, 0.12);

  --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 1024px) {
  :root {
    --fs-3xl: 2.5rem;
    --fs-4xl: 3.5rem;
    --space-section: 6rem;
  }
}

/* --------------------------------------------------------------------------
   2. Reset e base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Componentes usam display explícito; sem isto o atributo hidden é ignorado. */
[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-wrap: break-word;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.18;
  color: var(--navy);
  margin: 0 0 0.6em;
  letter-spacing: -0.02em;
}

h1 { font-size: var(--fs-4xl); font-weight: 800; }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-xl); }

p { margin: 0 0 1rem; }

a {
  color: var(--green);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--green-hover); text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

ul { margin: 0; padding: 0; list-style: none; }

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 200;
  background: var(--white);
  color: var(--navy);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: top var(--transition);
}
.skip-link:focus { top: 1rem; text-decoration: none; }

/* --------------------------------------------------------------------------
   3. Layout
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

.section { padding-block: var(--space-section); }
.section--alt { background: var(--bg-alt); }
.section--navy { background: var(--navy); color: rgba(255, 255, 255, 0.84); }
.section--navy h2,
.section--navy h3 { color: var(--white); }

.section-head {
  max-width: 44rem;
  margin: 0 auto 3rem;
  text-align: center;
}
.section-head p {
  color: var(--text-muted);
  font-size: var(--fs-lg);
  margin: 0;
}
.section--navy .section-head p { color: rgba(255, 255, 255, 0.72); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 0.9rem;
}
.section--navy .eyebrow { color: #6ee7a0; }

.grid { display: grid; gap: 1.5rem; }
@media (min-width: 768px) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .grid--4 { grid-template-columns: repeat(4, 1fr); }
}

/* --------------------------------------------------------------------------
   4. Botões
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.9rem 1.6rem;
  min-height: 52px;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--transition), border-color var(--transition),
    color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn[disabled],
.btn[aria-busy="true"] {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn--primary {
  background: var(--green);
  color: var(--white);
  box-shadow: 0 4px 14px rgba(42, 122, 56, 0.25);
}
.btn--primary:hover { background: var(--green-hover); color: var(--white); }

.btn--secondary {
  background: transparent;
  border-color: var(--navy);
  color: var(--navy);
}
.btn--secondary:hover { background: var(--navy); color: var(--white); }

.btn--ghost-light {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.35);
  color: var(--white);
}
.btn--ghost-light:hover { background: rgba(255, 255, 255, 0.16); color: var(--white); }

.btn--block { width: 100%; }
.btn--sm { min-height: 42px; padding: 0.55rem 1.1rem; font-size: var(--fs-sm); }

.btn .icon { flex: none; }

/* Spinner nos botões em estado de carregamento */
.btn__spinner {
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}
.btn[aria-busy="true"] .btn__spinner { display: block; }
.btn[aria-busy="true"] .btn__icon { display: none; }

@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   5. Header / navegação
   -------------------------------------------------------------------------- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--navy);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 72px;
}

.brand { display: inline-flex; align-items: center; }
.brand:hover { text-decoration: none; }
.brand__logo {
  height: 42px;
  width: auto;
  background: var(--white);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
}

.nav { display: none; }
.nav__list { display: flex; align-items: center; gap: 1.75rem; }
.nav__link {
  color: rgba(255, 255, 255, 0.86);
  font-size: var(--fs-sm);
  font-weight: 500;
  padding: 0.4rem 0;
  border-bottom: 2px solid transparent;
}
.nav__link:hover { color: var(--white); text-decoration: none; border-bottom-color: var(--green); }
.nav__link[aria-current="page"] { color: var(--white); border-bottom-color: var(--green); }

.header__cta { display: none; }

@media (min-width: 1024px) {
  .nav { display: block; }
  .header__cta { display: inline-flex; }
}

/* Hamburguer animado */
.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 48px;
  height: 48px;
  padding: 12px;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--white);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (min-width: 1024px) {
  .nav-toggle { display: none; }
}

/* Painel mobile */
.mobile-nav {
  position: fixed;
  inset: 72px 0 auto;
  background: var(--navy);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1rem 1.25rem 2rem;
  transform: translateY(-12px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
  z-index: 99;
}
.mobile-nav[data-open="true"] { opacity: 1; visibility: visible; transform: translateY(0); }
.mobile-nav a {
  display: block;
  padding: 0.95rem 0.25rem;
  color: var(--white);
  font-weight: 500;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.mobile-nav a:hover { text-decoration: none; color: #6ee7a0; }
.mobile-nav .btn { margin-top: 1.25rem; }
@media (min-width: 1024px) {
  .mobile-nav { display: none; }
}

/* --------------------------------------------------------------------------
   6. Hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-deep) 100%);
  color: var(--white);
  padding-block: 3.5rem 4rem;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  right: -18%;
  top: -30%;
  width: 60vw;
  height: 60vw;
  max-width: 680px;
  max-height: 680px;
  background: radial-gradient(circle, rgba(42, 122, 56, 0.32) 0%, transparent 68%);
  pointer-events: none;
}
.hero__inner { position: relative; z-index: 1; max-width: 46rem; }
.hero h1 { color: var(--white); }
.hero__lead {
  font-size: var(--fs-lg);
  color: rgba(255, 255, 255, 0.78);
  max-width: 38rem;
  margin-bottom: 2rem;
}
.hero__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  margin-top: 2.25rem;
  font-size: var(--fs-sm);
  color: rgba(255, 255, 255, 0.72);
}
.hero__badges li { display: inline-flex; align-items: center; gap: 0.5rem; }
.hero__badges .icon { color: #6ee7a0; }

@media (min-width: 1024px) {
  .hero { padding-block: 5.5rem 6rem; }
}

/* Barra de rastreio no hero */
.track-bar {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-lg);
}
.track-bar__label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--white);
  margin-bottom: 0.65rem;
}
.track-bar__row { display: grid; gap: 0.75rem; }
.track-bar__input {
  width: 100%;
  min-height: 52px;
  padding: 0.85rem 1rem;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.95);
  color: var(--navy);
  font-family: var(--font-mono);
  font-size: var(--fs-base);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.track-bar__input::placeholder { color: var(--gray-500); letter-spacing: normal; text-transform: none; }
.track-bar__hint { margin: 0.75rem 0 0; font-size: var(--fs-xs); color: rgba(255, 255, 255, 0.6); }
.track-bar__hint button {
  background: none;
  border: 0;
  padding: 0;
  color: #6ee7a0;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  cursor: pointer;
  text-decoration: underline;
}

@media (min-width: 640px) {
  .track-bar__row { grid-template-columns: 1fr auto; }
}

/* --------------------------------------------------------------------------
   7. Cards
   -------------------------------------------------------------------------- */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-3px); }
.card h3 { margin-bottom: 0.5rem; }
.card p { color: var(--text-muted); margin: 0; }

.card--glass {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: rgba(255, 255, 255, 0.8);
}
.card--glass h3 { color: var(--white); }
.card--glass p { color: rgba(255, 255, 255, 0.72); }

.card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  background: var(--green-soft);
  color: var(--green);
  margin-bottom: 1.1rem;
}
.card--glass .card__icon { background: rgba(110, 231, 160, 0.14); color: #6ee7a0; }

/* Métricas */
.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem 1rem;
  margin-top: 2.5rem;
}
@media (min-width: 768px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat__value {
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  font-weight: 800;
  color: var(--green);
  line-height: 1;
}
.stat__label { font-size: var(--fs-sm); color: var(--text-muted); margin: 0.4rem 0 0; }
.section--navy .stat__label { color: rgba(255, 255, 255, 0.68); }
.section--navy .stat__value { color: #6ee7a0; }

/* Valores (Quem somos) */
.value-list { display: grid; gap: 1.25rem; margin-top: 2rem; }
.value-item { display: flex; gap: 1rem; align-items: flex-start; }
.value-item .card__icon { margin-bottom: 0; flex: none; width: 46px; height: 46px; }
.value-item h3 { font-size: var(--fs-lg); margin-bottom: 0.25rem; }
.value-item p { margin: 0; color: var(--text-muted); font-size: var(--fs-sm); }

.about { display: grid; gap: 3rem; align-items: center; }
@media (min-width: 1024px) {
  .about { grid-template-columns: 1fr 1fr; gap: 4rem; }
}

/* Cobertura */
.coverage { display: grid; gap: 2.5rem; align-items: start; }
@media (min-width: 1024px) { .coverage { grid-template-columns: 1fr 1.1fr; gap: 3.5rem; } }
.region-list { display: grid; gap: 0.85rem; }
.region {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.region__name { font-weight: 600; color: var(--navy); }
.region__meta { font-size: var(--fs-sm); color: var(--text-muted); }

/* Depoimentos */
.quote { display: flex; flex-direction: column; height: 100%; }
.quote__stars { color: var(--green); display: flex; gap: 2px; margin-bottom: 1rem; }
.quote__text { font-size: var(--fs-base); color: var(--text); flex: 1; margin-bottom: 1.5rem; }
.quote__author { display: flex; align-items: center; gap: 0.85rem; }
.quote__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: var(--radius-pill);
  background: var(--navy);
  color: var(--white);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-sm);
}
.quote__name { font-weight: 600; color: var(--navy); font-size: var(--fs-sm); line-height: 1.3; }
.quote__role { font-size: var(--fs-xs); color: var(--text-muted); }

/* CTA final */
.cta-final {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-deep) 100%);
  border-radius: var(--radius-lg);
  padding: 3rem 1.75rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.8);
}
.cta-final h2 { color: var(--white); }
.cta-final p { max-width: 36rem; margin: 0 auto 2rem; font-size: var(--fs-lg); }
.cta-final__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}
@media (min-width: 768px) { .cta-final { padding: 4rem 3rem; } }

/* --------------------------------------------------------------------------
   8. Footer
   -------------------------------------------------------------------------- */
.footer {
  background: var(--navy-deep);
  color: rgba(255, 255, 255, 0.66);
  padding-block: 3.5rem 2rem;
  font-size: var(--fs-sm);
}
.footer__grid { display: grid; gap: 2.5rem; }
@media (min-width: 768px) { .footer__grid { grid-template-columns: 1.4fr 1fr 1fr 1.2fr; gap: 2rem; } }
.footer h4 {
  color: var(--white);
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1.1rem;
}
.footer a { color: rgba(255, 255, 255, 0.66); }
.footer a:hover { color: var(--white); }
.footer li + li { margin-top: 0.65rem; }
.footer__brand img {
  height: 44px;
  width: auto;
  background: var(--white);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 1.1rem;
}
.footer__contact li { display: flex; gap: 0.6rem; align-items: flex-start; }
.footer__contact .icon { flex: none; margin-top: 3px; color: #6ee7a0; }
.social { display: flex; gap: 0.75rem; margin-top: 1.25rem; }
.social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.07);
  color: var(--white);
  transition: background-color var(--transition);
}
.social a:hover { background: var(--green); }
.footer__bottom {
  margin-top: 3rem;
  padding-top: 1.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  justify-content: space-between;
  font-size: var(--fs-xs);
  color: rgba(255, 255, 255, 0.5);
}

/* --------------------------------------------------------------------------
   9. Páginas internas — cabeçalho
   -------------------------------------------------------------------------- */
.page-head {
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-deep) 100%);
  color: rgba(255, 255, 255, 0.78);
  padding-block: 3rem;
}
.page-head h1 { color: var(--white); font-size: var(--fs-3xl); margin-bottom: 0.5rem; }
.page-head p { max-width: 42rem; margin: 0; }
.breadcrumb {
  display: flex;
  gap: 0.5rem;
  font-size: var(--fs-xs);
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 1.25rem;
}
.breadcrumb a { color: rgba(255, 255, 255, 0.75); }

/* --------------------------------------------------------------------------
   10. Formulários
   -------------------------------------------------------------------------- */
.field { margin-bottom: 1.4rem; }
.field__label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.45rem;
}
.field__label .req { color: var(--danger); }
.field__hint { font-size: var(--fs-xs); color: var(--text-muted); margin: 0.4rem 0 0; }

.input,
.select,
.textarea {
  width: 100%;
  min-height: 52px;
  padding: 0.8rem 1rem;
  background: var(--gray-50);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: border-color var(--transition), background-color var(--transition);
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
.select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.75rem;
}
.input:focus,
.select:focus,
.textarea:focus { background: var(--white); border-color: var(--green); outline: none; }
.input--mono { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.04em; }
.input--mono::placeholder { text-transform: none; letter-spacing: normal; }

.field[data-state="invalid"] .input,
.field[data-state="invalid"] .select,
.field[data-state="invalid"] .textarea { border-color: var(--danger); background: #fef4f4; }
.field[data-state="valid"] .input,
.field[data-state="valid"] .select,
.field[data-state="valid"] .textarea { border-color: var(--green); }

.field__error {
  display: none;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--fs-xs);
  color: var(--danger);
  margin-top: 0.4rem;
  font-weight: 500;
}
.field[data-state="invalid"] .field__error { display: flex; }

/* Upload */
.upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 2rem 1rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--gray-50);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background-color var(--transition);
}
.upload:hover,
.upload[data-dragover="true"] { border-color: var(--green); background: var(--green-soft); }
.upload .icon { color: var(--green); }
.upload__title { font-weight: 600; color: var(--navy); font-size: var(--fs-sm); }
.upload__hint { font-size: var(--fs-xs); color: var(--text-muted); }
.upload__file {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
}
.upload__file[data-visible="true"] { display: flex; }
.upload__file button {
  background: none;
  border: 0;
  color: var(--danger);
  cursor: pointer;
  font-size: var(--fs-xs);
  font-weight: 600;
  text-decoration: underline;
}

/* Alertas */
.alert {
  display: flex;
  gap: 0.85rem;
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--info);
  background: var(--gray-50);
  font-size: var(--fs-sm);
  margin-bottom: 1.5rem;
}
.alert .icon { flex: none; margin-top: 2px; color: var(--info); }
.alert__title { display: block; color: var(--navy); font-weight: 700; margin-bottom: 0.15rem; }
.alert strong { color: var(--navy); }
.alert p { margin: 0; color: var(--text-muted); }
.alert--ok { border-left-color: var(--ok); background: var(--green-soft); }
.alert--ok .icon { color: var(--ok); }
.alert--warn { border-left-color: var(--warn); background: #fffbeb; }
.alert--warn .icon { color: var(--warn); }
.alert--danger { border-left-color: var(--danger); background: #fef4f4; }
.alert--danger .icon { color: var(--danger); }

/* --------------------------------------------------------------------------
   11. Módulo de rastreio
   -------------------------------------------------------------------------- */
.track-layout { display: grid; gap: 2rem; align-items: start; }
/* Itens de grid não encolhem abaixo do min-content sem isto — causa de
   estouro horizontal em telas de 320px. */
.track-layout > * { min-width: 0; }

.track-form {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.track-form__row { display: grid; gap: 0.75rem; }
@media (min-width: 640px) { .track-form__row { grid-template-columns: 1fr auto; } }

/* Chips de códigos múltiplos */
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.chips:empty { display: none; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.4rem 0.4rem 0.85rem;
  border-radius: var(--radius-pill);
  background: var(--gray-50);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--navy);
  cursor: pointer;
  transition: border-color var(--transition), background-color var(--transition);
}
.chip:hover { border-color: var(--green); }
.chip[aria-selected="true"] { background: var(--navy); border-color: var(--navy); color: var(--white); }
.chip__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: rgba(21, 39, 68, 0.08);
  color: inherit;
  cursor: pointer;
}
.chip[aria-selected="true"] .chip__remove { background: rgba(255, 255, 255, 0.18); }
.chip__remove:hover { background: var(--danger); color: var(--white); }

/* Resultado */
.result { display: none; }
.result[data-visible="true"] { display: block; animation: fadeUp 420ms ease both; }

.shipment-head {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}
.shipment-code {
  font-family: var(--font-mono);
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--navy);
  letter-spacing: 0.04em;
}
.shipment-sub { font-size: var(--fs-sm); color: var(--text-muted); margin: 0.25rem 0 0; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--green);
  color: var(--white);
}
.badge--navy { background: var(--navy); }
.badge--warn { background: var(--warn); }
.badge--danger { background: var(--danger); }
.badge--muted { background: var(--gray-200); color: var(--gray-900); }

/* Dados do envio */
.data-grid { display: grid; gap: 1.25rem; margin-bottom: 2rem; }
@media (min-width: 640px) { .data-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .data-grid { grid-template-columns: repeat(4, 1fr); } }
.data-item__label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.data-item__value { font-weight: 600; color: var(--navy); font-size: var(--fs-sm); line-height: 1.45; }
.data-item__value--mono { font-family: var(--font-mono); }

/* Timeline */
.timeline { position: relative; padding-left: 3.25rem; }
.timeline::before {
  content: "";
  position: absolute;
  left: 21px;
  top: 12px;
  bottom: 12px;
  width: 2px;
  background: var(--border);
}
.tl-step { position: relative; padding-bottom: 2rem; }
.tl-step:last-child { padding-bottom: 0; }
.tl-step__dot {
  position: absolute;
  left: -3.25rem;
  top: -2px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--white);
  border: 2px solid var(--border);
  color: var(--gray-500);
  z-index: 1;
}
.tl-step[data-state="done"] .tl-step__dot {
  background: var(--green);
  border-color: var(--green);
  color: var(--white);
}
.tl-step[data-state="current"] .tl-step__dot {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
  box-shadow: 0 0 0 6px rgba(21, 39, 68, 0.1);
}
.tl-step[data-state="failed"] .tl-step__dot {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--white);
}
.tl-step__title { font-weight: 700; color: var(--navy); font-size: var(--fs-base); margin-bottom: 0.15rem; }
.tl-step[data-state="pending"] .tl-step__title { color: var(--text-muted); font-weight: 600; }
.tl-step__meta {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}
.tl-step__desc { font-size: var(--fs-sm); color: var(--text-muted); margin: 0; }

/* Mapa estilizado */
.map {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: linear-gradient(160deg, #eef2f6 0%, #e4ebe6 100%);
}
.map svg { display: block; width: 100%; height: auto; }
.map__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  padding: 0.9rem 1.1rem;
  background: var(--white);
  border-top: 1px solid var(--border);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.map__legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.map__legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Histórico */
.history { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.history__row {
  display: grid;
  gap: 0.25rem 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
}
.history__row:last-child { border-bottom: 0; }
.history__row:nth-child(odd) { background: var(--gray-50); }
@media (min-width: 768px) {
  .history__row { grid-template-columns: 190px 1fr 200px; align-items: baseline; }
}
.history__when { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-muted); }
.history__what { font-weight: 600; color: var(--navy); }
.history__where { color: var(--text-muted); font-size: var(--fs-xs); }

/* Estados vazio/erro/carregando */
.state {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.75rem;
  padding: 3.5rem 1.5rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--gray-50);
}
.state[data-visible="true"] { display: flex; }
.state .icon { color: var(--gray-500); }
.state h3 { margin: 0; font-size: var(--fs-lg); }
.state p { margin: 0; color: var(--text-muted); max-width: 28rem; font-size: var(--fs-sm); }
.state--error { border-color: #f3c7c7; background: #fef4f4; }
.state--error .icon { color: var(--danger); }

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Painel genérico */
.panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}
@media (min-width: 768px) { .panel { padding: 2rem; } }
.panel + .panel { margin-top: 1.5rem; }
.panel__title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: var(--fs-lg);
  margin-bottom: 1.5rem;
}
.panel__title .icon { color: var(--green); }

/* --------------------------------------------------------------------------
   12. Chatbot
   -------------------------------------------------------------------------- */
.chat-launcher {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 150;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.25rem 0.85rem 0.85rem;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--green);
  color: var(--white);
  font-weight: 600;
  font-size: var(--fs-sm);
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(21, 39, 68, 0.28);
  transition: transform var(--transition), background-color var(--transition);
}
.chat-launcher:hover { background: var(--green-hover); transform: translateY(-2px); }
.chat-launcher img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--white);
}
.chat-launcher[data-hidden="true"] { display: none; }
.chat-launcher__text { display: none; }
@media (min-width: 640px) { .chat-launcher__text { display: inline; } }

.chat {
  position: fixed;
  inset: 0;
  z-index: 160;
  display: none;
  flex-direction: column;
  background: var(--white);
}
.chat[data-open="true"] { display: flex; animation: fadeUp 240ms ease both; }

@media (min-width: 640px) {
  .chat {
    inset: auto 1.25rem 1.25rem auto;
    width: 396px;
    height: min(640px, calc(100vh - 2.5rem));
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
  }
}

.chat__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: var(--navy);
  color: var(--white);
  flex: none;
}
.chat__avatar {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  background: var(--white);
}
.chat__title { font-weight: 700; font-size: var(--fs-sm); line-height: 1.2; }
.chat__status {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--fs-xs);
  color: rgba(255, 255, 255, 0.7);
}
.chat__status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6ee7a0;
  display: inline-block;
}
.chat__actions { margin-left: auto; display: flex; gap: 0.25rem; }
.chat__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--white);
  cursor: pointer;
  transition: background-color var(--transition);
}
.chat__icon-btn:hover { background: rgba(255, 255, 255, 0.12); }

.chat__body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1rem;
  background: var(--gray-50);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  scroll-behavior: smooth;
}

.msg { display: flex; max-width: 85%; }
.msg__bubble {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  line-height: 1.55;
  box-shadow: var(--shadow-sm);
  white-space: pre-wrap;
  word-break: break-word;
}
.msg--bot { align-self: flex-start; }
.msg--bot .msg__bubble {
  background: var(--white);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.msg--user { align-self: flex-end; }
.msg--user .msg__bubble {
  background: var(--navy);
  color: var(--white);
  border-bottom-right-radius: 4px;
}
.msg__bubble code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--green-soft);
  color: var(--green-hover);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
.msg--user .msg__bubble code { background: rgba(255, 255, 255, 0.16); color: var(--white); }
.msg__bubble a { text-decoration: underline; }
.msg--user .msg__bubble a { color: #a7f3c4; }

/* Indicador de digitação */
.typing { display: none; align-self: flex-start; }
.typing[data-visible="true"] { display: flex; }
.typing .msg__bubble { display: flex; gap: 4px; align-items: center; background: var(--white); padding: 0.9rem 1rem; }
.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gray-500);
  animation: bounce 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-5px); opacity: 1; }
}

.chat__quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0 1rem 0.75rem;
  background: var(--gray-50);
  flex: none;
}
.chat__quick:empty { display: none; }
.quick-btn {
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--green);
  border-radius: var(--radius-pill);
  background: var(--white);
  color: var(--green-hover);
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--transition), color var(--transition);
}
.quick-btn:hover { background: var(--green); color: var(--white); }

.chat__form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid var(--border);
  background: var(--white);
  flex: none;
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
}
.chat__input {
  flex: 1;
  min-height: 48px;
  max-height: 120px;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--gray-50);
  font-size: var(--fs-sm);
  resize: none;
  line-height: 1.4;
}
.chat__input:focus { background: var(--white); border-color: var(--green); outline: none; }
.chat__send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: var(--green);
  color: var(--white);
  cursor: pointer;
  transition: background-color var(--transition);
}
.chat__send:hover { background: var(--green-hover); }
.chat__send:disabled { background: var(--gray-200); color: var(--gray-500); cursor: not-allowed; }

/* --------------------------------------------------------------------------
   13. Animações de entrada
   -------------------------------------------------------------------------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 560ms ease, transform 560ms ease;
}
[data-reveal].is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   14. Utilitários
   -------------------------------------------------------------------------- */
.mono { font-family: var(--font-mono); }
.muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.stack > * + * { margin-top: 1rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.85rem; }
.icon { width: 20px; height: 20px; stroke-width: 2; flex: none; }
.icon--sm { width: 16px; height: 16px; }
.icon--lg { width: 40px; height: 40px; stroke-width: 1.5; }
.no-scroll { overflow: hidden; }
