:root {
  --ink: #0b1d2c;
  --muted: #4a5b6f;
  --accent: #0b4f8a;
  --accent-2: #0e8a5b;
  --bg: #eef2f7;
  --surface: #ffffff;
  --border: #d6dde6;
  --shadow: 0 18px 40px rgba(11, 31, 52, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Manrope", "Sora", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top, rgba(14, 138, 91, 0.12), transparent 48%), var(--bg);
  overflow: hidden;
}

.page {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(120deg, #002a52 0%, #005c83 52%, #0e8a5b 100%);
  color: #ffffff;
  box-shadow: var(--shadow);
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 14px;
}

.topbar-switch-row {
  padding: 0 14px 12px;
}

.top-industry-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.top-switch-chip {
  flex: 0 0 auto;
  min-width: 48px;
  min-height: 48px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.88);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: transform 120ms ease, background-color 120ms ease, border-color 120ms ease;
}

.top-switch-chip:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.top-switch-chip.is-active {
  background: rgba(255, 255, 255, 0.9);
  color: var(--accent);
  border-color: rgba(255, 255, 255, 0.95);
}

.top-switch-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
}

.top-switch-icon svg {
  display: block;
  width: 28px;
  height: 28px;
}

.top-switch-text {
  line-height: 1;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand img {
  height: 42px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.brand-subtitle {
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.84);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-metric {
  min-width: 140px;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  flex-direction: column;
  text-align: right;
}

.topbar-metric span {
  font-size: 1rem;
  font-weight: 700;
}

.topbar-metric small {
  color: rgba(255, 255, 255, 0.8);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.66rem;
}

.app {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 420px 1fr;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.panel-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-section-tight {
  gap: 6px;
}

.panel-top-actions {
  display: flex;
  justify-content: flex-start;
}

.panel-fill {
  min-height: 260px;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.7rem;
  color: var(--muted);
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

input[type="search"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
}

button {
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  background: var(--accent-2);
  color: #ffffff;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.ghost {
  background: rgba(11, 79, 138, 0.08);
  color: var(--accent);
  border: 1px solid rgba(11, 79, 138, 0.16);
}

.small-button {
  padding: 8px 12px;
  font-size: 0.84rem;
}

.summary-empty,
.table-empty {
  color: var(--muted);
  font-size: 0.92rem;
}

.summary-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(11, 79, 138, 0.04), rgba(14, 138, 91, 0.04));
}

.summary-card h2 {
  margin: 0 0 6px 0;
  font-size: 1.15rem;
}

.summary-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.summary-stat {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(11, 29, 44, 0.06);
}

.summary-stat strong {
  display: block;
  font-size: 1rem;
}

.summary-stat span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.summary-meta {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.86rem;
}

.summary-meta code {
  font-size: 0.8rem;
}

.section-row,
.section-actions,
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.employee-meta {
  font-size: 0.84rem;
  color: var(--muted);
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
}

.modal-shell.is-open {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 19, 31, 0.56);
  backdrop-filter: blur(3px);
}

.modal-card {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(920px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  transform: translate(-50%, -50%);
  background: var(--surface);
  border: 1px solid rgba(11, 29, 44, 0.12);
  border-radius: 24px;
  box-shadow: 0 28px 60px rgba(8, 19, 31, 0.28);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(11, 79, 138, 0.05), rgba(14, 138, 91, 0.07));
}

.modal-header h2 {
  margin: 4px 0 0 0;
  font-size: 1.28rem;
}

.modal-body {
  padding: 22px;
  overflow-y: auto;
  max-height: calc(100vh - 170px);
  color: var(--ink);
}

.modal-body h3 {
  margin: 18px 0 8px;
  font-size: 1rem;
}

.modal-body p {
  margin: 0 0 12px;
  line-height: 1.58;
  color: var(--ink);
}

.modal-body ul {
  margin: 0 0 14px 0;
  padding-left: 18px;
  color: var(--muted);
}

.modal-body li {
  margin: 0 0 8px;
  line-height: 1.5;
}

.table-wrap {
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: auto;
  background: #f9fbfd;
  min-height: 240px;
}

.employee-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.employee-table th,
.employee-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(11, 29, 44, 0.06);
  vertical-align: top;
}

.employee-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef5fa;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.compact-list {
  max-height: 220px;
  overflow: auto;
}

.list-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: #fbfdff;
  cursor: pointer;
  color: var(--ink);
  text-align: left;
  width: 100%;
}

.list-card:hover {
  border-color: rgba(14, 138, 91, 0.45);
  transform: translateY(-1px);
}

.list-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.92rem;
}

.list-card small {
  color: var(--muted);
}

.map-wrap {
  position: relative;
  min-height: 0;
}

#map {
  width: 100%;
  height: 100%;
}

.tooltip {
  position: absolute;
  z-index: 30;
  pointer-events: none;
  min-width: 180px;
  max-width: 280px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(11, 29, 44, 0.9);
  color: #ffffff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate(-50%, calc(-100% - 14px));
  transition: opacity 140ms ease;
}

.tooltip.is-visible {
  opacity: 1;
}

.loading-indicator {
  position: absolute;
  left: 50%;
  top: 28px;
  transform: translateX(-50%);
  z-index: 25;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(11, 79, 138, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.legend {
  position: absolute;
  right: 20px;
  top: 20px;
  width: 340px;
  max-height: calc(100% - 40px);
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.legend-title {
  font-weight: 700;
  margin-bottom: 0;
}

.legend-items {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  overflow-y: auto;
  padding-right: 4px;
}

.legend-item {
  width: 100%;
}

.legend-item-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(11, 79, 138, 0.04);
  border: 1px solid rgba(11, 79, 138, 0.08);
  color: var(--muted);
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
}

.legend-item-button:hover {
  border-color: rgba(14, 138, 91, 0.3);
  transform: translateY(-1px);
}

.legend-item-button.is-active {
  background: rgba(14, 138, 91, 0.1);
  border-color: rgba(14, 138, 91, 0.38);
  color: var(--ink);
}

.legend-swatch {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.legend-swatch svg {
  width: 44px;
  height: 44px;
  display: block;
}

.legend-code {
  min-width: 48px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink);
}

.legend-label {
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}

.legend-label strong {
  display: block;
  font-size: 0.78rem;
  color: var(--ink);
}

.legend-label small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
}

.legend-item-button.is-active .legend-label small {
  color: var(--ink);
}

.legend-note {
  margin-top: 0;
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.5;
  border-top: 1px solid rgba(11, 29, 44, 0.08);
  padding-top: 10px;
}

.maplibregl-popup-content {
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

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

@media (max-width: 1100px) {
  .app {
    grid-template-columns: 1fr;
  }

  .panel {
    order: 2;
    max-height: 46vh;
  }

  .map-wrap {
    min-height: 54vh;
  }

  .legend {
    width: calc(100% - 24px);
    right: 12px;
    top: 12px;
    max-height: calc(100% - 24px);
  }

  .modal-card {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }

  .modal-body {
    max-height: calc(100vh - 160px);
    padding: 18px;
  }
}
