:root {
  --azul:    #1E3A5F;
  --azul-m:  #2D5282;
  --azul-l:  #3B6EB0;
  --ambar:   #C9860A;
  --ambar-l: #F6AD3C;
  --bg:      #F4F6FA;
  --bg-card: #FFFFFF;
  --borde:   #D6E0EF;
  --texto:   #1A2638;
  --muted:   #5E7490;
  --radius:  10px;
  --shadow:  0 2px 12px rgba(30,58,95,.10);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--texto); min-height: 100vh; }

/* NAV */
nav {
  background: var(--azul);
  padding: 0 2rem;
  display: flex; align-items: center; gap: 0;
  box-shadow: 0 3px 10px rgba(0,0,0,.25);
  position: sticky; top: 0; z-index: 100;
}
.nav-brand {
  color: #fff; font-weight: 700; font-size: 1rem;
  padding: 1rem 1.5rem 1rem 0;
  border-right: 1px solid rgba(255,255,255,.15);
  margin-right: 1rem; white-space: nowrap;
  text-decoration: none; display: flex; align-items: center; gap: .5rem;
}
.nav-brand .sigla { color: var(--ambar-l); font-size: 1.1rem; }
.nav-links { display: flex; gap: .1rem; }
.nav-links a {
  color: rgba(255,255,255,.75); text-decoration: none;
  padding: .85rem 1.1rem; font-size: .88rem; font-weight: 500;
  border-radius: 6px; transition: all .2s; white-space: nowrap;
}
.nav-links a:hover, .nav-links a.active { color:#fff; background: rgba(255,255,255,.12); }
.nav-links a.active { color: var(--ambar-l); }
.nav-right { margin-left: auto; padding-left: 1rem; }
.btn-portal {
  padding: 4px 12px; border: 1px solid #c9a84c; border-radius: 4px;
  color: #c9a84c; text-decoration: none; font-size: .9em; white-space: nowrap;
  transition: all .2s;
}
.btn-portal:hover { background: rgba(201,168,76,.15); }

/* HERO */
.hero {
  background: linear-gradient(135deg, var(--azul) 0%, var(--azul-m) 60%, #1a4a7a 100%);
  color: #fff; padding: 3.5rem 2rem 3rem; position: relative; overflow: hidden;
}
.hero::after {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-inner { max-width: 960px; margin: 0 auto; position: relative; z-index:1; }
.hero h1 { font-size: 1.9rem; font-weight: 800; margin-bottom: .4rem; }
.hero h1 em { font-style:normal; color: var(--ambar-l); }
.hero p { color: rgba(255,255,255,.75); font-size: .95rem; }
.hero-sm { padding: 1.5rem 2rem; }
.hero-sm h1 { font-size: 1.4rem; }
.breadcrumb { opacity:.65; font-size:.85rem; margin-bottom:.3rem; }
.breadcrumb a { color:rgba(255,255,255,.7); text-decoration:none; }

/* CONTENIDO */
.contenido { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

/* CARDS */
.cards { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fill, minmax(210px,1fr)); margin-bottom: 2rem; }
.card {
  background: var(--bg-card); border: 1px solid var(--borde);
  border-radius: var(--radius); padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--ambar), var(--ambar-l));
}
.card-num { font-size: 2.2rem; font-weight: 800; color: var(--azul); line-height: 1; }
.card-label { font-size: .8rem; color: var(--muted); margin-top: .3rem; text-transform: uppercase; letter-spacing: .05em; }
.card-sub { font-size: .82rem; color: var(--muted); margin-top: .15rem; }

/* TABLA */
.tabla-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); }
table.data-table { width: 100%; border-collapse: collapse; background: var(--bg-card); font-size: .875rem; }
table.data-table thead tr { background: var(--azul); color: #fff; }
table.data-table thead th { padding: .75rem 1rem; text-align: left; font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
table.data-table tbody tr { border-bottom: 1px solid var(--borde); transition: background .15s; }
table.data-table tbody tr:hover { background: #EEF4FF; }
table.data-table tbody td { padding: .65rem 1rem; vertical-align: top; }
table.data-table tbody td a { color: var(--azul-l); text-decoration: none; font-weight: 600; }
table.data-table tbody td a:hover { color: var(--ambar); text-decoration: underline; }

/* BADGES */
.badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: .2rem .6rem; border-radius: 20px; white-space: nowrap; }
.badge-gob { background: #DBEAFE; color: #1E40AF; }
.badge-hac { background: #D1FAE5; color: #065F46; }
.badge-op  { background: #FEF3C7; color: #92400E; }

/* BUSCADOR */
.search-box {
  background: var(--bg-card); border: 1px solid var(--borde);
  border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); margin-bottom: 1.5rem;
}
.search-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); }
.form-group { display: flex; flex-direction: column; gap: .4rem; }
.form-group label { font-size: .78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.form-group input, .form-group select {
  padding: .55rem .8rem; border: 1px solid var(--borde); border-radius: 6px;
  font-size: .9rem; background: var(--bg); color: var(--texto); transition: border-color .2s, box-shadow .2s;
}
.form-group input:focus, .form-group select:focus {
  outline: none; border-color: var(--azul-l); box-shadow: 0 0 0 3px rgba(59,110,176,.15);
}

/* BOTONES */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .6rem 1.3rem;
       border: none; border-radius: 6px; cursor: pointer; font-size: .88rem; font-weight: 600;
       text-decoration: none; transition: all .2s; }
.btn-primary { background: var(--azul); color: #fff; }
.btn-primary:hover { background: var(--azul-m); }
.btn-amber  { background: var(--ambar); color: #fff; }
.btn-amber:hover { background: #b07208; }
.btn-outline { background: transparent; color: var(--azul); border: 1.5px solid var(--borde); }
.btn-outline:hover { border-color: var(--azul-l); background: #EEF4FF; }
.btn-sm { padding: .35rem .8rem; font-size: .8rem; }

/* PAGINACIÓN */
.paginacion { display: flex; gap: .5rem; justify-content: center; margin-top: 1.5rem; flex-wrap: wrap; }
.paginacion button {
  padding: .45rem .9rem; border: 1px solid var(--borde); background: var(--bg-card);
  border-radius: 6px; cursor: pointer; font-size: .85rem; color: var(--azul); font-weight: 600; transition: all .2s;
}
.paginacion button:hover { background: #EEF4FF; border-color: var(--azul-l); }
.paginacion button.activa { background: var(--azul); color: #fff; border-color: var(--azul); }

/* INFO / MISC */
.res-info { font-size: .83rem; color: var(--muted); margin-bottom: .75rem; }
.res-info strong { color: var(--texto); }
.sec-title { font-size: 1.05rem; font-weight: 700; color: var(--azul); margin-bottom: 1rem;
             display: flex; align-items: center; gap: .6rem; }
.sec-title::after { content:''; flex:1; height:1px; background: var(--borde); }
.tag { display:inline-block; background:#EEF4FF; color:var(--azul-m); font-size:.72rem; font-weight:600; padding:.15rem .55rem; border-radius:4px; }
.empty { text-align:center; padding:3rem; color:var(--muted); }

/* DETALLE */
.detalle-grid { display: grid; gap: 1.5rem; grid-template-columns: 1fr 320px; }
.detalle-main { background: var(--bg-card); border: 1px solid var(--borde); border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow); }
.detalle-side { background: var(--bg-card); border: 1px solid var(--borde); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); height: fit-content; }
.campo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.campo { display: flex; flex-direction: column; gap: .2rem; }
.campo-label { font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.campo-valor { font-size: .95rem; color: var(--texto); }
.ley-num { font-size: 2.8rem; font-weight: 900; color: var(--azul); line-height: 1; }

/* BARRAS */
.bar-item { display: flex; align-items: center; gap: .7rem; margin-bottom: .5rem; font-size: .85rem; }
.bar-label { min-width: 200px; color: var(--texto); }
.bar-track { flex: 1; background: var(--borde); border-radius: 20px; height: 10px; }
.bar-fill { height: 10px; border-radius: 20px; background: linear-gradient(90deg, var(--azul), var(--azul-l)); }
.bar-val { min-width: 40px; text-align: right; font-weight: 700; color: var(--azul); }

/* LOADING */
#loading { display:none; text-align:center; padding:2rem; color:var(--muted); }
.spinner { display:inline-block; width:28px; height:28px; border:3px solid var(--borde);
           border-top-color:var(--azul); border-radius:50%; animation:spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* FOOTER */
footer { background: var(--azul); color: rgba(255,255,255,.55); text-align:center; padding:1.2rem; font-size:.78rem; }
footer strong { color: rgba(255,255,255,.85); }

@media(max-width:700px) {
  .detalle-grid { grid-template-columns: 1fr; }
  .campo-grid   { grid-template-columns: 1fr; }
  .nav-links a  { padding: .85rem .7rem; font-size:.8rem; }
  .nav-right    { display: none; }
}
