
    :root {
      --navy: #241b3f;
      --navy-dark: #16112a;
      --yellow: #ffe600;
      --red: #d52b1e;
      --blue: #5b84bc;
      --white: #ffffff;
      --gray: #f4f4f8;
    }

    * { box-sizing: border-box; }

    body {
      margin: 0;
      font-family: 'Segoe UI', Arial, sans-serif;
      background: linear-gradient(160deg, var(--navy) 0%, var(--navy-dark) 100%);
      min-height: 100vh;
      color: var(--navy);
    }

    .topbar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 10px 22px;
      background: var(--navy-dark);
      border-bottom: 4px solid var(--yellow);
    }

    .topbar .datetime {
      color: var(--white);
      font-size: 14px;
      text-align: right;
      line-height: 1.3;
    }
    .topbar .datetime b { color: var(--yellow); font-size: 16px; }

    .btn-admin {
      background: var(--yellow);
      color: var(--navy);
      border: none;
      padding: 9px 18px;
      border-radius: 20px;
      font-weight: bold;
      cursor: pointer;
      box-shadow: 0 2px 6px rgba(0,0,0,.4);
      transition: transform .15s;
    }
    .btn-admin:hover { transform: translateY(-2px); }

    .header {
      text-align: center;
      padding: 26px 16px 10px;
    }
    .header img {
      width: 92px;
      filter: drop-shadow(0 4px 8px rgba(0,0,0,.5));
    }
    .header h1 {
      color: var(--yellow);
      font-size: 20px;
      margin: 10px auto 2px;
      max-width: 720px;
      letter-spacing: .5px;
      text-shadow: 0 2px 4px rgba(0,0,0,.5);
    }
    .header p {
      color: var(--white);
      opacity: .85;
      margin: 0;
      font-size: 13px;
    }

    .container {
      max-width: 460px;
      margin: 20px auto 50px;
      background: var(--white);
      border-radius: 18px;
      padding: 26px 24px 30px;
      box-shadow: 0 10px 30px rgba(0,0,0,.45);
      border-top: 6px solid var(--red);
    }

    .form-group { margin-bottom: 16px; }
    label {
      display: block;
      font-weight: 700;
      font-size: 13px;
      color: var(--navy);
      margin-bottom: 5px;
      letter-spacing: .3px;
    }
    input[type=text], input[type=tel], select {
      width: 100%;
      padding: 11px 12px;
      border-radius: 8px;
      border: 2px solid #d8d8e8;
      font-size: 15px;
      outline: none;
      transition: border-color .15s;
    }
    input:focus, select:focus { border-color: var(--blue); }

    .niveles {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
    }
    .nivel-opt {
      border: 2px solid #d8d8e8;
      border-radius: 8px;
      padding: 10px 8px;
      text-align: center;
      cursor: pointer;
      font-weight: 700;
      font-size: 13px;
      color: var(--navy);
      transition: all .15s;
      user-select: none;
    }
    .nivel-opt.selected {
      background: var(--blue);
      color: var(--white);
      border-color: var(--blue);
    }

    .btn-submit {
      width: 100%;
      background: var(--red);
      color: var(--white);
      border: none;
      padding: 14px;
      border-radius: 10px;
      font-size: 16px;
      font-weight: 800;
      letter-spacing: .5px;
      cursor: pointer;
      margin-top: 8px;
      box-shadow: 0 4px 12px rgba(213,43,30,.4);
      transition: transform .15s;
    }
    .btn-submit:hover { transform: translateY(-2px); }
    .btn-submit:disabled { opacity: .6; cursor: not-allowed; transform: none; }

    .mensaje {
      margin-top: 14px;
      padding: 12px 14px;
      border-radius: 8px;
      font-size: 14px;
      font-weight: 600;
      display: none;
    }
    .mensaje.ok { background: #e4f7e9; color: #1e7a34; display: block; border: 1px solid #a9e3ba; }
    .mensaje.err { background: #fdeaea; color: #b5271b; display: block; border: 1px solid #f3b7b1; }

    /* ---- Overlay de confirmación de registro ---- */
    .overlay-exito {
      display: none;
      position: fixed; inset: 0;
      background: rgba(20, 14, 40, .88);
      z-index: 1200;
      align-items: center;
      justify-content: center;
      padding: 20px;
    }
    .overlay-exito.show { display: flex; }
    .exito-box {
      background: var(--white);
      border-radius: 20px;
      padding: 38px 30px;
      text-align: center;
      max-width: 340px;
      box-shadow: 0 15px 45px rgba(0,0,0,.5);
      border-top: 8px solid #2ea44f;
      animation: pop .25s ease;
    }
    @keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
    .exito-check {
      width: 68px; height: 68px; border-radius: 50%;
      background: #2ea44f; color: #fff;
      display: flex; align-items: center; justify-content: center;
      font-size: 36px; margin: 0 auto 14px;
    }
    .exito-box h3 { margin: 6px 0 4px; color: var(--navy); font-size: 18px; }
    .exito-box p { margin: 2px 0; color: #555; font-size: 13px; }
    .exito-box .hora-reg { color: var(--blue); font-weight: 800; font-size: 15px; margin-top: 8px; }

    .panel-footer-info {
      text-align: center; font-size: 11px; color: #999; margin-top: 18px;
    }
    .panel-footer-info a { color: var(--blue); }

    .page-footer {
      text-align: center;
      color: rgba(255,255,255,.55);
      font-size: 11px;
      letter-spacing: 1px;
      padding: 4px 0 24px;
    }

    /* ---- MODALES ---- */
    .modal-overlay {
      display: none;
      position: fixed; inset: 0;
      background: rgba(10,7,24,.75);
      z-index: 999;
      align-items: center;
      justify-content: center;
      padding: 14px;
    }
    .modal-overlay.show { display: flex; }
    .modal-box {
      background: var(--white);
      border-radius: 16px;
      padding: 26px;
      width: 100%;
      max-width: 380px;
      box-shadow: 0 12px 40px rgba(0,0,0,.5);
      border-top: 6px solid var(--yellow);
      position: relative;
    }
    .modal-box h2 { color: var(--navy); margin-top: 0; font-size: 18px; text-align:center;}
    .modal-close {
      position: absolute; top: 10px; right: 14px;
      cursor: pointer; font-size: 22px; color: #999; font-weight: bold;
    }

    /* ---- PANEL ADMIN ---- */
    .panel-overlay {
      display: none;
      position: fixed; inset: 0;
      background: var(--gray);
      z-index: 900;
      overflow-y: auto;
    }
    .panel-overlay.show { display: block; }
    .panel-header {
      background: var(--navy);
      border-bottom: 5px solid var(--yellow);
      padding: 16px 24px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 10px;
    }
    .panel-header .titulo {
      display: flex; align-items: center; gap: 12px;
      color: var(--white);
    }
    .panel-header .titulo img { width: 46px; }
    .panel-header .titulo h2 { margin: 0; font-size: 17px; color: var(--yellow); }
    .btn-salir {
      background: var(--red); color: var(--white); border: none;
      padding: 8px 16px; border-radius: 18px; font-weight: 700; cursor: pointer;
    }

    .panel-body { padding: 22px; max-width: 1150px; margin: 0 auto; }

    .stats-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
      gap: 14px;
      margin-bottom: 24px;
    }
    .stat-card {
      background: var(--white);
      border-radius: 12px;
      padding: 16px;
      text-align: center;
      box-shadow: 0 3px 10px rgba(0,0,0,.08);
      border-bottom: 5px solid var(--blue);
    }
    .stat-card.total { border-bottom-color: var(--red); }
    .stat-card .num { font-size: 30px; font-weight: 800; color: var(--navy); }
    .stat-card .lbl { font-size: 12px; color: #777; font-weight: 700; letter-spacing: .5px; margin-top: 4px;}

    .filtros {
      background: var(--white);
      border-radius: 12px;
      padding: 16px 18px;
      display: flex;
      flex-wrap: wrap;
      gap: 12px;
      align-items: flex-end;
      margin-bottom: 20px;
      box-shadow: 0 3px 10px rgba(0,0,0,.08);
    }
    .filtros .fgroup { display: flex; flex-direction: column; gap: 4px; }
    .filtros label { font-size: 12px; font-weight: 700; color: var(--navy); }
    .filtros input, .filtros select {
      padding: 9px 10px; border-radius: 7px; border: 2px solid #ddd; font-size: 13px;
    }
    .filtros button {
      padding: 10px 16px; border-radius: 8px; border: none; font-weight: 700; cursor: pointer;
    }
    .btn-filtrar { background: var(--blue); color: var(--white); }
    .btn-pdf { background: var(--red); color: var(--white); }

    table.tabla-registros {
      width: 100%;
      border-collapse: collapse;
      background: var(--white);
      border-radius: 12px;
      overflow: hidden;
      box-shadow: 0 3px 10px rgba(0,0,0,.08);
      font-size: 13px;
    }
    table.tabla-registros thead { background: var(--navy); }
    table.tabla-registros thead th {
      color: var(--yellow); padding: 12px 10px; text-align: left; font-size: 12px; letter-spacing: .4px;
    }
    table.tabla-registros tbody td { padding: 10px; border-bottom: 1px solid #eee; }
    table.tabla-registros tbody tr:hover { background: #f7f7ff; }
    .badge-nivel {
      padding: 4px 9px; border-radius: 12px; font-size: 11px; font-weight: 700; color: white;
    }
    .badge-INICIAL { background: #e08a2c; }
    .badge-PRIMARIA { background: #3f9142; }
    .badge-SECUNDARIA { background: var(--blue); }
    .badge-EBA { background: #8451a8; }

    .acciones button {
      border: none; padding: 6px 10px; border-radius: 6px; margin-right: 5px; cursor: pointer; font-size: 12px; font-weight: 700; color: #fff;
    }
    .btn-editar { background: #3f7fbf; }
    .btn-eliminar { background: var(--red); }

    .tabla-vacia { text-align: center; padding: 30px; color: #999; }

    .loader {
      display: none;
      text-align: center;
      padding: 12px;
      font-weight: 700;
      color: var(--navy);
    }
    .loader.show { display: block; }

    @media (max-width: 600px) {
      table.tabla-registros { font-size: 11px; }
      .panel-header .titulo h2 { font-size: 14px; }
    }
  