:root {
    --brand:  #334042;
    --brand2: #1a2e2e;
    --bg:     #f4f7f7;
    --white:  #ffffff;
    --gray:   #6b7280;
    --border: #d0d8d8;
    --cyan:   #00c8e0;
    --nivel-a:#6ab187; --nivel-a-bg:#eaf7ef; --nivel-a-txt:#065f46; --nivel-a-brd:#3e8e60;
    --nivel-b:#e6c97b; --nivel-b-bg:#fdf6e3; --nivel-b-txt:#7c5c00; --nivel-b-brd:#c9a84c;
    --nivel-c:#6baed6; --nivel-c-bg:#e8f4fc; --nivel-c-txt:#1e40af; --nivel-c-brd:#3182bd;
  }
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  body { font-family: 'DM Sans', sans-serif; background: var(--bg); color: #1a2540; min-height: 100vh; }

  /* HEADER */
  .site-header { background: #fff; border-bottom: 1px solid #dde5f5; padding: 0 2rem; display: flex; align-items: center; justify-content: space-between; height: 64px; box-shadow: 0 2px 8px rgba(40,76,183,.08); }
  .header-left { display: flex; align-items: center; gap: .75rem; }
  .header-logo-padron { height: 36px; width: auto; object-fit: contain; background: transparent; }
  .header-logo-ceneval { height: 36px; width: auto; object-fit: contain; background: transparent; }
  .header-title { font-family: 'Lato', sans-serif; font-size: 1.05rem; font-weight: 900; color: var(--brand); letter-spacing: -.01em; }
  .header-right { display: flex; align-items: center; gap: .9rem; }
  #institutionLabel { font-size: .78rem; color: var(--gray); max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: none; }
  #logoutBtn { background: transparent; border: 1px solid var(--border); color: var(--gray); padding: .3rem .85rem; border-radius: 6px; font-family: 'DM Sans', sans-serif; font-size: .8rem; cursor: pointer; display: none; transition: all .2s; }
  #logoutBtn:hover { border-color: #00c8e0; color: #00c8e0; }


  /* ══ NEW LOGIN REDESIGN ══ */
  #loginScreen {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 62px);
    padding: 0;
    background-image: url('img/fondo_padron.png');
    background-size: cover;
    background-position: center;
    position: relative;
  }
  #loginScreen::before {
 
  }
  .login-inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6rem;
    flex: 1;
    padding: 4rem 3rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
  }
  /* Left side */
  .login-left {
    flex: 1;
    max-width: 480px;
    color: #fff;
  }
  .login-logos {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2.2rem;
  }
  .login-logos img {
    height: 80px;
    width: auto;
    object-fit: contain;
    filter: brightness(0) invert(1);
  }
  .login-left h1 {
    font-family: 'Lato', sans-serif;
    font-size: 2.6rem;
    font-weight: 900;
    line-height: 1.15;
    color: #fff;
    margin-bottom: .6rem;
  }
  .login-left h1 span {
    font-weight: 300;
    display: block;
    font-size: 2.1rem;
  }
  .login-left p {
    font-size: .95rem;
    line-height: 1.65;
    color: rgba(255,255,255,.88);
    max-width: 420px;
    margin-top: 1.1rem;
  }
  /* Right side — card */
  .login-card {
    background: #fff;
    border-radius: 20px;
    padding: 2.6rem 2.4rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(10,30,120,.22);
    flex-shrink: 0;
  }
  .login-card h2 {
    font-family: 'Lato', sans-serif;
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--cyan);
    margin-bottom: .35rem;
  }
  .login-card > p {
    font-size: .86rem;
    color: var(--gray);
    margin-bottom: 1.6rem;
    line-height: 1.5;
  }
  .login-card .form-group { margin-bottom: 1rem; }
  .login-card .form-group label { color: var(--brand); }
  .login-card .login-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #dc2626;
    border-radius: 7px;
    padding: .5rem .8rem;
    font-size: .82rem;
    margin-bottom: .9rem;
    display: none;
  }
  .login-notice {
    margin-top: 1.3rem;
    padding: .7rem .9rem;
    background: #e8f9fb;
    border-left: 3px solid var(--cyan);
    border-radius: 0 8px 8px 0;
    font-size: .78rem;
    color: var(--brand);
    line-height: 1.5;
  }
  @media (max-width: 860px) {
    .login-inner { flex-direction: column; gap: 2.5rem; padding: 2.5rem 1.5rem; }
    .login-left h1 { font-size: 2rem; }
    .login-left h1 span { font-size: 1.6rem; }
    .login-card { max-width: 100%; }
  }


  /* PORTAL */
  #portal { display: none; }
  .container { max-width: 1140px; margin: 0 auto; padding: 2rem 1.5rem; }

  /* TABS */
  .tab-nav { display: flex; gap: .2rem; border-bottom: 2px solid var(--border); margin-bottom: 1.8rem; }
  .tab-btn { padding: .6rem 1.35rem; background: transparent; border: none; border-bottom: 3px solid transparent; margin-bottom: -2px; font-family: 'DM Sans', sans-serif; font-size: .9rem; font-weight: 500; color: var(--gray); cursor: pointer; transition: all .2s; border-radius: 6px 6px 0 0; }
  .tab-btn:hover { color: var(--brand); background: #eff3ff; }
  .tab-btn.active { color: var(--brand); font-weight: 700; border-bottom-color: var(--brand); }

  /* SECTION TITLES */
  .section-title { font-family: 'Lato', sans-serif; font-size: 1.45rem; font-weight: 900; color: var(--brand); margin-bottom: .25rem; }
  .section-sub { font-size: .87rem; color: var(--gray); margin-bottom: 1.6rem; line-height: 1.5; }

  .notice-box { background: #fffbeb; border: 1px solid #fde68a; border-left: 4px solid #f59e0b; border-radius: 8px; padding: .85rem 1.1rem; font-size: .82rem; color: #92400e; margin-bottom: 1.6rem; line-height: 1.5; }

  /* CHART */
  .chart-wrapper { background: var(--white); border: 1px solid var(--border); border-radius: 14px; padding: 1.4rem 1.4rem .9rem; margin-bottom: 1.8rem; box-shadow: 0 2px 12px rgba(40,76,183,.06); }
  .chart-title { font-family: 'Lato', sans-serif; font-size: 1rem; font-weight: 700; color: var(--brand); margin-bottom: 1rem; text-align: center; }
  .chart-container { position: relative; width: 100%; max-width: 1000px; margin: 0 auto; }
  .chart-svg { width: 100%; height: auto; display: block; }
  .chart-legend { display: flex; justify-content: center; gap: 1.4rem; flex-wrap: wrap; margin-top: .7rem; font-size: .78rem; color: var(--gray); }
  .legend-item { display: flex; align-items: center; gap: .35rem; }
  .legend-dot { width: 13px; height: 13px; border-radius: 50%; flex-shrink: 0; }
  .chart-tooltip { position: absolute; background: #1a2540; color: #fff; padding: .55rem .85rem; border-radius: 8px; font-size: .76rem; pointer-events: none; opacity: 0; transition: opacity .15s; width: 260px; max-width: 260px; line-height: 1.65; z-index: 100; white-space: normal; word-wrap: break-word; }

  /* TABLE */
  .table-wrapper { background: var(--white); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; box-shadow: 0 2px 12px rgba(40,76,183,.06); margin-bottom: 1.8rem; }
  .table-header { padding: .9rem 1.2rem .75rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
  .table-header h3 { font-family: 'Lato', sans-serif; font-size: .97rem; font-weight: 700; color: var(--brand); }
  .table-scroll { overflow-x: auto; }
  table { width: 100%; border-collapse: collapse; font-size: .83rem; }
  thead th { background: var(--brand); color: #fff; padding: .65rem .85rem; text-align: left; font-weight: 700; font-size: .75rem; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
  tbody tr { border-bottom: 1px solid var(--border); }
  tbody tr:last-child { border-bottom: none; }
  tbody tr:hover { background: #f5f7ff; }
  tbody td { padding: .65rem .85rem; vertical-align: middle; }

  /* BADGES */
  .nivel-badge { display: inline-flex; align-items: center; gap: .28rem; padding: .22rem .6rem; border-radius: 20px; font-size: .75rem; font-weight: 700; letter-spacing: .03em; white-space: nowrap; }
  .nivel-a { background: var(--nivel-a-bg); color: var(--nivel-a-txt); border: 1px solid var(--nivel-a-brd); }
  .nivel-b { background: var(--nivel-b-bg); color: var(--nivel-b-txt); border: 1px solid var(--nivel-b-brd); }
  .nivel-c { background: var(--nivel-c-bg); color: var(--nivel-c-txt); border: 1px solid var(--nivel-c-brd); }
  .nivel-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
  .dot-a { background: var(--nivel-a); } .dot-b { background: var(--nivel-b); } .dot-c { background: var(--nivel-c); }

  /* HISTORICO */
  .hist-meta { display: flex; gap: .8rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
  .hist-chip { background: var(--white); border: 1px solid var(--border); border-radius: 8px; padding: .35rem .8rem; font-size: .78rem; color: #1a2540; }
  .hist-chip strong { color: var(--brand); }
  .nivel-h1 { background: #eff3ff; color: var(--brand); border: 1px solid #bfcfff; padding: .18rem .55rem; border-radius: 20px; font-size: .75rem; font-weight: 700; white-space: nowrap; display: inline-block; }
  .nivel-h2 { background: #f0fdf4; color: #166534; border: 1px solid #86efac; padding: .18rem .55rem; border-radius: 20px; font-size: .75rem; font-weight: 700; white-space: nowrap; display: inline-block; }
  .nivel-h1plus { background: #fdf6e3; color: #7c5c00; border: 1px solid #c9a84c; padding: .18rem .55rem; border-radius: 20px; font-size: .75rem; font-weight: 700; white-space: nowrap; display: inline-block; }

  /* PAGER */
  .pager { display: flex; align-items: center; gap: .5rem; justify-content: flex-end; padding: .7rem 1rem; border-top: 1px solid var(--border); font-size: .8rem; color: var(--gray); flex-wrap: wrap; }
  .pager button { border: 1px solid var(--border); background: #fff; padding: .3rem .65rem; border-radius: 6px; cursor: pointer; font-size: .78rem; transition: all .15s; }
  .pager button:hover:not(:disabled) { background: #eff3ff; border-color: var(--brand); color: var(--brand); }
  .pager button:disabled { opacity: .4; cursor: default; }
  .pager select { border: 1px solid var(--border); border-radius: 6px; padding: .25rem .4rem; font-size: .78rem; }

  .empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--gray); }
  .empty-state .icon { font-size: 2rem; margin-bottom: .6rem; }
  .empty-state p { font-size: .88rem; }

  @keyframes fadeUp { from { opacity:0; transform:translateY(14px); } to { opacity:1; transform:translateY(0); } }
  .fade-up { animation: fadeUp .35s ease both; }
  @media (max-width:600px) { .login-card { padding: 1.8rem 1.4rem; } thead th, tbody td { padding: .5rem .55rem; font-size: .74rem; } }

  /* FORM ELEMENTS */
  .form-group { margin-bottom: 1.1rem; }
  .form-group label { display: block; font-size: .75rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--brand); margin-bottom: .38rem; }
  .form-group input, .form-group select { width: 100%; padding: .65rem .95rem; border: 1.5px solid var(--border); border-radius: 8px; font-family: 'DM Sans', sans-serif; font-size: .93rem; color: #1a2540; background: #fff; transition: border-color .2s; appearance: auto; }
  .form-group input:focus, .form-group select:focus { outline: none; border-color: #00c8e0; box-shadow: 0 0 0 3px rgba(0,200,224,.15); }
  .btn-primary { width: 100%; padding: .75rem; background: var(--brand); color: #fff; border: none; border-radius: 8px; font-family: 'Lato', sans-serif; font-size: 1rem; font-weight: 700; cursor: pointer; transition: background .2s; margin-top: .5rem; display: block; }
  .btn-primary:hover { background: var(--brand2); }