.ui-modal {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.55);
}

[data-theme="light"] .ui-modal {
    background: rgba(15, 23, 42, 0.28);
}

.ui-modal[hidden] {
    display: none;
}

.ui-modal__dialog {
    width: min(560px, 100%);
    max-height: calc(100vh - 2rem);
    overflow: auto;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    color: var(--text-strong);
    border-radius: 18px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

[data-theme="light"] .ui-modal__dialog {
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
    color: #1a1a1e;
}

.ui-modal__dialog--sm {
    width: min(420px, 100%);
}

.ui-modal__dialog--lg {
    width: min(760px, 100%);
}

.ui-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(243, 197, 0, 0.2);
}

[data-theme="light"] .ui-modal__header {
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.ui-modal__title {
    margin: 0;
    font-family: "Space Grotesk", sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-strong);
}

[data-theme="light"] .ui-modal__title {
    color: #1a1a1e;
}

.ui-modal__close {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--input-border);
    background: var(--ghost-bg);
    color: var(--text-strong);
    cursor: pointer;
    font-size: 1.3rem;
    line-height: 1;
    transition: background 0.2s ease, border-color 0.2s ease;
}

[data-theme="light"] .ui-modal__close {
    background: rgba(15, 23, 42, 0.04);
    border-color: rgba(15, 23, 42, 0.08);
    color: #1a1a1e;
}

.ui-modal__close:hover {
    background: var(--ghost-hover-bg);
    border-color: rgba(243, 197, 0, 0.6);
}

[data-theme="light"] .ui-modal__close:hover {
    background: rgba(15, 23, 42, 0.08);
    border-color: rgba(15, 23, 42, 0.12);
}

.ui-modal__body {
    padding: 1.5rem 1.5rem 0.5rem 1.5rem;
}

[data-theme="light"] .ui-modal__body {
    color: #1a1a1e;
}

.ui-modal__footer {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.5rem 1.5rem 1.5rem 1.5rem;
    border-top: 1px solid rgba(243, 197, 0, 0.15);
}

[data-theme="light"] .ui-modal__footer {
    border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.ui-modal__footer .ui-btn {
    min-width: 120px;
    padding: 0.6rem 1.5rem;
}

.ui-form {
    display: grid;
    gap: 0.75rem;
}

.ui-form__grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ui-form__grid--one {
    grid-template-columns: 1fr;
}

.ui-field {
    display: grid;
    gap: 0.35rem;
}

.ui-field--full {
    grid-column: 1 / -1;
}

.ui-field > span {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.ui-field input,
.ui-field select,
.ui-field textarea {
    width: 100%;
    border: 1px solid var(--input-border);
    border-radius: 12px;
    padding: 0.75rem 0.85rem;
    font: inherit;
    background: var(--input-bg);
    color: var(--input-text);
}

.ui-field input::placeholder,
.ui-field textarea::placeholder {
    color: var(--input-placeholder);
}

.ui-field select option {
    color: #121212;
}

.ui-field input:focus,
.ui-field select:focus,
.ui-field textarea:focus {
    outline: 3px solid rgba(243, 197, 0, 0.25);
    border-color: rgba(243, 197, 0, 0.7);
}

.ui-form__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 0.2rem;
}

.ui-btn {
    appearance: none;
    border: 0;
    border-radius: 999px;
    padding: 0.72rem 1rem;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
}

.ui-btn--primary {
    color: #111111;
    background: linear-gradient(180deg, var(--yellow), var(--yellow-soft));
}

.ui-btn--ghost {
    background: var(--ghost-bg);
    color: var(--ghost-text);
    border: 1px solid var(--ghost-border);
}

.ui-btn--ghost:hover {
    background: var(--ghost-hover-bg);
    border-color: rgba(243, 197, 0, 0.5);
}

body.ui-modal-open {
    overflow: hidden;
}

.feedback-modal__content {
    display: grid;
    gap: 0.85rem;
    text-align: center;
}

.feedback-modal__icon {
    width: 64px;
    height: 64px;
    margin: 0.25rem auto 0;
    border-radius: 999px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(17, 24, 39, 0.12);
    background: rgba(243, 197, 0, 0.12);
    color: var(--yellow, #f3c500);
}

/* Importante: asegurar que hidden SI oculte el icono (nuestro display:grid lo estaba anulando). */
.feedback-modal__icon[hidden] {
    display: none !important;
}

.feedback-modal__icon svg {
    width: 34px;
    height: 34px;
}

.feedback-modal__icon svg path {
    fill: none;
    stroke: currentColor;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.feedback-modal__content[data-feedback-type="error"] .feedback-modal__icon {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger, #ef4444);
}

.feedback-modal__message {
    margin: 0;
    color: var(--text-strong);
    font-weight: 700;
    line-height: 1.35;
}

@keyframes feedback-pop {
    0% {
        transform: scale(0.75);
        opacity: 0;
    }
    70% {
        transform: scale(1.12);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes feedback-draw {
    from {
        stroke-dashoffset: 100;
        opacity: 0.9;
    }
    to {
        stroke-dashoffset: 0;
        opacity: 1;
    }
}

@keyframes feedback-fade {
    0% {
        transform: translateY(6px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.feedback-modal__icon.is-anim {
    animation: feedback-pop 460ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.feedback-modal__icon.is-anim svg path {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: feedback-draw 520ms ease-out 90ms forwards;
}

.feedback-modal__message.is-anim {
    animation: feedback-fade 220ms ease-out;
}

@media (max-width: 640px) {
    .ui-form__grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Tablas y table-controls embebidos dentro de modales ===== */
.ui-modal .table-controls {
    color: var(--text-strong);
}

.ui-modal .table-controls__search,
.ui-modal .table-controls__size {
    color: var(--text-muted);
}

.ui-modal .table-controls__input,
.ui-modal .table-controls__select {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--input-text);
}

.ui-modal .table-controls__input::placeholder {
    color: var(--input-placeholder);
}

.ui-modal .table-controls__input:focus,
.ui-modal .table-controls__select:focus {
    border-color: rgba(243, 197, 0, 0.8);
    box-shadow: 0 0 0 3px rgba(243, 197, 0, 0.25);
}

.ui-modal .table-controls__select option {
    color: #121212;
}

.ui-modal .table-controls__btn {
    background: var(--yellow);
    border: 1px solid rgba(243, 197, 0, 0.6);
    color: #121212;
    font-weight: 900;
}

.ui-modal .table-controls__btn:hover:not(:disabled) {
    background: var(--yellow-soft);
}

.ui-modal .table-controls__btn:disabled {
    background: rgba(243, 197, 0, 0.35);
    color: rgba(18, 18, 18, 0.55);
}

.ui-modal .table-controls__info {
    color: var(--text-muted);
}

.ui-modal .table th {
    color: var(--text-muted);
    border-bottom: 1px solid rgba(243, 197, 0, 0.2);
}

.ui-modal .table td {
    color: var(--text-strong);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ui-modal .table__empty,
.ui-modal .helper {
    color: var(--text-muted) !important;
}