:root {
  --green-950: #071f18;
  --green-900: #0a2d23;
  --green-800: #113a30;
  --green-700: #0f6f4b;
  --green-600: #118756;
  --green-500: #16a065;
  --green-100: #d9eee7;
  --ink: #16211c;
  --muted: #63756d;
  --line: #d8e2dd;
  --surface: #f7faf8;
  --white: #ffffff;
  --shadow: 0 22px 45px rgba(10, 45, 35, 0.16);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  background: var(--surface);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.brand-panel {
  position: fixed;
  inset: 0 auto 0 0;
  width: 50%;
  min-width: 520px;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.88);
  background:
    radial-gradient(circle at 54% 52%, rgba(255, 255, 255, 0.18), transparent 23%),
    linear-gradient(90deg, rgba(7, 31, 24, 0.98), rgba(16, 54, 44, 0.82)),
    var(--green-950);
}

.brand-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 56px 60px;
}

.brand-header.compact {
  padding: 0;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 2px solid rgba(22, 160, 101, 0.45);
  border-radius: 999px;
}

.brand-mark::before {
  position: absolute;
  bottom: -4px;
  width: 9px;
  height: 9px;
  content: "";
  background: var(--green-500);
  clip-path: polygon(50% 100%, 0 0, 100% 0);
}

.brand-mark span {
  width: 9px;
  height: 9px;
  background: var(--green-500);
  border: 2px solid var(--green-100);
  border-radius: 999px;
}

.brand-name {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-name span {
  color: var(--green-500);
}

.radar {
  position: absolute;
  top: 29%;
  left: 27%;
  width: min(37vw, 500px);
  aspect-ratio: 1;
  border: 1px solid rgba(17, 135, 86, 0.18);
  border-radius: 999px;
}

.radar::before,
.radar::after {
  position: absolute;
  inset: 16%;
  content: "";
  border: 1px solid rgba(17, 135, 86, 0.2);
  border-radius: inherit;
}

.radar::after {
  inset: 32%;
}

.radar-dot {
  position: absolute;
  inset: 49% auto auto 49%;
  width: 12px;
  height: 12px;
  background: var(--green-500);
  border-radius: 999px;
  box-shadow: 0 0 0 14px rgba(22, 160, 101, 0.06);
}

.brand-copy {
  position: absolute;
  z-index: 2;
  top: 47%;
  left: 60px;
  width: min(520px, calc(100% - 120px));
  transform: translateY(-5%);
}

.brand-copy h1 {
  max-width: 410px;
  margin: 0 0 16px;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.18;
  letter-spacing: 0;
}

.brand-copy p {
  max-width: 600px;
  margin: 0;
  color: rgba(255, 255, 255, 0.62);
  font-size: 16px;
  line-height: 1.6;
}

.brand-footer {
  position: absolute;
  bottom: 42px;
  left: 60px;
  color: rgba(255, 255, 255, 0.36);
  font-size: 13px;
}

.auth-panel {
  display: grid;
  min-height: 100vh;
  margin-left: 50%;
  padding: 40px;
  place-items: center;
  background: #fbfdfc;
}

.auth-box {
  width: min(100%, 384px);
}

.auth-box h2 {
  margin: 0 0 8px;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: 0;
}

.auth-box > p {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 15px;
}

.segment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  min-height: 40px;
  margin-bottom: 24px;
  padding: 4px;
  background: #edf3f0;
  border-radius: 8px;
}

.segment-button {
  min-height: 32px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
}

.segment-button.active {
  color: var(--ink);
  background: var(--white);
  box-shadow: 0 1px 2px rgba(10, 45, 35, 0.08);
}

.auth-form {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 10px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}

.field input,
.field select {
  width: 100%;
  min-height: 40px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.field input:focus,
.field select:focus {
  border-color: var(--green-500);
  box-shadow: 0 0 0 4px rgba(22, 160, 101, 0.13);
}

.field select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 17px,
    calc(100% - 12px) 17px;
  background-repeat: no-repeat;
  background-size: 6px 6px;
}

.form-message {
  min-height: 18px;
  margin: -6px 0 0;
  color: #b42318;
  font-size: 13px;
}

.form-message.success {
  color: var(--green-700);
}

.primary-button {
  min-height: 44px;
  color: var(--white);
  background: linear-gradient(90deg, #108052, #19a768);
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
  transition:
    transform 150ms ease,
    filter 150ms ease;
}

.primary-button:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
}

.ghost-button {
  min-height: 42px;
  color: var(--green-700);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 700;
}

.ghost-button:hover {
  background: #edf7f2;
  border-color: rgba(22, 160, 101, 0.35);
}

.switch-line {
  margin-top: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.switch-line button {
  padding: 0;
  color: var(--green-700);
  background: transparent;
  border: 0;
  font-weight: 700;
}

.dashboard {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
  background: #f2f7f4;
}

.dashboard-sidebar {
  display: flex;
  flex-direction: column;
  gap: 34px;
  padding: 32px;
  color: var(--white);
  background: var(--green-950);
}

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

.nav-item,
.logout-button {
  min-height: 42px;
  padding: 0 14px;
  color: rgba(255, 255, 255, 0.7);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
}

.nav-item.active,
.nav-item:hover,
.logout-button:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.08);
}

.logout-button {
  margin-top: auto;
}

.dashboard-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 24px;
  padding: 38px;
  min-height: 100vh;
  background: #bdffbc;
}

.dashboard-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green-700);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.dashboard-topbar h2 {
  margin: 0;
  font-size: 30px;
  letter-spacing: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 14px;
  color: var(--green-700);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 700;
}

.status-pill span {
  width: 9px;
  height: 9px;
  background: var(--green-500);
  border-radius: 999px;
}

.digital-clock {
  min-height: 36px;
  min-width: 104px;
  padding: 7px 12px;
  color: var(--green-900);
  text-align: center;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: "Segoe UI", ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0;
}

.panel-toggle {
  min-height: 36px;
  padding: 0 14px;
  color: var(--green-900);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
}

.panel-toggle:hover {
  border-color: rgba(22, 160, 101, 0.45);
  background: #f4faf7;
}

.tracking-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  min-height: 0;
  transition: grid-template-columns 180ms ease;
}

.tracking-layout.panel-collapsed {
  grid-template-columns: minmax(0, 1fr) 58px;
}

.map-surface,
.vehicle-panel {
  background: #bdffbc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.map-surface {
  position: relative;
  min-height: 100%;
  overflow: hidden;
  background: #bdffbc;
}

#live-map {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #bdffbc;
}

.leaflet-container {
  background: #bdffbc;
}

.leaflet-control-attribution {
  font-size: 10px;
}

.leaflet-popup-content {
  margin: 0;
}

.vehicle-popup {
  width: 260px;
  overflow: hidden;
  color: var(--ink);
  background: var(--white);
  border-radius: 8px;
}

.vehicle-popup img {
  display: block;
  width: 100%;
  height: 118px;
  object-fit: cover;
}

.vehicle-popup-body {
  display: grid;
  gap: 4px;
  padding: 12px;
}

.vehicle-popup-body strong {
  color: var(--green-900);
  font-size: 16px;
}

.vehicle-popup-body span,
.vehicle-popup-body small {
  color: var(--muted);
  font-size: 12px;
}

.vehicle-popup-body p {
  margin: 6px 0 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}

.vehicle-marker {
  display: block;
  width: 64px;
  height: 46px;
  padding: 5px;
  background: var(--white);
  border: 2px solid var(--green-500);
  border-radius: 8px;
  box-shadow: 0 12px 24px rgba(8, 68, 43, 0.28);
}

.vehicle-marker img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.map-status {
  position: absolute;
  z-index: 2;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 4px;
  min-width: 210px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(10, 45, 35, 0.12);
}

.map-status strong {
  color: var(--green-900);
}

.map-status span {
  color: var(--muted);
  font-size: 13px;
}

.vehicle-panel {
  position: relative;
  align-self: start;
  padding: 22px;
  overflow: hidden;
  transition:
    padding 180ms ease,
    opacity 180ms ease;
}

.tracking-layout.panel-collapsed .vehicle-panel {
  min-height: 580px;
  padding: 12px 8px;
}

.tracking-layout.panel-collapsed .vehicle-panel::before {
  position: absolute;
  inset: 16px 0 auto;
  color: var(--muted);
  content: "Painel";
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-align: center;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.tracking-layout.panel-collapsed .vehicle-panel h3,
.tracking-layout.panel-collapsed #panel-content {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.vehicle-panel h3 {
  margin: 0 0 18px;
  font-size: 20px;
  letter-spacing: 0;
}

.metric {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  border-top: 1px solid var(--line);
}

.metric span {
  color: var(--muted);
}

.metric strong {
  color: var(--green-900);
  overflow-wrap: anywhere;
  text-align: right;
}

.compact-button {
  width: 100%;
  margin-top: 16px;
}

.panel-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.panel-form {
  display: grid;
  gap: 14px;
}

.panel-form .field {
  gap: 7px;
}

.panel-form .field input,
.panel-form .field select {
  min-height: 38px;
}

.panel-item,
.toggle-row {
  display: grid;
  gap: 4px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.panel-item strong,
.toggle-row strong {
  color: var(--green-900);
}

.panel-item span,
.toggle-row span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.alert-item {
  padding: 14px;
  background: #f4faf7;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.alert-item small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.toggle-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.toggle-row input {
  width: 42px;
  height: 22px;
  accent-color: var(--green-600);
}

.map-fallback {
  display: grid;
  min-height: 100%;
  color: var(--muted);
  place-items: center;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .brand-panel {
    position: relative;
    width: 100%;
    min-width: 0;
    min-height: 44vh;
  }

  .brand-header {
    padding: 28px;
  }

  .brand-copy {
    position: relative;
    top: auto;
    left: auto;
    width: auto;
    padding: 84px 28px 74px;
    transform: none;
  }

  .brand-footer {
    bottom: 24px;
    left: 28px;
  }

  .radar {
    top: 22%;
    left: 40%;
    width: 340px;
  }

  .auth-panel {
    min-height: 56vh;
    margin-left: 0;
    padding: 34px 22px;
  }

  .dashboard {
    grid-template-columns: 1fr;
  }

  .dashboard-sidebar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tracking-layout {
    grid-template-columns: 1fr;
  }

  .tracking-layout.panel-collapsed {
    grid-template-columns: 1fr;
  }

  .tracking-layout.panel-collapsed .vehicle-panel {
    display: none;
  }
}

@media (max-width: 640px) {
  .brand-copy h1 {
    font-size: 2rem;
  }

  .dashboard-main {
    padding: 24px 18px;
  }

  .dashboard-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .map-surface {
    min-height: 420px;
  }
}
