:root {
  --bg-paper: #F6F4EC;
  --bg-surface: #FFFFFF;
  --bg-subtle: #EDE9DC;
  --ink-primary: #16232E;
  --ink-secondary: #475866;
  --ink-muted: #6C7D8C;
  --highway-green: #0E6B45;
  --highway-green-dark: #094D31;
  --highway-green-light: #E6F4EE;
  --sun-amber: #F2A900;
  --sun-amber-light: #FFF7E0;
  --river-blue: #1B6CA8;
  --border-map: #D5D1C4;
  --border-strong: #B8B2A1;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Space Grotesk', monospace;
}

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

body {
  background-color: var(--bg-paper);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header Estilo Cartel Vial RN */
.topbar {
  background-color: var(--ink-primary);
  color: #FFFFFF;
  border-bottom: 4px solid var(--sun-amber);
  padding: 1rem 0;
}

.topbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.highway-shield {
  background-color: #FFFFFF;
  color: var(--ink-primary);
  border: 3px solid var(--ink-primary);
  outline: 2px solid #FFFFFF;
  border-radius: 6px 6px 14px 14px;
  width: 54px;
  height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.shield-country {
  font-size: 0.65rem;
  font-weight: 700;
  border-bottom: 1.5px solid var(--ink-primary);
  width: 100%;
  text-align: center;
  line-height: 1.2;
}

.shield-number {
  font-size: 1rem;
  font-weight: 700;
  padding-top: 2px;
}

.brand-title {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 0.9rem;
  color: #C7D3DD;
}

.vehicle-badge {
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.vehicle-icon {
  background-color: var(--highway-green);
  color: #FFFFFF;
  width: 38px;
  height: 38px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vehicle-details {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
}

.vehicle-details strong {
  color: #FFFFFF;
  font-size: 0.92rem;
}

.service-ok {
  color: #7CE3B3;
  font-weight: 500;
}

/* Main Layout */
.main-content {
  padding-top: 1.75rem;
  padding-bottom: 3.5rem;
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
}

/* Selector Bar */
.destination-selector-bar {
  background-color: var(--bg-surface);
  border: 1.5px solid var(--border-map);
  border-radius: 10px;
  padding: 1.25rem;
}

.selector-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.selector-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-btn {
  background-color: var(--bg-paper);
  color: var(--ink-secondary);
  border: 1px solid var(--border-map);
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.filter-btn:hover {
  border-color: var(--ink-primary);
  color: var(--ink-primary);
}

.filter-btn.active {
  background-color: var(--ink-primary);
  color: #FFFFFF;
  border-color: var(--ink-primary);
}

.route-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.75rem;
}

.route-tab-btn {
  background-color: var(--bg-paper);
  border: 2px solid var(--border-map);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-family: var(--font-sans);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.route-tab-btn:hover {
  border-color: var(--highway-green);
}

.route-tab-btn.active {
  background-color: var(--highway-green-light);
  border-color: var(--highway-green);
}

.tab-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.tab-shield {
  background-color: var(--highway-green);
  color: #FFFFFF;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.tab-score-pill {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  background-color: var(--sun-amber-light);
  color: #8A5D00;
  border: 1px solid var(--sun-amber);
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
}

.tab-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--ink-primary);
}

.tab-meta {
  font-size: 0.8rem;
  color: var(--ink-secondary);
}

/* Atlas Grid */
.atlas-grid {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: 1.5rem;
  align-items: start;
}

.atlas-left {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.map-card,
.vote-card,
.expedition-sheet,
.comparison-section,
.checklist-section {
  background-color: var(--bg-surface);
  border: 1.5px solid var(--border-map);
  border-radius: 10px;
}

.map-card {
  overflow: hidden;
}

.map-card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-map);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.map-card-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.map-card-header p {
  font-size: 0.82rem;
  color: var(--ink-secondary);
}

.map-scale {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--highway-green);
  background-color: var(--highway-green-light);
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  white-space: nowrap;
}

.map-canvas-wrap {
  position: relative;
  background-color: #E6F1F6;
  border-bottom: 1px solid var(--border-map);
}

.route-map-svg {
  width: 100%;
  height: auto;
  display: block;
}

.map-route-line {
  fill: none;
  stroke: #9FB1BC;
  stroke-width: 3;
  stroke-dasharray: 5 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.map-route-line.active {
  stroke: var(--highway-green);
  stroke-width: 5.5;
  stroke-dasharray: none;
}

.map-node {
  cursor: pointer;
}

.map-node .node-dot {
  fill: #FFFFFF;
  stroke: var(--ink-primary);
  stroke-width: 2.5;
}

.map-node .node-pulse {
  fill: transparent;
}

.map-node.active .node-dot {
  fill: var(--sun-amber);
  stroke: var(--ink-primary);
  stroke-width: 3;
}

.map-node.active .node-pulse {
  fill: rgba(242, 169, 0, 0.3);
}

.node-label {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  fill: var(--ink-primary);
  paint-order: stroke;
  stroke: #FFFFFF;
  stroke-width: 3.5px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.node-sublabel {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  fill: var(--highway-green-dark);
}

/* Computadora del Cronos */
.cronos-telemetry {
  background-color: var(--ink-primary);
  color: #FFFFFF;
  padding: 1.15rem 1.25rem;
}

.telemetry-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #B4C5D4;
}

.telemetry-tag {
  background-color: var(--highway-green);
  color: #FFFFFF;
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  font-weight: 700;
}

.telemetry-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.metric-box {
  background-color: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  padding: 0.65rem 0.8rem;
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 0.75rem;
  color: #B4C5D4;
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--sun-amber);
  margin-top: 0.15rem;
}

/* Tarjeta de Votación */
.vote-card {
  padding: 1.25rem;
}

.vote-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.vote-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.vote-header p {
  font-size: 0.82rem;
  color: var(--ink-secondary);
}

.total-score-badge {
  background-color: var(--sun-amber);
  color: var(--ink-primary);
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  white-space: nowrap;
}

.vote-controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.voter-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  background-color: var(--bg-paper);
  padding: 0.6rem 0.85rem;
  border-radius: 6px;
}

.voter-label {
  font-size: 0.88rem;
  font-weight: 600;
}

.star-group {
  display: flex;
  gap: 0.35rem;
}

.star-btn {
  background-color: #FFFFFF;
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  width: 34px;
  height: 32px;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink-secondary);
  cursor: pointer;
}

.star-btn:hover {
  border-color: var(--sun-amber);
}

.star-btn.selected {
  background-color: var(--sun-amber);
  border-color: #C98B00;
  color: var(--ink-primary);
}

.notes-box label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--ink-secondary);
}

.notes-box textarea {
  width: 100%;
  border: 1.5px solid var(--border-map);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  resize: vertical;
  background-color: var(--bg-paper);
}

/* Hoja de Ruta Derecha (Expedition Sheet) */
.expedition-sheet {
  padding: 1.6rem;
}

.sheet-top {
  border-bottom: 2px solid var(--bg-subtle);
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
}

.sheet-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.highway-pill {
  background-color: var(--highway-green);
  color: #FFFFFF;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

.style-pill {
  background-color: var(--bg-subtle);
  color: var(--ink-primary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

.sheet-title {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

.sheet-summary {
  font-size: 0.98rem;
  color: var(--ink-secondary);
  max-width: 72ch;
}

.highlights-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.highlight-panel {
  background-color: var(--bg-paper);
  border: 1px solid var(--border-map);
  border-radius: 8px;
  padding: 1rem;
}

.highlight-panel h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--ink-primary);
}

.highlight-panel ul {
  padding-left: 1.15rem;
  font-size: 0.88rem;
  color: var(--ink-secondary);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.cronos-advice-banner {
  background-color: var(--highway-green-light);
  border-left: 4px solid var(--highway-green);
  padding: 0.9rem 1.1rem;
  border-radius: 0 8px 8px 0;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.cronos-advice-banner strong {
  color: var(--highway-green-dark);
}

/* Itinerario 7 días */
.itinerary-heading {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
}

.days-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.day-item {
  border: 1px solid var(--border-map);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 0.85rem;
  align-items: baseline;
  background-color: #FFFFFF;
}

.day-badge {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--highway-green-dark);
  background-color: var(--highway-green-light);
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  text-align: center;
}

.day-content h5 {
  font-size: 0.96rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.day-content p {
  font-size: 0.88rem;
  color: var(--ink-secondary);
}

/* Tabla Comparativa */
.comparison-section,
.checklist-section {
  padding: 1.5rem;
}

.section-header-split,
.checklist-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.section-header-split h2,
.checklist-header h2 {
  font-size: 1.25rem;
  font-weight: 800;
}

.section-header-split p,
.checklist-header p {
  font-size: 0.88rem;
  color: var(--ink-secondary);
}

.fuel-calculator-control {
  background-color: var(--bg-paper);
  border: 1.5px solid var(--border-strong);
  border-radius: 8px;
  padding: 0.55rem 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.fuel-calculator-control label {
  font-size: 0.85rem;
  font-weight: 700;
}

.fuel-calculator-control input {
  width: 105px;
  padding: 0.35rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
}

.table-responsive {
  overflow-x: auto;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.comparison-table th,
.comparison-table td {
  padding: 0.85rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--border-map);
}

.comparison-table th {
  background-color: var(--bg-paper);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-secondary);
}

.comparison-table tbody tr {
  cursor: pointer;
}

.comparison-table tbody tr:hover {
  background-color: var(--bg-paper);
}

.comparison-table tbody tr.active-row {
  background-color: var(--highway-green-light);
}

.mono-cell {
  font-family: var(--font-mono);
  font-weight: 600;
}

/* Checklist */
.btn-secondary {
  background-color: var(--bg-paper);
  border: 1.5px solid var(--border-strong);
  color: var(--ink-primary);
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

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

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

.checklist-group {
  background-color: var(--bg-paper);
  border: 1px solid var(--border-map);
  border-radius: 8px;
  padding: 1rem;
}

.checklist-group h3 {
  font-size: 0.98rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-map);
}

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.4rem 0;
  font-size: 0.88rem;
  cursor: pointer;
}

.check-item input[type="checkbox"] {
  margin-top: 0.22rem;
  width: 17px;
  height: 17px;
  accent-color: var(--highway-green);
  cursor: pointer;
}

.check-item.done span {
  text-decoration: line-through;
  color: var(--ink-muted);
}

/* Footer */
.site-footer {
  background-color: var(--ink-primary);
  color: #C7D3DD;
  padding: 1.5rem 0;
  font-size: 0.85rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
}

.footer-meta code {
  font-family: var(--font-mono);
  color: var(--sun-amber);
}

/* Responsive */
@media (max-width: 980px) {
  .atlas-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .highlights-grid {
    grid-template-columns: 1fr;
  }
  .day-item {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }
  .day-badge {
    width: fit-content;
  }
}

/* Auth Gate & User Controls (AWS Cognito) */
.topbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
}

.auth-user-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  font-size: 0.82rem;
}

.auth-user-controls[hidden],
.auth-gate-wrap[hidden],
.main-content[hidden] {
  display: none !important;
}

.auth-user-email {
  color: #E2EBF2;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.sync-badge {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background-color: rgba(255, 255, 255, 0.14);
  color: #FFFFFF;
}

.sync-badge.sync-ok {
  background-color: var(--highway-green);
  color: #FFFFFF;
}

.sync-badge.sync-saving {
  background-color: var(--sun-amber);
  color: var(--ink-primary);
}

.sync-badge.sync-offline {
  background-color: #475866;
  color: #FFFFFF;
}

.btn-logout {
  background-color: transparent;
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 5px;
  padding: 0.25rem 0.6rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-logout:hover {
  background-color: rgba(255, 255, 255, 0.15);
}

.auth-gate-wrap {
  min-height: calc(100vh - 165px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
}

.auth-gate-card {
  background-color: var(--bg-surface);
  border: 2px solid var(--border-strong);
  border-radius: 12px;
  max-width: 460px;
  width: 100%;
  padding: 2.25rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.9rem;
}

.auth-shield {
  margin-bottom: 0.25rem;
}

.auth-gate-card h2 {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--ink-primary);
}

.auth-gate-card p {
  font-size: 0.92rem;
  color: var(--ink-secondary);
}

.auth-error-msg {
  width: 100%;
  background-color: #FDECEC;
  border-left: 4px solid #C92A2A;
  color: #8A1C1C !important;
  padding: 0.65rem 0.85rem;
  border-radius: 4px;
  font-weight: 600;
}

.btn-cognito-login {
  width: 100%;
  background-color: var(--highway-green);
  color: #FFFFFF;
  border: none;
  border-radius: 8px;
  padding: 0.85rem 1.2rem;
  font-family: var(--font-sans);
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 0.4rem;
}

.btn-cognito-login:hover:not(:disabled) {
  background-color: var(--highway-green-dark);
}

.btn-cognito-login:disabled {
  opacity: 0.7;
  cursor: wait;
}
