/* GaeliKA · Radar de Convocatorias — identidad corporativa "Light Blue" */
:root {
  --azul: #4FA3D1;          /* Azul Claro GaeliKA (tecnología, datos) */
  --verde: #6BC46D;         /* Verde Innovación (acción, impacto) */
  --azul-profundo: #1F4E79; /* contraste, cabeceras */
  --gris: #4A4A4A;          /* texto de cuerpo */
  --gris-claro: #E9EEF2;    /* fondos de tablas, separadores */
  --blanco: #FFFFFF;
  --azul-15: rgba(79, 163, 209, 0.15);
  --sombra: 0 1px 3px rgba(31, 78, 121, 0.08), 0 4px 16px rgba(31, 78, 121, 0.06);
  --radio: 12px;
  --radio-sm: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, system-ui, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--gris);
  background: #f7fafc;
}

h1, h2, h3, .brand-sub { font-family: 'Montserrat', 'Inter', sans-serif; }
h1 { color: var(--azul); font-weight: 600; font-size: 1.6rem; }
h2 { color: var(--azul); font-weight: 600; font-size: 1.25rem; }
h3 { color: var(--verde); font-weight: 600; font-size: 1.05rem; }
a { color: var(--azul); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: #7b8794; }

/* ---------- Topbar / nav ---------- */
.topbar {
  display: flex; align-items: center; gap: 24px;
  background: var(--blanco);
  border-bottom: 3px solid var(--azul);
  padding: 10px 24px;
  box-shadow: var(--sombra);
  position: sticky; top: 0; z-index: 50;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { height: 40px; width: auto; display: block; }
.brand:hover { text-decoration: none; }
.brand-sub { color: var(--azul-profundo); font-weight: 600; font-size: 0.95rem; border-left: 2px solid var(--gris-claro); padding-left: 10px; }
.nav { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
.nav a {
  color: var(--gris); padding: 7px 12px; border-radius: var(--radio-sm); font-weight: 500;
}
.nav a:hover { background: var(--azul-15); text-decoration: none; color: var(--azul-profundo); }
.usermenu { display: flex; align-items: center; gap: 8px; }
.user-email { font-size: 0.85rem; color: #7b8794; }

/* ---------- Layout ---------- */
.container { max-width: 1180px; margin: 0 auto; padding: 24px; }
.footer { text-align: center; color: #9aa7b2; font-size: 0.8rem; padding: 28px 16px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; cursor: pointer; border: 1px solid transparent;
  border-radius: var(--radio-sm); padding: 8px 16px; font-weight: 600; font-size: 0.9rem;
  font-family: inherit; transition: all .15s ease; text-align: center;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--azul); color: #fff; }
.btn-primary:hover { background: #3d8fbd; }
.btn-green { background: var(--verde); color: #fff; }
.btn-green:hover { background: #57b259; }
.btn-ghost { background: transparent; color: var(--gris); border-color: var(--gris-claro); }
.btn-ghost:hover { background: var(--gris-claro); }
.btn-danger { background: #fff; color: #c0392b; border-color: #e8c4bf; }
.btn-danger:hover { background: #fdecea; }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }

/* ---------- Flash ---------- */
.flash { padding: 12px 16px; border-radius: var(--radio-sm); margin-bottom: 16px; font-weight: 500; }
.flash-ok { background: #eafaf0; color: #1e7e44; border: 1px solid #b9ecca; }
.flash-err { background: #fdecea; color: #b93a2b; border: 1px solid #f3c4bd; }

/* ---------- Cards ---------- */
.card { background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra); padding: 20px; }
.grid { display: grid; gap: 16px; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat { background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra); padding: 16px 18px; border-left: 4px solid var(--azul); }
.stat .num { font-family: 'Montserrat', sans-serif; font-size: 1.9rem; font-weight: 700; color: var(--azul-profundo); line-height: 1; }
.stat .num.green { color: var(--verde); }
.stat .lbl { font-size: 0.8rem; color: #7b8794; margin-top: 6px; }

/* ---------- Filters ---------- */
.toolbar { background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra); padding: 16px; margin-bottom: 18px; }
.toolbar-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 0.78rem; color: #7b8794; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
.field.grow { flex: 1; min-width: 220px; }
input, select, textarea {
  font-family: inherit; font-size: 0.92rem; color: var(--gris);
  border: 1px solid #d6dee6; border-radius: var(--radio-sm); padding: 9px 11px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--azul); box-shadow: 0 0 0 3px var(--azul-15); }

/* ---------- Convocatoria cards ---------- */
.result-count { color: #7b8794; font-size: 0.88rem; margin: 4px 0 14px; }
.conv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.conv {
  background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra);
  padding: 18px; display: flex; flex-direction: column; gap: 8px; border-top: 3px solid var(--gris-claro);
}
.conv.estado-ABIERTA { border-top-color: var(--verde); }
.conv.estado-PERMANENTE { border-top-color: var(--azul); }
.conv.estado-PREVISTA { border-top-color: #e7a33e; }
.conv.estado-CERRADA-RECURRENTE { border-top-color: #b6c0ca; }
.conv h3 { margin: 0; color: var(--azul-profundo); font-size: 1.02rem; }
.conv h3 a { color: inherit; }
.conv .org { font-size: 0.82rem; color: #7b8794; }
.conv .desc { font-size: 0.86rem; color: var(--gris); }
.conv .meta { font-size: 0.82rem; }
.conv .meta b { color: var(--azul-profundo); }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font-size: 0.7rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; letter-spacing: .02em; text-transform: uppercase; }
.badge-estado.estado-ABIERTA { background: #eafaf0; color: #1e7e44; }
.badge-estado.estado-PERMANENTE { background: var(--azul-15); color: var(--azul-profundo); }
.badge-estado.estado-PREVISTA { background: #fdf1de; color: #b9772a; }
.badge-estado.estado-CERRADA-RECURRENTE { background: #eef1f4; color: #6a7682; }
.badge-ambito { background: #eef4f9; color: var(--azul-profundo); }
.badge-conf { background: #f4f6f8; color: #7b8794; }
.tipo-tag { font-size: 0.72rem; color: var(--verde); font-weight: 700; }

/* ---------- Detail ---------- */
.detail-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.detail dl { display: grid; grid-template-columns: 200px 1fr; gap: 0; margin: 0; }
.detail dt { font-weight: 600; color: var(--azul-profundo); padding: 11px 0; border-bottom: 1px solid var(--gris-claro); }
.detail dd { margin: 0; padding: 11px 0 11px 16px; border-bottom: 1px solid var(--gris-claro); }
.backlink { display: inline-block; margin-bottom: 14px; }

/* ---------- Tables ---------- */
table.data { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radio); overflow: hidden; box-shadow: var(--sombra); }
table.data thead th { background: var(--azul-15); color: var(--azul-profundo); font-family: 'Montserrat', sans-serif; font-weight: 500; text-align: left; padding: 11px 14px; font-size: 0.85rem; }
table.data tbody td { padding: 10px 14px; border-top: 1px solid var(--gris-claro); font-size: 0.88rem; vertical-align: middle; }
table.data tbody tr:nth-child(even) { background: #fafcfd; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 88vh; display: flex; align-items: center; justify-content: center; }
.auth-card { background: #fff; border-radius: 16px; box-shadow: var(--sombra); padding: 36px; width: 100%; max-width: 380px; text-align: center; border-top: 4px solid var(--verde); }
.auth-logo { height: 84px; margin-bottom: 8px; }
.auth-card h1 { font-size: 1.2rem; margin: 4px 0; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; text-align: left; margin-top: 18px; }
.auth-card label { display: flex; flex-direction: column; gap: 5px; font-size: 0.82rem; color: #7b8794; font-weight: 600; }
.auth-card .btn { margin-top: 6px; }

/* ---------- Asistente ---------- */
.asis-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
.rec { border-left: 4px solid var(--azul); background: #fff; border-radius: var(--radio); box-shadow: var(--sombra); padding: 16px; margin-bottom: 12px; }
.rec.encaje-ALTO { border-left-color: var(--verde); }
.rec.encaje-MEDIO { border-left-color: var(--azul); }
.rec.encaje-BAJO { border-left-color: #b6c0ca; }
.rec .rec-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.score { font-family: 'Montserrat', sans-serif; font-weight: 700; color: var(--azul-profundo); }
.pill { display: inline-block; background: var(--azul-15); color: var(--azul-profundo); border-radius: 999px; padding: 4px 12px; font-size: 0.8rem; font-weight: 600; margin: 4px 6px 0 0; }
.spinner { display: inline-block; width: 18px; height: 18px; border: 3px solid var(--azul-15); border-top-color: var(--azul); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.notice { background: #fff8ec; border: 1px solid #f3dcae; color: #8a6420; padding: 12px 16px; border-radius: var(--radio-sm); }
.codebox { background: var(--gris-claro); border-radius: var(--radio-sm); padding: 10px 14px; font-family: 'Roboto Mono', monospace; font-size: 0.95rem; color: var(--azul-profundo); display: inline-block; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0 14px; flex-wrap: wrap; }

@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .detail dl { grid-template-columns: 1fr; }
  .detail dt { padding-bottom: 0; border: none; }
  .detail dd { padding-left: 0; }
  .nav { order: 3; width: 100%; }
}
