:root {
  --green: #4fbe5d;
  --green-dark: #37a84a;
  --green-soft: #e8f8eb;
  --navy: #1d2347;
  --navy-deep: #08162a;
  --ink: #172239;
  --muted: #677083;
  --line: #dfe5e9;
  --paper: #fff;
  --mist: #f3f6f7;
  --orange: #e9963e;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--ink); background: var(--navy-deep); font-family: "Montserrat", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
.skip-link { position: absolute; z-index: 1000; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.skip-link:focus { top: 10px; left: 10px; width: auto; height: auto; padding: 10px 14px; color: #fff; background: var(--navy); clip: auto; }
.tracking-kicker { margin: 0; color: var(--green); font-size: 11px; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
.tracking-kicker::before { content: ""; display: inline-block; width: 28px; height: 3px; margin-right: 10px; background: currentColor; vertical-align: middle; }
.tracking-brand { display: inline-flex; width: 150px; }
.tracking-brand img { width: 100%; height: auto; }

/* Login */
.tracking-login { min-height: 100dvh; display: grid; grid-template-columns: minmax(420px, 48%) 1fr; overflow: hidden; color: var(--paper); background: var(--navy-deep); }
.login-visual { position: relative; min-height: 100dvh; overflow: hidden; }
.login-visual img { width: 118%; height: 100%; object-fit: cover; object-position: 60% center; filter: saturate(.92) contrast(1.05); }
.login-visual::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(8,22,42,.28), rgba(8,22,42,.05) 62%, rgba(8,22,42,.52)); }
.login-cut { position: absolute; z-index: 2; top: 0; right: -1px; width: 24%; height: 100%; background: var(--navy-deep); clip-path: polygon(100% 0, 100% 100%, 0 100%, 75% 0); }
.login-panel { position: relative; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 56px clamp(46px, 6vw, 116px) 42px clamp(34px, 3vw, 66px); }
.login-panel > .tracking-brand { position: absolute; top: 44px; left: clamp(34px, 3vw, 66px); }
.login-copy { max-width: 590px; margin: 68px 0 36px; }
.login-copy h1 { margin: 18px 0 20px; color: var(--paper); font-size: clamp(43px, 4.3vw, 70px); line-height: .98; letter-spacing: -.045em; }
.login-copy h1 span { color: var(--green); }
.login-copy > p:last-child { max-width: 550px; margin: 0; color: rgba(255,255,255,.68); font-size: 15px; line-height: 1.65; }
.login-card { width: min(550px, 100%); padding: 28px 30px 24px; color: var(--ink); background: var(--paper); border-radius: 12px; box-shadow: 0 28px 70px rgba(0,0,0,.24); }
.login-card-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 23px; }
.login-icon { display: grid; place-items: center; flex: 0 0 48px; width: 48px; height: 48px; color: var(--paper); background: var(--green); border-radius: 9px; font-size: 20px; }
.login-card-heading strong, .login-card-heading small { display: block; }
.login-card-heading strong { color: var(--navy); font-size: 17px; }
.login-card-heading small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.login-card label { display: block; margin: 14px 0 7px; color: var(--navy); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.field-wrap { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; min-height: 52px; overflow: hidden; background: #f7f9fa; border: 1px solid var(--line); border-radius: 8px; transition: border-color .2s ease, box-shadow .2s ease; }
.field-wrap:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(79,190,93,.13); }
.field-wrap > i { color: #8c95a3; text-align: center; }
.field-wrap input { min-width: 0; height: 50px; padding: 0 8px 0 0; color: var(--ink); background: transparent; border: 0; outline: 0; font-size: 14px; }
.field-wrap input::placeholder { color: #9ba3af; }
.password-toggle { width: 44px; height: 50px; padding: 0; color: #8c95a3; background: transparent; border: 0; cursor: pointer; }
.login-error { margin: 13px 0 0; color: #bb3434; font-size: 12px; line-height: 1.4; }
.tracking-button { width: 100%; min-height: 54px; display: flex; align-items: center; justify-content: space-between; margin-top: 20px; padding: 0 20px; color: var(--paper); background: var(--green); border: 0; border-radius: 8px; font-weight: 800; cursor: pointer; transition: background .2s ease, transform .2s ease; }
.tracking-button:hover { background: var(--green-dark); transform: translateY(-1px); }
.tracking-button:disabled { opacity: .6; cursor: wait; }
.demo-access { margin: 16px 0 0; padding: 10px 12px; color: #596276; background: #f0f5f1; border-left: 3px solid var(--green); font-size: 10px; line-height: 1.45; }
.demo-access strong, .demo-access span { display: block; }
.demo-access strong { margin-bottom: 3px; color: var(--navy); }
.back-site { position: absolute; left: clamp(34px, 3vw, 66px); bottom: 28px; color: rgba(255,255,255,.62); font-size: 12px; font-weight: 700; }
.back-site i { margin-right: 8px; color: var(--green); }

/* Aplicação */
.tracking-app { min-height: 100dvh; background: var(--mist); }
.tracking-header { position: relative; z-index: 1001; height: 88px; display: grid; grid-template-columns: 180px 1fr auto; align-items: center; gap: 28px; padding: 0 34px; color: var(--paper); background: var(--navy-deep); border-bottom: 1px solid rgba(255,255,255,.08); }
.tracking-header .tracking-brand { width: 132px; }
.tracking-header-title { padding-left: 24px; border-left: 1px solid rgba(255,255,255,.2); }
.tracking-header-title span, .tracking-header-title strong { display: block; }
.tracking-header-title span { color: var(--green); font-size: 9px; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }
.tracking-header-title strong { margin-top: 4px; font-size: 14px; }
.tracking-account { display: flex; align-items: center; gap: 13px; }
.tracking-account > img { width: 82px; height: 38px; padding: 4px 8px; object-fit: contain; background: var(--paper); border-radius: 5px; }
.tracking-account div span, .tracking-account div small { display: block; }
.tracking-account div span { max-width: 210px; overflow: hidden; font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.tracking-account div small { margin-top: 3px; color: rgba(255,255,255,.55); font-size: 9px; }
.tracking-account button { height: 38px; display: inline-flex; align-items: center; gap: 7px; margin-left: 7px; padding: 0 12px; color: rgba(255,255,255,.7); background: transparent; border: 1px solid rgba(255,255,255,.18); border-radius: 6px; font-size: 11px; cursor: pointer; }
.tracking-account button:hover { color: var(--paper); border-color: rgba(255,255,255,.45); }
.tracking-layout { height: calc(100dvh - 88px); min-height: 620px; display: grid; grid-template-columns: 410px minmax(0, 1fr); }
.loads-panel { position: relative; z-index: 3; min-height: 0; display: flex; flex-direction: column; padding: 31px 26px 20px; background: var(--paper); border-right: 1px solid var(--line); box-shadow: 12px 0 32px rgba(13,27,44,.07); }
.loads-intro { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 10px; }
.loads-intro h1 { margin: 8px 0 0; color: var(--navy); font-size: 32px; line-height: 1; letter-spacing: -.04em; }
.live-badge { align-self: start; display: inline-flex; align-items: center; gap: 6px; padding: 7px 8px; color: var(--green-dark); background: var(--green-soft); border-radius: 4px; font-size: 8px; font-weight: 900; text-transform: uppercase; }
.live-badge i { width: 6px; height: 6px; background: var(--green); border-radius: 50%; box-shadow: 0 0 0 4px rgba(79,190,93,.13); }
.loads-updated { grid-column: 1 / -1; margin: 10px 0 0; color: var(--muted); font-size: 10px; }
.loads-summary { display: grid; grid-template-columns: repeat(3, 1fr); margin: 23px 0 18px; border: 1px solid var(--line); border-radius: 8px; }
.loads-summary article { min-width: 0; padding: 13px 10px; border-right: 1px solid var(--line); }
.loads-summary article:last-child { border-right: 0; }
.loads-summary span, .loads-summary small { display: block; }
.loads-summary span { color: var(--navy); font-size: 21px; font-weight: 900; }
.loads-summary small { margin-top: 3px; color: var(--muted); font-size: 8px; line-height: 1.3; text-transform: uppercase; }
.loads-list { min-height: 0; display: grid; align-content: start; gap: 9px; overflow-y: auto; padding: 2px 4px 14px 1px; scrollbar-width: thin; scrollbar-color: #b6bec8 transparent; }
.load-card { position: relative; width: 100%; display: grid; gap: 10px; padding: 15px 15px 14px; color: var(--ink); text-align: left; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease; }
.load-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: transparent; border-radius: 8px 0 0 8px; }
.load-card:hover { border-color: #bfc8cf; transform: translateY(-1px); box-shadow: 0 9px 22px rgba(20,37,56,.07); }
.load-card.is-active { border-color: rgba(79,190,93,.62); background: #fbfefb; box-shadow: 0 10px 25px rgba(49,137,65,.1); }
.load-card.is-active::before { background: var(--green); }
.load-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.load-card-top strong { color: var(--navy); font-size: 15px; }
.status-chip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 7px; border-radius: 999px; font-size: 7px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.status-chip::before { content: ""; width: 5px; height: 5px; background: currentColor; border-radius: 50%; }
.status-live { color: #258238; background: #e7f7e9; }
.status-near { color: #237b63; background: #e6f6f1; }
.load-route { display: grid; grid-template-columns: 1fr 18px 1fr; align-items: center; gap: 6px; }
.load-route > div:last-child { text-align: right; }
.load-route span, .load-route strong { display: block; }
.load-route span { color: var(--muted); font-size: 8px; text-transform: uppercase; }
.load-route strong { margin-top: 3px; color: var(--ink); font-size: 11px; line-height: 1.25; }
.load-route i { color: var(--green); font-size: 12px; text-align: center; }
.load-meta { display: flex; justify-content: space-between; gap: 10px; padding-top: 9px; color: var(--muted); border-top: 1px solid #edf0f2; font-size: 9px; }
.load-meta b { color: var(--navy); }
.loads-empty { margin: auto 0; padding: 30px 22px; color: var(--muted); text-align: center; }
.loads-empty i { color: var(--green); font-size: 38px; }
.loads-empty strong { display: block; margin: 13px 0 7px; color: var(--navy); }
.loads-empty p { margin: 0; font-size: 11px; line-height: 1.6; }
.loads-footer { display: flex; align-items: center; gap: 10px; padding-top: 15px; color: var(--muted); border-top: 1px solid var(--line); font-size: 9px; line-height: 1.45; }
.loads-footer i { color: var(--green); font-size: 16px; }

.map-panel { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #e4e8e9; }
#tracking-map { position: absolute; inset: 0; z-index: 1; background: #e4e8e9; }
.map-toolbar { position: absolute; z-index: 500; top: 20px; right: 20px; }
.map-toolbar button { min-height: 38px; padding: 0 13px; color: var(--navy); background: rgba(255,255,255,.94); border: 1px solid rgba(23,34,57,.15); border-radius: 6px; box-shadow: 0 8px 24px rgba(12,29,47,.12); font-size: 10px; font-weight: 800; cursor: pointer; }
.map-toolbar i { margin-right: 6px; color: var(--green-dark); }
.selected-load { position: absolute; z-index: 500; right: 20px; bottom: 50px; width: min(530px, calc(100% - 40px)); padding: 20px 22px 17px; background: rgba(255,255,255,.97); border: 1px solid rgba(23,34,57,.12); border-radius: 10px; box-shadow: 0 20px 55px rgba(12,29,47,.2); backdrop-filter: blur(9px); }
.selected-load::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--green); border-radius: 10px 0 0 10px; }
.selected-head { display: flex; justify-content: space-between; align-items: center; }
.selected-status { color: var(--green-dark); font-size: 9px; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
.selected-head button { width: 28px; height: 28px; padding: 0; color: #86909d; background: transparent; border: 0; cursor: pointer; }
.selected-route { display: flex; align-items: center; gap: 10px; margin: 11px 0 17px; color: var(--navy); font-size: 16px; }
.selected-route i { color: var(--green); }
.selected-route strong { font-size: 18px; }
.selected-grid { display: grid; grid-template-columns: 1.25fr 1fr 1.35fr; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.selected-grid > div { min-width: 0; padding: 13px 12px 13px 0; }
.selected-grid > div + div { padding-left: 13px; border-left: 1px solid var(--line); }
.selected-grid small, .selected-grid strong { display: block; }
.selected-grid small { color: var(--muted); font-size: 8px; text-transform: uppercase; }
.selected-grid strong { margin-top: 5px; overflow: hidden; color: var(--navy); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.selected-note { margin: 12px 0 0; color: var(--muted); font-size: 9px; line-height: 1.45; }
.map-legend { position: absolute; z-index: 500; left: 20px; bottom: 18px; display: flex; gap: 14px; padding: 8px 11px; color: #4f5968; background: rgba(255,255,255,.9); border-radius: 5px; box-shadow: 0 7px 22px rgba(12,29,47,.1); font-size: 8px; }
.map-legend span { display: flex; align-items: center; gap: 6px; }
.map-legend i { width: 8px; height: 8px; border-radius: 50%; }
.legend-live { background: var(--green); }
.demo-ribbon { position: absolute; z-index: 500; top: 20px; left: 50%; padding: 8px 12px; color: var(--navy); background: rgba(255,248,220,.95); border: 1px solid rgba(173,129,45,.25); border-radius: 5px; box-shadow: 0 7px 20px rgba(12,29,47,.09); font-size: 9px; font-weight: 800; transform: translateX(-50%); }

.leaflet-container { font: inherit; }
.leaflet-control-attribution { font-size: 8px !important; }
.leaflet-bar a { color: var(--navy) !important; }
.truck-marker { background: none; border: 0; }
.truck-marker span { position: relative; display: grid; place-items: center; width: 34px; height: 34px; color: var(--paper); background: var(--green); border: 3px solid var(--paper); border-radius: 50%; box-shadow: 0 7px 17px rgba(13,29,45,.25); }
.truck-marker span::after { content: ""; position: absolute; right: 0; bottom: 0; width: 8px; height: 8px; background: var(--green); border: 2px solid var(--paper); border-radius: 50%; }
.truck-marker i { font-size: 13px; }
.destination-marker span { display: grid; place-items: center; width: 28px; height: 28px; color: var(--paper); background: var(--navy); border: 3px solid var(--paper); border-radius: 50% 50% 50% 0; box-shadow: 0 6px 14px rgba(13,29,45,.22); transform: rotate(-45deg); }
.destination-marker i { font-size: 10px; transform: rotate(45deg); }
.truck-popup strong { color: var(--navy); font-size: 12px; }
.truck-popup span { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }

@media (max-width: 1080px) {
  .tracking-login { grid-template-columns: 42% 1fr; }
  .login-panel { padding-right: 42px; }
  .tracking-layout { grid-template-columns: 360px minmax(0, 1fr); }
  .tracking-header { padding-inline: 24px; }
  .tracking-account div { display: none; }
}

@media (max-width: 780px) {
  .tracking-login { display: block; min-height: 100dvh; background: linear-gradient(rgba(8,22,42,.86), rgba(8,22,42,.94)), url("../images/hero-green-highway.webp") 62% center / cover; }
  .login-visual { display: none; }
  .login-panel { min-height: 100dvh; padding: 105px 22px 68px; }
  .login-panel > .tracking-brand { top: 30px; left: 22px; width: 128px; }
  .login-copy { margin: 20px 0 26px; }
  .login-copy h1 { font-size: clamp(39px, 12vw, 56px); }
  .login-card { padding: 24px 20px 20px; }
  .back-site { left: 22px; bottom: 22px; }
  .tracking-header { height: 72px; grid-template-columns: 116px 1fr auto; gap: 12px; padding-inline: 15px; }
  .tracking-header .tracking-brand { width: 108px; }
  .tracking-header-title { padding-left: 12px; }
  .tracking-header-title span { display: none; }
  .tracking-header-title strong { margin: 0; font-size: 11px; }
  .tracking-account > img { display: none; }
  .tracking-account button { width: 38px; padding: 0; justify-content: center; }
  .tracking-account button span { display: none; }
  .tracking-layout { height: auto; min-height: calc(100dvh - 72px); display: flex; flex-direction: column; }
  .loads-panel { order: 2; min-height: 480px; padding: 25px 18px 18px; }
  .map-panel { order: 1; height: 56dvh; min-height: 430px; }
  .selected-load { right: 12px; bottom: 42px; width: calc(100% - 24px); padding: 17px 17px 14px; }
  .selected-route { font-size: 13px; }
  .selected-route strong { font-size: 14px; }
  .selected-grid { grid-template-columns: 1fr 1fr; }
  .selected-grid > div:nth-child(3) { grid-column: 1 / -1; padding-left: 0; border-top: 1px solid var(--line); border-left: 0; }
  .map-toolbar { top: 12px; right: 12px; }
  .map-legend { left: 12px; bottom: 10px; }
  .demo-ribbon { top: 12px; left: 12px; transform: none; }
}

@media (max-width: 430px) {
  .tracking-header-title { display: none; }
  .tracking-header { grid-template-columns: 1fr auto; }
  .loads-intro { grid-template-columns: 1fr; }
  .live-badge { justify-self: start; }
  .loads-summary small { font-size: 7px; }
  .map-legend { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
