:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --text: #0f172a;
  --muted: #475569;
  --border: #dbe3ee;
  --primary: #00274c;
  --primary-dark: #001a33;
  --chip-selected: #00274c;
  --dot-selected: #ffcb05;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 10px 24px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at top, #e3ecf8 0%, var(--bg) 24%, var(--bg) 100%);
  color: var(--text);
}

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

.hero {
  margin-bottom: 1.1rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.25rem;
}

.hero-content {
  min-width: 0;
}

h1 {
  margin: 0;
  font-size: clamp(1.6rem, 2.4vw, 2.2rem);
  letter-spacing: -0.02em;
}

header p {
  margin: 0.6rem 0 0;
  max-width: 78ch;
  color: var(--muted);
}

.hero-logo {
  width: clamp(260px, 32vw, 360px);
  height: auto;
  flex: 0 0 auto;
  margin-top: 0.15rem;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.controls {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.15rem;
}

.filter-row {
  display: grid;
  gap: 1rem;
}

.map-country-cluster {
  border: 1px solid #c4d2e3;
  border-radius: 14px;
  background: linear-gradient(180deg, #f7f9fd 0%, #eef4fc 100%);
  box-shadow: var(--shadow-md);
  padding: 0.95rem;
}

.filter-row-country-map {
  grid-template-columns: minmax(590px, 2.2fr) minmax(210px, 0.78fr);
  align-items: stretch;
}

.filter-row-secondary {
  grid-template-columns: minmax(590px, 2.15fr) minmax(225px, 0.82fr);
  align-items: start;
}

.country-control-group select {
  min-height: 14.5rem;
  height: var(--country-select-height, 14.5rem);
}

.country-control-group .region-select {
  min-height: 0;
  height: auto;
}

.country-control-group {
  --country-label-offset: 0px;
  padding-top: var(--country-label-offset);
}

.control-group-departments {
  min-width: 0;
}

.secondary-right-column {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

label,
.control-group > span {
  font-weight: 700;
  font-size: 0.93rem;
  color: #1e293b;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-height: 16rem;
  overflow-y: auto;
  padding: 0.05rem 0.15rem 0.05rem 0;
}

.filter-search {
  width: 100%;
  border: 1px solid #b6c2d2;
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
  background: #fff;
  color: #111827;
}

.filter-search::placeholder {
  color: #64748b;
}

.filter-search:focus {
  outline: 3px solid rgba(37, 99, 235, 0.2);
  border-color: #2a4f79;
}

select {
  width: 100%;
  border: 1px solid #b6c2d2;
  border-radius: 10px;
  padding: 0.45rem;
  background: var(--surface-alt);
  color: #111827;
  min-height: 15rem;
}

select:focus,
button:focus-visible,
.chip:focus-visible,
.map-country.available:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.25);
  outline-offset: 1px;
}

.control-actions {
  display: flex;
  align-items: end;
}

button {
  border: 0;
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
  padding: 0.65rem 1.05rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.28);
}

button:hover {
  background: var(--primary-dark);
}

.chip {
  border: 1px solid #b7c3d4;
  background: #f5f8fc;
  color: #1f2937;
  border-radius: 999px;
  padding: 0.34rem 0.8rem;
  box-shadow: none;
  font-size: 0.86rem;
}

.chip:hover {
  background: #e6edf6;
}

.chip.active {
  background: var(--chip-selected);
  color: #fff;
  border-color: var(--chip-selected);
  box-shadow: 0 6px 14px rgba(0, 39, 76, 0.35);
}

.chip.unavailable {
  opacity: 0.42;
  cursor: not-allowed;
  border-color: #c7d2df;
  background: #eef2f7;
  color: #64748b;
  box-shadow: none;
}

.chip.unavailable:hover {
  background: #eef2f7;
}

.active-filters {
  margin-top: 0;
  padding: 0.55rem 0.7rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.active-filters[hidden] {
  display: none;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.24rem 0.35rem 0.24rem 0.62rem;
  border-radius: 999px;
  border: 1px solid #9cb6d4;
  background: #eef4fb;
  color: #11365f;
  font-size: 0.82rem;
  font-weight: 600;
}

.pill-remove {
  border: 0;
  box-shadow: none;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 999px;
  padding: 0;
  font-size: 0.95rem;
  line-height: 1;
  background: #00274c;
  color: #ffcb05;
}

.pill-remove:hover {
  background: #001a33;
}

.map-panel {
  padding: 0.25rem;
  border: 0;
  border-radius: 12px;
  background: transparent;
  box-shadow: none;
}

.map-panel h2 {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

.map-help {
  margin: 0.45rem 0 0.9rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.world-map {
  width: 100%;
  height: auto;
  border: 1px solid #becde0;
  border-radius: 12px;
  background: linear-gradient(180deg, #edf2f8 0%, #e4ebf5 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.map-base-country {
  fill: #dce5f2;
  stroke: #b8c7dc;
  stroke-width: 0.65;
  vector-effect: non-scaling-stroke;
}

.map-country {
  fill: #cdd7e5;
  stroke: rgba(255, 255, 255, 0.95);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  transition: fill 120ms ease, stroke 120ms ease, stroke-width 120ms ease, opacity 120ms ease;
}

.map-country.available {
  fill: #8fa8c7;
  cursor: pointer;
}

.map-country.available:hover {
  fill: var(--primary);
  stroke: #001a33;
  stroke-width: 1.5;
}

.map-country.selected {
  fill: var(--dot-selected);
  stroke: rgba(0, 39, 76, 0.28);
  stroke-width: 0.8;
}

.map-country.selected:hover {
  fill: var(--dot-selected);
  stroke: rgba(0, 39, 76, 0.32);
  stroke-width: 1;
}

.map-country.unavailable {
  fill: #e7edf5;
  opacity: 0.95;
}

.fallback-country {
  stroke-width: 1.3;
}

.status {
  margin: 1rem 0 0.7rem;
  font-weight: 700;
  color: #1e293b;
  padding: 0.75rem 0.95rem;
  background: #f5f8fc;
}

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

.card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.05rem;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card h2 {
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
  line-height: 1.3;
}

.meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.meta + .meta {
  margin-top: 0.2rem;
}

.country-match {
  background: var(--dot-selected);
  color: #1f2937;
  font-weight: 700;
  padding: 0 0.2rem;
  border-radius: 4px;
}

.description {
  margin-top: 0.65rem;
  color: #1e293b;
}

.assumptions {
  margin-top: 1.15rem;
  color: #334155;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f5f8fc;
  padding: 0.6rem 0.75rem;
}

.assumptions summary {
  cursor: pointer;
  font-weight: 600;
}

@media (max-width: 940px) {
  .hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-logo {
    width: clamp(200px, 52vw, 260px);
    margin-top: 0.2rem;
  }

  .filter-row-country-map,
  .filter-row-secondary {
    grid-template-columns: 1fr;
  }

  .map-country-cluster {
    padding: 0.8rem;
  }

  .control-actions {
    align-items: center;
  }

  button#clearBtn {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 1rem 0.8rem 1.4rem;
  }

  .hero {
    gap: 0.55rem;
    margin-bottom: 0.65rem;
  }

  h1 {
    font-size: 1.45rem;
    line-height: 1.2;
  }

  header p {
    margin-top: 0.32rem;
    font-size: 0.92rem;
    line-height: 1.35;
  }

  .hero-logo {
    width: clamp(145px, 42vw, 205px);
    margin-top: 0;
  }

  .controls {
    margin-top: 0.55rem;
    gap: 0.7rem;
    padding: 0.75rem;
    border-radius: 12px;
  }

  .map-country-cluster {
    padding: 0.65rem;
    border-radius: 12px;
  }

  .filter-row {
    gap: 0.7rem;
  }

  .control-group {
    gap: 0.4rem;
  }

  .secondary-right-column {
    gap: 0.65rem;
  }

  label,
  .control-group > span {
    font-size: 0.88rem;
  }

  select {
    min-height: 12rem;
    padding: 0.38rem;
  }

  .country-control-group select {
    min-height: 0;
    height: auto;
    padding: 0.24rem;
  }

  .country-control-group .region-select {
    min-height: 0;
    height: auto;
    padding: 0.38rem;
  }

  .chip-list {
    gap: 0.42rem;
    max-height: 13.5rem;
  }

  .chip {
    padding: 0.32rem 0.7rem;
    font-size: 0.82rem;
  }

  .filter-search {
    padding: 0.46rem 0.6rem;
  }

  .active-filters {
    padding: 0.45rem 0.55rem;
    gap: 0.35rem;
  }

  button {
    padding: 0.58rem 0.9rem;
  }

  .map-panel h2 {
    font-size: 1rem;
  }

  .map-help {
    margin: 0.25rem 0 0.55rem;
    font-size: 0.86rem;
    line-height: 1.35;
  }

  .world-map {
    max-height: 230px;
  }

  .status {
    margin: 0.75rem 0 0.55rem;
    padding: 0.62rem 0.75rem;
  }

  .results {
    gap: 0.75rem;
  }

  .card {
    border-radius: 12px;
    padding: 0.8rem 0.85rem;
  }

  .card h2 {
    font-size: 1rem;
    margin-bottom: 0.36rem;
  }

  .meta {
    font-size: 0.89rem;
  }

  .description {
    margin-top: 0.48rem;
    font-size: 0.93rem;
  }

  .assumptions {
    margin-top: 0.82rem;
    padding: 0.5rem 0.65rem;
  }
}
