.studio-map-page {
  min-height: 100vh;
  overflow-x: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.directory-intro {
  padding: clamp(54px, 6vw, 76px) 0 clamp(36px, 4.5vw, 52px);
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 78% 18%, rgba(102, 227, 196, .13), transparent 28rem),
    linear-gradient(145deg, #071a2f, #0b2742 72%, #0e3151);
}

.directory-heading {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .55fr);
  gap: var(--content-gap);
  align-items: end;
}

.directory-heading h1 {
  max-width: 17ch;
  font-size: clamp(2.65rem, 5.7vw, 5.8rem);
}

.directory-heading .lede {
  max-width: 69ch;
}

.directory-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, .045);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.directory-stats div {
  min-height: 132px;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border-left: 1px solid var(--line);
}

.directory-stats div:first-child { border-left: 0; }
.directory-stats strong { color: var(--rust); font-size: clamp(1.65rem, 3vw, 2.45rem); letter-spacing: -.06em; }
.directory-stats span { color: var(--muted); font-size: .76rem; line-height: 1.35; }

.map-workspace {
  position: relative;
  height: min(820px, calc(100vh - 74px));
  min-height: 640px;
  display: grid;
  grid-template-columns: minmax(340px, 390px) minmax(0, 1fr);
  background: #071523;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.directory-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: rgba(7, 26, 47, .97);
  border-right: 1px solid var(--line);
  z-index: 5;
}

.panel-controls {
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.control-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 50px;
  gap: 10px;
}

.map-search {
  min-width: 0;
  height: 50px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid rgba(138, 240, 213, .27);
  border-radius: 15px;
  background: rgba(255, 255, 255, .06);
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}

.map-search:focus-within {
  border-color: var(--rust);
  background: rgba(255, 255, 255, .085);
  box-shadow: 0 0 0 4px rgba(102, 227, 196, .09);
}

.map-search svg,
.icon-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.map-search svg { color: var(--rust); }
.map-search input { width: 100%; min-width: 0; color: white; background: none; border: 0; outline: 0; }
.map-search input::placeholder { color: #8aa2b5; }

.icon-button {
  width: 50px;
  height: 50px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(138, 240, 213, .27);
  border-radius: 15px;
  background: rgba(255, 255, 255, .06);
  color: var(--rust);
  transition: transform .2s ease, background .2s ease;
}

.icon-button:hover { transform: translateY(-2px); background: rgba(102, 227, 196, .12); }

.filter-row {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.filter-chip {
  min-height: 35px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 999px;
  background: transparent;
  color: #b8cad8;
  font-size: .78rem;
  font-weight: 700;
}

.filter-chip:hover { border-color: rgba(102, 227, 196, .4); color: white; }
.filter-chip.active { background: var(--rust); border-color: var(--rust); color: var(--ink); }

.result-summary {
  margin-top: 15px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: .77rem;
}

.result-summary strong { color: white; }
.panel-link { padding: 0; border: 0; background: none; color: var(--rust); font-weight: 700; }
.panel-link:hover { text-decoration: underline; }

.candidate-notice {
  margin: 14px 14px 0;
  padding: 13px 14px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  border: 1px solid rgba(255, 194, 99, .2);
  border-radius: 14px;
  background: rgba(255, 194, 99, .065);
  color: #c8d6e1;
  font-size: .72rem;
  line-height: 1.45;
}

.candidate-notice p { margin: 0; }
.candidate-notice strong { color: #ffe0a5; }
.candidate-dot { width: 9px; height: 9px; margin-top: 4px; border-radius: 50%; background: #ffc263; box-shadow: 0 0 12px rgba(255, 194, 99, .5); }

.studio-results {
  min-height: 0;
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(102, 227, 196, .35) transparent;
}

.studio-card {
  width: 100%;
  padding: 17px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 14px;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 16px;
  background: rgba(255, 255, 255, .035);
  color: white;
  transition: border-color .2s ease, transform .2s ease, background .2s ease;
}

.studio-card:hover,
.studio-card.active {
  transform: translateY(-2px);
  border-color: rgba(102, 227, 196, .5);
  background: rgba(102, 227, 196, .075);
}

.studio-card h3 { margin: 0; font-size: .98rem; line-height: 1.25; letter-spacing: -.02em; }
.studio-card p { margin: 4px 0 0; color: var(--muted); font-size: .75rem; line-height: 1.45; }
.studio-card .company-number { grid-column: 1; color: #7f9ab0; font-size: .68rem; }
.candidate-badge { align-self: start; padding: 5px 8px; border-radius: 999px; background: rgba(138, 240, 213, .11); color: var(--rust); font-size: .61rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.candidate-badge.review { background: rgba(255, 157, 122, .12); color: #ff9d7a; }
.candidate-badge.strong { background: rgba(102, 227, 196, .16); color: #8af0d5; }

.empty-results { padding: 34px 18px; color: var(--muted); text-align: center; }
.empty-results strong { display: block; margin-bottom: 5px; color: white; }

.map-shell {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #061725;
  isolation: isolate;
}

#studio-map {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 52% 46%, rgba(55, 168, 156, .22), transparent 32%),
    radial-gradient(circle at 18% 78%, rgba(26, 92, 122, .24), transparent 30%),
    linear-gradient(rgba(115, 191, 194, .038) 1px, transparent 1px),
    linear-gradient(90deg, rgba(115, 191, 194, .038) 1px, transparent 1px),
    linear-gradient(145deg, #071b2a 0%, #082437 48%, #061624 100%);
  background-size: auto, auto, 42px 42px, 42px 42px, auto;
  box-shadow: inset 0 0 100px rgba(0, 8, 18, .62);
}

.leaflet-container {
  background-color: transparent;
  color: #dff9f2;
  font-family: "Poppins", sans-serif;
}

.leaflet-pane path { vector-effect: non-scaling-stroke; }
.leaflet-fade-anim .leaflet-map-pane { transition: opacity .28s ease; }
.map-shell.is-moving .leaflet-map-pane { cursor: grabbing; }

.leaflet-control-zoom.leaflet-bar {
  padding: 4px;
  overflow: hidden;
  border: 1px solid rgba(138, 240, 213, .28) !important;
  border-radius: 16px;
  background: rgba(5, 23, 37, .84);
  box-shadow: 0 15px 36px rgba(0, 9, 20, .34);
  backdrop-filter: blur(16px);
}

.leaflet-bar a,
.leaflet-bar a:hover {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 11px !important;
  background: transparent;
  color: #cffff2;
  font-size: 1.3rem;
  line-height: 40px;
  transition: color .2s ease, background .2s ease, transform .2s ease;
}

.leaflet-bar a:hover { background: rgba(102, 227, 196, .14); color: white; transform: scale(.94); }
.leaflet-bar a + a { margin-top: 3px; border-top: 1px solid rgba(138, 240, 213, .14); }

.leaflet-control-attribution {
  border-top-left-radius: 10px;
  background: rgba(3, 17, 29, .76) !important;
  color: #8ca9b6;
  font-size: 9px;
  backdrop-filter: blur(10px);
}

.leaflet-control-attribution a { color: #9eead8; }
.leaflet-control-scale-line {
  border-color: rgba(202, 249, 238, .58);
  border-top: 0;
  background: rgba(4, 23, 36, .68);
  color: #c4e0e5;
  text-shadow: none;
}

.studio-cluster-wrap,
.studio-pin {
  border: 0 !important;
  background: transparent !important;
}

.studio-cluster-wrap {
  --cluster-a: #73edd1;
  --cluster-b: #2fb99e;
  display: grid;
  place-items: center;
}

.studio-cluster-wrap.medium { --cluster-a: #4ad3b6; --cluster-b: #178c83; }
.studio-cluster-wrap.large { --cluster-a: #4c9fb1; --cluster-b: #0a3d55; }

.cluster-radar {
  position: absolute;
  inset: 4px;
  border: 1px solid color-mix(in srgb, var(--cluster-a) 62%, transparent);
  border-radius: 50%;
  box-shadow: 0 0 0 7px color-mix(in srgb, var(--cluster-a) 8%, transparent);
  animation: clusterRadar 2.8s ease-out infinite;
}

.cluster-core {
  position: absolute;
  inset: 7px;
  display: grid;
  place-content: center;
  justify-items: center;
  border: 2px solid rgba(225, 255, 248, .82);
  border-radius: 50%;
  background: linear-gradient(145deg, var(--cluster-a), var(--cluster-b));
  color: #041b28;
  box-shadow:
    0 14px 30px rgba(0, 10, 20, .42),
    inset 0 1px 1px rgba(255, 255, 255, .45),
    0 0 24px color-mix(in srgb, var(--cluster-a) 26%, transparent);
  transition: transform .22s ease, box-shadow .22s ease;
}

.studio-cluster-wrap.large .cluster-core { color: #f4fffc; }
.cluster-core strong { font-size: .92rem; line-height: 1; letter-spacing: -.04em; }
.studio-cluster-wrap.small .cluster-core strong { font-size: 1rem; }
.studio-cluster-wrap.large .cluster-core strong { font-size: 1.08rem; }
.cluster-core small { margin-top: 3px; font-size: .42rem; font-weight: 700; letter-spacing: .08em; opacity: .72; text-transform: uppercase; }
.studio-cluster-wrap.small .cluster-core small { display: none; }
.studio-cluster-wrap:hover .cluster-core { transform: scale(1.09); box-shadow: 0 18px 36px rgba(0, 10, 20, .5), 0 0 32px color-mix(in srgb, var(--cluster-a) 38%, transparent); }

.studio-pin { filter: drop-shadow(0 7px 9px rgba(0, 7, 15, .42)); }
.pin-body {
  position: absolute;
  top: 3px;
  left: 4px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  transform: rotate(45deg);
  border: 2px solid rgba(234, 255, 250, .9);
  border-radius: 50% 50% 50% 7px;
  background: linear-gradient(145deg, #2f6a7d, #0a3047);
  box-shadow: 0 0 16px rgba(72, 165, 181, .36), inset 0 1px 2px rgba(255, 255, 255, .42);
  transition: transform .2s ease, box-shadow .2s ease;
}

.studio-pin.strong .pin-body { background: linear-gradient(145deg, #7bf1d6, #20a88f); box-shadow: 0 0 18px rgba(102, 227, 196, .52); }
.studio-pin.review .pin-body { background: linear-gradient(145deg, #ffb18f, #e75b4b); box-shadow: 0 0 18px rgba(255, 127, 92, .48); }
.pin-body i { width: 6px; height: 6px; transform: rotate(-45deg); border-radius: 50%; background: rgba(247, 255, 253, .96); box-shadow: 0 0 0 3px rgba(4, 27, 40, .15); }
.studio-pin:hover .pin-body { transform: rotate(45deg) scale(1.22) translate(-1px, -1px); box-shadow: 0 0 26px rgba(102, 227, 196, .58); }

.leaflet-tooltip.studio-map-tooltip {
  min-width: 180px;
  padding: 10px 12px;
  border: 1px solid rgba(138, 240, 213, .28);
  border-radius: 12px;
  background: rgba(4, 24, 39, .94);
  color: white;
  box-shadow: 0 16px 36px rgba(0, 8, 18, .44);
  backdrop-filter: blur(14px);
}

.studio-map-tooltip::before { border-top-color: rgba(4, 24, 39, .94) !important; }
.studio-map-tooltip strong { display: block; max-width: 28ch; font-size: .75rem; line-height: 1.3; }
.studio-map-tooltip span { display: block; margin-top: 4px; color: #98b9c5; font-size: .62rem; }

.map-view-status,
.map-interaction-hint {
  position: absolute;
  z-index: 900;
  border: 1px solid rgba(138, 240, 213, .22);
  background: rgba(4, 23, 37, .82);
  color: white;
  box-shadow: 0 14px 36px rgba(0, 9, 20, .3);
  backdrop-filter: blur(16px);
  pointer-events: none;
}

.map-view-status {
  top: 18px;
  left: 18px;
  padding: 10px 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 14px;
}

.map-view-status > span:last-child { display: grid; }
.map-view-status strong { font-size: .69rem; letter-spacing: .05em; text-transform: uppercase; }
.map-view-status small { margin-top: 2px; color: #8eacb8; font-size: .57rem; }
.map-view-status b { color: #9df2dd; }
.map-live-dot { width: 9px; height: 9px; border-radius: 50%; background: #66e3c4; box-shadow: 0 0 0 5px rgba(102, 227, 196, .1), 0 0 18px rgba(102, 227, 196, .75); animation: livePulse 2.2s ease-in-out infinite; }

.map-interaction-hint {
  left: 50%;
  bottom: 24px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  border-radius: 999px;
  color: #9db8c3;
  font-size: .58rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.map-interaction-hint i { width: 3px; height: 3px; border-radius: 50%; background: #66e3c4; }

.map-loading {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  background: linear-gradient(145deg, #071a2f, #0b2742);
  color: var(--muted);
  transition: opacity .35s ease, visibility .35s ease;
}

.map-loading.hidden { opacity: 0; visibility: hidden; }
.map-loading span { width: 38px; height: 38px; border: 3px solid rgba(102, 227, 196, .15); border-top-color: var(--rust); border-radius: 50%; animation: mapSpin .8s linear infinite; }
.map-loading p { margin: 0; }

.map-error {
  position: absolute;
  inset: 20px 20px auto auto;
  z-index: 5;
  max-width: 310px;
  padding: 18px;
  border: 1px solid rgba(255, 157, 122, .35);
  border-radius: 16px;
  background: rgba(7, 26, 47, .95);
  color: white;
  box-shadow: var(--shadow);
}

.map-error p { margin: 4px 0 0; color: var(--muted); font-size: .8rem; }

.map-legend {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 900;
  padding: 10px 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  border: 1px solid rgba(138, 240, 213, .2);
  border-radius: 14px;
  background: rgba(4, 23, 37, .84);
  color: #a8c2cc;
  font-size: .66rem;
  box-shadow: 0 14px 36px rgba(0, 9, 20, .3);
  backdrop-filter: blur(16px);
  pointer-events: none;
}

.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-pin { width: 9px; height: 9px; transform: rotate(45deg); border: 1.5px solid rgba(247, 255, 253, .9); border-radius: 50% 50% 50% 2px; box-shadow: 0 0 8px rgba(7, 26, 47, .3); }
.legend-pin.strong { background: #2cb99b; }
.legend-pin.standard { background: #2f6a7d; }
.legend-pin.review { background: #ff7f5c; }

.mobile-results-toggle { display: none; }

.studio-dialog {
  width: min(580px, calc(100% - 32px));
  max-height: min(760px, calc(100vh - 32px));
  padding: 34px;
  overflow-y: auto;
  border: 1px solid rgba(138, 240, 213, .3);
  border-radius: 24px;
  background: #0b2742;
  color: white;
  box-shadow: 0 34px 100px rgba(0, 0, 0, .55);
}

.studio-dialog::backdrop { background: rgba(1, 11, 25, .78); backdrop-filter: blur(7px); }
.dialog-close { position: sticky; z-index: 2; top: 0; float: right; width: 38px; height: 38px; margin: -18px -18px 0 0; border: 1px solid var(--line); border-radius: 50%; background: #071a2f; color: white; font-size: 1.4rem; line-height: 1; }
.dialog-heading h2 { font-size: clamp(2rem, 6vw, 3.5rem); }
.studio-detail h2 { margin: 18px 0 12px; font-size: clamp(2rem, 6vw, 3.7rem); max-width: 13ch; }
.studio-detail-address { color: #d8e7f2; }
.detail-meta { margin: 24px 0; display: grid; grid-template-columns: repeat(2, 1fr); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.detail-meta div { min-height: 86px; padding: 15px; border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
.detail-meta div:nth-child(odd) { border-left: 0; }
.detail-meta div:nth-child(-n+2) { border-top: 0; }
.detail-meta span { display: block; color: var(--muted); font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; }
.detail-meta strong { display: block; margin-top: 6px; font-size: .85rem; }
.detail-warning { padding: 14px; border: 1px solid rgba(255, 194, 99, .22); border-radius: 14px; background: rgba(255, 194, 99, .07); color: #ffe4b1; font-size: .76rem; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.detail-tags span { padding: 5px 9px; border-radius: 999px; background: rgba(255, 157, 122, .1); color: #ffb198; font-size: .66rem; }
.studio-dialog .field input,
.studio-dialog .field textarea { background: rgba(255, 255, 255, .065); color: white; border-color: var(--line); }
.studio-dialog .field input:focus,
.studio-dialog .field textarea:focus { border-color: var(--rust); }

.action-grid { display: grid; grid-template-columns: 1fr auto; gap: 50px; align-items: center; }
.directory-actions h2 { max-width: 15ch; }

@keyframes mapSpin { to { transform: rotate(360deg); } }
@keyframes clusterRadar {
  0% { opacity: .75; transform: scale(.72); }
  70%, 100% { opacity: 0; transform: scale(1.35); }
}
@keyframes livePulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(.72); opacity: .7; }
}

@media (max-width: 1080px) {
  .directory-heading { grid-template-columns: 1fr; gap: 30px; }
  .directory-stats { max-width: 620px; }
  .map-workspace { height: calc(100vh - 74px); min-height: 650px; grid-template-columns: 1fr; }
  .directory-panel {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 8;
    max-height: 70%;
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow);
    transform: translateY(calc(100% + 24px));
    transition: transform .3s var(--ease-signal);
  }
  .map-workspace.results-open .directory-panel { transform: translateY(0); }
  .candidate-notice { display: none; }
  .map-shell { height: 100%; }
  .mobile-results-toggle {
    position: absolute;
    left: 50%;
    bottom: 22px;
    z-index: 4;
    min-width: 210px;
    min-height: 50px;
    padding: 0 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    transform: translateX(-50%);
    border: 1px solid rgba(102, 227, 196, .5);
    border-radius: 999px;
    background: rgba(7, 26, 47, .95);
    color: white;
    box-shadow: 0 14px 40px rgba(1, 11, 25, .38);
  }
  .mobile-results-toggle span { color: var(--muted); font-size: .72rem; }
  .mobile-results-toggle strong { color: var(--rust); font-size: .76rem; }
  .map-workspace.results-open .mobile-results-toggle { bottom: calc(70% + 20px); }
  .map-legend { bottom: 88px; }
  .map-interaction-hint { display: none; }
  .map-view-status { top: 12px; left: 12px; }
  .action-grid { grid-template-columns: 1fr; gap: 28px; }
}

@media (max-width: 640px) {
  .directory-intro { padding: 46px 0 30px; }
  .directory-heading h1 { font-size: clamp(2.45rem, 13vw, 4rem); }
  .directory-stats div { min-height: 102px; padding: 15px 11px; }
  .directory-stats strong { font-size: 1.5rem; }
  .directory-stats span { font-size: .61rem; }
  .map-workspace { min-height: 620px; }
  .panel-controls { padding: 14px; }
  .filter-row { flex-wrap: nowrap; overflow-x: auto; }
  .filter-chip { flex: 0 0 auto; }
  .studio-results { max-height: 48vh; }
  .map-legend { left: 10px; right: 10px; justify-content: center; font-size: .59rem; }
  .map-view-status small { display: none; }
  .leaflet-control-attribution { max-width: 72%; font-size: 7px; }
  .studio-dialog { padding: 25px; }
  .dialog-close { margin: -11px -11px 0 0; }
  .detail-meta { grid-template-columns: 1fr; }
  .detail-meta div { border-left: 0; }
  .detail-meta div:nth-child(2) { border-top: 1px solid var(--line); }
}

@media (prefers-reduced-motion: reduce) {
  .map-loading span,
  .cluster-radar,
  .map-live-dot { animation: none; }
  .directory-panel,
  .studio-card,
  .icon-button,
  .cluster-core,
  .pin-body { transition: none; }
}
