/* Botones de acciones y formularios. Bootstrap y cada flujo conservan su comportamiento. */
:where(.btn.th-btn) { position: relative; }
.btn.th-btn {
    --th-btn-start: #315b9a;
    --th-btn-end: #4768ae;
    --th-btn-ink: #315b9a;
    --th-btn-soft: #edf3fc;
    --th-btn-line: #cbdaf0;
    --th-btn-text: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--th-space-2);
    isolation: isolate;
    overflow: hidden;
    min-width: 2.75rem;
    min-height: var(--th-control-height);
    padding: .6rem 1rem;
    border: 1px solid var(--th-btn-end);
    border-radius: .8rem;
    color: var(--th-btn-text);
    background: linear-gradient(135deg, var(--th-btn-start), var(--th-btn-end));
    box-shadow: inset 0 1px rgba(255,255,255,.18), 0 3px 8px rgba(23,39,67,.14);
    font-size: var(--th-text-sm);
    font-weight: var(--th-weight-semibold);
    line-height: 1.4;
    text-decoration: none;
    vertical-align: middle;
    white-space: normal;
    overflow-wrap: anywhere;
    transition: box-shadow .18s, filter .18s, border-color .18s;
}
.btn.th-btn:is(.btn-success, .btn-outline-success) { --th-btn-start: #18794e; --th-btn-end: #14663f; --th-btn-ink: #18734b; --th-btn-soft: #eff9f3; --th-btn-line: #c7e5d3; }
.btn.th-btn:is(.btn-danger, .btn-outline-danger) { --th-btn-start: #a9364b; --th-btn-end: #b44a5f; --th-btn-ink: #ad3047; --th-btn-soft: #fff2f5; --th-btn-line: #f0cfd7; }
.btn.th-btn:is(.btn-warning, .btn-outline-warning) { --th-btn-start: #aa650b; --th-btn-end: #8a4c0b; --th-btn-ink: #94540b; --th-btn-soft: #fff7e9; --th-btn-line: #efddb9; }
.btn.th-btn:is(.btn-info, .btn-outline-info) { --th-btn-start: #08768b; --th-btn-end: #075c73; --th-btn-ink: #08758b; --th-btn-soft: #effafd; --th-btn-line: #c5e7ef; }
.btn.th-btn:is(.btn-secondary, .btn-outline-secondary) { --th-btn-start: #536780; --th-btn-end: #44566e; --th-btn-ink: #536780; --th-btn-soft: #f2f5f9; --th-btn-line: #d6deea; }
.btn.th-btn:is(.btn-dark, .btn-outline-dark) { --th-btn-start: #243453; --th-btn-end: var(--th-color-dark-start); --th-btn-ink: #243453; --th-btn-soft: #edf1f8; --th-btn-line: #cdd7e8; }
.btn.th-btn.btn-light { --th-btn-start: #fff; --th-btn-end: #eef2fa; --th-btn-text: #3e526f; border-color: #d6e1f0; box-shadow: inset 0 1px #fff, 0 3px 8px rgba(23,39,67,.06); }
.btn.th-btn[class*='btn-outline-'] {
    color: var(--th-btn-ink);
    border-color: var(--th-btn-line);
    background: linear-gradient(135deg, #fff, var(--th-btn-soft));
    box-shadow: inset 0 1px #fff, 0 2px 4px rgba(23,39,67,.05);
}
.btn.th-btn::before {
    content: '';
    position: absolute;
    z-index: -1;
    inset: 0;
    background: linear-gradient(110deg, transparent 25%, rgba(255,255,255,.26) 50%, transparent 75%);
    transform: translateX(-130%);
    pointer-events: none;
}
.btn.th-btn:hover:not(:disabled):not(.disabled):not([aria-busy='true']) {
    color: var(--th-btn-text);
    filter: brightness(1.06);
    border-color: var(--th-btn-end);
    box-shadow: inset 0 1px rgba(255,255,255,.18), 0 5px 12px rgba(23,39,67,.19);
}
.btn.th-btn[class*='btn-outline-']:hover:not(:disabled):not(.disabled):not([aria-busy='true']) { color: #fff; background: linear-gradient(135deg, var(--th-btn-ink), var(--th-btn-end)); }
.btn.th-btn:is(:hover, :focus-visible):not(:disabled):not(.disabled):not([aria-busy='true'])::before { animation: th-button-sheen .65s ease-out both; }
.btn.th-btn:focus-visible { outline: 3px solid var(--th-color-focus); outline-offset: 3px; }
.btn.th-btn:is(:active, .active):not(:disabled):not(.disabled) { color: var(--th-btn-text); filter: brightness(.96); box-shadow: inset 0 2px 4px rgba(8,15,33,.2); }
.btn.th-btn[class*='btn-outline-']:is(:active, .active):not(:disabled):not(.disabled) { color: #fff; background: var(--th-btn-ink); }
.btn.th-btn:is(:disabled, .disabled) { opacity: .55; filter: saturate(.6); box-shadow: none; cursor: default; }
.btn.th-btn[aria-busy='true'] { cursor: progress; }
.btn.th-btn > .bi {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: .5rem;
    color: inherit;
    background: rgba(255,255,255,.13);
    font-size: 1rem;
    line-height: 1;
}
.btn.th-btn > .bi[class*='me-'] { margin-right: 0 !important; }
.btn.th-btn:is(.btn-light, [class*='btn-outline-']) > .bi { background: rgba(93,120,165,.08); }
.btn.th-btn[aria-busy='true'] > .bi { animation: th-button-busy 1s linear infinite; background: transparent; }
.btn.th-btn.btn-sm, .th-table > tbody .btn.th-btn { min-width: 2.125rem; min-height: 2.125rem; padding: .3rem .6rem; border-radius: .65rem; font-size: var(--th-text-sm); gap: .35rem; }
.btn.th-btn.btn-sm > .bi, .th-table > tbody .btn.th-btn > .bi { width: 1.15rem; height: 1.15rem; border-radius: .35rem; font-size: .875rem; }
.btn.th-btn.btn-lg { min-height: 3.125rem; padding: .8rem 1.25rem; font-size: var(--th-text-sm); border-radius: .9rem; }
.btn.th-btn.th-btn--icon { padding-inline: .5rem; aspect-ratio: 1; }
.btn.th-btn.th-btn--round { border-radius: 50%; }
.btn.th-btn .spinner-border { width: 1rem; height: 1rem; flex-shrink: 0; }
/* Conservar uniones y anchos de Bootstrap; la geometría no cambia al pulsar. */
.btn-group > .btn.th-btn { flex: 1 1 auto; }
.th-btn-actions { display: flex; flex-wrap: wrap; align-items: stretch; gap: var(--th-space-2); }
.th-btn-actions > :is(.th-btn, form) { flex: 1 1 9rem; min-width: 0; }
.th-btn-actions > form > .th-btn { width: 100%; height: 100%; }
@keyframes th-button-sheen { to { transform: translateX(130%); } }
@keyframes th-button-busy { to { transform: rotate(360deg); } }
@media (max-width: 575.98px) {
    .btn.th-btn { padding-inline: .8rem; }
    .btn.th-btn.btn-sm, .th-table > tbody .btn.th-btn { min-width: 2.5rem; min-height: 2.5rem; }
}
@media (prefers-reduced-motion: reduce) {
    .btn.th-btn { transition: none; }
    .btn.th-btn::before, .btn.th-btn[aria-busy='true'] > .bi { animation: none !important; }
}
