/* Paleta compartida con el formulario de presupuesto. */
.phc-banner,
.phc-dialog,
.phc-floating,
.phc-declaration {
    --phc-primary: #6c4f34;
    --phc-primary-dark: #4f3824;
    --phc-surface: #fffdf9;
    --phc-border: #d8d1c7;
    --phc-text: #29241f;
    --phc-muted: #5c544b;
}

.phc-banner[hidden],
.phc-floating[hidden] {
    display: none !important;
}

.phc-banner {
    position: fixed;
    right: 16px;
    bottom: 16px;
    left: 16px;
    z-index: 2147483000;
    max-width: 1080px;
    margin: 0 auto;
    border: 1px solid var(--phc-border);
    border-radius: 14px;
    background: var(--phc-surface);
    box-shadow: 0 16px 40px rgba(41, 36, 31, .18);
    color: var(--phc-text);
    font-size: 15px;
    line-height: 1.5;
}

.phc-banner[data-phc-preview]::before {
    position: absolute;
    top: -11px;
    left: 18px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #b32d2e;
    color: #fff;
    content: attr(data-phc-preview);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.phc-banner__inner {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 18px 22px;
}

.phc-banner__text {
    flex: 1 1 auto;
}

.phc-banner__text p {
    margin: 0;
}

.phc-banner__title {
    margin-bottom: 4px !important;
    font-size: 16px;
    font-weight: 700;
}

.phc-banner a,
.phc-dialog a {
    color: var(--phc-primary);
    text-decoration: underline;
}

.phc-banner__actions,
.phc-dialog__actions {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

:is(.phc-banner, .phc-dialog) .phc-button {
    min-width: 120px;
    min-height: 44px;
    padding: 10px 20px;
    border: 2px solid var(--phc-primary);
    border-radius: 8px;
    background: var(--phc-primary);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    line-height: 1.2;
}

:is(.phc-banner, .phc-dialog) .phc-button:hover,
:is(.phc-banner, .phc-dialog) .phc-button:focus-visible {
    border-color: var(--phc-primary-dark);
    background: var(--phc-primary-dark);
}

:is(.phc-banner, .phc-dialog) .phc-button:focus-visible,
button.phc-link-button:focus-visible,
button.phc-floating:focus-visible,
.phc-dialog .phc-dialog__close:focus-visible {
    outline: 3px solid #2271b1;
    outline-offset: 2px;
}

:is(.phc-banner, .phc-dialog) .phc-button--secondary {
    background: transparent;
    color: var(--phc-primary);
}

:is(.phc-banner, .phc-dialog) .phc-button--secondary:hover,
:is(.phc-banner, .phc-dialog) .phc-button--secondary:focus-visible {
    background: #f3ece4;
    color: var(--phc-primary-dark);
}

:is(.phc-banner, .phc-dialog) .phc-button--link {
    min-width: 0;
    padding: 10px 6px;
    border-color: transparent;
    background: transparent;
    color: var(--phc-primary);
    text-decoration: underline;
}

:is(.phc-banner, .phc-dialog) .phc-button--link:hover,
:is(.phc-banner, .phc-dialog) .phc-button--link:focus-visible {
    border-color: transparent;
    background: transparent;
    color: var(--phc-primary-dark);
}

button.phc-link-button {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    cursor: pointer;
    font: inherit;
    text-decoration: underline;
}

.phc-dialog {
    width: min(720px, calc(100vw - 32px));
    max-height: min(86vh, 860px);
    padding: 0;
    border: 1px solid var(--phc-border);
    border-radius: 14px;
    background: var(--phc-surface);
    color: var(--phc-text);
    font-size: 15px;
    line-height: 1.5;
}

.phc-dialog::backdrop {
    background: rgba(41, 36, 31, .45);
}

.phc-dialog__form {
    display: flex;
    flex-direction: column;
    max-height: inherit;
    margin: 0;
}

.phc-dialog__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--phc-border);
}

.phc-dialog__header h2 {
    margin: 0;
    color: var(--phc-text);
    font-size: 20px;
}

.phc-dialog .phc-dialog__close {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--phc-text);
    cursor: pointer;
    font-size: 26px;
    line-height: 1;
}

.phc-dialog .phc-dialog__close:hover {
    background: #f3ece4;
}

.phc-dialog__body {
    overflow-y: auto;
    padding: 6px 22px 12px;
}

.phc-dialog__actions {
    justify-content: flex-end;
    padding: 14px 22px;
    border-top: 1px solid var(--phc-border);
}

.phc-category {
    padding: 14px 0;
    border-bottom: 1px solid #ece6df;
}

.phc-category:last-child {
    border-bottom: 0;
}

.phc-category p {
    margin: 6px 0;
    color: var(--phc-muted);
}

.phc-category summary {
    color: var(--phc-primary);
    cursor: pointer;
    font-weight: 600;
}

.phc-switch {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.phc-category__label {
    flex: 1 1 auto;
    font-size: 16px;
    font-weight: 700;
}

.phc-switch input {
    position: absolute;
    right: 0;
    width: 46px;
    height: 26px;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.phc-switch__track {
    position: relative;
    flex: 0 0 auto;
    width: 46px;
    height: 26px;
    border-radius: 999px;
    background: #b9b0a5;
    transition: background-color .15s ease;
}

.phc-switch__track::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
    content: "";
    transition: transform .15s ease;
}

.phc-switch input:checked + .phc-switch__track {
    background: var(--phc-primary);
}

.phc-switch input:checked + .phc-switch__track::after {
    transform: translateX(20px);
}

.phc-switch input:disabled + .phc-switch__track {
    opacity: .6;
}

.phc-switch input:focus-visible + .phc-switch__track {
    outline: 3px solid #2271b1;
    outline-offset: 2px;
}

.phc-switch__state {
    color: var(--phc-muted);
    font-size: 13px;
}

.phc-table-wrap {
    overflow-x: auto;
    margin: 10px 0 4px;
}

.phc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.phc-table th,
.phc-table td {
    padding: 8px 10px;
    border: 1px solid var(--phc-border);
    text-align: left;
    vertical-align: top;
}

.phc-table th {
    background: #f3ece4;
    color: var(--phc-text);
}

.phc-table code {
    white-space: nowrap;
}

button.phc-floating {
    position: fixed;
    bottom: 16px;
    left: 16px;
    z-index: 2147482000;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--phc-primary);
    box-shadow: 0 6px 18px rgba(41, 36, 31, .25);
    color: #fff;
    cursor: pointer;
}

button.phc-floating:hover {
    background: var(--phc-primary-dark);
}

@media (max-width: 760px) {
    .phc-banner {
        right: 8px;
        bottom: 8px;
        left: 8px;
        font-size: 14px;
    }

    .phc-banner__inner {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        padding: 16px;
    }

    .phc-banner__actions,
    .phc-dialog__actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .phc-banner__actions .phc-button.phc-button--link {
        grid-column: 1 / -1;
        order: 3;
    }

    .phc-dialog__actions .phc-button.phc-button--secondary {
        grid-column: 1 / -1;
        order: 3;
    }

    :is(.phc-banner, .phc-dialog) .phc-button {
        min-width: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .phc-switch__track,
    .phc-switch__track::after {
        transition: none;
    }
}
