/* Velia 2 — interfaz moderna «barra lateral y tarjetas»: menú único a la izquierda (contraíble a iconos),
   cabecera limpia con el buscador destacado, tarjetas blancas con sombra suave y titulares en minúscula */
:root {
  --bg: #f4f4f6;
  --surface: #ffffff;
  --surface-2: #f8f8fa;
  --border: #e4e4e9;
  --text: #16161a;
  --text-2: #5b5b66;
  --side: #ffffff;
  --side-text: #3a3a44;
  --side-active: #f7e4e8;
  --radius: 14px;
  --sombra: 0 1px 2px rgba(20, 20, 30, .05), 0 4px 14px rgba(20, 20, 30, .05);
  --ancho-menu: 252px;
}
:root[data-theme="dark"] {
  --bg: #0f0f12;
  --surface: #18181c;
  --surface-2: #1f1f24;
  --border: #2c2c33;
  --side: #141417;
  --side-text: #d9d8de;
  --side-active: #2e141a;
  --sombra: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
}

/* Tipografía: titulares en minúscula, limpios */
h1, .hello h1 { font-family: var(--font); font-weight: 800; text-transform: none; letter-spacing: -.02em; font-size: 28px; line-height: 1.15; }
.hello h1 { font-size: 32px; }
h2 { font-family: var(--font); font-weight: 750; font-size: 17px; letter-spacing: -.01em; }
h3 { font-family: var(--font); font-weight: 700; }
.page-head { margin-bottom: 20px; }
.page-head p { font-size: 14px; color: var(--text-2); }

/* Estructura */
.app { grid-template-columns: var(--ancho-menu) 1fr; transition: grid-template-columns .2s ease; }
body.nav-rail .app { grid-template-columns: 68px 1fr; }
.content { padding: 26px 32px 80px; }

/* ---------- Barra lateral ---------- */
.side, :root[data-theme="dark"] .side { background: var(--side); border-right: 1px solid var(--border); }
.brand, :root[data-theme="dark"] .brand { color: var(--text); padding: 18px 18px 12px; }
.brand b { font-family: var(--font); font-weight: 800; font-size: 20px; letter-spacing: .02em; color: var(--accent); }
.brand small, :root[data-theme="dark"] .brand small { color: var(--text-2); font-size: 11px; }
.nav-group { padding: 4px 10px; }
.nav-group.fijo { padding-top: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.nav-group > span, :root[data-theme="dark"] .nav-group > span { color: var(--text-2); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 10px 10px 4px; }
.nav a, :root[data-theme="dark"] .nav a { color: var(--side-text); font-size: 14px; font-weight: 600; letter-spacing: 0; padding: 8px 10px; border-radius: 10px; }
.nav a .ico, :root[data-theme="dark"] .nav a .ico { color: var(--text-2); }
.nav a:hover, :root[data-theme="dark"] .nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a:hover .ico { color: var(--accent); }
.nav a.active, :root[data-theme="dark"] .nav a.active { background: var(--side-active); color: var(--accent); font-weight: 750; box-shadow: none; }
.nav a.active .ico, :root[data-theme="dark"] .nav a.active .ico { color: var(--accent); }
.nav a .badge { background: var(--surface-2); color: var(--text-2); }
.nav a .badge.red, .ng-h .badge.red { background: #c42d45; color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 7px; }
/* Grupos plegables */
.ng-h { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: 0; cursor: pointer; padding: 9px 10px; border-radius: 10px; color: var(--text-2); font: inherit; font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; text-align: left; }
.ng-h:hover { background: var(--surface-2); color: var(--text); }
.ng-car { margin-left: auto; font-size: 15px; transition: transform .15s; }
.nav-group.abierto .ng-car { transform: rotate(90deg); }
.ng-items { display: none; padding-bottom: 4px; }
.nav-group.abierto .ng-items { display: block; }
/* Pie: contraer menú */
.side-foot { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-top: 1px solid var(--border); }
.side-foot small { color: var(--text-2); font-size: 11px; padding-left: 4px; }
.nav-plegar { display: flex; align-items: center; gap: 10px; background: none; border: 0; cursor: pointer; color: var(--text-2); font: inherit; font-size: 13px; font-weight: 600; padding: 7px 8px; border-radius: 10px; }
.nav-plegar:hover { background: var(--surface-2); color: var(--text); }
/* Menú contraído: solo iconos (el nombre sale al pasar el ratón) */
body.nav-rail .brand > div, body.nav-rail .side-foot small, body.nav-rail .nav-plegar span, body.nav-rail .ng-h, body.nav-rail .nav-group > span { display: none; }
body.nav-rail .brand { justify-content: center; padding: 16px 0 10px; }
body.nav-rail .nav-group { padding: 2px 8px; border-bottom: 1px solid var(--border); }
body.nav-rail .ng-items { display: block; }
body.nav-rail .nav a { justify-content: center; padding: 9px 0; font-size: 0; position: relative; }
body.nav-rail .nav a .ico { width: 20px; height: 20px; }
body.nav-rail .nav a .badge { position: absolute; top: 2px; right: 4px; font-size: 9.5px; padding: 0 5px; }
body.nav-rail .nav a .badge + .badge { display: none; }
body.nav-rail .nav-plegar { justify-content: center; }
body.nav-rail .nav-plegar svg { transform: scaleX(-1); }

/* ---------- Cabecera ---------- */
.topbar, :root[data-theme="dark"] .topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 26px; gap: 12px; }
.topnav { display: none !important; }
/* Buscador: grande, con borde de color y siempre a la vista */
.search, :root[data-theme="dark"] .search { flex: 1; max-width: 640px; min-height: 42px; display: flex; align-items: center; gap: 10px; padding: 0 14px; background: var(--surface); border: 2px solid var(--accent); border-radius: 12px; color: var(--text); font-size: 14.5px; font-weight: 600; cursor: text; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent); transition: box-shadow .15s, transform .15s; }
.search:hover, .search:focus-visible { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 20%, transparent); outline: none; }
.search span { color: var(--text-2); flex: 1; }
.search kbd { background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 2px 8px; font-size: 11.5px; font-weight: 700; }
/* Botones de la cabecera más sobrios */
.btn-salir { background: transparent; color: var(--text-2); border: 1px solid var(--border); font-weight: 700; text-transform: none; letter-spacing: 0; box-shadow: none; }
.btn-salir:hover { background: var(--surface-2); color: var(--accent); border-color: var(--accent); box-shadow: none; }
.iconbtn { border-radius: 10px; }

/* ---------- Componentes ---------- */
.card, :root[data-theme="dark"] .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--sombra); }
.card-h { border-bottom: 1px solid var(--border); }
.btn { border-radius: 10px; font-weight: 650; }
.btn.primary { background: var(--accent); box-shadow: 0 2px 6px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn.primary:hover { filter: brightness(1.08); transform: none; }
.tabs { border-bottom: 1px solid var(--border); gap: 4px; }
.tabs a { font-weight: 650; border-radius: 8px 8px 0 0; padding: 10px 14px; }
.tabs a:hover { color: var(--text); background: var(--surface-2); }
.tabs a.active { border-bottom-width: 3px; }
input[type="text"], input[type="search"], input[type="email"], input[type="number"], input[type="date"], input[type="tel"], select, textarea { border-radius: 10px; }
.t th { font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--text-2); }
.t tr:hover td { background: var(--surface-2); }
.pill { border-radius: 999px; }

@media (max-width: 800px) {
  .app, body.nav-rail .app { grid-template-columns: 1fr; }
  .search { max-width: none; }
  .content { padding: 16px 14px 70px; }
  h1 { font-size: 23px; }
}

/* Cajas del seguimiento: señalamientos en verde suave y vencimientos (plazos) en granate claro, para verlos de un vistazo */
.seg-it.senalamiento { background: #eaf6ee; border-color: #b9e0c5; border-left-color: #2f8f55; }
.seg-it.senalamiento .seg-ic { background: #d3eedc; color: #1f6e3f; }
.seg-it.senalamiento .seg-tipo { color: #237a46; }
.seg-it.termino { background: #fbecef; border-color: #efc6ce; border-left-color: #9e1f32; }
.seg-it.termino .seg-ic { background: #f6d6dc; color: #8a1a2c; }
.seg-it.termino .seg-tipo { color: #9e1f32; }
.seg-it.senalamiento.hecho, .seg-it.termino.hecho { opacity: .7; }
:root[data-theme="dark"] .seg-it.senalamiento { background: #13261a; border-color: #24452f; border-left-color: #4cbf78; }
:root[data-theme="dark"] .seg-it.senalamiento .seg-ic { background: #1c3a26; color: #8fe0ac; }
:root[data-theme="dark"] .seg-it.senalamiento .seg-tipo { color: #7fd69e; }
:root[data-theme="dark"] .seg-it.termino { background: #2a1419; border-color: #4a2229; border-left-color: #e24a62; }
:root[data-theme="dark"] .seg-it.termino .seg-ic { background: #3d1c23; color: #f3a5b2; }
:root[data-theme="dark"] .seg-it.termino .seg-tipo { color: #f08a9b; }

/* Señalamientos (verde) y vencimientos (granate) también cuando vienen como «agenda» del programa anterior,
   y en todas las vistas: seguimiento, pestaña «Agenda y plazos» y agenda general */
.seg-it.v-senal, .ag-item.v-senal { background: #eaf6ee; border-color: #b9e0c5; border-left-color: #2f8f55; }
.seg-it.v-senal .seg-ic { background: #d3eedc; color: #1f6e3f; } .seg-it.v-senal .seg-tipo { color: #237a46; }
.seg-it.v-venc, .ag-item.v-venc { background: #fbecef; border-color: #efc6ce; border-left-color: #9e1f32; }
.seg-it.v-venc .seg-ic { background: #f6d6dc; color: #8a1a2c; } .seg-it.v-venc .seg-tipo { color: #9e1f32; }
.ag-item.v-senal:hover { background: #dcf0e3; } .ag-item.v-venc:hover { background: #f7dde3; }
tr.v-senal td { background: #eaf6ee; } tr.v-senal td:first-child { box-shadow: inset 4px 0 0 #2f8f55; }
tr.v-venc td { background: #fbecef; } tr.v-venc td:first-child { box-shadow: inset 4px 0 0 #9e1f32; }
.t tr.v-senal:hover td { background: #dcf0e3; } .t tr.v-venc:hover td { background: #f7dde3; }
.ev.v-senal { background: #d9f0e1; color: #1b5e36; border-left: 3px solid #2f8f55; }
.ev.v-venc { background: #f8dde3; color: #7a1626; border-left: 3px solid #9e1f32; }
:root[data-theme="dark"] .seg-it.v-senal, :root[data-theme="dark"] .ag-item.v-senal { background: #13261a; border-color: #24452f; border-left-color: #4cbf78; }
:root[data-theme="dark"] .seg-it.v-senal .seg-ic { background: #1c3a26; color: #8fe0ac; } :root[data-theme="dark"] .seg-it.v-senal .seg-tipo { color: #7fd69e; }
:root[data-theme="dark"] .seg-it.v-venc, :root[data-theme="dark"] .ag-item.v-venc { background: #2a1419; border-color: #4a2229; border-left-color: #e24a62; }
:root[data-theme="dark"] .seg-it.v-venc .seg-ic { background: #3d1c23; color: #f3a5b2; } :root[data-theme="dark"] .seg-it.v-venc .seg-tipo { color: #f08a9b; }
:root[data-theme="dark"] tr.v-senal td { background: #13261a; } :root[data-theme="dark"] tr.v-venc td { background: #2a1419; }
:root[data-theme="dark"] .ev.v-senal { background: #1c3a26; color: #a6e8bd; } :root[data-theme="dark"] .ev.v-venc { background: #3d1c23; color: #f6b5c0; }

/* Barra del próximo vencimiento: siempre muy visible (granate intenso, más alta, cifras grandes, icono que late);
   si quedan menos de 3 días, además late la barra entera; si es un señalamiento, en verde intenso */
.anuncio { background: linear-gradient(90deg, #7a1222, #c42d45 50%, #7a1222); font-size: 15.5px; font-weight: 700; padding: 12px 16px; gap: 12px; box-shadow: 0 3px 12px rgba(122, 18, 34, .35); position: relative; z-index: 5; letter-spacing: .01em; }
.anuncio.es-senal { background: linear-gradient(90deg, #14532d, #1f8a4c 50%, #14532d); box-shadow: 0 3px 12px rgba(20, 83, 45, .35); }
.anuncio > span:first-child::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #fff; margin-right: 10px; vertical-align: 1px; animation: anuncioLatido 1.2s ease-in-out infinite; }
.anuncio .cd { font-size: 21px; background: #fff; color: #7a1222; padding: 1px 9px; border-radius: 7px; }
.anuncio.es-senal .cd { color: #14532d; }
.anuncio a { background: #fff; color: #7a1222; text-decoration: none; padding: 4px 14px; border-radius: 8px; font-weight: 800; }
.anuncio.es-senal a { color: #14532d; }
.anuncio.urgente:not(.parpadea) { animation: anuncioUrgente 1.6s ease-in-out infinite; }
@keyframes anuncioLatido { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,.8); } 50% { box-shadow: 0 0 0 7px rgba(255,255,255,0); } }
@keyframes anuncioUrgente { 0%, 100% { filter: none; } 50% { filter: brightness(1.35) saturate(1.2); } }

/* Barra del próximo vencimiento sin abrir: parpadeo en tonos naranja */
.anuncio.parpadea { animation: anuncioNaranja 1s steps(1, end) infinite; box-shadow: 0 0 0 3px #ffb347 inset, 0 3px 14px rgba(230, 110, 0, .45); }
@keyframes anuncioNaranja { 0% { background: linear-gradient(90deg, #d95f00, #ff8c1a 50%, #d95f00); color: #fff; } 50% { background: #ffd08a; color: #7a3a00; } }
.anuncio.parpadea .cd, .anuncio.parpadea a { color: #b34d00; }
/* Barra lateral con un fondo suave */
:root:not([data-theme="dark"]) { --side: #f6f0ec; --side-active: #ecd9dd; }
:root:not([data-theme="dark"]) .side { background: #f6f0ec; border-right-color: #e8ddd7; }
:root:not([data-theme="dark"]) .nav a:hover, :root:not([data-theme="dark"]) .ng-h:hover, :root:not([data-theme="dark"]) .nav-plegar:hover { background: #ede3de; }
:root:not([data-theme="dark"]) .nav-group.fijo, :root:not([data-theme="dark"]) .side-foot { border-color: #e8ddd7; }

/* Barra lateral en granate intenso con letras blancas (en claro y en oscuro) */
.side, :root[data-theme="dark"] .side, :root:not([data-theme="dark"]) .side { background: linear-gradient(180deg, #8e1a2c 0%, #6e1222 100%); border-right: 0; }
.side .brand, .side .brand b, :root[data-theme="dark"] .side .brand { color: #fff; }
.side .brand small, :root[data-theme="dark"] .side .brand small { color: rgba(255, 255, 255, .78); }
.side .nav a, :root[data-theme="dark"] .side .nav a { color: #fff; }
.side .nav a .ico, :root[data-theme="dark"] .side .nav a .ico { color: rgba(255, 255, 255, .85); }
.side .nav a:hover, :root:not([data-theme="dark"]) .side .nav a:hover, :root[data-theme="dark"] .side .nav a:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.side .nav a:hover .ico { color: #fff; }
.side .nav a.active, :root[data-theme="dark"] .side .nav a.active { background: #fff; color: #8e1a2c; font-weight: 800; }
.side .nav a.active .ico, :root[data-theme="dark"] .side .nav a.active .ico { color: #8e1a2c; }
.side .nav-group > span, :root[data-theme="dark"] .side .nav-group > span, .side .ng-h { color: rgba(255, 255, 255, .8); }
.side .ng-h:hover, :root:not([data-theme="dark"]) .side .ng-h:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.side .nav a .badge { background: rgba(255, 255, 255, .22); color: #fff; }
.side .nav a .badge.red, .side .ng-h .badge.red { background: #ffb347; color: #5a2a00; }
.side .nav a.active .badge.red { background: #c42d45; color: #fff; }
.side .nav-group.fijo, .side .side-foot, :root:not([data-theme="dark"]) .side .nav-group.fijo, :root:not([data-theme="dark"]) .side .side-foot, body.nav-rail .side .nav-group { border-color: rgba(255, 255, 255, .18); }
.side .side-foot small { color: rgba(255, 255, 255, .7); }
.side .nav-plegar { color: rgba(255, 255, 255, .9); }
.side .nav-plegar:hover, :root:not([data-theme="dark"]) .side .nav-plegar:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.side::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .3); }

/* Barra del próximo vencimiento en NARANJA siempre (verde si lo próximo es un señalamiento).
   Parpadea en naranja mientras no se abra el aviso y, si quedan menos de 3 días, aunque ya se haya abierto */
.anuncio:not(.es-senal) { background: linear-gradient(90deg, #c45200, #f07c00 50%, #c45200); box-shadow: 0 3px 14px rgba(220, 100, 0, .45); }
.anuncio:not(.es-senal) .cd, .anuncio:not(.es-senal) a { color: #b34d00; }
.anuncio.parpadea, .anuncio.urgente { animation: anuncioNaranja 1s steps(1, end) infinite; box-shadow: 0 0 0 3px #ffb347 inset, 0 3px 14px rgba(230, 110, 0, .45); }
.anuncio.es-senal.urgente:not(.parpadea) { animation: anuncioVerde 1s steps(1, end) infinite; }
@keyframes anuncioVerde { 0% { background: linear-gradient(90deg, #14532d, #1f8a4c 50%, #14532d); color: #fff; } 50% { background: #ffb347; color: #5a2a00; } }
/* La barra es naranja también cuando lo próximo es un señalamiento */
.anuncio.es-senal { background: linear-gradient(90deg, #c45200, #f07c00 50%, #c45200); box-shadow: 0 3px 14px rgba(220, 100, 0, .45); }
.anuncio.es-senal .cd, .anuncio.es-senal a { color: #b34d00; }
.anuncio.es-senal.urgente:not(.parpadea), .anuncio.es-senal.parpadea { animation: anuncioNaranja 1s steps(1, end) infinite; }

/* Señalamientos y vencimientos MÁS MARCADOS: fondo de color claro pero intenso, borde de color alrededor,
   franja lateral gruesa, título en el color y etiqueta de tipo en relleno sólido */
.seg-it.v-senal, .ag-item.v-senal { background: #cfeedb; border: 2px solid #3fa66a; border-left: 8px solid #1d7a45; }
.seg-it.v-venc, .ag-item.v-venc { background: #f8d3db; border: 2px solid #c94a62; border-left: 8px solid #8e1a2c; }
.seg-it.v-senal .seg-t, .ag-item.v-senal b { color: #0f5130; }
.seg-it.v-venc .seg-t, .ag-item.v-venc b { color: #6e1222; }
.seg-it.v-senal .seg-tipo { background: #1d7a45; color: #fff; padding: 2px 8px; border-radius: 6px; }
.seg-it.v-venc .seg-tipo { background: #8e1a2c; color: #fff; padding: 2px 8px; border-radius: 6px; }
.seg-it.v-senal .seg-ic { background: #1d7a45; color: #fff; border-color: transparent; }
.seg-it.v-venc .seg-ic { background: #8e1a2c; color: #fff; border-color: transparent; }
tr.v-senal td { background: #cfeedb; } tr.v-senal td:first-child { box-shadow: inset 8px 0 0 #1d7a45; }
tr.v-venc td { background: #f8d3db; } tr.v-venc td:first-child { box-shadow: inset 8px 0 0 #8e1a2c; }
.t tr.v-senal:hover td { background: #bde6cd; } .t tr.v-venc:hover td { background: #f3c1cc; }
tr.v-senal td b, tr.v-senal td strong { color: #0f5130; } tr.v-venc td b, tr.v-venc td strong { color: #6e1222; }
.ag-item.v-senal:hover { background: #bde6cd; } .ag-item.v-venc:hover { background: #f3c1cc; }
.ev.v-senal { background: #1d7a45; color: #fff; border-left: 4px solid #0f5130; }
.ev.v-venc { background: #8e1a2c; color: #fff; border-left: 4px solid #5a0e1b; }
.seg-it.v-senal.hecho, .seg-it.v-venc.hecho { opacity: .6; }
:root[data-theme="dark"] .seg-it.v-senal, :root[data-theme="dark"] .ag-item.v-senal { background: #173d27; border: 2px solid #2f8f55; border-left: 8px solid #4cbf78; }
:root[data-theme="dark"] .seg-it.v-venc, :root[data-theme="dark"] .ag-item.v-venc { background: #4a1822; border: 2px solid #a8304a; border-left: 8px solid #e24a62; }
:root[data-theme="dark"] .seg-it.v-senal .seg-t, :root[data-theme="dark"] .ag-item.v-senal b { color: #b6f0cb; }
:root[data-theme="dark"] .seg-it.v-venc .seg-t, :root[data-theme="dark"] .ag-item.v-venc b { color: #ffc4cf; }
:root[data-theme="dark"] .seg-it.v-senal .seg-tipo, :root[data-theme="dark"] .seg-it.v-senal .seg-ic { background: #2f8f55; color: #fff; }
:root[data-theme="dark"] .seg-it.v-venc .seg-tipo, :root[data-theme="dark"] .seg-it.v-venc .seg-ic { background: #c42d45; color: #fff; }
:root[data-theme="dark"] tr.v-senal td { background: #173d27; } :root[data-theme="dark"] tr.v-venc td { background: #4a1822; }
:root[data-theme="dark"] tr.v-senal td:first-child { box-shadow: inset 8px 0 0 #4cbf78; } :root[data-theme="dark"] tr.v-venc td:first-child { box-shadow: inset 8px 0 0 #e24a62; }

/* Barra del próximo vencimiento en AZUL (siempre, sea vencimiento o señalamiento) y parpadeo más rápido */
.anuncio, .anuncio.es-senal, .anuncio:not(.es-senal) { background: linear-gradient(90deg, #0b3d91, #1f6fe0 50%, #0b3d91); color: #fff; box-shadow: 0 3px 14px rgba(15, 70, 170, .45); }
.anuncio .cd, .anuncio a, .anuncio.es-senal .cd, .anuncio.es-senal a, .anuncio:not(.es-senal) .cd, .anuncio:not(.es-senal) a, .anuncio.parpadea .cd, .anuncio.parpadea a { color: #0b3d91; }
.anuncio.parpadea, .anuncio.urgente, .anuncio.es-senal.parpadea, .anuncio.es-senal.urgente:not(.parpadea) { animation: anuncioAzul .6s steps(1, end) infinite; box-shadow: 0 0 0 3px #7fb2ff inset, 0 3px 14px rgba(15, 70, 170, .5); }
@keyframes anuncioAzul { 0% { background: linear-gradient(90deg, #0b3d91, #1f6fe0 50%, #0b3d91); color: #fff; } 50% { background: #a9cbff; color: #08306f; } }

/* Azul MÁS OSCURO y parpadeo aún más rápido */
.anuncio, .anuncio.es-senal, .anuncio:not(.es-senal) { background: linear-gradient(90deg, #031a40, #0a2f6b 50%, #031a40); box-shadow: 0 3px 14px rgba(3, 26, 64, .55); }
.anuncio .cd, .anuncio a, .anuncio.es-senal .cd, .anuncio.es-senal a, .anuncio:not(.es-senal) .cd, .anuncio:not(.es-senal) a, .anuncio.parpadea .cd, .anuncio.parpadea a { color: #031a40; }
.anuncio.parpadea, .anuncio.urgente, .anuncio.es-senal.parpadea, .anuncio.es-senal.urgente:not(.parpadea) { animation: anuncioAzulOscuro .35s steps(1, end) infinite; box-shadow: 0 0 0 3px #3b6fc4 inset, 0 3px 14px rgba(3, 26, 64, .6); }
@keyframes anuncioAzulOscuro { 0% { background: linear-gradient(90deg, #031a40, #0a2f6b 50%, #031a40); color: #fff; } 50% { background: #2f5fb3; color: #fff; } }

/* TODA la banda parpadea SIEMPRE y rápido (aunque ya se haya abierto el aviso) */
.anuncio, .anuncio.es-senal, .anuncio:not(.es-senal), .anuncio.parpadea, .anuncio.urgente, .anuncio.es-senal.parpadea, .anuncio.es-senal.urgente:not(.parpadea) { animation: anuncioAzulOscuro .25s steps(1, end) infinite !important; box-shadow: 0 0 0 3px #3b6fc4 inset, 0 3px 14px rgba(3, 26, 64, .6); }
.anuncio > span:first-child::before { animation-duration: .25s; }
@media (prefers-reduced-motion: reduce) { .anuncio { animation: anuncioAzulOscuro .25s steps(1, end) infinite !important; } }

/* Parpadea rápido SOLO mientras el usuario no haya abierto el aviso; al abrirlo queda fija en azul oscuro */
.anuncio, .anuncio.es-senal, .anuncio:not(.es-senal), .anuncio.urgente, .anuncio.es-senal.urgente:not(.parpadea) { animation: none !important; }
.anuncio.parpadea, .anuncio.es-senal.parpadea { animation: anuncioAzulOscuro .25s steps(1, end) infinite !important; }
.anuncio:not(.parpadea) > span:first-child::before { animation: none; }
.anuncio #anuncioVer { cursor: pointer; }

/* Azul aún más oscuro, parpadeo algo más pausado y botón «Ver» muy destacado */
.anuncio, .anuncio.es-senal, .anuncio:not(.es-senal) { background: linear-gradient(90deg, #010b1f, #041a3d 50%, #010b1f); box-shadow: 0 3px 14px rgba(1, 11, 31, .6); }
.anuncio.parpadea, .anuncio.es-senal.parpadea { animation: anuncioAzulNoche .5s steps(1, end) infinite !important; box-shadow: 0 0 0 3px #2a4f8f inset, 0 3px 14px rgba(1, 11, 31, .65); }
@keyframes anuncioAzulNoche { 0% { background: linear-gradient(90deg, #010b1f, #041a3d 50%, #010b1f); color: #fff; } 50% { background: #1b3f7a; color: #fff; } }
.anuncio .cd, .anuncio.es-senal .cd, .anuncio:not(.es-senal) .cd, .anuncio.parpadea .cd { color: #041a3d; }
.anuncio #anuncioVer, .anuncio.es-senal #anuncioVer, .anuncio:not(.es-senal) #anuncioVer, .anuncio.parpadea #anuncioVer {
  background: #ffd23f; color: #041a3d; font-size: 16px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em;
  padding: 6px 22px; border-radius: 10px; border: 2px solid #fff; box-shadow: 0 0 0 3px rgba(255, 210, 63, .45), 0 3px 10px rgba(0, 0, 0, .4); margin-left: auto; }
.anuncio #anuncioVer:hover { background: #fff; transform: scale(1.06); }
.anuncio #anuncioVer::before { content: '👁 '; }

/* Cuenta atrás (días, horas, minutos) bien legible: cajita blanca con números azul oscuro, también al parpadear */
.anuncio .cd, .anuncio.parpadea .cd, .anuncio.es-senal .cd, .anuncio:not(.es-senal) .cd { background: #fff !important; color: #041a3d !important; font-weight: 800; padding: 1px 10px; border-radius: 7px; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
/* «VER» junto a la cuenta atrás, sin salirse de la pantalla */
.anuncio #anuncioVer, .anuncio.es-senal #anuncioVer, .anuncio:not(.es-senal) #anuncioVer, .anuncio.parpadea #anuncioVer { margin-left: 8px; padding: 4px 18px; font-size: 15px; }

/* ===== Banda partida en dos: vencimiento (granate) | señalamiento (verde); cada mitad parpadea hasta pulsar su «Ver» ===== */
#anuncio.anuncio-doble { display: flex; flex-wrap: wrap; gap: 0; padding: 0; background: none !important; box-shadow: 0 3px 12px rgba(0, 0, 0, .35); animation: none !important; color: #fff; }
#anuncio.anuncio-doble:empty { display: none; }
.anu-mitad { flex: 1 1 420px; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 9px 14px; font-size: 14.5px; font-weight: 700; color: #fff; }
.anu-mitad .anu-txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.anu-mitad .anu-cds { display: flex; gap: 5px; flex-shrink: 0; }
.anu-venc { background: linear-gradient(90deg, #6e1222, #8e1a2c); border-right: 2px solid rgba(255, 255, 255, .5); }
.anu-senal { background: linear-gradient(90deg, #1d7a45, #145c33); }
.anu-venc.parpadea { animation: anuVencParp .5s steps(1, end) infinite; }
.anu-senal.parpadea { animation: anuSenalParp .5s steps(1, end) infinite; }
@keyframes anuVencParp { 0% { background: linear-gradient(90deg, #6e1222, #8e1a2c); } 50% { background: #d9566e; } }
@keyframes anuSenalParp { 0% { background: linear-gradient(90deg, #1d7a45, #145c33); } 50% { background: #4fc283; } }
.anu-vacia { opacity: .75; font-weight: 600; }
#anuncio.anuncio-doble .cd { background: #fff !important; font-weight: 800; padding: 1px 9px; border-radius: 7px; font-size: 17px; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
#anuncio .anu-venc .cd { color: #6e1222 !important; }
#anuncio .anu-senal .cd { color: #145c33 !important; }
#anuncio .anu-ver { flex-shrink: 0; background: #ffd23f; color: #1a1a1a; font-size: 15px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; text-decoration: none; padding: 4px 16px; border-radius: 10px; border: 2px solid #fff; box-shadow: 0 0 0 3px rgba(255, 210, 63, .45), 0 3px 10px rgba(0, 0, 0, .4); cursor: pointer; }
#anuncio .anu-ver::before { content: '👁 '; }
#anuncio .anu-ver:hover { background: #fff; transform: scale(1.06); }
@media (max-width: 900px) { .anu-venc { border-right: 0; border-bottom: 2px solid rgba(255, 255, 255, .5); } }
/* Parpadeo de las dos mitades algo más lento */
.anu-venc.parpadea { animation-duration: 1.2s; }
.anu-senal.parpadea { animation-duration: 1.2s; }

/* Buscador encima de los desplegables largos */
.bsel { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.bsel[hidden] { display: none !important; }
.bsel .bsel-q { flex: 1; min-width: 140px; height: 32px; padding: 4px 10px; font-size: 13.5px; border: 1.5px solid #c94a62; border-radius: 8px; background: var(--surface, #fff); color: inherit; }
.bsel .bsel-q:focus { outline: none; border-color: #8e1a2c; box-shadow: 0 0 0 3px rgba(201, 74, 98, .22); }
.bsel .bsel-n { font-size: 12px; color: var(--muted, #777); white-space: nowrap; }
.bsel .bsel-n.mal { color: #c0392b; font-weight: 700; }
.row > .bsel, .toolbar .bsel { margin-bottom: 0; flex: 0 1 220px; }
.row > .bsel .bsel-n, .toolbar .bsel .bsel-n { display: none; }

/* ===== Autocompletado de desplegables (sustituye al buscador anterior) ===== */
select.bsel-oculto { display: none !important; }
.bsel { position: relative; display: flex; align-items: center; margin: 0; width: 100%; gap: 0; }
.bsel.bsel-barra { width: auto; flex: 0 1 260px; min-width: 190px; }
.bsel .bsel-q { flex: 1; width: 100%; min-width: 0; height: 38px; padding: 6px 30px 6px 12px; font-size: 14px; border: 1.5px solid var(--border, #ccc); border-radius: 9px; background: var(--surface, #fff); color: inherit; text-overflow: ellipsis; }
.bsel.bsel-barra .bsel-q { height: 34px; font-size: 13.5px; }
.bsel .bsel-q:focus, .bsel.abierta .bsel-q { outline: none; border-color: #8e1a2c; box-shadow: 0 0 0 3px rgba(201, 74, 98, .22); }
.bsel .bsel-flecha { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 12px; opacity: .65; cursor: pointer; user-select: none; }
.bsel-lista { position: fixed; z-index: 10050; overflow: auto; background: var(--surface, #fff); color: var(--text, #222); border: 1.5px solid #8e1a2c; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .28); padding: 4px; font-size: 14px; }
.bsel-lista .bsel-op { padding: 7px 10px; border-radius: 7px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bsel-lista .bsel-op.on { background: #8e1a2c; color: #fff; }
.bsel-lista .bsel-op.elegida:not(.on) { font-weight: 700; }
.bsel-lista .bsel-op.vacia { font-style: italic; opacity: .8; }
.bsel-lista mark { background: #ffd23f; color: #1a1a1a; border-radius: 3px; padding: 0 1px; }
.bsel-lista .bsel-op.on mark { background: #ffe58a; }
.bsel-lista .bsel-cuenta { font-size: 12px; opacity: .7; padding: 3px 10px 5px; }
.bsel-lista .bsel-nada, .bsel-lista .bsel-mas { padding: 8px 10px; font-size: 13px; opacity: .7; }
[data-theme="dark"] .bsel-lista { background: #1f1f23; color: #eee; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bsel-lista { background: #1f1f23; color: #eee; } }

/* Revisión en tabla */
.rt-tabla td.rt-celda { cursor: pointer; vertical-align: top; font-size: 13.5px; max-width: 320px; }
.rt-tabla td.rt-celda:hover { outline: 2px solid #8e1a2c; outline-offset: -2px; }
.rt-alta { background: rgba(31, 138, 76, .12); }
.rt-media { background: rgba(240, 160, 0, .16); }
.rt-baja { background: rgba(201, 74, 98, .16); }
.rt-tabla td.rt-nc { color: var(--muted, #888); font-style: italic; }
.rt-ley { display: inline-block; padding: 1px 8px; border-radius: 6px; margin: 0 3px; }

/* El botón para contraer/ampliar la barra lateral queda SIEMPRE visible abajo, aunque el menú sea largo */
.side .side-foot { position: sticky; bottom: 0; z-index: 3; background: #6e1222; }
body.nav-rail .side .side-foot { padding: 10px 6px; }
body.nav-rail #navPlegar { justify-content: center; background: rgba(255, 255, 255, .16); }

/* Colores de los expedientes (Configuración › Colores de los expedientes) */
tr.exp-color > td:first-child { box-shadow: inset 6px 0 0 var(--exp-color); padding-left: 16px; }
tr.exp-color > td { background: var(--exp-tinte); }
tr.exp-color:hover > td { background: color-mix(in srgb, var(--exp-color) 16%, transparent); }
.ce-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; }
.ce-it { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); cursor: pointer; }
.ce-it input[type=color] { width: 34px; height: 26px; padding: 0; border: 0; background: none; cursor: pointer; flex-shrink: 0; }
.ce-it span:nth-child(2) { flex: 1; font-weight: 600; font-size: 13.5px; }

/* ===== Contratos con IA: control de cambios y semáforo ===== */
.rl-doc { line-height: 1.6; font-family: Georgia, serif; font-size: 14.5px; max-height: 70vh; overflow: auto; }
.rl-doc p { margin: 0 0 10px; }
.rl-del { color: #b91c1c; text-decoration: line-through; background: rgba(185, 28, 28, .08); }
.rl-ins { color: #1d4ed8; text-decoration: underline; background: rgba(29, 78, 216, .08); }
.rl-cambio { border-left: 3px solid #e07b00; padding-left: 8px; }
.rl-num { display: inline-block; min-width: 22px; font: 600 11px system-ui, sans-serif; color: #fff; background: #e07b00; border-radius: 10px; text-align: center; margin-right: 6px; padding: 1px 5px; }
.rl-it { padding: 6px 0; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 13px; }
.rl-it:hover { background: rgba(0, 0, 0, .03); }
.pill.falta { background: rgba(124, 58, 237, .12); color: #7c3aed; border-color: transparent; }
.ct-tabla td { vertical-align: top; }
.ct-tabla tr.ct-riesgo > td:first-child { box-shadow: inset 4px 0 0 #c0392b; }
.ct-tabla tr.ct-desviacion > td:first-child { box-shadow: inset 4px 0 0 #e07b00; }
.ct-tabla tr.ct-falta > td:first-child { box-shadow: inset 4px 0 0 #7c3aed; }
.ct-tabla tr.ct-conforme > td:first-child { box-shadow: inset 4px 0 0 #16a34a; }
.ct-tabla [contenteditable]:hover, .ct-tabla [contenteditable]:focus { outline: 1px dashed var(--accent); background: rgba(29, 78, 216, .04); }
.vig-nueva { border-left: 4px solid var(--accent); }
.vig-ia { background: rgba(0, 0, 0, .03); border-radius: 8px; padding: 10px 12px; margin-top: 6px; }

/* ===== Acciones de una actuación (documento, email, asociar) ===== */
.aa-op { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 14px; cursor: pointer; border: 1px solid var(--border); background: var(--card, #fff); font: inherit; color: inherit; margin: 0; }
.aa-op:hover:not([disabled]) { border-color: var(--accent); box-shadow: 0 2px 10px rgba(0, 0, 0, .08); }
.aa-op[disabled] { opacity: .5; cursor: not-allowed; }
.aa-ic { font-size: 26px; line-height: 1; }

/* ===== Editor de materias vigiladas ===== */
.vg-temas { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 6px; }
.vg-tema { border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; }
.vg-tema.on { border-color: var(--accent); background: rgba(158, 31, 50, .05); }
.vg-det { margin-top: 6px; }
