/* AlmaForce — Decisiones: botones únicos, Reversar, «Deshacer», bandeja «Por decidir», banda de ficha y Registro
   de auditoría (2026-10-18). Estilo de la casa: radios grandes, bordes finos, sombras suaves, Inter/Plus Jakarta. */

/* Botones de decisión: Aprobar verde a la izquierda · Rechazar con borde y texto rojo a la derecha */
.af-decision { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
.af-decision .af-button { border-radius: 999px; padding-inline: .85rem; }
.af-decision__reject { border-color: color-mix(in srgb, var(--af-danger) 55%, transparent); color: var(--af-danger); background: var(--af-surface); }
.af-decision__reject:hover { border-color: var(--af-danger); color: var(--af-danger); background: color-mix(in srgb, var(--af-danger) 8%, var(--af-surface)); }

/* Reversar: solo ícono pequeño junto al estado decidido (diseño de Antonio, 2026-10-18) */
.af-button--icon.af-revert { width: 1.7rem; min-height: 1.7rem; border-radius: 50%; color: var(--af-text-muted); }
.af-button--icon.af-revert .af-icon { width: .95rem; height: .95rem; }
.af-button--icon.af-revert:hover { color: var(--af-accent); background: var(--af-accent-soft); border-color: transparent; }
.af-revert--blocked { opacity: .5; cursor: help; }
/* Globito del motivo, anclado al ícono */
.af-pop { position: fixed; z-index: 95; width: min(300px, calc(100vw - 24px)); padding: .8rem .85rem; border-radius: 16px; border: 1px solid var(--af-border);
  background: var(--af-surface); color: var(--af-text); box-shadow: 0 10px 30px rgba(15, 23, 42, .16), 0 2px 6px rgba(15, 23, 42, .06); font-family: var(--af-font); animation: af-in .15s ease-out; }
.af-pop::before { content: ''; position: absolute; left: calc(var(--af-pop-arrow, 50%) - 6px); width: 12px; height: 12px; background: var(--af-surface); border: 1px solid var(--af-border); transform: rotate(45deg); }
.af-pop--below::before { top: -7px; border-right: 0; border-bottom: 0; }
.af-pop--above::before { bottom: -7px; border-left: 0; border-top: 0; }
.af-pop__title { display: flex; align-items: center; gap: .4rem; margin: 0 0 .5rem; font: 650 .82rem var(--af-font-display, var(--af-font)); }
.af-pop__title .af-icon { color: var(--af-accent); }
.af-pop__lead { margin: 0 0 .6rem; font-size: .78rem; color: var(--af-text-2); }
.af-pop__reason { width: 100%; resize: vertical; min-height: 3.2rem; border-radius: 12px; font-size: .78rem; }
.af-pop__error { display: block; min-height: .9rem; margin-top: .2rem; font-size: .7rem; color: var(--af-danger); }
.af-pop__actions { display: flex; gap: .4rem; margin-top: .3rem; }
.af-pop__actions .af-button { border-radius: 999px; }
.af-decided { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.af-decided__who { font: 500 .7rem var(--af-font); color: var(--af-text-muted); }
.af-decided__note { flex-basis: 100%; font-size: .72rem; color: var(--af-text-2); }

/* Antigüedad: ámbar > 24 h, rojo > 48 h */
.af-age { display: inline-flex; align-items: center; gap: .25rem; padding: .14rem .5rem; border-radius: 999px; font: 550 .66rem/1.3 var(--af-font);
  background: var(--af-surface-3); color: var(--af-text-2); white-space: nowrap; }
.af-age .af-icon { width: .85em; height: .85em; }
.af-age--warn { background: var(--af-warning-soft); color: var(--af-warning); }
.af-age--late { background: var(--af-danger-soft); color: var(--af-danger); }

/* Aviso con «Deshacer» */
.af-toast--undo { align-items: center; position: relative; overflow: hidden; padding-bottom: .85rem; }
.af-toast__undo { margin-left: auto; display: inline-flex; align-items: center; gap: .3rem; padding: .3rem .7rem; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .35);
  background: rgba(255, 255, 255, .12); color: inherit; font: 650 .74rem var(--af-font); cursor: pointer; white-space: nowrap; }
.af-toast__undo:hover { background: rgba(255, 255, 255, .22); }
.af-toast__undo:disabled { opacity: .6; cursor: progress; }
.af-toast__timer { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: #6ee7a8; transform-origin: left; animation: af-undo-timer linear forwards; }
@keyframes af-undo-timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* Confirmación fuerte (sin vuelta) */
.af-irreversible { display: flex; gap: .6rem; align-items: flex-start; margin: .2rem 0 .9rem; padding: .75rem .9rem; border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--af-danger) 35%, transparent); background: var(--af-danger-soft); color: var(--af-danger); font-size: .8rem; }
.af-irreversible p { margin: .3rem 0 0; color: var(--af-text); }
.af-irreversible .af-icon { width: 1.2rem; height: 1.2rem; margin-top: .1rem; }

/* Botón fijo «Por decidir (N)» junto a la campana */
.af-decide-pill { display: inline-flex; align-items: center; gap: .35rem; margin-right: .25rem; padding: .3rem .7rem .3rem .55rem; border-radius: 999px;
  border: 1px solid var(--af-border, #e2e8f0); background: #fff; color: #334155; font: 600 .74rem/1 Inter, system-ui, sans-serif; cursor: pointer; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06); transition: border-color .15s, box-shadow .15s; }
.af-decide-pill .af-icon { width: 1rem; height: 1rem; }
.af-decide-pill:hover { border-color: #94a3b8; box-shadow: 0 2px 8px rgba(15, 23, 42, .1); }
.af-decide-pill__count { min-width: 1.25rem; padding: .15rem .38rem; border-radius: 999px; background: #e2e8f0; color: #334155; font-size: .68rem; text-align: center; }
.af-decide-pill--has .af-decide-pill__count { background: #b7791f; color: #fff; }
.af-decide-pill--late .af-decide-pill__count { background: #c0392b; color: #fff; }
:root[data-theme="dark"] .af-decide-pill { background: var(--af-surface-2, #1b2533); color: var(--af-text, #e8eef7); border-color: var(--af-border, #2b3646); }
@media (max-width: 760px) { .af-decide-pill__label { display: none; } }

/* Bandeja (panel lateral y vista) */
.af-drawer--inbox { width: min(520px, 100vw); }
.af-seg { display: inline-flex; gap: .25rem; padding: .25rem; margin: .9rem 0 .6rem; border-radius: 999px; background: var(--af-surface-3); }
.af-seg__btn { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .85rem; border: 0; border-radius: 999px; background: none; color: var(--af-text-2); font: 600 .76rem var(--af-font); cursor: pointer; }
.af-seg__btn[aria-selected="true"] { background: var(--af-surface); color: var(--af-text); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.af-inbox { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.af-inbox__item { display: flex; gap: .7rem; padding: .8rem .9rem; border-radius: 16px; border: 1px solid var(--af-border); background: var(--af-surface); box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.af-inbox__icon { flex: none; display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--af-accent-soft); color: var(--af-accent); }
.af-inbox__icon[data-tone="sample"] { background: var(--af-info-soft); color: var(--af-info); }
.af-inbox__icon[data-tone="money"], .af-inbox__icon[data-tone="quote"] { background: var(--af-warning-soft); color: var(--af-warning); }
.af-inbox__body { min-width: 0; flex: 1; display: grid; gap: .25rem; }
.af-inbox__top { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.af-inbox__amount { margin-left: auto; font: 650 .8rem var(--af-font-display, var(--af-font)); color: var(--af-text); }
.af-inbox__title { justify-self: start; padding: 0; border: 0; background: none; text-align: left; color: var(--af-text); font: 650 .86rem var(--af-font-display, var(--af-font)); cursor: pointer; }
.af-inbox__title:hover { color: var(--af-accent); text-decoration: underline; }
.af-inbox__meta, .af-inbox__detail { font-size: .74rem; color: var(--af-text-muted); }
.af-inbox__reason { font-size: .76rem; color: var(--af-text-2); }
.af-inbox__actions { margin-top: .3rem; }
.af-inbox__sub { margin: 1.1rem 0 .5rem; font: 650 .78rem var(--af-font); color: var(--af-text-2); }

/* Banda de decisión arriba de la ficha */
.af-dband { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; margin-bottom: 1rem; padding: .75rem 1rem; border-radius: 18px;
  border: 1px solid var(--af-border); background: var(--af-surface); box-shadow: 0 1px 3px rgba(15, 23, 42, .05); }
.af-dband__icon { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--af-surface-3); color: var(--af-text-2); flex: none; }
.af-dband__text { flex: 1; min-width: 12rem; display: grid; gap: .15rem; font-size: .8rem; color: var(--af-text-2); }
.af-dband__text strong { font: 650 .9rem var(--af-font-display, var(--af-font)); color: var(--af-text); }
.af-dband--pending { border-color: color-mix(in srgb, var(--af-warning) 40%, transparent); background: color-mix(in srgb, var(--af-warning-soft) 55%, var(--af-surface)); }
.af-dband--pending .af-dband__icon { background: var(--af-warning-soft); color: var(--af-warning); }
.af-dband--done .af-dband__icon { background: var(--af-success-soft); color: var(--af-success); }
.af-dband--rejected .af-dband__icon { background: var(--af-danger-soft); color: var(--af-danger); }
.af-dband--reverted .af-dband__icon { background: var(--af-info-soft); color: var(--af-info); }

/* Historial de decisiones (línea de tiempo) */
.af-dtl { list-style: none; margin: 0; padding: 0 0 0 .4rem; display: grid; gap: .9rem; }
.af-dtl__item { position: relative; display: flex; gap: .7rem; }
.af-dtl__item:not(:last-child)::before { content: ''; position: absolute; left: .32rem; top: 1rem; bottom: -.9rem; width: 2px; background: var(--af-border); border-radius: 2px; }
.af-dtl__dot { flex: none; width: .7rem; height: .7rem; margin-top: .3rem; border-radius: 50%; background: var(--af-text-muted); box-shadow: 0 0 0 3px var(--af-surface); }
.af-dtl__item--success .af-dtl__dot { background: var(--af-success); }
.af-dtl__item--danger .af-dtl__dot { background: var(--af-danger); }
.af-dtl__item--info .af-dtl__dot { background: var(--af-info); }
.af-dtl__item--accent .af-dtl__dot { background: var(--af-accent); }
.af-dtl__line { font-size: .82rem; color: var(--af-text); }
.af-dtl__meta { font-size: .7rem; color: var(--af-text-muted); }
.af-dtl__changes { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .3rem; }
.af-dtl__reason { margin-top: .25rem; font-size: .76rem; color: var(--af-text-2); }
.af-change { display: inline-flex; gap: .25rem; padding: .14rem .5rem; border-radius: 999px; background: var(--af-surface-3); font-size: .7rem; color: var(--af-text-2); }
.af-change b { font-weight: 600; color: var(--af-text); }

/* Registro de auditoría */
.af-audit__head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .8rem; }
.af-integrity { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .8rem; border-radius: 999px; font: 600 .74rem var(--af-font); }
.af-integrity--ok { background: var(--af-success-soft); color: var(--af-success); }
.af-integrity--bad { background: var(--af-danger-soft); color: var(--af-danger); }
.af-audit__filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem .8rem; align-items: end; margin: 1rem 0; padding: .9rem; border-radius: 16px; background: var(--af-surface-2, var(--af-surface-3)); }
.af-audit__buttons { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .4rem; }
.af-audit__table { overflow-x: auto; scrollbar-width: none; border-radius: 14px; border: 1px solid var(--af-border); }
.af-audit__table::-webkit-scrollbar { display: none; }
.af-audit__table td { vertical-align: top; }
.af-audit__table td .af-change { margin: 0 .2rem .2rem 0; }
.af-audit__pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .5rem; margin-top: .8rem; }
.af-audit__pager .af-muted { margin-right: auto; font-size: .76rem; }

/* Fila «Por decidir» en la campana */
.af-bell-decide { display: flex; align-items: center; gap: .55rem; padding: .65rem .8rem; cursor: pointer; background: #fff8eb; color: #7a5410; }
.af-bell-decide:hover, .af-bell-decide:focus { background: #fdefd3; outline: none; }
.af-bell-decide .af-icon { width: 1.1rem; height: 1.1rem; }
.af-bell-decide span { display: grid; gap: .1rem; font-size: .74rem; }
.af-bell-decide small { color: #8a6821; font-size: .68rem; }

.af-inbox--compact .af-inbox__item { padding: .65rem .75rem; box-shadow: none; }

/* «Ver más» de decisiones con más de 7 días (tablero de Muestras): mismo patrón de «Cargar más» de Clientes. */
.af-more-decided { margin-top: .5rem; }
.af-more-decided > summary { list-style: none; display: inline-flex; margin: .25rem auto 0; cursor: pointer; }
.af-more-decided > summary::-webkit-details-marker { display: none; }
.af-more-decided[open] > summary { display: none; }
.af-more-decided > .af-mini { margin-top: .4rem; }

/* Barra de estados de Pedidos como secuencia del proceso: número de paso + flecha entre pasos. */
.af-flow-step { display: inline-grid; place-items: center; width: 1.15rem; height: 1.15rem; margin-right: .35rem; border-radius: 999px;
  font-size: .65rem; font-weight: 600; background: var(--af-surface-3, #e8efe9); color: var(--af-text-muted, #5b6b62); }
.af-filter[aria-pressed="true"] .af-flow-step { background: rgba(255, 255, 255, .22); color: inherit; }
.af-flow-arrow { color: var(--af-text-muted, #8a9a91); font-size: 1rem; line-height: 1; margin: 0 -.1rem; }
/* Muestras: el paso 4 (cierre) agrupa tres salidas; el número va suelto antes de ellas. */
.af-flow-step--label { margin: 0 .1rem 0 0; align-self: center; }

/* Tarjeta recién decidida en la bandeja: se resalta mientras la vista la trae, para que se vea su ícono Reversar. */
.af-inbox__item.is-just-decided { box-shadow: 0 0 0 2px var(--af-accent, #2a9166), 0 8px 24px rgba(42, 145, 102, .18); transition: box-shadow .3s ease; }
.af-inbox__item.is-just-decided .af-revert { animation: af-revert-pulse 1.2s ease-in-out 2; }
@keyframes af-revert-pulse { 50% { transform: scale(1.18); } }

/* Guía plegada: una sola pregunta + una línea de contexto (antes repetía «¿Para qué sirve? · ¿Para qué sirven…?»). */
.af-guide--collapsed .af-guide__open { display: flex; width: 100%; max-width: 100%; align-items: center; gap: .65rem; padding: .55rem .9rem; border-radius: 16px; text-align: left; }
.af-guide__q { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: .1rem; }
.af-guide__q strong { font-weight: 600; font-size: .82rem; color: var(--af-text, #16261e); }
.af-guide__ctx { font-size: .76rem; color: var(--af-text-muted, #64756c); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.af-guide__more { flex: none; font-size: .72rem; font-weight: 600; color: var(--af-accent, #2a9166); }

/* Botón del asistente (encabezado): robot propio, frase de bienvenida y paleta AlmaFlow (antes púrpura del tema viejo). */
.af-assistant-btn { position: relative; display: inline-flex; align-items: center; gap: .55rem; padding: .3rem .95rem .3rem .3rem; border: 0; border-radius: 999px; cursor: pointer;
  color: #fff; background: linear-gradient(120deg, #0f7a4f 0%, #1aa37a 55%, #2bb5a0 100%); box-shadow: 0 6px 18px rgba(16, 122, 79, .28), inset 0 1px 0 rgba(255, 255, 255, .25);
  font-family: var(--af-font, Inter, system-ui, sans-serif); transition: transform .18s ease, box-shadow .18s ease; isolation: isolate; overflow: hidden; }
.af-assistant-btn::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, .28) 48%, transparent 66%);
  transform: translateX(-120%); animation: af-assistant-shine 5.5s ease-in-out 1.5s infinite; }
.af-assistant-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(16, 122, 79, .36), inset 0 1px 0 rgba(255, 255, 255, .3); }
.af-assistant-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(43, 181, 160, .45), 0 6px 18px rgba(16, 122, 79, .28); }
.af-assistant-btn__bot { position: relative; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #fff; color: #1a9a6c;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .12); flex: none; }
.af-assistant-btn__bot svg { animation: af-assistant-float 3.2s ease-in-out infinite; }
.af-assistant-btn__eye { transform-origin: center; transform-box: fill-box; animation: af-assistant-blink 4.5s infinite; }
.af-assistant-btn__antenna { animation: af-assistant-glow 2.4s ease-in-out infinite; }
.af-assistant-btn__online { position: absolute; right: -1px; bottom: 1px; width: 10px; height: 10px; border-radius: 50%; background: #34d399; border: 2px solid #fff; }
.af-assistant-btn__text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; text-align: left; }
.af-assistant-btn__text strong { font-family: var(--af-font-display, 'Plus Jakarta Sans', Inter, sans-serif); font-weight: 700; font-size: .8rem; letter-spacing: .01em; }
.af-assistant-btn__text small { font-size: .68rem; font-weight: 500; opacity: .9; }
@keyframes af-assistant-shine { 0%, 70% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }
@keyframes af-assistant-float { 50% { transform: translateY(-1.5px); } }
@keyframes af-assistant-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes af-assistant-glow { 50% { opacity: .55; } }
@media (max-width: 640px) { .af-assistant-btn__text { display: none; } .af-assistant-btn { padding: .3rem; } }
@media (prefers-reduced-motion: reduce) { .af-assistant-btn::after, .af-assistant-btn__bot svg, .af-assistant-btn__eye, .af-assistant-btn__antenna { animation: none; } }
