/* PietroCal 10Q02.7.1 — selección global con checkboxes tradicionales integrados. */
:root {
    --pc-selection-accent: #e7852f;
    --pc-selection-accent-dark: #9a3412;
    --pc-selection-soft: #fff7ed;
    --pc-selection-soft-strong: #ffedd5;
    --pc-selection-line: #fdba74;
    --pc-selection-ring: rgba(249, 115, 22, .14);
    --pc-selection-shadow: 0 8px 20px rgba(194, 65, 12, .08);
}

/* Pestañas, filtros, botones presionados y tarjetas activas comparten el acento. */
:is(
    .contacts-tab.is-active,
    .contacts-filter-chip.is-active,
    .bookings-portfolio-filters button.is-active,
    .bookings-status-filters button.is-active,
    .calendar-management-tab.is-active,
    .calendar-context-switch.is-active,
    .calendar-invitations-tab.is-active,
    .pietro-event-kind-switch button.is-active,
    .pietro-toggle-completed-tasks.is-active,
    .pietro-toggle-completed-tasks[aria-pressed="true"],
    .pietro-toggle-completed-tasks--icon.is-active,
    .pietro-toggle-completed-tasks--icon[aria-pressed="true"],
    .pc-plan-tab.active,
    .admin-crud-menu-item.active,
    .btn-light.active,
    .personal-no-dates-toggle-button.is-active,
    .personal-no-dates-toggle-button[aria-pressed="true"]
) {
    border-color: var(--pc-selection-line) !important;
    background: var(--pc-selection-soft) !important;
    color: var(--pc-selection-accent-dark) !important;
    box-shadow: inset 0 0 0 1px rgba(249, 115, 22, .04), var(--pc-selection-shadow) !important;
}

:is(
    .contacts-tab.is-active,
    .contacts-filter-chip.is-active,
    .bookings-portfolio-filters button.is-active,
    .bookings-status-filters button.is-active,
    .calendar-management-tab.is-active,
    .calendar-context-switch.is-active,
    .calendar-invitations-tab.is-active,
    .pietro-event-kind-switch button.is-active,
    .pietro-toggle-completed-tasks.is-active,
    .pietro-toggle-completed-tasks[aria-pressed="true"],
    .pietro-toggle-completed-tasks--icon.is-active,
    .pietro-toggle-completed-tasks--icon[aria-pressed="true"],
    .pc-plan-tab.active,
    .admin-crud-menu-item.active,
    .btn-light.active,
    .personal-no-dates-toggle-button.is-active,
    .personal-no-dates-toggle-button[aria-pressed="true"]
):hover {
    border-color: var(--pc-selection-accent) !important;
    background: var(--pc-selection-soft-strong) !important;
    color: var(--pc-selection-accent-dark) !important;
}

:is(
    .calendar-management-item.is-active,
    .contacts-followup-metric.is-active,
    .bookings-portfolio-stat.is-active,
    .pc-onboarding-step.is-active
) {
    border-color: var(--pc-selection-line) !important;
    background: linear-gradient(180deg, var(--pc-selection-soft) 0%, #fff 100%) !important;
    color: inherit !important;
    box-shadow: var(--pc-selection-shadow) !important;
}

.calendar-management-item.is-active {
    border-left-color: var(--pc-selection-accent) !important;
}

/*
 * Booleanos reales: el input permanece en el DOM y el label dibuja un checkbox
 * tradicional PietroCal. No se convierte el label completo en card o botón.
 */
label.pc-selection-checkbox {
    position: relative !important;
    display: grid !important;
    grid-template-columns: 17px minmax(0, 1fr) !important;
    grid-template-rows: auto !important;
    grid-auto-rows: auto !important;
    grid-auto-flow: row !important;
    column-gap: 7px !important;
    row-gap: 0 !important;
    width: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 3px 0 !important;
    align-items: center !important;
    align-content: center !important;
    justify-content: stretch !important;
    border: 0 !important;
    border-radius: 7px !important;
    background: transparent !important;
    color: #334155 !important;
    box-shadow: none !important;
    font-size: 11.5px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    text-align: left !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    cursor: pointer !important;
    transform: none !important;
}

label.pc-selection-checkbox::before {
    content: '' !important;
    display: block !important;
    grid-column: 1 !important;
    grid-row: 1 !important;
    align-self: center !important;
    width: 17px !important;
    height: 17px !important;
    min-width: 17px !important;
    min-height: 17px !important;
    margin: 0 !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 5px !important;
    background-color: #fff !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-size: 11px 11px !important;
    box-shadow: inset 0 1px 1px rgba(15, 23, 42, .03) !important;
    box-sizing: border-box !important;
    transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease !important;
}

label.pc-selection-checkbox > input[type="checkbox"]:not([hidden]) {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-width: 1px !important;
    min-height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    opacity: .001 !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}

label.pc-selection-checkbox > input[type="checkbox"]::before,
label.pc-selection-checkbox > input[type="checkbox"]::after {
    content: none !important;
    display: none !important;
}

label.pc-selection-checkbox > :not(input[type="checkbox"]) {
    grid-column: 2 !important;
    min-width: 0 !important;
}

label.pc-selection-checkbox:hover:not(:has(input:disabled)) {
    background: #fffaf5 !important;
}

label.pc-selection-checkbox:hover:not(:has(input:disabled))::before {
    border-color: #fdba74 !important;
}

label.pc-selection-checkbox:has(input[type="checkbox"]:checked)::before {
    border-color: var(--pc-selection-accent) !important;
    background-color: var(--pc-selection-accent) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.2 6.2 4.8 8.7 9.9 3.4' fill='none' stroke='white' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
}

label.pc-selection-checkbox:has(input[type="checkbox"]:indeterminate)::before {
    border-color: var(--pc-selection-accent) !important;
    background-color: var(--pc-selection-accent) !important;
    background-image: linear-gradient(#fff, #fff) !important;
    background-size: 8px 2px !important;
}

label.pc-selection-checkbox:has(input[type="checkbox"]:focus-visible) {
    outline: 0 !important;
    box-shadow: none !important;
}

label.pc-selection-checkbox:has(input[type="checkbox"]:focus-visible)::before {
    border-color: var(--pc-selection-accent) !important;
    box-shadow: 0 0 0 3px var(--pc-selection-ring) !important;
}

label.pc-selection-checkbox:has(input[type="checkbox"]:disabled) {
    opacity: .56 !important;
    cursor: not-allowed !important;
}

label.pc-selection-checkbox:has(input[type="checkbox"]:disabled)::before {
    border-color: #dbe2ea !important;
    background-color: #f1f5f9 !important;
}

/* Los interruptores previos se reemplazan por el checkbox tradicional. */
.pietro-event-toggle-visual,
.calendar-switch,
.calendar-switch-knob {
    display: none !important;
}

.pietro-event-toggle.pc-selection-checkbox,
.pietro-event-toggle-compact.pc-selection-checkbox,
.pc-oauth-active.pc-selection-checkbox,
.pc-api-check.pc-selection-checkbox,
.admin-clients-check.pc-selection-checkbox,
.bookings-sync-check.pc-selection-checkbox,
.pc-public-consent.pc-selection-checkbox,
.pietro-event-attendees-mail-option.pc-selection-checkbox,
.calendar-management-share-delete-calendar.pc-selection-checkbox {
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Calendarios > Avanzado y permisos densos: filas compactas, sin cards. */
.calendar-management-options-advanced {
    column-gap: 14px !important;
    row-gap: 0 !important;
}

.pc-oauth-scope-group,
.pc-webhook-event-group {
    row-gap: 0 !important;
}

.pc-oauth-scope-group label.pc-selection-checkbox,
.pc-webhook-event-group label.pc-selection-checkbox {
    padding-block: 3px !important;
}

/*
 * Chips y tarjetas que ya tienen un lenguaje propio conservan su estructura.
 * Sólo se oculta el input técnico y se aplica el acento al estado seleccionado.
 */
label.pc-selection-choice {
    position: relative;
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease, color .16s ease, box-shadow .16s ease;
}

label.pc-selection-choice > input[type="checkbox"]:not([hidden]) {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-width: 1px !important;
    min-height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: .001 !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}

:is(
    #contextAvailability .availability-calendar-check,
    #personalSection .availability-calendar-check,
    #availabilityModalRoot .availability-calendar-check,
    #availabilityModalRoot .personal-calendar-row,
    #availabilityModalRoot .personal-toggle-card,
    #availabilityModalRoot .pattern-weekday-pill,
    #availabilityModalRoot .personal-link-modal-options label,
    #availabilityModalRoot .links-edit-toggles label,
    #availabilityModalRoot .personal-link-create-choice,
    #availabilityModalRoot .resource-policy-weekday-pill,
    #availabilityModalRoot .resource-hour-day,
    .admin-plan-feature
):has(input[type="checkbox"]:checked) {
    border-color: var(--pc-selection-line) !important;
    background: var(--pc-selection-soft) !important;
    color: var(--pc-selection-accent-dark) !important;
    box-shadow: inset 0 0 0 1px rgba(249, 115, 22, .04), var(--pc-selection-shadow) !important;
}

/* Paquetes: Activo y Sin fecha final conservan su forma; sólo se centra el texto. */
#availabilityModalRoot :is(
    .personal-package-active-toggle,
    .pattern-infinite-toggle,
    .pattern-active-toggle
) {
    align-items: center !important;
    justify-content: center !important;
    align-content: center !important;
}

#availabilityModalRoot :is(
    .personal-package-active-toggle,
    .pattern-infinite-toggle,
    .pattern-active-toggle
) > span {
    display: flex !important;
    width: 100% !important;
    min-height: 34px !important;
    margin: 0 !important;
    padding: 0 !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1.1 !important;
    text-align: center !important;
}

/* Días del patrón: ajuste visual aprobado. */
#availabilityModalRoot .personal-pattern-modal .pattern-weekday-pill {
    min-height: 29px !important;
    padding: 8px 8px !important;
    gap: 6px !important;
    border: 1px solid var(--pc-fb-line) !important;
    border-radius: 7px !important;
    background: #fff !important;
    color: var(--pc-fb-text) !important;
    font-size: 11.5px !important;
    font-weight: 500 !important;
    line-height: 1 !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: border-color .16s ease, background .16s ease, color .16s ease !important;
}

/* Días de Recursos: el label exterior no dibuja una segunda tarjeta. */
#availabilityModalRoot .resource-policy-weekday-pill,
#availabilityModalRoot .resource-policy-weekday-pill.pc-selection-choice,
#availabilityModalRoot .resource-policy-weekday-pill.pc-selection-choice:hover,
#availabilityModalRoot .resource-policy-weekday-pill.pc-selection-choice:has(input[type="checkbox"]:checked) {
    display: block !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: inherit !important;
    box-shadow: none !important;
    transform: none !important;
}

#availabilityModalRoot .resource-policy-weekday-pill > span {
    display: flex !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 29px !important;
    height: auto !important;
    margin: 0 !important;
    padding: 8px 8px !important;
    box-sizing: border-box !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    text-align: center !important;
}

/* Radios, rangos y progreso comparten el mismo acento. */
:is(input[type="radio"], input[type="range"], progress) {
    accent-color: var(--pc-selection-accent) !important;
}

:is(button, [role="button"], a[href], input, select, textarea, [tabindex]:not([tabindex="-1"])):focus-visible {
    outline: 0 !important;
    box-shadow: 0 0 0 3px var(--pc-selection-ring) !important;
}

@media (max-width: 760px) {
    .calendar-management-options-advanced {
        grid-template-columns: 1fr !important;
    }
}



/*
 * 10Q03.3.1 — Hotfix editor de eventos y recordatorios.
 * El checkbox compacto "Todo el día" vive dentro de un encabezado flex.
 * La regla global de booleanos no debe estirarlo al 100%, porque comprime el
 * título y el resumen del bloque Cuándo.
 */
#pietroEventModal .pietro-event-editor-card-heading > .pietro-event-toggle.pc-selection-checkbox,
#pietroEventModal .pietro-event-editor-card-heading > .pietro-event-toggle-compact.pc-selection-checkbox {
    flex: 0 0 auto !important;
    grid-template-columns: 17px auto !important;
    width: auto !important;
    max-width: none !important;
    min-width: max-content !important;
    justify-content: start !important;
    justify-self: end !important;
    white-space: nowrap !important;
}

#pietroEventModal .pietro-event-editor-card-heading > .pietro-event-toggle.pc-selection-checkbox > :not(input[type="checkbox"]),
#pietroEventModal .pietro-event-editor-card-heading > .pietro-event-toggle-compact.pc-selection-checkbox > :not(input[type="checkbox"]) {
    width: auto !important;
    min-width: max-content !important;
    white-space: nowrap !important;
}

#pietroEventModal .pietro-event-editor-card-heading > div {
    flex: 1 1 auto !important;
    min-width: 0 !important;
}
