:root{
  --bg-main:#f0f4f8;
  --bg-card:#ffffff;
  --primary:#0d1b2a;
  --accent:#1b9aaa;
  --accent-light:#8ecae6;
  --text:#020c1b;
  --muted:#415a77;
  --header-h:58px;
}

body{
  background:var(--bg-main);
  color:var(--text);
  font-family:"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  padding-top:var(--header-h);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* HEADER */
.top-header{
  min-height:var(--header-h);
  background:var(--primary);
  color:#fff;
  position:fixed;
  top:0;left:0;right:0;
  z-index:1030;
  box-shadow:0 2px 6px rgba(0,0,0,.18);
}

.top-header .navbar{
  min-height:var(--header-h);
  padding:.35rem 1rem;
}

.top-header .navbar-brand{
  display:flex;
  align-items:center;
  font-size:1.05rem;
  font-weight:600;
  letter-spacing:.5px;
}

.top-header .navbar-toggler:focus{
  box-shadow:none;
}

.brand{font-size:1.15rem;font-weight:600;letter-spacing:.5px;}

/* BOTONES HEADER */
.btn-header{
  font-size:.9rem;
  padding:.35rem .7rem;
  margin-left:.25rem;
  white-space:nowrap;
}

.btn-header:focus-visible{
  outline:2px solid #fff;
  outline-offset:2px;
}

/* En móvil, el menú colapsable se apila sobre el fondo del header */
@media (max-width: 991.98px){
  .top-header{height:auto;}
  .top-header .navbar-collapse{
    background:var(--primary);
    border-radius:.45rem;
    margin-top:.5rem;
    padding:.5rem;
  }
  .btn-header{width:100%;margin-left:0;}
}

/* CARDS & UI COMPONENTS */
.ui-card{
  border:none;
  border-radius:.85rem;
  background:var(--bg-card);
  box-shadow:0 5px 14px rgba(11,19,43,.07);
  overflow:hidden;
}

.ui-header{
  background:linear-gradient(135deg,var(--primary),var(--accent));
  color:#fff;
  border-radius:.85rem .85rem 0 0;
  padding:.8rem 1rem;
}

.ui-header h6{font-size:.9rem;margin:0;}

.btn-primary{
  background:var(--accent);
  border:none;
  border-radius:.45rem;
  font-size:.8rem;
}

.btn-primary:hover{background:#147a8b}

.btn-outline-primary{
  color:var(--accent);
  border-color:var(--accent);
  border-radius:.45rem;
  font-size:.8rem;
}

.btn-outline-primary:hover{
  background:var(--accent);border-color:var(--accent);color:#fff;
}

.form-control, .form-select{
  border-radius:.4rem;
  border:1px solid #c1d1e9;
  font-size:.85rem;
}

.form-control:focus, .form-select:focus{
  border-color:var(--accent-light);
  box-shadow:0 0 0 .12rem rgba(139,202,230,.35);
}

.icon-bg{
  background:var(--accent);
  color:#fff;
  border-radius:.4rem 0 0 .4rem;
}

small{color:var(--muted);font-size:.75rem;}

/* LAYOUT */
footer {
    flex-shrink: 0;
}

.main-content {
    flex: 1 0 auto;
}

/* BOTÓN FLOTANTE CAPTURA (si se usa) */
#btnJpg{
  position:fixed;
  bottom:1rem;right:1rem;
  z-index:1040;
  font-size:.7rem;
}

/* RESPONSIVE */
@media (max-width:576px){
  .ui-header{padding:.6rem .8rem;}
  .card-body.p-3{padding:.5rem !important;}
}

/* TABLAS CON CABECERA FIJA */
.table-sticky thead th{
  position:sticky;
  top:0;
  background:#fff;
  box-shadow:inset 0 -1px 0 rgba(13,27,42,.1);
  z-index:1;
}

.table-sticky tbody tr{vertical-align:middle;}

/* ICONOS DE PÁGINAS DE ESTADO / ERROR */
.error-icon{font-size:5rem;line-height:1;}
.error-icon-lg{font-size:3rem;}
.icon-display{font-size:2.5rem;}

/* TOASTS */
.toast-container{z-index:2005;}

/* KPI DASHBOARD */
.stat-card .stat-value{font-size:1.9rem;font-weight:700;}
.stat-card .stat-label{font-size:.8rem;color:var(--muted);}
.stat-meta{font-size:.7rem;}

/* LEYENDAS DE PRIORIDAD / ESTADO */
.legend{
  margin-bottom:1rem;
  display:flex;
  flex-wrap:wrap;
  gap:.5rem;
}

.legend-item{
  display:inline-flex;
  align-items:center;
  gap:.35rem;
  font-size:.78rem;
  color:var(--muted);
}

.legend-badge{min-width:80px;}

/* FOCO VISIBLE ACCESIBLE EN TABLAS */
.table a:focus-visible,
.table button:focus-visible{
  outline:2px solid var(--accent);
  outline-offset:2px;
}

/* Mensajes flash */
.vi-messages .alert{
  border-radius:.6rem;
}

/* Botonera de tablas en móvil muy pequeño */
@media (max-width:576px){
  .btn-group-sm .btn{font-size:.8rem;padding:.3rem .45rem;}
}
