/* Hub de Alertas. Tokens de market.css. */

.alerts-page .kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.alerts-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}

.alerts-hint {
    font-size: 12px;
    color: var(--color-faint);
}

.alerts-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-chip {
    border: 1px solid var(--color-line);
    background: var(--color-surface);
    color: var(--color-muted);
    font-size: 11.5px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 999px;
    cursor: pointer;
    font-family: inherit;
}

.filter-chip.active {
    background: var(--color-brand);
    border-color: var(--color-brand);
    color: #fff;
}

.alerts-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(240px, .8fr);
    gap: 16px;
    align-items: start;
}

.alerts-layout.single {
    grid-template-columns: minmax(0, 1fr);
}

.alert-row {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    width: 100%;
    padding: 14px 16px;
    border: none;
    border-bottom: 1px solid var(--color-line);
    background: transparent;
    color: inherit;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
}

.alert-row:last-child {
    border-bottom: none;
}

.alert-row:hover,
.alert-row.selected {
    background: var(--color-brand-soft);
}

.alert-row .logo-chip {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-control);
    font-size: 11px;
    color: var(--color-brand-strong);
}

.alert-row .logo-chip svg {
    width: 20px;
    height: 20px;
    color: var(--color-brand);
}

.alert-row .row-title {
    font-size: 14px;
    font-weight: 700;
}

.alert-row .row-sub {
    font-size: 13px;
    color: var(--color-muted);
    margin-top: 2px;
}

.alert-row .row-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.alert-row .row-actions {
    display: none;
    gap: 6px;
}

.alert-row:hover .row-actions,
.alert-row:focus-within .row-actions {
    display: flex;
}

.alert-row:hover .row-when {
    display: none;
}

.alert-row .when {
    font-size: 12px;
    color: var(--color-faint);
    white-space: nowrap;
}

.pill-ok {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.pill-muted {
    background: var(--color-surface-2);
    color: var(--color-muted);
}

.pill-warn {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}

.limit-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: var(--radius-control);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 16px;
    background: var(--color-warning-bg);
    color: var(--color-warning-strong);
}

.limit-banner svg {
    width: 18px;
    height: 18px;
    flex: none;
}

.limit-banner.limit-banner-info {
    background: var(--color-info-bg);
    color: var(--color-info);
    font-weight: 500;
}

.limit-banner a {
    color: inherit;
    font-weight: 700;
    text-decoration: underline;
}

.guest-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 1fr);
    gap: 40px;
    align-items: center;
    padding: 48px 44px;
    text-align: left;
    min-height: 420px;
}

.guest-copy svg {
    width: 36px;
    height: 36px;
    color: var(--color-brand);
    margin-bottom: 14px;
}

.guest-copy h2 {
    font-size: clamp(22px, 2.4vw, 28px);
    font-weight: 800;
}

.guest-copy p {
    font-size: 14px;
    color: var(--color-muted);
    margin: 10px 0 16px;
    max-width: 46ch;
}

.guest-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.guest-panel .steps {
    display: grid;
    gap: 12px;
}

.guest-panel .step {
    background: var(--color-surface-2);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-card);
    padding: 16px;
}

.step-num {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--color-brand-soft);
    color: var(--color-brand-strong);
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 8px;
}

.guest-panel .step h3 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
}

.guest-panel .step p {
    font-size: 13px;
    color: var(--color-muted);
    margin: 0;
}

.alerts-page .empty-state svg {
    width: 36px;
    height: 36px;
    color: var(--color-brand);
    margin: 0 auto 12px;
    display: block;
}

.inspector {
    padding: 20px;
}

.inspector h2 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 10px;
}

.inspector .why {
    font-size: 14px;
    color: var(--color-muted);
    margin: 12px 0 16px;
}

.overlay {
    position: fixed;
    inset: 0;
    background: color-mix(in srgb, black 45%, transparent);
    z-index: 40;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 24px 16px;
    overflow: auto;
}

.overlay[hidden] {
    display: none;
}

.modal {
    width: min(520px, 100%);
    background: var(--color-surface);
    border-radius: var(--radius-card);
    box-shadow: 0 10px 30px rgba(16, 24, 40, .12);
    padding: 24px;
    margin: auto;
    max-height: calc(100vh - 48px);
    overflow: auto;
}

.modal h2 {
    font-size: 20px;
    font-weight: 800;
}

.modal .sub {
    font-size: 13px;
    color: var(--color-muted);
    margin: 6px 0 16px;
}

.field {
    margin-bottom: 14px;
}

.field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-muted);
    margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    border: 1px solid var(--color-line-strong);
    border-radius: var(--radius-control);
    padding: 10px 12px;
    font-size: 14px;
    background: var(--color-surface);
    color: var(--color-ink);
    font-family: inherit;
    outline: none;
}

.field textarea {
    min-height: 72px;
    resize: vertical;
    line-height: 1.45;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px var(--color-brand-soft);
}

.field input.filled-by-ai,
.field select.filled-by-ai {
    border-color: var(--color-brand);
    background: var(--color-brand-soft);
}

.field-error {
    font-size: 12px;
    color: var(--color-danger);
    margin-top: 4px;
}

.ai-box {
    background: var(--color-surface-2);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-card);
    padding: 14px;
    margin-bottom: 16px;
}

.ai-box h3 {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 4px;
}

.ai-help {
    font-size: 12px;
    color: var(--color-muted);
    margin-bottom: 10px;
}

.ai-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 10px;
}

.ai-status {
    font-size: 12.5px;
    font-weight: 600;
    margin-top: 10px;
    color: var(--color-brand-strong);
}

.ai-status.warn {
    color: var(--color-warning);
}

.modal-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

.sk-row {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--color-line);
}

.sk {
    background: var(--color-surface-2);
    border-radius: 6px;
    height: 12px;
}

.sk-chip {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-control);
}

.ai-line {
    font-size: 12px;
    color: var(--color-faint);
    padding: 12px 16px 16px;
}

.ai-line button {
    background: none;
    border: none;
    color: var(--color-brand-strong);
    font: inherit;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
}

/* Canal de avisos */
.channel-card {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 24px;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    margin-bottom: 16px;
}

.channel-copy {
    min-width: 0;
}

.channel-card h2 {
    font-size: 14px;
    font-weight: 800;
}

.channel-lead {
    font-size: 13px;
    color: var(--color-muted);
    margin-top: 4px;
    max-width: 56ch;
}

.channel-lead strong {
    color: var(--color-ink);
    font-weight: 700;
}

.channel-hint {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--color-warning);
    margin-top: 6px;
}

.channel-hint a {
    color: inherit;
    font-weight: 700;
    text-decoration: underline;
}

.channel-meta {
    font-size: 12px;
    color: var(--color-muted);
    margin-top: 6px;
}

.rule-plan-note {
    font-size: 12.5px;
    color: var(--color-muted);
    background: var(--color-surface-2);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-control);
    padding: 10px 12px;
    margin-bottom: 14px;
}

.channel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.channel-skeleton {
    display: grid;
    gap: 8px;
    flex: 1;
    min-width: 200px;
    padding: 6px 0;
}

.channel-options {
    display: grid;
    gap: 10px;
    margin: 4px 0 14px;
}

.channel-option {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--color-line-strong);
    border-radius: var(--radius-control);
    padding: 12px 14px;
    cursor: pointer;
}

.channel-option:hover {
    border-color: var(--color-brand);
}

.channel-option:has(input:checked) {
    border-color: var(--color-brand);
    background: var(--color-brand-soft);
}

.channel-option.disabled {
    opacity: .55;
    cursor: not-allowed;
}

.channel-option.disabled:hover {
    border-color: var(--color-line-strong);
}

.channel-option input {
    accent-color: var(--color-brand);
    flex: none;
}

.channel-option-icon {
    width: 20px;
    height: 20px;
    flex: none;
    color: var(--color-brand-strong);
}

.channel-option-text {
    min-width: 0;
}

.channel-option-text strong {
    display: block;
    font-size: 13.5px;
}

.channel-option-text small {
    display: block;
    font-size: 12px;
    color: var(--color-muted);
    overflow-wrap: anywhere;
}

/* Confirmación */
.modal-sm {
    width: min(420px, 100%);
}

.btn-danger {
    border: none;
    background: var(--color-danger);
    color: #fff;
}

.btn-danger:hover {
    filter: brightness(.92);
}

html.dark .btn-danger {
    color: var(--color-surface);
}

@media (max-width: 900px) {
    .alerts-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .guest-panel {
        grid-template-columns: 1fr;
        min-height: 0;
        padding: 32px 24px;
        text-align: center;
        gap: 24px;
    }

    .guest-copy p {
        margin-left: auto;
        margin-right: auto;
    }

    .guest-actions {
        justify-content: center;
    }

    .guest-panel .step {
        text-align: left;
    }
}

@media (max-width: 760px) {
    .alert-row {
        grid-template-columns: 40px minmax(0, 1fr);
    }

    .alert-row .row-meta {
        grid-column: 2;
        justify-content: flex-start;
        margin-top: 4px;
    }

    .alert-row:hover .row-when {
        display: inline;
    }

    .alerts-page .kpi:last-child {
        grid-column: auto;
    }
}

@media (max-width: 560px) {
    .alerts-page .page-head .btn-primary {
        width: 100%;
    }

    .alerts-page .kpi:last-child {
        grid-column: auto;
    }

    .channel-card {
        align-items: stretch;
    }

    .channel-actions .btn {
        flex: 1;
        justify-content: center;
    }
}
