/* ═══════════════════════════════════════════════════════════════════════════
   AVISOS — la campana de la barra superior y el centro de avisos (/{empresa}/avisos)
   Prefijo «av-». Severidad: urgente (rojo), pide acción (violeta), informativo (verde azulado).
   Versionada en App.razor: al tocarla, sube el ?v=.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    --av-urgente: #dc2626;
    --av-urgente-suave: #fef2f2;
    --av-accion: #7c3aed;
    --av-accion-suave: #f5f3ff;
    --av-info: #0f766e;
    --av-info-suave: #f0fdfa;
    --av-texto: #0f172a;
    --av-texto-2: #475569;
    --av-texto-3: #94a3b8;
    --av-borde: #e2e8f0;
}

/* ── Botón de la barra ─────────────────────────────────────────────────────── */
.av-campana { position: relative; display: inline-flex; }

.av-boton {
    position: relative; width: 40px; height: 40px; border-radius: 12px;
    display: inline-grid; place-items: center; cursor: pointer;
    background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); color: #fff;
    transition: background .15s ease, transform .15s ease;
}
.av-boton:hover { background: rgba(255,255,255,.22); }
.av-boton:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.av-boton .material-icons { font-size: 22px; }

.av-insignia {
    position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px;
    border-radius: 999px; background: var(--av-accion); color: #fff; border: 2px solid #fff;
    font: 700 11px/16px system-ui, sans-serif; text-align: center; box-sizing: border-box;
}
.av-boton.is-urgente .av-insignia { background: var(--av-urgente); animation: av-latido 1.6s ease-in-out infinite; }
.av-boton.is-sacude .material-icons { animation: av-sacude .9s ease; }

@keyframes av-latido { 0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,.55); } 50% { box-shadow: 0 0 0 6px rgba(220,38,38,0); } }
@keyframes av-sacude { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(18deg); } 30% { transform: rotate(-16deg); } 45% { transform: rotate(10deg); } 60% { transform: rotate(-6deg); } 75% { transform: rotate(3deg); } }
@media (prefers-reduced-motion: reduce) {
    .av-boton.is-urgente .av-insignia, .av-boton.is-sacude .material-icons { animation: none; }
}

/* ── Panel desplegable ─────────────────────────────────────────────────────── */
.av-fondo { position: fixed; inset: 0; z-index: 1090; background: transparent; }

.av-panel {
    position: fixed; top: 62px; right: 16px; z-index: 1100;
    width: min(420px, calc(100vw - 24px)); max-height: min(72vh, 640px);
    display: flex; flex-direction: column; overflow: hidden;
    background: #fff; color: var(--av-texto); border-radius: 16px;
    box-shadow: 0 24px 60px rgba(15,23,42,.22), 0 0 0 1px rgba(15,23,42,.06);
    animation: av-entra .16s ease-out;
}
.av-panel:focus { outline: none; }
@keyframes av-entra { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.av-panel__cab { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 16px 8px; }
.av-panel__cab h2 { margin: 0; font-size: 1.02rem; font-weight: 750; }
.av-panel__cab small { color: var(--av-texto-2); font-size: .76rem; }
.av-panel__acciones { display: flex; align-items: center; gap: 4px; }
.av-panel__pie { border-top: 1px solid var(--av-borde); padding: 8px 12px; text-align: center; }

.av-enlace { background: none; border: 0; color: var(--av-accion); font-weight: 650; font-size: .78rem; cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.av-enlace:hover { background: var(--av-accion-suave); }
.av-icono { background: none; border: 0; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: var(--av-texto-2); cursor: pointer; }
.av-icono:hover { background: #f1f5f9; color: var(--av-texto); }
.av-icono .material-icons { font-size: 19px; }

.av-filtro { display: flex; gap: 6px; padding: 0 16px 8px; }
.av-filtro button, .av-chips button {
    border: 1px solid var(--av-borde); background: #fff; color: var(--av-texto-2);
    border-radius: 999px; padding: 4px 12px; font-size: .76rem; font-weight: 600; cursor: pointer;
}
.av-filtro button.is-on, .av-chips button.is-on { background: var(--av-texto); color: #fff; border-color: var(--av-texto); }

.av-lista { overflow-y: auto; padding: 0 8px 8px; }
.av-dia { margin: 10px 8px 4px; font-size: .68rem; font-weight: 700; color: var(--av-texto-3); text-transform: uppercase; letter-spacing: .06em; }

/* ── Un aviso ──────────────────────────────────────────────────────────────── */
.av-item { position: relative; display: flex; align-items: stretch; border-radius: 12px; margin: 2px 0; }
.av-item:hover { background: #f8fafc; }
.av-item.is-nuevo { background: linear-gradient(90deg, var(--av-sev-suave, #f8fafc) 0%, #fff 70%); }
.av-item.is-nuevo::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--av-sev); }
.av-item--urgente { --av-sev: var(--av-urgente); --av-sev-suave: var(--av-urgente-suave); }
.av-item--accion { --av-sev: var(--av-accion); --av-sev-suave: var(--av-accion-suave); }
.av-item--info { --av-sev: var(--av-info); --av-sev-suave: var(--av-info-suave); }

.av-item__cuerpo { flex: 1; display: flex; gap: 12px; text-align: left; background: none; border: 0; padding: 10px 6px 10px 12px; cursor: pointer; color: inherit; min-width: 0; }
.av-item__cuerpo:focus-visible { outline: 2px solid var(--av-accion); outline-offset: -2px; border-radius: 12px; }
.av-item__ico { flex: none; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--av-sev-suave); color: var(--av-sev); }
.av-item__ico .material-icons { font-size: 19px; }
.av-item__texto { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.av-item__texto b { font-size: .84rem; font-weight: 600; color: var(--av-texto); line-height: 1.3; }
.av-item.is-nuevo .av-item__texto b { font-weight: 750; }
.av-item__msg { font-size: .78rem; color: var(--av-texto-2); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.av-item__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .7rem; color: var(--av-texto-3); margin-top: 2px; }
.av-item__meta em { font-style: normal; background: #f1f5f9; color: var(--av-texto-2); border-radius: 999px; padding: 0 6px; font-weight: 700; }
.av-item__meta strong { color: var(--av-urgente); font-weight: 750; text-transform: uppercase; letter-spacing: .04em; font-size: .64rem; }
.av-item__correo .material-icons { font-size: 14px; vertical-align: -2px; }
.av-item__leido { flex: none; width: 34px; background: none; border: 0; cursor: pointer; display: grid; place-items: center; border-radius: 10px; }
.av-item__leido:hover { background: #eef2ff; }
.av-punto { width: 9px; height: 9px; border-radius: 50%; background: var(--av-sev); box-shadow: 0 0 0 3px var(--av-sev-suave); }

/* ── Vacío y carga ─────────────────────────────────────────────────────────── */
.av-vacio { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 34px 18px; color: var(--av-texto-2); }
.av-vacio .material-icons { font-size: 40px; color: #c4b5fd; }
.av-vacio b { color: var(--av-texto); font-size: .9rem; }
.av-vacio p { margin: 0; font-size: .78rem; max-width: 300px; line-height: 1.45; }
.av-cargando { width: 26px; height: 26px; border-radius: 50%; border: 3px solid #ede9fe; border-top-color: var(--av-accion); animation: av-gira .8s linear infinite; }
@keyframes av-gira { to { transform: rotate(360deg); } }

/* ── Centro de avisos ──────────────────────────────────────────────────────── */
.av-centro { max-width: 1100px; margin: 0 auto; padding: 22px 20px 40px; color: var(--av-texto); }
.av-centro__cab { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.av-centro__cab h1 { margin: 0; font-size: 1.55rem; font-weight: 800; letter-spacing: -.02em; display: flex; align-items: center; gap: 10px; }
.av-centro__cab h1 .material-icons { color: var(--av-accion); font-size: 28px; }
.av-centro__cab p { margin: 6px 0 0; color: var(--av-texto-2); font-size: .86rem; max-width: 640px; line-height: 1.5; }

.av-vistas { display: inline-flex; background: #f1f5f9; border-radius: 12px; padding: 4px; gap: 2px; }
.av-vistas button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 7px 14px; border-radius: 9px; font-size: .82rem; font-weight: 650; color: var(--av-texto-2); cursor: pointer; }
.av-vistas button .material-icons { font-size: 18px; }
.av-vistas button.is-on { background: #fff; color: var(--av-texto); box-shadow: 0 1px 3px rgba(15,23,42,.12); }
.av-vistas em { font-style: normal; background: var(--av-accion); color: #fff; border-radius: 999px; padding: 0 7px; font-size: .7rem; }

.av-centro__barra { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.av-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.av-chips__sep { width: 1px; height: 20px; background: var(--av-borde); margin: 0 4px; }
.av-chips .av-chip--urgente.is-on { background: var(--av-urgente); border-color: var(--av-urgente); }
.av-chips .av-chip--accion.is-on { background: var(--av-accion); border-color: var(--av-accion); }
.av-chips .av-chip--info.is-on { background: var(--av-info); border-color: var(--av-info); }
.av-centro__der { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.av-select { border: 1px solid var(--av-borde); border-radius: 10px; padding: 7px 10px; font-size: .82rem; background: #fff; color: var(--av-texto); }

.av-boton-sec, .av-boton-pri { display: inline-flex; align-items: center; gap: 6px; border-radius: 10px; padding: 8px 14px; font-size: .82rem; font-weight: 650; cursor: pointer; }
.av-boton-sec { border: 1px solid var(--av-borde); background: #fff; color: var(--av-texto); }
.av-boton-sec:disabled { opacity: .5; cursor: default; }
.av-boton-sec .material-icons { font-size: 18px; }
.av-boton-pri { border: 0; background: var(--av-accion); color: #fff; }
.av-boton-pri:hover { background: #6d28d9; }

.av-centro__lista { background: #fff; border-radius: 16px; padding: 6px; box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 0 0 1px rgba(15,23,42,.06); }
.av-item--grande .av-item__cuerpo { padding: 14px 8px 14px 14px; }
.av-item--grande .av-item__texto b { font-size: .9rem; }
.av-item--grande .av-item__msg { -webkit-line-clamp: 3; font-size: .82rem; }
.av-mas { display: block; margin: 10px auto 6px; border: 1px solid var(--av-borde); background: #fff; border-radius: 999px; padding: 7px 18px; font-weight: 650; font-size: .8rem; cursor: pointer; color: var(--av-texto-2); }

.av-pref { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.av-pref__bloque { background: #fff; border-radius: 16px; padding: 16px 18px; box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 0 0 1px rgba(15,23,42,.06); }
.av-pref__bloque h2 { margin: 0 0 10px; font-size: .95rem; font-weight: 750; display: flex; align-items: center; gap: 8px; }
.av-pref__bloque h2 .material-icons { color: var(--av-accion); font-size: 20px; }
.av-interruptor { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px dashed var(--av-borde); cursor: pointer; }
.av-interruptor:first-of-type { border-top: 0; }
.av-interruptor input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--av-accion); flex: none; }
.av-interruptor span { display: flex; flex-direction: column; gap: 2px; }
.av-interruptor b { font-size: .85rem; }
.av-interruptor small { color: var(--av-texto-2); font-size: .76rem; line-height: 1.4; }
.av-modulos { display: flex; flex-wrap: wrap; gap: 8px; }
.av-modulo { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--av-borde); border-radius: 999px; padding: 5px 12px 5px 8px; font-size: .78rem; cursor: pointer; background: #fff; }
.av-modulo input { accent-color: var(--av-accion); }
.av-modulo .material-icons { font-size: 17px; color: var(--av-accion); }
.av-modulo.is-off { background: #f8fafc; color: var(--av-texto-3); text-decoration: line-through; }
.av-modulo.is-off .material-icons { color: var(--av-texto-3); }
.av-pref__pie { grid-column: 1 / -1; display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.av-ok { display: inline-flex; align-items: center; gap: 6px; color: #047857; font-size: .82rem; font-weight: 650; }
.av-ok .material-icons { font-size: 18px; }
.av-nota { color: var(--av-texto-2); font-size: .8rem; line-height: 1.5; margin: 0 0 10px; }

.av-catalogo { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.av-catalogo > .av-nota { grid-column: 1 / -1; }
.av-catalogo__mod { background: #fff; border-radius: 16px; padding: 14px 16px; box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 0 0 1px rgba(15,23,42,.06); }
.av-catalogo__mod h2 { margin: 0 0 10px; font-size: .92rem; font-weight: 750; display: flex; align-items: center; gap: 8px; }
.av-catalogo__mod h2 .material-icons { color: var(--av-accion); font-size: 20px; }
.av-catalogo__mod ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.av-catalogo__mod li { display: flex; gap: 10px; align-items: center; }
.av-catalogo__mod li > span:last-child { display: flex; flex-direction: column; }
.av-catalogo__mod li b { font-size: .8rem; font-weight: 650; }
.av-catalogo__mod li small { font-size: .72rem; color: var(--av-texto-2); }

@media (max-width: 640px) {
    .av-panel { top: 58px; right: 12px; }
    .av-centro { padding: 14px 12px 32px; }
    .av-vistas { width: 100%; }
    .av-vistas button { flex: 1; justify-content: center; padding: 7px 8px; }
}
