/* Extraído sin cambios de index.php (sistema PHP). */
/* ── Overlay ─────────────────────────────────────────── */
    .tai-modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(6, 24, 58, 0.62);
      z-index: 9000;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 1rem;
      box-sizing: border-box;
      opacity: 0;
      transition: opacity 0.22s ease;
    }
    .tai-modal-overlay.tai-modal-visible { opacity: 1; }
    .tai-modal-overlay[hidden] { display: none !important; }

    /* ── Modal box ───────────────────────────────────────── */
    .tai-modal {
      background: #fff;
      border-radius: 14px;
      box-shadow: 0 8px 48px rgba(6, 24, 58, 0.22), 0 2px 8px rgba(6,24,58,0.10);
      width: 90%;
      max-width: 1380px;
      max-height: 96vh;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      position: relative;
      transform: translateY(10px);
      transition: transform 0.22s ease;
      box-sizing: border-box;
    }
    .tai-modal-overlay.tai-modal-visible .tai-modal { transform: translateY(0); }

    /* ── Scrollable body ─────────────────────────────────── */
    .tai-modal-body {
      overflow-y: auto;
      padding: 0.7rem 1.3rem 0;
      flex: 1;
      box-sizing: border-box;
    }

    /* ── Close button ────────────────────────────────────── */
    .tai-modal-close {
      position: absolute;
      top: 1rem;
      right: 1.1rem;
      background: none;
      border: none;
      cursor: pointer;
      color: #5a6a80;
      font-size: 1.5rem;
      line-height: 1;
      padding: 0.3rem 0.5rem;
      border-radius: 6px;
      z-index: 10;
      transition: background 0.15s, color 0.15s;
    }
    .tai-modal-close:hover,
    .tai-modal-close:focus-visible {
      background: #f1f4f8;
      color: #062B63;
      outline: 2px solid #062B63;
    }

    /* ── Header row ──────────────────────────────────────── */
    .tai-modal-head {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 1rem;
      margin-bottom: 0;
      padding-right: 4rem; /* espacio para no solapar con el botón X */
    }
    .tai-modal-head-text { flex: 1; min-width: 0; }
    .tai-modal-title {
      font-size: clamp(1.05rem, 1.8vw, 1.4rem);
      font-weight: 800;
      color: #062B63;
      margin: 0 0 0.25rem;
      line-height: 1.15;
      letter-spacing: -0.01em;
    }
    .tai-modal-subtitle {
      font-size: 0.8rem;
      color: #3a4a60;
      margin: 0;
      line-height: 1.4;
      max-width: 60ch;
    }

    /* ── Contenido de aviso ──────────────────────────────── */
    .tai-aviso-badge {
      flex-shrink: 0;
      width: 52px;
      height: 52px;
      border-radius: 50%;
      background: #FFD21F;
      color: #5c3e00;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.6rem;
      font-weight: 900;
      line-height: 1;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    .tai-aviso-title { font-size: clamp(1.3rem, 1.05rem + 1.4vw, 1.85rem); }
    .tai-aviso-content { font-size: clamp(1rem, 0.9rem + 0.55vw, 1.2rem); color: #24344a; line-height: 1.65; }
    .tai-aviso-content p { margin: 0 0 1.1rem; }
    .tai-aviso-content p:last-child { margin-bottom: 0; }
    .tai-aviso-lead { font-weight: 600; color: #16233a; }
    .tai-aviso-warning { margin-top: 0.3rem; margin-bottom: 0; padding: 0.8rem 1rem; }
    .tai-aviso-warning .tai-warning-text {
      font-size: clamp(1rem, 0.9rem + 0.55vw, 1.2rem);
      line-height: 1.6;
    }
    .tai-aviso-warning .tai-warning-icon { width: 24px; height: 24px; font-size: 0.9rem; }

    /* ── Brand badge — mismo estilo que el hero, escalado ── */
    .tai-modal-badge {
      flex-shrink: 0;
      text-align: center;
      user-select: none;
    }
    .tai-modal-badge .portal-hero-big {
      font-size: 1rem; /* base de referencia para clamp */
    }
    .tai-modal-badge .portal-hero-big .tai  { font-size: clamp(1.2rem, 2.2vw, 2rem); }
    .tai-modal-badge .portal-hero-big .inv  { font-size: clamp(0.9rem, 1.6vw, 1.5rem); }
    .tai-modal-badge .portal-hero-big .year { font-size: clamp(1.2rem, 2.2vw, 2rem); }

    /* ── Divider ─────────────────────────────────────────── */
    .tai-modal-divider {
      border: none;
      border-top: 1.5px solid #e5e7eb;
      margin: 0.35rem 0 0.4rem;
    }

    /* ── School grid ─────────────────────────────────────── */
    .tai-school-grid {
      column-count: 3;
      column-gap: 0.7rem;
      margin-bottom: 0.7rem;
    }
    @media (max-width: 900px) {
      .tai-school-grid { column-count: 2; }
    }
    @media (max-width: 560px) {
      .tai-school-grid { column-count: 1; }
      .tai-modal-body { padding: 1.1rem 1rem 0; }
      .tai-modal-head { gap: 0; }
      .tai-modal-badge { display: none; }
      .tai-aviso-badge { display: none; }
    }

    /* ── School card ─────────────────────────────────────── */
    .tai-school-card {
      break-inside: avoid;
      margin-bottom: 0.4rem;
      background: #f8fafc;
      border: 1px solid #e5e7eb;
      border-radius: 7px;
      padding: 0.38rem 0.6rem;
    }
    .tai-school-head {
      display: flex;
      align-items: center;
      gap: 0.4rem;
      margin-bottom: 0.25rem;
    }
    .tai-school-icon {
      flex-shrink: 0;
      width: 26px;
      height: 26px;
      background: #edf2fb;
      border: 1px solid #d0daf0;
      border-radius: 5px;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #062B63;
    }
    .tai-school-icon svg { width: 14px; height: 14px; }
    .tai-school-name {
      font-size: 0.92rem;
      font-weight: 700;
      color: #062B63;
      line-height: 1.2;
    }
    .tai-school-name em {
      font-style: normal;
      color: #0b3d91;
    }
    .tai-subject-list {
      list-style: none;
      padding: 0;
      margin: 0;
    }
    .tai-subject-list li {
      font-size: 0.86rem;
      color: #2d3a4a;
      padding: 0.06rem 0 0.06rem 0.85rem;
      position: relative;
      line-height: 1.35;
    }
    .tai-subject-list li::before {
      content: '';
      position: absolute;
      left: 0.15rem;
      top: 0.52em;
      width: 5px;
      height: 5px;
      border-radius: 50%;
      background: #FFD21F;
      border: 1px solid #c49c00;
    }

    /* ── Warning box ─────────────────────────────────────── */
    .tai-modal-warning {
      background: #FFF6D8;
      border: 1px solid #f0d060;
      border-radius: 8px;
      display: flex;
      align-items: flex-start;
      gap: 0.6rem;
      padding: 0.6rem 0.85rem;
      margin: 0 0 0.9rem;
    }
    .tai-warning-icon {
      flex-shrink: 0;
      align-self: center;
      width: 20px;
      height: 20px;
      background: #FFD21F;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.78rem;
      font-weight: 900;
      color: #7a5c00;
      line-height: 1;
    }
    .tai-warning-text {
      font-size: 0.78rem;
      color: #3d2f00;
      line-height: 1.4;
      margin: 0;
      align-self: center;
    }
    .tai-warning-text strong { color: #5c3e00; }

    /* ── Trigger button ──────────────────────────────────── */
    .tai-trigger-wrap {
      display: flex;
      justify-content: center;
      margin: 1.2rem 0 0.4rem;
    }
    .tai-trigger-btn {
      display: inline-flex;
      align-items: center;
      gap: 0.45rem;
      background: #062B63;
      color: #fff;
      border: none;
      border-radius: 7px;
      padding: 0.62rem 1.25rem;
      font-size: 0.92rem;
      font-weight: 700;
      cursor: pointer;
      transition: background 0.15s;
      letter-spacing: 0.01em;
    }
    .tai-trigger-btn:hover,
    .tai-trigger-btn:focus-visible {
      background: #0b3d91;
      outline: 2px solid #FFD21F;
      outline-offset: 2px;
    }
    .tai-trigger-btn svg { width: 17px; height: 17px; }
