/* Decent Work World Map v4.0.0 */
.dwm-wrap {
    position: relative;
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    box-sizing: border-box;
}

/* ── Search ───────────────────────── */
.dwm-search-row { display:flex; justify-content:flex-start; margin:0 0 12px; }
.dwm-search {
    width: min(420px,100%);
    padding: 9px 14px;
    border: 1px solid #d0d0d0;
    border-radius: 7px;
    background: #fff;
    font-size: 14px;
    color: #222;
    cursor: pointer;
    appearance: auto;
}
.dwm-search:focus { outline:none; border-color:#888; box-shadow:0 0 0 2px rgba(0,0,0,.08); }

/* ── Legend ───────────────────────── */
.dwm-legend { display:flex; flex-wrap:wrap; gap:8px; margin:10px 0 14px; font-size:12px; color:#27313d; align-items:center; }
.dwm-legend-item { display:inline-flex; align-items:center; gap:7px; padding:6px 10px; border:1px solid #e6e8eb; border-radius:999px; background:#fff; box-shadow:0 1px 2px rgba(0,0,0,.04); line-height:1.2; }
.dwm-legend-swatch { width:13px; height:13px; border-radius:4px; flex-shrink:0; border:1px solid rgba(0,0,0,.12); box-shadow:inset 0 0 0 1px rgba(255,255,255,.35); }

/* ── Map outer + spinner ──────────── */
.dwm-map-outer { position:relative; }
.dwm-map-div { width:100%; display:block; }

/* Tooltip must never intercept mouse events */
.dwm-map-div .amcharts-tooltip-container,
.dwm-map-div [class*="amcharts"][class*="tooltip"],
.dwm-map-div foreignObject { pointer-events:none !important; }

/* ── Loading spinner ──────────────── */
.dwm-spinner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.7);
    z-index: 10;
    border-radius: 6px;
    pointer-events: none;
}
.dwm-spinner-ring {
    width: 44px; height: 44px;
    border: 4px solid #e0e0e0;
    border-top-color: #26a69a;
    border-radius: 50%;
    animation: dwm-spin .8s linear infinite;
}
@keyframes dwm-spin { to { transform:rotate(360deg); } }

/* ── Tooltip HTML ─────────────────── */
.dwm-tt {
    width: 240px; padding: 12px 14px 10px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #111; line-height: 1.45;
}
.dwm-tt-name { font-size:15px; font-weight:700; color:#111; margin-bottom:8px; padding-bottom:8px; border-bottom:2px solid #ccc; }
.dwm-tt-region { font-size:11px; color:#888; margin-bottom:8px; }
.dwm-tt-row { display:flex; gap:12px; align-items:flex-start; }
.dwm-tt-cell { flex:1; min-width:0; }
.dwm-tt-label { font-size:10px; color:#999; text-transform:uppercase; letter-spacing:.04em; margin-bottom:2px; }
.dwm-tt-score { font-size:22px; font-weight:700; color:#111; line-height:1; white-space:nowrap; }
.dwm-tt-rating { font-size:12px; font-weight:600; color:#333; line-height:1.35; white-space:normal; word-break:break-word; }

/* ── Status ───────────────────────── */
.dwm-status { font-size:11px; color:#888; margin-top:6px; min-height:16px; }
.dwm-status.dwm-error { color:#c0392b; font-weight:500; }

/* ── Modal overlay ────────────────── */
.dwm-modal[hidden] { display:none; }
.dwm-modal {
    position: fixed; inset:0; z-index:99999;
    display: flex; align-items:center; justify-content:center;
    padding: 20px; box-sizing:border-box;
    animation: dwm-fade-in .18s ease;
}
@keyframes dwm-fade-in { from { opacity:0; } to { opacity:1; } }

.dwm-modal-backdrop {
    position: absolute; inset:0;
    background: rgba(0,0,0,.52); cursor:pointer;
}

/* ── Modal card ───────────────────── */
.dwm-modal-inner {
    position: relative; z-index:1;
    width: min(400px,95vw);
    border-radius: 14px; overflow:hidden;
    box-shadow: 0 16px 48px rgba(0,0,0,.3);
    animation: dwm-slide-up .2s ease;
}
@keyframes dwm-slide-up { from { transform:translateY(16px); opacity:0; } to { transform:translateY(0); opacity:1; } }

.dwm-modal-header { padding:24px 52px 18px 24px; }
.dwm-modal-name { font-size:clamp(20px,5vw,30px); font-weight:800; margin:0; line-height:1.1; }
.dwm-modal-close {
    position:absolute; top:14px; right:16px;
    background:none; border:none; font-size:28px; line-height:1;
    cursor:pointer; padding:0; opacity:.8; transition:opacity .15s;
}
.dwm-modal-close:hover { opacity:1; }

.dwm-modal-body { background:#fff; border-radius:10px 10px 14px 14px; margin:0 10px 10px; padding:16px 16px 18px; }
.dwm-modal-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:10px; }
.dwm-modal-cell { background:#f4f4f4; border-radius:8px; padding:12px 14px; }
.dwm-modal-label { font-size:11px; color:#888; text-transform:uppercase; letter-spacing:.05em; margin-bottom:4px; }
.dwm-modal-score  { font-size:32px; font-weight:700; color:#111; }
.dwm-modal-rating { font-size:13px; font-weight:600; color:#222; line-height:1.4; }
.dwm-modal-region-wrap { background:#f4f4f4; border-radius:8px; padding:10px 14px; margin-bottom:14px; }
.dwm-modal-region { font-size:13px; font-weight:500; color:#333; }
.dwm-modal-btn {
    display:block; padding:11px 16px;
    border:1.5px solid #ddd; border-radius:7px;
    font-size:13px; font-weight:500; color:#222;
    background:#fff; text-decoration:none; text-align:center;
    transition:background .15s, color .15s;
}
.dwm-modal-btn:hover { background:#f0f0f0; color:#000; text-decoration:none; }

@media (max-width:480px) {
    .dwm-modal-grid { grid-template-columns:1fr; }
    .dwm-modal { padding:12px; }
    .dwm-modal-inner { border-radius:10px; }
}

/* ═══════════════════════════════════════════════════════
   ADMIN BUILDER STYLES
   ═══════════════════════════════════════════════════════ */

/* ── Column mapping table ── */
.dwm-mapping-table { margin-bottom:0; }
.dwm-mapping-table td, .dwm-mapping-table th { padding:8px 10px; vertical-align:middle; }
.dwm-mapping-table input[type="text"] { width:100%; max-width:220px; }

/* ── Chips ── */
.dwm-chip {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 12px;
    border: 1px solid #c3c4c7;
    background: #f0f0f1;
    color: #1d2327;
    font-size: 11px;
    font-family: monospace;
    cursor: pointer;
    margin: 2px 2px 2px 0;
    line-height: 1.5;
    transition: background .12s, border-color .12s;
}
.dwm-chip:hover { background: #2271b1; color: #fff; border-color: #2271b1; }
.dwm-chip-used  { background: #d7f5e0; border-color: #00a32a; color: #00a32a; }
.dwm-chip-ready { background: #2271b1 !important; color: #fff !important; border-color: #2271b1 !important; cursor: pointer; }
.dwm-chip-raw   { background: #fef8ee; border-color: #dba617; color: #7a4f00; }
.dwm-chip-raw:hover { background: #dba617; color: #fff; border-color: #dba617; }
.dwm-chip-mapping { background: #eef2fb; border-color: #2271b1; color: #2271b1; }
.dwm-chip-mapping:hover { background: #2271b1; color: #fff; }
.dwm-chip-sep   { color: #ccc; margin: 0 6px; }
.dwm-chip-label { font-size: 11px; color: #888; margin-right:4px; }

/* ── Builder wrap ── */
.dwm-builder-wrap { padding: 4px 0; }

.dwm-builder-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
}
.dwm-builder-label { font-size: 12px; color: #50575e; white-space: nowrap; font-weight: 600; }

/* ── Side-by-side editor + preview ── */
.dwm-builder-editor {
    display: flex;
    gap: 0;
    border: 1px solid #dcdcde;
    border-radius: 0 0 4px 4px;
    overflow: hidden;
}
.dwm-builder-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.dwm-builder-col + .dwm-builder-col { border-left: 2px solid #dcdcde; }
.dwm-builder-col-label {
    display: block;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    color: #50575e;
    text-transform: uppercase;
    letter-spacing: .04em;
    background: #f6f7f7;
    border-bottom: 1px solid #dcdcde;
}

/* ── Textarea ── */
.dwm-template-textarea {
    flex: 1;
    width: 100% !important;
    box-sizing: border-box;
    border: none !important;
    border-radius: 0 !important;
    resize: vertical;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.6;
    padding: 10px 12px;
    background: #1e1e2e;
    color: #cdd6f4;
    outline: none;
    box-shadow: none !important;
}
.dwm-template-textarea:focus { outline: none; box-shadow: none !important; }

/* ── Tooltip preview ── */
.dwm-tooltip-preview-wrap {
    flex: 1;
    padding: 20px;
    background: repeating-linear-gradient(45deg,#f0f0f0 0,#f0f0f0 10px,#fafafa 10px,#fafafa 20px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
}
.dwm-preview-box {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 24px rgba(0,0,0,.15), 0 0 0 1px #d6d6d6;
    padding: 0;
    max-width: 260px;
    width: 100%;
    min-height: 60px;
    overflow: hidden;
}
.dwm-preview-box .dwm-tt { padding: 12px 14px 10px; }

/* ── Popup preview ── */
.dwm-popup-preview-wrap {
    flex: 1;
    padding: 20px;
    background: repeating-linear-gradient(45deg,#f0f0f0 0,#f0f0f0 10px,#fafafa 10px,#fafafa 20px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
}
.dwm-preview-modal {
    width: 100%;
    max-width: 340px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.dwm-preview-modal .dwm-modal-body { background: #fff; border-radius: 10px 10px 12px 12px; margin: 0 10px 10px; padding: 14px; }

/* ── Responsive: stack on narrow screens ── */
@media (max-width: 900px) {
    .dwm-builder-editor { flex-direction: column; }
    .dwm-builder-col + .dwm-builder-col { border-left: none; border-top: 2px solid #dcdcde; }
}

/* ── Visual builder rows ── */
.dwm-visual-builder { padding: 4px 0; }
.dwm-vb-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.dwm-vb-list { border:1px solid #dcdcde; border-radius:6px; overflow:hidden; margin-bottom:10px; }

.dwm-vb-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    transition: background .12s;
}
.dwm-vb-row:last-child { border-bottom: none; }
.dwm-vb-row.dwm-vb-hidden { background: #fafafa; opacity: .55; }
.dwm-vb-row.ui-sortable-helper { box-shadow: 0 4px 16px rgba(0,0,0,.12); border-radius:6px; opacity:.95; }

.dwm-vb-drag { cursor: grab; color: #b0b0b0; font-size: 16px; flex-shrink:0; user-select:none; }
.dwm-vb-drag:active { cursor: grabbing; }
.dwm-vb-key { font-family:monospace; font-size:12px; color:#2271b1; background:#eef2fb; padding:2px 7px; border-radius:10px; white-space:nowrap; flex-shrink:0; }
.dwm-vb-label-input { flex:1; min-width:80px; border:1px solid #dcdcde; border-radius:4px; padding:4px 8px; font-size:13px; }
.dwm-vb-label-input:focus { border-color:#2271b1; outline:none; box-shadow:0 0 0 2px rgba(34,113,177,.1); }

.dwm-vb-style-badge { font-size:10px; padding:2px 7px; border-radius:10px; font-weight:600; text-transform:uppercase; letter-spacing:.04em; flex-shrink:0; }
.dwm-vb-style-name   { background:#fff3e0; color:#e65100; }
.dwm-vb-style-score  { background:#e8f5e9; color:#2e7d32; }
.dwm-vb-style-rating { background:#e3f2fd; color:#1565c0; }
.dwm-vb-style-region { background:#f3e5f5; color:#6a1b9a; }
.dwm-vb-style-button { background:#fce4ec; color:#880e4f; }
.dwm-vb-style-text   { background:#f5f5f5; color:#555; }

.dwm-vb-toggle, .dwm-vb-remove {
    background: none; border: none; cursor: pointer;
    padding: 3px 6px; font-size: 16px; line-height:1;
    border-radius: 4px; flex-shrink:0;
    transition: background .12s;
}
.dwm-vb-toggle:hover { background: #f0f0f0; }
.dwm-vb-remove { font-size:13px; color:#999; }
.dwm-vb-remove:hover { background:#fce4ec; color:#c0392b; }

.dwm-vb-add-row { margin-top:4px; display:flex; align-items:center; flex-wrap:wrap; gap:6px; }
.dwm-vb-add-row strong { font-size:12px; color:#50575e; white-space:nowrap; }
.dwm-add-chips { display:inline-flex; flex-wrap:wrap; gap:4px; }
.dwm-chip-add { background:#fff; border:1px dashed #2271b1; color:#2271b1; }
.dwm-chip-add:hover { background:#2271b1; color:#fff; border-style:solid; }

.dwm-vb-preview-row { margin-top:16px; }
.dwm-vb-preview-row strong { font-size:12px; color:#50575e; }

/* ── Controls row (search + filters) ── */
.dwm-controls-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    align-items: center;
}
.dwm-control {
    padding: 9px 14px;
    border: 1px solid #d0d0d0;
    border-radius: 7px;
    background: #fff;
    font-size: 14px;
    color: #222;
    cursor: pointer;
    appearance: auto;
    height: 40px;
    box-sizing: border-box;
}
.dwm-control:focus { outline: none; border-color: #888; box-shadow: 0 0 0 2px rgba(0,0,0,.08); }

.dwm-search      { flex: 2; min-width: 180px; }
.dwm-region-filter,
.dwm-rating-filter { flex: 1; min-width: 140px; }

.dwm-filter-reset {
    padding: 8px 14px;
    border: 1px solid #d63638;
    border-radius: 7px;
    background: #fff;
    color: #d63638;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, color .15s;
    height: 40px;
}
.dwm-filter-reset:hover { background: #d63638; color: #fff; }

/* ── Filter summary ───────────────────── */
.dwm-filter-summary[hidden] { display:none; }
.dwm-filter-summary { margin: 14px 0 14px; }
.dwm-summary-card {
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,.04);
    overflow: hidden;
}
.dwm-summary-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    padding: 14px 16px;
    border-bottom: 1px solid #eee;
    background: #fafafa;
}
.dwm-summary-kicker {
    font-size: 10px;
    line-height: 1.2;
    color: #777;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 4px;
}
.dwm-summary-head h3 {
    margin: 0;
    font-size: 18px;
    line-height: 1.25;
    color: #111;
}
.dwm-summary-count {
    flex: 0 0 auto;
    padding: 6px 10px;
    border-radius: 999px;
    background: #f0f4f8;
    color: #222;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}
.dwm-summary-empty { margin: 0; padding: 14px 16px; color: #666; }
.dwm-summary-table-wrap { max-height: 280px; overflow: auto; }
.dwm-summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.dwm-summary-table th,
.dwm-summary-table td {
    padding: 9px 12px;
    border-bottom: 1px solid #f0f0f0;
    text-align: left;
    vertical-align: top;
}
.dwm-summary-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #fff;
    color: #666;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.dwm-summary-table td:first-child { font-weight: 600; color: #111; }
.dwm-summary-country-link {
    display: inline-flex;
    align-items: center;
    color: #111;
    text-decoration: none;
    font-weight: 700;
}
.dwm-summary-country-link:hover { text-decoration: underline; }
.dwm-summary-profile-btn {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 8px;
    background: #066d57;
    color: #fff;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.dwm-summary-profile-btn:hover { filter: brightness(.95); color: #fff; }
.dwm-summary-no-link { color: #999; }
.dwm-summary-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    box-shadow: 0 0 0 1px rgba(0,0,0,.12) inset;
}
@media (max-width: 640px) {
    .dwm-summary-head { flex-direction: column; gap: 8px; }
    .dwm-summary-count { align-self: flex-start; }
    .dwm-summary-table { font-size: 12px; }
    .dwm-summary-table th,
    .dwm-summary-table td { padding: 8px; }
}

@media (max-width: 540px) {
    .dwm-search, .dwm-region-filter, .dwm-rating-filter { flex: 1 1 100%; }
}


/* Admin legend manager */
.dwm-legend-admin-table .dwm-legend-drag {
    cursor: move;
    color: #7a7a7a;
    text-align: center;
    font-size: 16px;
    vertical-align: middle;
}
.dwm-legend-admin-table input[type="text"] {
    min-height: 34px;
}
.dwm-legend-admin-table input[type="color"] {
    width: 44px;
    height: 32px;
    padding: 1px;
}
.dwm-legend-admin-row.ui-sortable-helper {
    display: table;
    background: #fff;
    box-shadow: 0 8px 24px rgba(0,0,0,.14);
}

.dwm-legend-admin-table .dwm-legend-drag:hover {
    color: #007c89;
    background: #eef9f8;
}
.dwm-legend-admin-table .dwm-legend-sort-placeholder td,
.dwm-legend-admin-table .dwm-legend-sort-placeholder {
    background: #e7f5ff !important;
    border: 2px dashed #72aee6 !important;
    height: 48px;
}
