

.wp-pres-calculadora {
    --bg: #f6f5f0;
    --card: #ffffff;
    --ink: #162025;
    --muted: #5b6770;
    /* --accent: #0c7a64; */
    /* --accent: #119EC1; // blue */ 
    --accent: #6a8366;
    --accent-soft: #c3d7c0;
    /* --accent-soft: #d9f1ea; */
    --border: #d9dfdc;
    --border-radius: 5px;
    /* max-width: 1100px; */
    max-width: 100%;
    margin: 24px auto;
    background: radial-gradient(circle at 10% 10%, #ffffff 0%, var(--bg) 65%);
    border: 1px solid var(--border);
    /* border-radius: 16px; */
    border-radius: var(--border-radius);
    padding: 20px;
    color: var(--ink);
    font-family: "Avenir Next", "Segoe UI", sans-serif;
    line-height: 1.4;
}

.wp-pres-version-tag {
    display: inline-block;
    margin-bottom: 10px;
    background: #e9f4ff;
    color: #245f8f;
    border: 1px solid #bdd9ee;
    border-radius: 999px;
    border-radius: var(--border-radius);
    padding: 4px 10px;
    font-size: 12px;
}

/* ── Controls de cuestionaris (tipo 4) ── */
.wp-pres-cuestionarios-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

.wp-pres-cuestionarios-select {
    display: block;
    font-size: 12px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 2px 4px;
    background: #fff;
    color: var(--muted);
    cursor: pointer;
    max-width: 160px;
}

.wp-pres-cuestionarios-select:focus {
    outline: none;
    border-color: var(--accent);
}

.wp-pres-cuestionarios-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.wp-pres-cuestionarios-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
    min-width: 72px;
}

.wp-pres-cuestionarios-input {
    width: 64px;
    height: 26px;
    padding: 2px 6px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    font-size: 12px;
    text-align: center;
    background: #f0f0f0;
    color: var(--muted);
    cursor: not-allowed;
}

.wp-pres-cuestionarios-input.unlocked,
.wp-pres-cuestionarios-input:not(:disabled) {
    background: #fff;
    border-color: var(--accent);
    color: var(--ink);
    cursor: text;
}

.wp-pres-cuestionarios-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(17, 158, 193, 0.12);
}

.wp-pres-cualificacion-select {
    max-width: 120px;
}

/* ── Controls de dies (tipo 5) ── */
.wp-pres-dies-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

.wp-pres-dies-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.wp-pres-dies-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
    min-width: 72px;
}

.wp-pres-dies-select {
    display: block;
    font-size: 12px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 2px 4px;
    background: #fff;
    color: var(--muted);
    cursor: pointer;
    max-width: 120px;
}

.wp-pres-dies-select:focus {
    outline: none;
    border-color: var(--accent);
}

.wp-pres-dies-input {
    width: 64px;
    height: 26px;
    padding: 2px 6px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    font-size: 12px;
    text-align: center;
    background: #f0f0f0;
    color: var(--muted);
    cursor: not-allowed;
}

.wp-pres-dies-input.unlocked,
.wp-pres-dies-input:not(:disabled) {
    background: #fff;
    border-color: var(--accent);
    color: var(--ink);
    cursor: text;
}

.wp-pres-dies-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(17, 158, 193, 0.12);
}

/* ── Input de número de personas (tipo 3) ── */
.wp-pres-num-personas-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    /* margin-top: 8px; */
    padding: 0px 8px;
    /* background: var(--accent-soft); */
    border-radius: var(--border-radius);
    float: right;
}

.wp-pres-num-personas-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
}

.wp-pres-num-personas-input {
    width: 30px;
    height: 30px;
    padding: 0px 8px;
    border: 1px solid var(--accent);
    border-radius: var(--border-radius);
    font-size: 13px;
    text-align: center;
}

.wp-pres-num-personas-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(12, 122, 100, 0.1);
}

.wp-pres-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 16px;
    align-items: end;
    align-items: center;
}

.wp-pres-title {
    margin: 0;
    font-size: 28px;
    letter-spacing: 0.2px;
}

.wp-pres-selectors {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 12px;
    width: 100%;
}

.wp-pres-selectors label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
}

.wp-pres-selectors select,
.wp-pres-selectors button,
.factor-grid input {
    height: 40px;
    border: 1px solid var(--border);
    /* border-radius: 10px; */
    border-radius: var(--border-radius);
    padding: 0 10px;
    background: #fff;
}

.wp-pres-selectors button {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    cursor: pointer;
    font-weight: 600;
}

.wp-pres-body {
    display: grid;
    gap: 16px;
    margin-top: 16px;
}

.wp-pres-progress-wrap {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 12px;
    display: grid;
    gap: 10px;
}

.wp-pres-progress-row {
    display: grid;
    grid-template-columns: 110px 1fr 48px;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 13px;
}

.wp-pres-progress {
    height: 12px;
    border-radius: var(--border-radius);
    background: #e8eeeb;
    overflow: hidden;
}

.wp-pres-progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #26a285 0%, #0c7a64 100%);
    transition: width 260ms ease;
}

.wp-pres-phases {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 14px;
}

.wp-pres-phases h3 {
    margin: 0 0 10px;
    font-size: 16px;
}

.wp-pres-phase-tabs>.scroll {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.phase-tab {
    border: 1px solid #c8d5cf;
    background: #f6faf8;
    color: #274038;
    height: 34px;
    /* border-radius: 999px; */
    border-radius: var(--border-radius);
    padding: 0 14px;
    font-size: 13px;
    cursor: pointer;
}
.phase-tab:hover {
    border-color: var(--accent);
}

.phase-tab.active {
    /* background: #0c7a64; */
    background: var(--accent);
    color: #fff;
    /* border-color: #0c7a64; */
    border-color: var(--accent)
}

.wp-pres-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 12px;
}

.summary-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 14px;
}

.summary-card-accent {
    background: linear-gradient(180deg, #f3fffb 0%, var(--accent-soft) 100%);
    border-color: #a5d9cc;
}

.summary-label {
    color: var(--muted);
    font-size: 13px;
}

.summary-value {
    margin-top: 6px;
    font-size: 24px;
    font-weight: 700;
}

.wp-pres-factors {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 14px;
}

.wp-pres-factors-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    position: relative;
}

.wp-pres-factors-toggle-btn {
    position: absolute;
    top: 0;
    right: 0;
    width: 26px;
    height: 26px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: #fff;
    color: var(--accent);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 400;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    padding: 0;
}

.wp-pres-factors-toggle-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.wp-pres-factors-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    font-size: 12px;
    color: var(--muted);
}

.wp-pres-factors-summary span {
    white-space: nowrap;
}

.wp-pres-factors-body {
    margin-top: 12px;
}

.wp-pres-factors h3 {
    margin: 0;
    font-size: 16px;
    display: block;
    width: 100%;
}

.wp-pres-factors h4 {
    margin: 0 0 10px;
    font-size: 15px;

}

.factor-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.wp-pres-perfiles-cost-override .factor-grid{
    margin-bottom: 0px;
}

.factor-grid label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--ink);
    font-weight: normal;
}

.wp-pres-table-wrap {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 14px;
}

.wp-pres-table-wrap h3 {
    margin: 0 0 10px;
    font-size: 16px;
}

.wp-pres-table {
    width: 100%;
    border-collapse: collapse;
}

.wp-pres-table th,
.wp-pres-table td {
    text-align: left;
    border-bottom: 1px solid var(--border);
    padding: 8px 6px;
    font-size: 14px;
    white-space: nowrap;
}
.wp-pres-table th{
    border-bottom: 1px solid var(--ink);
}

.wp-pres-table th:last-child,
.wp-pres-table td:last-child {
    text-align: right;
    width:80px;
}

.wp-pres-table th:nth-child(n+2):nth-child(-n+9),
.wp-pres-table td:nth-child(n+2):nth-child(-n+9) {
    text-align: right;
    font-size: 13px;
    color: var(--wp--preset--color--contrast);
    font-weight: normal;
}

.cell-level {
    color: #73818a;
    font-size: 12px;
    max-width: 280px;
}

.task-indent {
    display: inline-block;
}

.indent-0 { width: 0; }
.indent-1 { width: 10px; }
.indent-2 { width: 20px; }
.indent-3 { width: 30px; }
.indent-4 { width: 40px; }
.indent-5 { width: 50px; }

.status {
    border-radius: var(--border-radius);
    padding: 3px 8px;
    font-size: 12px;
    display: inline-block;
}

.status.ok {
    background: #dff4ea;
    color: #1a7b56;
}

.status.pending {
    background: #f7ece1;
    color: #9a5b26;
}

.row-pending td {
    /* background: #fffdfa; */
}

.wp-pres-phase-subtotal {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    font-size: 14px;
}

.wp-pres-empty {
    text-align: center;
    color: var(--muted);
}

.wp-pres-table th.label-task,
.wp-pres-table td.info-task{
    display: none;
}

.wp-pres-input-amount{
    text-align: right;
    max-width: 60px;
    border: 1px solid var(--border);
    padding: 4px;
}

.wp-pres-tipo-lectura {
    display: block;
    margin-top: 0px;
    margin-left: 4px;
    font-size: 12px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 8px 4px;
    background: #fff;
    color: var(--muted);
    cursor: pointer;
    max-width: 120px;
}
.wp-pres-tipo-lectura:focus {
    outline: none;
    border-color: var(--accent);
}
.wp-pres-currency{
    margin-left: 4px;
}

.wp-pres-help {
    /* float: right; */
    background-color: var(--accent);
    color: white;
    /* color: var(--wp--preset--color--base); */
    height: 24px;
    width: 24px;
    text-align: center;
    font-weight: 500;
    border-radius: 50%;
    line-height: 14px;
    font-size: 15px;
    padding-right: 6px;
    cursor: pointer;
    display: inline-block;
    transform: scale(0.7);
    margin-left: 4px;
}

.row-group .wp-pres-help{
    background-color: var(--muted);
    float: none;
    margin-left: 6px;
    display: inline-block;
    transform: scale(0.9);
}

td.cell-level{
    color: var(--ink);
    font-weight: 400;
    font-size: 15px;
    white-space: normal;
    text-align: left;
}

.level_2 td.cell-level {
    font-weight: bold;
    font-size: 20px;
    text-align: left;
}

.level_3 td.cell-level {
    font-weight: 600;
    font-size: 18px;
    text-align: left;
}

.wp-pres-table tr.level_2 td {
    /* border-bottom-width: 4px; */
    border-bottom-width: 1px;
    border-bottom-color: var(--accent);
    /* border-bottom-color: black; */
}
.wp-pres-table tr.level_3 td {
    border-bottom-width: 1px;
}

#wp-pres-task-rows span.value {
    min-width: 30px;
    width: fit-content;
    display: inline-block;
    text-align: right;
    padding: 4px;
    background-color: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    cursor: pointer;
}
#wp-pres-task-rows span.value:hover {
    border: 1px solid var(--accent);
}
#wp-pres-task-rows span.value.selected {
    background-color: var(--accent);
    color: #fff;
    border-color: var(--accent);
    font-weight: 600;
}

.wp-pres-body .cols_2{
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 12px;
}


:where(.wp-site-blocks :focus){
    outline-style: solid;
    outline-width: 2px;
    outline-color: var(--accent);
}

.wp-pres-actions {
    font-size: 18px;
    font-weight: normal;
}

.wp-pres-download{
    filter: invert(1);
}


@media (max-width: 900px) {
    .wp-pres-selectors {
        grid-template-columns: 1fr;
    }

    .wp-pres-summary {
        grid-template-columns: 1fr;
    }

    .factor-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Custom tooltip for help icons */
.wp-pres-tooltip {
    position: absolute;
    z-index: 9999;
    background: rgba(0,0,0,0.85);
    color: #fff;
    padding: 10px 10px;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-size: 500;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity .12s ease, transform .12s ease;
    opacity: 0;
    white-space: pre-wrap;
    max-width: 340px;
}
.wp-pres-tooltip.show { opacity: 1; transform: translateY(0); }

.wp-pres-help:focus { outline: none; box-shadow: 0 0 0 3px rgba(12,122,100,0.15); }

/* ── Template Selector (Dropdown personalitzat) ── */
.wp-pres-template-selector {
    position: relative;
    width: 100%;
}

.wp-pres-template-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    background: #fff;
    cursor: pointer;
    font-size: 12px;
    color: var(--muted);
    transition: all 0.2s ease;
}

.wp-pres-template-btn:hover {
    border-color: var(--accent);
    background: #f9f9f9;
}

.wp-pres-template-icon {
    font-size: 10px;
    margin-left: 6px;
    display: inline-block;
    transition: transform 0.2s ease;
}

.wp-pres-template-btn:hover .wp-pres-template-icon {
    color: var(--accent);
}

.wp-pres-template-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 2px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
}

.wp-pres-template-option {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 12px;
}

.wp-pres-template-option:last-child {
    border-bottom: none;
}

.wp-pres-template-option:hover {
    background-color: #f5f5f5;
}

.wp-pres-template-option.selected {
    background-color: #e8f5e9;
    color: var(--accent);
    font-weight: 600;
}

.wp-pres-option-label {
    white-space: normal;
    word-break: break-word;
    line-height: 1.4;
}

/* ── Perfiles Column ── */
.wp-pres-perfiles-wrap {
    display: flex;
    gap: 6px;
}

.wp-pres-perfil-box {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    background: #f9f9f9;
    font-size: 12px;
    text-align: center;
}

.wp-pres-perfil-label {
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 3px;
    font-size: 10px;
}

.wp-pres-perfil-value {
    font-weight: 700;
    color: var(--accent);
    font-size: 13px;
}

.wp-pres-template-btn.has-selection {
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 700;
}

/* ── Perfiles editable (Personalizado) ── */
.wp-pres-perfil-box.editable {
    border-color: var(--accent);
    background: #fff;
    cursor: default;
}

.wp-pres-perfil-box:not(.editable) {
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.wp-pres-perfil-box:not(.editable):hover {
    border-color: var(--accent);
    background: #f0f9f0;
}

.wp-pres-perfil-input-wrap {
    display: flex;
    align-items: center;
    gap: 3px;
}

.wp-pres-perfil-input {
    width: 100%;
    min-width: 0;
    border: none;
    border-bottom: 1px solid var(--accent);
    background: transparent;
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    text-align: center;
    padding: 2px 0;
    outline: none;
    max-width: 50px;
}

.wp-pres-perfil-input::-webkit-outer-spin-button,
.wp-pres-perfil-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.wp-pres-perfil-unitat {
    font-size: 10px;
    color: var(--muted);
    white-space: nowrap;
}

/* ── Cost calculat destacat ── */
.cell-cost.cost-calculated {
    font-weight: 700!important;
    color: var(--accent)!important;
}

/* ── Cost omplert (no obligatori) ── */
.cell-cost.cost-filled {
    font-weight: 700!important;
    color: var(--accent)!important;
}

/* ── Cost obligatori sense dades ── */
.cell-cost.cost-required {
    font-weight: 700!important;
    color: #c0392b!important;
}

/* ── Caixa Pàgines (más amplia) ── */
.wp-pres-perfil-box.perfil-box-pagines {
    min-width: 52px;
}

/* ── Botó Añadir (grups multiple) ── */
.wp-pres-btn-add-agrupador {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 12px;
    padding: 4px 12px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--border-radius);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    vertical-align: middle;
}

.wp-pres-btn-add-agrupador:hover {
    /* background: #0a6855; */
    background: var(--accent);
    transform: scale(1.03);
}

.wp-pres-btn-add-agrupador:active {
    transform: scale(0.97);
}

.row-agrupador-virtual {
    background-color: #f9f9f9;
}

/* ── Modal overlay ── */
.wp-pres-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.wp-pres-modal {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
    animation: wp-pres-modal-in 0.18s ease;
}

@keyframes wp-pres-modal-in {
    from { opacity: 0; transform: scale(0.94) translateY(-8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.wp-pres-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border);
}

.wp-pres-modal-title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--ink);
}

.wp-pres-modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--muted);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--border-radius);
    line-height: 1;
    transition: color 0.15s, background 0.15s;
}

.wp-pres-modal-close:hover {
    color: var(--ink);
    background: #f0f0f0;
}

.wp-pres-modal-body {
    padding: 20px;
}

.wp-pres-modal-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 8px;
}

.wp-pres-modal-input {
    width: 100%;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 0 12px;
    font-size: 15px;
    color: var(--ink);
    background: #fff;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.wp-pres-modal-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(12, 122, 100, 0.1);
}

.wp-pres-modal-error {
    margin: 10px 0 0;
    font-size: 12px;
    color: #c0392b;
}

.wp-pres-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px 18px;
    border-top: 1px solid var(--border);
}

.wp-pres-modal-btn-cancel {
    height: 38px;
    padding: 0 18px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    background: #fff;
    color: var(--muted);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.wp-pres-modal-btn-cancel:hover:not(:disabled) {
    background: #f5f5f5;
    color: var(--ink);
}

.wp-pres-modal-btn-confirm {
    height: 38px;
    padding: 0 20px;
    border: none;
    border-radius: var(--border-radius);
    background: var(--accent);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}

.wp-pres-modal-btn-confirm:hover:not(:disabled) {
    background: #0a6855;
}

.wp-pres-modal-btn-confirm:disabled,
.wp-pres-modal-btn-cancel:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Sub-grup agrupador ── */
.row-agrupador td.cell-level {
    font-style: italic;
    color: var(--accent);
    font-size: 18px;
    padding-left: 20px;
    text-align: left;
    font-weight: 600;
}

/* ── Accions d'agrupador (Duplicar / Eliminar) ── */
.wp-pres-agrupador-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 12px;
    vertical-align: middle;
    float: right;
}

.wp-pres-btn-agrupador {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 10px;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
    line-height: 1.4;
}

.wp-pres-btn-agrupador:active {
    transform: scale(0.96);
}

.wp-pres-btn-duplicate {
    background: #eaf4ff;
    color: #245f8f;
    border-color: #bdd9ee;
}

.wp-pres-btn-duplicate:hover {
    background: #d0e8f8;
    border-color: #245f8f;
}

.wp-pres-btn-delete {
    background: #fff0f0;
    color: #c0392b;
    border-color: #f5c6c2;
}

.wp-pres-btn-delete:hover {
    background: #fde0de;
    border-color: #c0392b;
}


/* ── Vista Costes / Resumen de Importes ── */

.wp-pres-costes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.wp-pres-costes-header h3 {
    margin: 0;
}

.wp-pres-costes-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.wp-pres-btn-costes-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border-radius: 5px;
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.wp-pres-btn-costes-csv {
    background: var(--accent, #1a6e56);
    color: #fff;
    border-color: var(--accent, #1a6e56);
}

.wp-pres-btn-costes-csv:hover {
    background: #145c47;
    border-color: #145c47;
}

.wp-pres-btn-costes-print {
    background: #fff;
    color: #444;
    border-color: #ccc;
}

.wp-pres-btn-costes-print:hover {
    background: #f0f0f0;
    border-color: #aaa;
}

@media screen and (max-width: 480px) {
    .wp-pres-costes-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

.wp-pres-costes-table .col-horas {
    text-align: right;
    width: 90px;
    font-size: 13px;
    color: var(--muted);
}

.wp-pres-costes-table .col-cost {
    text-align: right;
    width: 110px;
    font-weight: 600;
}

.costes-row-fase {
    cursor: pointer;
    background: var(--accent-soft);
    font-weight: 700;
    font-size: 15px;
}

.costes-row-fase:hover {
    background: #c4e8de;
}

.costes-row-fase td {
    padding: 10px 8px;
    /* border-bottom: 2px solid var(--accent); */
    border-bottom: 1px solid var(--border);
    background-color: #f6f9f8;
}

.costes-row-group {
    cursor: pointer;
    background: #f6f9f8;
    font-weight: 600;
}

.costes-row-group:hover {
    background: #edf5f2;
}

.costes-row-group td {
    padding: 8px 8px;
    border-bottom: 1px solid var(--border);
}

.costes-row-task td {
    padding: 6px 8px;
    font-size: 13px;
    color: var(--muted);
    border-bottom: 1px solid #f0f0f0;
}

.wp-pres-costes-table tr.highlight td:not(.costes-cell-title) {
    font-weight: 600!important;
}

.costes-cell-title {
    white-space: normal;
    word-break: break-word;
}

.costes-toggle-icon {
    display: inline-block;
    width: 16px;
    font-size: 10px;
    color: var(--muted);
    margin-right: 4px;
}

.phase-tab-costes {
    border-color: var(--accent);
    /* color: var(--accent);
    font-weight: 600; */
}

.phase-tab-costes.active {
    background: var(--accent);
    color: #fff;
}

td.cell-tipo{
    vertical-align: middle;
}
.tipo-title {
    padding: 8px 0px;
    display: inline-block;
}

.wp-pres-tipo-lectura{
    float: left;
}

@media screen and (max-width:768px){
    .wp-pres-table-wrap{
        overflow: scroll;
    }
    .wp-pres-factors-body .factor-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(160px, 1fr));
    }

    /* .wp-pres-phases{
        width: 100%;
        position: relative;
        max-width: 100%;
        box-sizing: border-box;
    }
    .wp-pres-phase-tabs{
        overflow-x: scroll;
        max-width: 100%;
        width: 100%;
        flex-wrap: nowrap;
    } */
    .wp-pres-phases{
      max-width: 100%;
      overflow: hidden;
    }
     .wp-pres-phase-tabs{
        overflow-x: scroll;
        max-width: 100%;
        position: relative;
        box-sizing: border-box;
     }
     .wp-pres-phase-tabs>.scroll {
        display: flex;
        gap: 8px;
        /* flex-wrap: wrap; */
        width: fit-content;
        flex-wrap: nowrap;
        height: 50px;
        padding-top: 2px;
    }

    .wp-pres-table {
        width: 100%;
        /* border-collapse: collapse; */
        display: flex;
    }
    .wp-pres-table thead {
        display: none;
    }
    .wp-pres-table tbody {
        display: flex;
        flex-direction: column;
        width: 100%;
    }
    .wp-pres-table tr.row-group,
    .wp-pres-table tr.row-pending {
        display: flex;
        width: 100%;
        /* flex-direction: column; */
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
    }
    .wp-pres-table tr.row-group td,
    .wp-pres-table tr.row-pending td {
        display: flex;
        /* width: 100%; */
        /* max-width: 100%; */
        /* flex-direction: column; */
        width: 50%;
        max-width: 50%;
        /* flex-direction: column; */
        box-sizing: border-box;
    }
    td.cell-level,
    .level_2 td.cell-tipo {
        font-size: 12px;
        width: 100%;
        min-width: 100%;
    }
    .level_2 td.cell-level{
        font-weight: bold;
        font-size: 16px;
    }
    .level_3 td.cell-level{
        font-size: 14px;
    }
    .wp-pres-table td.cell-cost{
        justify-content: flex-end;
        width: 100%;
        min-width: 100%;
    }
    .wp-pres-table td.cell-coste-fijo{
        justify-content: flex-end;
        align-items: center;
    }
    .wp-pres-perfil-box.perfil-box-pagines {
        min-width: 35px;
        padding: 4px;
    }
    .wp-pres-selectors select, .wp-pres-selectors button, .factor-grid input {
        height: 30px;
        border: 1px solid var(--border);
        /* border-radius: 10px; */
        border-radius: var(--border-radius);
        padding: 0 6px;
        background: #fff;
    }
    .wp-pres-factors .factor-grid label {
        font-weight: normal;
    }
    .wp-pres-factors-toggle-btn {
        width: 20px;
        height: 20px;
    }
    .wp-pres-table tr.row-group td.cell-level {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
        position: relative;
        justify-content: space-between;
    }
    .wp-pres-btn-add-agrupador{
        float: right;
        min-width: 74px;
        height: fit-content;
    }
    span.cell-level-title {
        width: calc(100% - 45px);
    }
    .wp-pres-help{
        height: 22px;
        width: 22px;
        line-height: 12px;
        font-size: 12px;
    }
    .wp-pres-btn-agrupador{
        padding: 2px 5px;
        white-space: nowrap;
    }
    .row-agrupador td.cell-level{
        padding-left: 12px;
    }
    .wp-pres-btn-agrupador>.txt{
        display: none;
    }
    /* tr.row-group.level_2 span.cell-level-title {
        width: fit-content;
    } */
}

@media screen and (max-width:640px){
    /* .factor-grid {
        display: grid;
        grid-template-columns: repeat(1, minmax(160px, 1fr));
    } */
    .wp-pres-body .cols_2{
        grid-template-columns: repeat(1, minmax(220px, 1fr));
    }
}