:root {
  --pulso-lime: #C8F169;
  --pulso-lime-hover: #b8e452;
  --pulso-graphite: #101820;
  --pulso-graphite-soft: #1c2835;
  --pulso-white: #FFFFFF;
  --pulso-light-gray: #F3F5F2;
  --pulso-sec-gray: #69736F;
  --pulso-border: #dce2da;
  --pulso-danger: #d92d20;
  --pulso-warning: #d97706;
  --pulso-success: #15803d;
  --pulso-radius: 16px;
  --pulso-shadow: 0 4px 16px rgba(16, 24, 32, 0.06);
  --pulso-safe-bottom: env(safe-area-inset-bottom, 0px);
  --pulso-safe-top: env(safe-area-inset-top, 0px);
  --pulso-shell-width: 460px;
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  background-color: #0b1117;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--pulso-graphite);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  max-width: 100%;
  display: inline-block;
  vertical-align: middle;
}

/* Mobile App Shell Wrapper */
.pulso-mobile-shell {
  width: 100%;
  max-width: var(--pulso-shell-width);
  min-height: 100dvh;
  margin: 0 auto;
  background-color: var(--pulso-light-gray);
  display: flex;
  flex-direction: column;
  position: relative;
  padding-bottom: calc(78px + var(--pulso-safe-bottom));
  box-shadow: 0 0 42px rgba(0, 0, 0, 0.55);
}

/* Top Mobile App Bar */
.pulso-header {
  background-color: var(--pulso-graphite);
  color: var(--pulso-white);
  position: sticky;
  top: 0;
  z-index: 1000;
  padding-top: var(--pulso-safe-top);
  border-bottom: 2px solid var(--pulso-lime);
  width: 100%;
}

.pulso-header-inner {
  padding: 0.65rem 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.pulso-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 800;
  font-size: 1.12rem;
  letter-spacing: 0.04em;
  color: var(--pulso-white);
  min-width: 0;
}

.pulso-brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--pulso-lime);
  color: var(--pulso-graphite);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.pulso-header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

/* Main Content Area */
.pulso-container {
  flex: 1;
  width: 100%;
  padding: 0.85rem 0.85rem 1.25rem;
}

/* Mobile Single-Column Grids */
.pulso-grid,
.pulso-grid-2,
.pulso-grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
}

/* 2-Column Mobile KPI Grid */
.pulso-grid-4 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}

/* Cards */
.pulso-card {
  background-color: var(--pulso-white);
  border-radius: var(--pulso-radius);
  border: 1px solid var(--pulso-border);
  box-shadow: var(--pulso-shadow);
  padding: 0.95rem;
  width: 100%;
  overflow: hidden;
}

.pulso-card-dark {
  background-color: var(--pulso-graphite);
  color: var(--pulso-white);
  border-color: var(--pulso-graphite-soft);
}

.pulso-card-title {
  margin: 0 0 0.65rem;
  font-size: 1rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.pulso-stat-value {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0.15rem 0;
  color: var(--pulso-graphite);
  word-break: break-word;
}

.pulso-card-dark .pulso-stat-value {
  color: var(--pulso-lime);
}

.pulso-stat-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--pulso-sec-gray);
}

.pulso-card-dark .pulso-stat-label {
  color: #b7c1bd;
}

/* Touch Buttons */
.pulso-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 46px;
  padding: 0.65rem 0.95rem;
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.92rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.08s ease, background-color 0.15s ease;
  text-align: center;
  touch-action: manipulation;
  line-height: 1.2;
}

.pulso-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.pulso-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.pulso-btn-primary {
  background-color: var(--pulso-lime);
  color: var(--pulso-graphite);
}

.pulso-btn-primary:hover:not(:disabled) {
  background-color: var(--pulso-lime-hover);
}

.pulso-btn-dark {
  background-color: var(--pulso-graphite);
  color: var(--pulso-white);
}

.pulso-btn-outline {
  background-color: var(--pulso-white);
  border-color: var(--pulso-graphite);
  color: var(--pulso-graphite);
}

.pulso-btn-danger {
  background-color: #fee2e2;
  color: var(--pulso-danger);
  border-color: #fecaca;
}

.pulso-btn-sm {
  min-height: 36px;
  padding: 0.4rem 0.7rem;
  font-size: 0.78rem;
  border-radius: 9px;
}

.pulso-btn-block {
  width: 100%;
}

/* Forms (16px prevents iOS Safari zoom) */
.pulso-form-group {
  margin-bottom: 0.75rem;
}

.pulso-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 0.28rem;
  color: var(--pulso-graphite);
}

.pulso-input,
.pulso-select,
.pulso-textarea {
  width: 100%;
  min-height: 46px;
  padding: 0.65rem 0.8rem;
  border-radius: 11px;
  border: 1.5px solid #c5cec8;
  background-color: var(--pulso-white);
  color: var(--pulso-graphite);
  font-size: 16px;
  font-family: inherit;
}

.pulso-textarea {
  min-height: 80px;
}

.pulso-input:focus,
.pulso-select:focus,
.pulso-textarea:focus {
  outline: none;
  border-color: var(--pulso-graphite);
  box-shadow: 0 0 0 3px rgba(200, 241, 105, 0.5);
}

.pulso-help {
  font-size: 0.75rem;
  color: var(--pulso-sec-gray);
  margin-top: 0.25rem;
}

/* Badges */
.pulso-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.pulso-badge-lime {
  background-color: var(--pulso-lime);
  color: var(--pulso-graphite);
}

.pulso-badge-dark {
  background-color: var(--pulso-graphite);
  color: var(--pulso-white);
}

.pulso-badge-success {
  background-color: #dcfce7;
  color: #166534;
}

.pulso-badge-warning {
  background-color: #fef3c7;
  color: #92400e;
}

.pulso-badge-danger {
  background-color: #fee2e2;
  color: #991b1b;
}

/* Alerts & Offline Banner */
.pulso-alert {
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  margin-bottom: 0.85rem;
  font-weight: 600;
  font-size: 0.86rem;
}

.pulso-alert-success {
  background-color: #ecfccb;
  border: 1px solid #a3e635;
  color: var(--pulso-graphite);
}

.pulso-alert-error {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.pulso-offline-banner {
  display: none;
  background-color: var(--pulso-danger);
  color: var(--pulso-white);
  text-align: center;
  padding: 0.5rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
}

body.is-offline .pulso-offline-banner {
  display: block;
}

/* Empty & Loading States */
.pulso-empty {
  text-align: center;
  padding: 1.4rem 0.9rem;
  color: var(--pulso-sec-gray);
  background: var(--pulso-light-gray);
  border-radius: 12px;
  border: 1px dashed var(--pulso-border);
  font-size: 0.85rem;
}

.pulso-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2.5px solid rgba(16, 24, 32, 0.25);
  border-top-color: var(--pulso-graphite);
  border-radius: 50%;
  animation: pulso-spin 0.7s linear infinite;
}

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

/* Map Container */
.pulso-map {
  width: 100%;
  height: 230px;
  border-radius: 13px;
  border: 1px solid var(--pulso-border);
  overflow: hidden;
  background: #e5e9e4;
  z-index: 1;
}

/* Timeline */
.pulso-timeline {
  list-style: none;
  padding: 0;
  margin: 0;
}

.pulso-timeline-item {
  position: relative;
  padding-left: 1.25rem;
  padding-bottom: 0.85rem;
  border-left: 2px solid var(--pulso-lime);
}

.pulso-timeline-item::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--pulso-graphite);
  border: 2px solid var(--pulso-lime);
}

/* Fixed Bottom Navigation Bar */
.pulso-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: 100%;
  max-width: var(--pulso-shell-width);
  background-color: var(--pulso-graphite);
  border-top: 1px solid #253343;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding: 0.35rem 0.3rem calc(0.35rem + var(--pulso-safe-bottom));
  z-index: 1050;
  box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.35);
}

.pulso-bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.18rem;
  padding: 0.3rem 0.15rem;
  border-radius: 10px;
  color: #9aa6a1;
  font-size: 0.68rem;
  font-weight: 700;
  text-align: center;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  min-width: 0;
}

.pulso-bottom-nav-item svg {
  width: 20px !important;
  height: 20px !important;
  stroke: currentColor;
  stroke-width: 2.1;
  fill: none;
  flex-shrink: 0;
}

.pulso-bottom-nav-item.active {
  color: var(--pulso-lime);
  background-color: rgba(200, 241, 105, 0.12);
}

/* Mobile Slide-Up Bottom Sheet */
.pulso-sheet-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 32, 0.65);
  z-index: 1100;
}

.pulso-sheet-backdrop.open {
  display: block !important;
}

.pulso-bottom-sheet {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0 auto;
  width: 100%;
  max-width: var(--pulso-shell-width);
  background: var(--pulso-white);
  border-radius: 20px 20px 0 0;
  padding: 1rem 1rem calc(1.2rem + var(--pulso-safe-bottom));
  z-index: 1150;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35);
}

.pulso-bottom-sheet.open {
  display: block !important;
}

.pulso-sheet-handle {
  width: 40px;
  height: 5px;
  background: #cbd2ce;
  border-radius: 99px;
  margin: 0 auto 0.85rem;
}

/* PWA Install Banner */
.pulso-pwa-banner {
  display: none;
  background: var(--pulso-graphite);
  color: var(--pulso-white);
  border: 1px solid var(--pulso-lime);
  border-radius: 13px;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.85rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.pulso-pwa-banner.visible {
  display: flex !important;
}

.pulso-footer {
  background: transparent;
  color: var(--pulso-sec-gray);
  padding: 0.75rem 0.85rem 1.25rem;
  text-align: center;
  font-size: 0.74rem;
}

/* Autocomplete de Endereços (OpenStreetMap Nominatim + Photon) */
.pulso-autocomplete-wrap {
  position: relative;
}

.pulso-autocomplete-list {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--pulso-white);
  border: 1.5px solid var(--pulso-graphite);
  border-radius: 12px;
  box-shadow: 0 12px 26px rgba(16, 24, 32, 0.22);
  z-index: 1200;
  max-height: 235px;
  overflow-y: auto;
}

.pulso-autocomplete-list.open {
  display: block;
}

.pulso-autocomplete-item {
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--pulso-border);
  cursor: pointer;
  transition: background 0.12s ease;
}

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

.pulso-autocomplete-item:hover,
.pulso-autocomplete-item:active {
  background: #f0f9d8;
}

.pulso-autocomplete-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--pulso-graphite);
  line-height: 1.25;
}

.pulso-autocomplete-sub {
  font-size: 0.75rem;
  color: var(--pulso-sec-gray);
  margin-top: 0.15rem;
}

/* Indicador de GPS em Tempo Real */
.pulso-live-gps-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: var(--pulso-graphite);
  color: var(--pulso-white);
  padding: 0.6rem 0.8rem;
  border-radius: 11px;
  font-size: 0.8rem;
  margin-top: 0.55rem;
}

.pulso-live-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--pulso-lime);
  box-shadow: 0 0 0 0 rgba(200, 241, 105, 0.8);
  animation: pulso-gps-pulse 1.6s infinite;
  margin-right: 0.35rem;
}

@keyframes pulso-gps-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(200, 241, 105, 0.85);
  }
  70% {
    box-shadow: 0 0 0 9px rgba(200, 241, 105, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(200, 241, 105, 0);
  }
}

