/* =============================================
   CAMPANITA GLOBAL — notificaciones automáticas + mensajería interna
   (ver static/js/notificaciones.js). Tokens de main.css.
   ============================================= */

/* Botón campana (mismo .topbar-icon-btn que usuario / cerrar sesión) */
.topbar-icon-bell { color: var(--topbar-bg); position: relative; }
.topbar-icon-bell.nt-bell-on { background: var(--accent-light); }
.nt-badge {
    position: absolute; top: -4px; right: -4px;
    min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 9px; border: 2px solid var(--topbar-bg);
    background: var(--error); color: #fff;
    font-size: 10.5px; font-weight: 700; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    pointer-events: none;
}
@keyframes ntRing {
    0%, 100% { transform: rotate(0); }
    20% { transform: rotate(14deg); } 40% { transform: rotate(-12deg); }
    60% { transform: rotate(8deg); }  80% { transform: rotate(-4deg); }
}
.nt-ring svg { animation: ntRing .7s ease; }
@media (prefers-reduced-motion: reduce) { .nt-ring svg { animation: none; } }

/* Panel desplegable */
.nt-panel {
    position: absolute; top: calc(100% + 10px); right: 44px;
    width: 400px; max-height: 560px;
    background: #fff; border-radius: 14px; box-shadow: 0 8px 32px rgba(0,0,0,.18);
    color: var(--text-dark); font-size: 13px;
    flex-direction: column; overflow: hidden;
    z-index: 1000; cursor: default;
}
.nt-tabs { display: flex; border-bottom: 1px solid var(--border); padding: 0 8px; flex-shrink: 0; }
.nt-tab {
    flex: 1; height: 46px; border: none; background: none; cursor: pointer;
    font-size: 13px; font-weight: 700; color: var(--text-mid);
    display: flex; align-items: center; justify-content: center; gap: 7px;
    border-bottom: 2.5px solid transparent; margin-bottom: -1px;
}
.nt-tab-on { color: var(--topbar-bg); border-bottom-color: var(--topbar-bg); }
.nt-cnt {
    min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9px;
    background: var(--accent-light); color: var(--text-sub);
    font-size: 11px; display: inline-flex; align-items: center; justify-content: center;
}
.nt-cnt-on { background: var(--error); color: #fff; }
.nt-cuerpo { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.nt-barra {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    padding: 9px 16px; font-size: 11.5px; color: var(--text-mid);
    border-bottom: 1px solid #f1f5f9; flex-shrink: 0;
}
.nt-link { border: none; background: none; padding: 0; cursor: pointer; color: var(--accent-hover); font-size: 11.5px; font-weight: 600; }
.nt-link:hover { text-decoration: underline; }
.nt-mas { display: block; width: 100%; padding: 10px; text-align: center; }
.nt-btn-nuevo { height: 30px; padding: 0 12px; font-size: 12px; }
.nt-lista { overflow-y: auto; flex: 1; }
.nt-vacio { padding: 40px 20px; text-align: center; color: var(--text-mid); font-size: 13px; }

/* Ítems (notificación / conversación) */
.nt-item {
    display: flex; gap: 12px; width: 100%; padding: 12px 34px 12px 16px;
    border: none; border-bottom: 1px solid #f1f5f9; background: #fff;
    text-align: left; cursor: pointer; position: relative; font-family: inherit;
}
.nt-item:hover { background: #f8fafc; }
.nt-item-nuevo { background: #f3f8fb; }
.nt-item-nuevo:hover { background: #e9f2f7; }
.nt-item-cuerpo { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nt-item-proc { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-mid); }
.nt-item-txt { font-size: 13px; line-height: 1.4; color: var(--text-dark); margin-top: 2px; word-break: break-word; }
.nt-item-meta { font-size: 11px; color: var(--text-mid); margin-top: 4px; }
.nt-item-ir { color: var(--accent-hover); font-weight: 600; }
.nt-recorte { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nt-punto { position: absolute; right: 14px; top: 16px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-hover); }

.nt-ico { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nt-ico svg { pointer-events: none; }
.nt-ico-amarillo { background: #fef3c7; color: #b45309; }
.nt-ico-celeste  { background: var(--accent-light); color: var(--accent-hover); }
.nt-ico-verde    { background: #dcfce7; color: #16a34a; }
.nt-ico-msg      { background: var(--topbar-bg); color: #fff; font-size: 11px; font-weight: 700; }

/* Conversación */
.nt-hilo-cab { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.nt-volver {
    width: 28px; height: 28px; border-radius: 50%; border: none; flex-shrink: 0;
    background: var(--accent-light); color: var(--text-sub); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.nt-volver svg { pointer-events: none; }
.nt-hilo-tit { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nt-hilo-sub { font-size: 11px; color: var(--text-mid); }
.nt-hilo-msgs { padding: 14px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; flex: 1; min-height: 160px; background: var(--content-bg); }
.nt-burbuja { max-width: 82%; padding: 9px 12px; border-radius: 12px; font-size: 13px; line-height: 1.4; word-break: break-word; }
.nt-burbuja-txt { white-space: pre-wrap; }
.nt-burbuja-quien { font-size: 10.5px; font-weight: 700; color: var(--text-mid); margin-bottom: 3px; letter-spacing: .03em; }
.nt-otro { background: #fff; border: 1px solid var(--border); align-self: flex-start; }
.nt-mia { background: var(--topbar-bg); color: #fff; align-self: flex-end; }
.nt-mia .nt-burbuja-quien { color: #a9bfd0; }
.nt-visto { font-size: 10.5px; color: var(--text-mid); align-self: flex-end; margin-top: -4px; }
.nt-responder { display: flex; align-items: flex-end; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); flex-shrink: 0; }
.nt-responder textarea {
    flex: 1; min-height: 36px; max-height: 140px; resize: vertical; box-sizing: border-box;
    border: 1.5px solid var(--border); border-radius: 8px; padding: 8px 10px;
    font-family: inherit; font-size: 13px; font-weight: 500; line-height: 1.4; outline: none; color: var(--text-dark);
}
.nt-responder textarea:focus { border-color: var(--accent); }
.nt-responder .btn-action { height: 36px; flex-shrink: 0; }

/* Modal nuevo mensaje — selector múltiple de usuarios */
.nt-picker {
    position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
    min-height: 38px; padding: 5px 6px; cursor: text;
    border: 1.5px solid var(--border); border-radius: 8px; background: #fff;
}
.nt-picker:focus-within { border-color: var(--accent); }
.nt-picker #nt-para-chips { display: contents; }
.modal-box .field .nt-picker input {
    flex: 1; min-width: 120px; height: 26px; border: none; padding: 0 4px; outline: none;
    font-size: 13px; width: auto;
}
.nt-chip {
    display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px;
    border-radius: 12px; background: var(--accent-light); color: var(--topbar-bg);
    font-size: 12px; font-weight: 600;
}
.nt-chip button { border: none; background: none; color: inherit; cursor: pointer; padding: 0; font-size: 15px; line-height: 1; opacity: .7; }
.nt-picker-lista {
    position: absolute; left: -1.5px; right: -1.5px; top: calc(100% + 4px); z-index: 5;
    background: #fff; border: 1px solid var(--border); border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 200px; overflow-y: auto;
}
.nt-picker-lista button {
    display: block; width: 100%; padding: 8px 12px; border: none; background: none;
    font-size: 13px; font-weight: 600; color: var(--text-dark); text-align: left; cursor: pointer;
}
.nt-picker-lista button:hover, .nt-picker-lista .nt-picker-act { background: var(--accent-light); }
.nt-picker-vacio { padding: 10px 12px; font-size: 12px; color: var(--text-mid); }
.nt-ayuda { font-size: 11px; color: var(--text-mid); }
.nt-textarea {
    width: 100%; padding: 9px 10px; resize: vertical; min-height: 90px;
    border: 1.5px solid var(--border); border-radius: 8px; outline: none;
    font-family: inherit; font-size: 13.5px; line-height: 1.45; color: var(--text-dark);
}
.nt-textarea:focus { border-color: var(--accent); }
.nt-error { margin-right: auto; align-self: center; font-size: 12px; font-weight: 600; color: var(--error); }

/* Aviso en pantalla (abajo a la derecha, 5 s) */
.nt-toast {
    position: fixed; right: 24px; bottom: 24px; z-index: 9998;
    width: 340px; display: flex; gap: 12px; padding: 12px 14px;
    background: #fff; border-radius: 12px; border-left: 4px solid var(--topbar-bg);
    box-shadow: 0 10px 30px rgba(0,0,0,.2); cursor: pointer;
    animation: fadeInUp .2s ease;
}

/* Peritajes: fila resaltada al llegar desde una notificación */
@keyframes ntResaltar { 0%, 60% { background: #fef3c7; } 100% { background: transparent; } }
tr.nt-fila-resaltada td { animation: ntResaltar 2.6s ease; }

/* Configuración › Notificaciones automáticas */
.ntc-chip {
    display: inline-flex; align-items: center; height: 22px; padding: 0 8px; margin: 0 4px 4px 0;
    border-radius: 11px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.ntc-chip-u { background: var(--accent-light); color: var(--topbar-bg); }
.ntc-chip-p { background: #ede9fe; color: #5b21b6; }
.ntc-chip-i { background: #fef3c7; color: #b45309; }
.ntc-chip-off { text-decoration: line-through; opacity: .6; }
.ntc-chip-c { background: #ccfbf1; color: #0f766e; }
.ntc-chip-cero, .nt-chip.ntc-chip-cero { background: #fee2e2; color: #b91c1c; }
.ntc-var { color: var(--accent-hover); font-weight: 700; }
.ntc-msg { font-size: 12.5px; color: var(--text-sub); }
.ntc-seccion { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 12px; }
.ntc-sub { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--text-dark); }
.ntc-vars { display: flex; flex-wrap: wrap; gap: 6px; }
.ntc-vbtn {
    height: 26px; padding: 0 9px; border-radius: 13px; cursor: pointer;
    border: 1.5px solid var(--accent); background: #fff; color: var(--accent-hover);
    font-size: 11.5px; font-weight: 700;
}
.ntc-vbtn:hover { background: var(--accent-light); }
.ntc-preview { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; background: #f3f8fb; border: 1px solid var(--border); border-radius: 10px; }
.ntc-audit { margin-right: auto; align-self: center; font-size: 11px; font-style: italic; color: var(--text-sub); }

/* ===== Mensajería v2 (asunto, lista corta, "Mis mensajes") ===== */
.nt-btn-barra { height: 30px; padding: 0 12px; font-size: 12px; flex-shrink: 0; }
.nt-barra-conv { padding: 8px 16px; }
.nt-conv-tit { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.nt-conv-tit b { font-size: 13px; color: var(--text-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nt-conv-tit span { font-size: 11px; color: var(--text-mid); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nt-pie { border-top: 1px solid var(--border); padding: 9px 16px; display: flex; justify-content: center; flex-shrink: 0; }
.nt-btn-mm {
    height: 28px; padding: 0 12px; border-radius: 7px; cursor: pointer;
    border: 1.5px solid var(--border); background: #fff; color: var(--text-sub);
    font-size: 12px; font-weight: 700;
}
.nt-btn-mm:hover { background: var(--accent-light); color: var(--text-dark); }
.nt-ico-grupo { background: var(--accent-hover); color: #fff; font-size: 11px; font-weight: 700; }
.nt-item-hilo { gap: 12px; }
.nt-hilo-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.nt-hilo-asunto { font-size: 13px; color: var(--text-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nt-item-nuevo .nt-hilo-asunto { font-weight: 700; }
.nt-hilo-hora { font-size: 11px; color: var(--text-mid); white-space: nowrap; flex-shrink: 0; }
.nt-item-nuevo .nt-hilo-hora { color: var(--accent-hover); font-weight: 700; }
.nt-punto-hilo { top: 38px; }
.nt-item-sel, .nt-item-sel:hover { background: var(--accent-light); box-shadow: inset 3px 0 0 var(--topbar-bg); }
.nt-pill {
    display: inline-flex; align-items: center; height: 18px; padding: 0 7px; border-radius: 9px;
    background: #f1f5f9; color: var(--text-sub); font-size: 10.5px; font-weight: 700;
}
.nt-meta-fila { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.nt-meta-fila:empty { display: none; }
.nt-inicial { border-top: 3px solid var(--accent); }
.nt-opcional { text-transform: none; letter-spacing: 0; font-weight: 500; }

/* Pantalla completa "Mis mensajes" */
.mm-cols { flex: 1; display: flex; min-height: 0; }
.mm-col-lista { width: 400px; flex-shrink: 0; border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.mm-busca { padding: 12px 14px 8px; }
.mm-busca input {
    width: 100%; height: 36px; border: 1.5px solid var(--border); border-radius: 8px; outline: none;
    padding: 0 10px 0 32px; font-size: 13px; color: var(--text-dark);
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237a9aaa' stroke-width='2.5'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") 10px center no-repeat;
}
.mm-busca input:focus { border-color: var(--accent); }
.mm-filtros { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 14px 10px; border-bottom: 1px solid var(--border); }
.mm-chip {
    height: 26px; padding: 0 11px; border-radius: 13px; cursor: pointer;
    border: 1.5px solid #e2e8f0; background: #f8fafc; color: #94a3b8;
    font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; gap: 5px;
}
.mm-chip-on { border-color: var(--topbar-bg); background: var(--accent-light); color: var(--topbar-bg); }
.mm-lista { flex: 1; overflow-y: auto; }
.mm-col-conv { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.mm-conv-vacia { flex: 1; display: flex; flex-direction: column; gap: 8px; align-items: center; justify-content: center; color: var(--text-mid); font-size: 13px; }
.mm-conv-cab { display: flex; gap: 12px; align-items: flex-start; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.mm-conv-tit { font-size: 15px; font-weight: 700; color: var(--text-dark); }
.mm-conv-sub { font-size: 12px; color: var(--text-sub); margin-top: 3px; }
.mm-conv-acc { margin-left: auto; display: flex; gap: 6px; flex-shrink: 0; }
.mm-btn-chico { height: 30px; padding: 0 12px; font-size: 12px; }
.mm-conv-msgs { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; background: var(--content-bg); }
.mm-conv-msgs .nt-burbuja { max-width: 70%; }
.mm-responder { display: flex; align-items: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); }
.mm-responder textarea {
    flex: 1; min-height: 38px; max-height: 220px; resize: vertical; box-sizing: border-box;
    border: 1.5px solid var(--border); border-radius: 8px; padding: 9px 10px;
    font-family: inherit; font-size: 13px; line-height: 1.4; outline: none; color: var(--text-dark);
}
.mm-responder textarea:focus { border-color: var(--accent); }
.mm-responder .btn-action { height: 38px; flex-shrink: 0; }

/* ===== Mis grupos ===== */
.mg-cuerpo { padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; max-height: 60vh; overflow-y: auto; }
.mg-fila { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; }
.mg-fila-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.mg-fila-nombre { font-size: 13.5px; font-weight: 700; color: var(--text-dark); display: flex; align-items: center; gap: 8px; }
.mg-fila-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.mg-chip-off { text-decoration: line-through; opacity: .55; }
.mg-btn-borrar { color: var(--error); border-color: #fecaca; }
.mg-btn-borrar:hover { background: #fee2e2; color: var(--error); }
.mg-btn-borrar-on { background: var(--error); color: #fff; border-color: var(--error); }
.mg-btn-borrar-on:hover { background: #dc2626; color: #fff; }
.nt-picker-grupo { display: flex !important; align-items: center; gap: 8px; }
.nt-picker-grupo small { color: var(--text-mid); font-weight: 500; }
.nt-grupo-tag { font-size: 9.5px; font-weight: 800; letter-spacing: .06em; padding: 2px 6px; border-radius: 4px; background: #ede9fe; color: #5b21b6; }
