/* ─────────────────────────────────────────────────────────────
   panel.css — estilos compartidos del panel SEG.
   Estructura original + paleta, tipografías y botones del DS.
   ───────────────────────────────────────────────────────────── */
:root {
  /* ── Paleta DS ── */
  --azul-oscuro: #002060;
  --azul:        #2762A6;
  --azul-medio:  #1E4E86;
  --azul-vivido: #007DFF;
  --azul-claro:  #A6CFF7;
  --grad-a:      #5DB9E6;
  --grad-b:      #004AAD;
  --gray100:     #e6ebf2;
  --gray300:     #bcc7d8;
  --gray500:     #67748f;
  --text:        #002060;
  --red:         #c0392b;
  --amarillo:    #FCBC22;
  --verde:       #63BA31;
  --teal1:       #0097B2;

  /* ── Tipografías DS ── */
  --ff-t: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --ff-b: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  /* ── Aliases legacy → DS (para no romper reglas antiguas) ── */
  --blue-900: var(--azul-oscuro);
  --blue-700: var(--azul);
  --blue-500: var(--azul-vivido);
  --blue-400: #4B7BBF;
  --blue-200: var(--azul-claro);
  --blue-100: #dceaf6;
  --blue-50:  #eef5fe;
  --gray-50:  #f5f8fd;
  --gray-100: var(--gray100);
  --gray-200: var(--gray300);
  --gray-400: var(--gray500);
  --gray-500: var(--gray500);
  --gray-600: #3A4456;
  --gray-700: #2c3444;
  --gray-900: #1A2033;
  --error: var(--red); --error-bg: #fdf0ef;
  --success: #2e7d12; --success-bg: #e9f7e0;
  --warn: #946b07; --warn-bg: #FEF3C7;
}
* { box-sizing: border-box; margin: 0; padding: 0 }
body { font-family: var(--ff-b); color: var(--gray-600); background: var(--gray-50); -webkit-font-smoothing: antialiased }
a { color: var(--azul); text-decoration: none }
a:hover { text-decoration: underline }

/* Iconos Flaticon Uicons (regular rounded). */
.fi { display: inline-flex; line-height: 1; vertical-align: middle }

/* Header */
.site-header { background: linear-gradient(135deg, var(--azul) 0%, var(--azul-oscuro) 100%); padding: 0 28px; height: 64px; display: flex; align-items: center;
  justify-content: space-between; box-shadow: 0 2px 12px rgba(0, 18, 51, .18) }
.site-header .brand { display: flex; align-items: center }
.site-header img { height: 34px }
.site-header .title-area { margin-left: 18px; border-left: 1px solid rgba(255, 255, 255, .25); padding-left: 18px }
.site-header .title-area h1 { font-family: var(--ff-t); font-size: 15px; font-weight: 800; color: #fff; line-height: 1.2 }
.site-header .title-area span { font-size: 11px; color: var(--azul-claro) }
.site-header .user-box { display: flex; align-items: center; gap: 12px; color: #fff; font-size: 13px }

/* Layout */
.shell { max-width: 1180px; margin: 28px auto; padding: 0 24px }
.crumbs { font-size: 13px; color: var(--gray-400); margin-bottom: 14px }
.sec-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap }
.sec-head h2 { font-family: var(--ff-t); font-size: 19px; font-weight: 900; color: var(--azul-oscuro) }

/* Buttons — estilo DS: primario en degradado, secundarios con contorno. */
.btn { font-family: var(--ff-b); font-size: 13px; font-weight: 700; letter-spacing: .2px; border-radius: 10px;
  padding: 10px 18px; border: none; cursor: pointer; transition: transform .15s, box-shadow .15s, background .2s;
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none; white-space: nowrap }
.btn-primary { background: linear-gradient(135deg, var(--azul) 0%, var(--azul-oscuro) 100%); color: #fff;
  box-shadow: 0 3px 10px rgba(0, 18, 51, .2) }
.btn-primary:hover { background: linear-gradient(135deg, var(--azul-vivido) 0%, var(--grad-b) 100%);
  transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 74, 173, .3); text-decoration: none }
.btn-ghost, .btn-ok, .btn-ver { background: #fff; border: 1.5px solid var(--azul); color: var(--azul); font-weight: 700 }
.btn-ghost:hover, .btn-ok:hover, .btn-ver:hover { background: #f5f8fd; border-color: var(--azul-oscuro); color: var(--azul-oscuro); text-decoration: none }
.btn-danger { background: var(--red); color: #fff; box-shadow: 0 3px 10px rgba(192, 57, 43, .2) }
.btn-danger:hover { background: #8b2a22; text-decoration: none }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px }
.btn:disabled { opacity: .55; cursor: not-allowed; pointer-events: none }

/* Forms */
.input, .sel { width: 100%; font-family: inherit; font-size: 14px; color: var(--text);
  border: 1.5px solid var(--gray300); border-radius: 10px; padding: 9px 11px; background: #fff;
  transition: border-color .2s, box-shadow .2s }
.input:focus, .sel:focus { outline: none; border-color: var(--azul-vivido); box-shadow: 0 0 0 3px rgba(0, 125, 255, .16) }
label { font-size: 12px; font-weight: 700; color: var(--azul-oscuro); display: block; margin-bottom: 5px }
textarea.input { resize: vertical; min-height: 84px }
.field { margin-bottom: 14px }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px }

/* Cards */
.card { background: #fff; border-radius: 12px; box-shadow: 0 1px 4px rgba(0, 18, 51, .06);
  border: 1px solid var(--gray100); padding: 22px; margin-bottom: 20px }
.card h3 { font-family: var(--ff-t); font-size: 15px; font-weight: 900; color: var(--azul-oscuro); margin-bottom: 14px;
  text-transform: uppercase; letter-spacing: .03em }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 13px }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--gray-400);
  padding: 10px 12px; border-bottom: 2px solid var(--gray100); white-space: nowrap }
td { padding: 11px 12px; border-bottom: 1px solid var(--gray100); color: var(--text); vertical-align: middle }
tbody tr:hover td { background: var(--gray-50) }

/* Campana de notificación en el header (microcredenciales por dictaminar). */
.notif-bell { position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px; margin-right: 12px; font-size: 18px;
  color: #fff; background: rgba(255, 255, 255, .12); text-decoration: none; transition: background .15s }
.notif-bell:hover { background: rgba(255, 255, 255, .24) }
.notif-count { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 800; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--azul-oscuro) }
.notif-count[hidden] { display: none }
/* Campana con panel desplegable (COEPES). */
.notif-wrap { position: relative; display: inline-flex; margin-right: 12px }
.notif-wrap .notif-bell { margin-right: 0; border: none; cursor: pointer; font-family: inherit }
.notif-panel { position: absolute; right: 0; top: 46px; width: 340px; max-width: 86vw; background: #fff;
  border: 1px solid var(--gray100); border-radius: 12px; box-shadow: 0 14px 40px rgba(0, 18, 51, .18);
  z-index: 50; overflow: hidden; max-height: 70vh; overflow-y: auto }
.notif-panel[hidden] { display: none }
.notif-panel-head { font-weight: 800; font-size: 13px; color: var(--azul-oscuro); padding: 12px 14px;
  border-bottom: 1px solid var(--gray100); position: sticky; top: 0; background: #fff }
.notif-item { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--gray100); text-decoration: none; color: var(--text) }
.notif-item:hover { background: var(--blue-50) }
.notif-item b { font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }

/* Notificaciones COEPES como acordeón: cada categoría se contrae/expande.
   El contenedor de la lista lleva un margen interno para separar las tarjetas. */
#coepesNotifList { padding: 10px }
.notif-acc { border: 1px solid var(--gray100); border-radius: 10px; overflow: hidden;
  background: #fff; margin-bottom: 10px }
.notif-acc:last-child { margin-bottom: 0 }
.notif-acc-head { width: 100%; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 10px 12px; background: #f5f8fd; border: none; cursor: pointer;
  font-family: inherit; text-align: left; transition: background .15s }
.notif-acc-head:hover { background: #eef2f8 }
.notif-acc-title { font-size: 12.5px; font-weight: 800; display: inline-flex; align-items: center; gap: 6px }
.notif-acc-right { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0 }
.notif-acc-count { background: var(--gray100); color: var(--gray500); font-size: 11px; font-weight: 800;
  border-radius: 20px; padding: 1px 8px; min-width: 22px; text-align: center }
.notif-acc-chev { font-size: 10px; color: var(--gray500); transition: transform .2s }
.notif-acc.open .notif-acc-chev { transform: rotate(180deg) }
.notif-acc-body { display: none; padding: 2px 12px 6px }
.notif-acc.open .notif-acc-body { display: block }
.notif-acc-body .notif-item { padding: 8px 0; border-bottom: 1px solid var(--gray100) }
.notif-acc-body .notif-item:last-child { border-bottom: none }
.notif-acc-body .notif-item:hover { background: transparent; opacity: .75 }

/* Títulos y subtítulos al estilo del formulario (solicitud-nueva). */
.sec-title {
  font-family: var(--ff-t); font-size: 17px; font-weight: 900; color: #fff; background: var(--azul);
  padding: 12px 18px; border-radius: 6px; letter-spacing: .02em; margin: 0 0 12px;
  box-shadow: 0 2px 8px rgba(0, 18, 51, .15);
}
.subsec-title {
  font-family: var(--ff-t); font-size: 13px; font-weight: 900; color: var(--azul-oscuro); margin: 22px 0 8px;
  padding: 8px 0 8px 14px; border-left: 5px solid var(--azul-vivido); background: var(--blue-50);
  border-radius: 0 4px 4px 0; text-transform: uppercase; letter-spacing: .06em;
}

/* Páginas de detalle (#contenido): los <h3> adoptan el estilo del formulario. */
#contenido .card > h3 {
  font-family: var(--ff-t); font-size: 13px; font-weight: 900; color: var(--azul-oscuro); margin: 22px 0 8px;
  padding: 8px 0 8px 14px; border-left: 5px solid var(--azul-vivido); background: var(--blue-50);
  border-radius: 0 4px 4px 0; text-transform: uppercase; letter-spacing: .06em;
}
#contenido .card > h3:first-child {
  font-size: 17px; font-weight: 900; color: #fff; background: var(--azul);
  padding: 12px 18px; border-left: none; border-radius: 6px; letter-spacing: .02em;
  margin: 0 0 12px; text-transform: none; box-shadow: 0 2px 8px rgba(0, 18, 51, .15);
}

/* Bandeja de solicitudes: encabezado azul sólido con esquinas redondeadas. */
.bandeja-scroll { overflow-x: auto; margin: 0 -22px }
.table-bandeja { border-collapse: separate; border-spacing: 0; width: 100% }
.table-bandeja thead th {
  background: var(--azul); color: #fff; font-weight: 800; border-bottom: none;
  box-shadow: 0 6px 14px rgba(39, 98, 166, .30);
}
.table-bandeja thead th:first-child { border-radius: 12px 0 0 12px }
.table-bandeja thead th:last-child  { border-radius: 0 12px 12px 0 }
.table-bandeja th:first-child, .table-bandeja td:first-child { padding-left: 22px }
.table-bandeja th:last-child,  .table-bandeja td:last-child  { padding-right: 22px }
.table-bandeja td { border-bottom: 1px solid var(--gray100) }


/* Definition list (detalle) */
.dl { display: grid; grid-template-columns: 200px 1fr; gap: 8px 18px; font-size: 14px }
.dl dt { font-size: 12px; font-weight: 700; color: var(--gray-400); text-transform: uppercase; letter-spacing: .03em; padding-top: 2px }
.dl dd { color: var(--text) }
@media (max-width: 640px) { .dl { grid-template-columns: 1fr } .dl dt { padding-top: 10px } }

/* Badges */
.badge { display: inline-block; font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 20px; white-space: nowrap }
.badge-gray { background: var(--gray100); color: var(--gray500) }
.badge-green { background: var(--success-bg); color: var(--success) }
.badge-red { background: var(--error-bg); color: #8b2a22 }
.badge-blue { background: var(--blue-50); color: var(--azul) }
.badge-amber { background: #FEF3C7; color: #92400E }

/* Filters / pager */
.filters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px }
.pager { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; font-size: 13px; color: var(--gray-400) }
.pager .pages { display: flex; gap: 8px; align-items: center }
@media (max-width: 760px) { .filters { grid-template-columns: 1fr 1fr } .grid2 { grid-template-columns: 1fr } }

/* Tabs */
.tabs { display: flex; gap: 6px; margin-bottom: 22px; border-bottom: 2px solid var(--gray100) }
.tab { background: none; border: none; font-family: inherit; font-size: 14px; font-weight: 700; color: var(--gray-400);
  padding: 12px 18px; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px }
.tab.active { color: var(--azul); border-bottom-color: var(--azul) }

/* Alerts */
.alert { padding: 11px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; display: none }
.alert.show { display: block }
.alert-err { background: var(--error-bg); color: #8b2a22 }
.alert-ok { background: var(--success-bg); color: var(--success) }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0, 18, 51, .45); display: none; align-items: center;
  justify-content: center; padding: 20px; z-index: 50 }
.modal-bg.show { display: flex }
.modal { background: #fff; border-radius: 14px; padding: 26px; width: 100%; max-width: 480px; box-shadow: 0 20px 60px rgba(0, 18, 51, .3) }
.modal h3 { font-family: var(--ff-t); font-size: 17px; font-weight: 900; color: var(--azul-oscuro); margin-bottom: 6px }
.modal p { font-size: 13px; color: var(--gray-400); margin-bottom: 16px }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px }

/* Login */
.login-wrap { min-height: calc(100vh - 64px); display: flex; align-items: center; justify-content: center; padding: 24px }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 14px; padding: 32px; box-shadow: 0 10px 40px rgba(0, 18, 51, .12) }
.login-card h2 { font-family: var(--ff-t); font-size: 20px; font-weight: 900; color: var(--azul-oscuro); margin-bottom: 4px }
.login-card .sub { font-size: 13px; color: var(--gray-400); margin-bottom: 22px }

/* ── Tarjetas de conteo (resumen de solicitudes) ── */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px }
.stat { background: #fff; border: 1px solid var(--gray100); border-radius: 12px; padding: 16px 18px;
  box-shadow: 0 1px 4px rgba(0, 18, 51, .06) }
.stat .n { font-family: var(--ff-t); font-size: 26px; font-weight: 900; color: var(--azul-oscuro); line-height: 1 }
.stat .l { font-size: 12px; font-weight: 700; color: var(--gray-400); margin-top: 6px;
  text-transform: uppercase; letter-spacing: .03em }
.stat.s-recibida { border-top: 3px solid var(--azul-vivido) }
.stat.s-en_dictamen { border-top: 3px solid var(--gray-400) }
.stat.s-aprobada { border-top: 3px solid var(--verde) }
.stat.s-rechazada { border-top: 3px solid var(--red) }
@media (max-width: 760px) { .stats { grid-template-columns: 1fr 1fr } }

/* ── Dashboard: banner de saludo (hero) ── */
.dash-hero {
  background: linear-gradient(120deg, var(--azul), var(--azul-oscuro));
  color: #fff; border-radius: 18px; padding: 24px 28px; margin-bottom: 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  box-shadow: 0 10px 26px rgba(0, 18, 51, .18); position: relative; overflow: hidden;
}
.dash-hero::after { /* círculo decorativo translúcido */
  content: ''; position: absolute; right: -40px; top: -60px; width: 200px; height: 200px;
  background: rgba(255, 255, 255, .10); border-radius: 50%;
}
.dash-hero .hero-text { position: relative; z-index: 1 }
.dash-hero h2 { font-family: var(--ff-t); color: #fff; margin: 0 0 6px; font-size: 22px; font-weight: 900; letter-spacing: 0; text-transform: none }
.dash-hero p { margin: 0; opacity: .92; font-size: 14px; max-width: 60ch }
.dash-hero .hero-emoji { font-size: 56px; line-height: 1; position: relative; z-index: 1; opacity: .95 }

/* Variantes de color por rol: azul (SEG), verde (universidad),
   turquesa (COEPES) y naranja (institución externa). */
.dash-hero--coepes { background: linear-gradient(120deg, #0C7A8C, #16B5C4); box-shadow: 0 10px 26px rgba(12, 122, 140, .22) }
.dash-hero--uni    { background: linear-gradient(120deg, #157A3D, #46D17A); box-shadow: 0 10px 26px rgba(21, 122, 61, .22) }
.dash-hero--ext    { background: linear-gradient(120deg, #C2410C, #F59E0B); box-shadow: 0 10px 26px rgba(194, 65, 12, .22) }

/* Variante SEG: imagen de bienvenida anclada al borde inferior. */
.dash-hero--img { min-height: 184px; padding-right: 270px; overflow: visible; margin-top: 72px }
.dash-hero--img::after { display: none }
.dash-hero--img .hero-text h2 { font-size: 32px }
.dash-hero--img .hero-text p { max-width: 56ch; font-size: 14.5px; line-height: 1.5 }
.dash-hero--img .hero-img {
  position: absolute; right: 24px; bottom: 0; height: 250px; z-index: 2; pointer-events: none;
}
@media (max-width: 820px) {
  .dash-hero--img { padding-right: 28px; overflow: hidden; margin-top: 0 }
  .dash-hero--img .hero-img { display: none }
}

/* ── Dashboard: tarjetas de estatus con icono ── */
.statcards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px }
.statcard {
  background: #fff; border: 1px solid var(--gray100); border-radius: 16px; padding: 16px 18px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: 0 2px 10px rgba(0, 18, 51, .05); transition: transform .15s, box-shadow .15s;
}
.statcard:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0, 18, 51, .12) }
.statcard img { width: 54px; height: 54px; flex: none; border-radius: 14px; object-fit: contain }
.statcard .n { font-family: var(--ff-t); font-size: 30px; font-weight: 900; color: var(--azul-oscuro); line-height: 1 }
.statcard .l { font-size: 12px; font-weight: 700; color: var(--gray-400); margin-top: 5px;
  text-transform: uppercase; letter-spacing: .03em }
@media (max-width: 860px) { .statcards { grid-template-columns: 1fr 1fr } }
@media (max-width: 760px) { .dash-hero { flex-direction: column; align-items: flex-start } .dash-hero .hero-emoji { display: none } }

/* ── Menú de usuario (dropdown en el header, esquina superior derecha) ── */
.usermenu { position: relative }
.usermenu .trigger { display: flex; align-items: center; gap: 8px; cursor: pointer; font-family: inherit;
  font-size: 13px; font-weight: 700; color: #fff; background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .25); padding: 7px 12px; border-radius: 8px }
.usermenu .trigger:hover { background: rgba(255, 255, 255, .2) }
.usermenu .caret { font-size: 10px; opacity: .85 }
.usermenu .dropdown { position: absolute; right: 0; top: 46px; background: #fff; border: 1px solid var(--gray300);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 18, 51, .18); min-width: 230px; padding: 6px; display: none; z-index: 40 }
.usermenu .dropdown.show { display: block }
.usermenu .dropdown .group-label { font-size: 10px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--gray-400); padding: 8px 12px 4px }
.usermenu .dropdown button { width: 100%; text-align: left; padding: 9px 12px; border: none; background: none;
  border-radius: 7px; font-family: inherit; font-size: 13px; font-weight: 700; color: var(--gray-600);
  cursor: pointer; display: flex; align-items: center; gap: 9px }
.usermenu .dropdown button:hover { background: var(--gray-50) }
.usermenu .dropdown button.active { color: var(--azul); background: var(--blue-50) }
.usermenu .dropdown button:disabled { opacity: .45; cursor: default; background: none }
.usermenu .dropdown .sep { height: 1px; background: var(--gray100); margin: 6px 4px }

/* Utils */
.muted { color: var(--gray-400) }
.hidden { display: none !important }
.req { color: var(--azul-vivido) }
.stack { display: flex; gap: 10px; flex-wrap: wrap }

/* ── Modal propio para confirmaciones/avisos críticos ──
   Los confirm()/alert() nativos pueden ser suprimidos por el navegador
   (se cierran solos devolviendo false), dejando botones "sin efecto". */
.cmodal-ov { position: fixed; inset: 0; background: rgba(15, 37, 87, .45); z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 20px }
.cmodal { background: #fff; border-radius: 12px; max-width: 440px; width: 100%;
  padding: 20px 22px; box-shadow: 0 18px 48px rgba(15, 37, 87, .28) }
.cmodal h4 { margin: 0 0 8px; font-size: 16px; color: var(--azul-oscuro, #0F2557) }
.cmodal p { margin: 0 0 16px; font-size: 14px; white-space: pre-line }
.cmodal .acts { display: flex; gap: 10px; justify-content: flex-end }
