:root {
    --pin-hit: 30px;
    --available: #98a2b3;
    --occupied: #21c063;
    --reserved: #f0a500;
    --picked: #2788ff;
    --pin-ink: #10131a;
    --label-inset: 1.5px;
    --blocked: #5b616e;
    --blocked-ink: #ffffff;
    --status-on: #f4c746;
    --dialog-surface: #22346f;
    --dialog-surface-soft: #2b4189;
    --dialog-text: #f4f8f5;
    --dialog-muted: #bcc7ea;
    --dialog-border: rgba(255, 255, 255, .18);
    --dialog-hover: #35509f;
    --dialog-close: #bcc7ea;
    --dialog-close-bg: rgba(255, 255, 255, .1);
}

* { box-sizing: border-box; }

.map-body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    color: var(--text);
    background: var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input { font: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 100; top: -50px; left: 12px; padding: 10px 14px; color: var(--on-accent); background: var(--accent); border-radius: 8px; }
.skip-link:focus { top: 12px; }

.map-page { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100dvh; }

.map-workspace { position: relative; min-height: 0; overflow: hidden; background: var(--workspace-bg); }
.map-workspace::before { content: ""; position: absolute; inset: 0; opacity: .16; pointer-events: none; background-image: linear-gradient(var(--glow-line) 1px, transparent 1px), linear-gradient(90deg, var(--glow-line) 1px, transparent 1px); background-size: 44px 44px; }

.map-workspace--off { display: grid; place-items: center; padding: 24px; }
.map-off { position: relative; z-index: 1; max-width: 34rem; text-align: center; }
.map-off h1 { margin: 0 0 .6rem; font-size: clamp(1.4rem, 4vw, 2rem); }
.map-off p { margin: 0 0 1.4rem; color: var(--muted, #9fb3a8); line-height: 1.6; }
.map-off__cta { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 22px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 700; text-decoration: none; }
.map-off__cta:hover { transform: translateY(-1px); }

.map-viewport {
    position: absolute;
    inset: 0;
    overflow: hidden;
    cursor: grab;
    touch-action: none;
    user-select: none;
    outline: none;
}
.map-viewport.is-dragging { cursor: grabbing; }
.map-viewport:focus-visible { box-shadow: inset 0 0 0 3px var(--focus-ring); }

.map-stage {
    position: absolute;
    top: 0;
    left: 0;
    width: 820px;
    aspect-ratio: var(--plant-aspect, 595.28 / 841.89);
    transform-origin: 0 0;
    filter: drop-shadow(0 28px 35px rgba(0, 0, 0, .36));
}

.map-viewport.is-dragging .map-stage { will-change: transform; }

.map-stage--client {
    aspect-ratio: var(--plant-aspect-client, 595.28 / 841.89);
}

.map-image { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 8px; background: #f5f0e3; pointer-events: none; transition: filter .2s ease; }

.map-image.is-filtering { filter: brightness(.32) saturate(.45); }

.booth-marker {
    position: absolute;
    z-index: 2;
    left: var(--area-left);
    top: var(--area-top);
    width: var(--area-width);
    height: var(--area-height);
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    transition: opacity .15s ease;
}
.booth-marker__shape {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}
.booth-marker__shape path {
    fill: transparent;
    stroke: transparent;
    stroke-width: 2;
    stroke-dasharray: 5 4;
    stroke-linejoin: round;
    transition: fill .15s ease, stroke .15s ease;
}
.booth-marker__pin {
    position: absolute;
    left: var(--pin-left, 50%);
    top: var(--pin-top, 50%);
    display: grid;
    place-items: center;
    width: var(--pin-diameter, 17px);
    aspect-ratio: 1;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, .92);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
    transform: translate(-50%, -50%);
    transition: scale .15s ease, box-shadow .15s ease;
}
.booth-marker__pin--code {
    width: auto;
    border-radius: 999px;
    height: var(--pin-diameter, 13px);
    aspect-ratio: auto;
    min-width: var(--pin-diameter, 13px);
    padding: 0 4px;
    overflow: visible;
    color: var(--pin-ink);
    font-size: var(--pin-font, 8px);
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}
.booth-marker__label,
.fusion-logo__label {
    position: absolute;
    z-index: 1;
    left: calc(var(--label-left, 0%) + var(--label-inset));
    top: calc(var(--label-top, 0%) + var(--label-inset));
    color: rgba(16, 19, 26, .78);
    font-size: 6px;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    text-shadow: 0 0 1px rgba(255, 255, 255, .7);
    transform-origin: 0 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, transform .15s ease, color .15s ease, text-shadow .15s ease;
}
.map-stage.is-label-zoom .booth-marker__label,
.map-stage.is-label-zoom .fusion-logo__label { opacity: 1; pointer-events: auto; }
.booth-marker__label:hover,
.fusion-logo__label:hover {
    color: var(--pin-ink);
    text-shadow: 0 0 1.5px rgba(255, 255, 255, .9), 0 1px 2px rgba(16, 19, 26, .28);
    transform: translateY(-1.5px) scale(1.25);
}
.pin-label-frame { position: absolute; z-index: 1; left: var(--area-left); top: var(--area-top); width: var(--area-width); height: var(--area-height); pointer-events: none; }
.pin-label-frame .booth-marker__label { opacity: 1; pointer-events: auto; cursor: move; touch-action: none; }
.booth-marker:hover, .booth-marker:focus-visible, .booth-marker.is-selected { z-index: 6; outline: none; }
.booth-marker:hover .booth-marker__shape path,
.booth-marker:focus-visible .booth-marker__shape path,
.booth-marker.is-selected .booth-marker__shape path {
    fill: color-mix(in srgb, var(--occupied) 12%, transparent);
    stroke: var(--occupied);
}
.booth-marker.is-available:hover .booth-marker__shape path,
.booth-marker.is-available:focus-visible .booth-marker__shape path {
    fill: color-mix(in srgb, var(--available) 16%, transparent);
    stroke: var(--available);
}
.booth-marker:hover .booth-marker__pin,
.booth-marker:focus-visible .booth-marker__pin,
.booth-marker.is-selected .booth-marker__pin {
    scale: 1.5;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, .28), 0 4px 10px rgba(0, 0, 0, .35);
}
.booth-marker--static { cursor: default; }
.booth-marker--static .booth-marker__pin,
.booth-marker--static:hover .booth-marker__pin { scale: 1; }
.booth-marker--focus .booth-marker__shape path {
    fill: color-mix(in srgb, var(--accent, #2f6feb) 14%, transparent);
    stroke: var(--accent, #2f6feb);
}
.booth-marker--focus .booth-marker__pin { scale: 1.6; box-shadow: 0 0 0 3px rgba(47, 111, 235, .45), 0 4px 10px rgba(0, 0, 0, .35); }

.booth-marker::before,
.reservation-map-pin::before,
.pin-board__pin::before {
    content: "";
    position: absolute;
    top: var(--pin-top, 50%);
    left: var(--pin-left, 50%);
    width: calc(var(--pin-hit, 30px) * var(--map-scale-inverse, 1));
    height: calc(var(--pin-hit, 30px) * var(--map-scale-inverse, 1));
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.booth-marker.is-dimmed::before,
.reservation-map-pin.is-dimmed::before,
.booth-marker.is-fused-member::before { display: none; }

.reservation-map-pin:hover, .reservation-map-pin:focus-visible, .pin-board__pin:hover { z-index: 6; }
.booth-marker.is-available .booth-marker__pin,
.pin-editor-handle.is-available .booth-marker__pin { background: var(--available); }
.booth-marker.is-reserved .booth-marker__pin,
.pin-editor-handle.is-reserved .booth-marker__pin { background: var(--reserved, #f0a500); }
.booth-marker.is-occupied .booth-marker__pin,
.pin-editor-handle.is-occupied .booth-marker__pin { background: var(--occupied); }
.booth-marker img,
.pin-editor-handle img { width: 100%; height: 100%; padding: 2px; border-radius: 50%; object-fit: contain; background: #fff; pointer-events: none; }
.booth-marker.is-dimmed { opacity: 0; pointer-events: none; }
.fusion-logo.is-dimmed { opacity: 0; pointer-events: none; }

.booth-marker.is-fused-member { opacity: 0; pointer-events: none; }

.fusion-logo {
    position: absolute;
    z-index: 3;
    left: var(--area-left);
    top: var(--area-top);
    width: var(--area-width);
    height: var(--area-height);
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    transition: opacity .15s ease;
}
.fusion-logo__shape {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}
.fusion-logo__shape path {
    fill: transparent;
    stroke: transparent;
    stroke-width: 2;
    stroke-dasharray: 6 4;
    stroke-linejoin: round;
    transition: fill .15s ease, stroke .15s ease;
}
.fusion-logo:hover, .fusion-logo:focus-visible, .fusion-logo.is-selected { z-index: 6; outline: none; }
.fusion-logo:hover .fusion-logo__pin,
.fusion-logo:focus-visible .fusion-logo__pin,
.fusion-logo.is-selected .fusion-logo__pin { scale: 1.5; }
.fusion-logo:hover .fusion-logo__shape path,
.fusion-logo:focus-visible .fusion-logo__shape path,
.fusion-logo.is-selected .fusion-logo__shape path,
.fusion-logo--static .fusion-logo__shape path {
    fill: color-mix(in srgb, var(--occupied) 12%, transparent);
    stroke: var(--occupied);
}
.fusion-logo--static { cursor: default; }
.fusion-logo__pin {
    position: absolute;
    left: var(--pin-left, 50%);
    top: var(--pin-top, 50%);
    display: grid;
    place-items: center;
    width: var(--pin-size, 40%);
    max-width: var(--pin-max, 56px);
    aspect-ratio: 1;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, .92);
    border-radius: 50%;
    background: var(--occupied);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
    transform: translate(-50%, -50%);
    transition: scale .15s ease;
}
.fusion-logo img { width: 100%; height: 100%; padding: 3px; border-radius: 50%; object-fit: contain; background: #fff; pointer-events: none; }

.map-floating-tools { position: absolute; z-index: 10; top: 18px; left: 18px; width: min(360px, calc(100% - 96px)); }
.search-box { display: flex; min-height: 50px; align-items: center; gap: 10px; padding: 2px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--panel); box-shadow: 0 16px 32px rgba(0,0,0,.24); backdrop-filter: blur(16px); }
.search-box svg { width: 18px; fill: var(--muted); }
.search-box input { width: 100%; min-width: 0; min-height: 44px; color: var(--text); border: 0; outline: 0; background: transparent; }
.search-box input[type="search"]::-webkit-search-cancel-button { appearance: none; -webkit-appearance: none; }
.search-box input::placeholder { color: #75877f; }
.search-clear { display: grid; flex: 0 0 auto; width: 44px; height: 44px; padding: 0; place-items: center; color: var(--muted); border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.search-clear:hover, .search-clear:focus-visible { color: var(--text); background: rgba(255,255,255,.1); outline: none; }
.search-clear svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.search-clear[hidden] { display: none; }
.search-results { margin-top: 7px; max-height: min(48vh, 360px); overflow-y: auto; padding: 7px; border: 1px solid var(--border); border-radius: 14px; background: var(--panel); backdrop-filter: blur(18px); }
.search-result { display: flex; width: 100%; padding: 11px 12px; color: var(--text); border: 0; border-radius: 9px; background: transparent; text-align: left; cursor: pointer; }
.search-result:hover, .search-result:focus-visible { background: rgba(255,255,255,.09); outline: none; }
.search-no-result { margin: 8px; color: var(--muted); font-size: .82rem; }

.zoom-tools { position: absolute; z-index: 10; top: 18px; right: 18px; display: flex; gap: 6px; padding: 6px; border: 1px solid var(--border); border-radius: 13px; background: var(--panel); backdrop-filter: blur(16px); }
.zoom-tools button { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 44px; padding: 0 10px; color: var(--text); border: 0; border-radius: 8px; background: rgba(255,255,255,.07); font-weight: 850; cursor: pointer; }
.zoom-tools button:hover { background: rgba(255,255,255,.14); }
.zoom-tools .fit-button { gap: 6px; font-size: .7rem; }
.fit-icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.gesture-hint { position: absolute; z-index: 5; left: 50%; bottom: 14px; margin: 0; padding: 8px 12px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; background: var(--panel); font-size: .7rem; transform: translateX(-50%); pointer-events: none; white-space: nowrap; }
.gesture-hint span { color: var(--accent-ink); }

.booth-dialog { width: min(540px, calc(100% - 28px)); max-height: calc(100dvh - 28px); padding: 0; overflow: visible; color: var(--dialog-text); border: 0; border-radius: 24px; background: transparent; }
.booth-dialog::backdrop { background: rgba(9, 18, 46, .7); backdrop-filter: blur(8px); }
.dialog-panel { position: relative; max-height: calc(100dvh - 28px); overflow-y: auto; padding: clamp(24px, 5vw, 38px); border: 1px solid var(--dialog-border); border-radius: 24px; background: var(--dialog-surface); box-shadow: 0 30px 100px rgba(9, 18, 46, .5); }
.dialog-close { position: absolute; top: 14px; right: 14px; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; color: var(--dialog-close); border: 0; border-radius: 50%; background: var(--dialog-close-bg); cursor: pointer; }
.dialog-close svg { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.dialog-close:hover { color: var(--dialog-text); }
.dialog-close:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.dialog-location { padding-right: 42px; }
.dialog-location p { margin: 0 0 26px; color: var(--dialog-muted); font-size: .88rem; }
.company-heading { display: flex; align-items: center; gap: 16px; }
.company-heading img { width: 82px; height: 68px; padding: 8px; object-fit: contain; border: 1px solid var(--dialog-border); border-radius: 15px; background: #fff; }
.company-heading p { margin: 0 0 4px; color: var(--dialog-muted); font-size: .68rem; font-weight: 850; text-transform: uppercase; letter-spacing: .12em; }
.company-heading h2, .availability-message h2 { margin: 0; color: var(--dialog-text); font-size: clamp(1.7rem, 5vw, 2.3rem); line-height: 1; letter-spacing: -.055em; }
.dialog-notes { margin: 22px 0; color: var(--dialog-muted); line-height: 1.6; }
.availability-message { padding: 14px 0 8px; }
.availability-icon { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 16px; color: #8a6500; border-radius: 50%; background: #fff0b8; }
.availability-message p { color: var(--dialog-muted); line-height: 1.6; }
.primary-action { color: #06140f; background: #42d996; }
.secondary-action { color: var(--dialog-text); border: 1px solid var(--dialog-border); }

html[data-theme="light"] {
    --dialog-surface: #ffffff;
    --dialog-surface-soft: #f5f7fc;
    --dialog-text: #16203c;
    --dialog-muted: #5c6483;
    --dialog-border: #dde2ef;
    --dialog-hover: #eef2fb;
    --dialog-close: #5c6483;
    --dialog-close-bg: #eceff8;
}

html[data-theme="light"] .search-box,
html[data-theme="light"] .search-results,
html[data-theme="light"] .zoom-tools { box-shadow: 0 16px 32px rgba(23, 33, 71, .14); }
html[data-theme="light"] .search-box input::placeholder { color: #767d99; }
html[data-theme="light"] .search-result:hover,
html[data-theme="light"] .search-result:focus-visible,
html[data-theme="light"] .search-clear:hover,
html[data-theme="light"] .search-clear:focus-visible,
html[data-theme="light"] .zoom-tools button { background: rgba(23, 33, 71, .07); }
html[data-theme="light"] .zoom-tools button:hover { background: rgba(23, 33, 71, .13); }

@media (max-width: 700px) {
    .map-floating-tools { top: 10px; left: 10px; width: calc(100% - 84px); }
    .zoom-tools { top: auto; right: 10px; bottom: 48px; flex-direction: column; }
    .zoom-tools .fit-button { width: 44px; padding: 0; }
    .zoom-tools .fit-label { display: none; }
    .zoom-tools .fit-icon { width: 18px; height: 18px; }
    .gesture-hint { bottom: 9px; max-width: calc(100% - 20px); overflow: hidden; text-overflow: ellipsis; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
