/* ===== CRIL Help Desk · estilo pastel ===== */
:root {
    --fondo: #f6f4fb;
    --tarjeta: #ffffff;
    --texto: #2e2a3d;
    --suave: #7c7891;
    --borde: #ebe7f3;
    --primario: #7c6cf0;
    --primario-osc: #6353e0;
    --primario-claro: #ece9ff;
    --peligro: #e05570;
    --radio: 16px;
    --sombra: 0 2px 10px rgba(80, 60, 140, .06);
    --sombra-hover: 0 6px 20px rgba(80, 60, 140, .13);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    font-size: 15px;
    background: var(--fondo);
    color: var(--texto);
}
a { color: var(--primario); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 1.2rem; font-weight: 700; }
h2 { font-size: 1.05rem; margin: 0 0 .9rem; font-weight: 700; }
.suave { color: var(--suave); font-weight: normal; }
.peque { font-size: .82rem; }

/* ===== Barra superior ===== */
.barra {
    display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap;
    background: linear-gradient(100deg, #e4e0ff 0%, #fde2ec 55%, #ffe9d6 100%);
    padding: .7rem 1.5rem; position: sticky; top: 0; z-index: 10;
    box-shadow: 0 2px 12px rgba(120, 90, 180, .12);
}
.marca { font-weight: 800; color: var(--texto) !important; font-size: 1.15rem; display: flex; align-items: center; gap: .4rem; }
.marca:hover { text-decoration: none; }
.logo { background: #fff; border-radius: 12px; width: 36px; height: 36px; display: grid; place-items: center; box-shadow: var(--sombra); }
.barra nav { display: flex; gap: .3rem; flex: 1; flex-wrap: wrap; }
.barra nav a { color: var(--texto); padding: .45rem .8rem; border-radius: 99px; font-weight: 600; font-size: .92rem; }
.barra nav a:hover { background: rgba(255,255,255,.6); text-decoration: none; }
.barra nav a.activo { background: #fff; box-shadow: var(--sombra); }
.crear { display: flex; gap: .5rem; }
.quien { display: flex; align-items: center; gap: .6rem; }
.salir { color: var(--suave); font-size: .88rem; }

.avatar {
    width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center;
    background: var(--primario); color: #fff !important; font-weight: 700; flex-shrink: 0;
}
.avatar:hover { text-decoration: none; filter: brightness(1.1); }
.avatar.peq { width: 22px; height: 22px; font-size: .72rem; vertical-align: middle; }

.contenido { max-width: 1320px; margin: 0 auto; padding: 1.6rem 1.5rem 3rem; }
.centrado {
    min-height: 100vh; display: grid; place-items: center; padding: 1rem;
    background: linear-gradient(135deg, #e4e0ff 0%, #fde2ec 50%, #d3f5e4 100%);
}

/* ===== Tarjetas y rejillas ===== */
.tarjeta {
    background: var(--tarjeta); border: 1px solid var(--borde);
    border-radius: var(--radio); padding: 1.3rem; margin-bottom: 1.2rem; box-shadow: var(--sombra);
}
.rejilla-2 { display: grid; grid-template-columns: 1fr 360px; gap: 1.2rem; align-items: start; }
.rejilla-2.item { grid-template-columns: 1fr 340px; }

/* ===== Formularios ===== */
.formulario { display: flex; flex-direction: column; gap: 1rem; }
.formulario.estrecho { width: 100%; max-width: 420px; }
.formulario.ancho { max-width: 900px; margin-inline: auto; }
label { display: flex; flex-direction: column; gap: .35rem; font-weight: 600; font-size: .9rem; flex: 1; }
label.check { flex-direction: row; align-items: center; font-weight: normal; }
input, select, textarea {
    font: inherit; padding: .6rem .75rem; border: 1.5px solid var(--borde);
    border-radius: 10px; background: #fcfbff; font-weight: normal; color: var(--texto);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primario); box-shadow: 0 0 0 3px var(--primario-claro); background: #fff; }
textarea { resize: vertical; }
.fila { display: flex; gap: 1rem; flex-wrap: wrap; }
.botones { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

.grupo { display: flex; flex-direction: column; gap: .4rem; }
.grupo-titulo { font-weight: 600; font-size: .9rem; }

/* Píldoras de selección (tipo, servicio, prioridad, estado) */
.pildoras { display: flex; flex-wrap: wrap; gap: .45rem; }
.pildora { flex: none; cursor: pointer; font-weight: 600; background: transparent !important; }
.pildora input { position: absolute; opacity: 0; pointer-events: none; }
.pildora span {
    display: inline-block; padding: .45rem .9rem; border-radius: 99px; font-size: .88rem;
    background: var(--p-fondo, #f1eff7); color: var(--p-texto, var(--texto));
    border: 2px solid transparent; opacity: .55; transition: all .12s;
}
.pildora:hover span { opacity: .85; }
.pildora input:checked + span { opacity: 1; border-color: currentColor; box-shadow: 0 2px 8px rgba(0,0,0,.08); transform: translateY(-1px); }
.pildora input:focus-visible + span { outline: 3px solid var(--primario-claro); }
.tipo-incidencia span { --p-fondo: #fde2ec; --p-texto: #9d174d; }
.tipo-tarea span      { --p-fondo: #d8ecfb; --p-texto: #075985; }
.prioridad-baja span    { --p-fondo: #d3f5e4; --p-texto: #166534; }
.prioridad-media span   { --p-fondo: #fdf3c4; --p-texto: #854d0e; }
.prioridad-alta span    { --p-fondo: #ffe5d0; --p-texto: #9a3412; }
.prioridad-critica span { --p-fondo: #ffd4d4; --p-texto: #991b1b; }
.estado-pendiente span { --p-fondo: #fdf3c4; --p-texto: #854d0e; }
.estado-en_curso span  { --p-fondo: #d8ecfb; --p-texto: #075985; }
.estado-en_espera span { --p-fondo: #e6e1fb; --p-texto: #4c1d95; }
.estado-resuelto span  { --p-fondo: #d3f5e4; --p-texto: #166534; }

.caja { border: 1.5px dashed #d9d3ec; border-radius: 12px; padding: 1rem; margin: 0; display: flex; flex-direction: column; gap: .8rem; }
.caja legend { font-weight: 700; padding: 0 .4rem; }
.caja-correo { background: #fbf9ff; }

/* ===== Botones ===== */
.btn {
    display: inline-block; background: var(--primario); color: #fff; border: 0;
    padding: .6rem 1.1rem; border-radius: 99px; font: inherit; font-weight: 700; cursor: pointer;
    box-shadow: 0 2px 8px rgba(124, 108, 240, .3); transition: all .12s; white-space: nowrap;
}
.btn:hover { background: var(--primario-osc); text-decoration: none; transform: translateY(-1px); }
.btn-sec { background: #fff; color: var(--texto); box-shadow: var(--sombra); border: 1px solid var(--borde); }
.btn-sec:hover { background: #f4f2fa; }
.btn-incidencia { background: #f9a8c1; color: #6b0f33; box-shadow: none; font-size: .88rem; }
.btn-incidencia:hover { background: #f78fb0; }
.btn-tarea { background: #a9d8f7; color: #0b3f63; box-shadow: none; font-size: .88rem; }
.btn-tarea:hover { background: #8fcbf3; }
.btn-correo { background: #fff; color: var(--primario); border: 1.5px solid var(--primario); box-shadow: none; width: 100%; text-align: center; margin-top: .8rem; }
.btn-correo:hover { background: var(--primario-claro); }
.btn-peligro { background: #fff; color: var(--peligro); border: 1.5px solid #f5c2cc; width: 100%; box-shadow: none; }
.btn-peligro:hover { background: #ffe8ec; }
.btn-mini {
    font: inherit; font-size: .8rem; padding: .3rem .65rem; border: 1px solid var(--borde);
    background: #fff; border-radius: 99px; cursor: pointer; white-space: nowrap;
}
.btn-mini:hover { background: var(--primario-claro); }

/* ===== Avisos ===== */
.aviso { padding: .8rem 1.1rem; border-radius: 12px; margin-bottom: 1.2rem; font-weight: 600; }
.aviso-ok { background: #d3f5e4; color: #166534; }
.aviso-error { background: #ffe0e5; color: #991b1b; }

/* ===== Etiquetas ===== */
.chips { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
.etq { display: inline-block; font-size: .76rem; font-weight: 700; padding: .2rem .6rem; border-radius: 99px; white-space: nowrap; }
.estado-pendiente { background: #fdf3c4; color: #854d0e; }
.estado-en_curso  { background: #d8ecfb; color: #075985; }
.estado-en_espera { background: #e6e1fb; color: #4c1d95; }
.estado-resuelto  { background: #d3f5e4; color: #166534; }
.prio-baja    { background: #edf9f2; color: #166534; }
.prio-media   { background: #fefae6; color: #854d0e; }
.prio-alta    { background: #ffeee0; color: #9a3412; }
.prio-critica { background: #ffd4d4; color: #991b1b; animation: latido 2s infinite; }
@keyframes latido { 50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, .15); } }
.tipo-incidencia { background: #fde2ec; color: #9d174d; }
.tipo-tarea      { background: #d8ecfb; color: #075985; }
.vencida { color: var(--peligro); font-weight: 700; }
.vencida-etq { background: #ffd4d4; color: #991b1b; }
.num-ticket { color: var(--suave); font-weight: 700; font-variant-numeric: tabular-nums; }
.ficha .num-ticket { margin-left: auto; }
.ref-item { background: var(--primario-claro); padding: 0 .35rem; border-radius: 6px; font-weight: 600; }

/* ===== Panel: estadísticas ===== */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: .9rem; margin-bottom: 1rem; }
.stat {
    border-radius: var(--radio); padding: 1rem 1.1rem; display: grid;
    grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: .7rem; align-items: center;
    box-shadow: var(--sombra); transition: all .15s;
}
.stat:hover { text-decoration: none; transform: translateY(-3px); box-shadow: var(--sombra-hover); }
.stat-icono { grid-row: span 2; font-size: 1.9rem; background: rgba(255,255,255,.65); width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; }
.stat .num { font-size: 1.9rem; font-weight: 800; line-height: 1; }
.stat-txt { font-size: .85rem; font-weight: 600; opacity: .85; }

.servicios-resumen { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.4rem; }
.servicio-chip { padding: .4rem .85rem; border-radius: 99px; font-weight: 600; font-size: .88rem; box-shadow: var(--sombra); }
.servicio-chip b { background: rgba(255,255,255,.7); border-radius: 99px; padding: 0 .45rem; margin-left: .2rem; }
.servicio-chip.cero { opacity: .55; }
.servicio-chip:hover { text-decoration: none; filter: brightness(.97); }

/* ===== Panel: tablero ===== */
.tablero { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; margin-bottom: 1.4rem; }
.columna { border-radius: var(--radio); padding: .9rem; min-height: 150px; }
.columna-pendiente { background: #fdf6d8; }
.columna-en_curso  { background: #e3f1fc; }
.columna-en_espera { background: #ede9fc; }
.columna h2 { display: flex; align-items: center; gap: .4rem; }
.contador { margin-left: auto; background: #fff; border-radius: 99px; padding: .1rem .6rem; font-size: .85rem; }
.ficha {
    display: flex; flex-direction: column; gap: .45rem; background: #fff; color: var(--texto);
    border-radius: 12px; padding: .8rem .9rem; margin-bottom: .7rem; border-left: 5px solid #e5e7eb;
    box-shadow: var(--sombra); transition: all .15s;
}
.ficha:hover { text-decoration: none; box-shadow: var(--sombra-hover); transform: translateY(-2px); }
.ficha strong { line-height: 1.3; }
.ficha-pie { font-size: .8rem; color: var(--suave); }
.prio-borde-critica { border-left-color: #f87171; }
.prio-borde-alta    { border-left-color: #fdba74; }
.prio-borde-media   { border-left-color: #fde68a; }
.prio-borde-baja    { border-left-color: #a7e3c4; }
.vacio { text-align: center; padding: 1.2rem; color: var(--suave); }

/* ===== Actividad ===== */
.actividad { list-style: none; margin: 0; padding: 0; }
.actividad li { padding: .55rem 0; border-bottom: 1px solid var(--borde); display: flex; gap: .6rem; align-items: center; }
.actividad li:last-child { border: 0; }
.cuando { margin-left: auto; white-space: nowrap; font-size: .82rem; }

/* ===== Listado ===== */
.filtros { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.filtros input[type=search] { flex: 1; min-width: 260px; }
.lista { display: flex; flex-direction: column; gap: .6rem; }
.fila-item {
    display: flex; gap: 1rem; align-items: center; background: #fff; color: var(--texto);
    padding: .85rem 1.1rem; border-radius: 14px; border-left: 5px solid #e5e7eb; box-shadow: var(--sombra); transition: all .15s;
}
.fila-item:hover { text-decoration: none; box-shadow: var(--sombra-hover); transform: translateX(3px); }
.fila-item.hecho { opacity: .6; }
.fila-item .num-ticket { font-size: 1.1rem; min-width: 3ch; }
.fila-item-cuerpo { flex: 1; display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.titulo-item { font-size: 1.02rem; }

/* ===== Tablas (usuarios) ===== */
.tabla { width: 100%; border-collapse: collapse; }
.tabla th { text-align: left; font-size: .78rem; color: var(--suave); text-transform: uppercase; padding: .5rem; border-bottom: 2px solid var(--borde); }
.tabla td { padding: .65rem .5rem; border-bottom: 1px solid var(--borde); vertical-align: top; }
.tabla tr.inactivo, .inactivo { opacity: .5; }
.acciones form { display: flex; gap: .3rem; margin-bottom: .3rem; }
.acciones input { padding: .25rem .5rem; font-size: .8rem; width: 150px; }

/* ===== Servicios ===== */
.fila-servicio { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .8rem 0; border-bottom: 1px solid var(--borde); }
.fila-servicio:last-child { border: 0; }
.fila-servicio .previa { width: 100%; display: flex; gap: .6rem; align-items: center; }
.fila-servicio input[name=nombre] { flex: 1; min-width: 150px; }
.campo-icono { width: 60px; text-align: center; font-size: 1.1rem; }
.paleta { display: flex; gap: .3rem; flex-wrap: wrap; }
.muestra { width: 26px; height: 26px; border-radius: 50%; cursor: pointer; flex: none; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--borde); }
.muestra input { position: absolute; opacity: 0; pointer-events: none; }
.muestra:has(input:checked) { box-shadow: 0 0 0 2.5px var(--primario); }

/* ===== Ficha de item ===== */
.cab-item { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.cab-item h1 { margin: .6rem 0 0; }
.tipo-fondo-incidencia { background: linear-gradient(100deg, #fff 60%, #fde2ec); }
.tipo-fondo-tarea { background: linear-gradient(100deg, #fff 60%, #d8ecfb); }
.texto { line-height: 1.6; overflow-wrap: anywhere; }
.datos { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: .55rem 1rem; font-size: .9rem; }
.datos dt { color: var(--suave); }
.datos dd { margin: 0; overflow-wrap: anywhere; }

.estados-rapidos { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.estado-btn {
    font: inherit; font-weight: 700; font-size: .88rem; padding: .6rem; border-radius: 12px;
    border: 2px solid transparent; cursor: pointer; opacity: .6; transition: all .12s;
}
.estado-btn:hover { opacity: 1; }
.estado-btn.actual { opacity: 1; border-color: currentColor; box-shadow: 0 2px 8px rgba(0,0,0,.08); }

.historial { list-style: none; padding: 0; margin: 0 0 1rem; }
.historial li.sistema { font-size: .85rem; color: var(--suave); display: flex; gap: .5rem; align-items: center; padding: .35rem 0; }
.historial li.sistema strong { color: var(--texto); }
.punto { width: 9px; height: 9px; border-radius: 50%; background: #d9d3ec; flex-shrink: 0; }
.historial li.comentario { background: #f8f6fe; border-radius: 14px; padding: .8rem 1rem; margin: .6rem 0; line-height: 1.5; overflow-wrap: anywhere; }
.historial .meta { display: flex; gap: .5rem; align-items: center; margin-bottom: .35rem; }

@media (max-width: 1000px) {
    .rejilla-2, .rejilla-2.item, .tablero { grid-template-columns: 1fr; }
    .cab-item { flex-direction: column; align-items: flex-start; }
    .crear { order: 3; width: 100%; }
}
