/* ============================================================================
   HARTĂ REGIUNI — tab în grupul Obiective.
   Culorile regiunilor NU stau aici: vin din data/paleta-regiuni.json prin API și
   se aplică inline pe fiecare județ, ca harta să urmeze automat reorganizările.
   Aici stă doar structura, tipografia și stările.
   ========================================================================== */

.hr-card { padding-bottom: 8px; }

.hr-toolbar { align-items: flex-start; flex-wrap: wrap; gap: 12px; }
.hr-controale { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }

.hr-camp { display: flex; flex-direction: column; gap: 4px; }
.hr-camp > span {
    font-size: .7rem; font-weight: 700; letter-spacing: .04em;
    text-transform: uppercase; color: var(--text-muted);
}
.hr-camp select {
    padding: 7px 10px; border-radius: var(--radius-sm);
    border: 1px solid var(--border-color); background: var(--surface-color);
    color: var(--text-main); font-size: .85rem; min-width: 250px;
}

/* Comutator de colorare: un singur control, trei stări. */
.hr-segment {
    display: inline-flex; border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-color);
}
.hr-segment button {
    border: 0; background: transparent; color: var(--text-muted);
    padding: 8px 14px; font-size: .82rem; font-weight: 600; cursor: pointer;
    white-space: nowrap; transition: background .15s, color .15s;
}
.hr-segment button + button { border-left: 1px solid var(--border-color); }
.hr-segment button:hover { background: color-mix(in srgb, var(--primary-color) 8%, transparent); }
.hr-segment button.is-activ { background: var(--primary-color); color: #fff; }

.hr-banner {
    display: flex; align-items: flex-start; gap: 10px;
    margin: 4px 0 14px; padding: 11px 14px; border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--accent-color) 8%, transparent);
    border-left: 3px solid var(--accent-color);
    font-size: .86rem; line-height: 1.45; color: var(--text-main);
}
.hr-banner i { color: var(--accent-color); margin-top: 2px; flex: 0 0 auto; }

/* Hartă + legendă. Pe ecran îngust legenda trece SUB hartă. */
.hr-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 18px; align-items: start; }
.hr-harta { position: relative; min-width: 0; }
.hr-svg { width: 100%; height: auto; display: block; overflow: visible; }

.hr-judet {
    stroke: var(--surface-color); stroke-width: 1.1; cursor: pointer;
    transition: opacity .15s, filter .15s;
}
.hr-judet:hover { filter: brightness(1.12); }
.hr-judet:focus-visible { outline: none; stroke: var(--text-main); stroke-width: 2.4; }
.hr-judet.is-sel { stroke: var(--text-main); stroke-width: 2; }
.hr-judet.is-dim { opacity: .22; }

/* Etichetele au contur în culoarea suprafeței: rămân lizibile pe orice fundal de județ.
   Ele sunt canalul secundar de identificare — paleta singură nu duce 9 regiuni. */
.hr-abrev, .hr-reg {
    text-anchor: middle; font-family: inherit; font-weight: 700;
    paint-order: stroke; stroke: rgba(0, 0, 0, .38); fill: #fff;
}
.hr-abrev { font-size: 13px; stroke-width: 2.8px; }
.hr-reg { font-size: 8.5px; stroke-width: 2.4px; opacity: .95; }
.hr-eticheta.is-dim { opacity: .25; }

/* Eticheta pe regiune — folosită DOAR pe telefon (vezi media query-ul de jos). */
.hr-reg-mare {
    text-anchor: middle; font-family: inherit; font-weight: 800; font-size: 34px;
    paint-order: stroke; stroke: rgba(0, 0, 0, .45); stroke-width: 6px; fill: #fff;
}
.hr-eticheta-reg { display: none; }
.hr-eticheta-reg.is-dim { opacity: .25; }

/* Sub pragul de lățime (clasa e pusă de ResizeObserver, pe lățimea REALĂ a hărții):
   o etichetă per regiune în loc de 42 de abrevieri ilizibile. */
.hr-compact .hr-eticheta { display: none; }
.hr-compact .hr-eticheta-reg { display: block; }

.hr-atributie {
    margin-top: 6px; font-size: .68rem; color: var(--text-muted); text-align: right;
}

/* Scala pentru modurile pe magnitudine — o rampă fără capete nu se poate citi. */
.hr-scala {
    display: grid; grid-template-columns: auto 1fr auto; align-items: center;
    gap: 6px; margin-bottom: 12px; padding: 9px 10px;
    border: 1px solid var(--border-color); border-radius: var(--radius-sm);
}
.hr-scala-cap { font-size: .68rem; font-weight: 700; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.hr-scala-bara { display: flex; height: 9px; border-radius: 3px; overflow: hidden; }
.hr-scala-bara i { flex: 1 1 0; }
.hr-scala small {
    grid-column: 1 / -1; text-align: center; font-size: .66rem;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em;
}

/* Legendă */
.hr-legenda { display: flex; flex-direction: column; gap: 3px; }
.hr-legenda-titlu {
    display: flex; align-items: center; justify-content: space-between;
    font-size: .7rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
    color: var(--text-muted); padding: 0 2px 6px;
}
.hr-reset {
    border: 0; background: transparent; color: var(--accent-color);
    font-size: .7rem; font-weight: 700; cursor: pointer; text-transform: none; letter-spacing: 0;
}
.hr-legenda-rand {
    display: flex; align-items: center; gap: 9px; width: 100%;
    padding: 8px 9px; border: 1px solid transparent; border-radius: var(--radius-sm);
    background: transparent; cursor: pointer; text-align: left;
    transition: background .15s, border-color .15s;
}
.hr-legenda-rand:hover { background: color-mix(in srgb, var(--primary-color) 6%, transparent); }
.hr-legenda-rand.is-sel {
    background: color-mix(in srgb, var(--primary-color) 10%, transparent);
    border-color: color-mix(in srgb, var(--primary-color) 35%, transparent);
}
.hr-pastila { width: 14px; height: 14px; border-radius: 4px; flex: 0 0 auto; }
.hr-pastila-mic { width: 10px; height: 10px; border-radius: 3px; display: inline-block; vertical-align: -1px; }
.hr-legenda-txt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.hr-legenda-txt b { font-size: .84rem; color: var(--text-main); }
.hr-legenda-txt small { font-size: .7rem; color: var(--text-muted); }
.hr-legenda-cifre { flex: 0 0 auto; text-align: right; display: flex; flex-direction: column; gap: 1px; }
.hr-legenda-cifre b { font-size: .84rem; }
.hr-legenda-cifre small { font-size: .68rem; color: var(--text-muted); }

/* Postul vacant se marchează cu pictogramă + text, nu prin culoare:
   o stare nu are voie să depindă de o nuanță. */
.hr-vacant-eticheta { color: var(--accent-color); font-weight: 700; }
.hr-vacant-eticheta i { margin-right: 3px; }

.hr-bun { color: #1B7F4B; }
.hr-atentie { color: #B8860B; }
.hr-slab { color: var(--accent-color); }

/* Tabelul e vedere de rezervă obligatorie, nu decor. */
.hr-tabel tbody tr { cursor: pointer; }
.hr-tabel tbody tr:hover { background: color-mix(in srgb, var(--primary-color) 5%, transparent); }
.hr-tabel tbody tr.is-sel { background: color-mix(in srgb, var(--primary-color) 10%, transparent); }
.hr-tabel tfoot td { border-top: 2px solid var(--border-color); font-weight: 700; }

/* Tooltip */
.hr-tooltip {
    /* FIXED, nu absolute: cu absolute se raporta la alt strămoș poziționat decât
       rădăcina modulului și sărea în susul paginii, departe de județ. */
    position: fixed; z-index: 60; pointer-events: none;
    min-width: 215px; max-width: 285px; padding: 10px 12px;
    border-radius: var(--radius-sm); border: 1px solid var(--border-color);
    background: var(--surface-color); box-shadow: 0 12px 30px -8px rgba(0, 0, 0, .28);
    font-size: .78rem; color: var(--text-main);
}
.hr-tooltip > b { font-size: .9rem; }
.hr-tip-reg { margin: 3px 0 7px; color: var(--text-muted); font-size: .74rem; }
.hr-tip-cifre { display: flex; flex-direction: column; gap: 3px; }
.hr-tip-cifre span {
    display: flex; justify-content: space-between; gap: 12px;
    color: var(--text-muted); font-size: .74rem;
}
.hr-tip-cifre b { color: var(--text-main); font-variant-numeric: tabular-nums; }
.hr-tip-cifre b i { font-style: normal; font-weight: 400; color: var(--text-muted); }

/* Blocul cu totalul regiunii — separat vizual, ca să nu se confunde cu cifrele județului. */
.hr-tip-regiune-total {
    margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--border-color);
    display: flex; flex-direction: column; gap: 3px;
}
.hr-tip-regiune-total > small {
    font-size: .66rem; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .03em; margin-bottom: 2px;
}
.hr-tip-regiune-total span {
    display: flex; justify-content: space-between; gap: 12px;
    color: var(--text-muted); font-size: .74rem;
}
.hr-tip-regiune-total b { color: var(--text-main); font-variant-numeric: tabular-nums; }

/* ── Mobil: 80% dintre utilizatori sunt pe telefon ────────────────────────── */
@media (max-width: 900px) {
    .hr-layout { grid-template-columns: 1fr; }
    .hr-legenda { max-height: none; }
    .hr-camp select { min-width: 0; width: 100%; }
    .hr-controale { width: 100%; }
    .hr-segment { width: 100%; }
    .hr-segment button { flex: 1 1 0; padding: 10px 6px; }
    /* Comutarea etichetelor o face ResizeObserver (clasa .hr-compact), pe lățimea reală
       a hărții — aici rămâne doar aranjarea în pagină. */
    .hr-tooltip { left: 12px !important; right: 12px; top: auto !important; bottom: 12px; max-width: none; }
}

/* ── Parteneri de realocat ────────────────────────────────────────────────── */
.hr-numar {
    display: inline-block; margin-left: 6px; padding: 1px 9px; border-radius: 999px;
    background: var(--accent-color); color: #fff; font-size: .74rem; font-weight: 800;
}
.hr-unelte-realocare { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.hr-realoc td b { display: block; font-size: .84rem; }
.hr-realoc td small { display: block; font-size: .69rem; color: var(--text-muted); }
.hr-realoc tbody tr.e-modificat { background: color-mix(in srgb, #B8860B 10%, transparent); }
.hr-realoc .hr-actiuni-rand { white-space: nowrap; }
.hr-realoc .hr-actiuni-rand button { padding: 5px 9px; }
.hr-motiv { margin-top: 2px; font-style: italic; }

/* Triajul: „DECIZIE" iese în evidență fiindcă acolo harta nu poate hotărî singură. */
.hr-impact {
    font-size: .62rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
    padding: 2px 7px; border-radius: 999px; white-space: nowrap;
    background: color-mix(in srgb, var(--text-muted) 16%, transparent); color: var(--text-muted);
}
.hr-imp-decizie { background: var(--accent-color); color: #fff; }
.hr-imp-mare { background: color-mix(in srgb, var(--primary-color) 16%, transparent); color: var(--primary-color); }
.hr-imp-zero { opacity: .65; }

.hr-stare-nedecis { color: var(--text-muted); font-style: italic; font-size: .8rem; }
.hr-stare-aprobat { color: #1B7F4B; font-weight: 700; font-size: .8rem; }
.hr-stare-respins { color: var(--accent-color); font-weight: 700; font-size: .8rem; }

@media (max-width: 900px) {
    .hr-unelte-realocare { width: 100%; }
    .hr-unelte-realocare button { width: 100%; }
}

/* Tabelul pe județe */
.hr-tabel-judete { font-size: .82rem; }
.hr-tabel-judete tbody tr { cursor: pointer; }
.hr-tabel-judete tbody tr:hover { background: color-mix(in srgb, var(--primary-color) 5%, transparent); }
.hr-tabel-judete tbody tr.is-sel { background: color-mix(in srgb, var(--primary-color) 10%, transparent); }
.hr-tabel-judete tfoot td { border-top: 2px solid var(--border-color); font-weight: 700; }
.hr-tabel-judete .num { font-variant-numeric: tabular-nums; }

/* Avertismentul „cifrele nu urmează încă teritoriul nou" */
.hr-banner-atentie {
    background: color-mix(in srgb, #B8860B 10%, transparent);
    border-left-color: #B8860B;
}
.hr-banner-atentie i { color: #B8860B; }
.hr-link-realocare {
    border: 0; background: transparent; padding: 0 0 0 4px;
    color: var(--accent-color); font-weight: 700; font-size: .86rem;
    cursor: pointer; text-decoration: underline;
}

/* Editarea regionalului (creionul apare doar pentru admin/director comercial) */
.hr-edit-regional {
    border: 0; background: transparent; cursor: pointer;
    color: inherit; opacity: .35; padding: 2px 5px; font-size: .8rem;
}
.hr-edit-regional:hover { opacity: 1; color: var(--accent-color); }
.hr-reg-editor { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.hr-reg-editor input {
    font: inherit; font-size: .82rem; padding: 3px 6px;
    border: 1px solid var(--border-color); border-radius: 6px;
    background: var(--card-bg, #fff); color: inherit;
}
.hr-reg-editor input[type="text"] { width: 150px; }
.hr-reg-btn { border: 0; background: transparent; cursor: pointer; padding: 2px 5px; }
#hr-reg-salveaza { color: #1B7F4B; }
#hr-reg-renunta { color: var(--accent-color); }
