/* ==================== MAPA ESTRATÉGICO ==================== */
/* Reset + layout grid: topbar / sidebar | canvas | panel-right */

* { box-sizing: border-box; }

body.mapa-page {
    margin: 0;
    background: #0a0b0e;
    color: #e8e8e8;
    font-family: 'Inter', -apple-system, sans-serif;
    overflow: hidden;
    height: 100vh;
}

.map-app {
    display: grid;
    grid-template-rows: 56px 1fr;
    height: 100vh;
}

/* ===== TOP BAR ===== */
.map-topbar {
    background: #14161a;
    border-bottom: 1px solid #23262d;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    gap: 16px;
    z-index: 10;
}

.map-topbar-left, .map-topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.map-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.map-save-status {
    font-size: 12px;
    color: #6a6a6a;
    padding: 2px 8px;
    background: rgba(255,255,255,0.04);
    border-radius: 10px;
}

.map-save-status.saving { color: #f59e0b; }
.map-save-status.saved { color: #22c55e; }
.map-save-status.error { color: #ef4444; }

.map-divider {
    width: 1px;
    height: 24px;
    background: #23262d;
    margin: 0 4px;
}

/* ===== BUTTONS ===== */
.map-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #c9c9c9;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.map-btn:hover:not(:disabled) {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

.map-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.map-btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

.map-btn-ghost {
    border-color: #23262d;
}

.map-btn-primary {
    background: #bfff00;
    color: #0a0b0e;
    font-weight: 600;
}

.map-btn-primary:hover:not(:disabled) {
    background: #d4ff3a;
    color: #0a0b0e;
}

.map-btn-danger {
    color: #ef4444;
}

.map-btn-danger:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.1);
    color: #ff5050;
}

.map-btn-danger-ghost {
    color: #ff5050;
}

/* ===== MAIN GRID ===== */
.map-grid {
    display: grid;
    grid-template-columns: 220px 1fr 280px;
    height: calc(100vh - 56px);
    overflow: hidden;
}

/* ===== SIDEBAR (LEFT) ===== */
.map-sidebar {
    background: #14161a;
    border-right: 1px solid #23262d;
    overflow-y: auto;
    padding: 12px;
}

.map-section {
    margin-bottom: 20px;
}

.map-section-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6a6a6a;
    margin-bottom: 8px;
    padding: 0 4px;
}

.map-tools {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.map-tool {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    background: #1a1d22;
    border: 1px solid #23262d;
    border-radius: 6px;
    color: #c9c9c9;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.map-tool:hover {
    background: #23262d;
    color: #fff;
}

.map-tool.active {
    background: rgba(191, 255, 0, 0.12);
    border-color: #bfff00;
    color: #bfff00;
    box-shadow: 0 0 8px rgba(191, 255, 0, 0.3);
}

.map-layer-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    font-size: 12px;
    color: #c9c9c9;
    cursor: pointer;
    border-radius: 4px;
}

.map-layer-toggle:hover {
    background: rgba(255,255,255,0.04);
}

.map-layer-toggle input {
    accent-color: #bfff00;
}

.map-action-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 6px 10px;
    background: transparent;
    border: 1px solid #23262d;
    border-radius: 6px;
    color: #c9c9c9;
    font-size: 12px;
    cursor: pointer;
    margin-bottom: 4px;
    transition: all 0.15s;
    font-family: inherit;
}

.map-action-btn:hover {
    background: rgba(255,255,255,0.04);
    color: #fff;
}

.map-help {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 11px;
    color: #8a8a8a;
}

.map-help li {
    padding: 3px 4px;
    line-height: 1.5;
}

.map-help kbd {
    background: #23262d;
    border-radius: 3px;
    padding: 1px 5px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: #e8e8e8;
}

/* ===== CANVAS ===== */
.map-canvas-wrap {
    position: relative;
    background: #0d0f12;
    overflow: hidden;
}

#mapCanvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: default;
}

#mapCanvas.placing-cursor {
    cursor: crosshair;
}

#mapCanvas.dragging-cursor {
    cursor: grabbing;
}

.placing-indicator {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(191, 255, 0, 0.95);
    color: #0a0b0e;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
    z-index: 5;
}

.placing-indicator .map-btn {
    background: rgba(10, 11, 14, 0.2);
    color: #0a0b0e;
}

.map-empty-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #4a4a4a;
    pointer-events: none;
}

.map-empty-hint .map-empty-icon {
    font-size: 64px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.map-empty-hint h3 {
    margin: 0 0 4px;
    color: #8a8a8a;
    font-size: 16px;
}

.map-empty-hint p {
    margin: 0;
    font-size: 12px;
}

/* ===== RIGHT PANEL ===== */
.map-panel-right {
    background: #14161a;
    border-left: 1px solid #23262d;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.map-tabs {
    display: flex;
    border-bottom: 1px solid #23262d;
}

.map-tab {
    flex: 1;
    padding: 10px 12px;
    background: transparent;
    border: 0;
    color: #8a8a8a;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    border-bottom: 2px solid transparent;
}

.map-tab:hover {
    color: #fff;
    background: rgba(255,255,255,0.03);
}

.map-tab.active {
    color: #bfff00;
    border-bottom-color: #bfff00;
}

.map-search-wrap {
    padding: 10px;
    border-bottom: 1px solid #23262d;
}

.map-search {
    width: 100%;
    padding: 7px 10px;
    background: #0d0f12;
    border: 1px solid #23262d;
    border-radius: 6px;
    color: #e8e8e8;
    font-size: 12px;
    font-family: inherit;
    outline: none;
}

.map-search:focus {
    border-color: #bfff00;
}

.map-panel-content {
    flex: 1;
    overflow-y: auto;
}

.map-catalog-list {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.map-loading {
    padding: 16px;
    text-align: center;
    color: #6a6a6a;
    font-size: 12px;
}

/* Ship item in catalog */
.map-catalog-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    background: #1a1d22;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.12s;
}

.map-catalog-item:hover {
    background: #23262d;
    border-color: #bfff00;
}

.map-catalog-item.placing {
    background: rgba(191, 255, 0, 0.12);
    border-color: #bfff00;
}

.map-catalog-thumb {
    position: relative;
    width: 52px;
    height: 52px;
    background: #0d0f12;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid currentColor;
}

.map-catalog-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: -webkit-optimize-contrast;
}

.map-catalog-thumb-fallback {
    font-size: 28px;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}

/* Tier chip — overlay top-right del thumbnail */
.map-catalog-tier-chip {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--chip-color, #444);
    color: #0a0b0e;
    font-size: 9px;
    font-weight: 800;
    padding: 1px 4px;
    border-radius: 3px;
    line-height: 1.2;
    letter-spacing: 0.04em;
    text-shadow: 0 0 1px rgba(255,255,255,0.3);
    box-shadow: 0 1px 2px rgba(0,0,0,0.5);
    pointer-events: none;
}

/* Colores por tier — oro/plata/bronce/acero/cobre/madera/ramita */
.tier-chip-I   { --chip-color: #FFD700; }  /* oro */
.tier-chip-II  { --chip-color: #D3D3D3; }  /* plata */
.tier-chip-III { --chip-color: #CD7F32; }  /* bronce */
.tier-chip-IV  { --chip-color: #94A3B8; }  /* acero */
.tier-chip-V   { --chip-color: #B87333; }  /* cobre */
.tier-chip-VI  { --chip-color: #8B5A2B; }  /* madera oscura */
.tier-chip-VII { --chip-color: #6B4226; }  /* madera seca */

.map-catalog-thumb-fallback {
    font-size: 18px;
}

.map-catalog-info {
    flex: 1;
    min-width: 0;
}

.map-catalog-name {
    font-size: 12px;
    font-weight: 500;
    color: #e8e8e8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.map-catalog-meta {
    font-size: 10px;
    color: #6a6a6a;
    margin-top: 2px;
}

/* Tier group header in catalog (colapsable) */
.map-tier-group {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #8a8a8a;
    padding: 12px 8px 6px;
    border-bottom: 1px solid #23262d;
    margin-bottom: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
    transition: background 0.1s;
}

.map-tier-group:hover {
    background: rgba(255, 255, 255, 0.03);
}

.map-tier-group .tier-toggle {
    font-size: 9px;
    color: #6a6a6a;
    transition: transform 0.15s;
    flex-shrink: 0;
}

.map-tier-group .tier-count {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.08);
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 9px;
    color: #6a6a6a;
}

.map-tier-group:first-child {
    padding-top: 4px;
}

/* Zoom controls en topbar */
.map-zoom-controls {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 4px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
}

.map-zoom-btn {
    background: transparent;
    border: 0;
    color: #c9c9c9;
    width: 26px;
    height: 26px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.1s;
}

.map-zoom-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.map-zoom-indicator {
    font-size: 11px;
    color: #8a8a8a;
    padding: 0 6px;
    min-width: 36px;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
}

/* ===== STRATEGY ROWS ===== */
.strategies-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.strategy-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: #1a1d22;
    border: 1px solid #23262d;
    border-radius: 6px;
    transition: all 0.12s;
}

.strategy-row.active {
    border-color: #bfff00;
    background: rgba(191, 255, 0, 0.06);
}

.strategy-vis {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.strategy-vis input {
    display: none;
}

.strategy-vis-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #bfff00;
    border: 2px solid #6a6a6a;
    transition: all 0.12s;
    display: inline-block;
}

.strategy-vis input:not(:checked) + .strategy-vis-dot {
    background: transparent;
    border-color: #6a6a6a;
}

.strategy-name-btn {
    flex: 1;
    background: transparent;
    border: 0;
    color: #c9c9c9;
    font-size: 12px;
    text-align: left;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    font-family: inherit;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.strategy-name-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.strategy-name-btn.active {
    color: #bfff00;
    font-weight: 600;
}

.strategy-action {
    background: transparent;
    border: 0;
    color: #8a8a8a;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 11px;
    transition: all 0.1s;
}

.strategy-action:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.strategy-action.danger:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ff5050;
}

/* ===== INLINE EDIT POPUP ===== */
.edit-popup {
    position: absolute;
    background: #1a1d22;
    border: 1px solid #3a3f47;
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.6);
    z-index: 100;
    min-width: 260px;
    max-width: 320px;
    overflow: hidden;
}

.edit-popup-header {
    padding: 10px 12px;
    border-bottom: 1px solid #23262d;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #23262d;
}

.edit-popup-header strong {
    font-size: 13px;
    color: #fff;
}

.edit-popup-close {
    background: transparent;
    border: 0;
    color: #8a8a8a;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    line-height: 1;
    border-radius: 4px;
}

.edit-popup-close:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.edit-popup-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.edit-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.edit-field label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8a8a8a;
}

.edit-field input[type="text"],
.edit-field input[type="number"],
.edit-field textarea,
.edit-field select {
    padding: 6px 8px;
    background: #0d0f12;
    border: 1px solid #23262d;
    border-radius: 4px;
    color: #e8e8e8;
    font-size: 12px;
    font-family: inherit;
    outline: none;
}

.edit-field input:focus,
.edit-field textarea:focus,
.edit-field select:focus {
    border-color: #bfff00;
}

.edit-field textarea {
    resize: vertical;
    min-height: 50px;
}

.edit-color-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
}

.edit-color-swatch {
    aspect-ratio: 1;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.1s;
}

.edit-color-swatch:hover {
    transform: scale(1.1);
}

.edit-color-swatch.selected {
    border-color: #fff;
}

.edit-icon-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
}

.edit-icon-btn {
    aspect-ratio: 1;
    background: #0d0f12;
    border: 1px solid #23262d;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s;
    padding: 0;
}

.edit-icon-btn:hover {
    background: #23262d;
}

.edit-icon-btn.selected {
    background: rgba(191, 255, 0, 0.15);
    border-color: #bfff00;
}

.edit-popup-footer {
    padding: 8px 12px;
    border-top: 1px solid #23262d;
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    background: #14161a;
}

/* ===== TOAST ===== */
.map-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1a1d22;
    border: 1px solid #3a3f47;
    color: #e8e8e8;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 13px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 200;
    pointer-events: none;
}

.map-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.map-toast.success { border-color: #22c55e; }
.map-toast.error { border-color: #ef4444; }

/* ===== PUESTO ICON UPLOAD ===== */
.edit-icon-upload {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.edit-icon-preview {
    margin-top: 6px;
}

.edit-icon-preview img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 6px;
    background: #0d0f12;
    border: 1px solid #23262d;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .map-grid {
        grid-template-columns: 180px 1fr 240px;
    }
}

@media (max-width: 768px) {
    .map-grid {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
    }
    .map-sidebar, .map-panel-right {
        display: none;
    }
}

/* ============ ZONE DEFAULTS TOOLBAR ============ */
.zone-defaults-bar {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    background: rgba(13, 15, 18, 0.96);
    border: 1px solid #2a2d33;
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(191, 255, 0, 0.08);
    max-width: 90vw;
}

.zone-defaults-title {
    color: #bfff00;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-align: center;
}

.zone-defaults-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
    justify-content: center;
}

.zone-defaults-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 10px;
    color: #9a9a9a;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.zone-defaults-field input[type="number"],
.zone-defaults-field input[type="text"] {
    width: 80px;
    padding: 6px 8px;
    background: #0d0f12;
    border: 1px solid #2a2d33;
    border-radius: 4px;
    color: #fff;
    font-size: 13px;
    font-family: inherit;
}

.zone-defaults-field input[type="color"] {
    width: 44px;
    height: 32px;
    padding: 2px;
    background: #0d0f12;
    border: 1px solid #2a2d33;
    border-radius: 4px;
    cursor: pointer;
}

.zone-defaults-shape-toggle {
    display: flex;
    background: #0d0f12;
    border: 1px solid #2a2d33;
    border-radius: 4px;
    overflow: hidden;
}

.zone-shape-btn {
    padding: 6px 12px;
    background: transparent;
    border: none;
    color: #9a9a9a;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.12s;
}

.zone-shape-btn:hover {
    background: rgba(191, 255, 0, 0.06);
    color: #fff;
}

.zone-shape-btn.active {
    background: rgba(191, 255, 0, 0.15);
    color: #bfff00;
}

/* ============ EDIT POPUP shape toggle + hint ============ */
.edit-shape-toggle {
    display: flex;
    background: #0d0f12;
    border: 1px solid #2a2d33;
    border-radius: 4px;
    overflow: hidden;
}

.edit-shape-btn {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: #9a9a9a;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.12s;
}

.edit-shape-btn:hover {
    background: rgba(191, 255, 0, 0.06);
    color: #fff;
}

.edit-shape-btn.active {
    background: rgba(191, 255, 0, 0.15);
    color: #bfff00;
}

.edit-hint {
    font-size: 11px;
    color: #6a6a6a;
    padding: 8px 10px;
    background: rgba(191, 255, 0, 0.04);
    border-left: 2px solid #bfff00;
    border-radius: 4px;
    margin-top: 8px;
    line-height: 1.5;
}

.edit-hint strong {
    color: #bfff00;
}

/* ========================================
   PANEL DE DIBUJO (fase 1 rework)
   ======================================== */
.map-color-palette {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin: var(--space-2) 0;
}

.map-color-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    padding: 0;
    transition: border-color 0.12s ease, transform 0.12s ease;
}
.map-color-swatch:hover {
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.4);
}
.map-color-swatch.active {
    border-color: #fff;
    box-shadow: 0 0 0 2px rgba(191, 255, 0, 0.4);
}

.map-style-presets {
    display: flex;
    gap: 4px;
    flex: 1;
}
.map-style-presets button {
    flex: 1;
    padding: 6px 8px;
    background: var(--bg-input, #1a1d24);
    color: var(--text-primary, #e8e8e8);
    border: 1px solid var(--border-soft, #2a2f3a);
    border-radius: var(--radius-sm, 6px);
    cursor: pointer;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 14px;
    letter-spacing: 2px;
    transition: border-color 0.12s ease, background 0.12s ease;
}
.map-style-presets button:hover {
    border-color: var(--accent-lime, #bfff00);
}
.map-style-presets button.active {
    background: rgba(191, 255, 0, 0.12);
    border-color: var(--accent-lime, #bfff00);
    color: var(--accent-lime, #bfff00);
}

.map-checkbox-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    font-size: var(--text-sm, 13px);
    color: var(--text-primary, #e8e8e8);
}
.map-checkbox-row input[type="checkbox"] {
    cursor: pointer;
    accent-color: var(--accent-lime, #bfff00);
}

/* Cursor de dibujo */
canvas.placing-cursor {
    cursor: crosshair;
}

/* ========================================
   ICON PICKER MODAL (fase 2)
   ======================================== */
.icon-picker-modal {
    background: var(--bg-elevated, #161922);
    border: 1px solid var(--border-subtle, #2a2f3a);
    border-radius: var(--radius-xl, 12px);
    width: 90%;
    max-width: 580px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 64px rgba(0,0,0,0.6);
}
.icon-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-subtle, #2a2f3a);
}
.icon-picker-header h3 {
    margin: 0;
    font-size: var(--text-lg, 16px);
    font-weight: 700;
}
.icon-picker-search-wrap {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle, #2a2f3a);
}
.icon-picker-search-wrap input {
    width: 100%;
}
.icon-picker-grid {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-3) var(--space-4);
}
.icon-picker-group {
    margin-bottom: var(--space-4);
}
.icon-picker-group-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary, #94a3b8);
    margin-bottom: var(--space-2);
    font-weight: 700;
}
.icon-picker-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: 6px;
}
.icon-picker-item {
    background: var(--bg-card, #1a1d24);
    border: 1px solid var(--border-soft, #2a2f3a);
    border-radius: var(--radius-md, 8px);
    aspect-ratio: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.12s ease, background 0.12s ease, transform 0.12s ease;
}
.icon-picker-item:hover {
    border-color: var(--accent-lime, #bfff00);
    background: rgba(191, 255, 0, 0.08);
    transform: scale(1.05);
}
.icon-picker-footer {
    padding: var(--space-2) var(--space-4);
    border-top: 1px solid var(--border-subtle, #2a2f3a);
    color: var(--text-dim, #6b7280);
    font-size: 11px;
    text-align: center;
}

/* ========================================
   PULIDO ESTÉTICO (fase 3)
   ======================================== */

/* Tool activo más visible con glow lima */
.map-tool-v2.active {
    background: rgba(191, 255, 0, 0.18) !important;
    border-color: var(--accent-lime, #bfff00) !important;
    color: var(--accent-lime, #bfff00) !important;
    box-shadow: 0 0 0 1px var(--accent-lime, #bfff00), 0 0 16px rgba(191, 255, 0, 0.25);
}

/* Separador visual entre grupos de tools */
.map-toolbar-v2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    padding-top: var(--space-2);
    border-top: 1px solid var(--border-subtle, #2a2f3a);
    margin-top: var(--space-2);
}
.map-toolbar-v2:first-child {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
}

/* Toolbar v2 visual: cards más consistentes */
.map-tool-v2 {
    background: var(--bg-card, #1a1d24);
    border: 1px solid var(--border-soft, #2a2f3a);
    border-radius: var(--radius-md, 8px);
    color: var(--text-secondary, #94a3b8);
    padding: var(--space-2);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease;
    min-height: 50px;
    justify-content: center;
}
.map-tool-v2:hover:not(.active) {
    border-color: rgba(191, 255, 0, 0.4);
    color: var(--text-primary, #e8e8e8);
    background: rgba(191, 255, 0, 0.05);
}
.map-tool-v2-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Botón de WoSB destacado sutil */
.map-btn[onclick*="setWoSBBackground"] {
    border-color: rgba(191, 255, 0, 0.3);
}

/* ========================================
   SIZE PREVIEW DOT (fase 4)
   ======================================== */
.map-size-preview-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-lime, #bfff00);
    box-shadow: 0 0 12px rgba(191, 255, 0, 0.4);
    transition: width 0.1s ease, height 0.1s ease;
    margin-left: var(--space-2);
    vertical-align: middle;
}

/* Quitar los presets numéricos — los dejamos sin estilo por si se usan en otro lado */
.map-size-presets {
    display: none;
}

/* ========================================
   EDIT POPUP — preview en vivo (fase 4)
   ======================================== */
.edit-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3);
    background: linear-gradient(135deg, rgba(191, 255, 0, 0.05), rgba(0, 0, 0, 0.2));
    border-radius: var(--radius-md, 8px);
    margin-bottom: var(--space-3);
    border: 1px solid var(--border-soft, #2a2f3a);
}
.edit-preview-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 16px rgba(0,0,0,0.5);
}
.edit-preview-label {
    font-size: var(--text-sm, 13px);
    font-weight: 600;
    color: var(--text-bright, #fff);
    text-align: center;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
