﻿:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --primary: #154a8a;
  --primary-dark: #0c2e52;
  --accent: #00b894;
  --warning: #f6ae2d;
  --danger: #d63031;
  --text: #1f2d3d;
  --muted: #5f6c7b;
  --border: #e1e7f0;
  --radius-lg: 20px;
  --radius-md: 16px;
  --shadow-sm: 0 8px 16px rgba(17, 35, 65, 0.08);
  --shadow-lg: 0 28px 48px rgba(12, 46, 82, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(180deg, #eef4ff 0%, var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
}

h1, h2, h3 {
  margin: 0;
  font-weight: 600;
}

p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.app-header {
  background: linear-gradient(135deg, #ffffff, #e7f1ff);
  color: var(--text);
  padding: 18px 36px 14px;
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.header-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
  background: rgba(255, 255, 255, 0.82);
  padding: 10px 18px;
  border-radius: 18px;
  box-shadow: 0 18px 30px rgba(12, 46, 82, 0.12);
}
.brand-logo {
  display: block;
  height: 60px;
  width: auto;
  object-fit: contain;
  border-radius: 16px;
  box-shadow: 0 18px 36px rgba(12, 46, 82, 0.28);
}

@media (max-width: 768px) {
  .brand-logo {
    height: 48px;
  }
}


.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.12);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-text h1 {
  font-size: 1.7rem;
  color: var(--text);
}

.brand-text p {
  margin-top: 4px;
  color: var(--muted);
}

.header-actions {
  display: flex;
  gap: 12px;
}

.main-tabs {
  align-self: center;
  display: inline-flex;
  gap: 8px;
  background: rgba(30, 64, 175, 0.08);
  padding: 6px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(30, 64, 175, 0.12);
}

.tab-btn {
  border: none;
  background: transparent;
  color: rgba(30, 64, 175, 0.72);
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  box-shadow: 0 14px 24px rgba(37, 99, 235, 0.35);
}

.primary-btn,
.ghost-btn {
  font-weight: 600;
  border-radius: 999px;
  padding: 12px 26px;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary-btn {
  background: var(--accent);
  color: white;
  box-shadow: 0 16px 30px rgba(0, 184, 148, 0.28);
}

.primary-btn:hover {
  transform: translateY(-2px);
}

.ghost-btn {
  background: rgba(21, 74, 138, 0.08);
  color: inherit;
  border: 1px solid rgba(21, 74, 138, 0.2);
}

.layout {
  padding: 48px;
  display: grid;
  gap: 40px;
}

.tab-panel {
  display: none;
  flex-direction: column;
  gap: 32px;
}

.tab-panel.active {
  display: flex;
}

.tab-intro {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 760px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.card.wide {
  grid-column: 1 / -1;
}

.card.full {
  padding: 0;
  overflow: hidden;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 28px;
  border-bottom: 1px solid var(--border);
}

.hero-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  background: linear-gradient(135deg, rgba(21, 74, 138, 0.92), rgba(12, 46, 82, 0.92));
  color: white;
  box-shadow: var(--shadow-lg);
}

.analysis-grid {
  display: grid;
  gap: 28px;
  margin-bottom: 32px;
}






.hero-copy p {
  color: rgba(255, 255, 255, 0.75);
}

.hero-stat-grid {
  display: grid;
  gap: 16px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.stat-label {
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 600;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 28px;
}

.gradient {
  background: linear-gradient(150deg, rgba(21, 74, 138, 0.96), rgba(12, 46, 82, 0.85));
  color: white;
}

.gradient h3 {
  color: white;
}

.agenda-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 14px;
}

.agenda-card li {
  font-weight: 500;
  line-height: 1.5;
}

.alert-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.alert-list {
  display: grid;
  gap: 14px;
}

.alert-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: rgba(214, 48, 49, 0.12);
  border: 1px solid rgba(214, 48, 49, 0.22);
}

.alert-item strong {
  color: var(--danger);
}

.quick-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.quick-actions {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
  color: var(--muted);
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 28px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-field label {
  font-weight: 500;
  color: var(--muted);
}

.form-field input,
.form-field select,
.form-field textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.95rem;
  background: #fdfdff;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 74, 138, 0.18);
}

.span-2 {
  grid-column: span 2;
}

.form-actions {
  display: flex;
  gap: 14px;
  align-items: center;
}

.filters-card {
  padding-bottom: 8px;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.responsive-table {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.responsive-table.small {
  max-height: 320px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

thead {
  background: #eef3fb;
  color: var(--muted);
}

thead th {
  padding: 14px 16px;
  font-weight: 600;
  text-align: left;
}

tbody td {
  border-top: 1px solid var(--border);
  padding: 14px 16px;
  vertical-align: top;
}

.entity-name {
  display: block;
  font-weight: 600;
}

.entity-address {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

.entity-actions {
  display: flex;
  gap: 10px;
}

.entity-actions button {
  padding: 6px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(21, 74, 138, 0.12);
  color: var(--primary);
  cursor: pointer;
  font-weight: 500;
}

.entity-actions button:hover {
  background: rgba(21, 74, 138, 0.18);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 500;
}

.status-pill::before {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.status-pill.ok {
  background: rgba(0, 184, 148, 0.16);
  color: var(--accent);
}

.status-pill.ok::before {
  background: var(--accent);
}

.status-pill.late {
  background: rgba(214, 48, 49, 0.18);
  color: var(--danger);
}

.status-pill.late::before {
  background: var(--danger);
}

.status-pill.neutral {
  background: rgba(95, 108, 123, 0.16);
  color: var(--muted);
}

.status-pill.neutral::before {
  background: var(--muted);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.metric {
  background: #f4f6fb;
  border-radius: var(--radius-md);
  padding: 16px 18px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.metric strong {
  margin-top: 6px;
  display: block;
  font-size: 1.2rem;
}

.analytics-card {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

#map {
  height: 480px;
}

.map-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.map-card .card-header {
  border-bottom: 1px solid var(--border);
}

.map-card #map {
  height: 520px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow: hidden;
}

.leaflet-container {
  font-family: 'Poppins', sans-serif;
}

.leaflet-control-zoom {
  border: none !important;
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  background: white;
}

.leaflet-control-attribution {
  background: rgba(12, 46, 82, 0.08);
  color: var(--muted);
  border-radius: 12px;
  font-size: 0.72rem;
  padding: 6px 10px;
}

.leaflet-control-attribution a {
  color: inherit;
  text-decoration: none;
}

.leaflet-control-zoom a {
  width: 34px;
  height: 34px;
  background: white;
  color: var(--primary);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.leaflet-control-zoom a + a {
  border-top: 1px solid rgba(21, 74, 138, 0.15);
}

.leaflet-control-zoom a:hover {
  background: rgba(21, 74, 138, 0.12);
}

.marker-pin {
  position: relative;
  width: 46px;
  height: 46px;
  transform: translate(-23px, -40px);
  cursor: pointer;
}

.marker-pin .marker-shadow {
  position: absolute;
  bottom: -8px;
  left: 50%;
  width: 28px;
  height: 10px;
  background: rgba(15, 35, 62, 0.25);
  filter: blur(6px);
  border-radius: 50%;
  transform: translateX(-50%);
}

.marker-pin .marker-icon {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 1rem;
  box-shadow: 0 18px 30px rgba(12, 46, 82, 0.28);
}

.marker-pin .marker-icon::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  width: 14px;
  height: 14px;
  background: inherit;
  transform: translateX(-50%) rotate(45deg);
  border-radius: 4px;
}

.marker-pin.good .marker-icon {
  background: linear-gradient(160deg, #00d19a, #00b894);
}

.marker-pin.warning .marker-icon {
  background: linear-gradient(160deg, #f6ae2d, #f0932b);
}

.marker-pin.late .marker-icon {
  background: linear-gradient(160deg, #ff6b6b, #d63031);
}

.leaflet-tooltip.map-tooltip {
  background: white;
  color: var(--text);
  border: none;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 14px 16px;
  font-size: 0.85rem;
}

.leaflet-tooltip.map-tooltip::before {
  border-top-color: white;
}

.map-tooltip .tooltip-title {
  font-weight: 600;
  color: var(--text);
}

.map-tooltip .tooltip-meta {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 4px;
}

.map-tooltip .tooltip-line {
  display: block;
  margin-top: 6px;
  color: var(--text);
}

.map-tooltip .status-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.map-tooltip .status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(21, 74, 138, 0.08);
  color: var(--primary);
}

.map-tooltip .status-badge.ok {
  background: rgba(0, 184, 148, 0.12);
  color: var(--accent);
}

.map-tooltip .status-badge.late {
  background: rgba(214, 48, 49, 0.14);
  color: var(--danger);
}

.map-tooltip .status-badge.neutral {
  background: rgba(95, 108, 123, 0.16);
  color: var(--muted);
}

.map-popup {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
}

.map-popup strong {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.map-popup .popup-meta {
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.map-popup .popup-lines span {
  display: block;
  margin-top: 6px;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
}

.leaflet-popup-content {
  margin: 16px 18px;
}

.leaflet-popup-close-button {
  display: none;
}


.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 35, 62, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  padding: 40px;
  z-index: 40;
}

.modal.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background: white;
  padding: 32px;
  border-radius: var(--radius-lg);
  width: min(520px, 90vw);
  box-shadow: var(--shadow-lg);
  position: relative;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  border: none;
  background: transparent;
  font-size: 1.3rem;
  cursor: pointer;
}

#receiptDetails {
  margin: 16px 0 24px;
  line-height: 1.6;
  font-size: 0.95rem;
}

@media (max-width: 1200px) {
  .layout {
    padding: 32px;
  }
}

@media (max-width: 768px) {
  .app-header {
    padding: 24px;
  }

  .header-main {
    flex-direction: column;
    align-items: flex-start;
  }

  .main-tabs {
    flex-wrap: wrap;
  }

  .layout {
    padding: 24px;
  }

  .card,
  .hero-card {
    padding: 22px;
  }

  .hero-card {
    grid-template-columns: 1fr;
  }

  .panel-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: 1;
  }

  #map,
  .map-card #map {
    height: 360px;
  }
}



@media (min-width: 1024px) {
  .analysis-grid {
    grid-template-columns: minmax(340px, 400px) minmax(0, 1fr);
    align-items: stretch;
  }
}

.analysis-grid .analytics-card {
  background: linear-gradient(135deg, #ffffff, #edf3ff);
  border: 1px solid rgba(37, 99, 235, 0.12);
  box-shadow: 0 18px 30px rgba(37, 99, 235, 0.12);
}

.analysis-grid .analytics-card .metrics-grid {
  margin-bottom: 18px;
}

.analysis-grid .analytics-card canvas {
  width: 100%;
}


.map-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
}

.map-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.map-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.map-filter-group {
  display: inline-flex;
  background: rgba(37, 99, 235, 0.08);
  padding: 4px;
  border-radius: 999px;
}

.map-filter-btn {
  border: none;
  background: transparent;
  color: rgba(30, 64, 175, 0.72);
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.map-filter-btn.active {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  box-shadow: 0 12px 18px rgba(37, 99, 235, 0.28);
}

.map-container {
  position: relative;
}

.map-overlay {
  position: absolute;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-radius: 18px;
  box-shadow: 0 20px 40px rgba(12, 46, 82, 0.18);
  padding: 14px 18px;
  z-index: 5;
}

.map-stats {
  top: 24px;
  left: 24px;
  display: flex;
  gap: 18px;
}

.map-stats div span {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.map-stats div strong {
  display: block;
  font-size: 1.4rem;
  margin-top: 4px;
  color: var(--text);
}

.map-legend {
  bottom: 24px;
  left: 24px;
  display: grid;
  gap: 10px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text);
}

.legend-item span {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.legend-item.good span {
  background: linear-gradient(135deg, #34d399, #059669);
}

.legend-item.warning span {
  background: linear-gradient(135deg, #fbbf24, #f97316);
}

.legend-item.late span {
  background: linear-gradient(135deg, #f87171, #dc2626);
}

@media (max-width: 768px) {
  .map-header {
    flex-direction: column;
    align-items: stretch;
  }

  .map-controls {
    flex-direction: column;
    align-items: flex-start;
  }

  .map-stats {
    position: static;
    display: flex;
    margin: 16px 16px 0;
  }

  .map-legend {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 16px;
  }

  .map-overlay {
    box-shadow: none;
    background: rgba(255, 255, 255, 0.98);
  }
}
@media (max-width: 1024px) {
  .app-header {
    padding: 24px 28px;
    gap: 20px;
  }

  .header-main {
    align-items: flex-start;
    gap: 20px;
  }

  .main-tabs {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding: 4px 8px;
  }

  .layout {
    padding: 32px 28px;
    gap: 32px;
  }

  .analysis-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

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

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

  .map-card #map,
  #map {
    height: 420px;
  }

  .map-header {
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
  }

  .map-controls {
    justify-content: space-between;
  }
}

@media (max-width: 600px) {
  body {
    font-size: 0.95rem;
  }

  .app-header {
    padding: 18px 20px;
  }

  .header-main {
    gap: 16px;
  }

  .brand {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .header-actions {
    width: 100%;
    justify-content: stretch;
  }

  .primary-btn,
  .ghost-btn {
    width: 100%;
    text-align: center;
  }

  .main-tabs {
    padding: 4px;
    gap: 6px;
    scrollbar-width: thin;
  }

  .layout {
    padding: 20px 16px 32px;
    gap: 24px;
  }

  .hero-stat-grid,
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .tab-panel {
    gap: 24px;
  }

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

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

  .responsive-table table {
    min-width: 560px;
  }

  .map-card #map,
  #map {
    height: 320px;
  }

  .map-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .map-overlay {
    position: static;
    margin-top: 12px;
    width: 100%;
  }

  .map-stats,
  .map-legend {
    gap: 12px;
  }
}
