* { margin: 0; padding: 0; box-sizing: border-box; }

body, html {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  background: #f0f4f8;
  color: #2d4a62;
  height: 100%;
  overflow: hidden;
}

#splash {
  position: fixed;
  inset: 0;
  background: linear-gradient(160deg, #1a3a5c 0%, #1e4d7b 50%, #1a5f8a 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  z-index: 9999;
  transition: opacity 0.6s ease;
}
#splash.oculto { opacity: 0; pointer-events: none; }
#splash .icono { font-size: 64px; margin-bottom: 8px; }
#splash h1 { font-size: 28px; font-weight: 500; color: #ffffff; letter-spacing: 0.02em; }
#splash .subtitulo { font-size: 13px; color: rgba(255,255,255,0.55); }
#splash .autor { font-size: 11px; color: rgba(255,255,255,0.35); margin-top: 16px; letter-spacing: 0.04em; }
#splash .barra-contenedor { position: absolute; bottom: 0; left: 0; right: 0; height: 4px; background: rgba(255,255,255,0.1); }
#splash .barra-progreso { height: 100%; width: 0%; background: rgba(100,180,255,0.7); border-radius: 2px; transition: width 0.4s ease; }

#app { display: flex; flex-direction: column; height: 100%; }
#app.oculto { display: none; }

.menubar {
  background: #2c7bb6;
  display: flex;
  align-items: center;
  height: 36px;
  padding: 0 10px;
  gap: 2px;
  flex-shrink: 0;
}
.menubar .menu-item {
  font-size: 13px;
  color: rgba(255,255,255,0.95);
  padding: 5px 14px;
  border-radius: 4px;
  cursor: pointer;
  border: none;
  background: transparent;
  height: 28px;
  font-weight: 400;
}
.menubar .menu-item:hover { background: rgba(255,255,255,0.18); }

.toolbar {
  background: #e8f0f7;
  border-bottom: 1px solid #c5d5e8;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}
.tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 14px;
  border-radius: 5px;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  min-width: 64px;
}
.tool-btn:hover { background: rgba(44,123,182,0.12); border-color: rgba(44,123,182,0.3); }
.tool-btn.activo { background: rgba(44,123,182,0.15); border-color: rgba(44,123,182,0.4); }
.tool-btn .icono-tool { font-size: 28px; color: #2c6fa0; }
.tool-btn span { font-size: 11px; color: #4a6a88; font-weight: 500; }
.tool-sep { width: 1px; height: 44px; background: #c5d5e8; margin: 0 4px; }

/* CONTENIDO: ocupa todo el espacio restante */
.contenido {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* PANEL DE INICIO */
#panel-inicio {
  position: absolute;
  inset: 0;
  display: flex;
  overflow: hidden;
}
#panel-inicio.oculto { display: none; }

.home-layout { display: flex; flex: 1; overflow: hidden; }
.home-main { flex: 1; display: flex; flex-direction: column; padding: 16px 20px 10px; overflow-y: auto; }
.home-topbar { background: #1e3a52; border-radius: 8px; padding: 11px 16px; display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.home-logo-circle { width: 36px; height: 36px; background: #f0a500; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #1e3a52; font-size: 12px; flex-shrink: 0; }
.home-top-title { color: #fff; font-size: 14px; font-weight: 700; line-height: 1.2; }
.home-top-sub { color: rgba(255,255,255,0.6); font-size: 10px; margin-top: 2px; }
.home-top-archivo { color: #f0a500; font-size: 11px; font-weight: 600; margin-left: auto; white-space: nowrap; }
.home-section-label { font-size: 10px; font-weight: 700; color: #7a9ab8; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.home-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.home-card { background: #fff; border: 1.5px solid #e0eaf2; border-radius: 10px; padding: 14px 12px; display: flex; align-items: center; gap: 12px; cursor: pointer; transition: border-color 0.15s; }
.home-card:hover { border-color: #2c7bb6; background: #f7fbff; }
.home-card-primary { border-color: #2c7bb6; background: #f0f7ff; }
.home-card-accent { border-color: #f0a500; background: #fffbf0; }
.home-card-title { font-size: 12px; font-weight: 700; color: #1e3a52; line-height: 1.3; }
.home-card-desc { font-size: 10px; color: #7a9ab8; margin-top: 2px; line-height: 1.4; }
.home-icon-wrap { width: 46px; height: 46px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.home-icon-blue { background: #dbeafe; }
.home-icon-green { background: #dcfce7; }
.home-icon-purple { background: #ede9fe; }
.home-icon-teal { background: #ccfbf1; }
.home-icon-orange { background: #fff3cd; }
.home-footer { margin-top: auto; padding-top: 12px; text-align: center; font-size: 10px; color: #aac0d4; border-top: 1px solid #e0eaf2; }
.home-footer strong { color: #7a9ab8; }

.panel-recientes {
  width: 220px;
  background: #f7fafc;
  border-left: 1px solid #d0dde8;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  flex-shrink: 0;
}
.recientes-titulo { font-size: 10px; color: #7a9ab8; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.reciente-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 5px;
  cursor: pointer;
  background: white;
  border: 0.5px solid #d0dde8;
}
.reciente-item:hover { border-color: #2c7bb6; }
.reciente-item .icono-rec { font-size: 20px; color: #e8a020; flex-shrink: 0; margin-top: 1px; }
.reciente-nombre { font-size: 11px; color: #2d4a62; font-weight: 500; line-height: 1.3; }
.reciente-ruta { font-size: 9px; color: #8aacc8; margin-top: 2px; }
.recientes-vacio { font-size: 11px; color: #aac0d4; text-align: center; margin-top: 20px; }

.statusbar {
  background: #dce8f2;
  border-top: 1px solid #c5d5e8;
  height: 22px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  flex-shrink: 0;
}
.status-txt { font-size: 10px; color: #5a7a98; }
.status-archivo { font-size: 11px; color: #fff; font-weight: 600; margin-left: 12px; opacity: 0.85; }
.status-autor { margin-left: auto; font-size: 10px; color: #8aaccb; }

/* Menu activo */
.menubar .menu-item.menu-activo {
  background: rgba(255,255,255,0.25);
  font-weight: 600;
}

.home-stat-card { background:#fff; border:1px solid #e0eaf2; border-radius:8px; padding:12px 10px; text-align:center; }
.home-stat-num { font-size:22px; font-weight:700; color:#1e3a52; line-height:1.2; }
.home-stat-lbl { font-size:10px; color:#7a9ab8; margin-top:3px; }

/* --- DASHBOARD EXTRA --- */
.home-grid-3 { grid-template-columns: repeat(3, 1fr); }
.home-icon-slate { background: #f1f5f9; }
.home-icon-demo  { background: #e0f2fe; }
.home-icon-info  { background: #dbeafe; }

.modal-overlay { position:fixed;inset:0;background:rgba(10,25,45,0.45);display:flex;align-items:center;justify-content:center;z-index:8000; }
.modal-overlay.oculto { display:none; }
.modal-box { background:#fff;border-radius:10px;box-shadow:0 8px 40px rgba(0,0,0,0.22);width:90%;max-width:540px;max-height:90vh;display:flex;flex-direction:column;overflow:hidden; }
.modal-box-sm { max-width:400px; }
.modal-header { background:#1e3a52;padding:12px 16px;display:flex;align-items:center;justify-content:space-between; }
.modal-titulo { color:#fff;font-size:13px;font-weight:700; }
.modal-cerrar { background:rgba(255,255,255,0.15);border:none;color:#fff;width:24px;height:24px;border-radius:4px;cursor:pointer;font-size:14px;line-height:1; }
.modal-cerrar:hover { background:rgba(255,255,255,0.3); }
.modal-body, html { overflow-y:auto; }
.demo-tabla { border-collapse:collapse;width:100%;font-size:10px; }
.demo-tabla th { background:#1e3a52;color:#fff;padding:5px 8px;text-align:center;font-weight:600; }
.demo-tabla td { border:1px solid #e0eaf2;padding:4px 6px;text-align:center;font-size:9.5px;font-weight:600;min-width:72px; }
.demo-tabla .mod-lbl { background:#f0f4f8;color:#5a7a98;font-weight:700;width:48px; }

/* --- SELECCION VISIBLE --- */
tr.seleccionado, .item-seleccionado, tr:focus, .tabla-datos tr.activo {
  background: #1a6bb5 !important;
  color: #fff !important;
}
.tabla-datos tr.activo td, .tabla-datos tr.seleccionado td {
  color: #fff !important;
}
::selection {
  background: #1a6bb5;
  color: #fff;
}

/* --- SELECCION VISIBLE GLOBAL --- */
::selection { background: #1a56a0; color: #fff; }
.tabla-datos tbody tr:hover { background: #dbeafe !important; cursor: pointer; }
.tabla-datos tbody tr.activo, .tabla-datos tbody tr.seleccionado { background: #1a56a0 !important; }
.tabla-datos tbody tr.activo td, .tabla-datos tbody tr.seleccionado td { color: #fff !important; }
.grupo-card.seleccionado { border-color: #1a56a0 !important; background: #dbeafe !important; }
.reciente-item.activo { border-color: #1a56a0 !important; background: #dbeafe !important; }

/* --- HOVER FILAS TABLAS --- */
.tabla-datos tbody tr:hover td { background: #1a56a0 !important; color: #fff !important; }
.tabla-datos tbody tr:hover .btn { color: #1a56a0; }
table tbody tr:hover td { background: #dbeafe; }

/* --- FILA SELECCIONADA (click) --- */
.tabla-datos tbody tr.seleccionado td { background: #1a56a0 !important; color: #fff !important; }
.tabla-datos tbody tr.seleccionado .btn { color: #1a56a0 !important; background: #fff !important; }
