/* ============================================================
   UPED — Sistema Plan de Trabajo Anual
   Identidad visual institucional
   Colores: #00123D (azul marino) | #FDA508 (dorado) | #F9F9F9 (gris claro)
   ============================================================ */

:root {
  --azul:     #00123D;
  --azul-md:  #002266;
  --azul-lt:  #0a2d6e;
  --dorado:   #FDA508;
  --dorado-lt:#febb3a;
  --gris-bg:  #F9F9F9;
  --gris-bd:  #dee2e6;
  --gris-txt: #6c757d;
  --blanco:   #ffffff;
  --verde:    #198754;
  --amarillo: #ffc107;
  --rojo:     #dc3545;
  --verde-lt: #d1e7dd;
  --amarillo-lt:#fff3cd;
  --rojo-lt:  #f8d7da;
  --sidebar-w:260px;
  --topbar-h: 60px;
  --shadow:   0 2px 12px rgba(0,18,61,.12);
  --radius:   10px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; overflow-x: hidden; font-size: 15px; }
body { height: 100%; overflow-x: hidden;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--gris-bg);
  color: #1a1a2e;
  line-height: 1.6;
}

/* ─── LOGIN ─── */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--azul) 0%, var(--azul-lt) 100%);
  padding: 1rem;
}
.login-card {
  background: var(--blanco);
  border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(0,18,61,.35);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
}
.login-logo {
  display: block;
  margin: 0 auto 1.5rem;
  max-width: 220px;
  height: auto;
}
.login-title {
  color: var(--azul);
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.25rem;
}
.login-sub {
  color: var(--gris-txt);
  font-size: .85rem;
  text-align: center;
  margin-bottom: 1.8rem;
}
.login-footer {
  color: var(--gris-txt);
  font-size:.75rem;
  text-align:center;
  margin-top:1.5rem;
}

/* ─── LAYOUT PRINCIPAL ─── */
.layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
  position: relative;
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  background: var(--azul);
  color: var(--blanco);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 1000;
  transition: transform .3s ease;
  overflow-y: auto;
}
.sidebar-brand {
  padding: 1rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
  text-align: center;
}
.sidebar-brand img {
  max-width: 160px;
  height: auto;
}
.sidebar-brand .brand-text {
  font-size: .7rem;
  color: rgba(255,255,255,.65);
  margin-top: .4rem;
  line-height: 1.3;
}
.sidebar-user {
  padding: .75rem 1rem;
  background: rgba(255,255,255,.06);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-user .user-name {
  font-size: .8rem;
  font-weight: 600;
  color: var(--dorado);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user .user-rol {
  font-size: .7rem;
  color: rgba(255,255,255,.6);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.sidebar-user .user-unidad {
  font-size: .7rem;
  color: rgba(255,255,255,.5);
}

nav.sidebar-nav { flex: 1; padding: .5rem 0; }
.nav-section {
  padding: .5rem 1rem .25rem;
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.4);
  font-weight: 600;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem 1rem;
  color: rgba(255,255,255,.8);
  text-decoration: none;
  font-size: .88rem;
  transition: background .2s, color .2s, padding-left .2s;
  border-left: 3px solid transparent;
}
.nav-link:hover {
  background: rgba(255,255,255,.08);
  color: var(--blanco);
  padding-left: 1.2rem;
}
.nav-link.active {
  background: rgba(253,165,8,.12);
  color: var(--dorado);
  border-left-color: var(--dorado);
  font-weight: 600;
}
.nav-link .icon { font-size: 1rem; width: 1.2rem; text-align: center; }
.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255,255,255,.1);
}
.sidebar-footer .logout-btn {
  display: flex; align-items: center; gap: .5rem;
  color: rgba(255,255,255,.6);
  text-decoration: none;
  font-size: .85rem;
  transition: color .2s;
}
.sidebar-footer .logout-btn:hover { color: var(--rojo); }

/* TOPBAR */
.topbar {
  position: fixed;
  top: 0; left: var(--sidebar-w); right: 0;
  height: var(--topbar-h);
  background: var(--azul);
  color: var(--blanco);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 900;
  box-shadow: 0 2px 8px rgba(0,18,61,.3);
}
.topbar-title { font-size: 1rem; font-weight: 600; color: var(--blanco); }
.topbar-badge {
  background: var(--dorado);
  color: var(--azul);
  font-size: .7rem;
  font-weight: 700;
  padding: .15rem .5rem;
  border-radius: 20px;
}
.hamburger {
  display: none;
  background: none; border: none;
  color: var(--blanco); font-size: 1.3rem;
  cursor: pointer; padding: .3rem;
}

/* MAIN CONTENT */
.main {
  flex: 1 1 0%;
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  padding: 1.5rem;
  min-height: calc(100vh - var(--topbar-h));
  min-width: 0;
  overflow-x: hidden;
  width: calc(100vw - var(--sidebar-w));
}
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem; flex-wrap: wrap; gap: .75rem;
}
.page-title {
  font-size: 1.25rem; font-weight: 700; color: var(--azul);
  display: flex; align-items: center; gap: .5rem;
}
.page-title .icon { color: var(--dorado); }

/* ─── CARDS ─── */
.card {
  background: var(--blanco);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.card-header {
  background: var(--azul);
  color: var(--blanco);
  padding: .85rem 1.25rem;
  font-weight: 600;
  font-size: .95rem;
  display: flex; align-items: center; justify-content: space-between;
}
.card-header.dorado { background: var(--dorado); color: var(--azul); }
.card-header.gris { background: #f0f2f5; color: var(--azul); }
.card-body { padding: 1.25rem; }

/* ─── STAT CARDS (dashboard) ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.stat-card {
  background: var(--blanco);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.2rem 1rem;
  display: flex; align-items: center; gap: 1rem;
  border-left: 4px solid var(--azul);
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(0,18,61,.18); }
.stat-card.dorado { border-left-color: var(--dorado); }
.stat-card.verde  { border-left-color: var(--verde); }
.stat-card.amarillo { border-left-color: var(--amarillo); }
.stat-card.rojo   { border-left-color: var(--rojo); }
.stat-icon {
  width: 52px; height: 52px; min-width: 52px;
  border-radius: 14px;
  background: rgba(0,18,61,.07);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.35rem;
}
.stat-card.dorado   .stat-icon { background: rgba(253,165,8,.12); }
.stat-card.verde    .stat-icon { background: rgba(25,135,84,.1); }
.stat-card.amarillo .stat-icon { background: rgba(255,193,7,.12); }
.stat-card.rojo     .stat-icon { background: rgba(220,53,69,.1); }
.stat-value { font-size: 1.7rem; font-weight: 700; color: var(--azul); line-height: 1; }
.stat-label { font-size: .78rem; color: var(--gris-txt); margin-top: .15rem; }

/* ─── PROGRESS BAR ─── */
.progress {
  height: 10px; border-radius: 5px;
  background: var(--gris-bd); overflow: hidden;
}
.progress-bar {
  height: 100%; border-radius: 5px;
  background: var(--azul);
  transition: width .4s ease;
}
.progress-bar.verde   { background: var(--verde); }
.progress-bar.amarillo { background: var(--amarillo); }
.progress-bar.rojo    { background: var(--rojo); }

/* ─── SEMAFORO BADGES ─── */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .25rem .65rem;
  border-radius: 20px;
  font-size: .76rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-verde    { background: var(--verde-lt);    color: #0a3622; }
.badge-amarillo { background: var(--amarillo-lt); color: #664d03; }
.badge-rojo     { background: var(--rojo-lt);     color: #58151c; }
.badge-azul     { background: #dce8ff;            color: var(--azul); }
.badge-gris     { background: #e9ecef;            color: #495057; }
.semaforo-dot   { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-verde    { background: var(--verde); }
.dot-amarillo { background: var(--amarillo); }
.dot-rojo     { background: var(--rojo); }
.dot-gris     { background: #adb5bd; }

/* ─── TABLA ─── */
.table-wrap { overflow-x: auto; }
table.tabla {
  width: 100%; border-collapse: collapse;
  font-size: .88rem;
}
.tabla th {
  background: var(--azul); color: var(--blanco);
  padding: .7rem .9rem; text-align: left;
  font-weight: 600; font-size: .82rem;
  white-space: nowrap;
}
.tabla td {
  padding: .65rem .9rem;
  border-bottom: 1px solid var(--gris-bd);
  vertical-align: middle;
}
.tabla tr:hover td { background: #f0f4ff; }
.tabla tr:last-child td { border-bottom: none; }

/* ─── FORMULARIOS ─── */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block; font-weight: 600; font-size: .88rem;
  color: var(--azul); margin-bottom: .35rem;
}
.form-label .req { color: var(--rojo); }
.form-control {
  width: 100%; padding: .55rem .85rem;
  border: 1.5px solid var(--gris-bd);
  border-radius: 6px; font-size: .9rem;
  transition: border-color .2s, box-shadow .2s;
  background: var(--blanco);
}
.form-control:focus {
  outline: none;
  border-color: var(--azul);
  box-shadow: 0 0 0 3px rgba(0,18,61,.1);
}
.form-row { display: grid; gap: 1rem; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-hint { font-size: .78rem; color: var(--gris-txt); margin-top: .25rem; }
.form-error { font-size: .78rem; color: var(--rojo); margin-top: .25rem; }

/* ─── BOTONES ─── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1.1rem; border-radius: 6px;
  font-size: .88rem; font-weight: 600;
  cursor: pointer; text-decoration: none;
  border: none; transition: all .2s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--azul); color: var(--blanco);
}
.btn-primary:hover { background: var(--azul-lt); color: var(--blanco); }
.btn-secondary {
  background: var(--dorado); color: var(--azul);
}
.btn-secondary:hover { background: var(--dorado-lt); }
.btn-outline {
  background: transparent; color: var(--azul);
  border: 1.5px solid var(--azul);
}
.btn-outline:hover { background: var(--azul); color: var(--blanco); }
.btn-danger  { background: var(--rojo);  color: var(--blanco); }
.btn-danger:hover  { background: #b02a37; }
.btn-success { background: var(--verde); color: var(--blanco); }
.btn-success:hover { background: #146c43; }
.btn-sm { padding: .3rem .7rem; font-size: .8rem; }
.btn-icon { padding: .4rem .55rem; }
.btn-group { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ─── ALERTAS ─── */
.alert {
  padding: .85rem 1.1rem; border-radius: 6px;
  font-size: .9rem; margin-bottom: 1rem;
  display: flex; align-items: flex-start; gap: .6rem;
}
.alert-success { background: var(--verde-lt);    color: #0a3622; border-left: 4px solid var(--verde); }
.alert-warning { background: var(--amarillo-lt); color: #664d03; border-left: 4px solid var(--amarillo); }
.alert-danger  { background: var(--rojo-lt);     color: #58151c; border-left: 4px solid var(--rojo); }
.alert-info    { background: #dce8ff;            color: var(--azul); border-left: 4px solid var(--azul); }

/* ─── CHECKLIST ─── */
.checklist { list-style: none; }
.checklist li {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .55rem .75rem;
  border-radius: 6px; cursor: pointer;
  transition: background .15s;
}
.checklist li:hover { background: #f0f4ff; }
.checklist li.completado { opacity: .65; }
.checklist li.completado .item-text { text-decoration: line-through; color: var(--gris-txt); }
.check-btn {
  width: 22px; height: 22px; min-width: 22px;
  border-radius: 50%; border: 2px solid var(--gris-bd);
  background: var(--blanco); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s; font-size: .75rem;
}
.check-btn.checked {
  background: var(--verde); border-color: var(--verde);
  color: var(--blanco);
}
.checklist-sub { margin-left: 2rem; border-left: 2px solid var(--gris-bd); padding-left: .75rem; }
.avance-proyecto {
  background: var(--azul);
  color: var(--blanco);
  border-radius: 8px;
  padding: .75rem 1rem;
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: .75rem;
}
.avance-pct { font-size: 1.8rem; font-weight: 800; }
.avance-label { font-size: .8rem; opacity: .8; }

/* ─── FILTROS / SEARCH ─── */
.filters {
  display: flex; gap: .75rem; align-items: center;
  flex-wrap: wrap; margin-bottom: 1rem;
}
.filter-select, .filter-input {
  padding: .4rem .7rem; border: 1.5px solid var(--gris-bd);
  border-radius: 6px; font-size: .87rem; background: var(--blanco);
}

/* ─── MODAL ─── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,18,61,.55);
  z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-box {
  background: var(--blanco);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,18,61,.4);
  width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
}
.modal-header {
  background: var(--azul); color: var(--blanco);
  padding: 1rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between;
  border-radius: var(--radius) var(--radius) 0 0;
}
.modal-close {
  background: none; border: none; color: var(--blanco);
  font-size: 1.2rem; cursor: pointer; opacity: .7;
}
.modal-close:hover { opacity: 1; }
.modal-body { padding: 1.25rem; }
.modal-footer {
  padding: .85rem 1.25rem;
  border-top: 1px solid var(--gris-bd);
  display: flex; justify-content: flex-end; gap: .5rem;
}

/* ─── BREADCRUMB ─── */
.breadcrumb {
  display: flex; align-items: center; gap: .4rem;
  font-size: .82rem; color: var(--gris-txt);
  margin-bottom: .75rem;
}
.breadcrumb a { color: var(--azul); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { color: var(--gris-bd); }

/* ─── ESTADOS PLAN ─── */
.estado-chip {
  padding: .2rem .6rem; border-radius: 20px;
  font-size: .75rem; font-weight: 700; text-transform: uppercase;
}
.estado-borrador  { background: #e9ecef; color: #495057; }
.estado-enviado   { background: #dce8ff; color: var(--azul); }
.estado-revisado  { background: var(--amarillo-lt); color: #664d03; }
.estado-aprobado  { background: var(--verde-lt); color: #0a3622; }
.estado-observado { background: var(--rojo-lt); color: #58151c; }

/* ─── RESPONSIVE ─── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .topbar { left: 0; }
  .main { margin-left: 0; }
  .hamburger { display: block; }
  .form-row.cols-2,
  .form-row.cols-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 500px) {
  .stats-grid { grid-template-columns: 1fr; }
  .main { padding: 1rem; }
}


/* ── LOGO REAL EN LOGIN ─────────────────────────────── */
.login-logo {
  display: block;
  margin: 0 auto 1.5rem;
  max-width: 240px;
  max-height: 100px;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* ── LOGO EN SIDEBAR ────────────────────────────────── */
.sidebar-brand img {
  max-width: 170px;
  max-height: 70px;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* ── STAT CARDS mejoradas ────────────────────────────── */
.stat-card {
  background: var(--blanco);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.1rem;
  display: flex; align-items: center; gap: .9rem;
  border-left: 4px solid var(--azul);
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 6px 24px rgba(0,18,61,.16); }
.stat-value { font-size: 1.8rem; font-weight: 800; color: var(--azul); line-height: 1; }
.stat-label { font-size: .77rem; color: var(--gris-txt); margin-top: .2rem; letter-spacing: .01em; }




/* ═══════════════════════════════════════════════════════
   RESPONSIVE SYSTEM — UPED PTA
   Breakpoints: xl>1200 | md<1100 | sm<900 | xs<700 | xxs<480
   ═══════════════════════════════════════════════════════ */

/* ── Grid helpers ─────────────────────────────────── */
.grid-6col { display:grid; grid-template-columns:repeat(6,1fr); gap:.85rem; width:100%; }
.grid-3col { display:grid; grid-template-columns:repeat(3,1fr); gap:1.1rem;  width:100%; }
.grid-2col { display:grid; grid-template-columns:1fr 1fr;       gap:1.1rem;  width:100%; }
.grid-ejes { display:grid; gap:.85rem; width:100%; }

/* ── Overlay sidebar mobile ───────────────────────── */
.sidebar-overlay {
  display:none; position:fixed; inset:0;
  background:rgba(0,0,0,.45); z-index:1049;
}
.sidebar-overlay.active { display:block; }

/* ── Dashboard badge extra ────────────────────────── */
.badge-azul { background:rgba(0,18,61,.1); color:var(--azul); }

/* ────────────────────────────────────────────────────
   xl → md  (1200 → 1100px)
   ──────────────────────────────────────────────────── */
@media (max-width:1200px) {
  .grid-6col { grid-template-columns:repeat(3,1fr); }
}
@media (max-width:1100px) {
  .grid-3col { grid-template-columns:1fr 1fr; }
  .grid-ejes { grid-template-columns:1fr 1fr !important; }
}

/* ────────────────────────────────────────────────────
   md → sm  (1100 → 900px)
   ──────────────────────────────────────────────────── */
@media (max-width:900px) {
  /* Sidebar slide-in */
  .sidebar {
    transform: translateX(-100%);
    top: var(--topbar-h);
    height: calc(100vh - var(--topbar-h));
    z-index:1050;
    box-shadow: none;
    transition: transform .3s cubic-bezier(.4,0,.2,1);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 6px 0 30px rgba(0,0,0,.35);
  }

  /* Main ocupa todo el ancho */
  .main {
    margin-left: 0 !important;
    width: 100% !important;
    padding: 1rem !important;
  }

  /* Topbar ocupa todo el ancho */
  .topbar { left:0 !important; right:0 !important; }

  /* Hamburger visible */
  .hamburger { display:flex !important; align-items:center; }

  /* Grids */
  .grid-2col { grid-template-columns:1fr !important; }
}

/* ────────────────────────────────────────────────────
   sm → xs  (900 → 700px)
   ──────────────────────────────────────────────────── */
@media (max-width:700px) {
  .grid-6col { grid-template-columns:repeat(2,1fr) !important; }
  .grid-3col { grid-template-columns:1fr !important; }
  .grid-ejes { grid-template-columns:1fr !important; }

  /* Tablas con scroll */
  .table-wrap { overflow-x:auto; -webkit-overflow-scrolling:touch; }
  .tabla { min-width:500px; }
  .tabla th, .tabla td { padding:.4rem .5rem; font-size:.77rem; }

  /* Charts */
  .card-body[style*="height:240px"] { height:auto !important; min-height:200px; }
}

/* ────────────────────────────────────────────────────
   xs → xxs  (700 → 480px)
   ──────────────────────────────────────────────────── */
@media (max-width:480px) {
  .main { padding:.75rem !important; }
  .grid-6col { grid-template-columns:1fr 1fr !important; }

  .card-header { padding:.6rem .8rem; font-size:.85rem; }
  .card-body   { padding:.65rem; }

  .page-header { flex-direction:column; align-items:flex-start; gap:.5rem; }
  .page-title  { font-size:1rem; }

  .btn { font-size:.78rem; padding:.3rem .65rem; }
  .btn-group { flex-wrap:wrap; gap:.3rem; }

  .topbar-title { font-size:.82rem; }
  .topbar-badge { font-size:.72rem; padding:.15rem .45rem; }

  .login-card  { padding:1.5rem 1rem; margin:.5rem; }
  .login-logo  { max-width:140px; }
  .login-title { font-size:1rem; }

  canvas { max-height:180px !important; }
}

/* ─── Formularios responsivos ─────────────────────── */
@media (max-width:700px) {
  .form-row { grid-template-columns:1fr !important; }
  .breadcrumb { font-size:.75rem; flex-wrap:wrap; }
}
